[OLINGO-562] Merge branch 'master' into OLINGO-562_SpringExtension
diff --git a/dist/server-lib/src/main/resources/NOTICE b/dist/server-lib/src/main/resources/NOTICE
index 5264d78..5a87ef7 100644
--- a/dist/server-lib/src/main/resources/NOTICE
+++ b/dist/server-lib/src/main/resources/NOTICE
@@ -20,18 +20,6 @@
in some artifacts (usually source distributions); but is always available
from the source code management (SCM) system project uses.
-This distribution includes SLF4J
-Copyright (c) 2004-2013 QOS.ch
- All rights reserved.
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions.
- http://slf4j.org/license.html
-
This distribution includes TreeLayout Core (http://code.google.com/p/treelayout/)
Copyright (c) 2011, abego Software GmbH, Germany (http://www.abego.org)
All rights reserved.
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
index f8506c2..6a2d8ce 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
@@ -31,10 +31,10 @@
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.client.core.ODataClientFactory;
import org.apache.olingo.client.core.edm.ClientCsdlEdmProvider;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.apache.olingo.ext.proxy.api.AbstractTerm;
import org.apache.olingo.ext.proxy.api.PersistenceManager;
@@ -96,7 +96,7 @@
}
this.client = ODataClientFactory.getEdmEnabledClient(serviceRoot, edm, metadataETag);
- this.client.getConfiguration().setDefaultPubFormat(ODataFormat.JSON_FULL_METADATA);
+ this.client.getConfiguration().setDefaultPubFormat(ContentType.JSON_FULL_METADATA);
this.transactional = transactional;
this.context = new Context();
}
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ComplexCollection.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ComplexCollection.java
index a5ef9a1..e318491 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ComplexCollection.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ComplexCollection.java
@@ -21,7 +21,7 @@
import java.util.Collection;
public interface ComplexCollection<
- T extends StructuredType, EC extends Collection<T>, CT extends StructuredCollection<T, EC, ?>>
+ T extends StructuredType<?>, EC extends Collection<T>, CT extends StructuredCollection<T, EC, ?>>
extends StructuredCollection<T, EC, CT> {
//No additional methods needed for now.
}
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ComplexType.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ComplexType.java
index a60d0dd..ff38aa3 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ComplexType.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ComplexType.java
@@ -18,6 +18,6 @@
*/
package org.apache.olingo.ext.proxy.api;
-public interface ComplexType<T extends StructuredType> extends StructuredType<T> {
+public interface ComplexType<T extends StructuredType<?>> extends StructuredType<T> {
//No additional methods needed for now.
}
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityCollection.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityCollection.java
index 6c74c4c..9ff7fe5 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityCollection.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityCollection.java
@@ -21,7 +21,7 @@
import java.util.Collection;
public interface EntityCollection<
- T extends StructuredType, EC extends Collection<T>, CT extends StructuredCollection<T, EC, ?>>
+ T extends StructuredType<?>, EC extends Collection<T>, CT extends StructuredCollection<T, EC, ?>>
extends StructuredCollection<T, EC, CT> {
/**
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityType.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityType.java
index f0e3c5e..e68eab9 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityType.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/EntityType.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.ext.proxy.api;
-public interface EntityType<T extends StructuredType> extends StructuredType<T> {
+public interface EntityType<T extends StructuredType<?>> extends StructuredType<T> {
/**
* Appends ref segment to the URI.
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/NoResultException.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/NoResultException.java
deleted file mode 100644
index 617b305..0000000
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/NoResultException.java
+++ /dev/null
@@ -1,31 +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.ext.proxy.api;
-
-/**
- * Thrown when {@link Filter#getSingleResult()} is executed and there is no result to return.
- */
-public class NoResultException extends RuntimeException {
-
- private static final long serialVersionUID = -6643642637364303053L;
-
- public NoResultException() {
- super();
- }
-}
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/NonUniqueResultException.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/NonUniqueResultException.java
deleted file mode 100644
index 37658c6..0000000
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/NonUniqueResultException.java
+++ /dev/null
@@ -1,31 +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.ext.proxy.api;
-
-/**
- * Thrown when {@link Filter#getSingleResult()} is executed and there is more than one result.
- */
-public class NonUniqueResultException extends RuntimeException {
-
- private static final long serialVersionUID = 4444551737338550185L;
-
- public NonUniqueResultException() {
- super();
- }
-}
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ODataFlushException.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ODataFlushException.java
index 13edbd0..8cd5b02 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ODataFlushException.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ODataFlushException.java
@@ -19,7 +19,7 @@
package org.apache.olingo.ext.proxy.api;
import java.util.List;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
public class ODataFlushException extends ODataRuntimeException {
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ODataResponseError.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ODataResponseError.java
index ead17f5..732d436 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ODataResponseError.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/ODataResponseError.java
@@ -19,7 +19,7 @@
package org.apache.olingo.ext.proxy.api;
import org.apache.olingo.client.api.communication.request.ODataRequest;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
public class ODataResponseError {
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredCollection.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredCollection.java
index 06322d2..236a388 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredCollection.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredCollection.java
@@ -24,7 +24,7 @@
* Marker interface for Entity and complex type.
*/
public interface StructuredCollection<
- T extends StructuredType, EC extends Collection<T>, CT extends StructuredCollection<T, EC, ?>>
+ T extends StructuredType<?>, EC extends Collection<T>, CT extends StructuredCollection<T, EC, ?>>
extends GenericCollection<T, EC> {
/**
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredComposableInvoker.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredComposableInvoker.java
index c14c4ce..3c7a3a2 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredComposableInvoker.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredComposableInvoker.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.ext.proxy.api;
-public interface StructuredComposableInvoker<T extends StructuredType, O extends Operations>
+public interface StructuredComposableInvoker<T extends StructuredType<?>, O extends Operations>
extends StructuredInvoker<T>, ComposableInvoker<T, O> {
//No additional methods needed for now.
}
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredInvoker.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredInvoker.java
index 75423e7..30a7d88 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredInvoker.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/StructuredInvoker.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.ext.proxy.api;
-public interface StructuredInvoker<T extends StructuredType>
+public interface StructuredInvoker<T extends StructuredType<?>>
extends StructuredQuery<StructuredInvoker<T>>, Invoker<T> {
//No additional methods needed for now.
}
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java
index b31e624..cb72126 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java
@@ -24,6 +24,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.URI;
+
import org.apache.commons.lang3.ArrayUtils;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
@@ -136,7 +137,7 @@
}
@SuppressWarnings("unchecked")
- public <NE extends EntityType> NE newEntityInstance(final Class<NE> ref) {
+ public <NE extends EntityType<?>> NE newEntityInstance(final Class<NE> ref) {
final EntityInvocationHandler handler = EntityInvocationHandler.getInstance(ref, getService());
return (NE) Proxy.newProxyInstance(
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
index 66bc66c..c124402 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
@@ -33,12 +33,12 @@
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.uri.URIBuilder;
import org.apache.olingo.client.api.domain.ClientAnnotation;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.uri.URIBuilder;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.ext.proxy.AbstractService;
import org.apache.olingo.ext.proxy.api.AbstractTerm;
import org.apache.olingo.ext.proxy.api.Annotatable;
@@ -335,7 +335,7 @@
getClient().getRetrieveRequestFactory().getMediaEntityRequest(contentSource);
if (StringUtils.isNotBlank(getEntity().getMediaContentType())) {
- retrieveReq.setFormat(ODataFormat.fromString(getEntity().getMediaContentType()));
+ retrieveReq.setFormat(ContentType.parse(getEntity().getMediaContentType()));
}
final ODataRetrieveResponse<InputStream> res = retrieveReq.execute();
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
index 6c8d35f..8250f72 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
@@ -29,11 +29,11 @@
import org.apache.commons.lang3.tuple.Triple;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
-import org.apache.olingo.client.api.uri.URIBuilder;
import org.apache.olingo.client.api.domain.ClientAnnotation;
import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.uri.URIBuilder;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.ext.proxy.AbstractService;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
import org.apache.olingo.ext.proxy.api.AbstractSingleton;
@@ -95,7 +95,7 @@
public Long count() {
final ODataValueRequest req = getClient().getRetrieveRequestFactory().
getValueRequest(getClient().newURIBuilder(this.uri.build().toASCIIString()).count().build());
- req.setFormat(ODataFormat.TEXT_PLAIN);
+ req.setFormat(ContentType.TEXT_PLAIN);
return Long.valueOf(req.execute().getBody().asPrimitive().toString());
}
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/NonTransactionalPersistenceManagerImpl.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/NonTransactionalPersistenceManagerImpl.java
index 04d1851..91f8cbe 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/NonTransactionalPersistenceManagerImpl.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/NonTransactionalPersistenceManagerImpl.java
@@ -29,7 +29,7 @@
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.ODataResponse;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.ext.proxy.AbstractService;
import org.apache.olingo.ext.proxy.api.ODataFlushException;
import org.apache.olingo.ext.proxy.api.ODataResponseError;
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/TransactionalPersistenceManagerImpl.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/TransactionalPersistenceManagerImpl.java
index 5f42127..e43a4e1 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/TransactionalPersistenceManagerImpl.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/TransactionalPersistenceManagerImpl.java
@@ -64,7 +64,7 @@
((ODataRequest) request).setAccept(
service.getClient().getConfiguration().getDefaultBatchAcceptFormat().toContentTypeString());
- final BatchManager batchManager = (BatchManager) ((ODataStreamedRequest) request).payloadManager();
+ final BatchManager batchManager = (BatchManager) ((ODataStreamedRequest<?,?>) request).payloadManager();
final List<ODataRequest> requests = new ArrayList<ODataRequest>(changes.getChanges().size());
final ODataChangeset changeset = batchManager.addChangeset();
@@ -117,10 +117,10 @@
if (handler != null) {
if (res instanceof ODataEntityCreateResponse && res.getStatusCode() == 201) {
- handler.setEntity(((ODataEntityCreateResponse) res).getBody());
+ handler.setEntity(((ODataEntityCreateResponse<?>) res).getBody());
LOG.debug("Upgrade created object '{}'", handler);
} else if (res instanceof ODataEntityUpdateResponse && res.getStatusCode() == 200) {
- handler.setEntity(((ODataEntityUpdateResponse) res).getBody());
+ handler.setEntity(((ODataEntityUpdateResponse<?>) res).getBody());
LOG.debug("Upgrade updated object '{}'", handler);
}
}
diff --git a/ext/config/src/main/java/org/apache/olingo/ext/config/edm/GenericEdmProvider.java b/ext/config/src/main/java/org/apache/olingo/ext/config/edm/GenericEdmProvider.java
index a606680..ed38d97 100644
--- a/ext/config/src/main/java/org/apache/olingo/ext/config/edm/GenericEdmProvider.java
+++ b/ext/config/src/main/java/org/apache/olingo/ext/config/edm/GenericEdmProvider.java
@@ -18,10 +18,6 @@
*/
package org.apache.olingo.ext.config.edm;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
import org.apache.olingo.commons.api.edm.provider.CsdlAction;
@@ -39,216 +35,213 @@
import org.apache.olingo.commons.api.edm.provider.CsdlSingleton;
import org.apache.olingo.commons.api.edm.provider.CsdlTerm;
import org.apache.olingo.commons.api.edm.provider.CsdlTypeDefinition;
+import org.apache.olingo.commons.api.ex.ODataException;
+
+import java.util.ArrayList;
+import java.util.List;
public class GenericEdmProvider extends CsdlAbstractEdmProvider {
- private String containerName = "default";
+ private String containerName = "default";
- private List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
+ private List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
- // OData
+ // OData
- @Override
- public List<CsdlSchema> getSchemas() throws ODataException {
- return schemas;
- }
+ @Override
+ public List<CsdlSchema> getSchemas() {
+ return schemas;
+ }
- @Override
- public CsdlEntityContainer getEntityContainer() throws ODataException {
- CsdlEntityContainer container = new CsdlEntityContainer();
- container.setName(containerName);
+ @Override
+ public CsdlEntityContainer getEntityContainer() {
+ CsdlEntityContainer container = new CsdlEntityContainer();
+ container.setName(containerName);
- // EntitySets
- List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
- container.setEntitySets(entitySets);
+ // EntitySets
+ List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
+ container.setEntitySets(entitySets);
- // Load entity sets per index
- for (CsdlSchema schema : schemas) {
+ // Load entity sets per index
+ for (CsdlSchema schema : schemas) {
- if (schema.getEntityContainer() != null
- && schema.getEntityContainer().getEntitySets() != null) {
- for (CsdlEntitySet schemaEntitySet : schema.getEntityContainer()
- .getEntitySets()) {
- CsdlEntitySet entitySet = new CsdlEntitySet().setName(
- schemaEntitySet.getName()).setType(
- new FullQualifiedName(
- schemaEntitySet.getTypeFQN().getNamespace(),
- schemaEntitySet.getTypeFQN().getName()));
- entitySets.add(entitySet);
- }
- }
- }
+ if (schema.getEntityContainer() != null
+ && schema.getEntityContainer().getEntitySets() != null) {
+ for (CsdlEntitySet schemaEntitySet : schema.getEntityContainer()
+ .getEntitySets()) {
+ CsdlEntitySet entitySet = new CsdlEntitySet().setName(
+ schemaEntitySet.getName()).setType(
+ new FullQualifiedName(
+ schemaEntitySet.getTypeFQN().getNamespace(),
+ schemaEntitySet.getTypeFQN().getName()));
+ entitySets.add(entitySet);
+ }
+ }
+ }
- return container;
- }
+ return container;
+ }
- private CsdlSchema findSchema(String namespace) {
- for (CsdlSchema schema : schemas) {
- if (schema.getNamespace().equals(namespace)) {
- return schema;
- }
- }
+ private CsdlSchema findSchema(String namespace) {
+ for (CsdlSchema schema : schemas) {
+ if (schema.getNamespace().equals(namespace)) {
+ return schema;
+ }
+ }
- return null;
- }
+ return null;
+ }
- private CsdlEntityType findEntityType(CsdlSchema schema, String entityTypeName) {
- for (CsdlEntityType entityType : schema.getEntityTypes()) {
- if (entityType.getName().equals(entityTypeName)) {
- return entityType;
- }
- }
+ private CsdlEntityType findEntityType(CsdlSchema schema, String entityTypeName) {
+ for (CsdlEntityType entityType : schema.getEntityTypes()) {
+ if (entityType.getName().equals(entityTypeName)) {
+ return entityType;
+ }
+ }
- return null;
- }
+ return null;
+ }
- @Override
- public CsdlEntityType getEntityType(FullQualifiedName entityTypeName)
- throws ODataException {
- CsdlSchema schema = findSchema(entityTypeName.getNamespace());
- return findEntityType(schema, entityTypeName.getName());
- }
+ @Override
+ public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) {
+ CsdlSchema schema = findSchema(entityTypeName.getNamespace());
+ return findEntityType(schema, entityTypeName.getName());
+ }
- private CsdlEnumType findEnumType(CsdlSchema schema, String enumTypeName) {
- for (CsdlEnumType enumType : schema.getEnumTypes()) {
- if (enumType.getName().equals(enumTypeName)) {
- return enumType;
- }
- }
+ private CsdlEnumType findEnumType(CsdlSchema schema, String enumTypeName) {
+ for (CsdlEnumType enumType : schema.getEnumTypes()) {
+ if (enumType.getName().equals(enumTypeName)) {
+ return enumType;
+ }
+ }
- return null;
- }
+ return null;
+ }
- @Override
- public CsdlEnumType getEnumType(FullQualifiedName enumTypeName)
- throws ODataException {
- CsdlSchema schema = findSchema(enumTypeName.getNamespace());
- return findEnumType(schema, enumTypeName.getName());
- }
+ @Override
+ public CsdlEnumType getEnumType(FullQualifiedName enumTypeName) {
+ CsdlSchema schema = findSchema(enumTypeName.getNamespace());
+ return findEnumType(schema, enumTypeName.getName());
+ }
- @Override
- public CsdlTypeDefinition getTypeDefinition(FullQualifiedName typeDefinitionName)
- throws ODataException {
- System.out.println(">> getTypeDefinition");
- // TODO Auto-generated method stub
- return super.getTypeDefinition(typeDefinitionName);
- }
+ @Override
+ public CsdlTypeDefinition getTypeDefinition(FullQualifiedName typeDefinitionName) throws ODataException {
+ System.out.println(">> getTypeDefinition");
+ // TODO Auto-generated method stub
+ return super.getTypeDefinition(typeDefinitionName);
+ }
- private CsdlComplexType findComplexType(CsdlSchema schema, String complexTypeName) {
- for (CsdlComplexType complexType : schema.getComplexTypes()) {
- if (complexType.getName().equals(complexTypeName)) {
- return complexType;
- }
- }
+ private CsdlComplexType findComplexType(CsdlSchema schema, String complexTypeName) {
+ for (CsdlComplexType complexType : schema.getComplexTypes()) {
+ if (complexType.getName().equals(complexTypeName)) {
+ return complexType;
+ }
+ }
- return null;
- }
+ return null;
+ }
- @Override
- public CsdlComplexType getComplexType(FullQualifiedName complexTypeName)
- throws ODataException {
- CsdlSchema schema = findSchema(complexTypeName.getNamespace());
- return findComplexType(schema, complexTypeName.getName());
- }
+ @Override
+ public CsdlComplexType getComplexType(FullQualifiedName complexTypeName) {
+ CsdlSchema schema = findSchema(complexTypeName.getNamespace());
+ return findComplexType(schema, complexTypeName.getName());
+ }
- @Override
- public List<CsdlAction> getActions(FullQualifiedName actionName)
- throws ODataException {
- System.out.println(">> getActions");
- // TODO Auto-generated method stub
- return super.getActions(actionName);
- }
+ @Override
+ public List<CsdlAction> getActions(FullQualifiedName actionName) throws ODataException {
+ System.out.println(">> getActions");
+ // TODO Auto-generated method stub
+ return super.getActions(actionName);
+ }
- @Override
- public List<CsdlFunction> getFunctions(FullQualifiedName functionName)
- throws ODataException {
- System.out.println(">> getFunctions");
- // TODO Auto-generated method stub
- return super.getFunctions(functionName);
- }
+ @Override
+ public List<CsdlFunction> getFunctions(FullQualifiedName functionName) throws ODataException {
+ System.out.println(">> getFunctions");
+ // TODO Auto-generated method stub
+ return super.getFunctions(functionName);
+ }
- @Override
- public CsdlTerm getTerm(FullQualifiedName termName) throws ODataException {
- System.out.println(">> getTerm");
- // TODO Auto-generated method stub
- return super.getTerm(termName);
- }
+ @Override
+ public CsdlTerm getTerm(FullQualifiedName termName) throws ODataException {
+ System.out.println(">> getTerm");
+ // TODO Auto-generated method stub
+ return super.getTerm(termName);
+ }
- private CsdlEntitySet findEntitySetInSchemas(String entitySetName)
- throws ODataException {
- List<CsdlSchema> schemas = getSchemas();
- for (CsdlSchema schema : schemas) {
- CsdlEntityContainer entityContainer = schema.getEntityContainer();
- List<CsdlEntitySet> entitySets = entityContainer.getEntitySets();
- for (CsdlEntitySet entitySet : entitySets) {
- if (entitySet.getName().equals(entitySetName)) {
- return entitySet;
- }
- }
- }
- return null;
- }
+ private CsdlEntitySet findEntitySetInSchemas(String entitySetName) {
+ List<CsdlSchema> schemas = getSchemas();
+ for (CsdlSchema schema : schemas) {
+ CsdlEntityContainer entityContainer = schema.getEntityContainer();
+ List<CsdlEntitySet> entitySets = entityContainer.getEntitySets();
+ for (CsdlEntitySet entitySet : entitySets) {
+ if (entitySet.getName().equals(entitySetName)) {
+ return entitySet;
+ }
+ }
+ }
+ return null;
+ }
- @Override
- public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer,
- String entitySetName) throws ODataException {
- return findEntitySetInSchemas(entitySetName);
- }
+ @Override
+ public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer,
+ String entitySetName) {
+ return findEntitySetInSchemas(entitySetName);
+ }
- @Override
- public CsdlSingleton getSingleton(FullQualifiedName entityContainer,
- String singletonName) throws ODataException {
- System.out.println(">> getSingleton");
- // TODO Auto-generated method stub
- return super.getSingleton(entityContainer, singletonName);
- }
+ @Override
+ public CsdlSingleton getSingleton(FullQualifiedName entityContainer,
+ String singletonName) throws ODataException {
+ System.out.println(">> getSingleton");
+ // TODO Auto-generated method stub
+ return super.getSingleton(entityContainer, singletonName);
+ }
- @Override
- public CsdlActionImport getActionImport(FullQualifiedName entityContainer,
- String actionImportName) throws ODataException {
- System.out.println(">> getActionImport");
- // TODO Auto-generated method stub
- return super.getActionImport(entityContainer, actionImportName);
- }
+ @Override
+ public CsdlActionImport getActionImport(FullQualifiedName entityContainer,
+ String actionImportName) throws ODataException {
+ System.out.println(">> getActionImport");
+ // TODO Auto-generated method stub
+ return super.getActionImport(entityContainer, actionImportName);
+ }
- @Override
- public CsdlFunctionImport getFunctionImport(FullQualifiedName entityContainer,
- String functionImportName) throws ODataException {
- System.out.println(">> getFunctionImport");
- // TODO Auto-generated method stub
- return super.getFunctionImport(entityContainer, functionImportName);
- }
+ @Override
+ public CsdlFunctionImport getFunctionImport(FullQualifiedName entityContainer,
+ String functionImportName) throws ODataException {
+ System.out.println(">> getFunctionImport");
+ // TODO Auto-generated method stub
+ return super.getFunctionImport(entityContainer, functionImportName);
+ }
- @Override
- public CsdlEntityContainerInfo getEntityContainerInfo(
- FullQualifiedName entityContainerName) throws ODataException {
- CsdlEntityContainer container = getEntityContainer();
- FullQualifiedName fqName = new FullQualifiedName(container.getName(),
- container.getName());
- CsdlEntityContainerInfo info = new CsdlEntityContainerInfo();
- info.setContainerName(fqName);
- return info;
- }
+ @Override
+ public CsdlEntityContainerInfo getEntityContainerInfo(
+ FullQualifiedName entityContainerName) {
+ CsdlEntityContainer container = getEntityContainer();
+ FullQualifiedName fqName = new FullQualifiedName(container.getName(),
+ container.getName());
+ CsdlEntityContainerInfo info = new CsdlEntityContainerInfo();
+ info.setContainerName(fqName);
+ return info;
+ }
- @Override
- public List<CsdlAliasInfo> getAliasInfos() throws ODataException {
- System.out.println(">> getAliasInfos");
- // TODO Auto-generated method stub
- return super.getAliasInfos();
- }
+ @Override
+ public List<CsdlAliasInfo> getAliasInfos() throws ODataException {
+ System.out.println(">> getAliasInfos");
+ // TODO Auto-generated method stub
+ return super.getAliasInfos();
+ }
- // DI
+ // DI
- public void setSchemas(List<CsdlSchema> schemas) {
- this.schemas = schemas;
- }
+ public void setSchemas(List<CsdlSchema> schemas) {
+ this.schemas = schemas;
+ }
- public String getContainerName() {
- return containerName;
- }
+ public String getContainerName() {
+ return containerName;
+ }
- public void setContainerName(String containerName) {
- this.containerName = containerName;
- }
+ public void setContainerName(String containerName) {
+ this.containerName = containerName;
+ }
}
diff --git a/ext/karaf/karaf-features/pom.xml b/ext/karaf/karaf-features/pom.xml
new file mode 100644
index 0000000..2ae3f2c
--- /dev/null
+++ b/ext/karaf/karaf-features/pom.xml
@@ -0,0 +1,81 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>odata-karaf-features</artifactId>
+ <packaging>pom</packaging>
+ <name>${project.artifactId}</name>
+
+ <parent>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-karaf</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>filter</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>target/classes/features.xml</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ext/karaf/karaf-features/src/main/resources/features.xml b/ext/karaf/karaf-features/src/main/resources/features.xml
new file mode 100644
index 0000000..0f2b5f4
--- /dev/null
+++ b/ext/karaf/karaf-features/src/main/resources/features.xml
@@ -0,0 +1,59 @@
+<?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.
+-->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0" name="olingo-${project.version}">
+
+ <feature name="olingo-server" version="${project.version}" resolver="(obr)" start-level="50">
+ <feature>war</feature>
+ <bundle>mvn:commons-codec/commons-codec/${commons.codec.version}</bundle>
+ <bundle>mvn:org.apache.commons/commons-lang3/${commons.lang3.version}</bundle>
+ <bundle>mvn:org.codehaus.woodstox/stax2-api/${woodstox.stax2-api.version}</bundle>
+ <bundle>mvn:com.fasterxml/aalto-xml/${aalto-xml.version}</bundle>
+ <bundle>wrap:mvn:org.antlr/antlr4-runtime/${antlr.version}/$Bundle-SymbolicName=antlr4-runtime&Bundle-Version=${antlr.version}&Export-Package=org.antlr.v4.runtime*</bundle>
+
+ <bundle>mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle>
+ <bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle>
+ <bundle>mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle>
+
+ <bundle>mvn:org.apache.olingo/odata-commons-api/${project.version}</bundle>
+ <bundle>mvn:org.apache.olingo/odata-commons-core/${project.version}</bundle>
+ <bundle>mvn:org.apache.olingo/odata-server-api/${project.version}</bundle>
+ <bundle>mvn:org.apache.olingo/odata-server-core/${project.version}</bundle>
+ </feature>
+
+ <feature name="olingo-client" version="${project.version}" resolver="(obr)" start-level="50">
+ <bundle>mvn:commons-codec/commons-codec/${commons.codec.version}</bundle>
+ <bundle>mvn:commons-io/commons-io/${commons.io.version}</bundle>
+ <bundle>mvn:org.apache.commons/commons-lang3/${commons.lang3.version}</bundle>
+ <bundle>mvn:org.codehaus.woodstox/stax2-api/${woodstox.stax2-api.version}</bundle>
+ <bundle>mvn:com.fasterxml/aalto-xml/${aalto-xml.version}</bundle>
+ <bundle>mvn:org.apache.httpcomponents/httpcore-osgi/${hc.core.version}</bundle>
+ <bundle>mvn:org.apache.httpcomponents/httpclient-osgi/${hc.client.version}</bundle>
+
+ <bundle>mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle>
+ <bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle>
+ <bundle>mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle>
+ <bundle>mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/${jackson.version}</bundle>
+ <bundle>mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-xml/${jackson.version}</bundle>
+
+ <bundle>mvn:org.apache.olingo/odata-commons-api/${project.version}</bundle>
+ <bundle>mvn:org.apache.olingo/odata-commons-core/${project.version}</bundle>
+ <bundle>mvn:org.apache.olingo/odata-client-api/${project.version}</bundle>
+ <bundle>mvn:org.apache.olingo/odata-client-core/${project.version}</bundle>
+ </feature>
+</features>
diff --git a/ext/karaf/karaf-fit/pom.xml b/ext/karaf/karaf-fit/pom.xml
new file mode 100644
index 0000000..4cd50c1
--- /dev/null
+++ b/ext/karaf/karaf-fit/pom.xml
@@ -0,0 +1,152 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>odata-karaf-fit</artifactId>
+ <packaging>jar</packaging>
+ <name>${project.artifactId}</name>
+
+ <parent>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-karaf</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <dependencies>
+ <!-- Karaf features -->
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-karaf-features</artifactId>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.karaf.features</groupId>
+ <artifactId>org.apache.karaf.features.core</artifactId>
+ <version>${karaf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.console</artifactId>
+ <version>${karaf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${osgi.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>${osgi.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- pax-exam -->
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit4</artifactId>
+ <version>${pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam</artifactId>
+ <version>${pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-karaf</artifactId>
+ <version>${pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-link-mvn</artifactId>
+ <version>${pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>apache-karaf</artifactId>
+ <version>${karaf.version}</version>
+ <type>tar.gz</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.dev</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse</groupId>
+ <artifactId>osgi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.client</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <!-- generate dependencies versions that are needed -->
+ <plugin>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <execution>
+ <id>generate-depends-file</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/BundlesTest.java b/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/BundlesTest.java
new file mode 100644
index 0000000..85d0f42
--- /dev/null
+++ b/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/BundlesTest.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+
+package org.apache.olingo.osgi.itests;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
+
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class BundlesTest extends OlingoOSGiTestSupport {
+ @Test
+ public void test() throws Exception {
+ // check the server-api and server-core
+ assertBundleStarted("org.apache.olingo.odata-server-api");
+ assertBundleStarted("org.apache.olingo.odata-server-core");
+
+ // check the client-api and client-core
+ assertBundleStarted("org.apache.olingo.odata-client-api");
+ assertBundleStarted("org.apache.olingo.odata-client-core");
+ }
+
+ @Configuration
+ public Option[] config() {
+ return new Option[]{
+ olingoBaseConfig(),
+ features(olingoUrl, "olingo-server", "olingo-client"),
+ logLevel(LogLevel.INFO)};
+ }
+}
diff --git a/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/OlingoOSGiTestSupport.java b/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/OlingoOSGiTestSupport.java
new file mode 100644
index 0000000..b95bd13
--- /dev/null
+++ b/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/OlingoOSGiTestSupport.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * 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.osgi.itests;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import javax.inject.Inject;
+
+import org.apache.karaf.features.FeaturesService;
+import org.junit.Assert;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.ProbeBuilder;
+import org.ops4j.pax.exam.TestProbeBuilder;
+import org.ops4j.pax.exam.options.MavenUrlReference;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.when;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+
+/**
+ *
+ */
+public class OlingoOSGiTestSupport {
+ private static final String MAVEN_DEPENDENCIES_PROPERTIES = "/META-INF/maven/dependencies.properties";
+
+ @Inject
+ protected BundleContext bundleContext;
+
+ @Inject
+ protected FeaturesService featureService;
+
+ protected ExecutorService executor = Executors.newCachedThreadPool();
+
+ protected MavenUrlReference olingoUrl;
+ protected MavenUrlReference karafUrl;
+
+ /**
+ * @param probe
+ * @return
+ */
+ @ProbeBuilder
+ public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
+ probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*,org.apache.felix.service.*;status=provisional");
+ return probe;
+ }
+
+ private static String getKarafVersion() {
+ String karafVersion = getVersionFromPom("org.apache.karaf/apache-karaf/version");
+ if (karafVersion == null) {
+ karafVersion = System.getProperty("karaf.version");
+ }
+ if (karafVersion == null) {
+ // setup the default version of it
+ karafVersion = "3.0.3";
+ }
+ return karafVersion;
+ }
+
+ private static String getVersionFromPom(String key) {
+ try {
+ InputStream ins = OlingoOSGiTestSupport.class.getResourceAsStream(MAVEN_DEPENDENCIES_PROPERTIES);
+ Properties p = new Properties();
+ p.load(ins);
+ return p.getProperty(key);
+ } catch (Exception t) {
+ throw new IllegalStateException(MAVEN_DEPENDENCIES_PROPERTIES + " can not be found", t);
+ }
+ }
+ /**
+ * Create an {@link org.ops4j.pax.exam.Option} for using a .
+ *
+ * @return
+ */
+ protected Option olingoBaseConfig() {
+ karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf").version(getKarafVersion())
+ .type("tar.gz");
+ olingoUrl = maven().groupId("org.apache.olingo").artifactId("odata-karaf-features").versionAsInProject()
+ .type("xml").classifier("features");
+ String localRepo = System.getProperty("localRepository");
+ return composite(karafDistributionConfiguration()
+ .frameworkUrl(karafUrl)
+ .karafVersion(getKarafVersion())
+ .name("Apache Karaf")
+ .useDeployFolder(false)
+ .unpackDirectory(new File("target/paxexam/")),
+ //DO NOT COMMIT WITH THIS LINE ENABLED!!!
+ //KarafDistributionOption.keepRuntimeFolder(),
+ systemProperty("java.awt.headless").value("true"),
+ when(localRepo != null)
+ .useOptions(editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg",
+ "org.ops4j.pax.url.mvn.localRepository",
+ localRepo)));
+ }
+
+ protected void assertBundleStarted(String name) {
+ Bundle bundle = findBundleByName(name);
+ Assert.assertNotNull("Bundle " + name + " should be installed", bundle);
+ Assert.assertEquals("Bundle " + name + " should be started", Bundle.ACTIVE, bundle.getState());
+ }
+
+ protected Bundle findBundleByName(String symbolicName) {
+ for (Bundle bundle : bundleContext.getBundles()) {
+ if (bundle.getSymbolicName().equals(symbolicName)) {
+ return bundle;
+ }
+ }
+ return null;
+ }
+}
diff --git a/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java b/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java
new file mode 100644
index 0000000..d727253
--- /dev/null
+++ b/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * 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.osgi.itests.server;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.apache.olingo.osgi.itests.OlingoOSGiTestSupport;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
+
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
+
+/**
+ *
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
+public class CarServiceTest extends OlingoOSGiTestSupport {
+ private static final String SERVICE_URL = "http://localhost:8181/olingo-cars/cars.svc/";
+
+ @Test
+ public void testServiceStarted() throws Exception {
+ // check if the bundle is started
+ assertBundleStarted("org.apache.olingo.odata-server-osgi-sample");
+
+ // use the jdk http client to verify the server side
+ verifyContent(getContent(SERVICE_URL));
+
+ verifyContent(getContent(SERVICE_URL + "$metadata"));
+
+ verifyContent(getContent(SERVICE_URL + "Cars"));
+
+ verifyContent(getContent(SERVICE_URL + "Cars(1)"));
+
+ verifyContent(getContent(SERVICE_URL + "Cars(1)/Price"));
+ }
+
+ private static void verifyContent(String content) {
+ // this is currently a simple test to check if there is no error
+ Assert.assertNotNull(content);
+ Assert.assertTrue(content.indexOf("error") < 0);
+ }
+
+ private static String getContent(String target) throws Exception {
+ InputStream in = null;
+ try {
+ URL url = new URL(target);
+ URLConnection urlConnection = url.openConnection();
+ urlConnection.setRequestProperty("Accept", "*/*");
+ in = urlConnection.getInputStream();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ byte[] buf = new byte[4096];
+ int n = 0;
+ while ((n = in.read(buf, 0, buf.length)) != -1) {
+ baos.write(buf, 0, n);
+ }
+ return new String(baos.toByteArray(), "utf-8");
+ } finally {
+ if (in != null) {
+ in.close();
+ }
+ }
+
+ }
+
+ @Configuration
+ public Option[] config() {
+ return new Option[] {
+ olingoBaseConfig(),
+ features(olingoUrl, "olingo-server", "olingo-client"),
+ mavenBundle("org.apache.olingo", "odata-server-osgi-sample", "4.0.0-SNAPSHOT"),
+ logLevel(LogLevel.INFO)
+ };
+ }
+
+
+}
diff --git a/ext/karaf/pom.xml b/ext/karaf/pom.xml
new file mode 100644
index 0000000..14e3645
--- /dev/null
+++ b/ext/karaf/pom.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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>odata-karaf</artifactId>
+ <packaging>pom</packaging>
+ <name>${project.artifactId}</name>
+
+ <parent>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-ext</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <modules>
+ <module>karaf-features</module>
+ <module>karaf-fit</module>
+ </modules>
+</project>
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
index 9321c64..295d1c2 100644
--- a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
@@ -55,7 +55,7 @@
import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmSchema;
import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
@@ -218,7 +218,7 @@
} else if (StringUtils.isNotEmpty(localEdm)) {
final FileInputStream fis = new FileInputStream(FileUtils.getFile(localEdm));
try {
- metadata = getClient().getDeserializer(ODataFormat.XML).toMetadata(fis);
+ metadata = getClient().getDeserializer(ContentType.APPLICATION_XML).toMetadata(fis);
edm = getClient().getReader().readMetadata(metadata.getSchemaByNsOrAlias());
} finally {
IOUtils.closeQuietly(fis);
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
index 7e0dbdd..c94129b 100644
--- a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
@@ -140,19 +140,19 @@
return getNavigationBindings(sourceEntityType, property);
} catch (Exception e) {
// maybe source entity type without entity set ...
- return getNavigationBindings(property.getType());
+ return getNavigationBindings(property.getType(), property.getName());
}
}
- private NavPropertyBindingDetails getNavigationBindings(final EdmStructuredType type) {
+ private NavPropertyBindingDetails getNavigationBindings(final EdmStructuredType type, String propertyName) {
if (type == null) {
- throw new IllegalStateException("Invalid navigation property");
+ throw new IllegalStateException("No EntitySet defined. Invalid navigation property: " + propertyName);
}
try {
return new NavPropertyBindingDetails(edm, type);
} catch (IllegalStateException ignore) {
- return getNavigationBindings(type.getBaseType());
+ return getNavigationBindings(type.getBaseType(), propertyName);
}
}
diff --git a/ext/pom.xml b/ext/pom.xml
index 41a7721..4ebfdeb 100644
--- a/ext/pom.xml
+++ b/ext/pom.xml
@@ -49,5 +49,11 @@
<module>spring</module>
</modules>
</profile>
+ <profile>
+ <id>karaf</id>
+ <modules>
+ <module>karaf</module>
+ </modules>
+ </profile>
</profiles>
</project>
diff --git a/fit/pom.xml b/fit/pom.xml
index b35d5ae..41fe4c2 100644
--- a/fit/pom.xml
+++ b/fit/pom.xml
@@ -34,6 +34,32 @@
<relativePath>..</relativePath>
</parent>
+ <properties>
+ <cobertura.skip>true</cobertura.skip>
+ <!-- exclude proxy tests by default -->
+ <exclude.regex>.*proxy.*</exclude.regex>
+ </properties>
+
+ <profiles>
+ <profile>
+ <id>build.fast</id>
+ <properties>
+ <pmd.skip>true</pmd.skip>
+ <rat.skip>true</rat.skip>
+ <checkstyle.skip>true</checkstyle.skip>
+ <exclude.regex>.*(proxy|client).*</exclude.regex>
+ </properties>
+ </profile>
+ <profile>
+ <id>build.quality</id>
+ <properties>
+ <cobertura.skip>false</cobertura.skip>
+ <!-- nothing excluded -->
+ <exclude.regex></exclude.regex>
+ </properties>
+ </profile>
+ </profiles>
+
<dependencies>
<dependency>
<groupId>org.apache.olingo</groupId>
@@ -43,6 +69,12 @@
<dependency>
<groupId>org.apache.olingo</groupId>
+ <artifactId>odata-client-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
<artifactId>odata-client-proxy</artifactId>
<version>${project.version}</version>
</dependency>
@@ -105,6 +137,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
+ <version>${sl4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -118,15 +151,15 @@
<dependency>
<groupId>org.apache.olingo</groupId>
- <artifactId>odata-client-core</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.olingo</groupId>
<artifactId>odata-server-tecsvc</artifactId>
<version>${project.version}</version>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -154,6 +187,9 @@
<include>**/*ITCase.java</include>
<include>**/*Test.java</include>
</includes>
+ <excludes>
+ <exclude>%regex[${exclude.regex}]</exclude>
+ </excludes>
</configuration>
</plugin>
<plugin>
@@ -176,6 +212,7 @@
<goal>unpack-dependencies</goal>
</goals>
<configuration>
+ <skip>${cobertura.skip}</skip>
<includeGroupIds>${project.groupId}</includeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<overWriteReleases>true</overWriteReleases>
@@ -189,6 +226,7 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<configuration>
+ <skip>${cobertura.skip}</skip>
<instrumentation>
<excludes>
<exclude>org/apache/olingo/**/tecsvc/**/*.class</exclude>
@@ -201,7 +239,7 @@
<aggregate>true</aggregate>
</configuration>
</plugin>
-
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
diff --git a/fit/src/it/demoV4/pom.xml b/fit/src/it/demo/pom.xml
similarity index 100%
rename from fit/src/it/demoV4/pom.xml
rename to fit/src/it/demo/pom.xml
diff --git a/fit/src/it/demoV4/verify.groovy b/fit/src/it/demo/verify.groovy
similarity index 100%
rename from fit/src/it/demoV4/verify.groovy
rename to fit/src/it/demo/verify.groovy
diff --git a/fit/src/it/openTypeV4/pom.xml b/fit/src/it/openType/pom.xml
similarity index 100%
rename from fit/src/it/openTypeV4/pom.xml
rename to fit/src/it/openType/pom.xml
diff --git a/fit/src/it/openTypeV4/verify.groovy b/fit/src/it/openType/verify.groovy
similarity index 100%
rename from fit/src/it/openTypeV4/verify.groovy
rename to fit/src/it/openType/verify.groovy
diff --git a/fit/src/it/staticServiceV4/pom.xml b/fit/src/it/staticService/pom.xml
similarity index 100%
rename from fit/src/it/staticServiceV4/pom.xml
rename to fit/src/it/staticService/pom.xml
diff --git a/fit/src/it/staticServiceV4/verify.groovy b/fit/src/it/staticService/verify.groovy
similarity index 100%
rename from fit/src/it/staticServiceV4/verify.groovy
rename to fit/src/it/staticService/verify.groovy
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 a5ca333..72a6061 100644
--- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
+++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
@@ -68,6 +68,11 @@
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
+import org.apache.olingo.client.api.serialization.ODataDeserializer;
+import org.apache.olingo.client.api.serialization.ODataSerializer;
+import org.apache.olingo.client.core.serialization.AtomSerializer;
+import org.apache.olingo.client.core.serialization.JsonDeserializer;
+import org.apache.olingo.client.core.serialization.JsonSerializer;
import org.apache.olingo.commons.api.data.ComplexValue;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
@@ -79,12 +84,7 @@
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.serialization.ODataDeserializer;
-import org.apache.olingo.commons.api.serialization.ODataSerializer;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.commons.core.serialization.AtomSerializer;
-import org.apache.olingo.commons.core.serialization.JsonDeserializer;
-import org.apache.olingo.commons.core.serialization.JsonSerializer;
import org.apache.olingo.fit.metadata.EntityType;
import org.apache.olingo.fit.metadata.Metadata;
import org.apache.olingo.fit.metadata.NavigationProperty;
@@ -148,7 +148,7 @@
atomDeserializer = new FITAtomDeserializer();
jsonDeserializer = new JsonDeserializer(true);
atomSerializer = new AtomSerializer(true);
- jsonSerializer = new JsonSerializer(true);
+ jsonSerializer = new JsonSerializer(true, ContentType.JSON_FULL_METADATA);
xml = new XMLUtilities(metadata);
json = new JSONUtilities(metadata);
@@ -684,7 +684,7 @@
final String location;
- if ((this instanceof V4KeyAsSegment)) {
+ if ((this instanceof KeyAsSegment)) {
location = uriInfo.getRequestUri().toASCIIString() + "/" + entityKey;
final Link editLink = new Link();
@@ -1223,7 +1223,7 @@
}
final Entity entry = container.getPayload();
- if ((this instanceof V4KeyAsSegment)) {
+ if ((this instanceof KeyAsSegment)) {
final Link editLink = new Link();
editLink.setRel("edit");
editLink.setTitle(entitySetName);
diff --git a/fit/src/main/java/org/apache/olingo/fit/Demo.java b/fit/src/main/java/org/apache/olingo/fit/Demo.java
new file mode 100644
index 0000000..c591f01
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/Demo.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.fit;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.fit.metadata.Metadata;
+import org.apache.olingo.fit.methods.PATCH;
+import org.apache.olingo.fit.utils.Accept;
+import org.apache.olingo.fit.utils.ConstantKey;
+import org.apache.olingo.fit.utils.Constants;
+import org.apache.olingo.fit.utils.FSManager;
+import org.springframework.stereotype.Service;
+
+@Service
+@Path("/V40/Demo.svc")
+public class Demo extends Services {
+
+ public Demo() throws IOException {
+ super(new Metadata(FSManager.instance(ODataServiceVersion.V40).
+ readRes("demo" + StringUtils.capitalize(Constants.get(ConstantKey.METADATA)), Accept.XML)));
+ }
+
+ private Response replaceServiceName(final Response response) {
+ try {
+ final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
+ replaceAll("Static\\.svc", "Demo.svc");
+
+ final Response.ResponseBuilder builder = Response.status(response.getStatus());
+ for (String headerName : response.getHeaders().keySet()) {
+ for (Object headerValue : response.getHeaders().get(headerName)) {
+ builder.header(headerName, headerValue);
+ }
+ }
+
+ final InputStream toBeStreamedBack = IOUtils.toInputStream(content, Constants.ENCODING);
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ IOUtils.copy(toBeStreamedBack, baos);
+ IOUtils.closeQuietly(toBeStreamedBack);
+
+ builder.header("Content-Length", baos.size());
+ builder.entity(new ByteArrayInputStream(baos.toByteArray()));
+
+ return builder.build();
+ } catch (Exception e) {
+ return response;
+ }
+ }
+
+ @GET
+ @Path("/$metadata")
+ @Produces(MediaType.APPLICATION_XML)
+ @Override
+ public Response getMetadata() {
+ return super.getMetadata(
+ "demo" + StringUtils.capitalize(Constants.get(ConstantKey.METADATA)));
+ }
+
+ @GET
+ @Path("/{entitySetName}({entityId})")
+ @Override
+ public Response getEntity(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
+ @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
+
+ return replaceServiceName(super.getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
+ accept, entitySetName, entityId, format, expand, select));
+ }
+
+ @GET
+ @Path("/{entitySetName}({entityId})/$value")
+ @Override
+ public Response getMediaEntity(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId) {
+
+ return super.getMediaEntity(uriInfo, accept, entitySetName, entityId);
+ }
+
+ @POST
+ @Path("/{entitySetName}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
+ @Override
+ public Response postNewEntity(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @PathParam("entitySetName") final String entitySetName,
+ final String entity) {
+
+ return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
+ }
+
+ @PATCH
+ @Path("/{entitySetName}({entityId})")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Override
+ public Response patchEntity(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) final String ifMatch,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ final String changes) {
+
+ return replaceServiceName(super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId,
+ changes));
+ }
+
+ @PUT
+ @Produces({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.WILDCARD, MediaType.APPLICATION_OCTET_STREAM })
+ @Path("/{entitySetName}({entityId})/$value")
+ @Override
+ public Response replaceMediaEntity(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ final String value) {
+
+ return super.replaceMediaEntity(uriInfo, prefer, entitySetName, entityId, format, value);
+ }
+}
diff --git a/fit/src/main/java/org/apache/olingo/fit/KeyAsSegment.java b/fit/src/main/java/org/apache/olingo/fit/KeyAsSegment.java
new file mode 100644
index 0000000..ef8ffa5
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/KeyAsSegment.java
@@ -0,0 +1,159 @@
+/*
+ * 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 java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.fit.methods.PATCH;
+import org.apache.olingo.fit.utils.Constants;
+import org.springframework.stereotype.Service;
+
+@Service
+@Path("/V40/KeyAsSegment.svc")
+public class KeyAsSegment extends Services {
+
+ public KeyAsSegment() throws IOException {
+ super();
+ }
+
+ private Response replaceServiceName(final Response response) {
+ try {
+ final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
+ replaceAll("Static\\.svc", "KeyAsSegment.svc");
+
+ final Response.ResponseBuilder builder = Response.status(response.getStatus());
+ for (String headerName : response.getHeaders().keySet()) {
+ for (Object headerValue : response.getHeaders().get(headerName)) {
+ builder.header(headerName, headerValue);
+ }
+ }
+
+ final InputStream toBeStreamedBack = IOUtils.toInputStream(content, Constants.ENCODING);
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ IOUtils.copy(toBeStreamedBack, baos);
+ IOUtils.closeQuietly(toBeStreamedBack);
+
+ builder.header("Content-Length", baos.size());
+ builder.entity(new ByteArrayInputStream(baos.toByteArray()));
+
+ return builder.build();
+ } catch (Exception e) {
+ return response;
+ }
+ }
+
+ @GET
+ @Path("/{entitySetName}/{entityId}")
+ @Override
+ public Response getEntity(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
+ @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
+
+ return replaceServiceName(super.getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
+ accept, entitySetName, entityId, format, expand, select));
+ }
+
+ @DELETE
+ @Path("/{entitySetName}/{entityId}")
+ @Override
+ public Response removeEntity(
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId) {
+
+ return replaceServiceName(super.removeEntity(entitySetName, entityId));
+ }
+
+ @PATCH
+ @Path("/{entitySetName}/{entityId}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Override
+ public Response patchEntity(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) final String ifMatch,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ final String changes) {
+
+ return replaceServiceName(super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId,
+ changes));
+ }
+
+ @PUT
+ @Path("/{entitySetName}/{entityId}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ public Response putNewEntity(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ final String entity) {
+
+ return replaceServiceName(super
+ .replaceEntity(uriInfo, accept, contentType, prefer, entitySetName, entityId, entity));
+ }
+
+ @POST
+ @Path("/{entitySetName}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
+ @Override
+ public Response postNewEntity(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @PathParam("entitySetName") final String entitySetName,
+ final String entity) {
+
+ return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
+ }
+}
diff --git a/fit/src/main/java/org/apache/olingo/fit/NorthWind.java b/fit/src/main/java/org/apache/olingo/fit/NorthWind.java
new file mode 100644
index 0000000..f5acaed
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/NorthWind.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.fit;
+
+import java.io.IOException;
+
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+
+import org.apache.cxf.interceptor.InInterceptors;
+import org.apache.olingo.fit.rest.XHTTPMethodInterceptor;
+import org.apache.olingo.fit.utils.ConstantKey;
+import org.apache.olingo.fit.utils.Constants;
+import org.springframework.stereotype.Service;
+
+@Service
+@Path("/V40/NorthWind.svc")
+@InInterceptors(classes = XHTTPMethodInterceptor.class)
+public class NorthWind extends Services {
+
+ public NorthWind() throws IOException {
+ super();
+ }
+
+ @Override
+ public Response getMetadata() {
+ return getMetadata("northwind-" + Constants.get(ConstantKey.METADATA));
+ }
+}
diff --git a/fit/src/main/java/org/apache/olingo/fit/NorthWindExt.java b/fit/src/main/java/org/apache/olingo/fit/NorthWindExt.java
new file mode 100644
index 0000000..61e0df6
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/NorthWindExt.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.fit;
+
+import java.io.IOException;
+
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+
+import org.apache.cxf.interceptor.InInterceptors;
+import org.apache.olingo.fit.rest.ResolvingReferencesInterceptor;
+import org.apache.olingo.fit.rest.XHTTPMethodInterceptor;
+import org.apache.olingo.fit.utils.ConstantKey;
+import org.apache.olingo.fit.utils.Constants;
+import org.springframework.stereotype.Service;
+
+@Service
+@Path("/V40/NorthWindExt.svc")
+@InInterceptors(classes = { XHTTPMethodInterceptor.class, ResolvingReferencesInterceptor.class })
+public class NorthWindExt extends Services {
+
+ public NorthWindExt() throws IOException {
+ super();
+ }
+
+ @Override
+ public Response getMetadata() {
+ return getMetadata("northwindExt-" + Constants.get(ConstantKey.METADATA));
+ }
+}
diff --git a/fit/src/main/java/org/apache/olingo/fit/OAuth2.java b/fit/src/main/java/org/apache/olingo/fit/OAuth2.java
new file mode 100644
index 0000000..9b2c9f1
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/OAuth2.java
@@ -0,0 +1,35 @@
+/*
+ * 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 java.io.IOException;
+
+import javax.ws.rs.Path;
+
+import org.springframework.stereotype.Service;
+
+@Service
+@Path("/V40/OAuth2.svc")
+public class OAuth2 extends Services {
+
+ public OAuth2() throws IOException {
+ super();
+ }
+
+}
diff --git a/fit/src/main/java/org/apache/olingo/fit/OpenType.java b/fit/src/main/java/org/apache/olingo/fit/OpenType.java
new file mode 100644
index 0000000..e65c5bf
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/OpenType.java
@@ -0,0 +1,140 @@
+/*
+ * 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 java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.fit.metadata.Metadata;
+import org.apache.olingo.fit.utils.Accept;
+import org.apache.olingo.fit.utils.ConstantKey;
+import org.apache.olingo.fit.utils.Constants;
+import org.apache.olingo.fit.utils.FSManager;
+import org.springframework.stereotype.Service;
+
+@Service
+@Path("/V40/OpenType.svc")
+public class OpenType extends Services {
+
+ public OpenType() throws IOException {
+ super(new Metadata(FSManager.instance(ODataServiceVersion.V40).
+ readRes("openType" + StringUtils.capitalize(Constants.get(ConstantKey.METADATA)), Accept.XML)));
+ }
+
+ private Response replaceServiceName(final Response response) {
+ try {
+ final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
+ replaceAll("Static\\.svc", "OpenType.svc");
+
+ final Response.ResponseBuilder builder = Response.status(response.getStatus());
+ for (String headerName : response.getHeaders().keySet()) {
+ for (Object headerValue : response.getHeaders().get(headerName)) {
+ builder.header(headerName, headerValue);
+ }
+ }
+
+ final InputStream toBeStreamedBack = IOUtils.toInputStream(content, Constants.ENCODING);
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ IOUtils.copy(toBeStreamedBack, baos);
+ IOUtils.closeQuietly(toBeStreamedBack);
+
+ builder.header("Content-Length", baos.size());
+ builder.entity(new ByteArrayInputStream(baos.toByteArray()));
+
+ return builder.build();
+ } catch (Exception e) {
+ return response;
+ }
+ }
+
+ /**
+ * Provide sample large metadata.
+ *
+ * @return metadata.
+ */
+ @GET
+ @Path("/$metadata")
+ @Produces(MediaType.APPLICATION_XML)
+ @Override
+ public Response getMetadata() {
+ return super.getMetadata("openType" + StringUtils.capitalize(Constants.get(ConstantKey.METADATA)));
+ }
+
+ @GET
+ @Path("/{entitySetName}({entityId})")
+ @Override
+ public Response getEntity(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
+ @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
+
+ return replaceServiceName(super.getEntityInternal(
+ uriInfo.getRequestUri().toASCIIString(), accept, entitySetName, entityId, format, expand, select));
+ }
+
+ @POST
+ @Path("/{entitySetName}")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
+ @Override
+ public Response postNewEntity(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @PathParam("entitySetName") final String entitySetName,
+ final String entity) {
+
+ return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
+ }
+
+ @DELETE
+ @Path("/{entitySetName}({entityId})")
+ @Override
+ public Response removeEntity(
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId) {
+
+ return replaceServiceName(super.removeEntity(entitySetName, entityId));
+ }
+}
diff --git a/fit/src/main/java/org/apache/olingo/fit/Services.java b/fit/src/main/java/org/apache/olingo/fit/Services.java
new file mode 100644
index 0000000..68e2c64
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/Services.java
@@ -0,0 +1,1448 @@
+/*
+ * 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 java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.regex.Pattern;
+
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMultipart;
+import javax.ws.rs.BadRequestException;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.math.NumberUtils;
+import org.apache.cxf.interceptor.InInterceptors;
+import org.apache.cxf.jaxrs.ext.multipart.Attachment;
+import org.apache.cxf.jaxrs.ext.multipart.Multipart;
+import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+import org.apache.olingo.fit.metadata.Metadata;
+import org.apache.olingo.fit.methods.PATCH;
+import org.apache.olingo.fit.rest.ResolvingReferencesInterceptor;
+import org.apache.olingo.fit.rest.XHTTPMethodInterceptor;
+import org.apache.olingo.fit.utils.AbstractUtilities;
+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.FSManager;
+import org.apache.olingo.fit.utils.LinkInfo;
+import org.springframework.stereotype.Service;
+
+@Service
+@Path("/V40/Static.svc")
+@InInterceptors(classes = { XHTTPMethodInterceptor.class, ResolvingReferencesInterceptor.class })
+public class Services extends AbstractServices {
+
+ /**
+ * CR/LF.
+ */
+ protected static final byte[] CRLF = { 13, 10 };
+
+ protected static final Pattern RELENTITY_SELECT_PATTERN = Pattern.compile("^.*\\(\\$select=.*\\)$");
+
+ protected static final Pattern CROSSJOIN_PATTERN = Pattern.compile(
+ "^\\$crossjoin\\(.*\\)\\?\\$filter=\\([a-zA-Z/]+ eq [a-zA-Z/]+\\)$");
+
+ private final Map<String, String> providedAsync = new HashMap<String, String>();
+
+ public Services() throws IOException {
+ super(ODataServiceVersion.V40, Commons.getMetadata(ODataServiceVersion.V40));
+ }
+
+ protected Services(final Metadata metadata) throws IOException {
+ super(ODataServiceVersion.V40, metadata);
+ }
+
+ @GET
+ @Path("/redirect/{name}({id})")
+ public Response conformanceRedirect(
+ @Context final UriInfo uriInfo,
+ @PathParam("name") final String name,
+ @PathParam("id") final String id) {
+ return Response.temporaryRedirect(
+ URI.create(uriInfo.getRequestUri().toASCIIString().replace("/redirect", ""))).build();
+ }
+
+ @GET
+ @Path("/$crossjoin({elements:.*})")
+ public Response crossjoin(
+ @PathParam("elements") final String elements,
+ @QueryParam("$filter") final String filter) {
+
+ try {
+ if (CROSSJOIN_PATTERN.matcher("$crossjoin(" + elements + ")?$filter=" + filter).matches()) {
+ final InputStream feed = FSManager.instance(version).readFile("crossjoin", Accept.JSON);
+
+ return xml.createResponse(feed, null, Accept.JSON_FULLMETA);
+ } else {
+ throw new IOException("Unexpected crossjoin pattern");
+ }
+ } catch (Exception e) {
+ return xml.createFaultResponse(Accept.JSON.toString(), e);
+ }
+ }
+
+ @GET
+ @Path("/relatedEntitySelect/{path:.*}")
+ public Response relatedEntitySelect(
+ @PathParam("path") final String path,
+ @QueryParam("$expand") final String expand) {
+
+ if (RELENTITY_SELECT_PATTERN.matcher(expand).matches()) {
+ return xml.createResponse(null, null, Accept.JSON_FULLMETA);
+ } else {
+ return xml.createFaultResponse(Accept.JSON.toString(), new Exception("Unexpected expand pattern"));
+ }
+ }
+
+ @DELETE
+ @Path("/monitor/{name}")
+ public Response removeMonitor(@PathParam("name") final String name) {
+ providedAsync.remove(name);
+ return xml.createResponse(null, null, null, Status.NO_CONTENT);
+ }
+
+ @GET
+ @Path("/monitor/{name}")
+ public Response async(@PathParam("name") final String name) {
+ try {
+ if (!providedAsync.containsKey(name)) {
+ throw new NotFoundException();
+ }
+ final InputStream res = IOUtils.toInputStream(providedAsync.get(name), Constants.ENCODING);
+ providedAsync.remove(name);
+ return xml.createMonitorResponse(res);
+ } catch (Exception e) {
+ return xml.createFaultResponse(Accept.JSON_FULLMETA.toString(), e);
+ }
+ }
+
+ @PUT
+ @Path("/People(1)/Parent")
+ public Response changeSingleValuedNavigationPropertyReference(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ final String content) {
+
+ try {
+ final Accept contentTypeValue = Accept.parse(contentType);
+ assert contentTypeValue == Accept.JSON;
+
+ jsonDeserializer.toEntity(IOUtils.toInputStream(content, Constants.ENCODING));
+
+ return Response.noContent().type(MediaType.APPLICATION_JSON).build();
+ } catch (Exception e) {
+ LOG.error("While update single property reference", e);
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @POST
+ @Path("/async/$batch")
+ public Response async(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ final @Multipart MultipartBody attachment) {
+
+ try {
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ bos.write("HTTP/1.1 200 Ok".getBytes());
+ bos.write(CRLF);
+ bos.write("OData-Version: 4.0".getBytes());
+ bos.write(CRLF);
+ bos.write(("Content-Type: " + ContentType.APPLICATION_OCTET_STREAM + ";boundary=" + BOUNDARY).getBytes());
+ bos.write(CRLF);
+ bos.write(CRLF);
+
+ bos.write(("--" + BOUNDARY).getBytes());
+ bos.write(CRLF);
+ bos.write("Content-Type: application/http".getBytes());
+ bos.write(CRLF);
+ bos.write("Content-Transfer-Encoding: binary".getBytes());
+ bos.write(CRLF);
+ bos.write(CRLF);
+
+ bos.write("HTTP/1.1 202 Accepted".getBytes());
+ bos.write(CRLF);
+ bos.write("Location: http://service-root/async-monitor".getBytes());
+ bos.write(CRLF);
+ bos.write("Retry-After: 10".getBytes());
+ bos.write(CRLF);
+ bos.write(CRLF);
+ bos.write(("--" + BOUNDARY + "--").getBytes());
+ bos.write(CRLF);
+
+ final UUID uuid = UUID.randomUUID();
+ providedAsync.put(uuid.toString(), bos.toString(Constants.ENCODING.toString()));
+
+ bos.flush();
+ bos.close();
+
+ return xml.createAsyncResponse(
+ uriInfo.getRequestUri().toASCIIString().replace("async/$batch", "") + "monitor/" + uuid.toString());
+ } catch (Exception e) {
+ return xml.createFaultResponse(Accept.JSON.toString(), e);
+ }
+ }
+
+ @GET
+ @Path("/async/{name}")
+ public Response async(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("name") final String name) {
+
+ try {
+ final Accept acceptType = Accept.parse(accept);
+ if (acceptType == Accept.XML || acceptType == Accept.TEXT) {
+ throw new UnsupportedMediaTypeException("Unsupported media type");
+ }
+
+ final String basePath = name + File.separatorChar;
+ final StringBuilder path = new StringBuilder(basePath);
+
+ path.append(metadata.getEntitySet(name).isSingleton()
+ ? Constants.get(ConstantKey.ENTITY)
+ : Constants.get(ConstantKey.FEED));
+
+ final InputStream feed = FSManager.instance(version).readFile(path.toString(), acceptType);
+
+ final StringBuilder builder = new StringBuilder();
+ builder.append("HTTP/1.1 200 Ok").append(new String(CRLF));
+ builder.append("Content-Type: ").append(accept).append(new String(CRLF)).append(new String(CRLF));
+ builder.append(IOUtils.toString(feed));
+ IOUtils.closeQuietly(feed);
+
+ final UUID uuid = UUID.randomUUID();
+ providedAsync.put(uuid.toString(), builder.toString());
+
+ return xml.createAsyncResponse(
+ uriInfo.getRequestUri().toASCIIString().replaceAll("async/" + name, "") + "monitor/" + uuid.toString());
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @Override
+ protected void setInlineCount(final EntityCollection entitySet, final String count) {
+ if ("true".equals(count)) {
+ entitySet.setCount(entitySet.getEntities().size());
+ }
+ }
+
+ @Override
+ public InputStream exploreMultipart(
+ final List<Attachment> attachments, final String boundary, final boolean continueOnError)
+ throws IOException {
+
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+ Response res = null;
+ boolean goon = true;
+ for (int i = 0; i < attachments.size() && goon; i++) {
+ try {
+ final Attachment obj = attachments.get(i);
+ bos.write(("--" + boundary).getBytes());
+ bos.write(Constants.CRLF);
+
+ final Object content = obj.getDataHandler().getContent();
+ if (content instanceof MimeMultipart) {
+ final ByteArrayOutputStream chbos = new ByteArrayOutputStream();
+ String lastContebtID = null;
+ try {
+ final Map<String, String> references = new HashMap<String, String>();
+
+ final String cboundary = "changeset_" + UUID.randomUUID().toString();
+ chbos.write(("Content-Type: multipart/mixed;boundary=" + cboundary).getBytes());
+ chbos.write(Constants.CRLF);
+ chbos.write(Constants.CRLF);
+
+ for (int j = 0; j < ((MimeMultipart) content).getCount(); j++) {
+ final MimeBodyPart part = (MimeBodyPart) ((MimeMultipart) content).getBodyPart(j);
+ lastContebtID = part.getContentID();
+ addChangesetItemIntro(chbos, lastContebtID, cboundary);
+
+ res = bodyPartRequest(new MimeBodyPart(part.getInputStream()), references);
+ if (!continueOnError && (res == null || res.getStatus() >= 400)) {
+ throw new Exception("Failure processing changeset");
+ }
+
+ addSingleBatchResponse(res, lastContebtID, chbos);
+ references.put("$" + lastContebtID, res.getHeaderString("Location"));
+ }
+
+ chbos.write(("--" + cboundary + "--").getBytes());
+ chbos.write(Constants.CRLF);
+
+ bos.write(chbos.toByteArray());
+ IOUtils.closeQuietly(chbos);
+ } catch (Exception e) {
+ LOG.warn("While processing changeset", e);
+ IOUtils.closeQuietly(chbos);
+
+ addItemIntro(bos, lastContebtID);
+
+ if (res == null || res.getStatus() < 400) {
+ addErrorBatchResponse(e, "1", bos);
+ } else {
+ addSingleBatchResponse(res, lastContebtID, bos);
+ }
+
+ goon = continueOnError;
+ }
+ } else {
+ addItemIntro(bos);
+
+ res = bodyPartRequest(new MimeBodyPart(obj.getDataHandler().getInputStream()));
+
+ if (res.getStatus() >= 400) {
+ goon = continueOnError;
+ throw new Exception("Failure processing batch item");
+ }
+
+ addSingleBatchResponse(res, bos);
+ }
+ } catch (Exception e) {
+ if (res == null || res.getStatus() < 400) {
+ addErrorBatchResponse(e, bos);
+ } else {
+ addSingleBatchResponse(res, bos);
+ }
+ }
+ }
+
+ bos.write(("--" + boundary + "--").getBytes());
+
+ return new ByteArrayInputStream(bos.toByteArray());
+ }
+
+ @GET
+ @Path("/People/{type:.*}")
+ public Response getPeople(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("type") final String type,
+ @QueryParam("$top") @DefaultValue(StringUtils.EMPTY) final String top,
+ @QueryParam("$skip") @DefaultValue(StringUtils.EMPTY) final String skip,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ @QueryParam("$inlinecount") @DefaultValue(StringUtils.EMPTY) final String count,
+ @QueryParam("$filter") @DefaultValue(StringUtils.EMPTY) final String filter,
+ @QueryParam("$search") @DefaultValue(StringUtils.EMPTY) final String search,
+ @QueryParam("$orderby") @DefaultValue(StringUtils.EMPTY) final String orderby,
+ @QueryParam("$skiptoken") @DefaultValue(StringUtils.EMPTY) final String skiptoken) {
+
+ return StringUtils.isBlank(filter) && StringUtils.isBlank(search)
+ ? NumberUtils.isNumber(type)
+ ? super.getEntityInternal(
+ uriInfo.getRequestUri().toASCIIString(), accept, "People", type, format, null, null)
+ : super.getEntitySet(accept, "People", type)
+ : super.getEntitySet(uriInfo, accept, "People", top, skip, format, count, filter, orderby, skiptoken, type);
+ }
+
+ @GET
+ @Path("/Boss")
+ public Response getSingletonBoss(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ return getEntityInternal(
+ uriInfo.getRequestUri().toASCIIString(), accept, "Boss", StringUtils.EMPTY, format, null, null);
+ }
+
+ @GET
+ @Path("/Company")
+ public Response getSingletonCompany(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ return getEntityInternal(
+ uriInfo.getRequestUri().toASCIIString(), accept, "Company", StringUtils.EMPTY, format, null, null);
+ }
+
+ @PATCH
+ @Path("/Company")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ public Response patchSingletonCompany(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) final String ifMatch,
+ final String changes) {
+
+ return super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, "Company", StringUtils.EMPTY, changes);
+ }
+
+ @GET
+ @Path("/Customers")
+ public Response getCustomers(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @QueryParam("$deltatoken") @DefaultValue(StringUtils.EMPTY) final String deltatoken) {
+
+ try {
+ final Accept acceptType;
+ if (StringUtils.isNotBlank(format)) {
+ acceptType = Accept.valueOf(format.toUpperCase());
+ } else {
+ acceptType = Accept.parse(accept);
+ }
+
+ final InputStream output;
+ if (StringUtils.isBlank(deltatoken)) {
+ final InputStream input = (InputStream) getEntitySet(
+ uriInfo, accept, "Customers", null, null, format, null, null, null, null).getEntity();
+ final EntityCollection entitySet = xml.readEntitySet(acceptType, input);
+
+ boolean trackChanges = prefer.contains("odata.track-changes");
+ if (trackChanges) {
+ entitySet.setDeltaLink(URI.create("Customers?$deltatoken=8015"));
+ }
+
+ output = xml.writeEntitySet(acceptType, new ResWrap<EntityCollection>(
+ URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + "Customers"),
+ null,
+ entitySet));
+ } else {
+ output = FSManager.instance(version).readFile("delta", acceptType);
+ }
+
+ final Response response = xml.createResponse(
+ null,
+ output,
+ null,
+ acceptType);
+ if (StringUtils.isNotBlank(prefer)) {
+ response.getHeaders().put("Preference-Applied", Collections.<Object> singletonList(prefer));
+ }
+ return response;
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @GET
+ @Path("/Company/Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount{paren:[\\(\\)]*}")
+ public Response functionGetEmployeesCount(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ try {
+ final Accept acceptType;
+ if (StringUtils.isNotBlank(format)) {
+ acceptType = Accept.valueOf(format.toUpperCase());
+ } else {
+ acceptType = Accept.parse(accept);
+ }
+
+ final Property property = new Property();
+ property.setType("Edm.Int32");
+ property.setValue(ValueType.PRIMITIVE, 2);
+ final ResWrap<Property> container = new ResWrap<Property>(
+ URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + property.getType()), null,
+ property);
+
+ return xml.createResponse(
+ null,
+ xml.writeProperty(acceptType, container),
+ null,
+ acceptType);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @POST
+ @Path("/Company/Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue{paren:[\\(\\)]*}")
+ public Response actionIncreaseRevenue(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ final String param) {
+
+ try {
+ final Accept acceptType;
+ if (StringUtils.isNotBlank(format)) {
+ acceptType = Accept.valueOf(format.toUpperCase());
+ } else {
+ acceptType = Accept.parse(accept);
+ }
+
+ final Accept contentTypeValue = Accept.parse(contentType);
+ final Entity entry = xml.readEntity(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
+
+ return xml.createResponse(
+ null,
+ xml.writeProperty(acceptType, entry.getProperty("IncreaseValue")),
+ null,
+ acceptType);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @GET
+ @Path("/Products({entityId})/Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails({param:.*})")
+ public Response functionGetProductDetails(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entityId") final String entityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ try {
+ final Accept acceptType;
+ if (StringUtils.isNotBlank(format)) {
+ acceptType = Accept.valueOf(format.toUpperCase());
+ } else {
+ acceptType = Accept.parse(accept);
+ }
+
+ final Entity entry = new Entity();
+ entry.setType("Microsoft.Test.OData.Services.ODataWCFService.ProductDetail");
+ final Property productId = new Property();
+ productId.setName("ProductID");
+ productId.setType("Edm.Int32");
+ productId.setValue(ValueType.PRIMITIVE, Integer.valueOf(entityId));
+ entry.getProperties().add(productId);
+ final Property productDetailId = new Property();
+ productDetailId.setName("ProductDetailID");
+ productDetailId.setType("Edm.Int32");
+ productDetailId.setValue(ValueType.PRIMITIVE, 2);
+ entry.getProperties().add(productDetailId);
+
+ final Link link = new Link();
+ link.setRel("edit");
+ link.setHref(URI.create(
+ Constants.get(ConstantKey.DEFAULT_SERVICE_URL)
+ + "ProductDetails(ProductID=6,ProductDetailID=1)").toASCIIString());
+ entry.setEditLink(link);
+
+ final EntityCollection feed = new EntityCollection();
+ feed.getEntities().add(entry);
+
+ final ResWrap<EntityCollection> container = new ResWrap<EntityCollection>(
+ URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + "ProductDetail"), null,
+ feed);
+
+ return xml.createResponse(
+ null,
+ xml.writeEntitySet(acceptType, container),
+ null,
+ acceptType);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @POST
+ @Path("/Products({entityId})/Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight{paren:[\\(\\)]*}")
+ public Response actionAddAccessRight(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ final String param) {
+
+ try {
+ final Accept acceptType;
+ if (StringUtils.isNotBlank(format)) {
+ acceptType = Accept.valueOf(format.toUpperCase());
+ } else {
+ acceptType = Accept.parse(accept);
+ }
+
+ final Accept contentTypeValue = Accept.parse(contentType);
+ final Entity entry = xml.readEntity(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
+
+ assert 1 == entry.getProperties().size();
+ assert entry.getProperty("accessRight") != null;
+
+ final Property property = entry.getProperty("accessRight");
+ property.setType("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel");
+
+ final ResWrap<Property> result = new ResWrap<Property>(
+ URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + property.getType()),
+ null, property);
+
+ return xml.createResponse(
+ null,
+ xml.writeProperty(acceptType, result),
+ null,
+ acceptType);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @POST
+ @Path("/Customers({personId})/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress{paren:[\\(\\)]*}")
+ public Response actionResetAddress(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("personId") final String personId,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ final String param) {
+
+ try {
+ final Accept contentTypeValue = Accept.parse(contentType);
+ final Entity entry = xml.readEntity(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
+
+ assert 2 == entry.getProperties().size();
+ assert entry.getProperty("addresses") != null;
+ assert entry.getProperty("index") != null;
+
+ return getEntityInternal(
+ uriInfo.getRequestUri().toASCIIString(), accept, "Customers", personId, format, null, null);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @GET
+ @Path("/ProductDetails(ProductID={productId},ProductDetailID={productDetailId})"
+ + "/Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct{paren:[\\(\\)]*}")
+ public Response functionGetRelatedProduct(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("productId") final String productId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ return getEntityInternal(
+ uriInfo.getRequestUri().toASCIIString(), accept, "Products", productId, format, null, null);
+ }
+
+ @POST
+ @Path("/Accounts({entityId})/Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI{paren:[\\(\\)]*}")
+ public Response actionRefreshDefaultPI(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @PathParam("entityId") final String entityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ final String param) {
+
+ try {
+ final Accept contentTypeValue = Accept.parse(contentType);
+ final Entity entry = xml.readEntity(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
+
+ assert 1 == entry.getProperties().size();
+ assert entry.getProperty("newDate") != null;
+
+ return functionGetDefaultPI(accept, entityId, format);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @GET
+ @Path("/Accounts({entityId})/Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI{paren:[\\(\\)]*}")
+ public Response functionGetDefaultPI(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entityId") final String entityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ return getContainedEntity(accept, entityId, "MyPaymentInstruments", entityId + "901", format);
+ }
+
+ @GET
+ @Path("/Accounts({entityId})/Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo{paren:[\\(\\)]*}")
+ public Response functionGetAccountInfo(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entityId") final String entityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ return getPath(accept, "Accounts", entityId, "AccountInfo", format);
+ }
+
+ @GET
+ @Path("/Accounts({entityId})/MyGiftCard/Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount({param:.*})")
+ public Response functionGetActualAmount(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entityId") final String entityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ try {
+ final Accept acceptType;
+ if (StringUtils.isNotBlank(format)) {
+ acceptType = Accept.valueOf(format.toUpperCase());
+ } else {
+ acceptType = Accept.parse(accept);
+ }
+
+ final Property property = new Property();
+ property.setType("Edm.Double");
+ property.setValue(ValueType.PRIMITIVE, 41.79);
+
+ final ResWrap<Property> container = new ResWrap<Property>((URI) null, null, property);
+
+ return xml.createResponse(
+ null,
+ xml.writeProperty(acceptType, container),
+ null,
+ acceptType);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ /**
+ * 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) final String accept,
+ @PathParam("path") final String path,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ try {
+ final Map.Entry<Accept, AbstractUtilities> 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(version).readFile(Constants.get(ConstantKey.REF)
+ + File.separatorChar + filename, utils.getKey()),
+ null,
+ utils.getKey());
+ } catch (Exception e) {
+ LOG.error("Error retrieving entity", e);
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @POST
+ @Path("/People")
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
+ public Response postPeople(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ final String entity) {
+
+ if ("{\"@odata.type\":\"#Microsoft.Test.OData.Services.ODataWCFService.Person\"}".equals(entity)) {
+ return xml.createFaultResponse(accept, new BadRequestException());
+ }
+
+ return super.postNewEntity(uriInfo, accept, contentType, prefer, "People", entity);
+ }
+
+ @Override
+ public Response patchEntity(
+ final UriInfo uriInfo,
+ final String accept,
+ final String contentType,
+ final String prefer,
+ final String ifMatch,
+ final String entitySetName,
+ final String entityId,
+ final String changes) {
+
+ final Response response =
+ getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
+ accept, entitySetName, entityId, accept, StringUtils.EMPTY, StringUtils.EMPTY);
+ return response.getStatus() >= 400
+ ? super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, changes)
+ : super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId, changes);
+ }
+
+ @Override
+ public Response replaceEntity(
+ final UriInfo uriInfo,
+ final String accept,
+ final String contentType,
+ final String prefer,
+ final String entitySetName,
+ final String entityId,
+ final String entity) {
+
+ try {
+ getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
+ accept, entitySetName, entityId, accept, StringUtils.EMPTY, StringUtils.EMPTY);
+ return super.replaceEntity(uriInfo, accept, contentType, prefer, entitySetName, entityId, entity);
+ } catch (NotFoundException e) {
+ return postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entityId);
+ }
+ }
+
+ private StringBuilder containedPath(final String entityId, final String containedEntitySetName) {
+ return new StringBuilder("Accounts").append(File.separatorChar).
+ append(entityId).append(File.separatorChar).
+ append("links").append(File.separatorChar).
+ append(containedEntitySetName);
+ }
+
+ @GET
+ @Path("/Accounts({entityId})/{containedEntitySetName}({containedEntityId})")
+ public Response getContainedEntity(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entityId") final String entityId,
+ @PathParam("containedEntitySetName") final String containedEntitySetName,
+ @PathParam("containedEntityId") final String containedEntityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ try {
+ final Accept acceptType;
+ if (StringUtils.isNotBlank(format)) {
+ acceptType = Accept.valueOf(format.toUpperCase());
+ } else {
+ acceptType = Accept.parse(accept);
+ }
+ if (acceptType == Accept.XML || acceptType == Accept.TEXT) {
+ throw new UnsupportedMediaTypeException("Unsupported media type");
+ }
+
+ final StringBuilder containedPath = containedPath(entityId, containedEntitySetName);
+ if (StringUtils.isNotBlank(containedEntityId)) {
+ containedPath.append('(').append(containedEntityId).append(')');
+ }
+ final InputStream entry = FSManager.instance(version).readFile(containedPath.toString(), Accept.ATOM);
+
+ final ResWrap<Entity> container = atomDeserializer.toEntity(entry);
+
+ return xml.createResponse(
+ null,
+ xml.writeEntity(acceptType, container),
+ null,
+ acceptType);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @POST
+ @Path("/Accounts({entityId})/{containedEntitySetName:.*}")
+ public Response postContainedEntity(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @PathParam("entityId") final String entityId,
+ @PathParam("containedEntitySetName") final String containedEntitySetName,
+ final String entity) {
+
+ try {
+ final Accept acceptType = Accept.parse(accept);
+ if (acceptType == Accept.XML || acceptType == Accept.TEXT) {
+ throw new UnsupportedMediaTypeException("Unsupported media type");
+ }
+
+ final AbstractUtilities utils = getUtilities(acceptType);
+
+ // 1. parse the entry (from Atom or JSON)
+ final ResWrap<Entity> entryContainer;
+ final Entity entry;
+ final Accept contentTypeValue = Accept.parse(contentType);
+ if (Accept.ATOM == contentTypeValue) {
+ entryContainer = atomDeserializer.toEntity(IOUtils.toInputStream(entity, Constants.ENCODING));
+ entry = entryContainer.getPayload();
+ } else {
+ final ResWrap<Entity> jcontainer = jsonDeserializer.toEntity(
+ IOUtils.toInputStream(entity, Constants.ENCODING));
+ entry = jcontainer.getPayload();
+
+ entryContainer = new ResWrap<Entity>(
+ jcontainer.getContextURL(),
+ jcontainer.getMetadataETag(),
+ entry);
+ }
+
+ final EdmTypeInfo contained = new EdmTypeInfo.Builder().setTypeExpression(metadata.
+ getNavigationProperties("Accounts").get(containedEntitySetName).getType()).build();
+ final String entityKey = getUtilities(contentTypeValue).
+ getDefaultEntryKey(contained.getFullQualifiedName().getName(), entry);
+
+ // 2. Store the new entity
+ final String atomEntryRelativePath = containedPath(entityId, containedEntitySetName).
+ append('(').append(entityKey).append(')').toString();
+ FSManager.instance(version).putInMemory(
+ utils.writeEntity(Accept.ATOM, entryContainer),
+ FSManager.instance(version).getAbsolutePath(atomEntryRelativePath, Accept.ATOM));
+
+ // 3. Update the contained entity set
+ final String atomFeedRelativePath = containedPath(entityId, containedEntitySetName).toString();
+ final InputStream feedIS = FSManager.instance(version).readFile(atomFeedRelativePath, Accept.ATOM);
+ final ResWrap<EntityCollection> feedContainer = atomDeserializer.toEntitySet(feedIS);
+ feedContainer.getPayload().getEntities().add(entry);
+
+ final ByteArrayOutputStream content = new ByteArrayOutputStream();
+ final OutputStreamWriter writer = new OutputStreamWriter(content, Constants.ENCODING);
+ atomSerializer.write(writer, feedContainer);
+ writer.flush();
+ writer.close();
+
+ FSManager.instance(version).putInMemory(
+ new ByteArrayInputStream(content.toByteArray()),
+ FSManager.instance(version).getAbsolutePath(atomFeedRelativePath, Accept.ATOM));
+
+ // Finally, return
+ return utils.createResponse(
+ uriInfo.getRequestUri().toASCIIString() + "(" + entityKey + ")",
+ utils.writeEntity(acceptType, entryContainer),
+ null,
+ acceptType,
+ Response.Status.CREATED);
+ } catch (Exception e) {
+ LOG.error("While creating new contained entity", e);
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @PATCH
+ @Path("/{entitySetName}({entityId})/{containedEntitySetName}({containedEntityId})")
+ public Response patchContainedEntity(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @PathParam("containedEntitySetName") final String containedEntitySetName,
+ @PathParam("containedEntityId") final String containedEntityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ final String changes) {
+
+ try {
+ final Accept acceptType;
+ if (StringUtils.isNotBlank(format)) {
+ acceptType = Accept.valueOf(format.toUpperCase());
+ } else {
+ acceptType = Accept.parse(accept);
+ }
+ if (acceptType == Accept.XML || acceptType == Accept.TEXT) {
+ throw new UnsupportedMediaTypeException("Unsupported media type");
+ }
+
+ final Accept contentTypeValue;
+ if (StringUtils.isBlank(contentType)) {
+ throw new IllegalArgumentException();
+ }
+ contentTypeValue = Accept.parse(contentType);
+
+ final LinkInfo links = xml.readLinks(
+ entitySetName, entityId, containedEntitySetName + "(" + containedEntityId + ")", Accept.ATOM);
+
+ ResWrap<Entity> container = atomDeserializer.toEntity(links.getLinks());
+ final Entity original = container.getPayload();
+
+ final Entity entryChanges;
+ if (Accept.ATOM == contentTypeValue) {
+ container = atomDeserializer.toEntity(IOUtils.toInputStream(changes, Constants.ENCODING));
+ entryChanges = container.getPayload();
+ } else {
+ final String entityType = metadata.getEntitySet(entitySetName).getType();
+ final String containedType = metadata.getEntityOrComplexType(entityType).
+ getNavigationProperty(containedEntitySetName).getType();
+ final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setTypeExpression(containedType).build();
+
+ final ResWrap<Entity> jsonContainer = jsonDeserializer.toEntity(
+ IOUtils.toInputStream(changes, Constants.ENCODING));
+ jsonContainer.getPayload().setType(typeInfo.getFullQualifiedName().toString());
+ entryChanges = jsonContainer.getPayload();
+ }
+
+ for (Property property : entryChanges.getProperties()) {
+ final Property old = original.getProperty(property.getName());
+ if (old != null) {
+ original.getProperties().remove(old);
+ }
+ original.getProperties().add(property);
+ }
+
+ FSManager.instance(version).putInMemory(new ResWrap<Entity>((URI) null, null, original),
+ xml.getLinksBasePath(entitySetName, entityId) + containedEntitySetName + "(" + containedEntityId + ")");
+
+ return xml.createResponse(null, null, acceptType, Response.Status.NO_CONTENT);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @DELETE
+ @Path("/Accounts({entityId})/{containedEntitySetName}({containedEntityId})")
+ public Response removeContainedEntity(
+ @PathParam("entityId") final String entityId,
+ @PathParam("containedEntitySetName") final String containedEntitySetName,
+ @PathParam("containedEntityId") final String containedEntityId) {
+
+ try {
+ // 1. Fetch the contained entity to be removed
+ final InputStream entry = FSManager.instance(version).
+ readFile(containedPath(entityId, containedEntitySetName).
+ append('(').append(containedEntityId).append(')').toString(), Accept.ATOM);
+ final ResWrap<Entity> container = atomDeserializer.toEntity(entry);
+
+ // 2. Remove the contained entity
+ final String atomEntryRelativePath = containedPath(entityId, containedEntitySetName).
+ append('(').append(containedEntityId).append(')').toString();
+ FSManager.instance(version).deleteFile(atomEntryRelativePath);
+
+ // 3. Update the contained entity set
+ final String atomFeedRelativePath = containedPath(entityId, containedEntitySetName).toString();
+ final InputStream feedIS = FSManager.instance(version).readFile(atomFeedRelativePath, Accept.ATOM);
+ final ResWrap<EntityCollection> feedContainer = atomDeserializer.toEntitySet(feedIS);
+ feedContainer.getPayload().getEntities().remove(container.getPayload());
+
+ final ByteArrayOutputStream content = new ByteArrayOutputStream();
+ final OutputStreamWriter writer = new OutputStreamWriter(content, Constants.ENCODING);
+ atomSerializer.write(writer, feedContainer);
+ writer.flush();
+ writer.close();
+
+ FSManager.instance(version).putInMemory(
+ new ByteArrayInputStream(content.toByteArray()),
+ FSManager.instance(version).getAbsolutePath(atomFeedRelativePath, Accept.ATOM));
+
+ return xml.createResponse(null, null, null, null, Response.Status.NO_CONTENT);
+ } catch (Exception e) {
+ return xml.createFaultResponse(Accept.XML.toString(), e);
+ }
+ }
+
+ @GET
+ @Path("/Accounts({entityId})/{containedEntitySetName:.*}")
+ public Response getContainedEntitySet(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entityId") final String entityId,
+ @PathParam("containedEntitySetName") final String containedEntitySetName,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ String tempContainedESName = containedEntitySetName;
+ if ("MyGiftCard".equals(tempContainedESName)) {
+ return getContainedEntity(accept, entityId, tempContainedESName, null, format);
+ }
+
+ try {
+ final Accept acceptType;
+ if (StringUtils.isNotBlank(format)) {
+ acceptType = Accept.valueOf(format.toUpperCase());
+ } else {
+ acceptType = Accept.parse(accept);
+ }
+ if (acceptType == Accept.XML || acceptType == Accept.TEXT) {
+ throw new UnsupportedMediaTypeException("Unsupported media type");
+ }
+
+ String derivedType = null;
+ if (tempContainedESName.contains("/")) {
+ final String[] parts = tempContainedESName.split("/");
+ tempContainedESName = parts[0];
+ derivedType = parts[1];
+ }
+
+ final InputStream feed = FSManager.instance(version).
+ readFile(containedPath(entityId, tempContainedESName).toString(), Accept.ATOM);
+
+ final ResWrap<EntityCollection> container = atomDeserializer.toEntitySet(feed);
+
+ if (derivedType != null) {
+ final List<Entity> nonMatching = new ArrayList<Entity>();
+ for (Entity entity : container.getPayload().getEntities()) {
+ if (!derivedType.equals(entity.getType())) {
+ nonMatching.add(entity);
+ }
+ }
+ container.getPayload().getEntities().removeAll(nonMatching);
+ }
+
+ return xml.createResponse(
+ null,
+ xml.writeEntitySet(acceptType, container),
+ null,
+ acceptType);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @GET
+ @Path("/GetDefaultColor()")
+ public Response functionGetDefaultColor(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ try {
+ final Accept acceptType;
+ if (StringUtils.isNotBlank(format)) {
+ acceptType = Accept.valueOf(format.toUpperCase());
+ } else {
+ acceptType = Accept.parse(accept);
+ }
+
+ final Property property = new Property();
+ property.setType("Microsoft.Test.OData.Services.ODataWCFService.Color");
+ property.setValue(ValueType.ENUM, "Red");
+ final ResWrap<Property> container = new ResWrap<Property>(
+ URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + property.getType()), null,
+ property);
+
+ return xml.createResponse(
+ null,
+ xml.writeProperty(acceptType, container),
+ null,
+ acceptType);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @GET
+ @Path("/GetPerson2({param:.*})")
+ public Response functionGetPerson2(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ return getEntityInternal(
+ uriInfo.getRequestUri().toASCIIString(), accept, "Customers", "1", format, null, null);
+ }
+
+ @GET
+ @Path("/GetPerson2({param:.*})/Emails")
+ public Response functionGetPerson2Emails(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ return getPath(accept, "Customers", "1", "Emails", format);
+ }
+
+ @GET
+ @Path("/GetPerson2({param:.*})/HomeAddress")
+ public Response functionGetPerson2HomeAddress(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ return getPath(accept, "Customers", "1", "HomeAddress", format);
+ }
+
+ @GET
+ @Path("/GetPerson2({param:.*})/Parent")
+ public Response functionGetPerson2Parent(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ return getEntityInternal(
+ uriInfo.getRequestUri().toASCIIString(), accept, "Customers", "2", format, null, null);
+ }
+
+ @GET
+ @Path("/GetPerson({param:.*})")
+ public Response functionGetPerson(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ return getEntityInternal(
+ uriInfo.getRequestUri().toASCIIString(), accept, "Customers", "1", format, null, null);
+ }
+
+ @GET
+ @Path("/GetAllProducts()")
+ public Response functionGetAllProducts(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ return getEntitySet(uriInfo, accept, "Products", null, null, format, null, null, null, null);
+ }
+
+ @GET
+ @Path("/GetProductsByAccessLevel({param:.*})")
+ public Response functionGetProductsByAccessLevel(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ try {
+ final Accept acceptType;
+ if (StringUtils.isNotBlank(format)) {
+ acceptType = Accept.valueOf(format.toUpperCase());
+ } else {
+ acceptType = Accept.parse(accept);
+ }
+
+ final Property property = new Property();
+ property.setType("Collection(String)");
+ final List<String> value = Arrays.asList("Cheetos", "Mushrooms", "Apple", "Car", "Computer");
+ property.setValue(ValueType.COLLECTION_PRIMITIVE, value);
+ final ResWrap<Property> container = new ResWrap<Property>(
+ URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + property.getType()), null,
+ property);
+
+ return xml.createResponse(
+ null,
+ xml.writeProperty(acceptType, container),
+ null,
+ acceptType);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @GET
+ @Path("/GetBossEmails({param:.*})")
+ public Response functionGetBossEmails(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
+
+ try {
+ final Accept acceptType;
+ if (StringUtils.isNotBlank(format)) {
+ acceptType = Accept.valueOf(format.toUpperCase());
+ } else {
+ acceptType = Accept.parse(accept);
+ }
+
+ final Property property = new Property();
+ property.setType("Collection(Edm.String)");
+ property.setValue(ValueType.COLLECTION_PRIMITIVE,
+ Arrays.asList("first@olingo.apache.org", "second@olingo.apache.org"));
+ final ResWrap<Property> container = new ResWrap<Property>(
+ URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + property.getType()), null,
+ property);
+
+ return xml.createResponse(null, xml.writeProperty(acceptType, container), null, acceptType);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @POST
+ @Path("/Discount()")
+ public Response actionDiscount(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ final String param) {
+
+ try {
+ final Accept acceptType;
+ if (StringUtils.isNotBlank(format)) {
+ acceptType = Accept.valueOf(format.toUpperCase());
+ } else {
+ acceptType = Accept.parse(accept);
+ }
+
+ final Accept contentTypeValue = Accept.parse(contentType);
+ Property property;
+ if (contentTypeValue == Accept.ATOM) {
+ final ResWrap<Property> paramContainer = atomDeserializer.toProperty(
+ IOUtils.toInputStream(param, Constants.ENCODING));
+ property = paramContainer.getPayload();
+ } else {
+ final ResWrap<Property> paramContainer = jsonDeserializer.toProperty(
+ IOUtils.toInputStream(param, Constants.ENCODING));
+ property = paramContainer.getPayload();
+ }
+
+ assert property.isComplex();
+ assert 1 == property.asComplex().getValue().size();
+ assert "Edm.Int32".equals(property.asComplex().getValue().get(0).getType());
+ assert property.asComplex().getValue().get(0).isPrimitive();
+ assert "percentage".equals(property.asComplex().getValue().get(0).getName());
+
+ return xml.createResponse(null, null, null, acceptType, Response.Status.NO_CONTENT);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @POST
+ @Path("/GetAllProducts()/Discount")
+ public Response actionBoundDiscount() {
+ try {
+ final String basePath = "Products" + File.separatorChar + "feed";
+
+ final InputStream feed = FSManager.instance(version).readFile(basePath, Accept.JSON_FULLMETA);
+ return xml.createResponse(null, feed, Commons.getETag(basePath), Accept.JSON_FULLMETA);
+ } catch (Exception e) {
+ return xml.createFaultResponse(Accept.JSON_FULLMETA.toString(), e);
+ }
+ }
+
+ @POST
+ @Path("/ResetBossAddress()")
+ public Response actionResetBossAddress(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ final String param) {
+
+ try {
+ final Accept acceptType;
+ if (StringUtils.isNotBlank(format)) {
+ acceptType = Accept.valueOf(format.toUpperCase());
+ } else {
+ acceptType = Accept.parse(accept);
+ }
+
+ final Accept contentTypeValue = Accept.parse(contentType);
+ final Entity entity = xml.readEntity(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
+
+ assert "Microsoft.Test.OData.Services.ODataWCFService.Address".equals(entity.getType());
+ assert entity.getProperty("address").isComplex();
+
+ final ResWrap<Property> result = new ResWrap<Property>(
+ URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX)
+ + "Microsoft.Test.OData.Services.ODataWCFService.Address"),
+ null,
+ entity.getProperty("address"));
+
+ return xml.createResponse(
+ null,
+ xml.writeProperty(acceptType, result),
+ null,
+ acceptType);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @POST
+ @Path("/ResetBossEmail()")
+ public Response actionResetBossEmail(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ final String param) {
+
+ try {
+ final Accept acceptType;
+ if (StringUtils.isNotBlank(format)) {
+ acceptType = Accept.valueOf(format.toUpperCase());
+ } else {
+ acceptType = Accept.parse(accept);
+ }
+
+ final Accept contentTypeValue = Accept.parse(contentType);
+ final Entity entry = xml.readEntity(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
+
+ assert 1 == entry.getProperties().size();
+ assert "Collection(Edm.String)".equals(entry.getProperty("emails").getType());
+ assert entry.getProperty("emails").isCollection();
+
+ return xml.createResponse(
+ null,
+ xml.writeProperty(acceptType, entry.getProperty("emails")),
+ null,
+ acceptType);
+ } catch (Exception e) {
+ return xml.createFaultResponse(accept, e);
+ }
+ }
+
+ @POST
+ @Path("/Products({productId})/Categories/$ref")
+ public Response createLinked(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ final String entity) {
+
+ return xml.createResponse(null, null, null, Status.NO_CONTENT);
+ }
+
+ @POST
+ @Path("/Customers(1)/Orders/$ref")
+ public Response linkOrderViaRef(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ final String entity) {
+
+ return xml.createResponse(null, null, null, Status.NO_CONTENT);
+ }
+
+ @DELETE
+ @Path("/Products({productId})/Categories({categoryId})/$ref")
+ public Response deleteLinked(
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ final String entity) {
+
+ return xml.createResponse(null, null, null, Status.NO_CONTENT);
+ }
+
+ @GET
+ @Path("/Company/VipCustomer")
+ public Response getVipCustomer(
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
+ @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
+
+ return super.getEntityInternal(
+ uriInfo.getRequestUri().toASCIIString(), accept, "VipCustomer", "1", format, expand, select);
+ }
+}
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4Demo.java b/fit/src/main/java/org/apache/olingo/fit/V4Demo.java
deleted file mode 100644
index e723cde..0000000
--- a/fit/src/main/java/org/apache/olingo/fit/V4Demo.java
+++ /dev/null
@@ -1,174 +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.fit;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.fit.metadata.Metadata;
-import org.apache.olingo.fit.methods.PATCH;
-import org.apache.olingo.fit.utils.Accept;
-import org.apache.olingo.fit.utils.ConstantKey;
-import org.apache.olingo.fit.utils.Constants;
-import org.apache.olingo.fit.utils.FSManager;
-import org.springframework.stereotype.Service;
-
-@Service
-@Path("/V40/Demo.svc")
-public class V4Demo extends V4Services {
-
- public V4Demo() throws IOException {
- super(new Metadata(FSManager.instance(ODataServiceVersion.V40).
- readRes("demo" + StringUtils.capitalize(Constants.get(ConstantKey.METADATA)), Accept.XML)));
- }
-
- private Response replaceServiceName(final Response response) {
- try {
- final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
- replaceAll("Static\\.svc", "Demo.svc");
-
- final Response.ResponseBuilder builder = Response.status(response.getStatus());
- for (String headerName : response.getHeaders().keySet()) {
- for (Object headerValue : response.getHeaders().get(headerName)) {
- builder.header(headerName, headerValue);
- }
- }
-
- final InputStream toBeStreamedBack = IOUtils.toInputStream(content, Constants.ENCODING);
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- IOUtils.copy(toBeStreamedBack, baos);
- IOUtils.closeQuietly(toBeStreamedBack);
-
- builder.header("Content-Length", baos.size());
- builder.entity(new ByteArrayInputStream(baos.toByteArray()));
-
- return builder.build();
- } catch (Exception e) {
- return response;
- }
- }
-
- @GET
- @Path("/$metadata")
- @Produces(MediaType.APPLICATION_XML)
- @Override
- public Response getMetadata() {
- return super.getMetadata(
- "demo" + StringUtils.capitalize(Constants.get(ConstantKey.METADATA)));
- }
-
- @GET
- @Path("/{entitySetName}({entityId})")
- @Override
- public Response getEntity(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @PathParam("entitySetName") final String entitySetName,
- @PathParam("entityId") final String entityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
- @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
-
- return replaceServiceName(super.getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
- accept, entitySetName, entityId, format, expand, select));
- }
-
- @GET
- @Path("/{entitySetName}({entityId})/$value")
- @Override
- public Response getMediaEntity(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @PathParam("entitySetName") final String entitySetName,
- @PathParam("entityId") final String entityId) {
-
- return super.getMediaEntity(uriInfo, accept, entitySetName, entityId);
- }
-
- @POST
- @Path("/{entitySetName}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
- @Override
- public Response postNewEntity(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
- @PathParam("entitySetName") final String entitySetName,
- final String entity) {
-
- return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
- }
-
- @PATCH
- @Path("/{entitySetName}({entityId})")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
- @Override
- public Response patchEntity(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
- @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) final String ifMatch,
- @PathParam("entitySetName") final String entitySetName,
- @PathParam("entityId") final String entityId,
- final String changes) {
-
- return replaceServiceName(super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId,
- changes));
- }
-
- @PUT
- @Produces({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.WILDCARD, MediaType.APPLICATION_OCTET_STREAM })
- @Path("/{entitySetName}({entityId})/$value")
- @Override
- public Response replaceMediaEntity(
- @Context final UriInfo uriInfo,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
- @PathParam("entitySetName") final String entitySetName,
- @PathParam("entityId") final String entityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- final String value) {
-
- return super.replaceMediaEntity(uriInfo, prefer, entitySetName, entityId, format, value);
- }
-}
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4KeyAsSegment.java b/fit/src/main/java/org/apache/olingo/fit/V4KeyAsSegment.java
deleted file mode 100644
index dbb7cca..0000000
--- a/fit/src/main/java/org/apache/olingo/fit/V4KeyAsSegment.java
+++ /dev/null
@@ -1,159 +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.fit;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.fit.methods.PATCH;
-import org.apache.olingo.fit.utils.Constants;
-import org.springframework.stereotype.Service;
-
-@Service
-@Path("/V40/KeyAsSegment.svc")
-public class V4KeyAsSegment extends V4Services {
-
- public V4KeyAsSegment() throws IOException {
- super();
- }
-
- private Response replaceServiceName(final Response response) {
- try {
- final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
- replaceAll("Static\\.svc", "KeyAsSegment.svc");
-
- final Response.ResponseBuilder builder = Response.status(response.getStatus());
- for (String headerName : response.getHeaders().keySet()) {
- for (Object headerValue : response.getHeaders().get(headerName)) {
- builder.header(headerName, headerValue);
- }
- }
-
- final InputStream toBeStreamedBack = IOUtils.toInputStream(content, Constants.ENCODING);
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- IOUtils.copy(toBeStreamedBack, baos);
- IOUtils.closeQuietly(toBeStreamedBack);
-
- builder.header("Content-Length", baos.size());
- builder.entity(new ByteArrayInputStream(baos.toByteArray()));
-
- return builder.build();
- } catch (Exception e) {
- return response;
- }
- }
-
- @GET
- @Path("/{entitySetName}/{entityId}")
- @Override
- public Response getEntity(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @PathParam("entitySetName") final String entitySetName,
- @PathParam("entityId") final String entityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
- @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
-
- return replaceServiceName(super.getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
- accept, entitySetName, entityId, format, expand, select));
- }
-
- @DELETE
- @Path("/{entitySetName}/{entityId}")
- @Override
- public Response removeEntity(
- @PathParam("entitySetName") final String entitySetName,
- @PathParam("entityId") final String entityId) {
-
- return replaceServiceName(super.removeEntity(entitySetName, entityId));
- }
-
- @PATCH
- @Path("/{entitySetName}/{entityId}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
- @Override
- public Response patchEntity(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
- @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) final String ifMatch,
- @PathParam("entitySetName") final String entitySetName,
- @PathParam("entityId") final String entityId,
- final String changes) {
-
- return replaceServiceName(super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId,
- changes));
- }
-
- @PUT
- @Path("/{entitySetName}/{entityId}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
- public Response putNewEntity(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
- @PathParam("entitySetName") final String entitySetName,
- @PathParam("entityId") final String entityId,
- final String entity) {
-
- return replaceServiceName(super
- .replaceEntity(uriInfo, accept, contentType, prefer, entitySetName, entityId, entity));
- }
-
- @POST
- @Path("/{entitySetName}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
- @Override
- public Response postNewEntity(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
- @PathParam("entitySetName") final String entitySetName,
- final String entity) {
-
- return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
- }
-}
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java b/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
deleted file mode 100644
index 071e717..0000000
--- a/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
+++ /dev/null
@@ -1,45 +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.fit;
-
-import java.io.IOException;
-
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Response;
-
-import org.apache.cxf.interceptor.InInterceptors;
-import org.apache.olingo.fit.rest.XHTTPMethodInterceptor;
-import org.apache.olingo.fit.utils.ConstantKey;
-import org.apache.olingo.fit.utils.Constants;
-import org.springframework.stereotype.Service;
-
-@Service
-@Path("/V40/NorthWind.svc")
-@InInterceptors(classes = XHTTPMethodInterceptor.class)
-public class V4NorthWind extends V4Services {
-
- public V4NorthWind() throws IOException {
- super();
- }
-
- @Override
- public Response getMetadata() {
- return getMetadata("northwind-" + Constants.get(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
deleted file mode 100644
index fad9bda..0000000
--- a/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
+++ /dev/null
@@ -1,46 +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.fit;
-
-import java.io.IOException;
-
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Response;
-
-import org.apache.cxf.interceptor.InInterceptors;
-import org.apache.olingo.fit.rest.ResolvingReferencesInterceptor;
-import org.apache.olingo.fit.rest.XHTTPMethodInterceptor;
-import org.apache.olingo.fit.utils.ConstantKey;
-import org.apache.olingo.fit.utils.Constants;
-import org.springframework.stereotype.Service;
-
-@Service
-@Path("/V40/NorthWindExt.svc")
-@InInterceptors(classes = { XHTTPMethodInterceptor.class, ResolvingReferencesInterceptor.class })
-public class V4NorthWindExt extends V4Services {
-
- public V4NorthWindExt() throws IOException {
- super();
- }
-
- @Override
- public Response getMetadata() {
- return getMetadata("northwindExt-" + Constants.get(ConstantKey.METADATA));
- }
-}
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4OAuth2.java b/fit/src/main/java/org/apache/olingo/fit/V4OAuth2.java
deleted file mode 100644
index a0ab3be..0000000
--- a/fit/src/main/java/org/apache/olingo/fit/V4OAuth2.java
+++ /dev/null
@@ -1,35 +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.fit;
-
-import java.io.IOException;
-
-import javax.ws.rs.Path;
-
-import org.springframework.stereotype.Service;
-
-@Service
-@Path("/V40/OAuth2.svc")
-public class V4OAuth2 extends V4Services {
-
- public V4OAuth2() throws IOException {
- super();
- }
-
-}
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4OpenType.java b/fit/src/main/java/org/apache/olingo/fit/V4OpenType.java
deleted file mode 100644
index ba902f5..0000000
--- a/fit/src/main/java/org/apache/olingo/fit/V4OpenType.java
+++ /dev/null
@@ -1,140 +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.fit;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.fit.metadata.Metadata;
-import org.apache.olingo.fit.utils.Accept;
-import org.apache.olingo.fit.utils.ConstantKey;
-import org.apache.olingo.fit.utils.Constants;
-import org.apache.olingo.fit.utils.FSManager;
-import org.springframework.stereotype.Service;
-
-@Service
-@Path("/V40/OpenType.svc")
-public class V4OpenType extends V4Services {
-
- public V4OpenType() throws IOException {
- super(new Metadata(FSManager.instance(ODataServiceVersion.V40).
- readRes("openType" + StringUtils.capitalize(Constants.get(ConstantKey.METADATA)), Accept.XML)));
- }
-
- private Response replaceServiceName(final Response response) {
- try {
- final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
- replaceAll("Static\\.svc", "OpenType.svc");
-
- final Response.ResponseBuilder builder = Response.status(response.getStatus());
- for (String headerName : response.getHeaders().keySet()) {
- for (Object headerValue : response.getHeaders().get(headerName)) {
- builder.header(headerName, headerValue);
- }
- }
-
- final InputStream toBeStreamedBack = IOUtils.toInputStream(content, Constants.ENCODING);
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- IOUtils.copy(toBeStreamedBack, baos);
- IOUtils.closeQuietly(toBeStreamedBack);
-
- builder.header("Content-Length", baos.size());
- builder.entity(new ByteArrayInputStream(baos.toByteArray()));
-
- return builder.build();
- } catch (Exception e) {
- return response;
- }
- }
-
- /**
- * Provide sample large metadata.
- *
- * @return metadata.
- */
- @GET
- @Path("/$metadata")
- @Produces(MediaType.APPLICATION_XML)
- @Override
- public Response getMetadata() {
- return super.getMetadata("openType" + StringUtils.capitalize(Constants.get(ConstantKey.METADATA)));
- }
-
- @GET
- @Path("/{entitySetName}({entityId})")
- @Override
- public Response getEntity(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @PathParam("entitySetName") final String entitySetName,
- @PathParam("entityId") final String entityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
- @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
-
- return replaceServiceName(super.getEntityInternal(
- uriInfo.getRequestUri().toASCIIString(), accept, entitySetName, entityId, format, expand, select));
- }
-
- @POST
- @Path("/{entitySetName}")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
- @Override
- public Response postNewEntity(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
- @PathParam("entitySetName") final String entitySetName,
- final String entity) {
-
- return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
- }
-
- @DELETE
- @Path("/{entitySetName}({entityId})")
- @Override
- public Response removeEntity(
- @PathParam("entitySetName") final String entitySetName,
- @PathParam("entityId") final String entityId) {
-
- return replaceServiceName(super.removeEntity(entitySetName, entityId));
- }
-}
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4Services.java b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
deleted file mode 100644
index c3d8a77..0000000
--- a/fit/src/main/java/org/apache/olingo/fit/V4Services.java
+++ /dev/null
@@ -1,1448 +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.fit;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStreamWriter;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.regex.Pattern;
-
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMultipart;
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.NotFoundException;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.math.NumberUtils;
-import org.apache.cxf.interceptor.InInterceptors;
-import org.apache.cxf.jaxrs.ext.multipart.Attachment;
-import org.apache.cxf.jaxrs.ext.multipart.Multipart;
-import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-import org.apache.olingo.fit.metadata.Metadata;
-import org.apache.olingo.fit.methods.PATCH;
-import org.apache.olingo.fit.rest.ResolvingReferencesInterceptor;
-import org.apache.olingo.fit.rest.XHTTPMethodInterceptor;
-import org.apache.olingo.fit.utils.AbstractUtilities;
-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.FSManager;
-import org.apache.olingo.fit.utils.LinkInfo;
-import org.springframework.stereotype.Service;
-
-@Service
-@Path("/V40/Static.svc")
-@InInterceptors(classes = { XHTTPMethodInterceptor.class, ResolvingReferencesInterceptor.class })
-public class V4Services extends AbstractServices {
-
- /**
- * CR/LF.
- */
- protected static final byte[] CRLF = { 13, 10 };
-
- protected static final Pattern RELENTITY_SELECT_PATTERN = Pattern.compile("^.*\\(\\$select=.*\\)$");
-
- protected static final Pattern CROSSJOIN_PATTERN = Pattern.compile(
- "^\\$crossjoin\\(.*\\)\\?\\$filter=\\([a-zA-Z/]+ eq [a-zA-Z/]+\\)$");
-
- private final Map<String, String> providedAsync = new HashMap<String, String>();
-
- public V4Services() throws IOException {
- super(ODataServiceVersion.V40, Commons.getMetadata(ODataServiceVersion.V40));
- }
-
- protected V4Services(final Metadata metadata) throws IOException {
- super(ODataServiceVersion.V40, metadata);
- }
-
- @GET
- @Path("/redirect/{name}({id})")
- public Response conformanceRedirect(
- @Context final UriInfo uriInfo,
- @PathParam("name") final String name,
- @PathParam("id") final String id) {
- return Response.temporaryRedirect(
- URI.create(uriInfo.getRequestUri().toASCIIString().replace("/redirect", ""))).build();
- }
-
- @GET
- @Path("/$crossjoin({elements:.*})")
- public Response crossjoin(
- @PathParam("elements") final String elements,
- @QueryParam("$filter") final String filter) {
-
- try {
- if (CROSSJOIN_PATTERN.matcher("$crossjoin(" + elements + ")?$filter=" + filter).matches()) {
- final InputStream feed = FSManager.instance(version).readFile("crossjoin", Accept.JSON);
-
- return xml.createResponse(feed, null, Accept.JSON_FULLMETA);
- } else {
- throw new IOException("Unexpected crossjoin pattern");
- }
- } catch (Exception e) {
- return xml.createFaultResponse(Accept.JSON.toString(), e);
- }
- }
-
- @GET
- @Path("/relatedEntitySelect/{path:.*}")
- public Response relatedEntitySelect(
- @PathParam("path") final String path,
- @QueryParam("$expand") final String expand) {
-
- if (RELENTITY_SELECT_PATTERN.matcher(expand).matches()) {
- return xml.createResponse(null, null, Accept.JSON_FULLMETA);
- } else {
- return xml.createFaultResponse(Accept.JSON.toString(), new Exception("Unexpected expand pattern"));
- }
- }
-
- @DELETE
- @Path("/monitor/{name}")
- public Response removeMonitor(@PathParam("name") final String name) {
- providedAsync.remove(name);
- return xml.createResponse(null, null, null, Status.NO_CONTENT);
- }
-
- @GET
- @Path("/monitor/{name}")
- public Response async(@PathParam("name") final String name) {
- try {
- if (!providedAsync.containsKey(name)) {
- throw new NotFoundException();
- }
- final InputStream res = IOUtils.toInputStream(providedAsync.get(name), Constants.ENCODING);
- providedAsync.remove(name);
- return xml.createMonitorResponse(res);
- } catch (Exception e) {
- return xml.createFaultResponse(Accept.JSON_FULLMETA.toString(), e);
- }
- }
-
- @PUT
- @Path("/People(1)/Parent")
- public Response changeSingleValuedNavigationPropertyReference(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- final String content) {
-
- try {
- final Accept contentTypeValue = Accept.parse(contentType);
- assert contentTypeValue == Accept.JSON;
-
- jsonDeserializer.toEntity(IOUtils.toInputStream(content, Constants.ENCODING));
-
- return Response.noContent().type(MediaType.APPLICATION_JSON).build();
- } catch (Exception e) {
- LOG.error("While update single property reference", e);
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @POST
- @Path("/async/$batch")
- public Response async(
- @Context final UriInfo uriInfo,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
- final @Multipart MultipartBody attachment) {
-
- try {
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- bos.write("HTTP/1.1 200 Ok".getBytes());
- bos.write(CRLF);
- bos.write("OData-Version: 4.0".getBytes());
- bos.write(CRLF);
- bos.write(("Content-Type: " + ContentType.APPLICATION_OCTET_STREAM + ";boundary=" + BOUNDARY).getBytes());
- bos.write(CRLF);
- bos.write(CRLF);
-
- bos.write(("--" + BOUNDARY).getBytes());
- bos.write(CRLF);
- bos.write("Content-Type: application/http".getBytes());
- bos.write(CRLF);
- bos.write("Content-Transfer-Encoding: binary".getBytes());
- bos.write(CRLF);
- bos.write(CRLF);
-
- bos.write("HTTP/1.1 202 Accepted".getBytes());
- bos.write(CRLF);
- bos.write("Location: http://service-root/async-monitor".getBytes());
- bos.write(CRLF);
- bos.write("Retry-After: 10".getBytes());
- bos.write(CRLF);
- bos.write(CRLF);
- bos.write(("--" + BOUNDARY + "--").getBytes());
- bos.write(CRLF);
-
- final UUID uuid = UUID.randomUUID();
- providedAsync.put(uuid.toString(), bos.toString(Constants.ENCODING.toString()));
-
- bos.flush();
- bos.close();
-
- return xml.createAsyncResponse(
- uriInfo.getRequestUri().toASCIIString().replace("async/$batch", "") + "monitor/" + uuid.toString());
- } catch (Exception e) {
- return xml.createFaultResponse(Accept.JSON.toString(), e);
- }
- }
-
- @GET
- @Path("/async/{name}")
- public Response async(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @PathParam("name") final String name) {
-
- try {
- final Accept acceptType = Accept.parse(accept);
- if (acceptType == Accept.XML || acceptType == Accept.TEXT) {
- throw new UnsupportedMediaTypeException("Unsupported media type");
- }
-
- final String basePath = name + File.separatorChar;
- final StringBuilder path = new StringBuilder(basePath);
-
- path.append(metadata.getEntitySet(name).isSingleton()
- ? Constants.get(ConstantKey.ENTITY)
- : Constants.get(ConstantKey.FEED));
-
- final InputStream feed = FSManager.instance(version).readFile(path.toString(), acceptType);
-
- final StringBuilder builder = new StringBuilder();
- builder.append("HTTP/1.1 200 Ok").append(new String(CRLF));
- builder.append("Content-Type: ").append(accept).append(new String(CRLF)).append(new String(CRLF));
- builder.append(IOUtils.toString(feed));
- IOUtils.closeQuietly(feed);
-
- final UUID uuid = UUID.randomUUID();
- providedAsync.put(uuid.toString(), builder.toString());
-
- return xml.createAsyncResponse(
- uriInfo.getRequestUri().toASCIIString().replaceAll("async/" + name, "") + "monitor/" + uuid.toString());
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @Override
- protected void setInlineCount(final EntityCollection entitySet, final String count) {
- if ("true".equals(count)) {
- entitySet.setCount(entitySet.getEntities().size());
- }
- }
-
- @Override
- public InputStream exploreMultipart(
- final List<Attachment> attachments, final String boundary, final boolean continueOnError)
- throws IOException {
-
- final ByteArrayOutputStream bos = new ByteArrayOutputStream();
-
- Response res = null;
- boolean goon = true;
- for (int i = 0; i < attachments.size() && goon; i++) {
- try {
- final Attachment obj = attachments.get(i);
- bos.write(("--" + boundary).getBytes());
- bos.write(Constants.CRLF);
-
- final Object content = obj.getDataHandler().getContent();
- if (content instanceof MimeMultipart) {
- final ByteArrayOutputStream chbos = new ByteArrayOutputStream();
- String lastContebtID = null;
- try {
- final Map<String, String> references = new HashMap<String, String>();
-
- final String cboundary = "changeset_" + UUID.randomUUID().toString();
- chbos.write(("Content-Type: multipart/mixed;boundary=" + cboundary).getBytes());
- chbos.write(Constants.CRLF);
- chbos.write(Constants.CRLF);
-
- for (int j = 0; j < ((MimeMultipart) content).getCount(); j++) {
- final MimeBodyPart part = (MimeBodyPart) ((MimeMultipart) content).getBodyPart(j);
- lastContebtID = part.getContentID();
- addChangesetItemIntro(chbos, lastContebtID, cboundary);
-
- res = bodyPartRequest(new MimeBodyPart(part.getInputStream()), references);
- if (!continueOnError && (res == null || res.getStatus() >= 400)) {
- throw new Exception("Failure processing changeset");
- }
-
- addSingleBatchResponse(res, lastContebtID, chbos);
- references.put("$" + lastContebtID, res.getHeaderString("Location"));
- }
-
- chbos.write(("--" + cboundary + "--").getBytes());
- chbos.write(Constants.CRLF);
-
- bos.write(chbos.toByteArray());
- IOUtils.closeQuietly(chbos);
- } catch (Exception e) {
- LOG.warn("While processing changeset", e);
- IOUtils.closeQuietly(chbos);
-
- addItemIntro(bos, lastContebtID);
-
- if (res == null || res.getStatus() < 400) {
- addErrorBatchResponse(e, "1", bos);
- } else {
- addSingleBatchResponse(res, lastContebtID, bos);
- }
-
- goon = continueOnError;
- }
- } else {
- addItemIntro(bos);
-
- res = bodyPartRequest(new MimeBodyPart(obj.getDataHandler().getInputStream()));
-
- if (res.getStatus() >= 400) {
- goon = continueOnError;
- throw new Exception("Failure processing batch item");
- }
-
- addSingleBatchResponse(res, bos);
- }
- } catch (Exception e) {
- if (res == null || res.getStatus() < 400) {
- addErrorBatchResponse(e, bos);
- } else {
- addSingleBatchResponse(res, bos);
- }
- }
- }
-
- bos.write(("--" + boundary + "--").getBytes());
-
- return new ByteArrayInputStream(bos.toByteArray());
- }
-
- @GET
- @Path("/People/{type:.*}")
- public Response getPeople(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @PathParam("type") final String type,
- @QueryParam("$top") @DefaultValue(StringUtils.EMPTY) final String top,
- @QueryParam("$skip") @DefaultValue(StringUtils.EMPTY) final String skip,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- @QueryParam("$inlinecount") @DefaultValue(StringUtils.EMPTY) final String count,
- @QueryParam("$filter") @DefaultValue(StringUtils.EMPTY) final String filter,
- @QueryParam("$search") @DefaultValue(StringUtils.EMPTY) final String search,
- @QueryParam("$orderby") @DefaultValue(StringUtils.EMPTY) final String orderby,
- @QueryParam("$skiptoken") @DefaultValue(StringUtils.EMPTY) final String skiptoken) {
-
- return StringUtils.isBlank(filter) && StringUtils.isBlank(search)
- ? NumberUtils.isNumber(type)
- ? super.getEntityInternal(
- uriInfo.getRequestUri().toASCIIString(), accept, "People", type, format, null, null)
- : super.getEntitySet(accept, "People", type)
- : super.getEntitySet(uriInfo, accept, "People", top, skip, format, count, filter, orderby, skiptoken, type);
- }
-
- @GET
- @Path("/Boss")
- public Response getSingletonBoss(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- return getEntityInternal(
- uriInfo.getRequestUri().toASCIIString(), accept, "Boss", StringUtils.EMPTY, format, null, null);
- }
-
- @GET
- @Path("/Company")
- public Response getSingletonCompany(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- return getEntityInternal(
- uriInfo.getRequestUri().toASCIIString(), accept, "Company", StringUtils.EMPTY, format, null, null);
- }
-
- @PATCH
- @Path("/Company")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
- public Response patchSingletonCompany(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
- @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) final String ifMatch,
- final String changes) {
-
- return super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, "Company", StringUtils.EMPTY, changes);
- }
-
- @GET
- @Path("/Customers")
- public Response getCustomers(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
- @QueryParam("$deltatoken") @DefaultValue(StringUtils.EMPTY) final String deltatoken) {
-
- try {
- final Accept acceptType;
- if (StringUtils.isNotBlank(format)) {
- acceptType = Accept.valueOf(format.toUpperCase());
- } else {
- acceptType = Accept.parse(accept);
- }
-
- final InputStream output;
- if (StringUtils.isBlank(deltatoken)) {
- final InputStream input = (InputStream) getEntitySet(
- uriInfo, accept, "Customers", null, null, format, null, null, null, null).getEntity();
- final EntityCollection entitySet = xml.readEntitySet(acceptType, input);
-
- boolean trackChanges = prefer.contains("odata.track-changes");
- if (trackChanges) {
- entitySet.setDeltaLink(URI.create("Customers?$deltatoken=8015"));
- }
-
- output = xml.writeEntitySet(acceptType, new ResWrap<EntityCollection>(
- URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + "Customers"),
- null,
- entitySet));
- } else {
- output = FSManager.instance(version).readFile("delta", acceptType);
- }
-
- final Response response = xml.createResponse(
- null,
- output,
- null,
- acceptType);
- if (StringUtils.isNotBlank(prefer)) {
- response.getHeaders().put("Preference-Applied", Collections.<Object> singletonList(prefer));
- }
- return response;
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @GET
- @Path("/Company/Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount{paren:[\\(\\)]*}")
- public Response functionGetEmployeesCount(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- try {
- final Accept acceptType;
- if (StringUtils.isNotBlank(format)) {
- acceptType = Accept.valueOf(format.toUpperCase());
- } else {
- acceptType = Accept.parse(accept);
- }
-
- final Property property = new Property();
- property.setType("Edm.Int32");
- property.setValue(ValueType.PRIMITIVE, 2);
- final ResWrap<Property> container = new ResWrap<Property>(
- URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + property.getType()), null,
- property);
-
- return xml.createResponse(
- null,
- xml.writeProperty(acceptType, container),
- null,
- acceptType);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @POST
- @Path("/Company/Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue{paren:[\\(\\)]*}")
- public Response actionIncreaseRevenue(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- final String param) {
-
- try {
- final Accept acceptType;
- if (StringUtils.isNotBlank(format)) {
- acceptType = Accept.valueOf(format.toUpperCase());
- } else {
- acceptType = Accept.parse(accept);
- }
-
- final Accept contentTypeValue = Accept.parse(contentType);
- final Entity entry = xml.readEntity(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
-
- return xml.createResponse(
- null,
- xml.writeProperty(acceptType, entry.getProperty("IncreaseValue")),
- null,
- acceptType);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @GET
- @Path("/Products({entityId})/Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails({param:.*})")
- public Response functionGetProductDetails(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @PathParam("entityId") final String entityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- try {
- final Accept acceptType;
- if (StringUtils.isNotBlank(format)) {
- acceptType = Accept.valueOf(format.toUpperCase());
- } else {
- acceptType = Accept.parse(accept);
- }
-
- final Entity entry = new Entity();
- entry.setType("Microsoft.Test.OData.Services.ODataWCFService.ProductDetail");
- final Property productId = new Property();
- productId.setName("ProductID");
- productId.setType("Edm.Int32");
- productId.setValue(ValueType.PRIMITIVE, Integer.valueOf(entityId));
- entry.getProperties().add(productId);
- final Property productDetailId = new Property();
- productDetailId.setName("ProductDetailID");
- productDetailId.setType("Edm.Int32");
- productDetailId.setValue(ValueType.PRIMITIVE, 2);
- entry.getProperties().add(productDetailId);
-
- final Link link = new Link();
- link.setRel("edit");
- link.setHref(URI.create(
- Constants.get(ConstantKey.DEFAULT_SERVICE_URL)
- + "ProductDetails(ProductID=6,ProductDetailID=1)").toASCIIString());
- entry.setEditLink(link);
-
- final EntityCollection feed = new EntityCollection();
- feed.getEntities().add(entry);
-
- final ResWrap<EntityCollection> container = new ResWrap<EntityCollection>(
- URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + "ProductDetail"), null,
- feed);
-
- return xml.createResponse(
- null,
- xml.writeEntitySet(acceptType, container),
- null,
- acceptType);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @POST
- @Path("/Products({entityId})/Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight{paren:[\\(\\)]*}")
- public Response actionAddAccessRight(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- final String param) {
-
- try {
- final Accept acceptType;
- if (StringUtils.isNotBlank(format)) {
- acceptType = Accept.valueOf(format.toUpperCase());
- } else {
- acceptType = Accept.parse(accept);
- }
-
- final Accept contentTypeValue = Accept.parse(contentType);
- final Entity entry = xml.readEntity(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
-
- assert 1 == entry.getProperties().size();
- assert entry.getProperty("accessRight") != null;
-
- final Property property = entry.getProperty("accessRight");
- property.setType("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel");
-
- final ResWrap<Property> result = new ResWrap<Property>(
- URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + property.getType()),
- null, property);
-
- return xml.createResponse(
- null,
- xml.writeProperty(acceptType, result),
- null,
- acceptType);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @POST
- @Path("/Customers({personId})/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress{paren:[\\(\\)]*}")
- public Response actionResetAddress(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @PathParam("personId") final String personId,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- final String param) {
-
- try {
- final Accept contentTypeValue = Accept.parse(contentType);
- final Entity entry = xml.readEntity(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
-
- assert 2 == entry.getProperties().size();
- assert entry.getProperty("addresses") != null;
- assert entry.getProperty("index") != null;
-
- return getEntityInternal(
- uriInfo.getRequestUri().toASCIIString(), accept, "Customers", personId, format, null, null);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @GET
- @Path("/ProductDetails(ProductID={productId},ProductDetailID={productDetailId})"
- + "/Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct{paren:[\\(\\)]*}")
- public Response functionGetRelatedProduct(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @PathParam("productId") final String productId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- return getEntityInternal(
- uriInfo.getRequestUri().toASCIIString(), accept, "Products", productId, format, null, null);
- }
-
- @POST
- @Path("/Accounts({entityId})/Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI{paren:[\\(\\)]*}")
- public Response actionRefreshDefaultPI(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @PathParam("entityId") final String entityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- final String param) {
-
- try {
- final Accept contentTypeValue = Accept.parse(contentType);
- final Entity entry = xml.readEntity(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
-
- assert 1 == entry.getProperties().size();
- assert entry.getProperty("newDate") != null;
-
- return functionGetDefaultPI(accept, entityId, format);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @GET
- @Path("/Accounts({entityId})/Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI{paren:[\\(\\)]*}")
- public Response functionGetDefaultPI(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @PathParam("entityId") final String entityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- return getContainedEntity(accept, entityId, "MyPaymentInstruments", entityId + "901", format);
- }
-
- @GET
- @Path("/Accounts({entityId})/Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo{paren:[\\(\\)]*}")
- public Response functionGetAccountInfo(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @PathParam("entityId") final String entityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- return getPath(accept, "Accounts", entityId, "AccountInfo", format);
- }
-
- @GET
- @Path("/Accounts({entityId})/MyGiftCard/Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount({param:.*})")
- public Response functionGetActualAmount(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @PathParam("entityId") final String entityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- try {
- final Accept acceptType;
- if (StringUtils.isNotBlank(format)) {
- acceptType = Accept.valueOf(format.toUpperCase());
- } else {
- acceptType = Accept.parse(accept);
- }
-
- final Property property = new Property();
- property.setType("Edm.Double");
- property.setValue(ValueType.PRIMITIVE, 41.79);
-
- final ResWrap<Property> container = new ResWrap<Property>((URI) null, null, property);
-
- return xml.createResponse(
- null,
- xml.writeProperty(acceptType, container),
- null,
- acceptType);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- /**
- * 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) final String accept,
- @PathParam("path") final String path,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- try {
- final Map.Entry<Accept, AbstractUtilities> 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(version).readFile(Constants.get(ConstantKey.REF)
- + File.separatorChar + filename, utils.getKey()),
- null,
- utils.getKey());
- } catch (Exception e) {
- LOG.error("Error retrieving entity", e);
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @POST
- @Path("/People")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
- public Response postPeople(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
- final String entity) {
-
- if ("{\"@odata.type\":\"#Microsoft.Test.OData.Services.ODataWCFService.Person\"}".equals(entity)) {
- return xml.createFaultResponse(accept, new BadRequestException());
- }
-
- return super.postNewEntity(uriInfo, accept, contentType, prefer, "People", entity);
- }
-
- @Override
- public Response patchEntity(
- final UriInfo uriInfo,
- final String accept,
- final String contentType,
- final String prefer,
- final String ifMatch,
- final String entitySetName,
- final String entityId,
- final String changes) {
-
- final Response response =
- getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
- accept, entitySetName, entityId, accept, StringUtils.EMPTY, StringUtils.EMPTY);
- return response.getStatus() >= 400
- ? super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, changes)
- : super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId, changes);
- }
-
- @Override
- public Response replaceEntity(
- final UriInfo uriInfo,
- final String accept,
- final String contentType,
- final String prefer,
- final String entitySetName,
- final String entityId,
- final String entity) {
-
- try {
- getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
- accept, entitySetName, entityId, accept, StringUtils.EMPTY, StringUtils.EMPTY);
- return super.replaceEntity(uriInfo, accept, contentType, prefer, entitySetName, entityId, entity);
- } catch (NotFoundException e) {
- return postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entityId);
- }
- }
-
- private StringBuilder containedPath(final String entityId, final String containedEntitySetName) {
- return new StringBuilder("Accounts").append(File.separatorChar).
- append(entityId).append(File.separatorChar).
- append("links").append(File.separatorChar).
- append(containedEntitySetName);
- }
-
- @GET
- @Path("/Accounts({entityId})/{containedEntitySetName}({containedEntityId})")
- public Response getContainedEntity(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @PathParam("entityId") final String entityId,
- @PathParam("containedEntitySetName") final String containedEntitySetName,
- @PathParam("containedEntityId") final String containedEntityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- try {
- final Accept acceptType;
- if (StringUtils.isNotBlank(format)) {
- acceptType = Accept.valueOf(format.toUpperCase());
- } else {
- acceptType = Accept.parse(accept);
- }
- if (acceptType == Accept.XML || acceptType == Accept.TEXT) {
- throw new UnsupportedMediaTypeException("Unsupported media type");
- }
-
- final StringBuilder containedPath = containedPath(entityId, containedEntitySetName);
- if (StringUtils.isNotBlank(containedEntityId)) {
- containedPath.append('(').append(containedEntityId).append(')');
- }
- final InputStream entry = FSManager.instance(version).readFile(containedPath.toString(), Accept.ATOM);
-
- final ResWrap<Entity> container = atomDeserializer.toEntity(entry);
-
- return xml.createResponse(
- null,
- xml.writeEntity(acceptType, container),
- null,
- acceptType);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @POST
- @Path("/Accounts({entityId})/{containedEntitySetName:.*}")
- public Response postContainedEntity(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @PathParam("entityId") final String entityId,
- @PathParam("containedEntitySetName") final String containedEntitySetName,
- final String entity) {
-
- try {
- final Accept acceptType = Accept.parse(accept);
- if (acceptType == Accept.XML || acceptType == Accept.TEXT) {
- throw new UnsupportedMediaTypeException("Unsupported media type");
- }
-
- final AbstractUtilities utils = getUtilities(acceptType);
-
- // 1. parse the entry (from Atom or JSON)
- final ResWrap<Entity> entryContainer;
- final Entity entry;
- final Accept contentTypeValue = Accept.parse(contentType);
- if (Accept.ATOM == contentTypeValue) {
- entryContainer = atomDeserializer.toEntity(IOUtils.toInputStream(entity, Constants.ENCODING));
- entry = entryContainer.getPayload();
- } else {
- final ResWrap<Entity> jcontainer = jsonDeserializer.toEntity(
- IOUtils.toInputStream(entity, Constants.ENCODING));
- entry = jcontainer.getPayload();
-
- entryContainer = new ResWrap<Entity>(
- jcontainer.getContextURL(),
- jcontainer.getMetadataETag(),
- entry);
- }
-
- final EdmTypeInfo contained = new EdmTypeInfo.Builder().setTypeExpression(metadata.
- getNavigationProperties("Accounts").get(containedEntitySetName).getType()).build();
- final String entityKey = getUtilities(contentTypeValue).
- getDefaultEntryKey(contained.getFullQualifiedName().getName(), entry);
-
- // 2. Store the new entity
- final String atomEntryRelativePath = containedPath(entityId, containedEntitySetName).
- append('(').append(entityKey).append(')').toString();
- FSManager.instance(version).putInMemory(
- utils.writeEntity(Accept.ATOM, entryContainer),
- FSManager.instance(version).getAbsolutePath(atomEntryRelativePath, Accept.ATOM));
-
- // 3. Update the contained entity set
- final String atomFeedRelativePath = containedPath(entityId, containedEntitySetName).toString();
- final InputStream feedIS = FSManager.instance(version).readFile(atomFeedRelativePath, Accept.ATOM);
- final ResWrap<EntityCollection> feedContainer = atomDeserializer.toEntitySet(feedIS);
- feedContainer.getPayload().getEntities().add(entry);
-
- final ByteArrayOutputStream content = new ByteArrayOutputStream();
- final OutputStreamWriter writer = new OutputStreamWriter(content, Constants.ENCODING);
- atomSerializer.write(writer, feedContainer);
- writer.flush();
- writer.close();
-
- FSManager.instance(version).putInMemory(
- new ByteArrayInputStream(content.toByteArray()),
- FSManager.instance(version).getAbsolutePath(atomFeedRelativePath, Accept.ATOM));
-
- // Finally, return
- return utils.createResponse(
- uriInfo.getRequestUri().toASCIIString() + "(" + entityKey + ")",
- utils.writeEntity(acceptType, entryContainer),
- null,
- acceptType,
- Response.Status.CREATED);
- } catch (Exception e) {
- LOG.error("While creating new contained entity", e);
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @PATCH
- @Path("/{entitySetName}({entityId})/{containedEntitySetName}({containedEntityId})")
- public Response patchContainedEntity(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @PathParam("entitySetName") final String entitySetName,
- @PathParam("entityId") final String entityId,
- @PathParam("containedEntitySetName") final String containedEntitySetName,
- @PathParam("containedEntityId") final String containedEntityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- final String changes) {
-
- try {
- final Accept acceptType;
- if (StringUtils.isNotBlank(format)) {
- acceptType = Accept.valueOf(format.toUpperCase());
- } else {
- acceptType = Accept.parse(accept);
- }
- if (acceptType == Accept.XML || acceptType == Accept.TEXT) {
- throw new UnsupportedMediaTypeException("Unsupported media type");
- }
-
- final Accept contentTypeValue;
- if (StringUtils.isBlank(contentType)) {
- throw new IllegalArgumentException();
- }
- contentTypeValue = Accept.parse(contentType);
-
- final LinkInfo links = xml.readLinks(
- entitySetName, entityId, containedEntitySetName + "(" + containedEntityId + ")", Accept.ATOM);
-
- ResWrap<Entity> container = atomDeserializer.toEntity(links.getLinks());
- final Entity original = container.getPayload();
-
- final Entity entryChanges;
- if (Accept.ATOM == contentTypeValue) {
- container = atomDeserializer.toEntity(IOUtils.toInputStream(changes, Constants.ENCODING));
- entryChanges = container.getPayload();
- } else {
- final String entityType = metadata.getEntitySet(entitySetName).getType();
- final String containedType = metadata.getEntityOrComplexType(entityType).
- getNavigationProperty(containedEntitySetName).getType();
- final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setTypeExpression(containedType).build();
-
- final ResWrap<Entity> jsonContainer = jsonDeserializer.toEntity(
- IOUtils.toInputStream(changes, Constants.ENCODING));
- jsonContainer.getPayload().setType(typeInfo.getFullQualifiedName().toString());
- entryChanges = jsonContainer.getPayload();
- }
-
- for (Property property : entryChanges.getProperties()) {
- final Property old = original.getProperty(property.getName());
- if (old != null) {
- original.getProperties().remove(old);
- }
- original.getProperties().add(property);
- }
-
- FSManager.instance(version).putInMemory(new ResWrap<Entity>((URI) null, null, original),
- xml.getLinksBasePath(entitySetName, entityId) + containedEntitySetName + "(" + containedEntityId + ")");
-
- return xml.createResponse(null, null, acceptType, Response.Status.NO_CONTENT);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @DELETE
- @Path("/Accounts({entityId})/{containedEntitySetName}({containedEntityId})")
- public Response removeContainedEntity(
- @PathParam("entityId") final String entityId,
- @PathParam("containedEntitySetName") final String containedEntitySetName,
- @PathParam("containedEntityId") final String containedEntityId) {
-
- try {
- // 1. Fetch the contained entity to be removed
- final InputStream entry = FSManager.instance(version).
- readFile(containedPath(entityId, containedEntitySetName).
- append('(').append(containedEntityId).append(')').toString(), Accept.ATOM);
- final ResWrap<Entity> container = atomDeserializer.toEntity(entry);
-
- // 2. Remove the contained entity
- final String atomEntryRelativePath = containedPath(entityId, containedEntitySetName).
- append('(').append(containedEntityId).append(')').toString();
- FSManager.instance(version).deleteFile(atomEntryRelativePath);
-
- // 3. Update the contained entity set
- final String atomFeedRelativePath = containedPath(entityId, containedEntitySetName).toString();
- final InputStream feedIS = FSManager.instance(version).readFile(atomFeedRelativePath, Accept.ATOM);
- final ResWrap<EntityCollection> feedContainer = atomDeserializer.toEntitySet(feedIS);
- feedContainer.getPayload().getEntities().remove(container.getPayload());
-
- final ByteArrayOutputStream content = new ByteArrayOutputStream();
- final OutputStreamWriter writer = new OutputStreamWriter(content, Constants.ENCODING);
- atomSerializer.write(writer, feedContainer);
- writer.flush();
- writer.close();
-
- FSManager.instance(version).putInMemory(
- new ByteArrayInputStream(content.toByteArray()),
- FSManager.instance(version).getAbsolutePath(atomFeedRelativePath, Accept.ATOM));
-
- return xml.createResponse(null, null, null, null, Response.Status.NO_CONTENT);
- } catch (Exception e) {
- return xml.createFaultResponse(Accept.XML.toString(), e);
- }
- }
-
- @GET
- @Path("/Accounts({entityId})/{containedEntitySetName:.*}")
- public Response getContainedEntitySet(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @PathParam("entityId") final String entityId,
- @PathParam("containedEntitySetName") final String containedEntitySetName,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- String tempContainedESName = containedEntitySetName;
- if ("MyGiftCard".equals(tempContainedESName)) {
- return getContainedEntity(accept, entityId, tempContainedESName, null, format);
- }
-
- try {
- final Accept acceptType;
- if (StringUtils.isNotBlank(format)) {
- acceptType = Accept.valueOf(format.toUpperCase());
- } else {
- acceptType = Accept.parse(accept);
- }
- if (acceptType == Accept.XML || acceptType == Accept.TEXT) {
- throw new UnsupportedMediaTypeException("Unsupported media type");
- }
-
- String derivedType = null;
- if (tempContainedESName.contains("/")) {
- final String[] parts = tempContainedESName.split("/");
- tempContainedESName = parts[0];
- derivedType = parts[1];
- }
-
- final InputStream feed = FSManager.instance(version).
- readFile(containedPath(entityId, tempContainedESName).toString(), Accept.ATOM);
-
- final ResWrap<EntityCollection> container = atomDeserializer.toEntitySet(feed);
-
- if (derivedType != null) {
- final List<Entity> nonMatching = new ArrayList<Entity>();
- for (Entity entity : container.getPayload().getEntities()) {
- if (!derivedType.equals(entity.getType())) {
- nonMatching.add(entity);
- }
- }
- container.getPayload().getEntities().removeAll(nonMatching);
- }
-
- return xml.createResponse(
- null,
- xml.writeEntitySet(acceptType, container),
- null,
- acceptType);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @GET
- @Path("/GetDefaultColor()")
- public Response functionGetDefaultColor(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- try {
- final Accept acceptType;
- if (StringUtils.isNotBlank(format)) {
- acceptType = Accept.valueOf(format.toUpperCase());
- } else {
- acceptType = Accept.parse(accept);
- }
-
- final Property property = new Property();
- property.setType("Microsoft.Test.OData.Services.ODataWCFService.Color");
- property.setValue(ValueType.ENUM, "Red");
- final ResWrap<Property> container = new ResWrap<Property>(
- URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + property.getType()), null,
- property);
-
- return xml.createResponse(
- null,
- xml.writeProperty(acceptType, container),
- null,
- acceptType);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @GET
- @Path("/GetPerson2({param:.*})")
- public Response functionGetPerson2(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- return getEntityInternal(
- uriInfo.getRequestUri().toASCIIString(), accept, "Customers", "1", format, null, null);
- }
-
- @GET
- @Path("/GetPerson2({param:.*})/Emails")
- public Response functionGetPerson2Emails(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- return getPath(accept, "Customers", "1", "Emails", format);
- }
-
- @GET
- @Path("/GetPerson2({param:.*})/HomeAddress")
- public Response functionGetPerson2HomeAddress(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- return getPath(accept, "Customers", "1", "HomeAddress", format);
- }
-
- @GET
- @Path("/GetPerson2({param:.*})/Parent")
- public Response functionGetPerson2Parent(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- return getEntityInternal(
- uriInfo.getRequestUri().toASCIIString(), accept, "Customers", "2", format, null, null);
- }
-
- @GET
- @Path("/GetPerson({param:.*})")
- public Response functionGetPerson(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- return getEntityInternal(
- uriInfo.getRequestUri().toASCIIString(), accept, "Customers", "1", format, null, null);
- }
-
- @GET
- @Path("/GetAllProducts()")
- public Response functionGetAllProducts(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- return getEntitySet(uriInfo, accept, "Products", null, null, format, null, null, null, null);
- }
-
- @GET
- @Path("/GetProductsByAccessLevel({param:.*})")
- public Response functionGetProductsByAccessLevel(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- try {
- final Accept acceptType;
- if (StringUtils.isNotBlank(format)) {
- acceptType = Accept.valueOf(format.toUpperCase());
- } else {
- acceptType = Accept.parse(accept);
- }
-
- final Property property = new Property();
- property.setType("Collection(String)");
- final List<String> value = Arrays.asList("Cheetos", "Mushrooms", "Apple", "Car", "Computer");
- property.setValue(ValueType.COLLECTION_PRIMITIVE, value);
- final ResWrap<Property> container = new ResWrap<Property>(
- URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + property.getType()), null,
- property);
-
- return xml.createResponse(
- null,
- xml.writeProperty(acceptType, container),
- null,
- acceptType);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @GET
- @Path("/GetBossEmails({param:.*})")
- public Response functionGetBossEmails(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
-
- try {
- final Accept acceptType;
- if (StringUtils.isNotBlank(format)) {
- acceptType = Accept.valueOf(format.toUpperCase());
- } else {
- acceptType = Accept.parse(accept);
- }
-
- final Property property = new Property();
- property.setType("Collection(Edm.String)");
- property.setValue(ValueType.COLLECTION_PRIMITIVE,
- Arrays.asList("first@olingo.apache.org", "second@olingo.apache.org"));
- final ResWrap<Property> container = new ResWrap<Property>(
- URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + property.getType()), null,
- property);
-
- return xml.createResponse(null, xml.writeProperty(acceptType, container), null, acceptType);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @POST
- @Path("/Discount()")
- public Response actionDiscount(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- final String param) {
-
- try {
- final Accept acceptType;
- if (StringUtils.isNotBlank(format)) {
- acceptType = Accept.valueOf(format.toUpperCase());
- } else {
- acceptType = Accept.parse(accept);
- }
-
- final Accept contentTypeValue = Accept.parse(contentType);
- Property property;
- if (contentTypeValue == Accept.ATOM) {
- final ResWrap<Property> paramContainer = atomDeserializer.toProperty(
- IOUtils.toInputStream(param, Constants.ENCODING));
- property = paramContainer.getPayload();
- } else {
- final ResWrap<Property> paramContainer = jsonDeserializer.toProperty(
- IOUtils.toInputStream(param, Constants.ENCODING));
- property = paramContainer.getPayload();
- }
-
- assert property.isComplex();
- assert 1 == property.asComplex().getValue().size();
- assert "Edm.Int32".equals(property.asComplex().getValue().get(0).getType());
- assert property.asComplex().getValue().get(0).isPrimitive();
- assert "percentage".equals(property.asComplex().getValue().get(0).getName());
-
- return xml.createResponse(null, null, null, acceptType, Response.Status.NO_CONTENT);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @POST
- @Path("/GetAllProducts()/Discount")
- public Response actionBoundDiscount() {
- try {
- final String basePath = "Products" + File.separatorChar + "feed";
-
- final InputStream feed = FSManager.instance(version).readFile(basePath, Accept.JSON_FULLMETA);
- return xml.createResponse(null, feed, Commons.getETag(basePath), Accept.JSON_FULLMETA);
- } catch (Exception e) {
- return xml.createFaultResponse(Accept.JSON_FULLMETA.toString(), e);
- }
- }
-
- @POST
- @Path("/ResetBossAddress()")
- public Response actionResetBossAddress(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- final String param) {
-
- try {
- final Accept acceptType;
- if (StringUtils.isNotBlank(format)) {
- acceptType = Accept.valueOf(format.toUpperCase());
- } else {
- acceptType = Accept.parse(accept);
- }
-
- final Accept contentTypeValue = Accept.parse(contentType);
- final Entity entity = xml.readEntity(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
-
- assert "Microsoft.Test.OData.Services.ODataWCFService.Address".equals(entity.getType());
- assert entity.getProperty("address").isComplex();
-
- final ResWrap<Property> result = new ResWrap<Property>(
- URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX)
- + "Microsoft.Test.OData.Services.ODataWCFService.Address"),
- null,
- entity.getProperty("address"));
-
- return xml.createResponse(
- null,
- xml.writeProperty(acceptType, result),
- null,
- acceptType);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @POST
- @Path("/ResetBossEmail()")
- public Response actionResetBossEmail(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- final String param) {
-
- try {
- final Accept acceptType;
- if (StringUtils.isNotBlank(format)) {
- acceptType = Accept.valueOf(format.toUpperCase());
- } else {
- acceptType = Accept.parse(accept);
- }
-
- final Accept contentTypeValue = Accept.parse(contentType);
- final Entity entry = xml.readEntity(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
-
- assert 1 == entry.getProperties().size();
- assert "Collection(Edm.String)".equals(entry.getProperty("emails").getType());
- assert entry.getProperty("emails").isCollection();
-
- return xml.createResponse(
- null,
- xml.writeProperty(acceptType, entry.getProperty("emails")),
- null,
- acceptType);
- } catch (Exception e) {
- return xml.createFaultResponse(accept, e);
- }
- }
-
- @POST
- @Path("/Products({productId})/Categories/$ref")
- public Response createLinked(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- final String entity) {
-
- return xml.createResponse(null, null, null, Status.NO_CONTENT);
- }
-
- @POST
- @Path("/Customers(1)/Orders/$ref")
- public Response linkOrderViaRef(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- final String entity) {
-
- return xml.createResponse(null, null, null, Status.NO_CONTENT);
- }
-
- @DELETE
- @Path("/Products({productId})/Categories({categoryId})/$ref")
- public Response deleteLinked(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- final String entity) {
-
- return xml.createResponse(null, null, null, Status.NO_CONTENT);
- }
-
- @GET
- @Path("/Company/VipCustomer")
- public Response getVipCustomer(
- @Context final UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
- @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
- @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
-
- return super.getEntityInternal(
- uriInfo.getRequestUri().toASCIIString(), accept, "VipCustomer", "1", format, expand, select);
- }
-}
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4Vocabularies.java b/fit/src/main/java/org/apache/olingo/fit/V4Vocabularies.java
deleted file mode 100644
index 099c8ab..0000000
--- a/fit/src/main/java/org/apache/olingo/fit/V4Vocabularies.java
+++ /dev/null
@@ -1,83 +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.fit;
-
-import java.io.IOException;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.fit.metadata.Metadata;
-import org.apache.olingo.fit.utils.Accept;
-import org.apache.olingo.fit.utils.ConstantKey;
-import org.apache.olingo.fit.utils.Constants;
-import org.apache.olingo.fit.utils.FSManager;
-import org.apache.olingo.fit.utils.XMLUtilities;
-import org.springframework.stereotype.Service;
-
-@Service
-@Path("/V40/Vocabularies.svc")
-public class V4Vocabularies {
-
- private final Metadata metadata;
-
- private final XMLUtilities xml;
-
- public V4Vocabularies() throws IOException {
- metadata = new Metadata(FSManager.instance(ODataServiceVersion.V40).readRes(
- "vocabularies-" + Constants.get(ConstantKey.METADATA), Accept.XML));
- xml = new XMLUtilities(metadata);
- }
-
- @GET
- @Path("/$metadata")
- @Produces(MediaType.APPLICATION_XML)
- public Response getMetadata() {
- try {
- return xml.createResponse(
- null,
- FSManager.instance(ODataServiceVersion.V40).readRes(
- "vocabularies-" + Constants.get(ConstantKey.METADATA), Accept.XML),
- null,
- Accept.XML);
- } catch (Exception e) {
- return xml.createFaultResponse(Accept.XML.toString(), e);
- }
- }
-
- @GET
- @Path("/{vocabulary}")
- @Produces(MediaType.APPLICATION_XML)
- public Response getVocabulary(@PathParam("vocabulary") final String vocabulary) {
- try {
- return xml.createResponse(
- null,
- FSManager.instance(ODataServiceVersion.V40).readFile(vocabulary, null),
- null,
- Accept.XML);
- } catch (Exception e) {
- return xml.createFaultResponse(Accept.XML.toString(), e);
- }
- }
-}
diff --git a/fit/src/main/java/org/apache/olingo/fit/Vocabularies.java b/fit/src/main/java/org/apache/olingo/fit/Vocabularies.java
new file mode 100644
index 0000000..0390eae
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/Vocabularies.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit;
+
+import java.io.IOException;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.fit.metadata.Metadata;
+import org.apache.olingo.fit.utils.Accept;
+import org.apache.olingo.fit.utils.ConstantKey;
+import org.apache.olingo.fit.utils.Constants;
+import org.apache.olingo.fit.utils.FSManager;
+import org.apache.olingo.fit.utils.XMLUtilities;
+import org.springframework.stereotype.Service;
+
+@Service
+@Path("/V40/Vocabularies.svc")
+public class Vocabularies {
+
+ private final XMLUtilities xml;
+
+ public Vocabularies() throws IOException {
+ Metadata metadata = new Metadata(FSManager.instance(ODataServiceVersion.V40).readRes(
+ "vocabularies-" + Constants.get(ConstantKey.METADATA), Accept.XML));
+ xml = new XMLUtilities(metadata);
+ }
+
+ @GET
+ @Path("/$metadata")
+ @Produces(MediaType.APPLICATION_XML)
+ public Response getMetadata() {
+ try {
+ return xml.createResponse(
+ null,
+ FSManager.instance(ODataServiceVersion.V40).readRes(
+ "vocabularies-" + Constants.get(ConstantKey.METADATA), Accept.XML),
+ null,
+ Accept.XML);
+ } catch (Exception e) {
+ return xml.createFaultResponse(Accept.XML.toString(), e);
+ }
+ }
+
+ @GET
+ @Path("/{vocabulary}")
+ @Produces(MediaType.APPLICATION_XML)
+ public Response getVocabulary(@PathParam("vocabulary") final String vocabulary) {
+ try {
+ return xml.createResponse(
+ null,
+ FSManager.instance(ODataServiceVersion.V40).readFile(vocabulary, null),
+ null,
+ Accept.XML);
+ } catch (Exception e) {
+ return xml.createFaultResponse(Accept.XML.toString(), e);
+ }
+ }
+}
diff --git a/fit/src/main/java/org/apache/olingo/fit/serializer/FITAtomDeserializer.java b/fit/src/main/java/org/apache/olingo/fit/serializer/FITAtomDeserializer.java
index 8ad62fe..d02475d 100644
--- a/fit/src/main/java/org/apache/olingo/fit/serializer/FITAtomDeserializer.java
+++ b/fit/src/main/java/org/apache/olingo/fit/serializer/FITAtomDeserializer.java
@@ -27,8 +27,8 @@
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLStreamException;
+import org.apache.olingo.client.core.serialization.AtomDeserializer;
import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.core.serialization.AtomDeserializer;
public class FITAtomDeserializer extends AtomDeserializer {
diff --git a/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java b/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java
index 9fb15f5..69d0314 100644
--- a/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java
+++ b/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java
@@ -23,17 +23,26 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import java.util.UUID;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.SimpleFormatter;
+import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException;
@@ -298,6 +307,7 @@
if (server != null) {
return server;
}
+ baseContext.addApplicationListener(SessionHolder.class.getName());
tomcat.start();
LOG.info("Started server at endpoint "
@@ -323,4 +333,45 @@
tomcat.destroy();
}
}
+
+ public void invalidateAllSessions() {
+ SessionHolder.invalidateAllSession();
+ }
+
+ public static class SessionHolder implements HttpSessionListener {
+
+ private static final Map<ServletContext, Set<HttpSession>> ALL_SESSIONS =
+ Collections.synchronizedMap(new HashMap<ServletContext, Set<HttpSession>>());
+
+ @Override
+ public void sessionCreated(HttpSessionEvent se) {
+ LOG.info("Created session: {}", se);
+
+ ServletContext c = se.getSession().getServletContext();
+ Set<HttpSession> set = ALL_SESSIONS.get(c);
+ if (set == null) {
+ set = new HashSet<HttpSession>();
+ ALL_SESSIONS.put(c, set);
+ }
+ set.add(se.getSession());
+ }
+
+ @Override
+ public void sessionDestroyed(HttpSessionEvent se) {
+ LOG.info("Destroy session: {}", se);
+ }
+
+ public static void invalidateAllSession() {
+ synchronized (ALL_SESSIONS) {
+ LOG.info("Invalidated sessions...");
+ for (Map.Entry<ServletContext, Set<HttpSession>> e : ALL_SESSIONS.entrySet()) {
+ for (HttpSession s : e.getValue()) {
+ s.invalidate();
+ }
+ }
+ ALL_SESSIONS.clear();
+ LOG.info("...Invalidated all sessions.");
+ }
+ }
+ }
}
\ No newline at end of file
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 7fa9201..0d350d5 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
@@ -42,19 +42,20 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.vfs2.FileObject;
+import org.apache.olingo.client.api.serialization.ODataDeserializer;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
+import org.apache.olingo.client.api.serialization.ODataSerializer;
+import org.apache.olingo.client.api.serialization.ODataSerializerException;
+import org.apache.olingo.client.core.serialization.AtomSerializer;
+import org.apache.olingo.client.core.serialization.JsonDeserializer;
+import org.apache.olingo.client.core.serialization.JsonSerializer;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.serialization.ODataDeserializer;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.apache.olingo.commons.api.serialization.ODataSerializer;
-import org.apache.olingo.commons.api.serialization.ODataSerializerException;
-import org.apache.olingo.commons.core.serialization.AtomSerializer;
-import org.apache.olingo.commons.core.serialization.JsonDeserializer;
-import org.apache.olingo.commons.core.serialization.JsonSerializer;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.fit.UnsupportedMediaTypeException;
import org.apache.olingo.fit.metadata.Metadata;
import org.apache.olingo.fit.metadata.NavigationProperty;
@@ -104,7 +105,7 @@
atomDeserializer = new FITAtomDeserializer();
jsonDeserializer = new JsonDeserializer(true);
atomSerializer = new AtomSerializer(true);
- jsonSerializer = new JsonSerializer(true);
+ jsonSerializer = new JsonSerializer(true, ContentType.JSON_FULL_METADATA);
}
public boolean isMediaContent(final String entityName) {
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/FSManager.java b/fit/src/main/java/org/apache/olingo/fit/utils/FSManager.java
index 02dcadd..4e4785d 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/FSManager.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/FSManager.java
@@ -38,12 +38,13 @@
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.FileType;
import org.apache.commons.vfs2.VFS;
+import org.apache.olingo.client.api.serialization.ODataSerializerException;
+import org.apache.olingo.client.core.serialization.AtomSerializer;
+import org.apache.olingo.client.core.serialization.JsonSerializer;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.serialization.ODataSerializerException;
-import org.apache.olingo.commons.core.serialization.AtomSerializer;
-import org.apache.olingo.commons.core.serialization.JsonSerializer;
+import org.apache.olingo.commons.api.format.ContentType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -125,7 +126,7 @@
putInMemory(new ByteArrayInputStream(content.toByteArray()), getAbsolutePath(relativePath, Accept.ATOM));
content.reset();
- new JsonSerializer(true).write(writer, container);
+ new JsonSerializer(true, ContentType.JSON_FULL_METADATA).write(writer, container);
writer.flush();
putInMemory(new ByteArrayInputStream(content.toByteArray()), getAbsolutePath(relativePath, Accept.JSON_FULLMETA));
diff --git a/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java
index 523aedd..9595573 100644
--- a/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java
@@ -33,12 +33,14 @@
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataSerializerException;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.fit.server.TomcatTestServer;
import org.apache.olingo.server.tecsvc.TechnicalServlet;
+import org.apache.olingo.server.tecsvc.async.TechnicalStatusMonitorServlet;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,28 +53,30 @@
protected static final Logger LOG = LoggerFactory.getLogger(AbstractBaseTestITCase.class);
protected abstract ODataClient getClient();
+ private static TomcatTestServer server;
@BeforeClass
public static void init()
throws LifecycleException, IOException, InstantiationException, IllegalAccessException, ClassNotFoundException {
- TomcatTestServer.init(9080)
- .addServlet(TechnicalServlet.class, "/odata-server-tecsvc/odata.svc/*")
- .addServlet(StaticContent.create("org-odata-core-v1.xml"),
- "/odata-server-tecsvc/v4.0/cs02/vocabularies/Org.OData.Core.V1.xml")
+ server = TomcatTestServer.init(9080)
+ .addServlet(TechnicalServlet.class, "/odata-server-tecsvc/odata.svc/*")
+ .addServlet(TechnicalStatusMonitorServlet.class, "/odata-server-tecsvc/status/*")
+ .addServlet(StaticContent.create("org-odata-core-v1.xml"),
+ "/odata-server-tecsvc/v4.0/cs02/vocabularies/Org.OData.Core.V1.xml")
.addWebApp(false)
.start();
}
- // @AfterClass
- // public static void cleanUp() throws LifecycleException {
- // server.stop();
- // }
+ @AfterClass
+ public static void cleanUp() throws LifecycleException {
+ server.invalidateAllSessions();
+ }
protected void debugEntity(final Entity entity, final String message) {
if (LOG.isDebugEnabled()) {
final StringWriter writer = new StringWriter();
try {
- getClient().getSerializer(ODataFormat.JSON).write(writer, entity);
+ getClient().getSerializer(ContentType.JSON).write(writer, entity);
} catch (final ODataSerializerException e) {
// Debug
}
@@ -85,7 +89,7 @@
if (LOG.isDebugEnabled()) {
final StringWriter writer = new StringWriter();
try {
- getClient().getSerializer(ODataFormat.JSON).write(writer, entitySet);
+ getClient().getSerializer(ContentType.JSON).write(writer, entitySet);
} catch (final ODataSerializerException e) {
// Debug
}
@@ -106,7 +110,8 @@
if (LOG.isDebugEnabled()) {
StringWriter writer = new StringWriter();
try {
- getClient().getSerializer(ODataFormat.ATOM).write(writer, getClient().getBinder().getEntity(entity));
+ getClient().getSerializer(ContentType.APPLICATION_ATOM_XML).write(writer, getClient().getBinder()
+ .getEntity(entity));
} catch (final ODataSerializerException e) {
// Debug
}
@@ -115,7 +120,7 @@
writer = new StringWriter();
try {
- getClient().getSerializer(ODataFormat.JSON).write(writer, getClient().getBinder().getEntity(entity));
+ getClient().getSerializer(ContentType.JSON).write(writer, getClient().getBinder().getEntity(entity));
} catch (final ODataSerializerException e) {
// Debug
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/AbstractTestITCase.java
new file mode 100644
index 0000000..1f85633
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/AbstractTestITCase.java
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.base;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.startsWith;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+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.response.ODataDeleteResponse;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ClientCollectionValue;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.fit.AbstractBaseTestITCase;
+import org.junit.BeforeClass;
+
+public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
+
+ protected static final ODataClient client = ODataClientFactory.getClient();
+
+ protected static EdmEnabledODataClient edmClient;
+
+ protected static String testStaticServiceRootURL;
+
+ protected static String testDemoServiceRootURL;
+
+ protected static String testVocabulariesServiceRootURL;
+
+ protected static String testNorthwindRootURL;
+
+ protected static String testKeyAsSegmentServiceRootURL;
+
+ protected static String testOpenTypeServiceRootURL;
+
+ protected static String testLargeModelServiceRootURL;
+
+ protected static String testAuthServiceRootURL;
+
+ protected static String testOAuth2ServiceRootURL;
+
+ @BeforeClass
+ public static void setUpODataServiceRoot() throws IOException {
+ testStaticServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Static.svc";
+ testDemoServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Demo.svc";
+ testVocabulariesServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Vocabularies.svc";
+ testNorthwindRootURL = "http://localhost:9080/stub/StaticService/V40/NorthWind.svc";
+ testKeyAsSegmentServiceRootURL = "http://localhost:9080/stub/StaticService/V40/KeyAsSegment.svc";
+ testOpenTypeServiceRootURL = "http://localhost:9080/stub/StaticService/V40/OpenType.svc";
+ testLargeModelServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Static.svc/large";
+ testAuthServiceRootURL = "http://localhost:9080/stub/DefaultService.svc/V40/Static.svc";
+ testOAuth2ServiceRootURL = "http://localhost:9080/stub/StaticService/V40/OAuth2.svc";
+
+ edmClient = ODataClientFactory.getEdmEnabledClient(testStaticServiceRootURL, ContentType.JSON);
+
+ edmClient.getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ client.getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ }
+
+ @Override
+ protected ODataClient getClient() {
+ return client;
+ }
+
+ protected ClientEntity read(final ContentType contentType, final URI editLink) {
+ final ODataEntityRequest<ClientEntity> req = getClient().getRetrieveRequestFactory().getEntityRequest(editLink);
+ req.setFormat(contentType);
+
+ final ODataRetrieveResponse<ClientEntity> res = req.execute();
+ final ClientEntity entity = res.getBody();
+
+ assertNotNull(entity);
+
+ if (ContentType.JSON_FULL_METADATA == contentType || ContentType.APPLICATION_ATOM_XML == contentType) {
+ assertEquals(req.getURI(), entity.getEditLink());
+ }
+
+ return entity;
+ }
+
+ protected void createAndDeleteOrder(final String serviceRoot, final ContentType contentType, final int id) {
+
+ final ClientEntity order = getClient().getObjectFactory().newEntity(
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order"));
+
+ final ClientProperty orderId = getClient().getObjectFactory().newPrimitiveProperty("OrderID",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id));
+ order.getProperties().add(orderId);
+
+ Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ dateTime.set(2011, 2, 4, 16, 3, 57);
+ final ClientProperty orderDate = getClient().getObjectFactory().newPrimitiveProperty("OrderDate",
+ getClient().getObjectFactory().newPrimitiveValueBuilder()
+ .setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build());
+ order.getProperties().add(orderDate);
+
+ final ClientProperty shelfLife = getClient().getObjectFactory().newPrimitiveProperty("ShelfLife",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setValue(BigDecimal.TEN.scaleByPowerOfTen(7)).build());
+ order.getProperties().add(shelfLife);
+
+ final ClientCollectionValue<ClientValue> orderShelfLifesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Duration)");
+ orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000001")).build());
+ orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build());
+ final ClientProperty orderShelfLifes = getClient().getObjectFactory().
+ newCollectionProperty("OrderShelfLifes", orderShelfLifesValue);
+ order.getProperties().add(orderShelfLifes);
+
+ final ODataEntityCreateRequest<ClientEntity> req = getClient().getCUDRequestFactory().getEntityCreateRequest(
+ getClient().newURIBuilder(serviceRoot).
+ appendEntitySetSegment("Orders").build(), order);
+ req.setFormat(contentType);
+ final ClientEntity created = req.execute().getBody();
+ assertNotNull(created);
+ assertEquals(2, created.getProperty("OrderShelfLifes").getCollectionValue().size());
+
+ if (contentType.equals(ContentType.JSON_NO_METADATA)) {
+ assertEquals(0, created.getNavigationLinks().size());
+ assertNull(created.getEditLink());
+ } else if (contentType.equals(ContentType.JSON_FULL_METADATA)) {
+ assertEquals(3, created.getNavigationLinks().size());
+ assertThat(created.getTypeName().getNamespace(), is("Microsoft.Test.OData.Services.ODataWCFService"));
+ assertThat(created.getEditLink().toASCIIString(), startsWith("http://localhost:9080/stub/StaticService"));
+ } else if (contentType.equals(ContentType.JSON) || contentType.equals(ContentType.APPLICATION_JSON)) {
+ assertEquals(0, created.getNavigationLinks().size());
+ assertNull(created.getEditLink());
+ }
+
+ final URI deleteURI = getClient().newURIBuilder(serviceRoot).
+ appendEntitySetSegment("Orders").appendKeySegment(id).build();
+ final ODataDeleteRequest deleteReq = getClient().getCUDRequestFactory().getDeleteRequest(deleteURI);
+ final ODataDeleteResponse deleteRes = deleteReq.execute();
+ assertEquals(204, deleteRes.getStatusCode());
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/AsyncTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/AsyncTestITCase.java
new file mode 100644
index 0000000..1f2cc23
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/AsyncTestITCase.java
@@ -0,0 +1,168 @@
+/*
+ * 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.base;
+
+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.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import org.apache.olingo.client.api.communication.request.AsyncRequestWrapper;
+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.AsyncResponseWrapper;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientInlineEntity;
+import org.apache.olingo.client.api.domain.ClientLink;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class AsyncTestITCase extends AbstractTestITCase {
+
+ @Test
+ public void clientAsync() throws InterruptedException, ExecutionException {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customers");
+ final Future<ODataRetrieveResponse<ClientEntitySet>> futureRes =
+ client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).asyncExecute();
+ assertNotNull(futureRes);
+
+ while (!futureRes.isDone()) {
+ Thread.sleep(1000L);
+ }
+
+ final ODataRetrieveResponse<ClientEntitySet> res = futureRes.get();
+ assertNotNull(res);
+ assertEquals(200, res.getStatusCode());
+ assertFalse(res.getBody().getEntities().isEmpty());
+ }
+
+ private void withInlineEntry(final ContentType contentType) {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
+
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ req.setFormat(contentType);
+
+ final AsyncRequestWrapper<ODataRetrieveResponse<ClientEntity>> async =
+ client.getAsyncRequestFactory().<ODataRetrieveResponse<ClientEntity>> getAsyncRequestWrapper(req);
+
+ final AsyncResponseWrapper<ODataRetrieveResponse<ClientEntity>> responseWrapper = async.execute();
+
+ assertFalse(responseWrapper.isPreferenceApplied());
+
+ final ODataRetrieveResponse<ClientEntity> res = responseWrapper.getODataResponse();
+ final ClientEntity entity = res.getBody();
+
+ assertNotNull(entity);
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
+ assertEquals(testStaticServiceRootURL + "/Customers(1)", entity.getEditLink().toASCIIString());
+
+ assertEquals(3, entity.getNavigationLinks().size());
+
+ if (ContentType.APPLICATION_ATOM_XML.equals(contentType)) {
+ assertTrue(entity.getAssociationLinks().isEmpty());
+ // In JSON, association links for each $ref link will exist.
+ }
+
+ boolean found = false;
+
+ for (ClientLink link : entity.getNavigationLinks()) {
+ if (link instanceof ClientInlineEntity) {
+ final ClientEntity inline = ((ClientInlineEntity) link).getEntity();
+ assertNotNull(inline);
+
+ final List<? extends ClientProperty> 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);
+ }
+
+ @Ignore
+ @Test
+ public void withInlineEntryAsAtom() {
+ withInlineEntry(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Ignore
+ @Test
+ public void withInlineEntryAsJSON() {
+ // this needs to be full, otherwise there is no mean to recognize links
+ withInlineEntry(ContentType.JSON_FULL_METADATA);
+ }
+
+ private void asyncOrders(final ContentType contentType) {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("async").appendEntitySetSegment("Orders");
+
+ final ODataEntitySetRequest<ClientEntitySet> req =
+ client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ req.setFormat(contentType);
+
+ final AsyncRequestWrapper<ODataRetrieveResponse<ClientEntitySet>> async =
+ client.getAsyncRequestFactory().<ODataRetrieveResponse<ClientEntitySet>> getAsyncRequestWrapper(req);
+ async.callback(URI.create("http://client.service.it/callback/endpoint"));
+
+ final AsyncResponseWrapper<ODataRetrieveResponse<ClientEntitySet>> responseWrapper = async.execute();
+
+ assertTrue(responseWrapper.isPreferenceApplied());
+ assertTrue(responseWrapper.isDone());
+
+ final ODataRetrieveResponse<ClientEntitySet> res = responseWrapper.getODataResponse();
+ final ClientEntitySet entitySet = res.getBody();
+
+ assertFalse(entitySet.getEntities().isEmpty());
+ }
+
+ @Test
+ public void asyncOrdersAsAtom() {
+ asyncOrders(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void asyncOrdersAsJSON() {
+ asyncOrders(ContentType.JSON);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/AuthBatchTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/AuthBatchTestITCase.java
new file mode 100644
index 0000000..9103818
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/AuthBatchTestITCase.java
@@ -0,0 +1,119 @@
+/*
+ * 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.base;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.request.batch.BatchManager;
+import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
+import org.apache.olingo.client.api.communication.request.batch.ODataChangeset;
+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.ODataBatchResponse;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.http.HttpClientException;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.junit.Test;
+
+public class AuthBatchTestITCase extends AbstractTestITCase {
+
+ private final static ContentType ACCEPT = ContentType.APPLICATION_OCTET_STREAM;
+
+ @Test
+ public void clean() throws EdmPrimitiveTypeException {
+ final ODataClient authclient = ODataClientFactory.getClient();
+ batchRequest(authclient, testStaticServiceRootURL);
+ }
+
+ @Test
+ public void authorized() throws EdmPrimitiveTypeException {
+ final ODataClient authclient = ODataClientFactory.getClient();
+ authclient.getConfiguration().setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
+ batchRequest(authclient, testAuthServiceRootURL);
+ }
+
+ @Test(expected = HttpClientException.class)
+ public void unauthorized() throws EdmPrimitiveTypeException {
+ final ODataClient unauthclient = ODataClientFactory.getClient();
+ unauthclient.getConfiguration().setHttpClientFactory(new BasicAuthHttpClientFactory("not_auth", "not_auth"));
+ batchRequest(unauthclient, testAuthServiceRootURL);
+ }
+
+ private void batchRequest(final ODataClient client, final String baseURL) throws EdmPrimitiveTypeException {
+ // create your request
+ final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(baseURL);
+ request.setAccept(ACCEPT.toContentTypeString());
+ request.addCustomHeader("User-Agent", "Apache Olingo OData Client");
+ request.addCustomHeader(HttpHeader.ACCEPT_CHARSET, "UTF-8");
+
+ final BatchManager streamManager = request.payloadManager();
+
+ // -------------------------------------------
+ // Add retrieve item
+ // -------------------------------------------
+ // prepare URI
+ URIBuilder targetURI = client.newURIBuilder(baseURL);
+ targetURI.appendEntitySetSegment("Customers").appendKeySegment(1);
+
+ // create new request
+ ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
+ queryReq.setFormat(ContentType.JSON);
+
+ streamManager.addRequest(queryReq);
+ // -------------------------------------------
+
+ // -------------------------------------------
+ // Add changeset item
+ // -------------------------------------------
+ final ODataChangeset changeset = streamManager.addChangeset();
+
+ // Update Customer into the changeset
+ targetURI = client.newURIBuilder(baseURL).appendEntitySetSegment("Customers").appendKeySegment(1);
+ final URI editLink = targetURI.build();
+
+ final ClientEntity patch = client.getObjectFactory().newEntity(
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
+ patch.setEditLink(editLink);
+
+ patch.getProperties().add(client.getObjectFactory().newPrimitiveProperty(
+ "LastName",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("new last name")));
+
+ final ODataEntityUpdateRequest<ClientEntity> changeReq =
+ client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patch);
+ changeReq.setFormat(ContentType.JSON_FULL_METADATA);
+
+ changeset.addRequest(changeReq);
+ // -------------------------------------------
+
+ final ODataBatchResponse response = streamManager.getResponse();
+ assertEquals(200, response.getStatusCode());
+ assertEquals("OK", response.getStatusMessage());
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/BatchTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/BatchTestITCase.java
new file mode 100644
index 0000000..2e77a08
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/BatchTestITCase.java
@@ -0,0 +1,647 @@
+/*
+ * 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.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.http.HttpResponse;
+import org.apache.olingo.client.api.ODataBatchConstants;
+import org.apache.olingo.client.api.communication.request.AsyncBatchRequestWrapper;
+import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
+import org.apache.olingo.client.api.communication.request.batch.BatchManager;
+import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
+import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
+import org.apache.olingo.client.api.communication.request.batch.ODataChangeset;
+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.request.retrieve.ODataEntitySetRequest;
+import org.apache.olingo.client.api.communication.response.AsyncResponse;
+import org.apache.olingo.client.api.communication.response.AsyncResponseWrapper;
+import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
+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.ODataResponse;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
+import org.apache.olingo.client.core.communication.request.Wrapper;
+import org.apache.olingo.client.core.communication.request.batch.ODataChangesetResponseItem;
+import org.apache.olingo.client.core.communication.request.batch.ODataSingleResponseItem;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl.ODataEntityResponseImpl;
+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.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.junit.Test;
+
+public class BatchTestITCase extends AbstractTestITCase {
+
+ private static final String PREFIX = "!!PREFIX!!";
+
+ private static final String SUFFIX = "!!SUFFIX!!";
+
+ private static final int MAX = 10000;
+
+ private final static String ACCEPT = ContentType.APPLICATION_OCTET_STREAM.toContentTypeString();
+
+ @Test
+ public void stringStreaming() {
+ final TestStreamManager streaming = new TestStreamManager();
+
+ new StreamingThread(streaming).start();
+
+ streaming.addObject((PREFIX + "\n").getBytes());
+
+ for (int i = 0; i <= MAX; i++) {
+ streaming.addObject((i + ") send info\n").getBytes());
+ }
+
+ streaming.addObject(SUFFIX.getBytes());
+ streaming.finalizeBody();
+ }
+
+ @Test
+ public void emptyBatchRequest() {
+ // create your request
+ final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
+ request.setAccept(ACCEPT);
+
+ final BatchManager payload = request.payloadManager();
+ final ODataBatchResponse response = payload.getResponse();
+
+ assertEquals(200, response.getStatusCode());
+ assertEquals("OK", response.getStatusMessage());
+
+ final Iterator<ODataBatchResponseItem> iter = response.getBody();
+ assertFalse(iter.hasNext());
+ }
+
+ @Test
+ public void changesetWithError() {
+ // create your request
+ final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
+ request.setAccept(ACCEPT);
+
+ final BatchManager payload = request.payloadManager();
+ final ODataChangeset changeset = payload.addChangeset();
+
+ URIBuilder targetURI;
+ ODataEntityCreateRequest<ClientEntity> createReq;
+
+ targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
+ for (int i = 1; i <= 2; i++) {
+ // Create Customer into the changeset
+ createReq = client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), newOrder(100 + i));
+ createReq.setFormat(ContentType.JSON);
+ changeset.addRequest(createReq);
+ }
+
+ targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("WrongEntitySet");
+ createReq = client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), newOrder(105));
+ createReq.setFormat(ContentType.JSON);
+ changeset.addRequest(createReq);
+
+ targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
+ for (int i = 3; i <= 4; i++) {
+ // Create Customer into the changeset
+ createReq = client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), newOrder(100 + i));
+ createReq.setFormat(ContentType.JSON);
+ changeset.addRequest(createReq);
+ }
+
+ final ODataBatchResponse response = payload.getResponse();
+ assertEquals(200, response.getStatusCode());
+ assertEquals("OK", response.getStatusMessage());
+
+ final Iterator<ODataBatchResponseItem> iter = response.getBody();
+ // retrieve the first item (ODataRetrieve)
+ ODataBatchResponseItem item = iter.next();
+
+ ODataChangesetResponseItem retitem = (ODataChangesetResponseItem) item;
+ ODataResponse res = retitem.next();
+ assertEquals(404, res.getStatusCode());
+ assertEquals("Not Found", res.getStatusMessage());
+ assertEquals(Integer.valueOf(3), Integer.valueOf(
+ res.getHeader(ODataBatchConstants.CHANGESET_CONTENT_ID_NAME).iterator().next()));
+
+ assertFalse(retitem.hasNext());
+ assertFalse(iter.hasNext());
+ }
+
+ @Test
+ public void continueOnError() {
+ continueOnError(true);
+ }
+
+ @Test
+ public void doNotContinueOnError() {
+ continueOnError(false);
+ }
+
+ private void continueOnError(final boolean continueOnError) {
+ final boolean preContinueOnError = client.getConfiguration().isContinueOnError();
+ client.getConfiguration().setContinueOnError(continueOnError);
+
+ // create your request
+ final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
+ request.setAccept(ACCEPT);
+
+ final BatchManager streamManager = request.payloadManager();
+
+ // -------------------------------------------
+ // Add retrieve item
+ // -------------------------------------------
+ // prepare URI
+ URIBuilder targetURI = client.newURIBuilder(testStaticServiceRootURL);
+ targetURI.appendEntitySetSegment("UnexistingEntitySet").appendKeySegment(1);
+
+ // create new request
+ ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
+ queryReq.setFormat(ContentType.JSON);
+
+ streamManager.addRequest(queryReq);
+ // -------------------------------------------
+
+ // -------------------------------------------
+ // Add retrieve item
+ // -------------------------------------------
+ // prepare URI
+ targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
+
+ // create new request
+ queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
+
+ streamManager.addRequest(queryReq);
+ // -------------------------------------------
+
+ final ODataBatchResponse response = streamManager.getResponse();
+ assertEquals(200, response.getStatusCode());
+ assertEquals("OK", response.getStatusMessage());
+ final Iterator<ODataBatchResponseItem> iter = response.getBody();
+
+ // retrieve the first item (ODataRetrieve)
+ ODataBatchResponseItem item = iter.next();
+ assertTrue(item instanceof ODataSingleResponseItem);
+
+ ODataSingleResponseItem retitem = (ODataSingleResponseItem) item;
+ ODataResponse res = retitem.next();
+ assertEquals(404, res.getStatusCode());
+ assertEquals("Not Found", res.getStatusMessage());
+
+ if (continueOnError) {
+ item = iter.next();
+ assertTrue(item instanceof ODataSingleResponseItem);
+
+ retitem = (ODataSingleResponseItem) item;
+ res = retitem.next();
+ assertTrue(res instanceof ODataEntityResponseImpl);
+ assertEquals(200, res.getStatusCode());
+ assertEquals("OK", res.getStatusMessage());
+ }
+
+ client.getConfiguration().setContinueOnError(preContinueOnError);
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void changesetWithReference() throws Exception {
+ // create your request
+ final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
+ request.setAccept(ACCEPT);
+ final BatchManager streamManager = request.payloadManager();
+
+ final ODataChangeset changeset = streamManager.addChangeset();
+ ClientEntity order = newOrder(20);
+
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
+
+ // add create request
+ final ODataEntityCreateRequest<ClientEntity> createReq =
+ client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), order);
+
+ changeset.addRequest(createReq);
+
+ // retrieve request reference
+ int createRequestRef = changeset.getLastContentId();
+
+ // add update request: link CustomerInfo(17) to the new customer
+ final ClientEntity customerChanges = client.getObjectFactory().newEntity(order.getTypeName());
+ customerChanges.addLink(client.getObjectFactory().newEntitySetNavigationLink(
+ "OrderDetails", new URI(testStaticServiceRootURL + "/OrderDetails(OrderID=7,ProductID=5)")));
+
+ final ODataEntityUpdateRequest<ClientEntity> updateReq = client.getCUDRequestFactory().getEntityUpdateRequest(
+ URI.create("$" + createRequestRef), UpdateType.PATCH, customerChanges);
+
+ changeset.addRequest(updateReq);
+
+ final ODataBatchResponse response = streamManager.getResponse();
+ assertEquals(200, response.getStatusCode());
+ assertEquals("OK", response.getStatusMessage());
+
+ // verify response payload ...
+ final Iterator<ODataBatchResponseItem> iter = response.getBody();
+
+ final ODataBatchResponseItem item = iter.next();
+ assertTrue(item instanceof ODataChangesetResponseItem);
+
+ final ODataChangesetResponseItem chgitem = (ODataChangesetResponseItem) item;
+
+ ODataResponse res = chgitem.next();
+ assertEquals(201, res.getStatusCode());
+ assertTrue(res instanceof ODataEntityCreateResponse);
+
+ order = ((ODataEntityCreateResponse<ClientEntity>) res).getBody();
+ final ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().getEntitySetRequest(
+ URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString() + "/OrderDetails"));
+
+ assertEquals(Integer.valueOf(7),
+ req.execute().getBody().getEntities().get(0).getProperty("OrderID").getPrimitiveValue().
+ toCastValue(Integer.class));
+
+ res = chgitem.next();
+ assertEquals(204, res.getStatusCode());
+ assertTrue(res instanceof ODataEntityUpdateResponse);
+
+ // clean ...
+ assertEquals(204, client.getCUDRequestFactory().getDeleteRequest(
+ URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString())).execute().
+ getStatusCode());
+
+ try {
+ client.getRetrieveRequestFactory().getEntityRequest(
+ URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString())).
+ execute().getBody();
+ fail();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void batchRequestWithOutsideUpdates() throws EdmPrimitiveTypeException {
+ // create your request
+ final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
+ request.setAccept(ACCEPT);
+ final BatchManager streamManager = request.payloadManager();
+
+ // -------------------------------------------
+ // Add retrieve item
+ // -------------------------------------------
+ // prepare URI
+ URIBuilder targetURI = client.newURIBuilder(testStaticServiceRootURL);
+ targetURI.appendEntitySetSegment("Customers").appendKeySegment(1).
+ expand("Orders").select("PersonID,Orders/OrderID");
+
+ // create new request
+ ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
+ queryReq.setFormat(ContentType.JSON);
+
+ streamManager.addRequest(queryReq);
+ // -------------------------------------------
+
+ // -------------------------------------------
+ // Add new order with outside item
+ // -------------------------------------------
+ // prepare URI
+ targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
+ final ClientEntity original = newOrder(2000);
+ final ODataEntityCreateRequest<ClientEntity> createReq =
+ client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original);
+ createReq.setFormat(ContentType.JSON);
+ streamManager.addRequest(createReq);
+ // -------------------------------------------
+
+ final ODataBatchResponse response = streamManager.getResponse();
+ assertEquals(200, response.getStatusCode());
+ assertEquals("OK", response.getStatusMessage());
+ final Iterator<ODataBatchResponseItem> iter = response.getBody();
+
+ // retrieve the first item (ODataRetrieve)
+ ODataBatchResponseItem item = iter.next();
+ assertTrue(item instanceof ODataSingleResponseItem);
+
+ ODataSingleResponseItem retitem = (ODataSingleResponseItem) item;
+ ODataResponse res = retitem.next();
+ assertTrue(res instanceof ODataEntityResponseImpl);
+ assertEquals(200, res.getStatusCode());
+ assertEquals("OK", res.getStatusMessage());
+
+ // retrieve the second item (ODataChangeset)
+ item = iter.next();
+ assertTrue(item instanceof ODataSingleResponseItem);
+
+ final ODataSingleResponseItem outitem = (ODataSingleResponseItem) item;
+ res = outitem.next();
+ assertTrue(res instanceof ODataEntityCreateResponse);
+ assertEquals(201, res.getStatusCode());
+ assertEquals("Created", res.getStatusMessage());
+
+ final ODataEntityCreateResponse<ClientEntity> entres = (ODataEntityCreateResponse<ClientEntity>) res;
+ final ClientEntity entity = entres.getBody();
+ assertEquals(2000, entity.getProperty("OrderID").getPrimitiveValue().toCastValue(Integer.class).intValue());
+
+ assertFalse(iter.hasNext());
+ }
+
+ @Test
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void batchRequest() throws EdmPrimitiveTypeException {
+ // create your request
+ final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
+ request.setAccept(ACCEPT);
+
+ final BatchManager streamManager = request.payloadManager();
+
+ // -------------------------------------------
+ // Add retrieve item
+ // -------------------------------------------
+ // prepare URI
+ URIBuilder targetURI = client.newURIBuilder(testStaticServiceRootURL);
+ targetURI.appendEntitySetSegment("Customers").appendKeySegment(1);
+
+ // create new request
+ ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
+ queryReq.setFormat(ContentType.JSON);
+
+ streamManager.addRequest(queryReq);
+ // -------------------------------------------
+
+ // -------------------------------------------
+ // Add changeset item
+ // -------------------------------------------
+ final ODataChangeset changeset = streamManager.addChangeset();
+
+ // Update Customer into the changeset
+ targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
+ final URI editLink = targetURI.build();
+
+ final ClientEntity patch = client.getObjectFactory().newEntity(
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
+ patch.setEditLink(editLink);
+
+ patch.getProperties().add(client.getObjectFactory().newPrimitiveProperty(
+ "LastName",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("new last name")));
+
+ final ODataEntityUpdateRequest<ClientEntity> changeReq =
+ client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patch);
+ changeReq.setFormat(ContentType.JSON_FULL_METADATA);
+
+ changeset.addRequest(changeReq);
+
+ // Create Order into the changeset
+ targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
+ final ClientEntity original = newOrder(1000);
+ final ODataEntityCreateRequest<ClientEntity> createReq =
+ client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original);
+ createReq.setFormat(ContentType.JSON);
+ changeset.addRequest(createReq);
+ // -------------------------------------------
+
+ // -------------------------------------------
+ // Add retrieve item
+ // -------------------------------------------
+ // prepare URI
+ targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
+
+ // create new request
+ queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
+
+ streamManager.addRequest(queryReq);
+ // -------------------------------------------
+
+ final ODataBatchResponse response = streamManager.getResponse();
+ assertEquals(200, response.getStatusCode());
+ assertEquals("OK", response.getStatusMessage());
+ final Iterator<ODataBatchResponseItem> iter = response.getBody();
+
+ // retrieve the first item (ODataRetrieve)
+ ODataBatchResponseItem item = iter.next();
+ assertTrue(item instanceof ODataSingleResponseItem);
+
+ ODataSingleResponseItem retitem = (ODataSingleResponseItem) item;
+ ODataResponse res = retitem.next();
+ assertTrue(res instanceof ODataEntityResponseImpl);
+ assertEquals(200, res.getStatusCode());
+ assertEquals("OK", res.getStatusMessage());
+
+ ODataEntityRequestImpl<ClientEntity>.ODataEntityResponseImpl entres =
+ (ODataEntityRequestImpl.ODataEntityResponseImpl) res;
+
+ ClientEntity entity = entres.getBody();
+ assertEquals(1, entity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0);
+
+ // retrieve the second item (ODataChangeset)
+ item = iter.next();
+ assertTrue(item instanceof ODataChangesetResponseItem);
+
+ final ODataChangesetResponseItem chgitem = (ODataChangesetResponseItem) item;
+ res = chgitem.next();
+ assertTrue(res instanceof ODataEntityUpdateResponse);
+ assertEquals(204, res.getStatusCode());
+ assertEquals("No Content", res.getStatusMessage());
+
+ res = chgitem.next();
+ assertTrue(res instanceof ODataEntityCreateResponse);
+ assertEquals(201, res.getStatusCode());
+ assertEquals("Created", res.getStatusMessage());
+
+ final ODataEntityCreateResponse<ClientEntity> createres = (ODataEntityCreateResponse<ClientEntity>) res;
+ entity = createres.getBody();
+ assertEquals(new Integer(1000), entity.getProperty("OrderID").getPrimitiveValue().toCastValue(Integer.class));
+
+ // retrieve the third item (ODataRetrieve)
+ item = iter.next();
+ assertTrue(item instanceof ODataSingleResponseItem);
+
+ retitem = (ODataSingleResponseItem) item;
+ res = retitem.next();
+ assertTrue(res instanceof ODataEntityResponseImpl);
+ assertEquals(200, res.getStatusCode());
+ assertEquals("OK", res.getStatusMessage());
+
+ entres = (ODataEntityRequestImpl.ODataEntityResponseImpl) res;
+ entity = entres.getBody();
+ assertEquals("new last name", entity.getProperty("LastName").getPrimitiveValue().toCastValue(String.class));
+
+ assertFalse(iter.hasNext());
+ }
+
+ @Test
+ public void async() {
+ // create your request
+ final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(
+ URI.create(testStaticServiceRootURL + "/async/").normalize().toASCIIString());
+ request.setAccept(ACCEPT);
+
+ final AsyncBatchRequestWrapper async = client.getAsyncRequestFactory().getAsyncBatchRequestWrapper(request);
+
+ // -------------------------------------------
+ // Add retrieve item
+ // -------------------------------------------
+ // prepare URI
+ URIBuilder targetURI = client.newURIBuilder(testStaticServiceRootURL);
+ targetURI.appendEntitySetSegment("People").appendKeySegment(5);
+
+ // create new request
+ ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
+ queryReq.setFormat(ContentType.JSON);
+
+ async.addRetrieve(queryReq);
+ // -------------------------------------------
+
+ // -------------------------------------------
+ // Add retrieve item
+ // -------------------------------------------
+ // prepare URI
+ targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
+
+ // create new request
+ queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
+
+ async.addRetrieve(queryReq);
+ // -------------------------------------------
+
+ final AsyncResponseWrapper<ODataBatchResponse> responseWrapper = async.execute();
+
+ assertTrue(responseWrapper.isPreferenceApplied());
+ assertTrue(responseWrapper.isDone());
+
+ final ODataBatchResponse response = responseWrapper.getODataResponse();
+
+ assertEquals(200, response.getStatusCode());
+ assertEquals("Ok", response.getStatusMessage());
+ final Iterator<ODataBatchResponseItem> iter = response.getBody();
+
+ // retrieve the first item (ODataRetrieve)
+ final ODataBatchResponseItem item = iter.next();
+ assertTrue(item instanceof ODataSingleResponseItem);
+
+ // The service return interim results to an asynchronously executing batch.
+ final ODataSingleResponseItem retitem = (ODataSingleResponseItem) item;
+ final ODataResponse res = retitem.next();
+ assertTrue(res instanceof AsyncResponse);
+ assertEquals(202, res.getStatusCode());
+ assertEquals("Accepted", res.getStatusMessage());
+
+ final Collection<String> newMonitorLocation = res.getHeader(HttpHeader.LOCATION);
+ if (newMonitorLocation != null && !newMonitorLocation.isEmpty()) {
+ responseWrapper.forceNextMonitorCheck(URI.create(newMonitorLocation.iterator().next()));
+ // .... now you can start again with isDone() and getODataResponse().
+ }
+
+ assertFalse(retitem.hasNext());
+ assertFalse(iter.hasNext());
+ }
+
+ private static class TestStreamManager extends AbstractODataStreamManager<ODataBatchResponse> {
+
+ public TestStreamManager() {
+ super(new Wrapper<Future<HttpResponse>>());
+ }
+
+ public ODataPayloadManager<ODataBatchResponse> addObject(final byte[] src) {
+ stream(src);
+ return this;
+ }
+
+ @Override
+ protected ODataBatchResponse getResponse(final long timeout, final TimeUnit unit) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ };
+
+ /**
+ * To be used for debug purposes.
+ */
+ private static class StreamingThread extends Thread {
+
+ private final TestStreamManager streaming;
+
+ public StreamingThread(final TestStreamManager streaming) {
+ super();
+ this.streaming = streaming;
+ }
+
+ @Override
+ public void run() {
+ try {
+ final StringBuilder builder = new StringBuilder();
+
+ byte[] buff = new byte[1024];
+
+ int len;
+
+ while ((len = streaming.getBody().read(buff)) >= 0) {
+ builder.append(new String(buff, 0, len));
+ }
+
+ assertTrue(builder.toString().startsWith(PREFIX));
+ assertTrue(builder.toString().contains((MAX / 2) + ") send info"));
+ assertTrue(builder.toString().contains((MAX / 3) + ") send info"));
+ assertTrue(builder.toString().contains((MAX / 20) + ") send info"));
+ assertTrue(builder.toString().contains((MAX / 30) + ") send info"));
+ assertTrue(builder.toString().contains(MAX + ") send info"));
+ assertTrue(builder.toString().endsWith(SUFFIX));
+
+ } catch (IOException e) {
+ fail();
+ }
+ }
+ }
+
+ private ClientEntity newOrder(final int id) {
+ final ClientEntity order = getClient().getObjectFactory().
+ newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order"));
+
+ order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderID",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id)));
+ order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderDate",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).build()));
+ order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ShelfLife",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build()));
+ order.getProperties().add(getClient().getObjectFactory().newCollectionProperty("OrderShelfLifes",
+ getClient().getObjectFactory().newCollectionValue(EdmPrimitiveTypeKind.Duration.name()).add(
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Duration).
+ setValue(new BigDecimal("0.0000002")).build())));
+
+ return order;
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/BoundOperationInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/BoundOperationInvokeTestITCase.java
new file mode 100644
index 0000000..ecd15c7
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/BoundOperationInvokeTestITCase.java
@@ -0,0 +1,459 @@
+/*
+ * 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.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.TimeZone;
+
+import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.domain.ClientCollectionValue;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientEnumValue;
+import org.apache.olingo.client.api.domain.ClientOperation;
+import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientSingleton;
+import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+public class BoundOperationInvokeTestITCase extends AbstractTestITCase {
+
+ private void functions(final ContentType contentType) throws EdmPrimitiveTypeException {
+ // GetEmployeesCount
+ URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Company");
+ final ODataEntityRequest<ClientSingleton> singletonReq =
+ client.getRetrieveRequestFactory().getSingletonRequest(builder.build());
+ singletonReq.setFormat(contentType);
+ final ClientSingleton company = singletonReq.execute().getBody();
+ assertNotNull(company);
+
+ ClientOperation boundOp = company.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount");
+ assertNotNull(boundOp);
+
+ final ODataInvokeRequest<ClientProperty> getEmployeesCountReq =
+ client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientProperty.class);
+ getEmployeesCountReq.setFormat(contentType);
+ final ClientProperty getEmployeesCountRes = getEmployeesCountReq.execute().getBody();
+ assertNotNull(getEmployeesCountRes);
+ assertTrue(getEmployeesCountRes.hasPrimitiveValue());
+
+ // GetProductDetails
+ builder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Products").appendKeySegment(5);
+ ODataEntityRequest<ClientEntity> entityReq = client.getRetrieveRequestFactory().
+ getEntityRequest(builder.build());
+ entityReq.setFormat(contentType);
+ ClientEntity entity = entityReq.execute().getBody();
+ assertNotNull(entity);
+
+ boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails");
+ assertNotNull(boundOp);
+
+ final ClientPrimitiveValue count = client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(1);
+ final ODataInvokeRequest<ClientEntitySet> getProductDetailsReq =
+ client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientEntitySet.class,
+ Collections.<String, ClientValue> singletonMap("count", count));
+ getProductDetailsReq.setFormat(contentType);
+ final ClientEntitySet getProductDetailsRes = getProductDetailsReq.execute().getBody();
+ assertNotNull(getProductDetailsRes);
+ assertEquals(1, getProductDetailsRes.getEntities().size());
+
+ // GetRelatedProduct
+ final Map<String, Object> keyMap = new LinkedHashMap<String, Object>();
+ keyMap.put("ProductID", 6);
+ keyMap.put("ProductDetailID", 1);
+ builder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("ProductDetails").appendKeySegment(keyMap);
+ entityReq = client.getRetrieveRequestFactory().getEntityRequest(builder.build());
+ entityReq.setFormat(contentType);
+ entity = entityReq.execute().getBody();
+ assertNotNull(entity);
+
+ boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct");
+ assertNotNull(boundOp);
+
+ final ODataInvokeRequest<ClientEntity> getRelatedProductReq =
+ client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientEntity.class);
+ getRelatedProductReq.setFormat(contentType);
+ final ClientEntity getRelatedProductRes = getRelatedProductReq.execute().getBody();
+ assertNotNull(getRelatedProductRes);
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Product",
+ getRelatedProductRes.getTypeName().toString());
+ assertEquals(6, getRelatedProductRes.getProperty("ProductID").getPrimitiveValue().toCastValue(Integer.class), 0);
+
+ // GetDefaultPI
+ builder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Accounts").appendKeySegment(102);
+ entityReq = client.getRetrieveRequestFactory().getEntityRequest(builder.build());
+ entityReq.setFormat(contentType);
+ entity = entityReq.execute().getBody();
+ assertNotNull(entity);
+
+ boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI");
+ assertNotNull(boundOp);
+
+ final ODataInvokeRequest<ClientEntity> getDefaultPIReq =
+ client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientEntity.class);
+ getDefaultPIReq.setFormat(contentType);
+ final ClientEntity getDefaultPIRes = getDefaultPIReq.execute().getBody();
+ assertNotNull(getDefaultPIRes);
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
+ getDefaultPIRes.getTypeName().toString());
+ assertEquals(102901,
+ getDefaultPIRes.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0);
+
+ // GetAccountInfo
+ boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo");
+ assertNotNull(boundOp);
+
+ final ODataInvokeRequest<ClientProperty> getAccountInfoReq =
+ client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientProperty.class);
+ getAccountInfoReq.setFormat(contentType);
+ final ClientProperty getAccountInfoRes = getAccountInfoReq.execute().getBody();
+ assertNotNull(getAccountInfoRes);
+ assertTrue(getAccountInfoRes.hasComplexValue());
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.AccountInfo",
+ getAccountInfoRes.getComplexValue().getTypeName());
+
+ // GetActualAmount
+ entityReq = client.getRetrieveRequestFactory().getEntityRequest(
+ entity.getNavigationLink("MyGiftCard").getLink());
+ entityReq.setFormat(contentType);
+ entity = entityReq.execute().getBody();
+ assertNotNull(entity);
+ assertEquals(301, entity.getProperty("GiftCardID").getPrimitiveValue().toCastValue(Integer.class), 0);
+
+ boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount");
+ assertNotNull(boundOp);
+
+ final ClientPrimitiveValue bonusRate = client.getObjectFactory().newPrimitiveValueBuilder().buildDouble(1.1);
+ final ODataInvokeRequest<ClientProperty> getActualAmountReq =
+ client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientProperty.class,
+ Collections.<String, ClientValue> singletonMap("bonusRate", bonusRate));
+ getActualAmountReq.setFormat(contentType);
+ final ClientProperty getActualAmountRes = getActualAmountReq.execute().getBody();
+ assertNotNull(getActualAmountRes);
+ assertEquals(41.79, getActualAmountRes.getPrimitiveValue().toCastValue(Double.class), 0);
+ }
+
+ @Test
+ public void atomFunctions() throws EdmPrimitiveTypeException {
+ functions(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonFunctions() throws EdmPrimitiveTypeException {
+ functions(ContentType.JSON_FULL_METADATA);
+ }
+
+ @Test
+ public void edmEnabledFunctions() throws EdmPrimitiveTypeException {
+ // GetEmployeesCount
+ final ODataInvokeRequest<ClientProperty> getEmployeesCountReq =
+ edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest(
+ edmClient.newURIBuilder().appendSingletonSegment("Company").build(),
+ new FullQualifiedName(("Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount")),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Company"),
+ false);
+ final ClientProperty getEmployeesCountRes = getEmployeesCountReq.execute().getBody();
+ assertNotNull(getEmployeesCountRes);
+ assertTrue(getEmployeesCountRes.hasPrimitiveValue());
+
+ // GetProductDetails
+ final ClientPrimitiveValue count = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildInt32(1);
+ final ODataInvokeRequest<ClientEntitySet> getProductDetailsReq =
+ edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest(
+ edmClient.newURIBuilder().appendEntitySetSegment("Products").appendKeySegment(5).build(),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails"),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Product"),
+ false,
+ Collections.<String, ClientValue> singletonMap("count", count));
+ final ClientEntitySet getProductDetailsRes = getProductDetailsReq.execute().getBody();
+ assertNotNull(getProductDetailsRes);
+ assertEquals(1, getProductDetailsRes.getEntities().size());
+
+ // GetRelatedProduct
+ final Map<String, Object> keyMap = new LinkedHashMap<String, Object>();
+ keyMap.put("ProductID", 6);
+ keyMap.put("ProductDetailID", 1);
+ URIBuilder builder = edmClient.newURIBuilder().appendEntitySetSegment("ProductDetails").appendKeySegment(keyMap);
+
+ final ODataInvokeRequest<ClientEntity> getRelatedProductReq =
+ edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest(
+ builder.build(),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct"),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.ProductDetail"),
+ false);
+ final ClientEntity getRelatedProductRes = getRelatedProductReq.execute().getBody();
+ assertNotNull(getRelatedProductRes);
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Product",
+ getRelatedProductRes.getTypeName().toString());
+ assertEquals(6, getRelatedProductRes.getProperty("ProductID").getPrimitiveValue().toCastValue(Integer.class), 0);
+
+ // GetDefaultPI
+ final ODataInvokeRequest<ClientEntity> getDefaultPIReq =
+ edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest(
+ edmClient.newURIBuilder().appendEntitySetSegment("Accounts").appendKeySegment(102).build(),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Account"),
+ false);
+ final ClientEntity getDefaultPIRes = getDefaultPIReq.execute().getBody();
+ assertNotNull(getDefaultPIRes);
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
+ getDefaultPIRes.getTypeName().toString());
+ assertEquals(102901,
+ getDefaultPIRes.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0);
+
+ // GetAccountInfo
+ final ODataInvokeRequest<ClientProperty> getAccountInfoReq =
+ edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest(
+ edmClient.newURIBuilder().appendEntitySetSegment("Accounts").appendKeySegment(102).build(),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Account"),
+ false);
+ final ClientProperty getAccountInfoRes = getAccountInfoReq.execute().getBody();
+ assertNotNull(getAccountInfoRes);
+ assertTrue(getAccountInfoRes.hasComplexValue());
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.AccountInfo",
+ getAccountInfoRes.getComplexValue().getTypeName());
+
+ // GetActualAmount
+ final ClientPrimitiveValue bonusRate = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildDouble(1.1);
+ final ODataInvokeRequest<ClientProperty> getActualAmountReq =
+ edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest(
+ edmClient.newURIBuilder().appendEntitySetSegment("Accounts").appendKeySegment(102).
+ appendNavigationSegment("MyGiftCard").build(),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount"),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GiftCard"),
+ false,
+ Collections.<String, ClientValue> singletonMap("bonusRate", bonusRate));
+ final ClientProperty getActualAmountRes = getActualAmountReq.execute().getBody();
+ assertNotNull(getActualAmountRes);
+ assertEquals(41.79, getActualAmountRes.getPrimitiveValue().toCastValue(Double.class), 0);
+ }
+
+ private void actions(final ContentType contentType) throws EdmPrimitiveTypeException {
+ // IncreaseRevenue
+ URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Company");
+ ODataEntityRequest<ClientEntity> entityReq =
+ client.getRetrieveRequestFactory().getEntityRequest(builder.build());
+ entityReq.setFormat(contentType);
+ ClientEntity entity = entityReq.execute().getBody();
+ assertNotNull(entity);
+
+ ClientOperation boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue");
+ assertNotNull(boundOp);
+
+ final ClientPrimitiveValue increaseValue =
+ client.getObjectFactory().newPrimitiveValueBuilder().buildInt64(12L);
+ final ODataInvokeRequest<ClientProperty> increaseRevenueReq =
+ client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ClientProperty.class,
+ Collections.<String, ClientValue> singletonMap("IncreaseValue", increaseValue));
+ increaseRevenueReq.setFormat(contentType);
+ final ClientProperty increaseRevenueRes = increaseRevenueReq.execute().getBody();
+ assertNotNull(increaseRevenueRes);
+ assertTrue(increaseRevenueRes.hasPrimitiveValue());
+
+ // AddAccessRight
+ builder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Products").appendKeySegment(5);
+ entityReq = client.getRetrieveRequestFactory().getEntityRequest(builder.build());
+ entityReq.setFormat(contentType);
+ entity = entityReq.execute().getBody();
+ assertNotNull(entity);
+
+ boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight");
+ assertNotNull(boundOp);
+
+ final ClientEnumValue accessRight = client.getObjectFactory().
+ newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "Execute");
+ final ODataInvokeRequest<ClientProperty> getProductDetailsReq =
+ client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ClientProperty.class,
+ Collections.<String, ClientValue> singletonMap("accessRight", accessRight));
+ getProductDetailsReq.setFormat(contentType);
+ final ClientProperty getProductDetailsRes = getProductDetailsReq.execute().getBody();
+ assertNotNull(getProductDetailsRes);
+ assertTrue(getProductDetailsRes.hasEnumValue());
+
+ // ResetAddress
+ builder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customers").appendKeySegment(2);
+ entityReq = client.getRetrieveRequestFactory().getEntityRequest(builder.build());
+ entityReq.setFormat(contentType);
+ entity = entityReq.execute().getBody();
+ assertNotNull(entity);
+
+ boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.ResetAddress");
+ assertNotNull(boundOp);
+
+ final ClientCollectionValue<ClientValue> addresses =
+ client.getObjectFactory().
+ newCollectionValue("Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)");
+ final ClientComplexValue address = client.getObjectFactory().
+ newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address");
+ address.add(client.getObjectFactory().newPrimitiveProperty("Street",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("Piazza La Bomba E Scappa")));
+ address.add(client.getObjectFactory().newPrimitiveProperty("City",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("Tollo")));
+ address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("66010")));
+ addresses.add(address);
+ final ClientPrimitiveValue index = client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(0);
+ final Map<String, ClientValue> params = new LinkedHashMap<String, ClientValue>(2);
+ params.put("addresses", addresses);
+ params.put("index", index);
+ final ODataInvokeRequest<ClientEntity> resetAddressReq =
+ client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ClientEntity.class, params);
+ resetAddressReq.setFormat(contentType);
+ final ClientEntity resetAddressRes = resetAddressReq.execute().getBody();
+ assertNotNull(resetAddressRes);
+ assertEquals(2, resetAddressRes.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0);
+
+ // RefreshDefaultPI
+ builder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Accounts").appendKeySegment(102);
+ entityReq = client.getRetrieveRequestFactory().getEntityRequest(builder.build());
+ entityReq.setFormat(contentType);
+ entity = entityReq.execute().getBody();
+ assertNotNull(entity);
+
+ boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI");
+ assertNotNull(boundOp);
+
+ Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ dateTime.set(2014, 3, 9, 0, 0, 0);
+ final ClientPrimitiveValue newDate = client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build();
+ final ODataInvokeRequest<ClientEntity> getDefaultPIReq =
+ client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ClientEntity.class,
+ Collections.<String, ClientValue> singletonMap("newDate", newDate));
+ getDefaultPIReq.setFormat(contentType);
+ final ClientEntity getDefaultPIRes = getDefaultPIReq.execute().getBody();
+ assertNotNull(getDefaultPIRes);
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
+ getDefaultPIRes.getTypeName().toString());
+ assertEquals(102901,
+ getDefaultPIRes.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0);
+ }
+
+ @Test
+ public void atomActions() throws EdmPrimitiveTypeException {
+ actions(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonActions() throws EdmPrimitiveTypeException {
+ actions(ContentType.JSON_FULL_METADATA);
+ }
+
+ @Test
+ public void edmEnabledActions() throws EdmPrimitiveTypeException {
+ // IncreaseRevenue
+ final ClientPrimitiveValue increaseValue = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildInt64(12L);
+ final ODataInvokeRequest<ClientProperty> increaseRevenueReq =
+ edmClient.getInvokeRequestFactory().getBoundActionInvokeRequest(
+ edmClient.newURIBuilder().appendSingletonSegment("Company").build(),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue"),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Company"),
+ false,
+ Collections.<String, ClientValue> singletonMap("IncreaseValue", increaseValue));
+ final ClientProperty increaseRevenueRes = increaseRevenueReq.execute().getBody();
+ assertNotNull(increaseRevenueRes);
+ assertTrue(increaseRevenueRes.hasPrimitiveValue());
+
+ // AddAccessRight
+ final ClientEnumValue accessRight = edmClient.getObjectFactory().
+ newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "Execute");
+ final ODataInvokeRequest<ClientProperty> getProductDetailsReq =
+ edmClient.getInvokeRequestFactory().getBoundActionInvokeRequest(
+ edmClient.newURIBuilder().appendEntitySetSegment("Products").appendKeySegment(5).build(),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight"),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Product"),
+ false,
+ Collections.<String, ClientValue> singletonMap("accessRight", accessRight));
+ final ClientProperty getProductDetailsRes = getProductDetailsReq.execute().getBody();
+ assertNotNull(getProductDetailsRes);
+ assertTrue(getProductDetailsRes.hasEnumValue());
+
+ // ResetAddress
+ final ClientCollectionValue<ClientValue> addresses =
+ edmClient.getObjectFactory().
+ newCollectionValue("Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)");
+ final ClientComplexValue address = edmClient.getObjectFactory().
+ newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address");
+ address.add(edmClient.getObjectFactory().newPrimitiveProperty("Street",
+ edmClient.getObjectFactory().newPrimitiveValueBuilder().buildString("Piazza La Bomba E Scappa")));
+ address.add(edmClient.getObjectFactory().newPrimitiveProperty("City",
+ edmClient.getObjectFactory().newPrimitiveValueBuilder().buildString("Tollo")));
+ address.add(edmClient.getObjectFactory().newPrimitiveProperty("PostalCode",
+ edmClient.getObjectFactory().newPrimitiveValueBuilder().buildString("66010")));
+ addresses.add(address);
+ final ClientPrimitiveValue index = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildInt32(0);
+ final Map<String, ClientValue> params = new LinkedHashMap<String, ClientValue>(2);
+ params.put("addresses", addresses);
+ params.put("index", index);
+ final Map<String, Object> keys = new HashMap<String, Object>();
+ keys.put("PersonID", 2);
+ final ODataInvokeRequest<ClientEntity> resetAddressReq =
+ edmClient.getInvokeRequestFactory().getBoundActionInvokeRequest(
+ edmClient.newURIBuilder().appendEntitySetSegment("Customers").appendKeySegment(keys).build(),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Person"),
+ false,
+ params);
+ final ClientEntity resetAddressRes = resetAddressReq.execute().getBody();
+ assertNotNull(resetAddressRes);
+ assertEquals(2, resetAddressRes.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0);
+
+ // RefreshDefaultPI
+ Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ dateTime.set(2014, 3, 9, 0, 0, 0);
+ final ClientPrimitiveValue newDate = edmClient.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build();
+ final ODataInvokeRequest<ClientEntity> getDefaultPIReq =
+ edmClient.getInvokeRequestFactory().getBoundActionInvokeRequest(
+ edmClient.newURIBuilder().appendEntitySetSegment("Accounts").appendKeySegment(102).build(),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"),
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Account"),
+ false,
+ Collections.<String, ClientValue> singletonMap("newDate", newDate));
+ final ClientEntity getDefaultPIRes = getDefaultPIReq.execute().getBody();
+ assertNotNull(getDefaultPIRes);
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
+ getDefaultPIRes.getTypeName().toString());
+ assertEquals(102901,
+ getDefaultPIRes.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/ConformanceTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/ConformanceTestITCase.java
new file mode 100644
index 0000000..d682e64
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/ConformanceTestITCase.java
@@ -0,0 +1,415 @@
+/*
+ * 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.base;
+
+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.math.BigDecimal;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import org.apache.olingo.client.api.communication.request.AsyncRequestWrapper;
+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.ODataDeltaRequest;
+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.AsyncResponseWrapper;
+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.domain.ClientCollectionValue;
+import org.apache.olingo.client.api.domain.ClientDelta;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
+import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+/**
+ * 13.2 Interoperable OData Clients
+ * <br />
+ * http://docs.oasis-open.org/odata/odata/v4.0/os/part1-protocol/odata-v4.0-os-part1-protocol.html#_Toc372793762
+ */
+public class ConformanceTestITCase extends AbstractTestITCase {
+
+ /**
+ * 1. MUST specify the OData-MaxVersion header in requests (section 8.2.6).
+ */
+ @Test
+ public void item1() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
+
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+
+ assertEquals("4.0", req.getHeader(HttpHeader.ODATA_MAX_VERSION));
+
+ assertNotNull(req.execute().getBody());
+ }
+
+ /**
+ * 2. MUST specify OData-Version (section 8.1.5) and Content-Type (section 8.1.1) in any request with a payload.
+ */
+ @Test
+ public void item2() {
+ final ClientEntity order = getClient().getObjectFactory().newEntity(
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order"));
+
+ final ClientProperty orderId = getClient().getObjectFactory().newPrimitiveProperty("OrderID",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(2000));
+ order.getProperties().add(orderId);
+
+ Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ dateTime.set(2011, 2, 4, 16, 3, 57);
+ final ClientProperty orderDate = getClient().getObjectFactory().newPrimitiveProperty("OrderDate",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build());
+ order.getProperties().add(orderDate);
+
+ final ClientProperty shelfLife = getClient().getObjectFactory().newPrimitiveProperty("ShelfLife",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000001")).build());
+ order.getProperties().add(shelfLife);
+
+ final ClientCollectionValue<ClientValue> orderShelfLifesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Duration)");
+ orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000001")).build());
+ orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build());
+ final ClientProperty orderShelfLifes = getClient().getObjectFactory().
+ newCollectionProperty("OrderShelfLifes", orderShelfLifesValue);
+ order.getProperties().add(orderShelfLifes);
+
+ final ODataEntityCreateRequest<ClientEntity> req = getClient().getCUDRequestFactory().getEntityCreateRequest(
+ getClient().newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Orders").build(), order);
+ req.setFormat(ContentType.JSON_FULL_METADATA);
+
+ // check for OData-Version
+ assertEquals("4.0", req.getHeader(HttpHeader.ODATA_VERSION));
+
+ // check for Content-Type
+ assertEquals(
+ ContentType.JSON_FULL_METADATA.toContentTypeString(),
+ req.getHeader("Content-Type"));
+ assertEquals(
+ ContentType.JSON_FULL_METADATA.toContentTypeString(),
+ req.getContentType());
+
+ final ClientEntity created = req.execute().getBody();
+ assertNotNull(created);
+
+ final URI deleteURI = created.getEditLink() == null
+ ? getClient().newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Orders").appendKeySegment(2000).build()
+ : created.getEditLink();
+ final ODataDeleteRequest deleteReq = getClient().getCUDRequestFactory().getDeleteRequest(deleteURI);
+ final ODataDeleteResponse deleteRes = deleteReq.execute();
+ assertEquals(204, deleteRes.getStatusCode());
+ }
+
+ /**
+ * 4. MUST follow redirects (section 9.1.5).
+ */
+ @Test
+ public void item4() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("redirect").
+ appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
+
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+
+ assertEquals("4.0", req.getHeader(HttpHeader.ODATA_MAX_VERSION));
+
+ final ODataRetrieveResponse<ClientEntity> res = req.execute();
+ final ClientEntity entity = res.getBody();
+
+ assertNotNull(entity);
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
+ assertTrue(entity.getProperty("Home").hasPrimitiveValue());
+ assertEquals("Edm.GeographyPoint", entity.getProperty("Home").getPrimitiveValue().getTypeName());
+ }
+
+ /**
+ * 5. MUST correctly handle next links (section 11.2.5.7).
+ */
+ @Test
+ public void item5() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People");
+
+ ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
+ req.setFormat(ContentType.JSON_FULL_METADATA);
+ req.setPrefer(client.newPreferences().maxPageSize(5));
+
+ ODataRetrieveResponse<ClientEntitySet> res = req.execute();
+ ClientEntitySet feed = res.getBody();
+
+ assertNotNull(feed);
+
+ assertEquals(5, feed.getEntities().size());
+ assertNotNull(feed.getNext());
+
+ final URI expected = URI.create(testStaticServiceRootURL + "/People?$skiptoken=5");
+ final URI found = URIUtils.getURI(testStaticServiceRootURL, feed.getNext().toASCIIString());
+
+ assertEquals(expected, found);
+
+ req = client.getRetrieveRequestFactory().getEntitySetRequest(found);
+ req.setFormat(ContentType.JSON_FULL_METADATA);
+
+ res = req.execute();
+ feed = res.getBody();
+
+ assertNotNull(feed);
+ }
+
+ /**
+ * 6. MUST support instances returning properties and navigation properties not specified in metadata (section 11.2).
+ */
+ @Test
+ public void item6() {
+ final Integer id = 2000;
+
+ ClientEntity rowIndex = getClient().getObjectFactory().newEntity(
+ new FullQualifiedName("Microsoft.Test.OData.Services.OpenTypesServiceV4.RowIndex"));
+ getClient().getBinder().add(rowIndex,
+ getClient().getObjectFactory().newPrimitiveProperty("Id",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id)));
+
+ // add property not in metadata
+ getClient().getBinder().add(rowIndex,
+ getClient().getObjectFactory().newPrimitiveProperty("aString",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("string")));
+
+ // add navigation property not in metadata
+ rowIndex.addLink(client.getObjectFactory().newEntityNavigationLink(
+ "Row", URI.create(testOpenTypeServiceRootURL + "/Row(71f7d0dc-ede4-45eb-b421-555a2aa1e58f)")));
+
+ final ODataEntityCreateRequest<ClientEntity> createReq = getClient().getCUDRequestFactory().
+ getEntityCreateRequest(getClient().newURIBuilder(testOpenTypeServiceRootURL).
+ appendEntitySetSegment("RowIndex").build(), rowIndex);
+
+ final ODataEntityCreateResponse<ClientEntity> createRes = createReq.execute();
+ assertEquals(201, createRes.getStatusCode());
+
+ final URIBuilder builder = getClient().newURIBuilder(testOpenTypeServiceRootURL).
+ appendEntitySetSegment("RowIndex").appendKeySegment(id);
+
+ rowIndex = read(ContentType.JSON_FULL_METADATA, builder.build());
+ assertNotNull(rowIndex);
+ assertEquals(EdmPrimitiveTypeKind.Int32, rowIndex.getProperty("Id").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.String, rowIndex.getProperty("aString").getPrimitiveValue().getTypeKind());
+ assertNotNull(rowIndex.getNavigationLink("Row"));
+
+ final ODataDeleteResponse deleteRes = getClient().getCUDRequestFactory().
+ getDeleteRequest(rowIndex.getEditLink()).execute();
+ assertEquals(204, deleteRes.getStatusCode());
+ }
+
+ /**
+ * 7. MUST generate PATCH requests for updates, if the client supports updates (section 11.4.3).
+ */
+ @Test
+ public void item7() {
+ final URI uri = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customers").appendKeySegment(1).build();
+
+ final ClientEntity patch = client.getObjectFactory().newEntity(
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
+ patch.setEditLink(uri);
+
+ final String newname = "New Name (" + System.currentTimeMillis() + ")";
+ patch.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("FirstName",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildString(newname)));
+
+ final ODataEntityUpdateRequest<ClientEntity> req =
+ getClient().getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patch);
+
+ final ODataEntityUpdateResponse<ClientEntity> res = req.execute();
+ assertEquals(204, res.getStatusCode());
+
+ final ClientEntity actual = read(ContentType.JSON, uri);
+
+ assertEquals(newname, actual.getProperty("FirstName").getPrimitiveValue().toString());
+ }
+
+ /**
+ * 8. SHOULD support basic authentication as specified in [RFC2617] over HTTPS.
+ * <br />
+ * Unfortunately no service over HTTPs is available yet.
+ */
+ @Test
+ public void item8() {
+ client.getConfiguration().setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
+
+ final URIBuilder uriBuilder = client.newURIBuilder(testAuthServiceRootURL).
+ appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
+
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ req.setFormat(ContentType.JSON_FULL_METADATA);
+
+ assertNotNull(req.execute().getBody());
+
+ client.getConfiguration().setHttpClientFactory(new DefaultHttpClientFactory());
+ }
+
+ /**
+ * 9. MAY request entity references in place of entities previously returned in the response (section 11.2.7).
+ */
+ @Test
+ public void item9() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Orders").appendKeySegment(8).appendNavigationSegment("CustomerForOrder").
+ appendRefSegment();
+
+ ODataEntityRequest<ClientEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ req.setFormat(ContentType.JSON_FULL_METADATA);
+
+ ODataRetrieveResponse<ClientEntity> res = req.execute();
+ assertNotNull(res);
+
+ final ClientEntity entity = res.getBody();
+ assertNotNull(entity);
+ assertTrue(entity.getId().toASCIIString().endsWith("/StaticService/V40/Static.svc/Customers(PersonID=1)"));
+
+ final URI referenceURI = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntityIdSegment(entity.getId().toASCIIString()).build();
+
+ req = client.getRetrieveRequestFactory().getEntityRequest(referenceURI);
+ req.setFormat(ContentType.JSON_FULL_METADATA);
+
+ res = req.execute();
+ assertNotNull(res);
+ assertNotNull(res.getBody());
+ }
+
+ /**
+ * 10. MAY support deleted entities, link entities, deleted link entities in a delta response (section 11.3).
+ */
+ @Test
+ public void item10() {
+ final ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().getEntitySetRequest(
+ client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").build());
+ req.setPrefer(client.newPreferences().trackChanges());
+
+ final ClientEntitySet customers = req.execute().getBody();
+ assertNotNull(customers);
+ assertNotNull(customers.getDeltaLink());
+
+ final ODataDeltaRequest deltaReq = client.getRetrieveRequestFactory().getDeltaRequest(customers.getDeltaLink());
+ deltaReq.setFormat(ContentType.JSON_FULL_METADATA);
+
+ final ClientDelta delta = deltaReq.execute().getBody();
+ assertNotNull(delta);
+
+ assertNotNull(delta.getDeltaLink());
+ assertTrue(delta.getDeltaLink().isAbsolute());
+ assertEquals(5, delta.getCount(), 0);
+
+ assertEquals(1, delta.getDeletedEntities().size());
+ assertTrue(delta.getDeletedEntities().get(0).getId().isAbsolute());
+ assertTrue(delta.getDeletedEntities().get(0).getId().toASCIIString().endsWith("Customers('ANTON')"));
+
+ assertEquals(1, delta.getAddedLinks().size());
+ assertTrue(delta.getAddedLinks().get(0).getSource().isAbsolute());
+ assertTrue(delta.getAddedLinks().get(0).getSource().toASCIIString().endsWith("Customers('BOTTM')"));
+ assertEquals("Orders", delta.getAddedLinks().get(0).getRelationship());
+
+ assertEquals(1, delta.getDeletedLinks().size());
+ assertTrue(delta.getDeletedLinks().get(0).getSource().isAbsolute());
+ assertTrue(delta.getDeletedLinks().get(0).getSource().toASCIIString().endsWith("Customers('ALFKI')"));
+ assertEquals("Orders", delta.getDeletedLinks().get(0).getRelationship());
+
+ assertEquals(2, delta.getEntities().size());
+ ClientProperty property = delta.getEntities().get(0).getProperty("ContactName");
+ assertNotNull(property);
+ assertTrue(property.hasPrimitiveValue());
+ property = delta.getEntities().get(1).getProperty("ShippingAddress");
+ assertNotNull(property);
+ assertTrue(property.hasComplexValue());
+ }
+
+ /**
+ * 11. MAY support asynchronous responses (section 9.1.3).
+ */
+ @Test
+ public void item11() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("async").appendEntitySetSegment("Orders");
+
+ final ODataEntitySetRequest<ClientEntitySet> req =
+ client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ req.setFormat(ContentType.JSON_FULL_METADATA);
+
+ final AsyncRequestWrapper<ODataRetrieveResponse<ClientEntitySet>> async =
+ client.getAsyncRequestFactory().<ODataRetrieveResponse<ClientEntitySet>> getAsyncRequestWrapper(req);
+ async.callback(URI.create("http://client.service.it/callback/endpoint"));
+
+ final AsyncResponseWrapper<ODataRetrieveResponse<ClientEntitySet>> responseWrapper = async.execute();
+
+ assertTrue(responseWrapper.isPreferenceApplied());
+ assertTrue(responseWrapper.isDone());
+
+ final ODataRetrieveResponse<ClientEntitySet> res = responseWrapper.getODataResponse();
+ final ClientEntitySet entitySet = res.getBody();
+
+ assertFalse(entitySet.getEntities().isEmpty());
+ }
+
+ /**
+ * 12. MAY support odata.metadata=minimal in a JSON response (see [OData-JSON]).
+ */
+ @Test
+ public void item12() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
+
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ req.setFormat(ContentType.JSON);
+
+ assertEquals("application/json;odata.metadata=minimal", req.getHeader("Accept"));
+ assertEquals("application/json;odata.metadata=minimal", req.getAccept());
+
+ final ODataRetrieveResponse<ClientEntity> res = req.execute();
+ assertTrue(res.getContentType().startsWith("application/json; odata.metadata=minimal"));
+
+ assertNotNull(res.getBody());
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/DeltaTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/DeltaTestITCase.java
new file mode 100644
index 0000000..6c7bfc6
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/DeltaTestITCase.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.olingo.client.api.communication.request.retrieve.ODataDeltaRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
+import org.apache.olingo.client.api.domain.ClientDelta;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+public class DeltaTestITCase extends AbstractTestITCase {
+
+ private void parse(final ContentType format) {
+ final ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().getEntitySetRequest(
+ client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").build());
+ req.setPrefer(client.newPreferences().trackChanges());
+
+ final ClientEntitySet customers = req.execute().getBody();
+ assertNotNull(customers);
+ assertNotNull(customers.getDeltaLink());
+
+ final ODataDeltaRequest deltaReq = client.getRetrieveRequestFactory().getDeltaRequest(customers.getDeltaLink());
+ deltaReq.setFormat(format);
+
+ final ClientDelta delta = deltaReq.execute().getBody();
+ assertNotNull(delta);
+
+ assertNotNull(delta.getDeltaLink());
+ assertTrue(delta.getDeltaLink().isAbsolute());
+ assertEquals(5, delta.getCount(), 0);
+
+ assertEquals(1, delta.getDeletedEntities().size());
+ assertTrue(delta.getDeletedEntities().get(0).getId().isAbsolute());
+ assertTrue(delta.getDeletedEntities().get(0).getId().toASCIIString().endsWith("Customers('ANTON')"));
+
+ assertEquals(1, delta.getAddedLinks().size());
+ assertTrue(delta.getAddedLinks().get(0).getSource().isAbsolute());
+ assertTrue(delta.getAddedLinks().get(0).getSource().toASCIIString().endsWith("Customers('BOTTM')"));
+ assertEquals("Orders", delta.getAddedLinks().get(0).getRelationship());
+
+ assertEquals(1, delta.getDeletedLinks().size());
+ assertTrue(delta.getDeletedLinks().get(0).getSource().isAbsolute());
+ assertTrue(delta.getDeletedLinks().get(0).getSource().toASCIIString().endsWith("Customers('ALFKI')"));
+ assertEquals("Orders", delta.getDeletedLinks().get(0).getRelationship());
+
+ assertEquals(2, delta.getEntities().size());
+ ClientProperty property = delta.getEntities().get(0).getProperty("ContactName");
+ assertNotNull(property);
+ assertTrue(property.hasPrimitiveValue());
+ property = delta.getEntities().get(1).getProperty("ShippingAddress");
+ assertNotNull(property);
+ assertTrue(property.hasComplexValue());
+ }
+
+ @Test
+ public void atomParse() {
+ parse(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonParse() {
+ parse(ContentType.JSON);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/DerivedTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/DerivedTypeTestITCase.java
new file mode 100644
index 0000000..2f470c3
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/DerivedTypeTestITCase.java
@@ -0,0 +1,150 @@
+/*
+ * 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.base;
+
+import static org.junit.Assert.assertEquals;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+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.ODataEntityCreateResponse;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientValuable;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+public class DerivedTypeTestITCase extends AbstractTestITCase {
+
+ private void read(final ContentType contentType) {
+ // 1. entity set
+ URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").
+ appendDerivedEntityTypeSegment("Microsoft.Test.OData.Services.ODataWCFService.Customer");
+ ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
+ req.setFormat(contentType);
+
+ for (ClientEntity customer : req.execute().getBody().getEntities()) {
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", customer.getTypeName().toString());
+ }
+
+ // 2. contained entity set
+ uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Accounts").appendKeySegment(101).
+ appendNavigationSegment("MyPaymentInstruments").
+ appendDerivedEntityTypeSegment("Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI");
+ req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ req.setFormat(contentType);
+
+ for (ClientEntity customer : req.execute().getBody().getEntities()) {
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI", customer.getTypeName().toString());
+ }
+ }
+
+ @Test
+ public void readfromAtom() {
+ read(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void readfromJSON() {
+ read(ContentType.JSON_FULL_METADATA);
+ }
+
+ private void createDelete(final ContentType conentType) {
+ final ClientEntity customer = client.getObjectFactory().
+ newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
+
+ customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("PersonID",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(976)));
+ customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("FirstName",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("Test")));
+ customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("LastName",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("Test")));
+
+ final ClientComplexValue homeAddress =
+ client.getObjectFactory().newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress");
+ homeAddress.add(client.getObjectFactory().newPrimitiveProperty("Street",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("V.le Gabriele D'Annunzio")));
+ homeAddress.add(client.getObjectFactory().newPrimitiveProperty("City",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("Pescara")));
+ homeAddress.add(client.getObjectFactory().newPrimitiveProperty("PostalCode",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("65127")));
+ homeAddress.add(client.getObjectFactory().newPrimitiveProperty("CompanyName",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("Tirasa")));
+ customer.getProperties().add(client.getObjectFactory().newComplexProperty("HomeAddress", homeAddress));
+
+ customer.getProperties().add(client.getObjectFactory().newCollectionProperty("Numbers",
+ client.getObjectFactory().newCollectionValue("Edm.String")));
+ customer.getProperties().add(client.getObjectFactory().newCollectionProperty("Emails",
+ client.getObjectFactory().newCollectionValue("Edm.String")));
+ customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("City",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("Pescara")));
+ final Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ dateTime.set(1977, 8, 8, 0, 0, 0);
+ customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Birthday",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build()));
+ customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("TimeBetweenLastTwoOrders",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build()));
+
+ final ODataEntityCreateRequest<ClientEntity> createReq = client.getCUDRequestFactory().
+ getEntityCreateRequest(
+ client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People").build(),
+ customer);
+ createReq.setFormat(conentType);
+
+ final ODataEntityCreateResponse<ClientEntity> createRes = createReq.execute();
+ assertEquals(201, createRes.getStatusCode());
+
+ final ODataEntityRequest<ClientEntity> fetchReq = client.getRetrieveRequestFactory().
+ getEntityRequest(client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").appendKeySegment(976).build());
+ fetchReq.setFormat(conentType);
+
+ final ClientEntity actual = fetchReq.execute().getBody();
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", actual.getTypeName().toString());
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress",
+ ((ClientValuable) actual.getProperty("HomeAddress")).getValue().getTypeName());
+
+ final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest(actual.getEditLink());
+ assertEquals(204, deleteReq.execute().getStatusCode());
+ }
+
+ @Test
+ public void createDeleteAsAtom() {
+ createDelete(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void createDeleteAsJSON() {
+ createDelete(ContentType.JSON_FULL_METADATA);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/EntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/EntityCreateTestITCase.java
new file mode 100644
index 0000000..868c154
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/EntityCreateTestITCase.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.fit.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.net.URI;
+import java.util.Calendar;
+
+import org.apache.commons.lang3.RandomUtils;
+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.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
+import org.apache.olingo.client.api.domain.ClientLink;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+public class EntityCreateTestITCase extends AbstractTestITCase {
+
+ @Test
+ public void atomCreateAndDelete() {
+ createAndDeleteOrder(testStaticServiceRootURL, ContentType.APPLICATION_ATOM_XML, 1000);
+ }
+
+ @Test
+ public void jsonCreateAndDelete() {
+ createAndDeleteOrder(testStaticServiceRootURL, ContentType.JSON, 1001);
+ createAndDeleteOrder(testStaticServiceRootURL, ContentType.JSON_NO_METADATA, 1001);
+ createAndDeleteOrder(testStaticServiceRootURL, ContentType.JSON_FULL_METADATA, 1001);
+ }
+
+ private void onContained(final ContentType contentType) {
+ final URI uri = getClient().newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Accounts").
+ appendKeySegment(101).appendNavigationSegment("MyPaymentInstruments").build();
+
+ // 1. read contained collection before any operation
+ ClientEntitySet instruments = getClient().getRetrieveRequestFactory().getEntitySetRequest(uri).execute().getBody();
+ assertNotNull(instruments);
+ final int sizeBefore = instruments.getCount();
+
+ // 2. instantiate an ODataEntity of the same type as the collection above
+ final ClientEntity instrument = getClient().getObjectFactory().
+ newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument"));
+
+ int id = RandomUtils.nextInt(101999, 105000);
+ instrument.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("PaymentInstrumentID",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id)));
+ instrument.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("FriendlyName",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("New one")));
+ instrument.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("CreatedDate",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).build()));
+
+ // 3. create it as contained entity
+ final ODataEntityCreateRequest<ClientEntity> req = getClient().getCUDRequestFactory().
+ getEntityCreateRequest(uri, instrument);
+ req.setFormat(contentType);
+
+ final ODataEntityCreateResponse<ClientEntity> res = req.execute();
+ assertEquals(201, res.getStatusCode());
+
+ // 4. verify that the contained collection effectively grew
+ instruments = getClient().getRetrieveRequestFactory().getEntitySetRequest(uri).execute().getBody();
+ assertNotNull(instruments);
+ final int sizeAfter = instruments.getCount();
+ assertEquals(sizeBefore + 1, sizeAfter);
+
+ // 5. remove the contained entity created above
+ final ODataDeleteResponse deleteRes = getClient().getCUDRequestFactory().
+ getDeleteRequest(getClient().newURIBuilder(uri.toASCIIString()).appendKeySegment(id).build()).execute();
+ assertEquals(204, deleteRes.getStatusCode());
+
+ // 6. verify that the contained collection effectively reduced
+ instruments = getClient().getRetrieveRequestFactory().getEntitySetRequest(uri).execute().getBody();
+ assertNotNull(instruments);
+ final int sizeEnd = instruments.getCount();
+ assertEquals(sizeBefore, sizeEnd);
+ }
+
+ @Test
+ public void atomOnContained() {
+ onContained(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonOnContained() {
+ onContained(ContentType.JSON);
+ }
+
+ private void deepInsert(final ContentType contentType, final int productId, final int productDetailId)
+ throws EdmPrimitiveTypeException {
+
+ final ClientEntity product = getClient().getObjectFactory().
+ newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Product"));
+ product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ProductID",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(productId)));
+ product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Name",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("Latte")));
+ product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("QuantityPerUnit",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("100g Bag")));
+ product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("UnitPrice",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildSingle(3.24f)));
+ product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("QuantityInStock",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(100)));
+ product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Discontinued",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildBoolean(false)));
+ product.getProperties().add(getClient().getObjectFactory().newEnumProperty("UserAccess",
+ getClient().getObjectFactory().
+ newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "Execute")));
+ product.getProperties().add(getClient().getObjectFactory().newEnumProperty("SkinColor",
+ getClient().getObjectFactory().
+ newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Blue")));
+ product.getProperties().add(getClient().getObjectFactory().newCollectionProperty("CoverColors",
+ getClient().getObjectFactory().
+ newCollectionValue("Microsoft.Test.OData.Services.ODataWCFService.Color")));
+ product.getProperty("CoverColors").getCollectionValue().add(getClient().getObjectFactory().
+ newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Green"));
+ product.getProperty("CoverColors").getCollectionValue().add(getClient().getObjectFactory().
+ newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Red"));
+
+ final ClientEntity detail = getClient().getObjectFactory().
+ newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.ProductDetail"));
+ detail.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ProductID",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(productId)));
+ detail.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ProductDetailID",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(productDetailId)));
+ detail.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ProductName",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("LatteHQ")));
+ detail.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Description",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("High-Quality Milk")));
+
+ final ClientEntitySet details = getClient().getObjectFactory().newEntitySet();
+ details.getEntities().add(detail);
+
+ final ClientInlineEntitySet inlineDetails = getClient().getObjectFactory().
+ newDeepInsertEntitySet("Details", details);
+ product.addLink(inlineDetails);
+
+ final ODataEntityCreateRequest<ClientEntity> req = getClient().getCUDRequestFactory().getEntityCreateRequest(
+ getClient().newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Products").build(), product);
+ req.setFormat(contentType);
+ final ODataEntityCreateResponse<ClientEntity> res = req.execute();
+ assertEquals(201, res.getStatusCode());
+
+ final ClientEntity createdProduct = res.getBody();
+ assertEquals(productId,
+ createdProduct.getProperty("ProductID").getPrimitiveValue().toCastValue(Integer.class), 0);
+
+ final ClientLink createdLink = createdProduct.getNavigationLink("Details");
+ assertNotNull(createdLink);
+
+ final ClientEntitySet createdProductDetails =
+ getClient().getRetrieveRequestFactory().getEntitySetRequest(createdLink.getLink()).execute().getBody();
+ assertNotNull(createdProductDetails);
+ assertEquals(productDetailId, createdProductDetails.getEntities().iterator().next().
+ getProperty("ProductDetailID").getPrimitiveValue().toCastValue(Integer.class), 0);
+ }
+
+ @Test
+ public void atomDeepInsert() throws EdmPrimitiveTypeException {
+ deepInsert(ContentType.APPLICATION_ATOM_XML, 10, 10);
+ }
+
+ @Test
+ public void jsonDeepInsert() throws EdmPrimitiveTypeException {
+ deepInsert(ContentType.JSON_FULL_METADATA, 11, 11);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/EntityRetrieveTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/EntityRetrieveTestITCase.java
new file mode 100644
index 0000000..2137dfb
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/EntityRetrieveTestITCase.java
@@ -0,0 +1,378 @@
+/*
+ * 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.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URI;
+import java.sql.Timestamp;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+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.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientInlineEntity;
+import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
+import org.apache.olingo.client.api.domain.ClientLink;
+import org.apache.olingo.client.api.domain.ClientLinkType;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This is the unit test class to check entity retrieve operations.
+ */
+public class EntityRetrieveTestITCase extends AbstractTestITCase {
+
+ private void withInlineEntity(final ODataClient client, final ContentType contentType) {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
+
+ final ODataEntityRequest<ClientEntity> req = client.getRetrieveRequestFactory().
+ getEntityRequest(uriBuilder.build());
+ req.setFormat(contentType);
+
+ final ODataRetrieveResponse<ClientEntity> res = req.execute();
+ final ClientEntity entity = res.getBody();
+
+ assertNotNull(entity);
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
+ assertTrue(entity.getProperty("Home").hasPrimitiveValue());
+ assertEquals("Edm.GeographyPoint", entity.getProperty("Home").getPrimitiveValue().getTypeName());
+
+ // In JSON with minimal metadata, links are not provided
+ if (contentType.isCompatible(ContentType.APPLICATION_ATOM_SVC)
+ || contentType.isCompatible(ContentType.APPLICATION_ATOM_XML)
+ || (contentType.isCompatible(ContentType.JSON)
+ && ContentType.VALUE_ODATA_METADATA_FULL
+ .equals(contentType.getParameter(ContentType.PARAMETER_ODATA_METADATA)))) {
+ assertEquals(testStaticServiceRootURL + "/Customers(1)", entity.getEditLink().toASCIIString());
+ assertEquals(3, entity.getNavigationLinks().size());
+
+ if (ContentType.APPLICATION_ATOM_XML == contentType) {
+ assertTrue(entity.getAssociationLinks().isEmpty());
+ // In JSON, association links for each $ref link will exist.
+ }
+
+ boolean found = false;
+
+ for (ClientLink link : entity.getNavigationLinks()) {
+ if (link instanceof ClientInlineEntity) {
+ final ClientEntity inline = ((ClientInlineEntity) link).getEntity();
+ assertNotNull(inline);
+
+ final List<? extends ClientProperty> 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);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void withInlineEntityFromAtom() {
+ withInlineEntity(client, ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void withInlineEntityFromFullJSON() {
+ withInlineEntity(client, ContentType.JSON_FULL_METADATA);
+ }
+
+ @Test
+ public void withInlineEntityFromJSON() {
+ withInlineEntity(edmClient, ContentType.JSON);
+ }
+
+ private void withInlineEntitySet(final ODataClient client, final ContentType contentType) {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customers").appendKeySegment(1).expand("Orders");
+
+ final ODataEntityRequest<ClientEntity> req = client.getRetrieveRequestFactory().
+ getEntityRequest(uriBuilder.build());
+ req.setFormat(contentType);
+
+ final ODataRetrieveResponse<ClientEntity> res = req.execute();
+ final ClientEntity entity = res.getBody();
+ assertNotNull(entity);
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
+
+ // In JSON with minimal metadata, links are not provided
+ if (contentType.equals(ContentType.APPLICATION_ATOM_XML) || contentType.equals(ContentType.JSON_FULL_METADATA)) {
+ boolean found = false;
+ for (ClientLink link : entity.getNavigationLinks()) {
+ if (link instanceof ClientInlineEntitySet) {
+ final ClientEntitySet inline = ((ClientInlineEntitySet) link).getEntitySet();
+ assertNotNull(inline);
+
+ found = true;
+ }
+ }
+ assertTrue(found);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void withInlineEntitySetFromAtom() {
+ withInlineEntitySet(client, ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void withInlineEntitySetFromFullJSON() {
+ withInlineEntitySet(client, ContentType.JSON_FULL_METADATA);
+ }
+
+ @Test
+ public void withInlineEntitySetFromJSON() {
+ withInlineEntitySet(edmClient, ContentType.JSON);
+ }
+
+ private void rawRequest(final ContentType contentType) {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").appendKeySegment(5);
+
+ final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
+ req.setFormat(contentType.toContentTypeString());
+
+ final ODataRawResponse res = req.execute();
+ assertNotNull(res);
+
+ final ResWrap<ClientEntitySet> entitySet = res.getBodyAs(ClientEntitySet.class);
+ assertNull(entitySet);
+
+ final ResWrap<ClientEntity> entity = res.getBodyAs(ClientEntity.class);
+ assertTrue(entity.getPayload().getId().toASCIIString().endsWith("/StaticService/V40/Static.svc/People(5)"));
+ }
+
+ @Test
+ public void rawRequestAsAtom() {
+ rawRequest(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void rawRequestAsJSON() {
+ // this needs to be full, otherwise reference will not be provided
+ rawRequest(ContentType.JSON_FULL_METADATA);
+ }
+
+ private void multiKey(final ContentType contentType) throws EdmPrimitiveTypeException {
+ final LinkedHashMap<String, Object> multiKey = new LinkedHashMap<String, Object>();
+ multiKey.put("ProductID", "6");
+ multiKey.put("ProductDetailID", 1);
+
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("ProductDetails").appendKeySegment(multiKey);
+
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ req.setFormat(contentType);
+
+ final ODataRetrieveResponse<ClientEntity> res = req.execute();
+ final ClientEntity entity = res.getBody();
+ assertNotNull(entity);
+ assertEquals(Integer.valueOf(1),
+ entity.getProperty("ProductDetailID").getPrimitiveValue().toCastValue(Integer.class));
+ }
+
+ @Test
+ public void multiKeyAsAtom() throws EdmPrimitiveTypeException {
+ multiKey(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void multiKeyAsJSON() throws EdmPrimitiveTypeException {
+ multiKey(ContentType.JSON_FULL_METADATA);
+ }
+
+ private void checkForETag(final ODataClient client, final ContentType contentType) {
+ final URIBuilder uriBuilder =
+ client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders").appendKeySegment(8);
+
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ req.setFormat(contentType);
+
+ final ODataRetrieveResponse<ClientEntity> res = req.execute();
+ assertEquals(200, res.getStatusCode());
+
+ final String etag = res.getETag();
+ assertTrue(StringUtils.isNotBlank(etag));
+
+ final ClientEntity order = res.getBody();
+ assertEquals(etag, order.getETag());
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Order", order.getTypeName().toString());
+ assertEquals("Edm.Int32", order.getProperty("OrderID").getPrimitiveValue().getTypeName());
+ assertEquals("Edm.DateTimeOffset", order.getProperty("OrderDate").getPrimitiveValue().getTypeName());
+ assertEquals("Edm.Duration", order.getProperty("ShelfLife").getPrimitiveValue().getTypeName());
+ assertEquals("Collection(Edm.Duration)", order.getProperty("OrderShelfLifes").getCollectionValue().getTypeName());
+ }
+
+ @Test
+ public void checkForETagAsAtom() {
+ checkForETag(client, ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void checkForETagAsFullJSON() {
+ checkForETag(client, ContentType.JSON_FULL_METADATA);
+ }
+
+ @Test
+ public void checkForETagAsJSON() {
+ checkForETag(edmClient, ContentType.JSON);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void issue99() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
+
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ req.setFormat(ContentType.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();
+ }
+
+ private void reference(final ContentType contentType) {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Orders").appendKeySegment(8).appendNavigationSegment("CustomerForOrder").
+ appendRefSegment();
+
+ ODataEntityRequest<ClientEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ req.setFormat(contentType);
+
+ ODataRetrieveResponse<ClientEntity> res = req.execute();
+ assertNotNull(res);
+
+ final ClientEntity entity = res.getBody();
+ assertNotNull(entity);
+ assertTrue(entity.getId().toASCIIString().endsWith("/StaticService/V40/Static.svc/Customers(PersonID=1)"));
+
+ final URI referenceURI = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntityIdSegment(entity.getId().toASCIIString()).build();
+
+ req = client.getRetrieveRequestFactory().getEntityRequest(referenceURI);
+ req.setFormat(contentType);
+
+ res = req.execute();
+ assertNotNull(res);
+ assertNotNull(res.getBody());
+ }
+
+ @Test
+ public void atomReference() {
+ reference(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonReference() {
+ reference(ContentType.JSON_FULL_METADATA);
+ }
+
+ private void contained(final ODataClient client, final ContentType contentType) throws EdmPrimitiveTypeException {
+ final URI uri = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Accounts").appendKeySegment(101).
+ appendNavigationSegment("MyPaymentInstruments").appendKeySegment(101902).build();
+ final ODataEntityRequest<ClientEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uri);
+ req.setFormat(contentType);
+
+ final ClientEntity contained = req.execute().getBody();
+ assertNotNull(contained);
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", contained.getTypeName().toString());
+ assertEquals(101902,
+ contained.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0);
+ assertEquals("Edm.DateTimeOffset", contained.getProperty("CreatedDate").getPrimitiveValue().getTypeName());
+ assertNotNull(contained.getProperty("CreatedDate").getPrimitiveValue().toCastValue(Timestamp.class));
+ }
+
+ @Test
+ public void containedFromAtom() throws EdmPrimitiveTypeException {
+ contained(client, ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void containedFromFullJSON() throws EdmPrimitiveTypeException {
+ contained(client, ContentType.JSON_FULL_METADATA);
+ }
+
+ @Test
+ public void containedFromJSON() throws EdmPrimitiveTypeException {
+ contained(edmClient, ContentType.JSON);
+ }
+
+ private void entitySetNavigationLink(final ODataClient client, final ContentType contentType) {
+ final URI uri = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Accounts").appendKeySegment(101).build();
+ final ODataEntityRequest<ClientEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uri);
+ req.setFormat(contentType);
+
+ final ClientEntity entity = req.execute().getBody();
+ assertNotNull(entity);
+
+ // With JSON, entity set navigation links are only recognizable via Edm
+ if (contentType.equals(ContentType.APPLICATION_ATOM_XML) || client instanceof EdmEnabledODataClient) {
+ assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("MyPaymentInstruments").getType());
+ assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("ActiveSubscriptions").getType());
+ }
+ }
+
+ @Test
+ public void entitySetNavigationLinkFromAtom() {
+ entitySetNavigationLink(client, ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void entitySetNavigationLinkFromJSON() {
+ // only JSON_FULL_METADATA has links, only Edm can recognize entity set navigation
+ entitySetNavigationLink(edmClient, ContentType.JSON_FULL_METADATA);
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/EntitySetTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/EntitySetTestITCase.java
new file mode 100644
index 0000000..f3e784a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/EntitySetTestITCase.java
@@ -0,0 +1,178 @@
+/*
+ * 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.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.apache.olingo.client.api.ODataClient;
+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.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.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientEntitySetIterator;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+/**
+ * This is the unit test class to check basic feed operations.
+ */
+public class EntitySetTestITCase extends AbstractTestITCase {
+
+ private void rawRequest(final ContentType contentType) {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People");
+
+ final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
+ req.setFormat(contentType.toContentTypeString());
+
+ final ODataRawResponse res = req.execute();
+ assertNotNull(res);
+
+ final ResWrap<ClientEntitySet> entitySet = res.getBodyAs(ClientEntitySet.class);
+ assertNotNull(entitySet.getPayload());
+ assertTrue(entitySet.getContextURL().toASCIIString().endsWith("$metadata#People"));
+ }
+
+ @Test
+ public void rawRequestAsAtom() throws IOException {
+ rawRequest(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void rawRequestAsJSON() throws IOException {
+ rawRequest(ContentType.JSON);
+ }
+
+ private void readWithInlineCount(final ODataClient client, final ContentType contentType) {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").count(true);
+
+ final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
+ req.setFormat(contentType.toContentTypeString());
+
+ final ODataRawResponse res = req.execute();
+ assertNotNull(res);
+
+ final ResWrap<ClientEntitySet> entitySet = res.getBodyAs(ClientEntitySet.class);
+ assertEquals(5, entitySet.getPayload().getEntities().size());
+
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Address",
+ entitySet.getPayload().getEntities().get(2).getProperty("HomeAddress").getComplexValue().getTypeName());
+ }
+
+ @Test
+ public void readWithInlineCountAsJSON() throws IOException {
+ readWithInlineCount(edmClient, ContentType.JSON);
+ }
+
+ @Test
+ public void readWithInlineCountAsFullJSON() throws IOException {
+ readWithInlineCount(client, ContentType.JSON_FULL_METADATA);
+ }
+
+ @Test
+ public void readWithInlineCountAsAtom() throws IOException {
+ readWithInlineCount(client, ContentType.APPLICATION_ATOM_XML);
+ }
+
+ private void readODataEntitySetIterator(final ContentType contentType) {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People");
+
+ final ODataEntitySetIteratorRequest<ClientEntitySet, ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build());
+ req.setFormat(contentType);
+
+ final ODataRetrieveResponse<ClientEntitySetIterator<ClientEntitySet, ClientEntity>> res = req.execute();
+ final ClientEntitySetIterator<ClientEntitySet, ClientEntity> feedIterator = res.getBody();
+
+ assertNotNull(feedIterator);
+
+ int count = 0;
+
+ while (feedIterator.hasNext()) {
+ assertNotNull(feedIterator.next());
+ count++;
+ }
+ assertEquals(5, count);
+ assertTrue(feedIterator.getNext().toASCIIString().endsWith("People?$skiptoken=5"));
+ }
+
+ @Test
+ public void readODataEntitySetIteratorFromAtom() {
+ readODataEntitySetIterator(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void readODataEntitySetIteratorFromJSON() {
+ readODataEntitySetIterator(ContentType.JSON);
+ }
+
+ @Test
+ public void readODataEntitySetIteratorFromJSONFull() {
+ readODataEntitySetIterator(ContentType.JSON_FULL_METADATA);
+ }
+
+ @Test
+ public void readODataEntitySetIteratorFromJSONNo() {
+ readODataEntitySetIterator(ContentType.JSON_NO_METADATA);
+ }
+
+ private void readWithNext(final ContentType format) {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People");
+
+ final ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
+ req.setFormat(format);
+ req.setPrefer(client.newPreferences().maxPageSize(5));
+
+ final ODataRetrieveResponse<ClientEntitySet> res = req.execute();
+ final ClientEntitySet feed = res.getBody();
+
+ assertNotNull(feed);
+
+ assertEquals(5, feed.getEntities().size());
+ assertNotNull(feed.getNext());
+
+ final URI expected = URI.create(testStaticServiceRootURL + "/People?$skiptoken=5");
+ final URI found = URIUtils.getURI(testStaticServiceRootURL, feed.getNext().toASCIIString());
+
+ assertEquals(expected, found);
+ }
+
+ @Test
+ public void readWithNextFromAtom() {
+ readWithNext(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void readWithNextFromJSON() {
+ readWithNext(ContentType.JSON_FULL_METADATA);
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/EntityUpdateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/EntityUpdateTestITCase.java
new file mode 100644
index 0000000..aa2bc06
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/EntityUpdateTestITCase.java
@@ -0,0 +1,185 @@
+/*
+ * 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.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.TimeZone;
+import java.util.UUID;
+
+import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
+import org.apache.olingo.client.api.communication.request.cud.ODataReferenceAddingRequest;
+import org.apache.olingo.client.api.communication.request.cud.UpdateType;
+import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
+import org.apache.olingo.client.api.communication.response.ODataReferenceAddingResponse;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientLink;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class EntityUpdateTestITCase extends AbstractTestITCase {
+
+ private void upsert(final UpdateType updateType, final ContentType contentType) {
+ final ClientEntity order = getClient().getObjectFactory().
+ newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order"));
+
+ order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderID",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(9)));
+ order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderDate",
+ getClient().getObjectFactory().newPrimitiveValueBuilder()
+ .setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(
+ Calendar.getInstance(TimeZone.getTimeZone("GMT"))).build()));
+ order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ShelfLife",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build()));
+
+ final URI upsertURI = getClient().newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Orders").appendKeySegment(9).build();
+ final ODataEntityUpdateRequest<ClientEntity> req = getClient().getCUDRequestFactory().
+ getEntityUpdateRequest(upsertURI, updateType, order);
+ req.setFormat(contentType);
+
+ req.execute();
+ try {
+ final ClientEntity read = read(contentType, upsertURI);
+ assertNotNull(read);
+ assertEquals(order.getProperty("OrderID"), read.getProperty("OrderID"));
+ assertEquals(order.getProperty("OrderDate").getPrimitiveValue().toString(),
+ read.getProperty("OrderDate").getPrimitiveValue().toString());
+ assertEquals(order.getProperty("ShelfLife").getPrimitiveValue().toString(),
+ read.getProperty("ShelfLife").getPrimitiveValue().toString());
+ } finally {
+ getClient().getCUDRequestFactory().getDeleteRequest(upsertURI).execute();
+ }
+ }
+
+ @Test
+ @Ignore
+ public void testUpateSingleValuedNavtiogationReference() throws Exception {
+ URI targetURI =
+ getClient().newURIBuilder(testStaticServiceRootURL)
+ .appendEntitySetSegment("People")
+ .appendKeySegment(1)
+ .appendNavigationSegment("Parent")
+ .build();
+
+ URI reference = getClient().newURIBuilder(testStaticServiceRootURL)
+ .appendEntitySetSegment("People")
+ .appendKeySegment(0)
+ .build();
+
+ final ODataReferenceAddingRequest request =
+ getClient().getCUDRequestFactory().getReferenceSingleChangeRequest(new URI(testStaticServiceRootURL),
+ targetURI, reference);
+
+ final ODataReferenceAddingResponse response = request.execute();
+
+ assertEquals(204, response.getStatusCode());
+ }
+
+ @Test
+ public void atomUpsert() {
+ upsert(UpdateType.PATCH, ContentType.APPLICATION_ATOM_XML);
+ upsert(UpdateType.REPLACE, ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonUpsert() {
+ upsert(UpdateType.PATCH, ContentType.JSON);
+ upsert(UpdateType.REPLACE, ContentType.JSON);
+ }
+
+ private void onContained(final ContentType contentType) {
+ final String newName = UUID.randomUUID().toString();
+ final ClientEntity changes = getClient().getObjectFactory().newEntity(
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument"));
+ changes.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("FriendlyName",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildString(newName)));
+
+ final URI uri = getClient().newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Accounts").appendKeySegment(101).
+ appendNavigationSegment("MyPaymentInstruments").appendKeySegment(101901).build();
+ final ODataEntityUpdateRequest<ClientEntity> req = getClient().getCUDRequestFactory().
+ getEntityUpdateRequest(uri, UpdateType.PATCH, changes);
+ req.setFormat(contentType);
+
+ final ODataEntityUpdateResponse<ClientEntity> res = req.execute();
+ assertEquals(204, res.getStatusCode());
+
+ final ClientEntity actual = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody();
+ assertNotNull(actual);
+ assertEquals(newName, actual.getProperty("FriendlyName").getPrimitiveValue().toString());
+ }
+
+ @Test
+ public void atomOnContained() {
+ onContained(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonOnContained() {
+ onContained(ContentType.JSON);
+ }
+
+ private void bindOperation(final ContentType contentType) throws EdmPrimitiveTypeException {
+ final ClientEntity changes = getClient().getObjectFactory().newEntity(
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
+ final ClientLink parent = getClient().getObjectFactory().newEntityNavigationLink("Parent",
+ getClient().newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").appendKeySegment(1).build());
+ changes.getNavigationLinks().add(parent);
+
+ final URI uri = getClient().newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").appendKeySegment(5).build();
+ final ODataEntityUpdateRequest<ClientEntity> req = getClient().getCUDRequestFactory().
+ getEntityUpdateRequest(uri, UpdateType.PATCH, changes);
+ req.setFormat(contentType);
+
+ final ODataEntityUpdateResponse<ClientEntity> res = req.execute();
+ assertEquals(204, res.getStatusCode());
+
+ final ClientEntity updated = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody();
+ assertNotNull(updated);
+ final ClientLink updatedLink = updated.getNavigationLink("Parent");
+ assertNotNull(updatedLink);
+
+ final ClientEntity updatedEntity = getClient().getRetrieveRequestFactory().getEntityRequest(updatedLink.getLink()).
+ execute().getBody();
+ assertNotNull(updatedEntity);
+ assertEquals(1, updatedEntity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0);
+ }
+
+ @Test
+ public void atomBindOperation() throws EdmPrimitiveTypeException {
+ bindOperation(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonBindOperation() throws EdmPrimitiveTypeException {
+ bindOperation(ContentType.JSON);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/ErrorResponseTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/ErrorResponseTestITCase.java
new file mode 100644
index 0000000..d386bbe
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/ErrorResponseTestITCase.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.fit.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.apache.olingo.client.api.communication.ODataClientErrorException;
+import org.apache.olingo.commons.api.ex.ODataError;
+import org.apache.olingo.commons.api.ex.ODataErrorDetail;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+public class ErrorResponseTestITCase extends AbstractTestITCase {
+
+ @Test
+ public void jsonError() {
+ final URI readURI = getClient().newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customers").appendKeySegment(32).
+ build();
+
+ try {
+ read(ContentType.JSON, readURI);
+ fail("should have got exception");
+ } catch (Exception ex) {
+ final ODataError err = ((ODataClientErrorException) ex).getODataError();
+
+ // verify details
+ final ODataErrorDetail detail = err.getDetails().get(0);
+ assertEquals("Code should be correct", "301", detail.getCode());
+ assertEquals("Target should be correct", "$search", detail.getTarget());
+ assertEquals("Message should be correct", "$search query option not supported", detail.getMessage());
+
+ // verify inner error dictionary
+ final Map<String, String> innerErr = err.getInnerError();
+ assertEquals("innerError dictionary size should be correct", 2, innerErr.size());
+ assertEquals("innerError['context'] should be correct",
+ "{\"key1\":\"for debug deployment only\"}", innerErr.get("context"));
+ assertEquals("innerError['trace'] should be correct",
+ "[\"callmethod1 etc\",\"callmethod2 etc\"]", innerErr.get("trace"));
+ }
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/FilterFactoryTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/FilterFactoryTestITCase.java
new file mode 100644
index 0000000..ccf97a0
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/FilterFactoryTestITCase.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.fit.base;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.uri.FilterArgFactory;
+import org.apache.olingo.client.api.uri.FilterFactory;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.uri.URIFilter;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+public class FilterFactoryTestITCase extends AbstractTestITCase {
+
+ private FilterFactory getFilterFactory() {
+ return getClient().getFilterFactory();
+ }
+
+ private FilterArgFactory getFilterArgFactory() {
+ return getFilterFactory().getArgFactory();
+ }
+
+ @Test
+ public void crossjoin() {
+ final URIFilter filter = getFilterFactory().eq(
+ getFilterArgFactory().property("Orders/OrderID"), getFilterArgFactory().property("Customers/Order"));
+
+ final URIBuilder uriBuilder =
+ client.newURIBuilder(testStaticServiceRootURL).appendCrossjoinSegment("Customers", "Orders").filter(filter);
+
+ final ODataEntitySetRequest<ClientEntitySet> req =
+ client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ req.setFormat(ContentType.JSON_FULL_METADATA);
+
+ final ClientEntitySet feed = req.execute().getBody();
+ assertEquals(3, feed.getEntities().size());
+
+ for (ClientEntity entity : feed.getEntities()) {
+ assertEquals(2, entity.getNavigationLinks().size());
+ }
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/JSONFormatConformanceTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/JSONFormatConformanceTestITCase.java
new file mode 100644
index 0000000..4f8a779
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/JSONFormatConformanceTestITCase.java
@@ -0,0 +1,333 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.base;
+
+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.math.BigDecimal;
+import java.net.URI;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ClientAnnotation;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientLink;
+import org.apache.olingo.client.api.domain.ClientLinkType;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+/**
+ * The test cases in this class are inspired by client conformance criteria defined in the <a
+ * href="http://docs.oasis-open.org/odata/odata-json-format/v4.0/os/odata-json-format-v4.0-os.html#_Toc372793094">specs
+ * </a>.
+ */
+public class JSONFormatConformanceTestITCase extends AbstractTestITCase {
+
+ /**
+ * MUST either:
+ * <ol>
+ * <li>understand <tt>odata.metadata=minimal</tt> (section 3.1.1) or</li>
+ * <li>explicitly specify <tt>odata.metadata=none</tt>(section 3.1.3) or <tt>odata.metadata=full</tt> (section 3.1.2)
+ * in the request (client)</li>
+ * </ol>
+ * .
+ */
+ @Test
+ public void item1() throws EdmPrimitiveTypeException {
+ final URI uri = edmClient.newURIBuilder().
+ appendEntitySetSegment("Accounts").appendKeySegment(102).
+ appendNavigationSegment("MyPaymentInstruments").appendKeySegment(102902).build();
+ final ODataEntityRequest<ClientEntity> req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri);
+
+ // request format (via Accept header) is set to minimal by default
+ assertEquals("application/json;odata.metadata=minimal", req.getAccept());
+
+ final ODataRetrieveResponse<ClientEntity> res = req.execute();
+
+ // response is odata.metadata=minimal
+ assertFalse(res.getContentType().contains("odata.metadata=none"));
+ assertFalse(res.getContentType().contains("odata.metadata=full"));
+
+ // response payload is understood
+ final ClientEntity entity = res.getBody();
+ assertNotNull(entity);
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", entity.getTypeName().toString());
+ assertEquals(102902, entity.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0);
+ assertEquals("Edm.DateTimeOffset", entity.getProperty("CreatedDate").getPrimitiveValue().getTypeName());
+ }
+
+ /**
+ * MUST be prepared to consume a response with full metadata.
+ */
+ @Test
+ public void item2() {
+ final URI uri = edmClient.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Accounts").appendKeySegment(102).build();
+ final ODataEntityRequest<ClientEntity> req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri);
+ req.setFormat(ContentType.JSON_FULL_METADATA);
+
+ // request format (via Accept header) is set to full metadata
+ assertEquals("application/json;odata.metadata=full", req.getAccept());
+
+ final ODataRetrieveResponse<ClientEntity> res = req.execute();
+
+ // response is odata.metadata=full
+ assertTrue(res.getContentType().contains("odata.metadata=full"));
+
+ // response payload is understood (including links, only returned with full metadata)
+ final ClientEntity entity = res.getBody();
+ assertNotNull(entity);
+ assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("MyPaymentInstruments").getType());
+ assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("ActiveSubscriptions").getType());
+ }
+
+ /**
+ * MUST be prepared to receive all data types (section 7.1)
+ * <ol>
+ * <li>defined in this specification (client)</li>
+ * <li>exposed by the service (service)</li>
+ * </ol>
+ * .
+ */
+ @Test
+ public void item3() throws Exception {
+ final String fromSection71 = "{"
+ + "\"NullValue\": null,"
+ + "\"TrueValue\": true,"
+ + "\"FalseValue\": false,"
+ + "\"BinaryValue@odata.type\": \"Binary\","
+ + "\"BinaryValue\": \"T0RhdGE\","
+ + "\"IntegerValue\": -128,"
+ + "\"DoubleValue\": 3.1415926535897931,"
+ + "\"SingleValue@odata.type\": \"Single\","
+ + "\"SingleValue\": \"INF\","
+ + "\"DecimalValue@odata.type\": \"Decimal\","
+ + "\"DecimalValue\": 34.95,"
+ + "\"StringValue\": \"Say \\\"Hello\\\",\\nthen go\","
+ + "\"DateValue@odata.type\": \"Date\","
+ + "\"DateValue\": \"2012-12-03\","
+ + "\"DateTimeOffsetValue@odata.type\": \"DateTimeOffset\","
+ + "\"DateTimeOffsetValue\": \"2012-12-03T07:16:23Z\","
+ + "\"DurationValue@odata.type\": \"Duration\","
+ + "\"DurationValue\": \"P12DT23H59M59.999999999999S\","
+ + "\"TimeOfDayValue@odata.type\": \"TimeOfDay\","
+ + "\"TimeOfDayValue\": \"07:59:59.999\","
+ + "\"GuidValue@odata.type\": \"Guid\","
+ + "\"GuidValue\": \"01234567-89ab-cdef-0123-456789abcdef\","
+ + "\"Int64Value@odata.type\": \"Int64\","
+ + "\"Int64Value\": 0,"
+ + "\"ColorEnumValue@odata.type\": \"Test.Color\","
+ + "\"ColorEnumValue\": \"Yellow\","
+ + "\"GeographyPoint\": {\"type\": \"Point\",\"coordinates\":[142.1,64.1]}"
+ + "}";
+
+ final ClientEntity entity = client.getReader().readEntity(IOUtils.toInputStream(fromSection71), ContentType.JSON);
+
+ assertTrue(entity.getProperty("NullValue").hasNullValue());
+
+ assertEquals(EdmPrimitiveTypeKind.Boolean, entity.getProperty("TrueValue").getPrimitiveValue().getTypeKind());
+ assertEquals(Boolean.TRUE, entity.getProperty("TrueValue").getPrimitiveValue().toCastValue(Boolean.class));
+
+ assertEquals(EdmPrimitiveTypeKind.Boolean, entity.getProperty("FalseValue").getPrimitiveValue().getTypeKind());
+ assertEquals(Boolean.FALSE, entity.getProperty("FalseValue").getPrimitiveValue().toCastValue(Boolean.class));
+
+ assertEquals(EdmPrimitiveTypeKind.Binary, entity.getProperty("BinaryValue").getPrimitiveValue().getTypeKind());
+
+ assertEquals(EdmPrimitiveTypeKind.Int32, entity.getProperty("IntegerValue").getPrimitiveValue().getTypeKind());
+ assertEquals(-128, entity.getProperty("IntegerValue").getPrimitiveValue().toCastValue(Integer.class), 0);
+
+ assertEquals(EdmPrimitiveTypeKind.Double, entity.getProperty("DoubleValue").getPrimitiveValue().getTypeKind());
+ assertEquals(3.1415926535897931,
+ entity.getProperty("DoubleValue").getPrimitiveValue().toCastValue(Double.class), 0);
+
+ assertEquals(EdmPrimitiveTypeKind.Single, entity.getProperty("SingleValue").getPrimitiveValue().getTypeKind());
+ assertEquals(Float.POSITIVE_INFINITY,
+ entity.getProperty("SingleValue").getPrimitiveValue().toCastValue(Float.class), 0);
+
+ assertEquals(EdmPrimitiveTypeKind.Decimal, entity.getProperty("DecimalValue").getPrimitiveValue().getTypeKind());
+ assertEquals(BigDecimal.valueOf(34.95),
+ entity.getProperty("DecimalValue").getPrimitiveValue().toCastValue(BigDecimal.class));
+
+ assertEquals(EdmPrimitiveTypeKind.String, entity.getProperty("StringValue").getPrimitiveValue().getTypeKind());
+ assertEquals("Say \"Hello\",\nthen go",
+ entity.getProperty("StringValue").getPrimitiveValue().toCastValue(String.class));
+
+ assertEquals(EdmPrimitiveTypeKind.Date, entity.getProperty("DateValue").getPrimitiveValue().getTypeKind());
+
+ assertEquals(EdmPrimitiveTypeKind.DateTimeOffset,
+ entity.getProperty("DateTimeOffsetValue").getPrimitiveValue().getTypeKind());
+
+ assertEquals(EdmPrimitiveTypeKind.Duration, entity.getProperty("DurationValue").getPrimitiveValue().getTypeKind());
+
+ assertEquals(EdmPrimitiveTypeKind.TimeOfDay,
+ entity.getProperty("TimeOfDayValue").getPrimitiveValue().getTypeKind());
+
+ assertEquals(EdmPrimitiveTypeKind.Guid, entity.getProperty("GuidValue").getPrimitiveValue().getTypeKind());
+
+ assertEquals(EdmPrimitiveTypeKind.Int64, entity.getProperty("Int64Value").getPrimitiveValue().getTypeKind());
+
+ assertTrue(entity.getProperty("ColorEnumValue").hasEnumValue());
+
+ assertEquals(EdmPrimitiveTypeKind.GeographyPoint,
+ entity.getProperty("GeographyPoint").getPrimitiveValue().getTypeKind());
+ }
+
+ /**
+ * MUST interpret all odata annotations defined according to the OData-Version header of the payload (section 4.5).
+ */
+ @Test
+ public void item4() throws Exception {
+ final String fromSection45_1 = "{"
+ + "\"@odata.context\": \"http://host/service/$metadata#Customers/$entity\","
+ + "\"@odata.metadataEtag\": \"W/\\\"A1FF3E230954908F\\\"\","
+ + "\"@odata.etag\": \"W/\\\"A1FF3E230954908G\\\"\","
+ + "\"@odata.type\": \"#Model.VipCustomer\","
+ + "\"@odata.id\": \"http://host/service/Employees(PersonID=3)\","
+ + "\"@odata.editLink\": \"People(976)\","
+ + "\"@odata.mediaEditLink\": \"Employees(1)/$value\","
+ + "\"@odata.mediaContentType\": \"image/jpeg\","
+ + "\"@odata.mediaEtag\": \"W/\\\"A1FF3E230954908H\\\"\","
+ + "\"Parent@odata.navigationLink\": \"People(976)/Parent\","
+ + "\"Parent@odata.associationLink\": \"People(976)/Parent\""
+ + "}";
+
+ final ResWrap<Entity> entity =
+ client.getDeserializer(ContentType.JSON).toEntity(IOUtils.toInputStream(fromSection45_1));
+
+ assertEquals("http://host/service/$metadata#Customers/$entity", entity.getContextURL().toASCIIString());
+ assertEquals("W/\"A1FF3E230954908F\"", entity.getMetadataETag());
+ assertEquals("W/\"A1FF3E230954908G\"", entity.getPayload().getETag());
+ assertEquals("Model.VipCustomer", entity.getPayload().getType());
+ assertEquals("http://host/service/Employees(PersonID=3)", entity.getPayload().getId().toASCIIString());
+ assertEquals("People(976)", entity.getPayload().getEditLink().getHref());
+ assertEquals("Employees(1)/$value", entity.getPayload().getMediaContentSource().toASCIIString());
+ assertEquals("image/jpeg", entity.getPayload().getMediaContentType());
+ assertEquals("W/\"A1FF3E230954908H\"", entity.getPayload().getMediaETag());
+ assertEquals("People(976)/Parent", entity.getPayload().getNavigationLink("Parent").getHref());
+ assertEquals("People(976)/Parent", entity.getPayload().getAssociationLink("Parent").getHref());
+
+ final String fromSection45_2 = "{"
+ + " \"@odata.count\": 5,"
+ + " \"value\": [],"
+ + " \"@odata.nextLink\": \"Customers?$expand=Orders&$skipToken=5\","
+ + " \"@odata.deltaLink\": \"Customers?$expand=Orders&$deltatoken=8015\""
+ + "}";
+
+ final ResWrap<EntityCollection> entitySet =
+ client.getDeserializer(ContentType.JSON).toEntitySet(IOUtils.toInputStream(fromSection45_2));
+
+ assertEquals(5, entitySet.getPayload().getCount(), 0);
+ assertEquals("Customers?$expand=Orders&$skipToken=5", entitySet.getPayload().getNext().toASCIIString());
+ assertEquals("Customers?$expand=Orders&$deltatoken=8015", entitySet.getPayload().getDeltaLink().toASCIIString());
+ }
+
+ /**
+ * MUST be prepared to receive any annotations, including custom annotations and <tt>odata</tt> annotations not
+ * defined in the <tt>OData-Version</tt> header of the payload (section 20).
+ */
+ @Test
+ public void item5() throws Exception {
+ final String sample = "{"
+ + " \"@odata.context\": \"http://host/service/$metadata#Customers\","
+ + " \"@odata.notdefined\": 11,"
+ + " \"@com.contoso.customer.setkind\": \"VIPs\","
+ + " \"value\": ["
+ + " {"
+ + " \"@com.contoso.display.highlight\": true,"
+ + " \"ID\": \"ALFKI\","
+ + " \"CompanyName@com.contoso.display.style\": { \"title\": true, \"order\": 1 },"
+ + " \"CompanyName\": \"Alfreds Futterkiste\","
+ + " \"Orders@com.contoso.display.style\": { \"order\": 2 },"
+ + " \"Orders@odata.navigationLink\": \"People(976)/Orders\""
+ + " }"
+ + " ]"
+ + "}";
+
+ final ClientEntitySet entitySet = client.getReader().
+ readEntitySet(IOUtils.toInputStream(sample), ContentType.JSON);
+
+ assertEquals(2, entitySet.getAnnotations().size());
+
+ final ClientAnnotation notdefined = entitySet.getAnnotations().get(0);
+ assertEquals("odata.notdefined", notdefined.getTerm());
+ assertEquals(11, notdefined.getPrimitiveValue().toCastValue(Integer.class), 0);
+
+ final ClientAnnotation setkind = entitySet.getAnnotations().get(1);
+ assertEquals("com.contoso.customer.setkind", setkind.getTerm());
+ assertEquals("VIPs", setkind.getPrimitiveValue().toCastValue(String.class));
+
+ final ClientEntity entity = entitySet.getEntities().get(0);
+ assertEquals(1, entity.getAnnotations().size());
+
+ final ClientAnnotation highlight = entity.getAnnotations().get(0);
+ assertEquals("com.contoso.display.highlight", highlight.getTerm());
+ assertEquals(Boolean.TRUE, highlight.getPrimitiveValue().toCastValue(Boolean.class));
+
+ final ClientProperty property = entity.getProperty("CompanyName");
+ assertEquals(1, property.getAnnotations().size());
+
+ final ClientAnnotation style = property.getAnnotations().get(0);
+ assertEquals("com.contoso.display.style", style.getTerm());
+ assertTrue(style.hasComplexValue());
+ assertEquals(Boolean.TRUE, style.getComplexValue().get("title").getPrimitiveValue().toCastValue(Boolean.class));
+ assertEquals(1, style.getComplexValue().get("order").getPrimitiveValue().toCastValue(Integer.class), 0);
+
+ final ClientLink orders = entity.getNavigationLink("Orders");
+ assertEquals(1, orders.getAnnotations().size());
+
+ final ClientAnnotation style2 = orders.getAnnotations().get(0);
+ assertEquals("com.contoso.display.style", style2.getTerm());
+ assertTrue(style2.hasComplexValue());
+ assertEquals(2, style2.getComplexValue().get("order").getPrimitiveValue().toCastValue(Integer.class), 0);
+ }
+
+ /**
+ * MUST NOT require <tt>odata.streaming=true</tt> in the <tt>Content-Type</tt> header (section 4.4).
+ */
+ @Test
+ public void item6() throws EdmPrimitiveTypeException {
+ final URI uri = edmClient.newURIBuilder().
+ appendEntitySetSegment("Accounts").appendKeySegment(102).
+ appendNavigationSegment("MyPaymentInstruments").appendKeySegment(102902).build();
+ final ODataEntityRequest<ClientEntity> req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri);
+
+ // request format (via Accept header) does not contain odata.streaming=true
+ assertEquals("application/json;odata.metadata=minimal", req.getAccept());
+
+ final ODataRetrieveResponse<ClientEntity> res = req.execute();
+
+ // response payload is understood
+ final ClientEntity entity = res.getBody();
+ assertNotNull(entity);
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", entity.getTypeName().toString());
+ assertEquals(102902, entity.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0);
+ assertEquals("Edm.DateTimeOffset", entity.getProperty("CreatedDate").getPrimitiveValue().getTypeName());
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/KeyAsSegmentTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/KeyAsSegmentTestITCase.java
new file mode 100644
index 0000000..3670292
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/KeyAsSegmentTestITCase.java
@@ -0,0 +1,127 @@
+/*
+ * 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.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import java.net.URI;
+
+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.ODataEntityUpdateResponse;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class KeyAsSegmentTestITCase extends AbstractTestITCase {
+
+ @BeforeClass
+ public static void enableKeyAsSegment() {
+ client.getConfiguration().setKeyAsSegment(true);
+ }
+
+ @AfterClass
+ public static void disableKeyAsSegment() {
+ client.getConfiguration().setKeyAsSegment(false);
+ }
+
+ private void read(final ContentType contentType) {
+ final URIBuilder uriBuilder = client.newURIBuilder(testKeyAsSegmentServiceRootURL).
+ appendEntitySetSegment("Accounts").appendKeySegment(101);
+
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ req.setFormat(contentType);
+
+ final ODataRetrieveResponse<ClientEntity> res = req.execute();
+ final ClientEntity entity = res.getBody();
+ assertNotNull(entity);
+
+ // In JSON with minimal metadata, links are not provided
+ if (contentType.equals(ContentType.APPLICATION_ATOM_XML) || contentType.equals(ContentType.JSON_FULL_METADATA)) {
+ assertFalse(entity.getEditLink().toASCIIString().contains("("));
+ assertFalse(entity.getEditLink().toASCIIString().contains(")"));
+ }
+ }
+
+ @Test
+ public void atomRead() {
+ read(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonRead() {
+ read(ContentType.JSON);
+ }
+
+ @Test
+ public void atomCreateAndDelete() {
+ createAndDeleteOrder(testKeyAsSegmentServiceRootURL, ContentType.APPLICATION_ATOM_XML, 1000);
+ }
+
+ @Test
+ public void jsonCreateAndDelete() {
+ createAndDeleteOrder(testKeyAsSegmentServiceRootURL, ContentType.JSON_FULL_METADATA, 1001);
+ }
+
+ private void update(final ContentType contentType) {
+ final ClientEntity changes = getClient().getObjectFactory().newEntity(
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
+ final ClientProperty middleName = getClient().getObjectFactory().newPrimitiveProperty("MiddleName",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("middle"));
+ changes.getProperties().add(middleName);
+
+ final URI uri = getClient().newURIBuilder(testKeyAsSegmentServiceRootURL).
+ appendEntitySetSegment("People").appendKeySegment(5).build();
+ final ODataEntityUpdateRequest<ClientEntity> req = getClient().getCUDRequestFactory().
+ getEntityUpdateRequest(uri, UpdateType.PATCH, changes);
+ req.setFormat(contentType);
+
+ final ODataEntityUpdateResponse<ClientEntity> res = req.execute();
+ assertEquals(204, res.getStatusCode());
+
+ final ClientEntity updated = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody();
+ assertNotNull(updated);
+ assertFalse(updated.getEditLink().toASCIIString().contains("("));
+ assertFalse(updated.getEditLink().toASCIIString().contains(")"));
+
+ final ClientProperty updatedMiddleName = updated.getProperty("MiddleName");
+ assertNotNull(updatedMiddleName);
+ assertEquals("middle", updatedMiddleName.getPrimitiveValue().toString());
+ }
+
+ @Test
+ public void atomUpdate() {
+ update(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonUpdate() {
+ update(ContentType.JSON);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/MediaEntityTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/MediaEntityTestITCase.java
new file mode 100644
index 0000000..84de7eb
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/MediaEntityTestITCase.java
@@ -0,0 +1,183 @@
+/*
+ * 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.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.UUID;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.olingo.client.api.ODataClient;
+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.request.retrieve.ODataMediaRequest;
+import org.apache.olingo.client.api.communication.request.streamed.MediaEntityCreateStreamManager;
+import org.apache.olingo.client.api.communication.request.streamed.MediaEntityUpdateStreamManager;
+import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest;
+import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest;
+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.ODataMediaEntityUpdateResponse;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientValuable;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+public class MediaEntityTestITCase extends AbstractTestITCase {
+
+ private void read(final ODataClient client, final ContentType contentType) throws IOException {
+ final URIBuilder builder = client.newURIBuilder(testDemoServiceRootURL).
+ appendEntitySetSegment("Advertisements").
+ appendKeySegment(UUID.fromString("f89dee73-af9f-4cd4-b330-db93c25ff3c7"));
+ final ODataEntityRequest<ClientEntity> entityReq =
+ client.getRetrieveRequestFactory().getEntityRequest(builder.build());
+ entityReq.setFormat(contentType);
+
+ final ClientEntity entity = entityReq.execute().getBody();
+ assertNotNull(entity);
+ assertTrue(entity.isMediaEntity());
+ // cast to workaround JDK 6 bug, fixed in JDK 7
+ assertEquals(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName().toString(),
+ ((ClientValuable) entity.getProperty("AirDate")).getValue().getTypeName());
+
+ final ODataMediaRequest streamReq = client.getRetrieveRequestFactory().
+ getMediaRequest(entity.getMediaContentSource());
+ final ODataRetrieveResponse<InputStream> streamRes = streamReq.execute();
+ assertEquals(200, streamRes.getStatusCode());
+
+ final byte[] actual = new byte[Integer.parseInt(streamRes.getHeader("Content-Length").iterator().next())];
+ IOUtils.read(streamRes.getBody(), actual, 0, actual.length);
+ }
+
+ @Test
+ public void readAsAtom() throws IOException {
+ read(client, ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void readAsJSON() throws IOException {
+ read(ODataClientFactory.getEdmEnabledClient(testDemoServiceRootURL, ContentType.JSON), ContentType.JSON);
+ }
+
+ @Test
+ public void readAsJSONFull() throws IOException {
+ read(client, ContentType.JSON_FULL_METADATA);
+ }
+
+ private void create(final ContentType contentType) throws IOException {
+ final String random = RandomStringUtils.random(110);
+ final InputStream input = IOUtils.toInputStream(random);
+
+ final URI uri = client.newURIBuilder(testDemoServiceRootURL).appendEntitySetSegment("Advertisements").build();
+ final ODataMediaEntityCreateRequest<ClientEntity> createReq =
+ client.getCUDRequestFactory().getMediaEntityCreateRequest(uri, input);
+ final MediaEntityCreateStreamManager<ClientEntity> streamManager = createReq.payloadManager();
+
+ final ODataMediaEntityCreateResponse<ClientEntity> createRes = streamManager.getResponse();
+ assertEquals(201, createRes.getStatusCode());
+
+ final Collection<String> location = createRes.getHeader(HttpHeader.LOCATION);
+ assertNotNull(location);
+ final URI createdLocation = URI.create(location.iterator().next());
+
+ final ClientEntity changes = client.getObjectFactory().
+ newEntity(new FullQualifiedName("ODataDemo.Advertisement"));
+ changes.getProperties().add(client.getObjectFactory().newPrimitiveProperty("AirDate",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).build()));
+
+ final ODataEntityUpdateRequest<ClientEntity> updateReq = getClient().getCUDRequestFactory().
+ getEntityUpdateRequest(createdLocation, UpdateType.PATCH, changes);
+ updateReq.setFormat(contentType);
+
+ final ODataEntityUpdateResponse<ClientEntity> updateRes = updateReq.execute();
+ assertEquals(204, updateRes.getStatusCode());
+
+ final ODataMediaRequest retrieveReq = client.getRetrieveRequestFactory().
+ getMediaEntityRequest(client.newURIBuilder(createdLocation.toASCIIString()).build());
+ final ODataRetrieveResponse<InputStream> retrieveRes = retrieveReq.execute();
+ assertEquals(200, retrieveRes.getStatusCode());
+
+ final byte[] actual = new byte[Integer.parseInt(retrieveRes.getHeader("Content-Length").iterator().next())];
+ IOUtils.read(retrieveRes.getBody(), actual, 0, actual.length);
+ assertEquals(random, new String(actual));
+ }
+
+ @Test
+ public void createAsAtom() throws IOException {
+ create(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void createAsJSON() throws IOException {
+ create(ContentType.JSON);
+ }
+
+ private void update(final ContentType contentType) throws IOException, EdmPrimitiveTypeException {
+ final URI uri = client.newURIBuilder(testDemoServiceRootURL).
+ appendEntitySetSegment("Advertisements").
+ appendKeySegment(UUID.fromString("f89dee73-af9f-4cd4-b330-db93c25ff3c7")).build();
+
+ final String random = RandomStringUtils.random(124);
+
+ // 1. update providing media content
+ final ODataMediaEntityUpdateRequest<ClientEntity> updateReq = client.getCUDRequestFactory().
+ getMediaEntityUpdateRequest(uri, IOUtils.toInputStream(random));
+ updateReq.setFormat(contentType);
+
+ final MediaEntityUpdateStreamManager<ClientEntity> streamManager = updateReq.payloadManager();
+ final ODataMediaEntityUpdateResponse<ClientEntity> createRes = streamManager.getResponse();
+ assertEquals(204, createRes.getStatusCode());
+
+ // 2. check that media content was effectively uploaded
+ final ODataMediaRequest streamReq = client.getRetrieveRequestFactory().getMediaEntityRequest(uri);
+ final ODataRetrieveResponse<InputStream> streamRes = streamReq.execute();
+ assertEquals(200, streamRes.getStatusCode());
+
+ final byte[] actual = new byte[Integer.parseInt(streamRes.getHeader("Content-Length").iterator().next())];
+ IOUtils.read(streamRes.getBody(), actual, 0, actual.length);
+ assertEquals(random, new String(actual));
+ }
+
+ @Test
+ public void updateAsAtom() throws IOException, EdmPrimitiveTypeException {
+ update(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void updateAsJSON() throws IOException, EdmPrimitiveTypeException {
+ update(ContentType.JSON);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/MetadataTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/MetadataTestITCase.java
new file mode 100644
index 0000000..62906c8
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/MetadataTestITCase.java
@@ -0,0 +1,146 @@
+/*
+ * 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.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+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.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.annotation.EdmRecord;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmBoolean;
+import org.junit.Test;
+
+public class MetadataTestITCase extends AbstractTestITCase {
+
+ @Test
+ public void retrieve() throws EdmPrimitiveTypeException {
+ final Edm edm = client.getRetrieveRequestFactory().getMetadataRequest(testStaticServiceRootURL).execute().getBody();
+ assertNotNull(edm);
+
+ final EdmEntityType order = edm.getEntityType(
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService", "Order"));
+ assertNotNull(order);
+
+ final EdmProperty orderDate = order.getStructuralProperty("OrderDate");
+ assertNotNull(orderDate);
+ assertEquals("Edm.DateTimeOffset", orderDate.getType().getFullQualifiedName().toString());
+
+ final EdmTerm isBoss = edm.getTerm(new FullQualifiedName(edm.getSchemas().get(0).getNamespace(), "IsBoss"));
+ assertNotNull(isBoss);
+ assertEquals(EdmBoolean.getInstance(), isBoss.getType());
+
+ final EdmEntitySet orders = edm.getSchemas().get(0).getEntityContainer().getEntitySet("Orders");
+ assertNotNull(orders);
+ assertFalse(orders.getAnnotations().isEmpty());
+ assertTrue(orders.getAnnotations().get(0).getExpression().isDynamic());
+ assertTrue(orders.getAnnotations().get(0).getExpression().asDynamic().isRecord());
+ final EdmRecord record = orders.getAnnotations().get(0).getExpression().asDynamic().asRecord();
+ assertNotNull(record);
+ assertEquals(3, record.getPropertyValues().size());
+ assertTrue(record.getPropertyValues().get(0).getValue().isConstant());
+ assertTrue((Boolean) record.getPropertyValues().get(0).getValue().asConstant().getValue().asPrimitive());
+ assertTrue(record.getPropertyValues().get(1).getValue().asDynamic().isCollection());
+ assertEquals(1, record.getPropertyValues().get(1).getValue().asDynamic().asCollection().getItems().size());
+ assertTrue(record.getPropertyValues().get(1).getValue().asDynamic().asCollection().getItems().get(0).isDynamic());
+ assertEquals("OrderID", record.getPropertyValues().get(1).getValue().asDynamic().asCollection().
+ getItems().get(0).asDynamic().asPropertyPath().getValue());
+ }
+
+ @Test
+ public void include() {
+ final Edm edm = client.getRetrieveRequestFactory().getMetadataRequest(testNorthwindRootURL).execute().getBody();
+ assertNotNull(edm);
+
+ final EdmEntityContainer container = edm.getEntityContainer(
+ new FullQualifiedName("ODataWebExperimental.Northwind.Model", "NorthwindEntities"));
+ assertNotNull(container);
+
+ final EdmEntitySet categories = container.getEntitySet("Categories");
+ assertNotNull(categories);
+ assertEquals("NorthwindModel", categories.getEntityType().getNamespace());
+ }
+
+ @Test
+ public void vocabularies() {
+ final Edm edm = client.getRetrieveRequestFactory().
+ getMetadataRequest(testVocabulariesServiceRootURL).execute().getBody();
+ assertNotNull(edm);
+
+ // 1. core
+ final EdmSchema core = edm.getSchema("Org.OData.Core.V1");
+ assertNotNull(core);
+ final EdmSchema coreAlias = edm.getSchema("Core");
+ assertEquals(core, coreAlias);
+
+ final EdmTerm descriptionTerm = edm.getTerm(new FullQualifiedName("Core.Description"));
+ assertNotNull(descriptionTerm);
+ assertEquals(descriptionTerm.getFullQualifiedName(),
+ edm.getTerm(new FullQualifiedName("Org.OData.Core.V1.Description")).getFullQualifiedName());
+
+ final EdmAnnotation description = core.getAnnotation(descriptionTerm);
+ assertNotNull(description);
+ // assertEquals("Core terms needed to write vocabularies",
+ // description.getExpression().asConstant().getValue().asPrimitive().getName());
+ assertEquals("Core terms needed to write vocabularies",
+ description.getExpression().asConstant().getValueAsString());
+
+ final EdmTerm isLanguageDependent = edm.getTerm(new FullQualifiedName("Core.IsLanguageDependent"));
+ assertNotNull(isLanguageDependent);
+ assertTrue(isLanguageDependent.getAppliesTo().contains(EdmProperty.class));
+ assertTrue(isLanguageDependent.getAppliesTo().contains(EdmTerm.class));
+ assertEquals(edm.getTypeDefinition(new FullQualifiedName("Core.Tag")), isLanguageDependent.getType());
+ assertEquals(EdmBoolean.getInstance(), ((EdmTypeDefinition) isLanguageDependent.getType()).getUnderlyingType());
+ assertNotNull(isLanguageDependent.getAnnotation(descriptionTerm));
+
+ final EdmTerm permissions = edm.getTerm(new FullQualifiedName("Core.Permissions"));
+ assertNotNull(permissions);
+ assertTrue(permissions.getType() instanceof EdmEnumType);
+
+ // 2. measures
+ final EdmSchema measures = edm.getSchema("UoM");
+ assertNotNull(measures);
+
+ final EdmTerm scale = edm.getTerm(new FullQualifiedName("UoM.Scale"));
+ assertNotNull(scale);
+
+ final EdmAnnotation requiresTypeInScale = edm.getAnnotation(
+ scale.getFullQualifiedName(), edm.getTerm(new FullQualifiedName("Core.RequiresType")));
+ assertNotNull(requiresTypeInScale);
+ assertEquals("Edm.Decimal", requiresTypeInScale.getExpression().asConstant().getValueAsString());
+
+ // 3. capabilities
+ final EdmTerm deleteRestrictions = edm.getTerm(new FullQualifiedName("Capabilities.DeleteRestrictions"));
+ assertNotNull(deleteRestrictions);
+ assertEquals(deleteRestrictions.getType().getFullQualifiedName(),
+ edm.getComplexType(new FullQualifiedName("Capabilities.DeleteRestrictionsType")).getFullQualifiedName());
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/OAuth2TestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/OAuth2TestITCase.java
new file mode 100644
index 0000000..e5f2542
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/OAuth2TestITCase.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.fit.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URI;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.fit.CXFOAuth2HttpClientFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class OAuth2TestITCase extends AbstractTestITCase {
+
+ private static final URI OAUTH2_GRANT_SERVICE_URI =
+ URI.create("http://localhost:9080/stub/StaticService/oauth2/authorize");
+
+ private static final URI OAUTH2_TOKEN_SERVICE_URI =
+ URI.create("http://localhost:9080/stub/StaticService/oauth2/token");
+
+ private EdmEnabledODataClient _edmClient;
+
+ @BeforeClass
+ public static void enableOAuth2() {
+ client.getConfiguration().setHttpClientFactory(
+ new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI));
+ }
+
+ @AfterClass
+ public static void disableOAuth2() {
+ client.getConfiguration().setHttpClientFactory(new DefaultHttpClientFactory());
+ }
+
+ protected ODataClient getLocalClient() {
+ ODataClient localClient = ODataClientFactory.getClient();
+ localClient.getConfiguration().setHttpClientFactory(
+ new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI));
+ return localClient;
+ }
+
+ protected EdmEnabledODataClient getEdmClient() {
+ if (_edmClient == null) {
+ _edmClient = ODataClientFactory.getEdmEnabledClient(testOAuth2ServiceRootURL, ContentType.JSON);
+ _edmClient.getConfiguration().setHttpClientFactory(
+ new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI));
+ }
+
+ return _edmClient;
+ }
+
+ private void read(final ODataClient client, final ContentType contentType) {
+ final URIBuilder uriBuilder =
+ client.newURIBuilder(testOAuth2ServiceRootURL).appendEntitySetSegment("Orders").appendKeySegment(8);
+
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ req.setFormat(contentType);
+
+ final ODataRetrieveResponse<ClientEntity> res = req.execute();
+ assertEquals(200, res.getStatusCode());
+
+ final String etag = res.getETag();
+ assertTrue(StringUtils.isNotBlank(etag));
+
+ final ClientEntity order = res.getBody();
+ assertEquals(etag, order.getETag());
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Order", order.getTypeName().toString());
+ assertEquals("Edm.Int32", order.getProperty("OrderID").getPrimitiveValue().getTypeName());
+ assertEquals("Edm.DateTimeOffset", order.getProperty("OrderDate").getPrimitiveValue().getTypeName());
+ assertEquals("Edm.Duration", order.getProperty("ShelfLife").getPrimitiveValue().getTypeName());
+ assertEquals("Collection(Edm.Duration)", order.getProperty("OrderShelfLifes").getCollectionValue().getTypeName());
+ }
+
+ @Test
+ public void testOAuth() {
+ try {
+ readAsAtom();
+ } catch (Exception e) {
+ System.out.println("failed for readAsAtom");
+ }
+
+ try {
+ readAsFullJSON();
+ } catch (Exception e) {
+ System.out.println("failed for readAsFullJSON");
+ }
+
+ try {
+ readAsJSON();
+ } catch (Exception e) {
+ System.out.println("failed for readAsJSON");
+ }
+
+ try {
+ createAndDelete();
+ } catch (Exception e) {
+ System.out.println("failed for createAndDelete");
+ }
+ }
+
+ public void readAsAtom() {
+ read(getLocalClient(), ContentType.APPLICATION_ATOM_XML);
+ }
+
+ public void readAsFullJSON() {
+ read(getLocalClient(), ContentType.JSON_FULL_METADATA);
+ }
+
+ public void readAsJSON() {
+ read(getEdmClient(), ContentType.JSON);
+ }
+
+ public void createAndDelete() {
+ createAndDeleteOrder(testOAuth2ServiceRootURL, ContentType.JSON, 1002);
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/OpenTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/OpenTypeTestITCase.java
new file mode 100644
index 0000000..e5f213b
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/OpenTypeTestITCase.java
@@ -0,0 +1,190 @@
+/*
+ * 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.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Calendar;
+import java.util.TimeZone;
+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.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+public class OpenTypeTestITCase extends AbstractTestITCase {
+
+ @Test
+ public void checkOpenTypeEntityTypesExist() {
+ final Edm metadata = getClient().getRetrieveRequestFactory().
+ getMetadataRequest(testOpenTypeServiceRootURL).execute().getBody();
+
+ final EdmSchema schema = metadata.getSchemas().get(0);
+
+ assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "Row")).isOpenType());
+ assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "IndexedRow")).isOpenType());
+ assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "RowIndex")).isOpenType());
+ }
+
+ private ClientEntity readRow(final ContentType contentType, final String uuid) {
+ final URIBuilder builder = getClient().newURIBuilder(testOpenTypeServiceRootURL).
+ appendEntitySetSegment("Row").appendKeySegment(UUID.fromString(uuid));
+ return read(contentType, builder.build());
+ }
+
+ private void read(final ContentType contentType) {
+ ClientEntity row = readRow(contentType, "71f7d0dc-ede4-45eb-b421-555a2aa1e58f");
+ assertEquals(EdmPrimitiveTypeKind.Double, row.getProperty("Double").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.Guid, row.getProperty("Id").getPrimitiveValue().getTypeKind());
+
+ row = readRow(contentType, "672b8250-1e6e-4785-80cf-b94b572e42b3");
+ assertEquals(EdmPrimitiveTypeKind.Decimal, row.getProperty("Decimal").getPrimitiveValue().getTypeKind());
+ }
+
+ @Test
+ public void readAsAtom() {
+ read(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void readAsJSON() {
+ read(ContentType.JSON_FULL_METADATA);
+ }
+
+ private void cud(final ContentType contentType) {
+ final Integer id = 1426;
+
+ ClientEntity rowIndex = getClient().getObjectFactory().newEntity(
+ new FullQualifiedName("Microsoft.Test.OData.Services.OpenTypesServiceV4.RowIndex"));
+ getClient().getBinder().add(rowIndex,
+ getClient().getObjectFactory().newPrimitiveProperty("Id",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id)));
+ getClient().getBinder().add(rowIndex,
+ getClient().getObjectFactory().newPrimitiveProperty("aString",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("string")));
+ getClient().getBinder().add(rowIndex,
+ getClient().getObjectFactory().newPrimitiveProperty("aBoolean",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildBoolean(true)));
+ getClient().getBinder().add(rowIndex,
+ getClient().getObjectFactory().newPrimitiveProperty("aDouble",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildDouble(1.5D)));
+ getClient().getBinder().add(rowIndex,
+ getClient().getObjectFactory().newPrimitiveProperty("aByte",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).
+ build()));
+ getClient().getBinder().add(rowIndex,
+ getClient().getObjectFactory().newPrimitiveProperty("aDate",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).
+ build()));
+ getClient().getBinder().add(rowIndex,
+ getClient().getObjectFactory().newPrimitiveProperty("aDate",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).
+ build()));
+ getClient().getBinder().add(rowIndex,
+ getClient().getObjectFactory().newEnumProperty("aColor", getClient().getObjectFactory().
+ newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Blue")));
+
+ final ClientComplexValue contactDetails = getClient().getObjectFactory().newComplexValue(
+ "Microsoft.Test.OData.Services.OpenTypesServiceV4.ContactDetails");
+ contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("FirstContacted",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildBinary("text".getBytes())));
+ Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT+00:01"));
+ dateTime.set(2014, 3, 5, 5, 5, 5);
+ dateTime.set(Calendar.MILLISECOND, 1);
+ contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("LastContacted",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build()));
+ Calendar date = Calendar.getInstance();
+ date.set(2001, 3, 5);
+ contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("Contacted",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Date).setValue(date).build()));
+ contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("GUID",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildGuid(UUID.randomUUID())));
+ contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("PreferedContactTime",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setValue(0).build()));
+ contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("Byte",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Byte).setValue(24).build()));
+ contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("SignedByte",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).build()));
+ contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("Double",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildDouble(Double.MAX_VALUE)));
+ contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("Single",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildSingle(Float.MAX_VALUE)));
+ contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("Short",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16(Short.MAX_VALUE)));
+ contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("Int",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(Integer.MAX_VALUE)));
+ getClient().getBinder().add(rowIndex,
+ getClient().getObjectFactory().newComplexProperty("aContact", contactDetails));
+
+ final ODataEntityCreateRequest<ClientEntity> createReq = getClient().getCUDRequestFactory().
+ getEntityCreateRequest(getClient().newURIBuilder(testOpenTypeServiceRootURL).
+ appendEntitySetSegment("RowIndex").build(), rowIndex);
+ createReq.setFormat(contentType);
+ final ODataEntityCreateResponse<ClientEntity> createRes = createReq.execute();
+ assertEquals(201, createRes.getStatusCode());
+
+ final URIBuilder builder = getClient().newURIBuilder(testOpenTypeServiceRootURL).
+ appendEntitySetSegment("RowIndex").appendKeySegment(id);
+ rowIndex = read(contentType, builder.build());
+ assertNotNull(rowIndex);
+ assertEquals(EdmPrimitiveTypeKind.Int32, rowIndex.getProperty("Id").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.String, rowIndex.getProperty("aString").getPrimitiveValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.Boolean, rowIndex.getProperty("aBoolean").getPrimitiveValue().getTypeKind());
+ assertTrue(rowIndex.getProperty("aDouble").hasPrimitiveValue());
+ assertTrue(rowIndex.getProperty("aByte").hasPrimitiveValue());
+ assertTrue(rowIndex.getProperty("aDate").hasPrimitiveValue());
+ assertNotNull(rowIndex.getProperty("aColor"));
+ assertTrue(rowIndex.getProperty("aContact").hasComplexValue());
+ assertTrue(rowIndex.getProperty("aContact").getComplexValue().get("SignedByte").hasPrimitiveValue());
+
+ final ODataDeleteResponse deleteRes = getClient().getCUDRequestFactory().
+ getDeleteRequest(rowIndex.getEditLink()).execute();
+ assertEquals(204, deleteRes.getStatusCode());
+ }
+
+ @Test
+ public void cudAsAtom() {
+ cud(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void cudAsJSON() {
+ cud(ContentType.JSON_FULL_METADATA);
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/OperationImportInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/OperationImportInvokeTestITCase.java
new file mode 100644
index 0000000..f083365
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/OperationImportInvokeTestITCase.java
@@ -0,0 +1,294 @@
+/*
+ * 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.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.apache.olingo.client.api.communication.request.invoke.ClientNoContent;
+import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
+import org.apache.olingo.client.api.domain.ClientCollectionValue;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientEnumValue;
+import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+public class OperationImportInvokeTestITCase extends AbstractTestITCase {
+
+ private void functionImports(final ContentType contentType) throws EdmPrimitiveTypeException {
+ // GetDefaultColor
+ final ODataInvokeRequest<ClientProperty> defaultColorReq = getClient().getInvokeRequestFactory().
+ getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
+ appendOperationCallSegment("GetDefaultColor").build(), ClientProperty.class);
+ defaultColorReq.setFormat(contentType);
+ final ClientProperty defaultColor = defaultColorReq.execute().getBody();
+ assertNotNull(defaultColor);
+ assertTrue(defaultColor.hasEnumValue());
+ assertEquals("Red", defaultColor.getEnumValue().getValue());
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", defaultColor.getEnumValue().getTypeName());
+
+ // GetPerson2
+ final ClientPrimitiveValue city = getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("London");
+
+ final ODataInvokeRequest<ClientEntity> person2Req = getClient().getInvokeRequestFactory().
+ getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
+ appendOperationCallSegment("GetPerson2").build(), ClientEntity.class,
+ Collections.<String, ClientValue> singletonMap("city", city));
+ person2Req.setFormat(contentType);
+ final ClientEntity person2 = person2Req.execute().getBody();
+ assertNotNull(person2);
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", person2.getTypeName().toString());
+ assertEquals(1, person2.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0);
+
+ // GetPerson
+ final ClientComplexValue address = getClient().getObjectFactory().
+ newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address");
+ address.add(client.getObjectFactory().newPrimitiveProperty("Street",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("1 Microsoft Way")));
+ address.add(client.getObjectFactory().newPrimitiveProperty("City",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("London")));
+ address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("98052")));
+
+ final ODataInvokeRequest<ClientEntity> personReq = getClient().getInvokeRequestFactory().
+ getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
+ appendOperationCallSegment("GetPerson").build(), ClientEntity.class,
+ Collections.<String, ClientValue> singletonMap("address", address));
+ personReq.setFormat(contentType);
+ final ClientEntity person = personReq.execute().getBody();
+ assertNotNull(person);
+ assertEquals(person2, person);
+
+ // GetAllProducts
+ final ODataInvokeRequest<ClientEntitySet> productsReq = getClient().getInvokeRequestFactory()
+ .getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
+ appendOperationCallSegment("GetAllProducts").build(), ClientEntitySet.class);
+ productsReq.setFormat(contentType);
+ final ClientEntitySet products = productsReq.execute().getBody();
+ assertNotNull(products);
+ assertEquals(5, products.getEntities().size());
+
+ // GetProductsByAccessLevel
+ final ClientEnumValue accessLevel = getClient().getObjectFactory().
+ newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "None");
+
+ final ODataInvokeRequest<ClientProperty> prodByALReq = getClient().getInvokeRequestFactory().
+ getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
+ appendOperationCallSegment("GetProductsByAccessLevel").build(), ClientProperty.class,
+ Collections.<String, ClientValue> singletonMap("accessLevel", accessLevel));
+ prodByALReq.setFormat(contentType);
+ final ClientProperty prodByAL = prodByALReq.execute().getBody();
+ assertNotNull(prodByAL);
+ assertTrue(prodByAL.hasCollectionValue());
+ assertEquals(5, prodByAL.getCollectionValue().size());
+ assertTrue(prodByAL.getCollectionValue().asJavaCollection().contains("Car"));
+ }
+
+ @Test
+ public void atomFunctionImports() throws EdmPrimitiveTypeException {
+ functionImports(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonFunctionImports() throws EdmPrimitiveTypeException {
+ functionImports(ContentType.JSON_FULL_METADATA);
+ }
+
+ @Test
+ public void edmEnabledFunctionImports() throws EdmPrimitiveTypeException {
+ // GetDefaultColor
+ final ODataInvokeRequest<ClientProperty> defaultColorReq = edmClient.getInvokeRequestFactory().
+ getFunctionImportInvokeRequest("GetDefaultColor");
+ final ClientProperty defaultColor = defaultColorReq.execute().getBody();
+ assertNotNull(defaultColor);
+ assertTrue(defaultColor.hasEnumValue());
+ assertEquals("Red", defaultColor.getEnumValue().getValue());
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", defaultColor.getEnumValue().getTypeName());
+
+ // GetPerson2
+ final ClientPrimitiveValue city =
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("London");
+ final ODataInvokeRequest<ClientEntity> person2Req = edmClient.getInvokeRequestFactory().
+ getFunctionImportInvokeRequest(
+ "GetPerson2", Collections.<String, ClientValue> singletonMap("city", city));
+ final ClientEntity person2 = person2Req.execute().getBody();
+ assertNotNull(person2);
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", person2.getTypeName().toString());
+ assertEquals(1, person2.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0);
+
+ // GetPerson
+ final ClientComplexValue address = getClient().getObjectFactory().
+ newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address");
+ address.add(client.getObjectFactory().newPrimitiveProperty("Street",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("1 Microsoft Way")));
+ address.add(client.getObjectFactory().newPrimitiveProperty("City",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("London")));
+ address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("98052")));
+
+ final ODataInvokeRequest<ClientEntity> personReq = edmClient.getInvokeRequestFactory().
+ getFunctionImportInvokeRequest(
+ "GetPerson", Collections.<String, ClientValue> singletonMap("address", address));
+ final ClientEntity person = personReq.execute().getBody();
+ assertNotNull(person);
+ assertEquals(person2, person);
+
+ // GetAllProducts
+ final ODataInvokeRequest<ClientEntitySet> productsReq = edmClient.getInvokeRequestFactory().
+ getFunctionImportInvokeRequest("GetAllProducts");
+ final ClientEntitySet products = productsReq.execute().getBody();
+ assertNotNull(products);
+ assertEquals(5, products.getEntities().size());
+
+ // GetProductsByAccessLevel
+ final ClientEnumValue accessLevel = getClient().getObjectFactory().
+ newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "None");
+
+ final ODataInvokeRequest<ClientProperty> prodByALReq = edmClient.getInvokeRequestFactory().
+ getFunctionImportInvokeRequest(
+ "GetProductsByAccessLevel",
+ Collections.<String, ClientValue> singletonMap("accessLevel", accessLevel));
+ final ClientProperty prodByAL = prodByALReq.execute().getBody();
+ assertNotNull(prodByAL);
+ assertTrue(prodByAL.hasCollectionValue());
+ assertEquals(5, prodByAL.getCollectionValue().size());
+ assertTrue(prodByAL.getCollectionValue().asJavaCollection().contains("Car"));
+ }
+
+ private void actionImports(final ContentType contentType) {
+ // Discount
+ final ClientPrimitiveValue percentage = getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(22);
+ final ODataInvokeRequest<ClientNoContent> discountReq = getClient().getInvokeRequestFactory().
+ getActionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
+ appendOperationCallSegment("Discount").build(), ClientNoContent.class,
+ Collections.<String, ClientValue> singletonMap("percentage", percentage));
+ discountReq.setFormat(contentType);
+ final ClientNoContent discount = discountReq.execute().getBody();
+ assertNotNull(discount);
+
+ // ResetBossAddress
+ final ClientComplexValue address = getClient().getObjectFactory().
+ newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address");
+ address.add(client.getObjectFactory().newPrimitiveProperty("Street",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("Via Le Mani Dal Naso, 123")));
+ address.add(client.getObjectFactory().newPrimitiveProperty("City",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("Tollo")));
+ address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("66010")));
+
+ final ODataInvokeRequest<ClientProperty> resetBossAddressReq = getClient().getInvokeRequestFactory().
+ getActionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
+ appendOperationCallSegment("ResetBossAddress").build(), ClientProperty.class,
+ Collections.<String, ClientValue> singletonMap("address", address));
+ resetBossAddressReq.setFormat(contentType);
+ final ClientProperty resetBossAddress = resetBossAddressReq.execute().getBody();
+ assertNotNull(resetBossAddress);
+ assertEquals(address, resetBossAddress.getComplexValue());
+ }
+
+ @Test
+ public void atomActionImports() {
+ actionImports(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonActionImports() {
+ actionImports(ContentType.JSON_FULL_METADATA);
+ }
+
+ @Test
+ public void edmEnabledActionImports() {
+ // Discount
+ final ClientPrimitiveValue percentage = getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(22);
+ final ODataInvokeRequest<ClientNoContent> discountReq = edmClient.getInvokeRequestFactory().
+ getActionImportInvokeRequest(
+ "Discount", Collections.<String, ClientValue> singletonMap("percentage", percentage));
+ final ClientNoContent discount = discountReq.execute().getBody();
+ assertNotNull(discount);
+
+ // ResetBossAddress
+ final ClientComplexValue address = getClient().getObjectFactory().
+ newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address");
+ address.add(client.getObjectFactory().newPrimitiveProperty("Street",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("Via Le Mani Dal Naso, 123")));
+ address.add(client.getObjectFactory().newPrimitiveProperty("City",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("Tollo")));
+ address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("66010")));
+
+ final ODataInvokeRequest<ClientProperty> resetBossAddressReq = edmClient.getInvokeRequestFactory().
+ getActionImportInvokeRequest(
+ "ResetBossAddress", Collections.<String, ClientValue> singletonMap("address", address));
+ final ClientProperty resetBossAddress = resetBossAddressReq.execute().getBody();
+ assertNotNull(resetBossAddress);
+ assertEquals(address.getTypeName(), resetBossAddress.getComplexValue().getTypeName());
+ }
+
+ private void bossEmails(final ContentType contentType) {
+ // ResetBossEmail
+ final ClientCollectionValue<ClientValue> emails =
+ getClient().getObjectFactory().newCollectionValue("Collection(Edm.String)");
+ emails.add(getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("first@olingo.apache.org"));
+ emails.add(getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("second@olingo.apache.org"));
+ ODataInvokeRequest<ClientProperty> bossEmailsReq = getClient().getInvokeRequestFactory().
+ getActionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
+ appendOperationCallSegment("ResetBossEmail").build(), ClientProperty.class,
+ Collections.<String, ClientValue> singletonMap("emails", emails));
+ bossEmailsReq.setFormat(contentType);
+ final ClientProperty bossEmails = bossEmailsReq.execute().getBody();
+ assertNotNull(bossEmails);
+ assertTrue(bossEmails.hasCollectionValue());
+ assertEquals(2, bossEmails.getCollectionValue().size());
+
+ final Map<String, ClientValue> params = new LinkedHashMap<String, ClientValue>(2);
+ params.put("start", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(0));
+ params.put("count", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(100));
+ bossEmailsReq = getClient().getInvokeRequestFactory().getFunctionInvokeRequest(
+ getClient().newURIBuilder(testStaticServiceRootURL).
+ appendOperationCallSegment("GetBossEmails").build(), ClientProperty.class, params);
+ bossEmailsReq.setFormat(contentType);
+ final ClientProperty bossEmailsViaGET = bossEmailsReq.execute().getBody();
+ assertNotNull(bossEmailsViaGET);
+ assertTrue(bossEmailsViaGET.hasCollectionValue());
+ assertEquals(2, bossEmailsViaGET.getCollectionValue().size());
+ assertEquals(bossEmails.getCollectionValue().asJavaCollection(),
+ bossEmailsViaGET.getCollectionValue().asJavaCollection());
+ }
+
+ @Test
+ public void atomBossEmails() throws EdmPrimitiveTypeException {
+ bossEmails(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonBossEmails() throws EdmPrimitiveTypeException {
+ bossEmails(ContentType.JSON_FULL_METADATA);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/PropertyTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/PropertyTestITCase.java
new file mode 100644
index 0000000..e16d9ea
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/PropertyTestITCase.java
@@ -0,0 +1,211 @@
+/*
+ * 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.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+
+import org.apache.olingo.client.api.ODataClient;
+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.ODataPropertyUpdateRequest;
+import org.apache.olingo.client.api.communication.request.cud.UpdateType;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
+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.ODataPropertyUpdateResponse;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientValuable;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.http.HttpMethod;
+import org.junit.Test;
+
+public class PropertyTestITCase extends AbstractTestITCase {
+
+ private void _enum(final ODataClient client, final ContentType contentType) {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Products").appendKeySegment(5).appendPropertySegment("CoverColors");
+ final ODataPropertyRequest<ClientProperty> req = client.getRetrieveRequestFactory().
+ getPropertyRequest(uriBuilder.build());
+ req.setFormat(contentType);
+
+ final ClientProperty prop = req.execute().getBody();
+ assertNotNull(prop);
+ // cast to workaround JDK 6 bug, fixed in JDK 7
+ assertEquals("Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)",
+ ((ClientValuable) prop).getValue().getTypeName());
+ }
+
+ @Test
+ public void enumFromXML() {
+ _enum(client, ContentType.APPLICATION_XML);
+ }
+
+ @Test
+ public void enumFromJSON() {
+ _enum(edmClient, ContentType.JSON);
+ }
+
+ @Test
+ public void enumFromFullJSON() {
+ _enum(client, ContentType.JSON_FULL_METADATA);
+ }
+
+ private void geospatial(final ODataClient client, final ContentType contentType) {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Home");
+ final ODataPropertyRequest<ClientProperty> req = client.getRetrieveRequestFactory().
+ getPropertyRequest(uriBuilder.build());
+ req.setFormat(contentType);
+
+ final ClientProperty prop = req.execute().getBody();
+ assertNotNull(prop);
+ // cast to workaround JDK 6 bug, fixed in JDK 7
+ assertEquals("Edm.GeographyPoint", ((ClientValuable) prop).getValue().getTypeName());
+ }
+
+ @Test
+ public void geospatialFromXML() {
+ geospatial(client, ContentType.APPLICATION_XML);
+ }
+
+ @Test
+ public void geospatialFromJSON() {
+ geospatial(edmClient, ContentType.JSON);
+ }
+
+ @Test
+ public void geospatialFromFullJSON() {
+ geospatial(client, ContentType.JSON_FULL_METADATA);
+ }
+
+ private void complex(final ODataClient client, final ContentType contentType) {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customers").appendKeySegment(2).appendPropertySegment("HomeAddress");
+ final ODataPropertyRequest<ClientProperty> req = client.getRetrieveRequestFactory().
+ getPropertyRequest(uriBuilder.build());
+ req.setFormat(contentType);
+
+ final ClientProperty prop = req.execute().getBody();
+ assertNotNull(prop);
+ // cast to workaround JDK 6 bug, fixed in JDK 7
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Address",
+ ((ClientValuable) prop).getValue().getTypeName());
+ }
+
+ @Test
+ public void complexFromXML() {
+ complex(client, ContentType.APPLICATION_XML);
+ }
+
+ @Test
+ public void complexFromJSON() {
+ complex(edmClient, ContentType.JSON);
+ }
+
+ @Test
+ public void complexFromFullJSON() {
+ complex(client, ContentType.JSON_FULL_METADATA);
+ }
+
+ private void updateComplexProperty(final ContentType contentType, final UpdateType type)
+ throws IOException {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customers").appendKeySegment(1).appendPropertySegment("HomeAddress");
+
+ ODataPropertyRequest<ClientProperty> retrieveReq =
+ client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
+ retrieveReq.setFormat(contentType);
+
+ ODataRetrieveResponse<ClientProperty> retrieveRes = retrieveReq.execute();
+ assertEquals(200, retrieveRes.getStatusCode());
+ ClientProperty oldAddress = retrieveRes.getBody();
+
+ ClientProperty homeAddress = client.getObjectFactory().newComplexProperty("HomeAddress",
+ client.getObjectFactory().newComplexValue(retrieveRes.getBody().getComplexValue().getTypeName()));
+
+ final String cityName = "Pescara";
+ homeAddress.getComplexValue().add(client.getObjectFactory().
+ newPrimitiveProperty("City", client.getObjectFactory().newPrimitiveValueBuilder().buildString(cityName)));
+
+ final ODataPropertyUpdateRequest updateReq = client.getCUDRequestFactory().
+ getPropertyComplexValueUpdateRequest(uriBuilder.build(), type, homeAddress);
+ if (client.getConfiguration().isUseXHTTPMethod()) {
+ assertEquals(HttpMethod.POST, updateReq.getMethod());
+ } else {
+ assertEquals(type.getMethod(), updateReq.getMethod());
+ }
+ updateReq.setFormat(contentType);
+
+ final ODataPropertyUpdateResponse updateRes = updateReq.execute();
+ assertEquals(204, updateRes.getStatusCode());
+
+ retrieveReq = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
+ retrieveReq.setFormat(contentType);
+
+ retrieveRes = retrieveReq.execute();
+ assertEquals(200, retrieveRes.getStatusCode());
+
+ homeAddress = retrieveRes.getBody();
+ assertEquals(cityName, homeAddress.getComplexValue().get("City").getPrimitiveValue().toString());
+
+ //
+ final ODataPropertyUpdateRequest resetRequest = client.getCUDRequestFactory().
+ getPropertyComplexValueUpdateRequest(uriBuilder.build(), type, oldAddress);
+ assertEquals(204, resetRequest.execute().getStatusCode());
+ }
+
+ @Test
+ public void patchComplexPropertyAsJSON() throws IOException {
+ updateComplexProperty(ContentType.JSON_FULL_METADATA, UpdateType.PATCH);
+ }
+
+ @Test
+ public void createAndDelete() {
+ // 1. create
+ final ClientEntity category = client.getObjectFactory().newEntity(null);
+ category.setId(client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Categories").appendKeySegment(1).build());
+
+ final URIBuilder createBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Products").appendKeySegment(0).appendNavigationSegment("Categories").
+ appendRefSegment();
+ final ODataEntityCreateRequest<ClientEntity> createReq = client.getCUDRequestFactory().
+ getEntityCreateRequest(createBuilder.build(), category);
+
+ final ODataEntityCreateResponse<ClientEntity> createRes = createReq.execute();
+ assertEquals(204, createRes.getStatusCode());
+
+ // 2. delete
+ final URIBuilder deleteBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Products").appendKeySegment(0).appendNavigationSegment("Categories").
+ appendKeySegment(1).appendRefSegment();
+ final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().
+ getDeleteRequest(deleteBuilder.build());
+
+ final ODataDeleteResponse deleteRes = deleteReq.execute();
+ assertEquals(204, deleteRes.getStatusCode());
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/PropertyValueTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/PropertyValueTestITCase.java
new file mode 100644
index 0000000..12bc827
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/PropertyValueTestITCase.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.fit.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+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.domain.ClientPrimitiveValue;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientValuable;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+public class PropertyValueTestITCase extends AbstractTestITCase {
+
+ @Test
+ public void retrieveIntPropertyValueTest() throws EdmPrimitiveTypeException {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PersonID");
+ final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
+ req.setFormat(ContentType.TEXT_PLAIN);
+ assertEquals("5", req.execute().getBody().toString());
+ }
+
+ @Test
+ public void retrieveBooleanPropertyValueTest() throws EdmPrimitiveTypeException {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("IsRegistered");
+ final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
+ req.setFormat(ContentType.TEXT_PLAIN);
+ assertEquals("true", req.execute().getBody().toString());
+ }
+
+ @Test
+ public void retrieveStringPropertyValueTest() throws EdmPrimitiveTypeException {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("FirstName");
+ final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
+ req.setFormat(ContentType.TEXT_PLAIN);
+ assertEquals("Peter", req.execute().getBody().toString());
+ }
+
+ @Test
+ public void retrieveDatePropertyValueTest() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Orders").appendKeySegment(8).appendPropertySegment("OrderDate");
+ final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
+ req.setFormat(ContentType.TEXT_PLAIN);
+ final ClientPrimitiveValue property = req.execute().getBody();
+ assertEquals("2011-03-04T16:03:57Z", property.toString());
+ }
+
+ @Test
+ public void retrieveDecimalPropertyValueTest() throws EdmPrimitiveTypeException {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Height");
+ final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
+ req.setFormat(ContentType.TEXT_PLAIN);
+ final ClientPrimitiveValue property = req.execute().getBody();
+ assertEquals("179", property.toString());
+ }
+
+ @Test
+ public void retrieveBinaryPropertyValueTest() throws IOException {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC");
+ final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
+ req.setFormat(ContentType.TEXT_PLAIN);
+ final ClientPrimitiveValue 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.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC");
+ final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
+ req.setAccept(ContentType.APPLICATION_ATOM_XML.toContentTypeString());
+ req.execute().getBody();
+ }
+
+ @Test(expected = ODataClientErrorException.class)
+ public void retrieveBinaryPropertyValueTestWithXML() throws IOException {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC");
+ final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
+ req.setAccept(ContentType.APPLICATION_XML.toContentTypeString());
+ req.execute().getBody();
+ }
+
+ @Test
+ public void retrieveCollectionPropertyValueTest() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Numbers");
+ final ODataPropertyRequest<ClientProperty> req = client.getRetrieveRequestFactory().
+ getPropertyRequest(uriBuilder.build());
+ req.setFormat(ContentType.APPLICATION_XML);
+ final ClientProperty property = req.execute().getBody();
+ // cast to workaround JDK 6 bug, fixed in JDK 7
+ assertTrue(((ClientValuable) property).getValue().isCollection());
+ assertEquals("555-555-5555", property.getCollectionValue().iterator().next().asPrimitive().toString());
+ }
+
+ @Test
+ public void retrieveNullPropertyValueTest() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("HomeAddress");
+ final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
+ req.setFormat(ContentType.TEXT_PLAIN);
+ final ClientPrimitiveValue property = req.execute().getBody();
+ assertTrue(StringUtils.isBlank(property.toString()));
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/QueryOptionsTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/QueryOptionsTestITCase.java
new file mode 100644
index 0000000..cd937ab
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/QueryOptionsTestITCase.java
@@ -0,0 +1,246 @@
+/*
+ * 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.base;
+
+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.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
+import org.apache.olingo.client.api.uri.QueryOption;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+/**
+ * This is the unit test class to check for query options.
+ */
+public class QueryOptionsTestITCase extends AbstractTestITCase {
+
+ /**
+ * Test <tt>$expand</tt>.
+ */
+ public void expand() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customers").appendKeySegment(1).expand("Orders");
+
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+
+ final ClientEntity customer = req.execute().getBody();
+ assertTrue(customer.getNavigationLink("Orders") instanceof ClientInlineEntitySet);
+ }
+
+ @Test
+ public void expandWithFilter() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customers").appendKeySegment(1).
+ expandWithOptions("Orders", Collections.<QueryOption, Object> singletonMap(
+ QueryOption.FILTER, getClient().getFilterFactory().gt("OrderID", 7).build()));
+
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+
+ final ClientEntity customer = req.execute().getBody();
+ assertTrue(customer.getNavigationLink("Orders") instanceof ClientInlineEntitySet);
+ }
+
+ /**
+ * Test <tt>$filter</tt> and <tt>$orderby</tt>.
+ *
+ * @see org.apache.olingo.fit.base.FilterFactoryTestITCase for more tests.
+ */
+ @Test
+ public void filterOrderby() throws EdmPrimitiveTypeException {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").filter("(PersonID lt 3)");
+
+ // 1. check that filtered entity set looks as expected
+ ODataEntitySetRequest<ClientEntitySet> req =
+ client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+
+ ClientEntitySet feed = req.execute().getBody();
+ assertNotNull(feed);
+ assertEquals(2, feed.getEntities().size());
+
+ // 2. extract PersonID values - sorted ASC by default
+ final List<Integer> former = new ArrayList<Integer>(2);
+ for (ClientEntity entity : feed.getEntities()) {
+ final Integer personID = entity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class);
+ assertTrue(personID < 3);
+ former.add(personID);
+ }
+
+ // 3. add orderby clause to filter above
+ req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.orderBy("PersonID desc").build());
+
+ feed = req.execute().getBody();
+ assertNotNull(feed);
+ assertEquals(2, feed.getEntities().size());
+
+ // 4. extract again VIN value - now they were required to be sorted DESC
+ final List<Integer> latter = new ArrayList<Integer>(2);
+ for (ClientEntity entity : feed.getEntities()) {
+ final Integer personID = entity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class);
+ assertTrue(personID < 3);
+ latter.add(personID);
+ }
+
+ // 5. reverse latter and expect to be equal to former
+ Collections.reverse(latter);
+ assertEquals(former, latter);
+ }
+
+ /**
+ * Test <tt>$format</tt>.
+ */
+ @Test
+ public void format() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customers").appendKeySegment(1).format("json");
+
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ req.setFormat(ContentType.APPLICATION_ATOM_XML);
+
+ final ODataRetrieveResponse<ClientEntity> res = req.execute();
+ assertNotNull(res);
+ assertTrue(res.getContentType().replaceAll(" ", "").
+ startsWith(ContentType.JSON.toContentTypeString()));
+ }
+
+ /**
+ * Test <tt>$skip</tt>.
+ */
+ public void skip() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People");
+
+ // 1. check that filtered entity set looks as expected
+ final ODataEntitySetRequest<ClientEntitySet> req =
+ client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.skip(2).build());
+
+ final ClientEntitySet feed = req.execute().getBody();
+ assertEquals(3, feed.getEntities().size());
+ }
+
+ /**
+ * Test <tt>$top</tt>.
+ */
+ public void top() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People");
+
+ // 1. check that filtered entity set looks as expected
+ final ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.top(2).build());
+
+ final ClientEntitySet feed = req.execute().getBody();
+ assertEquals(2, feed.getEntities().size());
+ }
+
+ /**
+ * Test <tt>$skiptoken</tt>.
+ */
+ @Test
+ public void skiptoken() throws EdmPrimitiveTypeException {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL);
+ uriBuilder.appendEntitySetSegment("People").skipToken("5");
+
+ final ODataEntitySetRequest<ClientEntitySet> req =
+ client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+
+ final ClientEntitySet feed = req.execute().getBody();
+ assertNotNull(feed);
+ assertEquals(1, feed.getEntities().size());
+
+ for (ClientEntity entity : feed.getEntities()) {
+ assertTrue(entity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class) > 5);
+ }
+ }
+
+ /**
+ * Test <tt>$inlinecount</tt>.
+ */
+ @Test
+ public void count() {
+ final URIBuilder uriBuilder =
+ client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").count(true);
+
+ final ODataEntitySetRequest<ClientEntitySet> req =
+ client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+
+ final ClientEntitySet feed = req.execute().getBody();
+ assertNotNull(feed);
+ assertEquals(Integer.valueOf(feed.getEntities().size()), feed.getCount());
+ }
+
+ /**
+ * Test <tt>$select</tt>.
+ */
+ @Test
+ public void select() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Customers").appendKeySegment(1).select("PersonID,Orders").expand("Orders");
+
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+
+ final ClientEntity customer = req.execute().getBody();
+ assertEquals(1, customer.getProperties().size());
+ assertEquals(1, customer.getNavigationLinks().size());
+ assertTrue((customer.getNavigationLinks().get(0) instanceof ClientInlineEntitySet));
+ }
+
+ @Test
+ public void issue253() {
+ final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("relatedEntitySelect").appendEntitySetSegment("Customers").appendKeySegment(1).
+ expandWithSelect("Orders", "OrderID", "OrderDetails");
+
+ final ODataEntityRequest<ClientEntity> req =
+ client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+
+ final ODataRetrieveResponse<ClientEntity> res = req.execute();
+ assertEquals(200, res.getStatusCode());
+ }
+
+ @Test
+ public void search() {
+ final URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").search(client.getSearchFactory().
+ or(client.getSearchFactory().literal("Bob"), client.getSearchFactory().literal("Jill")));
+
+ final ODataEntitySetRequest<ClientEntitySet> req =
+ client.getRetrieveRequestFactory().getEntitySetRequest(builder.build());
+
+ final ODataRetrieveResponse<ClientEntitySet> res = req.execute();
+ assertEquals(200, res.getStatusCode());
+ assertFalse(res.getBody().getEntities().isEmpty());
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/ServiceDocumentTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/ServiceDocumentTestITCase.java
new file mode 100644
index 0000000..10beb8b
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/ServiceDocumentTestITCase.java
@@ -0,0 +1,63 @@
+/*
+ * 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.base;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URI;
+
+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.domain.ClientServiceDocument;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+public class ServiceDocumentTestITCase extends AbstractTestITCase {
+
+ private void retrieveServiceDocument(final ContentType contentType) {
+ final ODataServiceDocumentRequest req =
+ client.getRetrieveRequestFactory().getServiceDocumentRequest(testStaticServiceRootURL);
+ req.setFormat(contentType);
+
+ final ODataRetrieveResponse<ClientServiceDocument> res = req.execute();
+ assertEquals(200, res.getStatusCode());
+
+ final ClientServiceDocument serviceDocument = res.getBody();
+ assertEquals(12, serviceDocument.getEntitySets().size());
+ assertEquals(6, serviceDocument.getSingletons().size());
+ assertEquals(6, serviceDocument.getFunctionImports().size());
+
+ 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 retrieveServiceDocumentAsXML() {
+ retrieveServiceDocument(ContentType.APPLICATION_XML);
+ }
+
+ @Test
+ public void retrieveServiceDocumentAsJSON() {
+ retrieveServiceDocument(ContentType.JSON);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/base/SingletonTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/base/SingletonTestITCase.java
new file mode 100644
index 0000000..8a0ee72
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/base/SingletonTestITCase.java
@@ -0,0 +1,135 @@
+/*
+ * 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.base;
+
+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 org.apache.olingo.client.api.ODataClient;
+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.ODataEntityUpdateResponse;
+import org.apache.olingo.client.api.domain.ClientAnnotation;
+import org.apache.olingo.client.api.domain.ClientSingleton;
+import org.apache.olingo.client.api.domain.ClientValuable;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+public class SingletonTestITCase extends AbstractTestITCase {
+
+ private void read(final ODataClient client, final ContentType contentType) throws EdmPrimitiveTypeException {
+ final URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Company");
+ final ODataEntityRequest<ClientSingleton> singleton =
+ client.getRetrieveRequestFactory().getSingletonRequest(builder.build());
+ singleton.setFormat(contentType);
+ final ClientSingleton company = singleton.execute().getBody();
+ assertNotNull(company);
+
+ assertEquals(0, company.getProperty("CompanyID").getPrimitiveValue().toCastValue(Integer.class), 0);
+ // cast to workaround JDK 6 bug, fixed in JDK 7
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory",
+ ((ClientValuable) company.getProperty("CompanyCategory")).getValue().getTypeName());
+ assertTrue(company.getProperty("CompanyCategory").hasEnumValue());
+ }
+
+ @Test
+ public void readFromAtom() throws EdmPrimitiveTypeException {
+ read(client, ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void readFromJSON() throws EdmPrimitiveTypeException {
+ read(edmClient, ContentType.JSON);
+ }
+
+ @Test
+ public void readfromJSONFull() throws EdmPrimitiveTypeException {
+ read(client, ContentType.JSON_FULL_METADATA);
+ }
+
+ private void readWithAnnotations(final ODataClient client, final ContentType contentType)
+ throws EdmPrimitiveTypeException {
+
+ final URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Boss");
+ final ODataEntityRequest<ClientSingleton> singleton =
+ client.getRetrieveRequestFactory().getSingletonRequest(builder.build());
+ singleton.setFormat(contentType);
+ singleton.setPrefer(client.newPreferences().includeAnnotations("*"));
+ final ClientSingleton boss = singleton.execute().getBody();
+ assertNotNull(boss);
+
+ assertFalse(boss.getAnnotations().isEmpty());
+ final ClientAnnotation isBoss = boss.getAnnotations().get(0);
+ assertTrue(isBoss.getPrimitiveValue().toCastValue(Boolean.class));
+ }
+
+ @Test
+ public void readWithAnnotationsFromAtom() throws EdmPrimitiveTypeException {
+ readWithAnnotations(client, ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void readWithAnnotationsFromJSON() throws EdmPrimitiveTypeException {
+ readWithAnnotations(edmClient, ContentType.JSON);
+ }
+
+ @Test
+ public void readWithAnnotationsFromJSONFull() throws EdmPrimitiveTypeException {
+ readWithAnnotations(client, ContentType.JSON_FULL_METADATA);
+ }
+
+ private void update(final ContentType contentType) throws EdmPrimitiveTypeException {
+ final ClientSingleton changes = getClient().getObjectFactory().newSingleton(
+ new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Company"));
+ changes.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Revenue",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt64(132520L)));
+
+ final URI uri = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Company").build();
+ final ODataEntityUpdateRequest<ClientSingleton> req = getClient().getCUDRequestFactory().
+ getSingletonUpdateRequest(uri, UpdateType.PATCH, changes);
+ req.setFormat(contentType);
+
+ final ODataEntityUpdateResponse<ClientSingleton> res = req.execute();
+ assertEquals(204, res.getStatusCode());
+
+ final ClientSingleton updated =
+ getClient().getRetrieveRequestFactory().getSingletonRequest(uri).execute().getBody();
+ assertNotNull(updated);
+ assertEquals(132520, updated.getProperty("Revenue").getPrimitiveValue().toCastValue(Integer.class), 0);
+ }
+
+ @Test
+ public void atomUpdate() throws EdmPrimitiveTypeException {
+ update(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonUpdate() throws EdmPrimitiveTypeException {
+ update(ContentType.JSON);
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/APIBasicDesignTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/APIBasicDesignTestITCase.java
new file mode 100644
index 0000000..a66192b
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/APIBasicDesignTestITCase.java
@@ -0,0 +1,626 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+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 java.io.IOException;
+import java.lang.reflect.Proxy;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.ext.proxy.AbstractService;
+import org.apache.olingo.ext.proxy.api.EdmStreamValue;
+import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
+import org.apache.olingo.ext.proxy.commons.AbstractCollectionInvocationHandler;
+import org.apache.olingo.fit.proxy.demo.Service;
+import org.apache.olingo.fit.proxy.demo.odatademo.DemoService;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.PersonDetail;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.AddressCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonComposableInvoker;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types
+ .ProductCollectionComposableInvoker;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types
+ .ProductDetailCollectionComposableInvoker;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddress;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetail;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.junit.Test;
+
+public class APIBasicDesignTestITCase extends AbstractTestITCase {
+
+ protected AbstractService<EdmEnabledODataClient> getService() {
+ return service;
+ }
+
+ protected InMemoryEntities getContainer() {
+ return container;
+ }
+
+ @Test
+ public void readEntitySet() {
+ final OrderCollection orders = container.getOrders().execute();
+ assertFalse(orders.isEmpty());
+
+ final CustomerCollection customers = container.getCustomers().
+ orderBy("PersonID").
+ select("FirstName", "LastName", "Orders").
+ expand("Orders").
+ execute();
+
+ assertEquals(2, customers.size());
+ for (Customer customer : customers) {
+ assertNotNull(customer.getFirstName());
+ assertNotNull(customer.getLastName());
+ }
+ }
+
+ @Test
+ public void readWithReferences() {
+ final Person person = container.getOrders().getByKey(8).getCustomerForOrder().refs().load();
+ assertEquals("http://localhost:9080/stub/StaticService/V40/Static.svc/Customers(PersonID=1)",
+ person.readEntityReferenceID());
+
+ final OrderCollection orders = container.getCustomers().getByKey(1).getOrders().refs().execute();
+ assertEquals("http://localhost:9080/stub/StaticService/V40/Static.svc/Orders(7)",
+ orders.iterator().next().readEntityReferenceID());
+ }
+
+ @Test
+ public void changeSingleNavigationProperty() {
+ /*
+ * See OData Spec 11.4.6.3
+ * Alternatively, a relationship MAY be updated as part of an update to the source entity by including
+ * the required binding information for the new target entity.
+ *
+ * => use PATCH instead of PUT
+ */
+ final Person person1 = container.getPeople().getByKey(1).load();
+ final Person person5 = container.getPeople().getByKey(5).load();
+
+ person1.setParent(person5);
+ container.flush();
+ }
+
+ @Test
+ public void addViaReference() {
+ final Order order = container.getOrders().getByKey(8).load();
+
+ final OrderCollection orders = container.newEntityCollection(OrderCollection.class);
+ orders.addRef(order);
+
+ container.getCustomers().getByKey(1).setOrders(orders);
+ container.flush();
+ }
+
+ @Test
+ public void readAndCheckForPrimitive() {
+ final Customer customer = getContainer().getCustomers().getByKey(1);
+ assertNotNull(customer);
+ assertNull(customer.getPersonID());
+
+ assertEquals(1, customer.load().getPersonID(), 0);
+ service.getContext().detachAll();
+ }
+
+ @Test
+ public void readAndCheckForComplex() {
+ Customer customer = container.getCustomers().getByKey(1); // no http request
+ Address homeAddress = customer.getHomeAddress();
+ assertNotNull(homeAddress);
+ assertNull(homeAddress.getCity());
+ assertNull(homeAddress.getPostalCode());
+ assertNull(homeAddress.getStreet());
+
+ homeAddress.load(); // HTTP request at complex loading
+ assertEquals("London", homeAddress.getCity());
+ assertEquals("98052", homeAddress.getPostalCode());
+ assertEquals("1 Microsoft Way", homeAddress.getStreet());
+
+ getService().getContext().detachAll();
+
+ homeAddress = container.getCustomers().getByKey(1).load().getHomeAddress(); // HTTP request at entity loading
+ assertEquals("London", homeAddress.getCity());
+ assertEquals("98052", homeAddress.getPostalCode());
+ assertEquals("1 Microsoft Way", homeAddress.getStreet());
+
+ getService().getContext().detachAll();
+
+ customer = container.getOrders().getByKey(8).getCustomerForOrder();
+ homeAddress = customer.getHomeAddress().select("City", "PostalCode").expand("SomethingElse"); // no HTTP request
+ assertNotNull(homeAddress);
+ assertNull(homeAddress.getCity());
+ assertNull(homeAddress.getPostalCode());
+ assertNull(homeAddress.getStreet());
+
+ try {
+ homeAddress.load();
+ fail();
+ } catch (Exception e) {
+ // Generated URL
+ // "<serviceroot>/Orders(8)/CustomerForOrder/HomeAddress?$select=City,PostalCode&$expand=SomethingElse"
+ // curently unsupported by test service server
+ homeAddress.clearQueryOptions();
+ }
+ }
+
+ @Test
+ public void readWholeEntitySet() {
+ PersonCollection person = getContainer().getPeople().execute();
+ assertEquals(5, person.size(), 0);
+
+ int pageCount = 1;
+ while (person.hasNextPage()) {
+ pageCount++;
+ assertFalse(person.nextPage().execute().isEmpty());
+ }
+
+ assertEquals(2, pageCount);
+ service.getContext().detachAll(); // avoid influences
+ }
+
+ @Test
+ public void loadWithSelect() {
+ Order order =
+ getContainer().getOrders().getByKey(8);
+ assertNull(order.getOrderID());
+ assertNull(order.getOrderDate());
+
+ order.select("OrderID");
+ order.load();
+
+ assertNull(order.getOrderDate());
+ assertNotNull(order.getOrderID());
+
+ order.clearQueryOptions();
+ order.load();
+ assertNotNull(order.getOrderDate());
+ assertNotNull(order.getOrderID());
+ service.getContext().detachAll(); // avoid influences
+ }
+
+ @Test
+ public void loadWithSelectAndExpand() {
+ final Customer customer = getContainer().getCustomers().getByKey(1);
+
+ customer.expand("Orders");
+ customer.select("Orders", "PersonID");
+
+ customer.load();
+ assertEquals(1, customer.getOrders().size());
+ service.getContext().detachAll(); // avoid influences
+ }
+
+ @Test
+ public void navigateLinks() {
+ final Customer customer = getContainer().getCustomers().getByKey(1); // No HTTP Request
+ assertNotNull(customer.getCompany().load().getCompanyID()); // singleton: single request
+ assertEquals(1, customer.getOrders().execute().size()); // collection: single request
+
+ final Order order = getContainer().getOrders().getByKey(8); // No HTTP Requests
+ assertNotNull(order.getCustomerForOrder().load().getPersonID()); // entity type: single request
+
+ service.getContext().detachAll(); // avoid influences
+ }
+
+ @Test
+ public void createDelete() {
+ // Create order ....
+ final Order order = getContainer().newEntityInstance(Order.class);
+ order.setOrderID(1105);
+
+ final Calendar orderDate = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ orderDate.clear();
+ orderDate.set(2011, 3, 4, 16, 3, 57);
+ order.setOrderDate(new Timestamp(orderDate.getTimeInMillis()));
+
+ order.setShelfLife(BigDecimal.ZERO);
+
+ final PrimitiveCollection<BigDecimal> osl = getContainer().newPrimitiveCollection(BigDecimal.class);
+ osl.add(BigDecimal.TEN.negate());
+ osl.add(BigDecimal.TEN);
+
+ order.setOrderShelfLifes(osl);
+
+ getContainer().getOrders().add(order);
+ getContainer().flush();
+
+ Order actual = getContainer().getOrders().getByKey(1105);
+ assertNull(actual.getOrderID());
+
+ actual.load();
+ assertEquals(1105, actual.getOrderID(), 0);
+ assertEquals(orderDate.getTimeInMillis(), actual.getOrderDate().getTime());
+ assertEquals(BigDecimal.ZERO, actual.getShelfLife());
+ assertEquals(2, actual.getOrderShelfLifes().size());
+
+ service.getContext().detachAll();
+
+ // (1) Delete by key (see EntityCreateTestITCase)
+ getContainer().getOrders().delete(1105);
+ assertNull(getContainer().getOrders().getByKey(1105));
+
+ service.getContext().detachAll(); // detach to show the second delete case
+
+ // (2) Delete by object (see EntityCreateTestITCase)
+ getContainer().getOrders().delete(getContainer().getOrders().getByKey(1105));
+ assertNull(getContainer().getOrders().getByKey(1105));
+
+ // (3) Delete by invoking delete method on the object itself
+ service.getContext().detachAll(); // detach to show the third delete case
+ getContainer().getOrders().getByKey(1105).delete();
+ assertNull(getContainer().getOrders().getByKey(1105));
+
+ getContainer().flush();
+
+ service.getContext().detachAll();
+ try {
+ getContainer().getOrders().getByKey(1105).load();
+ fail();
+ } catch (IllegalArgumentException e) {
+ // Test
+ }
+ service.getContext().detachAll(); // avoid influences
+ }
+
+ @Test
+ public void deleteSingleProperty() {
+ container.getCustomers().getByKey(1).delete("City");
+ container.flush();
+ }
+
+ @Test
+ public void deleteComplex() {
+ container.getCustomers().getByKey(1).getHomeAddress().delete();
+ container.flush();
+ }
+
+ @Test
+ public void deleteCollection() {
+ container.getCustomers().getByKey(1).getEmails().delete();
+ container.flush();
+ }
+
+ @Test
+ public void deleteEdmStreamProperty() throws IOException {
+ // ---------------------------------------
+ // Instantiate Demo Service
+ // ---------------------------------------
+ final Service<EdmEnabledODataClient> dservice =
+ Service.getV4(testDemoServiceRootURL);
+ dservice.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ final DemoService dcontainer = dservice.getEntityContainer(DemoService.class);
+ assertNotNull(dcontainer);
+ dservice.getContext().detachAll();
+ // ---------------------------------------
+ dcontainer.getPersonDetails().getByKey(1).delete("Photo");
+ dcontainer.flush();
+
+ dservice.getContext().detachAll(); // avoid influences
+ }
+
+ @Test
+ public void updateComplexProperty() {
+ Address homeAddress = container.getCustomers().getByKey(1).getHomeAddress();
+ homeAddress.setCity("Pescara");
+ homeAddress.setPostalCode("98052");
+ container.flush();
+
+ homeAddress = container.getCustomers().getByKey(1).getHomeAddress().load();
+ assertEquals("Pescara", homeAddress.getCity());
+ assertEquals("98052", homeAddress.getPostalCode());
+ }
+
+ @Test
+ public void updateAndReadEdmStreamProperty() throws IOException {
+ // ---------------------------------------
+ // Instantiate Demo Service
+ // ---------------------------------------
+ final Service<EdmEnabledODataClient> dservice =
+ Service.getV4(testDemoServiceRootURL);
+ dservice.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ final DemoService dcontainer = dservice.getEntityContainer(DemoService.class);
+ assertNotNull(dcontainer);
+ dservice.getContext().detachAll();
+ // ---------------------------------------
+ final String random = RandomStringUtils.random(124, "abcdefghijklmnopqrstuvwxyz");
+
+ final PersonDetail personDetail = dcontainer.getPersonDetails().getByKey(1); // NO HTTP Request
+
+ // 1 HTTP Request to add an Edm.Stream property value about MediaEditLink Photo
+ personDetail.setPhoto(dcontainer.newEdmStreamValue("application/octet-stream", IOUtils.toInputStream(random)));
+
+ dcontainer.flush();
+
+ final EdmStreamValue actual = dcontainer.getPersonDetails().getByKey(1).getPhoto().load(); // 1 HTTP Request
+ assertEquals(random, IOUtils.toString(actual.getStream()));
+
+ dservice.getContext().detachAll(); // avoid influences
+ }
+
+ @Test
+ public void boundOperationsAfterCreate() {
+ final Product product = getContainer().newEntityInstance(Product.class);
+ product.setProductID(1012);
+ product.setName("Latte");
+ product.setQuantityPerUnit("100g Bag");
+ product.setUnitPrice(3.24f);
+ product.setQuantityInStock(100);
+ product.setDiscontinued(false);
+ product.setUserAccess(AccessLevel.Execute);
+ product.setSkinColor(Color.Blue);
+
+ final PrimitiveCollection<Color> cc = getContainer().newPrimitiveCollection(Color.class);
+ cc.add(Color.Red);
+ cc.add(Color.Green);
+
+ product.setCoverColors(cc);
+
+ final ProductDetail detail = getContainer().newEntityInstance(ProductDetail.class);
+ detail.setProductID(product.getProductID());
+ detail.setProductDetailID(1012);
+ detail.setProductName("LatteHQ");
+ detail.setDescription("High-Quality Milk");
+
+ final ProductDetailCollection detailCollection = getContainer().newEntityCollection(ProductDetailCollection.class);
+ detailCollection.add(detail);
+
+ product.setDetails(detailCollection);
+
+ getContainer().getProducts().add(product);
+
+ // The first HTTP Request to create product and the linked product detail
+ getContainer().flush();
+
+ // The second HTTP request to access a bound operation via the local object
+ assertNotNull(product.operations().addAccessRight(AccessLevel.None).execute());
+
+ // The third HTTP Request to access a bound operation via entity URL
+ final ProductDetailCollectionComposableInvoker result =
+ container.getProducts().getByKey(1012).operations().getProductDetails(1);
+ assertEquals(1, result.execute().size());
+ }
+
+ @Test
+ public void workingWithPrimitiveCollections() throws IOException {
+ final PrimitiveCollection<String> emails = container.getPeople().getByKey(1).getEmails();
+ assertNotNull(emails);
+ assertTrue(emails.isEmpty());
+ assertFalse(emails.execute().isEmpty());
+
+ getService().getContext().detachAll();
+
+ // container.getOrders().getByKey(1).getCustomerForOrder().getEmails().execute().isEmpty());
+ // Not supported by the test service BTW generates a single request as expected:
+ // <service root>/Orders(1)/CustomerForOrder/Emails
+ emails.add("fabio.martelli@tirasa.net");
+ container.getPeople().getByKey(1).setEmails(emails);
+
+ container.flush();
+
+ boolean found = false;
+ for (String email : container.getPeople().getByKey(1).getEmails().execute()) {
+ if (email.equals("fabio.martelli@tirasa.net")) {
+ found = true;
+ }
+ }
+
+ assertTrue(found);
+
+ getService().getContext().detachAll();
+ }
+
+ @Test
+ public void workingWithSingletons() {
+ assertNotNull(container.getCompany().getVipCustomer().load().getPersonID());
+
+ container.getCompany().setName("new name");
+ container.flush();
+
+ assertEquals("new name", container.getCompany().load().getName());
+ }
+
+ @Test
+ public void createAndCallOperation() {
+ final Product product = container.newEntityInstance(Product.class);
+ product.setProductID(1001);
+ container.flush();
+
+ container.getProducts().getByKey(1000).operations().getProductDetails(1).execute();
+ }
+
+ @Test
+ public void workingWithOperations() {
+ // Primitive collections (available only skip and top)
+ final PrimitiveCollection<String> prods1 = container.operations().
+ getProductsByAccessLevel(AccessLevel.None).
+ skip(2).
+ top(3).execute();
+ assertNotNull(prods1);
+ assertFalse(prods1.isEmpty());
+
+ // Complex/Entity collection
+ final ProductCollection prods2 = container.operations().getAllProducts().
+ filter("name eq XXXX").
+ select("Name", "ProductDetail").
+ expand("ProductDetail").
+ orderBy("Name").skip(3).top(5).execute();
+ assertNotNull(prods2);
+ assertFalse(prods2.isEmpty());
+
+ // Complex/Entity
+ final Person person = container.operations().getPerson2("London").
+ select("Name").
+ expand("Order").execute();
+ assertNotNull(person);
+
+ // Primitive (no query option available)
+ final Double amount = container.getAccounts().getByKey(101).getMyGiftCard().operations().
+ getActualAmount(1.1).execute();
+ assertNotNull(amount);
+
+ // POST ...
+ final Address address = container.newComplexInstance(HomeAddress.class);
+ address.setStreet("Via Le Mani Dal Naso, 123");
+ address.setPostalCode("Tollo");
+ address.setCity("66010");
+
+ final AddressCollection ac = container.newComplexCollection(AddressCollection.class);
+ final Person updated = container.getCustomers().getByKey(2).operations().
+ resetAddress(ac, 0).select("Name").expand("Orders").execute();
+ assertNotNull(updated);
+ }
+
+ @Test
+ public void workingWithComposableOperations() {
+ final ProductCollectionComposableInvoker invoker1 = container.operations().getAllProducts();
+
+ // Complex/Entity collection (available filter, select, expand, orderBy, skip and top)
+ invoker1.operations().discount(10). // discount is an operation of ProductCollecton
+ filter("Name eq XXXX").
+ select("Name", "ProductDetail").
+ expand("ProductDetail").
+ orderBy("Name").skip(3).top(5).execute();
+
+ // Complex/Entity
+ final PersonComposableInvoker invoker2 = container.operations().getPerson2("London");
+
+ // a. whole entity
+ final Person person = invoker2.select("Name").expand("Order").execute();
+ assertNotNull(person);
+ assertEquals(1, person.getPersonID(), 0);
+
+ // b. primitive collection property
+ final PrimitiveCollection<String> emails = invoker2.getEmails().execute();
+ assertNotNull(emails);
+ assertFalse(emails.isEmpty());
+
+ // c. complex property
+ final Address homeAddress = invoker2.getHomeAddress().load();
+ assertNotNull(homeAddress);
+
+ // d. navigation property
+ final Person parent = invoker2.getParent().load();
+ assertNotNull(parent);
+ assertEquals(2, parent.getPersonID(), 0);
+ }
+
+ /**
+ * Java client should support the deletion based on locally created entity.
+ * See also <a href="https://issues.apache.org/jira/browse/OLINGO-395">Olingo Issue 395</a>.
+ */
+ @Test
+ public void issueOLINGO395() {
+ Order order = getContainer().newEntityInstance(Order.class);
+ order.setOrderID(1105);
+
+ final Calendar orderDate = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ orderDate.clear();
+ orderDate.set(2011, 3, 4, 16, 3, 57);
+ order.setOrderDate(new Timestamp(orderDate.getTimeInMillis()));
+
+ order.setShelfLife(BigDecimal.ZERO);
+
+ final PrimitiveCollection<BigDecimal> osl = getContainer().newPrimitiveCollection(BigDecimal.class);
+ osl.add(BigDecimal.TEN.negate());
+ osl.add(BigDecimal.TEN);
+
+ order.setOrderShelfLifes(osl);
+
+ getContainer().getOrders().add(order);
+ getContainer().getOrders().delete(order);
+
+ getContainer().flush();
+
+ service.getContext().detachAll();
+ try {
+ getContainer().getOrders().getByKey(1105).load();
+ fail();
+ } catch (IllegalArgumentException e) {
+ // Expected Exception
+ }
+ service.getContext().detachAll(); // avoid influences
+
+ order = getContainer().newEntityInstance(Order.class);
+ order.setOrderID(1105);
+
+ getContainer().getOrders().delete(order);
+ getContainer().flush(); // test service doesn't fail for delete requests about unexisting objects
+
+ service.getContext().detachAll();
+ try {
+ getContainer().getOrders().getByKey(1105).load();
+ fail();
+ } catch (IllegalArgumentException e) {
+ // Expected Exception
+ }
+ service.getContext().detachAll(); // avoid influences
+ }
+
+ @Test
+ public void issueOLINGO398() {
+ AbstractCollectionInvocationHandler<?, ?> handler = AbstractCollectionInvocationHandler.class.cast(
+ Proxy.getInvocationHandler(container.getCustomers().getByKey(1).getOrders().
+ select("OrderID", "CustomerForOrder").
+ expand("CustomerForOrder").
+ top(1).
+ skip(2)));
+
+ assertEquals("http://localhost:9080/stub/StaticService/V40/Static.svc/Customers(1)/Orders?"
+ + "%24select=OrderID%2CCustomerForOrder&%24expand=CustomerForOrder&%24top=1&%24skip=2",
+ handler.getRequestURI().toASCIIString());
+
+ handler = AbstractCollectionInvocationHandler.class.cast(
+ Proxy.getInvocationHandler(container.getCustomers().getByKey(1).getOrders().
+ select("OrderID", "CustomerForOrder").
+ expand("CustomerForOrder").
+ top(1).
+ skip(2)));
+
+ assertEquals("http://localhost:9080/stub/StaticService/V40/Static.svc/Customers(1)/Orders?%24"
+ + "select=OrderID%2CCustomerForOrder&%24expand=CustomerForOrder&%24top=1&%24skip=2",
+ handler.getRequestURI().toASCIIString());
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/AbstractTestITCase.java
new file mode 100644
index 0000000..c6e1b2c
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/AbstractTestITCase.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy;
+
+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.IOException;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.ext.proxy.AbstractService;
+import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
+import org.apache.olingo.fit.AbstractBaseTestITCase;
+import org.apache.olingo.fit.proxy.staticservice.Service;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order;
+import org.junit.BeforeClass;
+
+public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
+
+ protected static String testStaticServiceRootURL;
+
+ protected static String testDemoServiceRootURL;
+
+ protected static String testKeyAsSegmentServiceRootURL;
+
+ protected static String testActionOverloadingServiceRootURL;
+
+ protected static String testOpenTypeServiceRootURL;
+
+ protected static String testLargeModelServiceRootURL;
+
+ protected static String testAuthServiceRootURL;
+
+ protected static Service<EdmEnabledODataClient> service;
+
+ protected static InMemoryEntities container;
+
+ @BeforeClass
+ public static void setUpODataServiceRoot() throws IOException {
+ testStaticServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Static.svc";
+ testDemoServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Demo.svc";
+ testKeyAsSegmentServiceRootURL = "http://localhost:9080/stub/StaticService/V40/KeyAsSegment.svc";
+ testActionOverloadingServiceRootURL = "http://localhost:9080/stub/StaticService/V40/ActionOverloading.svc";
+ testOpenTypeServiceRootURL = "http://localhost:9080/stub/StaticService/V40/OpenType.svc";
+ testLargeModelServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Static.svc/large";
+ testAuthServiceRootURL = "http://localhost:9080/stub/DefaultService.svc/V40/Static.svc";
+
+ service = Service.getV4(testStaticServiceRootURL);
+ service.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ container = service.getEntityContainer(InMemoryEntities.class);
+ assertNotNull(container);
+ service.getContext().detachAll();
+ }
+
+ protected Customer readCustomer(final InMemoryEntities container, final int id) {
+ final Customer customer = container.getCustomers().getByKey(id).load();
+ assertNotNull(customer);
+ assertEquals(id, customer.getPersonID(), 0);
+
+ return customer;
+ }
+
+ protected void createPatchAndDeleteOrder(
+ final InMemoryEntities container, final AbstractService<EdmEnabledODataClient> service) {
+
+ // Create order ....
+ final Order order = container.newEntityInstance(Order.class);
+ order.setOrderID(105);
+
+ final Calendar orderDate = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ orderDate.clear();
+ orderDate.set(2011, 3, 4, 16, 3, 57);
+ order.setOrderDate(new Timestamp(orderDate.getTimeInMillis()));
+
+ order.setShelfLife(BigDecimal.ZERO);
+
+ final PrimitiveCollection<BigDecimal> value = container.newPrimitiveCollection(BigDecimal.class);
+ value.add(BigDecimal.TEN.negate());
+ value.add(BigDecimal.TEN);
+ order.setOrderShelfLifes(value);
+
+ container.getOrders().add(order);
+ container.flush();
+
+ // Patch order ... (test for OLINGO-353)
+ order.setShelfLife(BigDecimal.TEN);
+ container.flush();
+
+ Order actual = container.getOrders().getByKey(105).load();
+ assertEquals(105, actual.getOrderID(), 0);
+ assertEquals(orderDate.getTimeInMillis(), actual.getOrderDate().getTime());
+ assertEquals(BigDecimal.TEN, actual.getShelfLife());
+ assertEquals(2, actual.getOrderShelfLifes().size());
+
+ // Delete order ...
+ container.getOrders().delete(105);
+ actual = container.getOrders().getByKey(105);
+ assertNull(actual);
+
+ service.getContext().detachAll();
+ actual = container.getOrders().getByKey(105);
+ assertNotNull(actual);
+
+ container.getOrders().delete(105);
+ actual = container.getOrders().getByKey(105);
+ assertNull(actual);
+
+ container.flush();
+
+ service.getContext().detachAll();
+ try {
+ container.getOrders().getByKey(105).load();
+ fail();
+ } catch (IllegalArgumentException e) {
+ // Expected Exception
+ }
+ }
+
+ @Override
+ protected ODataClient getClient() {
+ throw new RuntimeException("This method should not be used from proxy tests.");
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/AsyncTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/AsyncTestITCase.java
new file mode 100644
index 0000000..6d4fe7f
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/AsyncTestITCase.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import org.apache.commons.lang3.RandomStringUtils;
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types
+ .PersonComposableInvoker;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types
+ .ProductCollectionComposableInvoker;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.junit.Test;
+
+public class AsyncTestITCase extends AbstractTestITCase {
+
+ @Test
+ public void retrieveEntitySet() throws InterruptedException, ExecutionException {
+ final Future<CustomerCollection> futureCustomers = container.getCustomers().executeAsync();
+ assertNotNull(futureCustomers);
+
+ while (!futureCustomers.isDone()) {
+ Thread.sleep(1000L);
+ }
+
+ final CustomerCollection customers = futureCustomers.get();
+ assertNotNull(customers);
+ assertFalse(customers.isEmpty());
+ for (Customer customer : customers) {
+ assertNotNull(customer);
+ }
+ }
+
+ @Test
+ public void updateEntity() throws Exception {
+ final String randomFirstName = RandomStringUtils.random(10, "abcedfghijklmnopqrstuvwxyz");
+
+ final Person person = container.getPeople().getByKey(1);
+ person.setFirstName(randomFirstName);
+
+ final Future<Void> futureFlush = container.flushAsync();
+ assertNotNull(futureFlush);
+
+ while (!futureFlush.isDone()) {
+ Thread.sleep(1000L);
+ }
+
+ final Future<? extends Person> futurePerson = container.getPeople().getByKey(1).loadAsync();
+ assertEquals(randomFirstName, futurePerson.get().getFirstName());
+ }
+
+ @Test
+ public void invoke() throws Exception {
+ final ProductCollectionComposableInvoker invoker1 = container.operations().getAllProducts();
+
+ final Future<ProductCollection> future1 = invoker1.operations().
+ discount(10).
+ filter("Name eq XXXX").
+ select("Name", "ProductDetail").
+ expand("ProductDetail").
+ orderBy("Name").skip(3).top(5).executeAsync();
+ while (!future1.isDone()) {
+ Thread.sleep(1000L);
+ }
+ assertFalse(future1.get().isEmpty());
+
+ final PersonComposableInvoker invoker2 = container.operations().getPerson2("London");
+
+ final Future<Person> future2 = invoker2.select("Name").
+ expand("Order").executeAsync();
+ while (!future2.isDone()) {
+ Thread.sleep(1000L);
+ }
+ assertNotNull(future2.get());
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/AuthEntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/AuthEntityCreateTestITCase.java
new file mode 100644
index 0000000..2a54622
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/AuthEntityCreateTestITCase.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.fit.proxy;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.fit.proxy.staticservice.Service;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+
+public class AuthEntityCreateTestITCase extends EntityCreateTestITCase {
+
+ private Service<EdmEnabledODataClient> ecf;
+
+ private InMemoryEntities ime;
+
+ @Override
+ protected Service<EdmEnabledODataClient> getService() {
+ if (ecf == null) {
+ ecf = Service.getV4(testAuthServiceRootURL);
+ ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ ecf.getClient().getConfiguration().
+ setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
+ }
+ return ecf;
+ }
+
+ @Override
+ protected InMemoryEntities getContainer() {
+ if (ime == null) {
+ ime = getService().getEntityContainer(InMemoryEntities.class);
+ }
+ return ime;
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/AuthEntityRetrieveTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/AuthEntityRetrieveTestITCase.java
new file mode 100644
index 0000000..471c01b
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/AuthEntityRetrieveTestITCase.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.fit.proxy.staticservice.Service;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+
+public class AuthEntityRetrieveTestITCase extends EntityRetrieveTestITCase {
+
+ @Override
+ protected InMemoryEntities getContainer() {
+ final Service<EdmEnabledODataClient> ecf = Service.getV4(testAuthServiceRootURL);
+ ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ ecf.getClient().getConfiguration().
+ setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
+ return ecf.getEntityContainer(InMemoryEntities.class);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/BoundOperationInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/BoundOperationInvokeTestITCase.java
new file mode 100644
index 0000000..5847f47
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/BoundOperationInvokeTestITCase.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.AddressCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types
+ .ProductDetailCollectionComposableInvoker;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailKey;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfoComposableInvoker;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddress;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductComposableInvoker;
+
+import org.junit.Test;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public class BoundOperationInvokeTestITCase extends AbstractTestITCase {
+
+ @Test
+ public void getEmployeesCount() {
+ assertNotNull(container.getCompany().load().operations().getEmployeesCount());
+ }
+
+ @Test
+ public void getProductDetails() {
+ final ProductDetailCollectionComposableInvoker result =
+ container.getProducts().getByKey(5).operations().getProductDetails(1);
+ assertEquals(1, result.execute().size());
+ }
+
+ @Test
+ public void getRelatedProduct() {
+ final ProductDetailKey key = new ProductDetailKey();
+ key.setProductID(6);
+ key.setProductDetailID(1);
+
+ final ProductComposableInvoker product =
+ container.getProductDetails().getByKey(key).operations().getRelatedProduct();
+ assertEquals(6, product.execute().getProductID(), 0);
+ }
+
+ @Test
+ public void getDefaultPI() {
+ final PaymentInstrument pi = container.getAccounts().getByKey(101).operations().getDefaultPI().execute();
+ assertEquals(101901, pi.getPaymentInstrumentID(), 0);
+ }
+
+ @Test
+ public void getAccountInfo() {
+ final AccountInfoComposableInvoker accountInfo =
+ container.getAccounts().getByKey(101).operations().getAccountInfo();
+ assertNotNull(accountInfo.execute());
+ }
+
+ @Test
+ public void getActualAmount() {
+ final Double amount =
+ container.getAccounts().getByKey(101).getMyGiftCard().operations().getActualAmount(1.1).execute();
+ assertEquals(41.79, amount, 0);
+ }
+
+ @Test
+ public void increaseRevenue() {
+ final Long result = container.getCompany().load().operations().increaseRevenue(12L).execute();
+ assertNotNull(result);
+ }
+
+ @Test
+ public void addAccessRight() {
+ final AccessLevel accessLevel =
+ container.getProducts().getByKey(5).operations().addAccessRight(AccessLevel.Execute).execute();
+ assertNotNull(accessLevel);
+ }
+
+ @Test
+ public void resetAddress() {
+ final Address address = container.newComplexInstance(HomeAddress.class);
+ address.setStreet("Via Le Mani Dal Naso, 123");
+ address.setPostalCode("Tollo");
+ address.setCity("66010");
+
+ final AddressCollection ac = container.newComplexCollection(AddressCollection.class);
+ ac.add(address);
+
+ final Person person = container.getCustomers().getByKey(2).operations().resetAddress(ac, 0).execute();
+ assertEquals(2, person.getPersonID(), 0);
+ }
+
+ @Test
+ public void refreshDefaultPI() {
+ final PaymentInstrument pi = container.getAccounts().getByKey(101).operations().
+ refreshDefaultPI(new Timestamp(Calendar.getInstance().getTimeInMillis())).execute();
+ assertEquals(101901, pi.getPaymentInstrumentID(), 0);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/ContextTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/ContextTestITCase.java
new file mode 100644
index 0000000..2d97038
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/ContextTestITCase.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.ext.proxy.api.ODataFlushException;
+import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
+import org.apache.olingo.fit.proxy.staticservice.Service;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
+import org.junit.Test;
+
+public class ContextTestITCase extends AbstractTestITCase {
+
+ private void continueOnError(final Service<EdmEnabledODataClient> service, final InMemoryEntities container) {
+ final Person person = container.newEntityInstance(Person.class);
+ container.getPeople().add(person);
+
+ final Employee employee = container.newEntityInstance(Employee.class);
+ employee.setPersonID(199);
+ employee.setFirstName("Fabio");
+ employee.setLastName("Martelli");
+
+ final PrimitiveCollection<String> emails = container.newPrimitiveCollection(String.class);
+ emails.add("fabio.martelli@tirasa.net");
+
+ employee.setEmails(emails);
+ final Calendar date = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ date.clear();
+ date.set(2011, 3, 4, 9, 0, 0);
+ employee.setDateHired(new Timestamp(date.getTimeInMillis()));
+ final Address homeAddress = container.newComplexInstance(Address.class);
+ homeAddress.setCity("Pescara");
+ homeAddress.setPostalCode("65100");
+ homeAddress.setStreet("viale Gabriele D'Annunzio 256");
+ employee.setHomeAddress(homeAddress);
+
+ final PrimitiveCollection<String> numbers = container.newPrimitiveCollection(String.class);
+ numbers.add("3204725072");
+ numbers.add("08569930");
+ employee.setNumbers(numbers);
+
+ container.getPeople().add(employee);
+
+ try {
+ container.flush();
+ fail();
+ } catch (ODataFlushException e) {
+ assertEquals(1, e.getErrors().size());
+ assertEquals(0, e.getErrors().get(0).getIndex());
+ assertNotNull(e.getErrors().get(0).getRequest());
+ }
+
+ service.getContext().detachAll();
+ }
+
+ @Test
+ public void transactionalContinueOnError() {
+ service.getClient().getConfiguration().setContinueOnError(true);
+ continueOnError(service, container);
+ service.getClient().getConfiguration().setContinueOnError(false);
+ }
+
+ @Test
+ public void nonTransactionalContinueOnError() {
+ final Service<EdmEnabledODataClient> _service = Service.getV4(testStaticServiceRootURL, false);
+ _service.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ _service.getClient().getConfiguration().setContinueOnError(true);
+
+ final InMemoryEntities _container = _service.getEntityContainer(InMemoryEntities.class);
+
+ continueOnError(_service, _container);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/DerivedTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/DerivedTypeTestITCase.java
new file mode 100644
index 0000000..f59dcd8
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/DerivedTypeTestITCase.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddress;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPI;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPICollection;
+
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.junit.Test;
+
+public class DerivedTypeTestITCase extends AbstractTestITCase {
+
+ @Test
+ public void read() {
+ final CustomerCollection customers = container.getPeople().execute(CustomerCollection.class);
+ assertNotNull(customers);
+
+ for (Object customer : customers) {
+ assertTrue(customer instanceof Customer);
+ }
+
+ final CreditCardPICollection creditCards = container.getAccounts().getByKey(101).
+ getMyPaymentInstruments().execute(CreditCardPICollection.class);
+ assertNotNull(creditCards);
+ for (Object creditCard : creditCards) {
+ assertTrue(creditCard instanceof CreditCardPI);
+ }
+ }
+
+ @Test
+ public void createDelete() {
+ final Customer customer = container.newEntityInstance(Customer.class);
+ customer.setPersonID(976);
+ customer.setFirstName("Test");
+ customer.setLastName("Test");
+
+ final Address homeAddress = container.newComplexInstance(CompanyAddress.class);
+ homeAddress.setStreet("V.le Gabriele D'Annunzio");
+ homeAddress.setCity("Pescara");
+ homeAddress.setPostalCode("65127");
+ customer.setHomeAddress(homeAddress);
+
+ customer.setNumbers(container.newPrimitiveCollection(String.class)); // empty
+ customer.setEmails(container.newPrimitiveCollection(String.class)); // empty
+ customer.setCity("Pescara");
+
+ final Calendar birthday = Calendar.getInstance();
+ birthday.clear();
+ birthday.set(1977, 8, 8);
+ customer.setBirthday(new Timestamp(birthday.getTimeInMillis()));
+
+ customer.setTimeBetweenLastTwoOrders(BigDecimal.valueOf(0.0000002));
+
+ container.getPeople().add(customer);
+ container.flush();
+
+ final Person actual = container.getPeople().getByKey(976, Customer.class).load();
+ assertTrue(actual instanceof Customer);
+ assertTrue(actual.getHomeAddress() instanceof CompanyAddress);
+
+ container.getPeople().delete(976);
+
+ container.flush();
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/EntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/EntityCreateTestITCase.java
new file mode 100644
index 0000000..e581111
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/EntityCreateTestITCase.java
@@ -0,0 +1,382 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import org.apache.commons.lang3.RandomUtils;
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.ext.proxy.AbstractService;
+import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetail;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailKey;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrumentCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetail;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection;
+
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddress;
+import org.junit.Assert;
+import org.junit.Test;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+/**
+ * This is the unit test class to check entity create operations.
+ */
+public class EntityCreateTestITCase extends AbstractTestITCase {
+
+ protected AbstractService<EdmEnabledODataClient> getService() {
+ return service;
+ }
+
+ protected InMemoryEntities getContainer() {
+ return container;
+ }
+
+ @Test
+ public void createAndDelete() {
+ createPatchAndDeleteOrder(getContainer(), getService());
+ }
+
+ @Test
+ public void createEmployee() {
+ final Integer id = 101;
+
+ final Employee employee = getContainer().newEntityInstance(Employee.class);
+ employee.setPersonID(id);
+ employee.setFirstName("Fabio");
+ employee.setLastName("Martelli");
+
+ PrimitiveCollection<String> value = getContainer().newPrimitiveCollection(String.class);
+ value.add("fabio.martelli@tirasa.net");
+ employee.setEmails(value);
+
+ final Calendar date = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ date.clear();
+ date.set(2011, 3, 4, 9, 0, 0);
+ employee.setDateHired(new Timestamp(date.getTimeInMillis()));
+ final Address homeAddress = getContainer().newComplexInstance(HomeAddress.class);
+ homeAddress.setCity("Pescara");
+ homeAddress.setPostalCode("65100");
+ homeAddress.setStreet("viale Gabriele D'Annunzio 256");
+ employee.setHomeAddress(homeAddress);
+
+ value = getContainer().newPrimitiveCollection(String.class);
+ value.add("3204725072");
+ value.add("08569930");
+ employee.setNumbers(value);
+
+ getContainer().getPeople().add(employee);
+
+ getContainer().flush();
+
+ Employee actual = getContainer().getPeople().getByKey(id, Employee.class).load();
+ assertNotNull(actual);
+ assertEquals(id, actual.getPersonID());
+ Assert.assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity());
+
+ getService().getContext().detachAll();
+ actual = getContainer().getPeople().getByKey(id, Employee.class).load();
+ assertNotNull(actual);
+ assertEquals(id, actual.getPersonID());
+ Assert.assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity());
+
+ getContainer().getPeople().delete(actual.getPersonID());
+ getContainer().flush();
+
+ try {
+ getContainer().getPeople().getByKey(id, Employee.class).load();
+ fail();
+ } catch (IllegalArgumentException e) {
+ // Expected
+ }
+
+ getService().getContext().detachAll();
+ try {
+ getContainer().getPeople().getByKey(id, Employee.class).load();
+ fail();
+ } catch (IllegalArgumentException e) {
+ // Expected
+ }
+ }
+
+ @Test
+ public void createWithNavigation() {
+ final Integer id = 101;
+
+ final Customer customer = getContainer().newEntityInstance(Customer.class);
+ customer.setPersonID(id);
+ customer.setPersonID(id);
+ customer.setFirstName("Fabio");
+ customer.setLastName("Martelli");
+ customer.setCity("Pescara");
+
+ PrimitiveCollection<String> value = getContainer().newPrimitiveCollection(String.class);
+ value.add("fabio.martelli@tirasa.net");
+ customer.setEmails(value);
+
+ Address homeAddress = getContainer().newComplexInstance(HomeAddress.class);
+ homeAddress.setCity("Pescara");
+ homeAddress.setPostalCode("65100");
+ homeAddress.setStreet("viale Gabriele D'Annunzio 256");
+ customer.setHomeAddress(homeAddress);
+
+ value = getContainer().newPrimitiveCollection(String.class);
+ value.add("3204725072");
+ value.add("08569930");
+ customer.setNumbers(value);
+
+ final OrderCollection orders = getContainer().newEntityCollection(OrderCollection.class);
+ orders.add(getContainer().getOrders().getByKey(8));
+ customer.setOrders(orders);
+
+ getContainer().getCustomers().add(customer);
+ getContainer().flush();
+
+ Customer actual = readCustomer(getContainer(), id);
+ Assert.assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity());
+ Assert.assertEquals(1, actual.getOrders().execute().size());
+ Assert.assertEquals(8, actual.getOrders().iterator().next().getOrderID(), 0);
+
+ getContainer().getCustomers().delete(actual.getPersonID());
+ getContainer().flush();
+
+ try {
+ getContainer().getCustomers().getByKey(id).load();
+ fail();
+ } catch (IllegalArgumentException e) {
+ // Expected
+ }
+ }
+
+ @Test
+ public void createWithBackNavigation() {
+ final Integer id = 102;
+
+ // -------------------------------
+ // Create a new order
+ // -------------------------------
+ Order order = getContainer().newEntityInstance(Order.class);
+ order.setOrderID(id);
+
+ final Calendar orderDate = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ orderDate.clear();
+ orderDate.set(2011, 3, 4, 16, 3, 57);
+ order.setOrderDate(new Timestamp(orderDate.getTimeInMillis()));
+
+ order.setShelfLife(BigDecimal.TEN);
+
+ PrimitiveCollection<BigDecimal> osl = getContainer().newPrimitiveCollection(BigDecimal.class);
+ osl.add(BigDecimal.TEN.negate());
+ osl.add(BigDecimal.TEN);
+ order.setOrderShelfLifes(osl);
+ // -------------------------------
+
+ // -------------------------------
+ // Create a new customer
+ // -------------------------------
+ final Customer customer = getContainer().newEntityInstance(Customer.class);
+ customer.setPersonID(id);
+ customer.setPersonID(id);
+ customer.setFirstName("Fabio");
+ customer.setLastName("Martelli");
+ customer.setCity("Pescara");
+
+ PrimitiveCollection<String> value = getContainer().newPrimitiveCollection(String.class);
+ value.add("fabio.martelli@tirasa.net");
+ customer.setEmails(value);
+
+ final Address homeAddress = getContainer().newComplexInstance(HomeAddress.class);
+ homeAddress.setCity("Pescara");
+ homeAddress.setPostalCode("65100");
+ homeAddress.setStreet("viale Gabriele D'Annunzio 256");
+ customer.setHomeAddress(homeAddress);
+
+ value = getContainer().newPrimitiveCollection(String.class);
+ value.add("3204725072");
+ value.add("08569930");
+ customer.setNumbers(value);
+
+ final OrderCollection orders = getContainer().newEntityCollection(OrderCollection.class);
+ orders.add(order);
+ customer.setOrders(orders);
+ // -------------------------------
+
+ // -------------------------------
+ // Link customer to order
+ // -------------------------------
+ order.setCustomerForOrder(customer);
+ // -------------------------------
+
+ getContainer().getOrders().add(order);
+ getContainer().flush();
+
+ assertEquals(id, order.getOrderID());
+ assertEquals(id, customer.getPersonID());
+
+ Customer actual = readCustomer(getContainer(), id);
+ Assert.assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity());
+ Assert.assertEquals(1, actual.getOrders().execute().size());
+ Assert.assertEquals(id, actual.getOrders().iterator().next().getOrderID());
+
+ order = getContainer().getOrders().getByKey(id);
+ assertNotNull(order);
+ Assert.assertEquals(id, order.getCustomerForOrder().load().getPersonID());
+
+ getContainer().getOrders().delete(actual.getOrders());
+ getContainer().flush();
+
+ try {
+ getContainer().getOrders().getByKey(id).load();
+ fail();
+ } catch (IllegalArgumentException e) {
+ // Expected
+ }
+
+ actual = readCustomer(getContainer(), id);
+ assertTrue(actual.getOrders().isEmpty());
+
+ getContainer().getCustomers().delete(actual.getPersonID());
+ getContainer().flush();
+
+ try {
+ getContainer().getCustomers().getByKey(id).load();
+ fail();
+ } catch (IllegalArgumentException e) {
+ // Expected
+ }
+ }
+
+ @Test
+ public void multiKey() {
+ OrderDetail details = getContainer().newEntityInstance(OrderDetail.class);
+ details.setOrderID(8);
+ details.setProductID(1);
+ details.setQuantity(100);
+ details.setUnitPrice(5f);
+
+ getContainer().getOrderDetails().add(details);
+ getContainer().flush();
+
+ OrderDetailKey key = new OrderDetailKey();
+ key.setOrderID(8);
+ key.setProductID(1);
+
+ details = getContainer().getOrderDetails().getByKey(key).load();
+ assertNotNull(details);
+ assertEquals(Integer.valueOf(100), details.getQuantity());
+ assertEquals(8, details.getOrderID(), 0);
+ assertEquals(1, details.getProductID(), 0);
+ assertEquals(5f, details.getUnitPrice(), 0);
+
+ getContainer().getOrderDetails().delete(key);
+ getContainer().flush();
+
+ try {
+ getContainer().getOrderDetails().getByKey(key).load();
+ fail();
+ } catch (IllegalArgumentException e) {
+ // Expected
+ }
+ }
+
+ @Test
+ public void deepInsert() {
+ Product product = getContainer().newEntityInstance(Product.class);
+ product.setProductID(12);
+ product.setName("Latte");
+ product.setQuantityPerUnit("100g Bag");
+ product.setUnitPrice(3.24f);
+ product.setQuantityInStock(100);
+ product.setDiscontinued(false);
+ product.setUserAccess(AccessLevel.Execute);
+ product.setSkinColor(Color.Blue);
+
+ PrimitiveCollection<Color> value = getContainer().newPrimitiveCollection(Color.class);
+ value.add(Color.Red);
+ value.add(Color.Green);
+ product.setCoverColors(value);
+
+ final ProductDetail detail = getContainer().newEntityInstance(ProductDetail.class);
+ detail.setProductID(product.getProductID());
+ detail.setProductDetailID(12);
+ detail.setProductName("LatteHQ");
+ detail.setDescription("High-Quality Milk");
+
+ final ProductDetailCollection detailCollection = getContainer().newEntityCollection(ProductDetailCollection.class);
+ detailCollection.add(detail);
+
+ product.setDetails(detailCollection);
+
+ getContainer().getProducts().add(product);
+ getContainer().flush();
+
+ product = getContainer().getProducts().getByKey(12).load();
+ assertEquals("Latte", product.getName());
+ Assert.assertEquals(12, product.getDetails().execute().iterator().next().getProductDetailID(), 0);
+ }
+
+ @Test
+ public void contained() {
+ PaymentInstrumentCollection instruments =
+ getContainer().getAccounts().getByKey(101).getMyPaymentInstruments().execute();
+ final int sizeBefore = instruments.size();
+
+ final PaymentInstrument instrument = getContainer().newEntityInstance(PaymentInstrument.class);
+ instruments.add(instrument);
+
+ final int id = RandomUtils.nextInt(101999, 105000);
+ instrument.setPaymentInstrumentID(id);
+ instrument.setFriendlyName("New one");
+ instrument.setCreatedDate(new Timestamp(Calendar.getInstance().getTimeInMillis()));
+
+ getContainer().flush();
+
+ instruments = getContainer().getAccounts().getByKey(101).getMyPaymentInstruments().execute();
+ final int sizeAfter = instruments.size();
+ assertEquals(sizeBefore + 1, sizeAfter);
+
+ getContainer().getAccounts().getByKey(101).getMyPaymentInstruments().delete(id);
+
+ getContainer().flush();
+
+ instruments = getContainer().getAccounts().getByKey(101).getMyPaymentInstruments().execute();
+ final int sizeEnd = instruments.size();
+ assertEquals(sizeBefore, sizeEnd);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/EntityRetrieveTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/EntityRetrieveTestITCase.java
new file mode 100644
index 0000000..3b74db8
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/EntityRetrieveTestITCase.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.fit.proxy;
+
+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 static org.junit.Assert.fail;
+
+import java.lang.reflect.Proxy;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.ext.proxy.commons.EntityInvocationHandler;
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetail;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailKey;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.junit.Test;
+
+/**
+ * This is the unit test class to check entity retrieve operations.
+ */
+public class EntityRetrieveTestITCase extends AbstractTestITCase {
+
+ protected InMemoryEntities getContainer() {
+ return container;
+ }
+
+ @Test
+ public void exists() {
+ assertTrue(getContainer().getCustomers().exists(1));
+ assertFalse(getContainer().getOrders().exists(1));
+ }
+
+ @Test
+ public void get() {
+ readCustomer(getContainer(), 1);
+ }
+
+ @Test
+ public void getAll() {
+ final PersonCollection all = getContainer().getPeople().execute();
+ assertNotNull(all);
+ assertFalse(all.isEmpty());
+ for (Person person : all) {
+ assertNotNull(person);
+ }
+
+ final EmployeeCollection employees = getContainer().getPeople().execute(EmployeeCollection.class);
+ assertNotNull(employees);
+ assertFalse(employees.isEmpty());
+ for (Employee employee : employees) {
+ assertNotNull(employee);
+ }
+
+ final CustomerCollection customers = getContainer().getPeople().execute(CustomerCollection.class);
+ assertNotNull(customers);
+ assertFalse(customers.isEmpty());
+ for (Customer customer : customers) {
+ assertNotNull(customer);
+ }
+
+ assertTrue(all.size() > employees.size() + customers.size());
+ }
+
+ @Test
+ public void navigate() {
+ final Order order = getContainer().getOrders().getByKey(8).load();
+ assertEquals(8, order.getOrderID(), 0);
+
+ final Timestamp date = order.getOrderDate();
+ assertNotNull(date);
+ final Calendar actual = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ actual.clear();
+ actual.set(2011, 2, 4, 16, 3, 57);
+ assertEquals(actual.getTimeInMillis(), date.getTime());
+
+ final Customer customer = getContainer().getCustomers().getByKey(1).load();
+ assertNotNull(customer);
+ assertEquals(1, customer.getPersonID(), 0);
+ final Address address = customer.getHomeAddress();
+ assertNotNull(address);
+ assertEquals("98052", address.getPostalCode());
+ }
+
+ @Test
+ public void withInlineEntry() {
+ final Customer customer = readCustomer(getContainer(), 1);
+ final Company company = customer.getCompany();
+ assertEquals(0, company.load().getCompanyID(), 0);
+ }
+
+ @Test
+ public void withInlineFeed() {
+ final Customer customer = readCustomer(getContainer(), 1);
+ final OrderCollection orders = customer.getOrders();
+ assertEquals(1, orders.execute().size());
+ assertEquals(8, orders.iterator().next().getOrderID(), 0);
+ }
+
+ @Test
+ public void withActions() {
+ final Product product = getContainer().getProducts().getByKey(5).load();
+ assertEquals(5, product.getProductID(), 0);
+
+ try {
+ assertNotNull(product.operations().getClass().getMethod("addAccessRight", AccessLevel.class));
+ } catch (Exception e) {
+ fail();
+ }
+ }
+
+ @Test
+ public void multiKey() {
+ final OrderDetailKey orderDetailKey = new OrderDetailKey();
+ orderDetailKey.setOrderID(7);
+ orderDetailKey.setProductID(5);
+
+ final OrderDetail orderDetail = getContainer().getOrderDetails().getByKey(orderDetailKey).load();
+ assertNotNull(orderDetail);
+ assertEquals(7, orderDetail.getOrderID(), 0);
+ assertEquals(5, orderDetail.getProductID(), 0);
+ }
+
+ @Test
+ public void checkForETag() {
+ final Order order = getContainer().getOrders().getByKey(8).load();
+ assertTrue(StringUtils.isNotBlank(((EntityInvocationHandler) Proxy.getInvocationHandler(order)).getETag()));
+ }
+
+ @Test
+ public void contained() {
+ final PaymentInstrument instrument =
+ getContainer().getAccounts().getByKey(101).getMyPaymentInstruments().getByKey(101901).load();
+ assertEquals(101901, instrument.getPaymentInstrumentID(), 0);
+ assertNotNull(instrument.getCreatedDate());
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/EntitySetTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/EntitySetTestITCase.java
new file mode 100644
index 0000000..7610603
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/EntitySetTestITCase.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.fit.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * This is the unit test class to check basic feed operations.
+ */
+public class EntitySetTestITCase extends AbstractTestITCase {
+
+ @Test
+ public void count() {
+ assertNotNull(container.getOrders());
+ Assert.assertEquals(2, container.getOrders().count().longValue());
+ }
+
+ @Test
+ public void getAll() {
+ int count = 0;
+ for (Customer customer : container.getCustomers().execute()) {
+ assertNotNull(customer);
+ count++;
+ }
+ assertEquals(2, count);
+ }
+
+ @Test
+ public void iterator() {
+ int count = 0;
+ for (Customer customer : container.getCustomers()) {
+ assertNotNull(customer);
+ count++;
+ }
+ assertEquals(2, count);
+ }
+
+ @Test
+ public void readEntitySetWithNextLink() {
+ int count = 0;
+ for (Person people : container.getPeople().execute()) {
+ assertNotNull(people);
+ count++;
+ }
+ assertEquals(5, count);
+
+ int iterating = 0;
+ for (Person person : container.getPeople()) {
+ assertNotNull(person);
+ iterating++;
+ }
+ assertEquals(count + 1, iterating);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/EntityUpdateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/EntityUpdateTestITCase.java
new file mode 100644
index 0000000..fce3d85
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/EntityUpdateTestITCase.java
@@ -0,0 +1,193 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+
+import java.lang.reflect.Proxy;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.UUID;
+
+import org.apache.commons.lang3.RandomUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.ext.proxy.AbstractService;
+import org.apache.olingo.ext.proxy.commons.EntityInvocationHandler;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetail;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailKey;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddress;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
+import org.junit.Test;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+/**
+ * This is the unit test class to check entity update operations.
+ */
+public class EntityUpdateTestITCase extends AbstractTestITCase {
+
+ protected AbstractService<EdmEnabledODataClient> getService() {
+ return service;
+ }
+
+ protected InMemoryEntities getContainer() {
+ return container;
+ }
+
+ @Test
+ public void update() {
+ Person person = getContainer().getPeople().getByKey(1);
+
+ final Address address = person.getHomeAddress();
+ address.setCity("XXX");
+
+ getContainer().flush();
+
+ person = getContainer().getPeople().getByKey(1).load();
+ assertEquals("XXX", person.getHomeAddress().getCity());
+ }
+
+ @Test
+ public void multiKey() {
+ final OrderDetailKey orderDetailKey = new OrderDetailKey();
+ orderDetailKey.setOrderID(7);
+ orderDetailKey.setProductID(5);
+
+ OrderDetail orderDetail = getContainer().getOrderDetails().getByKey(orderDetailKey).load();
+ assertNotNull(orderDetail);
+ assertEquals(7, orderDetail.getOrderID(), 0);
+ assertEquals(5, orderDetail.getProductID(), 0);
+
+ orderDetail.setQuantity(5);
+
+ getContainer().flush();
+
+ orderDetail = getContainer().getOrderDetails().getByKey(orderDetailKey).load();
+ assertEquals(5, orderDetail.getQuantity(), 0);
+ }
+
+ @Test
+ public void patchLink() {
+ // 1. create customer
+ Customer customer = getContainer().newEntityInstance(Customer.class);
+ customer.setPersonID(977);
+ customer.setFirstName("Test");
+ customer.setLastName("Test");
+
+ final Address homeAddress = getContainer().newComplexInstance(CompanyAddress.class);
+ homeAddress.setStreet("V.le Gabriele D'Annunzio");
+ homeAddress.setCity("Pescara");
+ homeAddress.setPostalCode("65127");
+ customer.setHomeAddress(homeAddress);
+
+ customer.setNumbers(getContainer().newPrimitiveCollection(String.class)); // empty
+ customer.setEmails(getContainer().newPrimitiveCollection(String.class)); // empty
+ customer.setCity("Pescara");
+
+ final Calendar birthday = Calendar.getInstance();
+ birthday.clear();
+ birthday.set(1977, 8, 8);
+ customer.setBirthday(new Timestamp(birthday.getTimeInMillis()));
+
+ customer.setTimeBetweenLastTwoOrders(BigDecimal.valueOf(0.0000002));
+
+ // 2. create order and set it to customer
+ final int orderId = RandomUtils.nextInt(400, 410);
+
+ Order order = getContainer().newEntityInstance(Order.class);
+ order.setOrderID(orderId);
+
+ final OrderCollection orders = getContainer().newEntityCollection(OrderCollection.class);
+ orders.add(order);
+
+ customer.setOrders(orders);
+ order.setCustomerForOrder(customer);
+
+ getContainer().getCustomers().add(customer);
+ getContainer().flush();
+
+ assertEquals(977, order.getCustomerForOrder().load().getPersonID(), 0);
+ // order.getCustomerForOrder().load() caches Customer ... test server doesn't support something like the following
+ // <service>/Orders(400)/CustomerForOrder/Orders
+ // detach all and check for stored data ..
+ getService().getContext().detachAll();
+
+ // 3. check everything after flush
+ order = getContainer().getOrders().getByKey(orderId).load();
+ assertEquals(orderId, order.getOrderID(), 0);
+
+ customer = getContainer().getCustomers().getByKey(977);
+
+ // assertEquals(1, customer.getOrders().size());
+
+ int count = 0;
+ for (Order inside : customer.getOrders().execute()) {
+ if (inside.getOrderID() == orderId) {
+ count++;
+ }
+ }
+ assertEquals(1, count);
+ assertEquals(977, order.getCustomerForOrder().load().getPersonID(), 0);
+
+ // 4. delete customer and order
+ getContainer().getCustomers().delete(977);
+ getContainer().getOrders().delete(orderId);
+
+ getContainer().flush();
+ }
+
+ @Test
+ public void concurrentModification() {
+ Order order = getContainer().getOrders().getByKey(8).load();
+ final String etag = ((EntityInvocationHandler) Proxy.getInvocationHandler(order)).getETag();
+ assertTrue(StringUtils.isNotBlank(etag));
+
+ order.setShelfLife(BigDecimal.TEN);
+
+ getContainer().flush();
+
+ order = getContainer().getOrders().getByKey(8).load();
+ assertEquals(BigDecimal.TEN, order.getShelfLife());
+ }
+
+ @Test
+ public void contained() {
+ PaymentInstrument instrument =
+ getContainer().getAccounts().getByKey(101).getMyPaymentInstruments().getByKey(101901);
+
+ final String newName = UUID.randomUUID().toString();
+ instrument.setFriendlyName(newName);
+
+ getContainer().flush();
+
+ instrument = getContainer().getAccounts().getByKey(101).getMyPaymentInstruments().getByKey(101901).load();
+ assertEquals(newName, instrument.getFriendlyName());
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/FilterTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/FilterTestITCase.java
new file mode 100644
index 0000000..d9f3c9d
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/FilterTestITCase.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.ext.proxy.api.Search;
+import org.apache.olingo.ext.proxy.api.Sort;
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.People;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection;
+import org.junit.Test;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public class FilterTestITCase extends AbstractTestITCase {
+
+ @Test
+ public void testFilterWithEntityType() {
+ final People people = container.getPeople();
+ final EmployeeCollection response = people.filter(service.getClient().getFilterFactory().lt("PersonID", 4))
+ .execute(EmployeeCollection.class);
+
+ assertEquals(1, response.size());
+
+ for (final Employee employee : response) {
+ assertEquals(Integer.valueOf(3), employee.getPersonID());
+ }
+ }
+
+ @Test
+ public void filterOrderby() {
+ final People people = container.getPeople();
+
+ PersonCollection result =
+ people.filter(service.getClient().getFilterFactory().lt("PersonID", 3)).execute();
+
+ // 1. check that result looks as expected
+ assertEquals(2, result.size());
+
+ // 2. extract PersonID values - sorted ASC by default
+ final List<Integer> former = new ArrayList<Integer>(2);
+ for (Person person : result) {
+ final Integer personID = person.getPersonID();
+ assertTrue(personID < 3);
+ former.add(personID);
+ }
+
+ // 3. add orderby clause to filter above
+ result = people.orderBy(new Sort("PersonID", Sort.Direction.DESC)).execute();
+ assertEquals(2, result.size());
+
+ // 4. extract again VIN value - now they were required to be sorted DESC
+ final List<Integer> latter = new ArrayList<Integer>(2);
+ for (Person person : result) {
+ final Integer personID = person.getPersonID();
+ assertTrue(personID < 3);
+ latter.add(personID);
+ }
+
+ // 5. reverse latter and expect to be equal to former
+ Collections.reverse(latter);
+ assertEquals(former, latter);
+ }
+
+ @Test
+ public void search() {
+ final Search<Person, PersonCollection> search = container.getPeople().createSearch().setSearch(
+ service.getClient().getSearchFactory().or(
+ service.getClient().getSearchFactory().literal("Bob"),
+ service.getClient().getSearchFactory().literal("Jill")));
+
+ final PersonCollection result = search.getResult();
+ assertFalse(result.isEmpty());
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/KeyAsSegmentTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/KeyAsSegmentTestITCase.java
new file mode 100644
index 0000000..bc57529
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/KeyAsSegmentTestITCase.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.fit.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.fit.proxy.staticservice.Service;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
+import org.junit.Test;
+
+public class KeyAsSegmentTestITCase extends AbstractTestITCase {
+
+ private Service<EdmEnabledODataClient> ecf;
+
+ private InMemoryEntities ime;
+
+ protected Service<EdmEnabledODataClient> getService() {
+ if (ecf == null) {
+ ecf = Service.getV4(testKeyAsSegmentServiceRootURL);
+ ecf.getClient().getConfiguration().setKeyAsSegment(true);
+ ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ }
+ return ecf;
+ }
+
+ protected InMemoryEntities getContainer() {
+ if (ime == null) {
+ ime = getService().getEntityContainer(InMemoryEntities.class);
+ }
+ return ime;
+ }
+
+ @Test
+ public void read() {
+ assertNotNull(getContainer().getAccounts().getByKey(101));
+ }
+
+ @Test
+ public void createAndDelete() {
+ createPatchAndDeleteOrder(getContainer(), getService());
+ }
+
+ @Test
+ public void update() {
+ Person person = getContainer().getPeople().getByKey(5);
+ person.setMiddleName("middleN");
+
+ container.flush();
+
+ person = getContainer().getPeople().getByKey(5);
+ assertEquals("middleN", person.getMiddleName());
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/MediaEntityTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/MediaEntityTestITCase.java
new file mode 100644
index 0000000..f2cb7fb
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/MediaEntityTestITCase.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy;
+
+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.IOException;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.UUID;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.ext.proxy.api.EdmStreamValue;
+import org.apache.olingo.fit.proxy.demo.Service;
+import org.apache.olingo.fit.proxy.demo.odatademo.DemoService;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.Advertisement;
+import org.junit.Test;
+
+/**
+ * This is the unit test class to check media entity retrieve operations.
+ */
+public class MediaEntityTestITCase extends AbstractTestITCase {
+
+ private Service<EdmEnabledODataClient> ecf;
+
+ private DemoService ime;
+
+ protected Service<EdmEnabledODataClient> getService() {
+ if (ecf == null) {
+ ecf = Service.getV4(testDemoServiceRootURL);
+ ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ }
+ return ecf;
+ }
+
+ protected DemoService getContainer() {
+ if (ime == null) {
+ ime = getService().getEntityContainer(DemoService.class);
+ }
+ return ime;
+ }
+
+ @Test
+ public void read() throws IOException {
+ final UUID uuid = UUID.fromString("f89dee73-af9f-4cd4-b330-db93c25ff3c7");
+
+ final Advertisement adv = getContainer().getAdvertisements().getByKey(uuid);
+ assertNull(adv.getAirDate()); // No HTTP request --> property null
+
+ final EdmStreamValue res = adv.loadStream();
+ assertEquals("application/octet-stream", res.getContentType());
+ assertNotNull(res.getStream());
+ IOUtils.closeQuietly(res.getStream());
+
+ getService().getContext().detachAll();
+ }
+
+ @Test
+ public void update() throws IOException {
+ final UUID uuid = UUID.fromString("f89dee73-af9f-4cd4-b330-db93c25ff3c7");
+ final Advertisement adv = getContainer().getAdvertisements().getByKey(uuid);
+ final String random = RandomStringUtils.random(124, "abcdefghijklmnopqrstuvwxyz");
+ adv.uploadStream(getContainer().newEdmStreamValue("application/octet-stream", IOUtils.toInputStream(random)));
+ getContainer().flush();
+ assertEquals(random,
+ IOUtils.toString(getContainer().getAdvertisements().getByKey(uuid).loadStream().getStream()));
+ getService().getContext().detachAll();
+ }
+
+ @Test
+ public void create() throws IOException {
+ final String random = RandomStringUtils.random(124, "abcdefghijklmnopqrstuvwxyz");
+
+ final Advertisement adv = getContainer().newEntityInstance(Advertisement.class);
+ adv.uploadStream(getContainer().newEdmStreamValue("application/octet-stream", IOUtils.toInputStream(random)));
+ adv.setAirDate(new Timestamp(Calendar.getInstance().getTimeInMillis()));
+
+ getContainer().getAdvertisements().add(adv);
+ getContainer().flush();
+
+ final UUID uuid = adv.getID();
+ getService().getContext().detachAll();
+
+ assertEquals(random, IOUtils.toString(getContainer().getAdvertisements().getByKey(uuid).loadStream().getStream()));
+
+ getService().getContext().detachAll();
+
+ getContainer().getAdvertisements().delete(uuid);
+ getContainer().flush();
+
+ try {
+ getContainer().getAdvertisements().getByKey(uuid).load();
+ fail();
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+ getService().getContext().detachAll();
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/NonTransactionalAuthEntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/NonTransactionalAuthEntityCreateTestITCase.java
new file mode 100644
index 0000000..60c4c12
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/NonTransactionalAuthEntityCreateTestITCase.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.fit.proxy;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.fit.proxy.staticservice.Service;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+
+public class NonTransactionalAuthEntityCreateTestITCase extends EntityCreateTestITCase {
+
+ private Service<EdmEnabledODataClient> ecf;
+
+ private InMemoryEntities ime;
+
+ @Override
+ protected Service<EdmEnabledODataClient> getService() {
+ if (ecf == null) {
+ ecf = Service.getV4(testAuthServiceRootURL, false);
+ ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ ecf.getClient().getConfiguration().
+ setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
+ }
+ return ecf;
+ }
+
+ @Override
+ protected InMemoryEntities getContainer() {
+ if (ime == null) {
+ ime = getService().getEntityContainer(InMemoryEntities.class);
+ }
+ return ime;
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/NonTransactionalEntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/NonTransactionalEntityCreateTestITCase.java
new file mode 100644
index 0000000..9b797ce
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/NonTransactionalEntityCreateTestITCase.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.fit.proxy.staticservice.Service;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+
+public class NonTransactionalEntityCreateTestITCase extends EntityCreateTestITCase {
+
+ private Service<EdmEnabledODataClient> ecf;
+
+ private InMemoryEntities ime;
+
+ @Override
+ protected Service<EdmEnabledODataClient> getService() {
+ if (ecf == null) {
+ ecf = Service.getV4(testStaticServiceRootURL, false);
+ ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ }
+ return ecf;
+ }
+
+ @Override
+ protected InMemoryEntities getContainer() {
+ if (ime == null) {
+ ime = getService().getEntityContainer(InMemoryEntities.class);
+ }
+ return ime;
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/NonTransactionalEntityUpdateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/NonTransactionalEntityUpdateTestITCase.java
new file mode 100644
index 0000000..0ed093c
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/NonTransactionalEntityUpdateTestITCase.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.proxy;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.fit.proxy.staticservice.Service;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+
+public class NonTransactionalEntityUpdateTestITCase extends EntityUpdateTestITCase {
+
+ private Service<EdmEnabledODataClient> ecf;
+
+ private InMemoryEntities ime;
+
+ @Override
+ protected Service<EdmEnabledODataClient> getService() {
+ if (ecf == null) {
+ ecf = Service.getV4(testStaticServiceRootURL, false);
+ ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ }
+ return ecf;
+ }
+
+ @Override
+ protected InMemoryEntities getContainer() {
+ if (ime == null) {
+ ime = getService().getEntityContainer(InMemoryEntities.class);
+ }
+ return ime;
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/NonTransactionalMediaEntityTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/NonTransactionalMediaEntityTestITCase.java
new file mode 100644
index 0000000..e0b2bd3
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/NonTransactionalMediaEntityTestITCase.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.fit.proxy.demo.Service;
+import org.apache.olingo.fit.proxy.demo.odatademo.DemoService;
+
+public class NonTransactionalMediaEntityTestITCase extends MediaEntityTestITCase {
+
+ private Service<EdmEnabledODataClient> ecf;
+
+ private DemoService ime;
+
+ @Override
+ protected Service<EdmEnabledODataClient> getService() {
+ if (ecf == null) {
+ ecf = Service.getV4(testDemoServiceRootURL, false);
+ ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ }
+ return ecf;
+ }
+
+ @Override
+ protected DemoService getContainer() {
+ if (ime == null) {
+ ime = getService().getEntityContainer(DemoService.class);
+ }
+ return ime;
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/OpenTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/OpenTypeTestITCase.java
new file mode 100644
index 0000000..42626b5
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/OpenTypeTestITCase.java
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.UUID;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.ext.proxy.api.annotations.EntityType;
+import org.apache.olingo.fit.proxy.opentype.Service;
+import org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.DefaultContainer;
+import org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.AccountInfo;
+import org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.Color;
+import org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.ContactDetails;
+import org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.IndexedRow;
+import org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.Row;
+import org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.RowIndex;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class OpenTypeTestITCase extends AbstractTestITCase {
+
+ private static Service<EdmEnabledODataClient> otservice;
+
+ private static DefaultContainer otcontainer;
+
+ @BeforeClass
+ public static void initContainer() {
+ otservice = Service.getV4(testOpenTypeServiceRootURL);
+ otservice.getClient().getConfiguration().
+ setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ otcontainer = otservice.getEntityContainer(DefaultContainer.class);
+ assertNotNull(otcontainer);
+ }
+
+ @Test
+ public void checkOpenTypeEntityTypesExist() {
+ assertTrue(otcontainer.newEntityInstance(Row.class).getClass().getInterfaces()[0].
+ getAnnotation(EntityType.class).openType());
+ assertTrue(otcontainer.newEntityInstance(RowIndex.class).getClass().getInterfaces()[0].
+ getAnnotation(EntityType.class).openType());
+ assertTrue(otcontainer.newEntityInstance(IndexedRow.class).getClass().getInterfaces()[0].
+ getAnnotation(EntityType.class).openType());
+ otservice.getContext().detachAll();
+ }
+
+ @Test
+ public void read() {
+ Row row = otcontainer.getRow().getByKey(UUID.fromString("71f7d0dc-ede4-45eb-b421-555a2aa1e58f")).load();
+ assertEquals(Double.class, row.readAdditionalProperty("Double").getClass());
+ assertEquals("71f7d0dc-ede4-45eb-b421-555a2aa1e58f", row.getId().toString());
+
+ row = otcontainer.getRow().getByKey(UUID.fromString("672b8250-1e6e-4785-80cf-b94b572e42b3")).load();
+ assertEquals(BigDecimal.class, row.readAdditionalProperty("Decimal").getClass());
+ }
+
+ @Test
+ public void cud() throws ParseException {
+ final Integer id = 1426;
+
+ RowIndex rowIndex = otcontainer.newEntityInstance(RowIndex.class);
+ rowIndex.setId(id);
+ rowIndex.addAdditionalProperty("aString", "string");
+ rowIndex.addAdditionalProperty("aBoolean", true);
+ rowIndex.addAdditionalProperty("aDouble", 1.5D);
+ rowIndex.addAdditionalProperty("aByte", Byte.MAX_VALUE);
+ rowIndex.addAdditionalProperty("aDate", Calendar.getInstance());
+
+ final ContactDetails contact = otcontainer.newComplexInstance(ContactDetails.class);
+ contact.setFirstContacted("text".getBytes());
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTime(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").parse("2001-04-05T05:05:05.001"));
+
+ contact.setLastContacted(new Timestamp(cal.getTimeInMillis()));
+
+ cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTime(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").parse("2001-04-05T05:05:04.001"));
+ contact.setContacted(cal);
+
+ contact.setGUID(UUID.randomUUID());
+ contact.setPreferedContactTime(cal);
+ contact.setByte(Short.valueOf("24"));
+ contact.setSignedByte(Byte.MAX_VALUE);
+ contact.setDouble(Double.valueOf(Double.MAX_VALUE));
+ contact.setSingle(Float.MAX_VALUE);
+ contact.setShort(Short.MAX_VALUE);
+ contact.setInt(Integer.MAX_VALUE);
+ rowIndex.addAdditionalProperty("aContact", contact);
+ rowIndex.addAdditionalProperty("aColor", Color.Green);
+
+ final AccountInfo ai = otcontainer.newComplexInstance(AccountInfo.class);
+ ai.setFirstName("Fabio");
+ ai.setLastName("Martelli");
+ ai.addAdditionalProperty("email", "fabio.martelli@tirasa.net");
+ rowIndex.addAdditionalProperty("info", ai);
+
+ otcontainer.getRowIndex().add(rowIndex);
+ otcontainer.flush();
+
+ rowIndex = otcontainer.getRowIndex().getByKey(id).load();
+ assertEquals(String.class, rowIndex.readAdditionalProperty("aString").getClass());
+ assertEquals(Boolean.class, rowIndex.readAdditionalProperty("aBoolean").getClass());
+ assertEquals(Double.class, rowIndex.readAdditionalProperty("aDouble").getClass());
+ assertEquals(Byte.class, rowIndex.readAdditionalProperty("aByte").getClass());
+ assertEquals(Byte.MAX_VALUE, rowIndex.readAdditionalProperty("aByte"));
+ assertTrue(Calendar.class.isAssignableFrom(rowIndex.readAdditionalProperty("aDate").getClass()));
+ assertEquals(ContactDetails.class, rowIndex.readAdditionalProperty("aContact").getClass().getInterfaces()[0]);
+ assertEquals(Color.class, rowIndex.readAdditionalProperty("aColor").getClass());
+ assertEquals(Color.Green, rowIndex.readAdditionalProperty("aColor"));
+ assertEquals("Fabio", AccountInfo.class.cast(rowIndex.readAdditionalProperty("info")).getFirstName());
+ assertEquals("Martelli", AccountInfo.class.cast(rowIndex.readAdditionalProperty("info")).getLastName());
+ assertEquals("fabio.martelli@tirasa.net", AccountInfo.class.cast(rowIndex.readAdditionalProperty("info")).
+ readAdditionalProperty("email"));
+
+ otservice.getContext().detachAll();
+
+ otcontainer.getRowIndex().delete(id);
+ otcontainer.flush();
+
+ try {
+ otcontainer.getRowIndex().getByKey(id).load();
+ fail();
+ } catch (IllegalArgumentException e) {
+ // Expected
+ }
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/OperationImportInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/OperationImportInvokeTestITCase.java
new file mode 100644
index 0000000..e30ffb6
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/OperationImportInvokeTestITCase.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.fit.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types
+ .PersonComposableInvoker;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types
+ .ProductCollectionComposableInvoker;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color;
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddress;
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.junit.Assert;
+import org.junit.Test;
+
+public class OperationImportInvokeTestITCase extends AbstractTestITCase {
+
+ @Test
+ public void getDefaultColor() {
+ final Color color = container.operations().getDefaultColor().execute();
+ assertEquals(Color.Red, color);
+ }
+
+ @Test
+ public void getPerson2() {
+ final PersonComposableInvoker person = container.operations().getPerson2("London");
+ assertEquals(1, person.execute().getPersonID(), 0);
+ }
+
+ @Test
+ public void getPerson() {
+ final Address address = container.newComplexInstance(HomeAddress.class);
+ address.setStreet("1 Microsoft Way");
+ address.setPostalCode("98052");
+ address.setCity("London");
+
+ final PersonComposableInvoker person = container.operations().getPerson(address);
+ assertEquals(1, person.execute().getPersonID(), 0);
+ }
+
+ @Test
+ public void getAllProducts() {
+ final ProductCollectionComposableInvoker products = container.operations().getAllProducts();
+ Assert.assertEquals(5, products.execute().size());
+ }
+
+ @Test
+ public void getProductsByAccessLevel() {
+ final PrimitiveCollection<String> products =
+ container.operations().getProductsByAccessLevel(AccessLevel.None).execute();
+ assertEquals(5, products.size());
+ assertTrue(products.contains("Car"));
+ }
+
+ @Test
+ public void discount() {
+ container.operations().discount(22).execute();
+ }
+
+ @Test
+ public void resetBossAddress() {
+ final Address address = container.newComplexInstance(HomeAddress.class);
+ address.setStreet("Via Le Mani Dal Naso, 123");
+ address.setPostalCode("Tollo");
+ address.setCity("66010");
+
+ final Address actual = container.operations().resetBossAddress(address).execute();
+ assertEquals(address.getStreet(), actual.getStreet());
+ assertEquals(address.getPostalCode(), actual.getPostalCode());
+ assertEquals(address.getCity(), actual.getCity());
+ }
+
+ @Test
+ public void bossEmails() {
+ PrimitiveCollection<String> be = container.newPrimitiveCollection(String.class);
+ be.add("first@olingo.apache.org");
+ be.add("second@olingo.apache.org");
+
+ final PrimitiveCollection<String> result = container.operations().resetBossEmail(be).execute();
+ assertEquals(2, result.size());
+
+ final PrimitiveCollection<String> result2 = container.operations().getBossEmails(0, 100).execute();
+ assertEquals(result, result2);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/PropertyTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/PropertyTestITCase.java
new file mode 100644
index 0000000..015161a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/PropertyTestITCase.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.proxy;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import org.apache.olingo.ext.proxy.api.ODataFlushException;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI;
+import org.junit.Test;
+
+/**
+ * This is the unit test class to check actions overloading.
+ */
+public class PropertyTestITCase extends AbstractTestITCase {
+
+ @Test
+ public void nullNullableProperty() {
+ final Customer customer = container.getCustomers().getByKey(1);
+ customer.setFirstName(null);
+ container.flush();
+
+ assertNull(container.getCustomers().getByKey(1).getFirstName());
+ }
+
+ @Test
+ public void nullNonNullableProperty() {
+ final StoredPI storedPI = container.getStoredPIs().getByKey(1000);
+ storedPI.setPIName(null);
+
+ try {
+ container.flush();
+ fail();
+ } catch (ODataFlushException e) {
+ assertNotNull(e);
+ }
+ service.getContext().detachAll();
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/SingletonTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/SingletonTestITCase.java
new file mode 100644
index 0000000..fab7a14
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/SingletonTestITCase.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.fit.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.olingo.ext.proxy.api.Annotatable;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.IsBoss;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
+import org.junit.Test;
+
+public class SingletonTestITCase extends AbstractTestITCase {
+
+ @Test
+ public void read() {
+ final Company company = container.getCompany().load();
+ assertEquals(0, company.getCompanyID(), 0);
+ assertEquals(CompanyCategory.IT, company.getCompanyCategory());
+ }
+
+ @Test
+ public void update() {
+ final Company company = container.getCompany().load();
+ company.setRevenue(132520L);
+
+ container.flush();
+
+ assertEquals(132520L, container.getCompany().load().getRevenue(), 0);
+ }
+
+ @Test
+ public void readWithAnnotations() {
+ final Company company = container.getCompany().load();
+ assertTrue(company.readAnnotationTerms().isEmpty());
+
+ final Person boss = container.getBoss().load();
+ assertEquals(2, boss.getPersonID(), 0);
+
+ assertEquals(1, boss.readAnnotationTerms().size());
+ Object isBoss = boss.readAnnotation(IsBoss.class);
+ assertTrue(isBoss instanceof Boolean);
+ assertTrue((Boolean) isBoss);
+
+ Annotatable annotations = boss.annotations().getFirstNameAnnotations();
+ assertTrue(annotations.readAnnotationTerms().isEmpty());
+
+ annotations = boss.annotations().getLastNameAnnotations();
+ isBoss = annotations.readAnnotation(IsBoss.class);
+ assertTrue(isBoss instanceof Boolean);
+ assertFalse((Boolean) isBoss);
+
+ annotations = boss.annotations().getParentAnnotations();
+ isBoss = annotations.readAnnotation(IsBoss.class);
+ assertTrue(isBoss instanceof Boolean);
+ assertFalse((Boolean) isBoss);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/UnauthorizedEntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/UnauthorizedEntityCreateTestITCase.java
new file mode 100644
index 0000000..93906ef
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/UnauthorizedEntityCreateTestITCase.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.fit.proxy;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.http.HttpClientException;
+import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.fit.proxy.staticservice.Service;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
+import org.junit.Test;
+
+public class UnauthorizedEntityCreateTestITCase extends AbstractTestITCase {
+
+ private Service<EdmEnabledODataClient> ecf;
+
+ private InMemoryEntities ime;
+
+ public Service<EdmEnabledODataClient> getService() {
+ if (ecf == null) {
+ ecf = Service.getV4(testAuthServiceRootURL);
+ ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ ecf.getClient().getConfiguration().
+ setHttpClientFactory(new BasicAuthHttpClientFactory("not_auth", "not_auth"));
+ }
+ return ecf;
+ }
+
+ @Test(expected = HttpClientException.class)
+ public void unauthorizedCreate() {
+ createPatchAndDeleteOrder(getContainer(), getService());
+ }
+
+ protected InMemoryEntities getContainer() {
+ if (ime == null) {
+ ime = getService().getEntityContainer(InMemoryEntities.class);
+ }
+ return ime;
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/Service.java
new file mode 100644
index 0000000..4cbc29f
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/Service.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.fit.proxy.demo;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.ext.proxy.AbstractService;
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.Address;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.Advertisement;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.Category;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.Customer;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.Employee;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.FeaturedProduct;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.Person;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.PersonDetail;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.Product;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.ProductDetail;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.Supplier;
+
+public class Service<C extends EdmEnabledODataClient> extends AbstractService<C> {
+
+ // CHECKSTYLE:OFF (Maven checkstyle)
+ private static final String COMPRESSED_METADATA =
+ "H4sIAAAAAAAAAMVaDYwcVR1/t7f3fW2PaylShS6mFFrLbq+9lsJhy/Z2e6zs0eP2esHjw8zNvNsbmZ0Z3ry92yVS1ERiwA8aFCFVVKIEI42mRgIYI6ggmjQmfAUTglHRhAgGAyGKJvp/b753ZvZmrhUbcuzMzvt//N7v/b9mH3kTdRkE7dNINSvogriIs5oiq1UtKyoyVmlW1AjOYqmWbdSU7NJo9rrJ8iSmgiRQoVTTlco3v7/r+D/OqacQahB0WTwx+XmDEkGkHlmPfWff7JrfnPxuCnWUURoebFD0kTKIy5nicqa4nCkObso5eCgH0nJFeHgMlO9JphyWlSiudV73hzfu3//CW8wBHZAYiY0E08sgePh7Gwrfvv4eiZveT/ACJlgVsUHRUPmTwpKQq1NZyZVlgzIrdyW2sjG+Dt02c8mml1MoVUaDDK0KJksyV7E7HkYFz6KxMupZwsSQNZWiYdNERVCruQolsH6scQs6ijqN2LsJUHjFM0gu/9gd194g7niBQ9JjgICaYDCx3YDA5ckQ8Mr++ZufvfTEqfwxjsSwB4lZ0x+moq+Mzq4JjUL4l6ZzOtvp9czzLNucbJ4Qocl2qPGZ5867/1fCNzpRRwmlDflW3NARQh3LafYXFu2OjUmFe83Q2PS5u15MP/qLm1NoANAAl8AYEw3YTkFVNQq2zitsO9d5GDMp6LBVQ9YDsGaCaHXdXjjg3ndkiRpow42Zpo7te+vANJk2x2GvBVnFhKLL4jFmaTRX9C8FYwZMaV4FfVit13w3Fuqqz8UuiknNsYfCowW8IKuy+wyQYjQZKUxwH/rJvb9+6lPp2zkdugRFNkkGDOhThRo2QBz27jpFfYcZLwq4pvEn18KupvjephLtbZ47yPa29LvX77vp6ZGHU6hrDnXNa3VVKqM1JkwVTKcEumiZlGYmWZ/7dYHAFQBj4wJxg9aJyoCkaDT2Fk07q1hsuSK+AxaOeZd9u187fsQYe+JafmYD7LKCgg0a4qChRgdg2luQDREcpyGQ7o1t0ZSNCEN1/lRja26uluEbG8L0tEFkiaIdYThptRo86ABVxVquMl0qMHwuTUYyx6S/jx28L5+q/DKFuudQr1pXFAYYsAziTBmrVbpI0XpPIC2pFFf5gfFuep9OsCjbkegCYKwhCgq2LtLsYHjIypDt0Ykm1UWqw+ezHOZmp8y7gc0wY8P5CJ4elqw9mcJEBAeFKmZC+iCdZMG63buCixtGbIBgu1zisf2a/dOrj2eLNzwTDZDl5QoYsG1lnzcH8UC6zjzoZx4UtDoLl+z+OQFHmPtDJVUkWDBwRVAEImPDecqO5A5S/Xp8hHQLYnY3ze+mE9VOeZfIDLUTxc+/cXLXay9HnLjE5ZRH/Pa7/mL88Mk/l/gB6rulDrFxQcbEYmI3FUgVU39oPNslGPtjp9xW4JKQxDWIuXv1S3f/dudPX78lhTrLaIPrbrEBpDDMcqQUO/K563P5EFFjIW6nWSJynT43sMPg3Exs51wDspAiDSqoNMwQ5vnkP++euf3KsYv5bnBiUzS7Gk/bKdrCswCcqCVBqVsnh6Cp1fgTJJSr5ulLJr5EssX/sHqZU+doO9DAlVVgxl1B1r9h3lms5cUai67ZIhQc3i+Bu91m6UrRzplF2cjAf0LGEFgxlOGszhgmmzPLMl3MLGmiMF83AwMszhwG6/ljWchkuiI0s7MjcAYMkcg6M6zBibK3fRD2BpaxILPYjQPsT5Gi7XlFydjrM+CXzMNlRlYzdBFnNBUgxBmDwgYlM29jwLzcNawOWoWNg5aADBMQbYX5kT3jWrE5NJDkKnVdB1IQNxb3c8X9ccxZNymLRDO0BZoZ14ieBTVbXYumIB3IoskrsIpfGouYOM6vID09WTk0AyK3rCyyJMURuLOkLgH9NdLckbH93pHJS9B2URm4aMBtSHvwv0OyKkCzCMoviFR+NW4ua0Qy4mg+e5FS/fJcbnl5OauxBinLwgyIvyhSfJ7C4Zmvs8sjRImjZD0jMJGri0BfOLKwwVgCFbk4KjzEPS1/tkcqK2hivcYyuuVR5jRciibZDGtqDi8cMXBM0CI92RbNOiIvCWJzCmKq2Iyppnc0tyu3a+fIbpB8YaTksmDQSU1i2TEWoSON/3CkilINSioGf6MRLttfVcSvosbdLpcl131fufTA5hsfepvXnsOCPTdxGlUoSDUd81I1tJfonYc6ccYuNqEyUYUlucofgRiosxPr9Lb9uv9O8hrNY/y6Z2979MY3P3SxOfJyGgUzq0Lxn5cklg8Riij0QwHt4jfYSC/mOIy1XqZTTYbmgaEn9n91wx0PRdakMTs6p4eyZP+18s6FI3c/9uUU6vN0CHOop67KoiZhNtjCC0JdobNO+RLSPyTop9r0Eh0dulU0YEzdtsIsIsKx/Zq5Jj0OrEq0oqsCAOJES3rmZH0cMEm2aJy1e2Rl4xqszI0/KWgZAjGOXLP11cFN7527PoW6ymiNYM9CNELbDKf6nZmIMwqyB0X+tf0GmKNg6uHcRxPOTP0mv3Xn1j1vjTx/JIXSc2ijxbKWZyByKMKtzbImSCC+qDJyShAbPoEbFKuSPVZqPaWIdZAD7dul+FPUvAcNhvO2K5459dSJ6iu8Yeo2cba576AZblmwt6Fok1uXtbbHYS1zm6jdw2/0JJrvFG2DmWcn33jwvutLzw+CZ3PoA7IqKnUJl1QLRDuBh/JoUyA8Nw/KqmQzvTv5mMexbHnzD46fLL1wiLdp/e6oM2Lzw9oByL92Yd8RjZ87OzgUG79rotxmeD4wdM8N5xe++I7ZYOru0DHY6bNK0LH6EBZonWDJ7hacCpXBT9Fa37VZfz4J0WUcIlpVYyTxXdjf99olL0V9/qofvlxj6SpgOHkK6PBdW6x7nKJzAthGrGiDs7ffAdU9wU1y1A276iyHmj7f4mtxZK+gJgykM6RlyIMdSGWDlR7zQwINg+YKG/U13ktX1cZWVeHPx1fb3WpxGCPa8zS+snUtB8ALZpv4F7hhd7JJhmNuhcpO8LMnFi666djOf/FYHxL2ElalMavpfKBaHvrx+pcrf3z3bf4+I7Sa7lsUDFY5CTVfZd1aRnfejOEE7YmecjFD3He4XAE0ugwL8w3kMffAArZ6/PczPlk9+/aNHXsw+zyvZwctoJrTeCH0tYabtWNWz1OuQKZtw+8f+PdzJ156N/hCqjV5QMZNlQptKNXJb7DXsAdOI0cwo/YfLVa/declj7QO58N6IXZgofbC0MzHm08ethawl8q6QKjqTFs3Wm/CqSwofNhHoNJyqjxPSU7QlcnYGnRz9v6nfvSFD2b2A+5zaK1oVnXGDM99IVXbCpFd94SBkDrq/HFNUTCvxi4OZo1tbEXHGuRJg4k1hGQJR6o/f4aKto9NiOSorBqs7XhrgXhrAUTVV3g34uuR+MgwSe8y4BkKxVxoWjYwDeSDuFOwW6xh/noIrmbkGj68sGDgIApezUP83SVwVK1jaRVSTDO6p4GNatUH0sjetku6pghUuqGvtHzNGt93FMxU8GVY/dlmMuBJfSaRfEkzlEitStsTyicvPLJ1BAjMQzv7pivU0F6GqLWgbbhs9c4+A6F++U0I8SoIrKvJfrnt2UzXwiTnpMdSv3LHbkPXawcZ8HQl1Npnl1a42nQterDG94N1Xmg8tARuawvc/ySyuHDZwTMGyc4kXL3eoL1KsOw53vsZhu2Jo97yewPrdtu1vWXNHP3yn1ZtD0no5u8ynDeCVQzJbbpUoD975bZ7K4/UeeHbJ0HAVc1XwVfE/HHHBNYM6HihythSsFf7XoNeAHXNkkBkVvX4f6dxUNMgfahjDf1o+M/SQmwOU4esf8PWO9ECbNJE8fDEdH7qqo8zPM5y315aOk9lyKdf/Pp7f4O6dM6ytaF3WKkHdFSJoC82pzRZbZ96BqC0EuuE/eKwuRI7nINh9Vhn/Fj4WsbQo2FpDjkYEY3k/zN8jNcNqtV4+Ajpqduk2rZtp2X74AzU3kqxAQ2UYRo1wOsALMo1IZiTXKuKUNJrTYxP3yq7xfBY1W9Lb0F272hbFvZeJZPVFGFW+cRHjt7JNZ8AR2Pg41kMFveazyfissXUUBb79IdwObArrppu/lC3DzzbunhcNhd15qsm2L3s+YNNGoTLB/EEViVMXJ5ZYajteemaWtTU9yOFIEcd1XzqsFCLZoG/gEUdZziYtRa/4ZWkf/IUpMK5kcPWtufQjmx8dyfqsnTGUj2y9kkmic5ronFY5A0ApHM0uzNw/78+E7hjhjAAAA==";
+ private static final String METADATA_ETAG = null;
+ // CHECKSTYLE:ON (Maven checkstyle)
+
+ private static final Map<String, Service<?>> SERVICES = new ConcurrentHashMap<String, Service<?>>();
+
+ @SuppressWarnings("unchecked")
+ private static <C extends EdmEnabledODataClient> Service<C> getInstance(
+ final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
+
+ if (!SERVICES.containsKey(serviceRoot)) {
+ final Service<C> instance = new Service<C>(COMPRESSED_METADATA, METADATA_ETAG,
+ version, serviceRoot, transactional);
+ SERVICES.put(serviceRoot, instance);
+ }
+
+ return (Service<C>) SERVICES.get(serviceRoot);
+ }
+
+ /**
+ * Gives an OData 4.0 instance for given service root, operating in transactions (with batch requests).
+ *
+ * @param serviceRoot OData service root
+ * @return OData 4.0 instance for given service root, operating in transactions (with batch requests)
+ */
+ public static Service<org.apache.olingo.client.api.EdmEnabledODataClient> getV4(
+ final String serviceRoot) {
+
+ return getV4(serviceRoot, true);
+ }
+
+ /**
+ * Gives an OData 4.0 instance for given service root.
+ *
+ * @param serviceRoot OData service root
+ * @param transactional whether operating in transactions (with batch requests) or not
+ * @return OData 4.0 instance for given service root
+ */
+ public static Service<org.apache.olingo.client.api.EdmEnabledODataClient> getV4(
+ final String serviceRoot, final boolean transactional) {
+
+ return getInstance(ODataServiceVersion.V40, serviceRoot, transactional);
+ }
+
+ private final Map<String, Class<?>> entityTypes = new HashMap<String, Class<?>>();
+
+ private final Map<String, Class<?>> complexTypes = new HashMap<String, Class<?>>();
+
+ private final Map<String, Class<?>> enumTypes = new HashMap<String, Class<?>>();
+
+ private final Map<String, Class<? extends AbstractTerm>> terms = new HashMap<String, Class<? extends AbstractTerm>>();
+
+ public Service(final String compressedMetadata, final String metadataETag,
+ final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
+
+ super(compressedMetadata, metadataETag, version, serviceRoot, transactional);
+
+ // CHECKSTYLE:OFF (Maven checkstyle)
+ entityTypes.put("ODataDemo.Customer", Customer.class);
+ entityTypes.put("ODataDemo.PersonDetail", PersonDetail.class);
+ entityTypes.put("ODataDemo.ProductDetail", ProductDetail.class);
+ entityTypes.put("ODataDemo.Employee", Employee.class);
+ entityTypes.put("ODataDemo.Product", Product.class);
+ entityTypes.put("ODataDemo.Advertisement", Advertisement.class);
+ entityTypes.put("ODataDemo.Category", Category.class);
+ entityTypes.put("ODataDemo.Person", Person.class);
+ entityTypes.put("ODataDemo.Supplier", Supplier.class);
+ entityTypes.put("ODataDemo.FeaturedProduct",
+ FeaturedProduct.class);
+ complexTypes.put("ODataDemo.Address", Address.class);
+ // CHECKSTYLE:ON (Maven checkstyle)
+ }
+
+ @Override
+ public Class<?> getEntityTypeClass(final String name) {
+ return entityTypes.get(name);
+ }
+
+ @Override
+ public Class<?> getComplexTypeClass(final String name) {
+ return complexTypes.get(name);
+ }
+
+ @Override
+ public Class<?> getEnumTypeClass(final String name) {
+ return enumTypes.get(name);
+ }
+
+ @Override
+ public Class<? extends AbstractTerm> getTermClass(final String name) {
+ return terms.get(name);
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/Advertisements.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/Advertisements.java
new file mode 100644
index 0000000..a1e9a94
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/Advertisements.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.Advertisement;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.AdvertisementCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Advertisements", container = "ODataDemo.DemoService")
+public interface Advertisements
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Advertisement, AdvertisementCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Advertisements>,
+ AbstractEntitySet<Advertisement, java.util.UUID, AdvertisementCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/Categories.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/Categories.java
new file mode 100644
index 0000000..9aeb012
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/Categories.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.Category;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.CategoryCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Categories", container = "ODataDemo.DemoService")
+public interface Categories
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Category, CategoryCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Categories>,
+ AbstractEntitySet<Category, java.lang.Integer, CategoryCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/DemoService.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/DemoService.java
new file mode 100644
index 0000000..689a15e
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/DemoService.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.fit.proxy.demo.odatademo;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.io.InputStream;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import java.io.Serializable;
+
+import org.apache.olingo.ext.proxy.api.ComplexCollection;
+import org.apache.olingo.ext.proxy.api.ComplexType;
+import org.apache.olingo.ext.proxy.api.EdmStreamValue;
+import org.apache.olingo.ext.proxy.api.EntityCollection;
+import org.apache.olingo.ext.proxy.api.EntityType;
+import org.apache.olingo.ext.proxy.api.OperationType;
+import org.apache.olingo.ext.proxy.api.PersistenceManager;
+import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
+@org.apache.olingo.ext.proxy.api.annotations.EntityContainer(name = "DemoService",
+ namespace = "ODataDemo")
+public interface DemoService extends PersistenceManager {
+
+ Products getProducts();
+
+ Advertisements getAdvertisements();
+
+ Persons getPersons();
+
+ Categories getCategories();
+
+ PersonDetails getPersonDetails();
+
+ Suppliers getSuppliers();
+
+ ProductDetails getProductDetails();
+
+ Operations operations();
+
+ public interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "IncreaseSalaries",
+ type = OperationType.ACTION)
+ org.apache.olingo.ext.proxy.api.Invoker<Void> increaseSalaries(
+ @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "percentage", type = "Edm.Int32",
+ nullable = false) java.lang.Integer percentage
+ );
+
+ }
+
+ <NE extends EntityType<?>> NE newEntityInstance(Class<NE> ref);
+
+ <T extends EntityType<?>, NEC extends EntityCollection<T, ?, ?>> NEC newEntityCollection(Class<NEC> ref);
+
+ <NE extends ComplexType<?>> NE newComplexInstance(Class<NE> ref);
+
+ <T extends ComplexType<?>, NEC extends ComplexCollection<T, ?, ?>> NEC newComplexCollection(Class<NEC> ref);
+
+ <T extends Serializable, NEC extends PrimitiveCollection<T>> NEC newPrimitiveCollection(Class<T> ref);
+
+ EdmStreamValue newEdmStreamValue(String contentType, InputStream stream);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/PersonDetails.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/PersonDetails.java
new file mode 100644
index 0000000..7bbe19a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/PersonDetails.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.PersonDetail;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.PersonDetailCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "PersonDetails", container = "ODataDemo.DemoService")
+public interface PersonDetails
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<PersonDetail, PersonDetailCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<PersonDetails>,
+ AbstractEntitySet<PersonDetail, java.lang.Integer, PersonDetailCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/Persons.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/Persons.java
new file mode 100644
index 0000000..0168282
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/Persons.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.Person;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.PersonCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Persons", container = "ODataDemo.DemoService")
+public interface Persons
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Person, PersonCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Persons>,
+ AbstractEntitySet<Person, java.lang.Integer, PersonCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/ProductDetails.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/ProductDetails.java
new file mode 100644
index 0000000..af9d06f
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/ProductDetails.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.ProductDetail;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.ProductDetailCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "ProductDetails", container = "ODataDemo.DemoService")
+public interface ProductDetails
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<ProductDetail, ProductDetailCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ProductDetails>,
+ AbstractEntitySet<ProductDetail, java.lang.Integer, ProductDetailCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/Products.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/Products.java
new file mode 100644
index 0000000..ace5f49
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/Products.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.Product;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.ProductCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Products", container = "ODataDemo.DemoService")
+public interface Products
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Product, ProductCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Products>,
+ AbstractEntitySet<Product, java.lang.Integer, ProductCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/Suppliers.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/Suppliers.java
new file mode 100644
index 0000000..3293d39
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/Suppliers.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.Supplier;
+import org.apache.olingo.fit.proxy.demo.odatademo.types.SupplierCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Suppliers", container = "ODataDemo.DemoService")
+public interface Suppliers
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Supplier, SupplierCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Suppliers>,
+ AbstractEntitySet<Supplier, java.lang.Integer, SupplierCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/package-info.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/package-info.java
new file mode 100644
index 0000000..c9f8094
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo;
+
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Address.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Address.java
new file mode 100644
index 0000000..1310bf3
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Address.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.Annotatable;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
+@org.apache.olingo.ext.proxy.api.annotations.ComplexType(name = "Address",
+ isOpenType = false,
+ isAbstract = false)
+public interface Address
+ extends org.apache.olingo.ext.proxy.api.ComplexType<Address>,
+ org.apache.olingo.ext.proxy.api.StructuredQuery<Address> {
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getStreet();
+
+ void setStreet(java.lang.String _street);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCity();
+
+ void setCity(java.lang.String _city);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "State",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getState();
+
+ void setState(java.lang.String _state);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ZipCode",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getZipCode();
+
+ void setZipCode(java.lang.String _zipCode);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Country",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCountry();
+
+ void setCountry(java.lang.String _country);
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Street",
+ type = "Edm.String")
+ Annotatable getStreetAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "City",
+ type = "Edm.String")
+ Annotatable getCityAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "State",
+ type = "Edm.String")
+ Annotatable getStateAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ZipCode",
+ type = "Edm.String")
+ Annotatable getZipCodeAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Country",
+ type = "Edm.String")
+ Annotatable getCountryAnnotations();
+
+ }
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AddressCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AddressCollection.java
new file mode 100644
index 0000000..85bf84e
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AddressCollection.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface AddressCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<AddressCollection>,
+org.apache.olingo.ext.proxy.api.ComplexCollection<Address, AddressCollection, AddressCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AddressCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AddressCollectionComposableInvoker.java
new file mode 100644
index 0000000..34e8a67
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AddressCollectionComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface AddressCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<AddressCollection, AddressCollection.Operations> {
+
+ @Override
+ AddressCollectionComposableInvoker select(String... select);
+
+ @Override
+ AddressCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AddressComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AddressComposableInvoker.java
new file mode 100644
index 0000000..bc22a11
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AddressComposableInvoker.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface AddressComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Address, Address.Operations>
+{
+
+ @Override
+ AddressComposableInvoker select(String... select);
+
+ @Override
+ AddressComposableInvoker expand(String... expand);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getStreet();
+
+ void setStreet(java.lang.String _street);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCity();
+
+ void setCity(java.lang.String _city);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "State",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getState();
+
+ void setState(java.lang.String _state);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ZipCode",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getZipCode();
+
+ void setZipCode(java.lang.String _zipCode);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Country",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCountry();
+
+ void setCountry(java.lang.String _country);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Advertisement.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Advertisement.java
new file mode 100644
index 0000000..df7a8e0
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Advertisement.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Advertisement",
+ openType = false,
+ hasStream = true,
+ isAbstract = false)
+public interface Advertisement
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Advertisement>,
+ org.apache.olingo.ext.proxy.api.StructuredQuery<Advertisement> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Guid",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.util.UUID getID();
+
+ void setID(java.util.UUID _iD);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AirDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getAirDate();
+
+ void setAirDate(java.sql.Timestamp _airDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "FeaturedProduct",
+ type = "ODataDemo.FeaturedProduct",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Products",
+ containsTarget = false)
+ FeaturedProduct getFeaturedProduct();
+
+ void setFeaturedProduct(FeaturedProduct _featuredProduct);
+
+ void uploadStream(org.apache.olingo.ext.proxy.api.EdmStreamValue stream);
+
+ org.apache.olingo.ext.proxy.api.EdmStreamValue loadStream();
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
+ type = "Edm.Guid")
+ org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "AirDate",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getAirDateAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "FeaturedProduct",
+ type = "ODataDemo.FeaturedProduct")
+ org.apache.olingo.ext.proxy.api.Annotatable getFeaturedProductAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AdvertisementCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AdvertisementCollection.java
new file mode 100644
index 0000000..12daaeb
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AdvertisementCollection.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface AdvertisementCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<AdvertisementCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Advertisement, AdvertisementCollection, AdvertisementCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AdvertisementCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AdvertisementCollectionComposableInvoker.java
new file mode 100644
index 0000000..cba307e
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AdvertisementCollectionComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface AdvertisementCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<AdvertisementCollection, AdvertisementCollection.Operations> {
+
+ @Override
+ AdvertisementCollectionComposableInvoker select(String... select);
+
+ @Override
+ AdvertisementCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AdvertisementComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AdvertisementComposableInvoker.java
new file mode 100644
index 0000000..7137eae
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/AdvertisementComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface AdvertisementComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Advertisement, Advertisement.Operations>
+{
+
+ @Override
+ AdvertisementComposableInvoker select(String... select);
+
+ @Override
+ AdvertisementComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Guid",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.util.UUID getID();
+
+ void setID(java.util.UUID _iD);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AirDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getAirDate();
+
+ void setAirDate(java.sql.Timestamp _airDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "FeaturedProduct",
+ type = "ODataDemo.FeaturedProduct",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Products",
+ containsTarget = false)
+ FeaturedProduct getFeaturedProduct();
+
+ void setFeaturedProduct(FeaturedProduct _featuredProduct);
+
+ void uploadStream(org.apache.olingo.ext.proxy.api.EdmStreamValue stream);
+
+ org.apache.olingo.ext.proxy.api.EdmStreamValue loadStream();
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Category.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Category.java
new file mode 100644
index 0000000..4283f83
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Category.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Category",
+ openType = true,
+ hasStream = false,
+ isAbstract = false)
+public interface Category
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Category>, org.apache.olingo.ext.proxy.api.StructuredQuery<Category>,
+ AbstractOpenType {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getID();
+
+ void setID(java.lang.Integer _iD);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Products",
+ type = "ODataDemo.Product",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Products",
+ containsTarget = false)
+ ProductCollection getProducts();
+
+ void setProducts(ProductCollection _products);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Products",
+ type = "ODataDemo.Product")
+ org.apache.olingo.ext.proxy.api.Annotatable getProductsAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CategoryCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CategoryCollection.java
new file mode 100644
index 0000000..0c93867
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CategoryCollection.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface CategoryCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<CategoryCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Category, CategoryCollection, CategoryCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CategoryCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CategoryCollectionComposableInvoker.java
new file mode 100644
index 0000000..d5680f8
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CategoryCollectionComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface CategoryCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<CategoryCollection, CategoryCollection.Operations> {
+
+ @Override
+ CategoryCollectionComposableInvoker select(String... select);
+
+ @Override
+ CategoryCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CategoryComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CategoryComposableInvoker.java
new file mode 100644
index 0000000..4964587
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CategoryComposableInvoker.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+public interface CategoryComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Category, Category.Operations>
+ , AbstractOpenType {
+
+ @Override
+ CategoryComposableInvoker select(String... select);
+
+ @Override
+ CategoryComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getID();
+
+ void setID(java.lang.Integer _iD);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Products",
+ type = "ODataDemo.Product",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Products",
+ containsTarget = false)
+ ProductCollection getProducts();
+
+ void setProducts(ProductCollection _products);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Customer.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Customer.java
new file mode 100644
index 0000000..405ce0a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Customer.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.concurrent.Future;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Customer",
+ openType = false,
+ hasStream = false,
+ isAbstract = false,
+ baseType = "ODataDemo.Person")
+public interface Customer
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ Person {
+
+ @Override
+ Customer load();
+
+ @Override
+ Future<? extends Customer> loadAsync();
+
+ @Override
+ Customer refs();
+
+ @Override
+ Customer expand(String... expand);
+
+ @Override
+ Customer select(String... select);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ @Override
+ java.lang.Integer getID();
+
+ @Override
+ void setID(java.lang.Integer _iD);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ @Override
+ java.lang.String getName();
+
+ @Override
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TotalExpense",
+ type = "Edm.Decimal",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.math.BigDecimal getTotalExpense();
+
+ void setTotalExpense(java.math.BigDecimal _totalExpense);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "PersonDetail",
+ type = "ODataDemo.PersonDetail",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "PersonDetails",
+ containsTarget = false)
+ PersonDetail getPersonDetail();
+
+ @Override
+ void setPersonDetail(PersonDetail _personDetail);
+
+ @Override
+ Operations operations();
+
+ interface Operations extends Person.Operations {
+ // No additional methods needed for now.
+ }
+
+ @Override
+ Annotations annotations();
+
+ interface Annotations extends Person.Annotations {
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "TotalExpense",
+ type = "Edm.Decimal")
+ org.apache.olingo.ext.proxy.api.Annotatable getTotalExpenseAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "PersonDetail",
+ type = "ODataDemo.PersonDetail")
+ org.apache.olingo.ext.proxy.api.Annotatable getPersonDetailAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CustomerCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CustomerCollection.java
new file mode 100644
index 0000000..6ce29da
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CustomerCollection.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface CustomerCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<CustomerCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Customer, CustomerCollection, CustomerCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CustomerCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CustomerCollectionComposableInvoker.java
new file mode 100644
index 0000000..537ee8a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CustomerCollectionComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface CustomerCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<CustomerCollection, CustomerCollection.Operations> {
+
+ @Override
+ CustomerCollectionComposableInvoker select(String... select);
+
+ @Override
+ CustomerCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CustomerComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CustomerComposableInvoker.java
new file mode 100644
index 0000000..4e6e7e2
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/CustomerComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface CustomerComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Customer, Customer.Operations>
+{
+
+ @Override
+ CustomerComposableInvoker select(String... select);
+
+ @Override
+ CustomerComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getID();
+
+ void setID(java.lang.Integer _iD);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TotalExpense",
+ type = "Edm.Decimal",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.math.BigDecimal getTotalExpense();
+
+ void setTotalExpense(java.math.BigDecimal _totalExpense);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "PersonDetail",
+ type = "ODataDemo.PersonDetail",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "PersonDetails",
+ containsTarget = false)
+ PersonDetail getPersonDetail();
+
+ void setPersonDetail(PersonDetail _personDetail);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Employee.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Employee.java
new file mode 100644
index 0000000..4b55f53
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Employee.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.concurrent.Future;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Employee",
+ openType = false,
+ hasStream = false,
+ isAbstract = false,
+ baseType = "ODataDemo.Person")
+public interface Employee
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ Person {
+
+ @Override
+ Employee load();
+
+ @Override
+ Future<? extends Employee> loadAsync();
+
+ @Override
+ Employee refs();
+
+ @Override
+ Employee expand(String... expand);
+
+ @Override
+ Employee select(String... select);
+
+ @Override
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getID();
+
+ @Override
+ void setID(java.lang.Integer _iD);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ @Override
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "EmployeeID",
+ type = "Edm.Int64",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Long getEmployeeID();
+
+ void setEmployeeID(java.lang.Long _employeeID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HireDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getHireDate();
+
+ void setHireDate(java.sql.Timestamp _hireDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Salary",
+ type = "Edm.Single",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Float getSalary();
+
+ void setSalary(java.lang.Float _salary);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "PersonDetail",
+ type = "ODataDemo.PersonDetail",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "PersonDetails",
+ containsTarget = false)
+ PersonDetail getPersonDetail();
+
+ @Override
+ void setPersonDetail(PersonDetail _personDetail);
+
+ @Override
+ Operations operations();
+
+ interface Operations extends Person.Operations {
+ // No additional methods needed for now.
+ }
+
+ @Override
+ Annotations annotations();
+
+ interface Annotations extends Person.Annotations {
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "EmployeeID",
+ type = "Edm.Int64")
+ org.apache.olingo.ext.proxy.api.Annotatable getEmployeeIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "HireDate",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getHireDateAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Salary",
+ type = "Edm.Single")
+ org.apache.olingo.ext.proxy.api.Annotatable getSalaryAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "PersonDetail",
+ type = "ODataDemo.PersonDetail")
+ org.apache.olingo.ext.proxy.api.Annotatable getPersonDetailAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/EmployeeCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/EmployeeCollection.java
new file mode 100644
index 0000000..c3d8c0d
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/EmployeeCollection.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface EmployeeCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<EmployeeCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Employee, EmployeeCollection, EmployeeCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/EmployeeCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/EmployeeCollectionComposableInvoker.java
new file mode 100644
index 0000000..d491887
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/EmployeeCollectionComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface EmployeeCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<EmployeeCollection, EmployeeCollection.Operations> {
+
+ @Override
+ EmployeeCollectionComposableInvoker select(String... select);
+
+ @Override
+ EmployeeCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/EmployeeComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/EmployeeComposableInvoker.java
new file mode 100644
index 0000000..64639cd
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/EmployeeComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface EmployeeComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Employee, Employee.Operations>
+{
+
+ @Override
+ EmployeeComposableInvoker select(String... select);
+
+ @Override
+ EmployeeComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getID();
+
+ void setID(java.lang.Integer _iD);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "EmployeeID",
+ type = "Edm.Int64",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Long getEmployeeID();
+
+ void setEmployeeID(java.lang.Long _employeeID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HireDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getHireDate();
+
+ void setHireDate(java.sql.Timestamp _hireDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Salary",
+ type = "Edm.Single",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Float getSalary();
+
+ void setSalary(java.lang.Float _salary);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "PersonDetail",
+ type = "ODataDemo.PersonDetail",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "PersonDetails",
+ containsTarget = false)
+ PersonDetail getPersonDetail();
+
+ void setPersonDetail(PersonDetail _personDetail);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/FeaturedProduct.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/FeaturedProduct.java
new file mode 100644
index 0000000..0d09511
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/FeaturedProduct.java
@@ -0,0 +1,285 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.concurrent.Future;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "FeaturedProduct",
+ openType = false,
+ hasStream = false,
+ isAbstract = false,
+ baseType = "ODataDemo.Product")
+public interface FeaturedProduct
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ Product {
+
+ @Override
+ FeaturedProduct load();
+
+ @Override
+ Future<? extends FeaturedProduct> loadAsync();
+
+ @Override
+ FeaturedProduct refs();
+
+ @Override
+ FeaturedProduct expand(String... expand);
+
+ @Override
+ FeaturedProduct select(String... select);
+
+ @Override
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getID();
+
+ @Override
+ void setID(java.lang.Integer _iD);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ @Override
+ void setName(java.lang.String _name);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Description",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getDescription();
+
+ @Override
+ void setDescription(java.lang.String _description);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ReleaseDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getReleaseDate();
+
+ @Override
+ void setReleaseDate(java.sql.Timestamp _releaseDate);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DiscontinuedDate",
+ type = "Edm.DateTimeOffset",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getDiscontinuedDate();
+
+ @Override
+ void setDiscontinuedDate(java.sql.Timestamp _discontinuedDate);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Rating",
+ type = "Edm.Int16",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Short getRating();
+
+ @Override
+ void setRating(java.lang.Short _rating);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Price",
+ type = "Edm.Double",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Double getPrice();
+
+ @Override
+ void setPrice(java.lang.Double _price);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Categories",
+ type = "ODataDemo.Category",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Categories",
+ containsTarget = false)
+ CategoryCollection getCategories();
+
+ @Override
+ void setCategories(CategoryCollection _categories);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Supplier",
+ type = "ODataDemo.Supplier",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Suppliers",
+ containsTarget = false)
+ Supplier getSupplier();
+
+ @Override
+ void setSupplier(Supplier _supplier);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ProductDetail",
+ type = "ODataDemo.ProductDetail",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "ProductDetails",
+ containsTarget = false)
+ ProductDetail getProductDetail();
+
+ @Override
+ void setProductDetail(ProductDetail _productDetail);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Advertisement",
+ type = "ODataDemo.Advertisement",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Advertisements",
+ containsTarget = false)
+ Advertisement getAdvertisement();
+
+ void setAdvertisement(Advertisement _advertisement);
+
+ @Override
+ Operations operations();
+
+ interface Operations extends Product.Operations {
+ // No additional methods needed for now.
+ }
+
+ @Override
+ Annotations annotations();
+
+ interface Annotations extends Product.Annotations {
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Description",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getDescriptionAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ReleaseDate",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getReleaseDateAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "DiscontinuedDate",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getDiscontinuedDateAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Rating",
+ type = "Edm.Int16")
+ org.apache.olingo.ext.proxy.api.Annotatable getRatingAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Price",
+ type = "Edm.Double")
+ org.apache.olingo.ext.proxy.api.Annotatable getPriceAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Categories",
+ type = "ODataDemo.Category")
+ org.apache.olingo.ext.proxy.api.Annotatable getCategoriesAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Supplier",
+ type = "ODataDemo.Supplier")
+ org.apache.olingo.ext.proxy.api.Annotatable getSupplierAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "ProductDetail",
+ type = "ODataDemo.ProductDetail")
+ org.apache.olingo.ext.proxy.api.Annotatable getProductDetailAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Advertisement",
+ type = "ODataDemo.Advertisement")
+ org.apache.olingo.ext.proxy.api.Annotatable getAdvertisementAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/FeaturedProductCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/FeaturedProductCollection.java
new file mode 100644
index 0000000..ed87bc8
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/FeaturedProductCollection.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface FeaturedProductCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<FeaturedProductCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<FeaturedProduct, FeaturedProductCollection, FeaturedProductCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/FeaturedProductCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/FeaturedProductCollectionComposableInvoker.java
new file mode 100644
index 0000000..d2dd740
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/FeaturedProductCollectionComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface FeaturedProductCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<FeaturedProductCollection, FeaturedProductCollection.Operations> {
+
+ @Override
+ FeaturedProductCollectionComposableInvoker select(String... select);
+
+ @Override
+ FeaturedProductCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/FeaturedProductComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/FeaturedProductComposableInvoker.java
new file mode 100644
index 0000000..8719896
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/FeaturedProductComposableInvoker.java
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface FeaturedProductComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<FeaturedProduct, FeaturedProduct.Operations>
+{
+
+ @Override
+ FeaturedProductComposableInvoker select(String... select);
+
+ @Override
+ FeaturedProductComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getID();
+
+ void setID(java.lang.Integer _iD);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Description",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getDescription();
+
+ void setDescription(java.lang.String _description);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ReleaseDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getReleaseDate();
+
+ void setReleaseDate(java.sql.Timestamp _releaseDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DiscontinuedDate",
+ type = "Edm.DateTimeOffset",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getDiscontinuedDate();
+
+ void setDiscontinuedDate(java.sql.Timestamp _discontinuedDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Rating",
+ type = "Edm.Int16",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Short getRating();
+
+ void setRating(java.lang.Short _rating);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Price",
+ type = "Edm.Double",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Double getPrice();
+
+ void setPrice(java.lang.Double _price);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Categories",
+ type = "ODataDemo.Category",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Categories",
+ containsTarget = false)
+ CategoryCollection getCategories();
+
+ void setCategories(CategoryCollection _categories);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Supplier",
+ type = "ODataDemo.Supplier",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Suppliers",
+ containsTarget = false)
+ Supplier getSupplier();
+
+ void setSupplier(Supplier _supplier);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ProductDetail",
+ type = "ODataDemo.ProductDetail",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "ProductDetails",
+ containsTarget = false)
+ ProductDetail getProductDetail();
+
+ void setProductDetail(ProductDetail _productDetail);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Advertisement",
+ type = "ODataDemo.Advertisement",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Advertisements",
+ containsTarget = false)
+ Advertisement getAdvertisement();
+
+ void setAdvertisement(Advertisement _advertisement);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Person.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Person.java
new file mode 100644
index 0000000..006bae7
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Person.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Person",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface Person
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Person>, org.apache.olingo.ext.proxy.api.StructuredQuery<Person> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getID();
+
+ void setID(java.lang.Integer _iD);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "PersonDetail",
+ type = "ODataDemo.PersonDetail",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "PersonDetails",
+ containsTarget = false)
+ PersonDetail getPersonDetail();
+
+ void setPersonDetail(PersonDetail _personDetail);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "PersonDetail",
+ type = "ODataDemo.PersonDetail")
+ org.apache.olingo.ext.proxy.api.Annotatable getPersonDetailAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonCollection.java
new file mode 100644
index 0000000..87300ec
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonCollection.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface PersonCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<PersonCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Person, PersonCollection, PersonCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonCollectionComposableInvoker.java
new file mode 100644
index 0000000..febb164
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonCollectionComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface PersonCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<PersonCollection, PersonCollection.Operations> {
+
+ @Override
+ PersonCollectionComposableInvoker select(String... select);
+
+ @Override
+ PersonCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonComposableInvoker.java
new file mode 100644
index 0000000..2461c09
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface PersonComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Person, Person.Operations>
+{
+
+ @Override
+ PersonComposableInvoker select(String... select);
+
+ @Override
+ PersonComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getID();
+
+ void setID(java.lang.Integer _iD);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "PersonDetail",
+ type = "ODataDemo.PersonDetail",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "PersonDetails",
+ containsTarget = false)
+ PersonDetail getPersonDetail();
+
+ void setPersonDetail(PersonDetail _personDetail);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonDetail.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonDetail.java
new file mode 100644
index 0000000..6dca287
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonDetail.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "PersonDetail",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface PersonDetail
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<PersonDetail>,
+ org.apache.olingo.ext.proxy.api.StructuredQuery<PersonDetail> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getPersonID();
+
+ void setPersonID(java.lang.Integer _personID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Age",
+ type = "Edm.Byte",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Short getAge();
+
+ void setAge(java.lang.Short _age);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Gender",
+ type = "Edm.Boolean",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Boolean getGender();
+
+ void setGender(java.lang.Boolean _gender);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Phone",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getPhone();
+
+ void setPhone(java.lang.String _phone);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
+ type = "ODataDemo.Address",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Address getAddress();
+
+ void setAddress(Address _address);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Photo",
+ type = "Edm.Stream",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.EdmStreamValue getPhoto();
+
+ void setPhoto(org.apache.olingo.ext.proxy.api.EdmStreamValue _photo);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Person",
+ type = "ODataDemo.Person",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Persons",
+ containsTarget = false)
+ Person getPerson();
+
+ void setPerson(Person _person);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PersonID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getPersonIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Age",
+ type = "Edm.Byte")
+ org.apache.olingo.ext.proxy.api.Annotatable getAgeAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Gender",
+ type = "Edm.Boolean")
+ org.apache.olingo.ext.proxy.api.Annotatable getGenderAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Phone",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getPhoneAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Address",
+ type = "ODataDemo.Address")
+ org.apache.olingo.ext.proxy.api.Annotatable getAddressAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Photo",
+ type = "Edm.Stream")
+ org.apache.olingo.ext.proxy.api.Annotatable getPhotoAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Person",
+ type = "ODataDemo.Person")
+ org.apache.olingo.ext.proxy.api.Annotatable getPersonAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonDetailCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonDetailCollection.java
new file mode 100644
index 0000000..c46df2a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonDetailCollection.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface PersonDetailCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<PersonDetailCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<PersonDetail, PersonDetailCollection, PersonDetailCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonDetailCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonDetailCollectionComposableInvoker.java
new file mode 100644
index 0000000..414955a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonDetailCollectionComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface PersonDetailCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<PersonDetailCollection, PersonDetailCollection.Operations> {
+
+ @Override
+ PersonDetailCollectionComposableInvoker select(String... select);
+
+ @Override
+ PersonDetailCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonDetailComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonDetailComposableInvoker.java
new file mode 100644
index 0000000..547f4b9
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/PersonDetailComposableInvoker.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface PersonDetailComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<PersonDetail, PersonDetail.Operations>
+{
+
+ @Override
+ PersonDetailComposableInvoker select(String... select);
+
+ @Override
+ PersonDetailComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getPersonID();
+
+ void setPersonID(java.lang.Integer _personID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Age",
+ type = "Edm.Byte",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Short getAge();
+
+ void setAge(java.lang.Short _age);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Gender",
+ type = "Edm.Boolean",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Boolean getGender();
+
+ void setGender(java.lang.Boolean _gender);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Phone",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getPhone();
+
+ void setPhone(java.lang.String _phone);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
+ type = "ODataDemo.Address",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Address getAddress();
+
+ void setAddress(Address _address);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Photo",
+ type = "Edm.Stream",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.EdmStreamValue getPhoto();
+
+ void setPhoto(org.apache.olingo.ext.proxy.api.EdmStreamValue _photo);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Person",
+ type = "ODataDemo.Person",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Persons",
+ containsTarget = false)
+ Person getPerson();
+
+ void setPerson(Person _person);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Product.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Product.java
new file mode 100644
index 0000000..4fe5121
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Product.java
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.OperationType;
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Product",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface Product
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Product>, org.apache.olingo.ext.proxy.api.StructuredQuery<Product> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getID();
+
+ void setID(java.lang.Integer _iD);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Description",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getDescription();
+
+ void setDescription(java.lang.String _description);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ReleaseDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getReleaseDate();
+
+ void setReleaseDate(java.sql.Timestamp _releaseDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DiscontinuedDate",
+ type = "Edm.DateTimeOffset",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getDiscontinuedDate();
+
+ void setDiscontinuedDate(java.sql.Timestamp _discontinuedDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Rating",
+ type = "Edm.Int16",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Short getRating();
+
+ void setRating(java.lang.Short _rating);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Price",
+ type = "Edm.Double",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Double getPrice();
+
+ void setPrice(java.lang.Double _price);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Categories",
+ type = "ODataDemo.Category",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Categories",
+ containsTarget = false)
+ CategoryCollection getCategories();
+
+ void setCategories(CategoryCollection _categories);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Supplier",
+ type = "ODataDemo.Supplier",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Suppliers",
+ containsTarget = false)
+ Supplier getSupplier();
+
+ void setSupplier(Supplier _supplier);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ProductDetail",
+ type = "ODataDemo.ProductDetail",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "ProductDetails",
+ containsTarget = false)
+ ProductDetail getProductDetail();
+
+ void setProductDetail(ProductDetail _productDetail);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "Discount",
+ type = OperationType.ACTION,
+ referenceType = java.lang.Double.class, returnType = "Edm.Double")
+ org.apache.olingo.ext.proxy.api.Invoker<java.lang.Double>
+ discount(
+ @Parameter(name = "discountPercentage", type = "Edm.Int32", nullable = false) java.lang.Integer discountPercentage
+ );
+
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Description",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getDescriptionAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ReleaseDate",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getReleaseDateAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "DiscontinuedDate",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getDiscontinuedDateAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Rating",
+ type = "Edm.Int16")
+ org.apache.olingo.ext.proxy.api.Annotatable getRatingAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Price",
+ type = "Edm.Double")
+ org.apache.olingo.ext.proxy.api.Annotatable getPriceAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Categories",
+ type = "ODataDemo.Category")
+ org.apache.olingo.ext.proxy.api.Annotatable getCategoriesAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Supplier",
+ type = "ODataDemo.Supplier")
+ org.apache.olingo.ext.proxy.api.Annotatable getSupplierAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "ProductDetail",
+ type = "ODataDemo.ProductDetail")
+ org.apache.olingo.ext.proxy.api.Annotatable getProductDetailAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductCollection.java
new file mode 100644
index 0000000..3347691
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductCollection.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface ProductCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ProductCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Product, ProductCollection, ProductCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductCollectionComposableInvoker.java
new file mode 100644
index 0000000..365359e
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductCollectionComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface ProductCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<ProductCollection, ProductCollection.Operations> {
+
+ @Override
+ ProductCollectionComposableInvoker select(String... select);
+
+ @Override
+ ProductCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductComposableInvoker.java
new file mode 100644
index 0000000..e03890c
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductComposableInvoker.java
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface ProductComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Product, Product.Operations>
+{
+
+ @Override
+ ProductComposableInvoker select(String... select);
+
+ @Override
+ ProductComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getID();
+
+ void setID(java.lang.Integer _iD);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Description",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getDescription();
+
+ void setDescription(java.lang.String _description);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ReleaseDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getReleaseDate();
+
+ void setReleaseDate(java.sql.Timestamp _releaseDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DiscontinuedDate",
+ type = "Edm.DateTimeOffset",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getDiscontinuedDate();
+
+ void setDiscontinuedDate(java.sql.Timestamp _discontinuedDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Rating",
+ type = "Edm.Int16",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Short getRating();
+
+ void setRating(java.lang.Short _rating);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Price",
+ type = "Edm.Double",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Double getPrice();
+
+ void setPrice(java.lang.Double _price);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Categories",
+ type = "ODataDemo.Category",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Categories",
+ containsTarget = false)
+ CategoryCollection getCategories();
+
+ void setCategories(CategoryCollection _categories);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Supplier",
+ type = "ODataDemo.Supplier",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Suppliers",
+ containsTarget = false)
+ Supplier getSupplier();
+
+ void setSupplier(Supplier _supplier);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ProductDetail",
+ type = "ODataDemo.ProductDetail",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "ProductDetails",
+ containsTarget = false)
+ ProductDetail getProductDetail();
+
+ void setProductDetail(ProductDetail _productDetail);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductDetail.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductDetail.java
new file mode 100644
index 0000000..f83a7ed
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductDetail.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "ProductDetail",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface ProductDetail
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<ProductDetail>,
+ org.apache.olingo.ext.proxy.api.StructuredQuery<ProductDetail> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getProductID();
+
+ void setProductID(java.lang.Integer _productID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Details",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getDetails();
+
+ void setDetails(java.lang.String _details);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Product",
+ type = "ODataDemo.Product",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Products",
+ containsTarget = false)
+ Product getProduct();
+
+ void setProduct(Product _product);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getProductIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Details",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getDetailsAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Product",
+ type = "ODataDemo.Product")
+ org.apache.olingo.ext.proxy.api.Annotatable getProductAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductDetailCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductDetailCollection.java
new file mode 100644
index 0000000..5811902
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductDetailCollection.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface ProductDetailCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ProductDetailCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<ProductDetail, ProductDetailCollection, ProductDetailCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductDetailCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductDetailCollectionComposableInvoker.java
new file mode 100644
index 0000000..15c1a65
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductDetailCollectionComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface ProductDetailCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<ProductDetailCollection, ProductDetailCollection.Operations> {
+
+ @Override
+ ProductDetailCollectionComposableInvoker select(String... select);
+
+ @Override
+ ProductDetailCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductDetailComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductDetailComposableInvoker.java
new file mode 100644
index 0000000..3727129
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/ProductDetailComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface ProductDetailComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<ProductDetail, ProductDetail.Operations>
+{
+
+ @Override
+ ProductDetailComposableInvoker select(String... select);
+
+ @Override
+ ProductDetailComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getProductID();
+
+ void setProductID(java.lang.Integer _productID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Details",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getDetails();
+
+ void setDetails(java.lang.String _details);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Product",
+ type = "ODataDemo.Product",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Products",
+ containsTarget = false)
+ Product getProduct();
+
+ void setProduct(Product _product);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Supplier.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Supplier.java
new file mode 100644
index 0000000..82f7c58
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/Supplier.java
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Supplier",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface Supplier
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Supplier>, org.apache.olingo.ext.proxy.api.StructuredQuery<Supplier> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getID();
+
+ void setID(java.lang.Integer _iD);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
+ type = "ODataDemo.Address",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Address getAddress();
+
+ void setAddress(Address _address);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Location",
+ type = "Edm.GeographyPoint",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.commons.api.edm.geo.Point getLocation();
+
+ void setLocation(org.apache.olingo.commons.api.edm.geo.Point _location);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Concurrency",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getConcurrency();
+
+ void setConcurrency(java.lang.Integer _concurrency);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Products",
+ type = "ODataDemo.Product",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Products",
+ containsTarget = false)
+ ProductCollection getProducts();
+
+ void setProducts(ProductCollection _products);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Address",
+ type = "ODataDemo.Address")
+ org.apache.olingo.ext.proxy.api.Annotatable getAddressAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Location",
+ type = "Edm.GeographyPoint")
+ org.apache.olingo.ext.proxy.api.Annotatable getLocationAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Concurrency",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getConcurrencyAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Products",
+ type = "ODataDemo.Product")
+ org.apache.olingo.ext.proxy.api.Annotatable getProductsAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/SupplierCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/SupplierCollection.java
new file mode 100644
index 0000000..112e795
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/SupplierCollection.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface SupplierCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<SupplierCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Supplier, SupplierCollection, SupplierCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/SupplierCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/SupplierCollectionComposableInvoker.java
new file mode 100644
index 0000000..2428a52
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/SupplierCollectionComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface SupplierCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<SupplierCollection, SupplierCollection.Operations> {
+
+ @Override
+ SupplierCollectionComposableInvoker select(String... select);
+
+ @Override
+ SupplierCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/SupplierComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/SupplierComposableInvoker.java
new file mode 100644
index 0000000..f4b7bf4
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/SupplierComposableInvoker.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.fit.proxy.demo.odatademo.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface SupplierComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Supplier, Supplier.Operations>
+{
+
+ @Override
+ SupplierComposableInvoker select(String... select);
+
+ @Override
+ SupplierComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getID();
+
+ void setID(java.lang.Integer _iD);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
+ type = "ODataDemo.Address",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Address getAddress();
+
+ void setAddress(Address _address);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Location",
+ type = "Edm.GeographyPoint",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.commons.api.edm.geo.Point getLocation();
+
+ void setLocation(org.apache.olingo.commons.api.edm.geo.Point _location);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Concurrency",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getConcurrency();
+
+ void setConcurrency(java.lang.Integer _concurrency);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Products",
+ type = "ODataDemo.Product",
+ targetSchema = "ODataDemo",
+ targetContainer = "DemoService",
+ targetEntitySet = "Products",
+ containsTarget = false)
+ ProductCollection getProducts();
+
+ void setProducts(ProductCollection _products);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/package-info.java b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/package-info.java
new file mode 100644
index 0000000..fba4be1
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/demo/odatademo/types/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.demo.odatademo.types;
+
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/Service.java
new file mode 100644
index 0000000..d6e1c6e
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/Service.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.opentype;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.ext.proxy.AbstractService;
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+import org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.AccountInfo;
+import org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.Color;
+import org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.ContactDetails;
+import org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.IndexedRow;
+import org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.Row;
+import org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.RowIndex;
+
+public class Service<C extends EdmEnabledODataClient> extends AbstractService<C> {
+
+ // CHECKSTYLE:OFF (Maven checkstyle)
+ private static final String COMPRESSED_METADATA =
+ "H4sIAAAAAAAAAK1Ya2wUVRS+3d2+n6EVtahIjGgCzFIoUKgWS7c0q9tSu4WQAprbnbvbkXk5c3fZJTyCUX6gRhFfDRGUCCoCGlBCNP5Af4gmxgTQ8Euif4WEREKM+sNz57E7090uM9U/TffsPeee853vnseeuI4qdQ11KVqKwypOTBBOEQU5pXAJUSAy5RKKRjjCS1xWErlMJ7dxMDZIKOYxxVFJFeOHP15y8M870wGEshpa6c1M77hONZygDlvn3u/a0Pj96aMBVBFDITiYpWhBDMyFTXNh01zYNAdCIQyHwmAt3A+Hu+HyZf4uB7UoJVJw46/XJnsu32ABqIBEh2ck2L0Mgg8/aou8t+kAb7hep5Ek0YicIDpFLbFncAaH01QQwzFBp8zLJb69zPY1o52ji9qvBFAghhoYWnGiZQTjiqXeMIo4lLpjqDpDNF1QZIpmmS6KWE6F41QD/e7ss2gXCuqeswlQOM0zSFY9vvfJzYmFlw1IqnUwIGGdma0CBFb5Q8Bp++vrz604+UPvfgOJWQ4kNpjxsCtqY+gOCWcjpb80g1NZpltZ5BxLDteraTjHMpTdc/HeyW/xO0FUEUUhXdhOsipCqGJbiP0FpaWeMYkbUTM02l948afQ2W+2BlA9oAEhgTMmGpBOLMsKBV/HRZbOZgdjBrEKqWqxDoDOgKakVVuxviDP20oocBvJjuZUYsuawTWB5vog11iQiUbRSm+MyXSG+92q4Ey9ac15QS2R05JLkEzLrhArKdGkvD8UjkZIUpCFwhkgRac/UpjgHvvyze/O7wjtNuhQiUXBJBkwoFbGEtHBHHFmnaLFg0JCU3QlSblRwJtbx2jC2fTi1qlENmKxmdNpGGyC5CODAqxGTJVMLwgYgoCv+tpXyCHjTtfrK1bP3XLsjwCqGkOzsF0V8mkYQzWK5XRJTtSMY52wby1g2mScEVLGkWENNDUq5DNXp7ol/gu6w/nmCzvPbrl+z8NmQWfpcGSCoiaDVvC6of4Loo6QH6AbDEGD7rnmA65WtDkG6uqWL3reaNt7zPCtCDQIe7m/sG3bv8dvPtjx6rlXAqgW8iKnRZE96zFUnZaFhMITVr1JEqdFugGLaTsltVCtYkRO0QmKWh3lOCpTkjKeXQE+OK1qJCHY9ewB4L2ewCKxPoR0TeApWljqjSuSBCHmH3mKKOH4SDTC7FObIGZ6KipUeCtNawVNp1aeCK8yWR30I26NIGMtVzo985Ch2xjDU1VnMVV4bmRUkMi6ZFIntKyJWrd6ja1eVik0sD4aKZwfSAt82fOtw2a/5q3LmG+GeiNTNz2N4PKxhtbkKCncyT6VPV8XF1Iy4fNatUwrflu1qoiSBjYV0mB+Lq8Th9Q7dczPZXUq4xOKRgueAQ07lpfVCMIR1/mlS8oDFlPklEtheXGdNTXaKarvTSSUtEyjclKBFuyjTNjl10kqg9NDWHJiYow9ZT2uYXT2pAV+a+gR7zOku8Wy4jQ0/5eG9r/ubg2gyhhqNKcFkENOyrT+OrMxx0n+ULPdht26dbrBAOoodo/6nEjdLt/YN3/ZjY5L6wMoNIZmW+VtyhnoXCLenospmAfz/TKrijz0pqdJlhKZt5v21C6BEIDdEjFN5o3NqP96LOj5jACQLBenrx15e1P0UkMABcfQXYKcENM8icrWdBBREmkJbJTMSHtRo81B3eRtzjDgV8wEePBs29xPDp6OXl5rjD11hZFsGhgp6vQ79XAjyjZ41/C3+MHlBYWheK1ndIemA4WhfajlwOb7Ii/fNOIKqZhOWBFVUaylCHXFFALndNNH0yUBRtuZxBmVeaAhqrH/LROxuzZ542DQELB1ymO68xy0R8ALJ5MPPbV/8d9AwpJM8znSeRxFe4tGzZbPW6/Ef7sFo2jlNKNo7QTWoS4SLLnG0qkzaHAryVG0bPo9hDlSWO+NC54gxuRmLqdzzLwD+VTvK5nLTnVXV/f+I9wlYwJssEDKjZCkBZO5Ahcz3eO8OVwwyG5ru3ron4snf75VvKdMfatQ8AJR3g+/bN8c3Qos3GYEMtV3QCszKE94E80ZVgo/K5FLsMPx7IxkMuGekqE9f1tkCkla/R/KEUtXz67+1Lv7Fp0wdq78GF96vVLkCIF2SigKe9ur11kK7FcYFWsUOprFhdnWT0dUwCJ0O/a8BDnfuB0zuoYe8/eGi8PcMHn+zEtz7u8BRo6hpoTZW/VRo8yWaMRWuS2xpBXnfoYk8sToMgNmthQTvK+H/davGCz/u18+Pv7V8OTR/2s9tG0vUI/M/WDB5KfGqFSZFHFKBxJIRBq3ppoq96rXlIaHoYk5uGDUvaChEu3F+y9Tg8aNLNLjP0YPH8y8hqeN1OfPMqblq28NfTbn5LwzZh93BFSZya+9dhsPjhDYVys6Sr/rU7CODGgE7kMV0+wUp9gCBlbhRIklAvT7FFHRimnqp8Y6zAU7ucVF8n8Bw1KQnkUXAAA=";
+ private static final String METADATA_ETAG = null;
+ // CHECKSTYLE:ON (Maven checkstyle)
+
+ private static final Map<String, Service<?>> SERVICES = new ConcurrentHashMap<String, Service<?>>();
+
+ @SuppressWarnings("unchecked")
+ private static <C extends EdmEnabledODataClient> Service<C> getInstance(
+ final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
+
+ if (!SERVICES.containsKey(serviceRoot)) {
+ final Service<C> instance = new Service<C>(COMPRESSED_METADATA, METADATA_ETAG,
+ version, serviceRoot, transactional);
+ SERVICES.put(serviceRoot, instance);
+ }
+
+ return (Service<C>) SERVICES.get(serviceRoot);
+ }
+
+ /**
+ * Gives an OData 4.0 instance for given service root, operating in transactions (with batch requests).
+ *
+ * @param serviceRoot OData service root
+ * @return OData 4.0 instance for given service root, operating in transactions (with batch requests)
+ */
+ public static Service<EdmEnabledODataClient> getV4(
+ final String serviceRoot) {
+
+ return getV4(serviceRoot, true);
+ }
+
+ /**
+ * Gives an OData 4.0 instance for given service root.
+ *
+ * @param serviceRoot OData service root
+ * @param transactional whether operating in transactions (with batch requests) or not
+ * @return OData 4.0 instance for given service root
+ */
+ public static Service<EdmEnabledODataClient> getV4(
+ final String serviceRoot, final boolean transactional) {
+
+ return getInstance(ODataServiceVersion.V40, serviceRoot, transactional);
+ }
+
+ private final Map<String, Class<?>> entityTypes = new HashMap<String, Class<?>>();
+
+ private final Map<String, Class<?>> complexTypes = new HashMap<String, Class<?>>();
+
+ private final Map<String, Class<?>> enumTypes = new HashMap<String, Class<?>>();
+
+ private final Map<String, Class<? extends AbstractTerm>> terms = new HashMap<String, Class<? extends AbstractTerm>>();
+
+ public Service(final String compressedMetadata, final String metadataETag,
+ final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
+
+ super(compressedMetadata, metadataETag, version, serviceRoot, transactional);
+
+ // CHECKSTYLE:OFF (Maven checkstyle)
+ entityTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV4.Row",
+ Row.class);
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.OpenTypesServiceV4.IndexedRow",
+ IndexedRow.class);
+ entityTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV4.RowIndex",
+ RowIndex.class);
+ complexTypes
+ .put(
+ "Microsoft.Test.OData.Services.OpenTypesServiceV4.AccountInfo",
+ AccountInfo.class);
+ complexTypes
+ .put(
+ "Microsoft.Test.OData.Services.OpenTypesServiceV4.ContactDetails",
+ ContactDetails.class);
+ enumTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV4.Color",
+ Color.class);
+ // CHECKSTYLE:ON (Maven checkstyle)
+ }
+
+ @Override
+ public Class<?> getEntityTypeClass(final String name) {
+ return entityTypes.get(name);
+ }
+
+ @Override
+ public Class<?> getComplexTypeClass(final String name) {
+ return complexTypes.get(name);
+ }
+
+ @Override
+ public Class<?> getEnumTypeClass(final String name) {
+ return enumTypes.get(name);
+ }
+
+ @Override
+ public Class<? extends AbstractTerm> getTermClass(final String name) {
+ return terms.get(name);
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/DefaultContainer.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/DefaultContainer.java
new file mode 100644
index 0000000..09bba09
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/DefaultContainer.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.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.io.InputStream;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import java.io.Serializable;
+
+import org.apache.olingo.ext.proxy.api.ComplexCollection;
+import org.apache.olingo.ext.proxy.api.ComplexType;
+import org.apache.olingo.ext.proxy.api.EdmStreamValue;
+import org.apache.olingo.ext.proxy.api.EntityCollection;
+import org.apache.olingo.ext.proxy.api.EntityType;
+import org.apache.olingo.ext.proxy.api.PersistenceManager;
+import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
+@org.apache.olingo.ext.proxy.api.annotations.EntityContainer(name = "DefaultContainer",
+ namespace = "Microsoft.Test.OData.Services.OpenTypesServiceV4")
+public interface DefaultContainer extends PersistenceManager {
+
+ Row getRow();
+
+ RowIndex getRowIndex();
+
+ Operations operations();
+
+ public interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ <NE extends EntityType<?>> NE newEntityInstance(Class<NE> ref);
+
+ <T extends EntityType<?>, NEC extends EntityCollection<T, ?, ?>> NEC newEntityCollection(Class<NEC> ref);
+
+ <NE extends ComplexType<?>> NE newComplexInstance(Class<NE> ref);
+
+ <T extends ComplexType<?>, NEC extends ComplexCollection<T, ?, ?>> NEC newComplexCollection(Class<NEC> ref);
+
+ <T extends Serializable, NEC extends PrimitiveCollection<T>> NEC newPrimitiveCollection(Class<T> ref);
+
+ EdmStreamValue newEdmStreamValue(String contentType, InputStream stream);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/Row.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/Row.java
new file mode 100644
index 0000000..6f230ff
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/Row.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.RowCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Row",
+ container = "Microsoft.Test.OData.Services.OpenTypesServiceV4.DefaultContainer")
+public interface Row
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.Row, RowCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Row>,
+ AbstractEntitySet<org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.Row, java.util.UUID, RowCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/RowIndex.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/RowIndex.java
new file mode 100644
index 0000000..cdc20c1
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/RowIndex.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.RowIndexCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "RowIndex",
+ container = "Microsoft.Test.OData.Services.OpenTypesServiceV4.DefaultContainer")
+public interface RowIndex
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.RowIndex, RowIndexCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<RowIndex>,
+ AbstractEntitySet<org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types.RowIndex, java.lang.Integer, RowIndexCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/package-info.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/package-info.java
new file mode 100644
index 0000000..55fb49b
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice;
+
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/AccountInfo.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/AccountInfo.java
new file mode 100644
index 0000000..0c28783
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/AccountInfo.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+import org.apache.olingo.ext.proxy.api.Annotatable;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
+@org.apache.olingo.ext.proxy.api.annotations.ComplexType(name = "AccountInfo",
+ isOpenType = true,
+ isAbstract = false)
+public interface AccountInfo
+ extends org.apache.olingo.ext.proxy.api.ComplexType<AccountInfo>,
+ org.apache.olingo.ext.proxy.api.StructuredQuery<AccountInfo>, AbstractOpenType {
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFirstName();
+
+ void setFirstName(java.lang.String _firstName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getLastName();
+
+ void setLastName(java.lang.String _lastName);
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FirstName",
+ type = "Edm.String")
+ Annotatable getFirstNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "LastName",
+ type = "Edm.String")
+ Annotatable getLastNameAnnotations();
+
+ }
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/AccountInfoCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/AccountInfoCollection.java
new file mode 100644
index 0000000..5c6abad
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/AccountInfoCollection.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.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface AccountInfoCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<AccountInfoCollection>,
+org.apache.olingo.ext.proxy.api.ComplexCollection<AccountInfo, AccountInfoCollection, AccountInfoCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/AccountInfoCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/AccountInfoCollectionComposableInvoker.java
new file mode 100644
index 0000000..746593c
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/AccountInfoCollectionComposableInvoker.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.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface AccountInfoCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<AccountInfoCollection, AccountInfoCollection.Operations> {
+
+ @Override
+ AccountInfoCollectionComposableInvoker select(String... select);
+
+ @Override
+ AccountInfoCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/AccountInfoComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/AccountInfoComposableInvoker.java
new file mode 100644
index 0000000..d4e186f
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/AccountInfoComposableInvoker.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface AccountInfoComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<AccountInfo, AccountInfo.Operations>
+ , AbstractOpenType {
+
+ @Override
+ AccountInfoComposableInvoker select(String... select);
+
+ @Override
+ AccountInfoComposableInvoker expand(String... expand);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFirstName();
+
+ void setFirstName(java.lang.String _firstName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getLastName();
+
+ void setLastName(java.lang.String _lastName);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/Color.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/Color.java
new file mode 100644
index 0000000..0594588
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/Color.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.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
+@org.apache.olingo.ext.proxy.api.annotations.EnumType(name = "Color",
+ underlyingType = EdmPrimitiveTypeKind.Int32,
+ isFlags = false)
+public enum Color {
+ Red(1),
+ Green(2),
+ Blue(4);
+
+ private java.lang.Integer value;
+
+ public java.lang.Integer getValue() {
+ return value;
+ }
+
+ private Color(final java.lang.Integer value) {
+ this.value = value;
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/ContactDetails.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/ContactDetails.java
new file mode 100644
index 0000000..3772b0f
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/ContactDetails.java
@@ -0,0 +1,273 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.Annotatable;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
+@org.apache.olingo.ext.proxy.api.annotations.ComplexType(name = "ContactDetails",
+ isOpenType = false,
+ isAbstract = false)
+public interface ContactDetails
+ extends org.apache.olingo.ext.proxy.api.ComplexType<ContactDetails>,
+ org.apache.olingo.ext.proxy.api.StructuredQuery<ContactDetails> {
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstContacted",
+ type = "Edm.Binary",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ byte[] getFirstContacted();
+
+ void setFirstContacted(byte[] _firstContacted);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastContacted",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getLastContacted();
+
+ void setLastContacted(java.sql.Timestamp _lastContacted);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Contacted",
+ type = "Edm.Date",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.util.Calendar getContacted();
+
+ void setContacted(java.util.Calendar _contacted);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "GUID",
+ type = "Edm.Guid",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.util.UUID getGUID();
+
+ void setGUID(java.util.UUID _gUID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PreferedContactTime",
+ type = "Edm.TimeOfDay",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.util.Calendar getPreferedContactTime();
+
+ void setPreferedContactTime(java.util.Calendar _preferedContactTime);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Byte",
+ type = "Edm.Byte",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Short getByte();
+
+ void setByte(java.lang.Short _byte);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "SignedByte",
+ type = "Edm.SByte",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Byte getSignedByte();
+
+ void setSignedByte(java.lang.Byte _signedByte);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Double",
+ type = "Edm.Double",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Double getDouble();
+
+ void setDouble(java.lang.Double _double);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Single",
+ type = "Edm.Single",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Float getSingle();
+
+ void setSingle(java.lang.Float _single);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Short",
+ type = "Edm.Int16",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Short getShort();
+
+ void setShort(java.lang.Short _short);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Int",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getInt();
+
+ void setInt(java.lang.Integer _int);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Long",
+ type = "Edm.Int64",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Long getLong();
+
+ void setLong(java.lang.Long _long);
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FirstContacted",
+ type = "Edm.Binary")
+ Annotatable getFirstContactedAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "LastContacted",
+ type = "Edm.DateTimeOffset")
+ Annotatable getLastContactedAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Contacted",
+ type = "Edm.Date")
+ Annotatable getContactedAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "GUID",
+ type = "Edm.Guid")
+ Annotatable getGUIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PreferedContactTime",
+ type = "Edm.TimeOfDay")
+ Annotatable getPreferedContactTimeAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Byte",
+ type = "Edm.Byte")
+ Annotatable getByteAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "SignedByte",
+ type = "Edm.SByte")
+ Annotatable getSignedByteAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Double",
+ type = "Edm.Double")
+ Annotatable getDoubleAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Single",
+ type = "Edm.Single")
+ Annotatable getSingleAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Short",
+ type = "Edm.Int16")
+ Annotatable getShortAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Int",
+ type = "Edm.Int32")
+ Annotatable getIntAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Long",
+ type = "Edm.Int64")
+ Annotatable getLongAnnotations();
+
+ }
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/ContactDetailsCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/ContactDetailsCollection.java
new file mode 100644
index 0000000..035c118
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/ContactDetailsCollection.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.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface ContactDetailsCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ContactDetailsCollection>,
+org.apache.olingo.ext.proxy.api.ComplexCollection<ContactDetails, ContactDetailsCollection, ContactDetailsCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/ContactDetailsCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/ContactDetailsCollectionComposableInvoker.java
new file mode 100644
index 0000000..d77451a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/ContactDetailsCollectionComposableInvoker.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.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface ContactDetailsCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<ContactDetailsCollection, ContactDetailsCollection.Operations> {
+
+ @Override
+ ContactDetailsCollectionComposableInvoker select(String... select);
+
+ @Override
+ ContactDetailsCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/ContactDetailsComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/ContactDetailsComposableInvoker.java
new file mode 100644
index 0000000..c55eec1
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/ContactDetailsComposableInvoker.java
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface ContactDetailsComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<ContactDetails, ContactDetails.Operations>
+{
+
+ @Override
+ ContactDetailsComposableInvoker select(String... select);
+
+ @Override
+ ContactDetailsComposableInvoker expand(String... expand);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstContacted",
+ type = "Edm.Binary",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ byte[] getFirstContacted();
+
+ void setFirstContacted(byte[] _firstContacted);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastContacted",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getLastContacted();
+
+ void setLastContacted(java.sql.Timestamp _lastContacted);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Contacted",
+ type = "Edm.Date",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.util.Calendar getContacted();
+
+ void setContacted(java.util.Calendar _contacted);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "GUID",
+ type = "Edm.Guid",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.util.UUID getGUID();
+
+ void setGUID(java.util.UUID _gUID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PreferedContactTime",
+ type = "Edm.TimeOfDay",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.util.Calendar getPreferedContactTime();
+
+ void setPreferedContactTime(java.util.Calendar _preferedContactTime);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Byte",
+ type = "Edm.Byte",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Short getByte();
+
+ void setByte(java.lang.Short _byte);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "SignedByte",
+ type = "Edm.SByte",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Byte getSignedByte();
+
+ void setSignedByte(java.lang.Byte _signedByte);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Double",
+ type = "Edm.Double",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Double getDouble();
+
+ void setDouble(java.lang.Double _double);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Single",
+ type = "Edm.Single",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Float getSingle();
+
+ void setSingle(java.lang.Float _single);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Short",
+ type = "Edm.Int16",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Short getShort();
+
+ void setShort(java.lang.Short _short);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Int",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getInt();
+
+ void setInt(java.lang.Integer _int);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Long",
+ type = "Edm.Int64",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Long getLong();
+
+ void setLong(java.lang.Long _long);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/IndexedRow.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/IndexedRow.java
new file mode 100644
index 0000000..2de8869
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/IndexedRow.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.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.concurrent.Future;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "IndexedRow",
+ openType = true,
+ hasStream = false,
+ isAbstract = false,
+ baseType = "Microsoft.Test.OData.Services.OpenTypesServiceV4.Row")
+public interface IndexedRow
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ Row,
+ AbstractOpenType {
+
+ @Override
+ IndexedRow load();
+
+ @Override
+ Future<? extends IndexedRow> loadAsync();
+
+ @Override
+ IndexedRow refs();
+
+ @Override
+ IndexedRow expand(String... expand);
+
+ @Override
+ IndexedRow select(String... select);
+
+ @Override
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Id",
+ type = "Edm.Guid",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.util.UUID getId();
+
+ @Override
+ void setId(java.util.UUID _id);
+
+ @Override
+ Operations operations();
+
+ interface Operations extends
+ Row.Operations {
+ // No additional methods needed for now.
+ }
+
+ @Override
+ Annotations annotations();
+
+ interface Annotations extends
+ Row.Annotations {
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Id",
+ type = "Edm.Guid")
+ org.apache.olingo.ext.proxy.api.Annotatable getIdAnnotations();
+
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/IndexedRowCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/IndexedRowCollection.java
new file mode 100644
index 0000000..51ea58b
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/IndexedRowCollection.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.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface IndexedRowCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<IndexedRowCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<IndexedRow, IndexedRowCollection, IndexedRowCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/IndexedRowCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/IndexedRowCollectionComposableInvoker.java
new file mode 100644
index 0000000..ee64c02
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/IndexedRowCollectionComposableInvoker.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.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface IndexedRowCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<IndexedRowCollection, IndexedRowCollection.Operations> {
+
+ @Override
+ IndexedRowCollectionComposableInvoker select(String... select);
+
+ @Override
+ IndexedRowCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/IndexedRowComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/IndexedRowComposableInvoker.java
new file mode 100644
index 0000000..56d9712
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/IndexedRowComposableInvoker.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+public interface IndexedRowComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<IndexedRow, IndexedRow.Operations>
+ , AbstractOpenType {
+
+ @Override
+ IndexedRowComposableInvoker select(String... select);
+
+ @Override
+ IndexedRowComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Id",
+ type = "Edm.Guid",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.util.UUID getId();
+
+ void setId(java.util.UUID _id);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/Row.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/Row.java
new file mode 100644
index 0000000..eb5a3cc
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/Row.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Row",
+ openType = true,
+ hasStream = false,
+ isAbstract = false)
+public interface Row
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Row>, org.apache.olingo.ext.proxy.api.StructuredQuery<Row>,
+ AbstractOpenType {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Id",
+ type = "Edm.Guid",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.util.UUID getId();
+
+ void setId(java.util.UUID _id);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Id",
+ type = "Edm.Guid")
+ org.apache.olingo.ext.proxy.api.Annotatable getIdAnnotations();
+
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowCollection.java
new file mode 100644
index 0000000..c754aed
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowCollection.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.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface RowCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<RowCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Row, RowCollection, RowCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowCollectionComposableInvoker.java
new file mode 100644
index 0000000..c3713a7
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowCollectionComposableInvoker.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.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface RowCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<RowCollection, RowCollection.Operations> {
+
+ @Override
+ RowCollectionComposableInvoker select(String... select);
+
+ @Override
+ RowCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowComposableInvoker.java
new file mode 100644
index 0000000..f77f079
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowComposableInvoker.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+public interface RowComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Row, Row.Operations>
+ , AbstractOpenType {
+
+ @Override
+ RowComposableInvoker select(String... select);
+
+ @Override
+ RowComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Id",
+ type = "Edm.Guid",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.util.UUID getId();
+
+ void setId(java.util.UUID _id);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowIndex.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowIndex.java
new file mode 100644
index 0000000..eee12de
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowIndex.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.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "RowIndex",
+ openType = true,
+ hasStream = false,
+ isAbstract = false)
+public interface RowIndex
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<RowIndex>, org.apache.olingo.ext.proxy.api.StructuredQuery<RowIndex>,
+ AbstractOpenType {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Id",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getId();
+
+ void setId(java.lang.Integer _id);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Rows",
+ type = "Microsoft.Test.OData.Services.OpenTypesServiceV4.Row",
+ targetSchema = "Microsoft.Test.OData.Services.OpenTypesServiceV4",
+ targetContainer = "DefaultContainer",
+ targetEntitySet = "Row",
+ containsTarget = false)
+ Row getRows();
+
+ void
+ setRows(Row _rows);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Id",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getIdAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Rows",
+ type = "Microsoft.Test.OData.Services.OpenTypesServiceV4.Row")
+ org.apache.olingo.ext.proxy.api.Annotatable getRowsAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowIndexCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowIndexCollection.java
new file mode 100644
index 0000000..c0dae50
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowIndexCollection.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.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface RowIndexCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<RowIndexCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<RowIndex, RowIndexCollection, RowIndexCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowIndexCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowIndexCollectionComposableInvoker.java
new file mode 100644
index 0000000..cb4f23f
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowIndexCollectionComposableInvoker.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.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface RowIndexCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<RowIndexCollection, RowIndexCollection.Operations> {
+
+ @Override
+ RowIndexCollectionComposableInvoker select(String... select);
+
+ @Override
+ RowIndexCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowIndexComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowIndexComposableInvoker.java
new file mode 100644
index 0000000..52e3306
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/RowIndexComposableInvoker.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+public interface RowIndexComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<RowIndex, RowIndex.Operations>
+ , AbstractOpenType {
+
+ @Override
+ RowIndexComposableInvoker select(String... select);
+
+ @Override
+ RowIndexComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Id",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getId();
+
+ void setId(java.lang.Integer _id);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Rows",
+ type = "Microsoft.Test.OData.Services.OpenTypesServiceV4.Row",
+ targetSchema = "Microsoft.Test.OData.Services.OpenTypesServiceV4",
+ targetContainer = "DefaultContainer",
+ targetEntitySet = "Row",
+ containsTarget = false)
+ Row getRows();
+
+ void
+ setRows(Row _rows);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/package-info.java b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/package-info.java
new file mode 100644
index 0000000..26254f9
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/opentype/microsoft/test/odata/services/opentypesservice/types/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.opentype.microsoft.test.odata.services.opentypesservice.types;
+
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/Service.java
new file mode 100644
index 0000000..5b5a829
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/Service.java
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.ext.proxy.AbstractService;
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Account;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfo;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Asset;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Club;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddress;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPI;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecord;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.GiftCard;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddress;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.IsBoss;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnion;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetail;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetail;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReview;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.PublicCompany;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Statement;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Subscription;
+
+public class Service<C extends EdmEnabledODataClient> extends AbstractService<C> {
+
+ // CHECKSTYLE:OFF (Maven checkstyle)
+ private static final String COMPRESSED_METADATA =
+ "H4sIAAAAAAAAAMU9fZAkVX09s7Mfs7Mf98V58nVQUcIJN8t9wB23eDi7O7s3YW5v2F0OPNFU78zb3fZmuofunr1ZK0ARS1KFGiHCyRWlGEqJMXfRHNESUpIiETVWKEshlKYIJIYKMZEqjMTEJJb5vff643X3655+Pbt4f1zN9L73+36/3+/93q/fnH1d6jV06aCmL+flplxdQXmtrqjLWr5aV5Bq5quajvKo1si3G/X86v78bUfLR5Ep12RTLjWa9flH/2TvI//9tlZaktq6dH08MIVFw9TlqsnA+trnDh4f/s75z6elVFnKwMC2KV1VBnBjFNwYBTdGwcFDZQwGjQG0sSIMHgfk14ohh2klEzV6bvunn5w5/MIbmIEmSGJPbElgvFgEX/jjbVN/+L5P1gjpgzpaQjpSq8gwpU3lD8qr8ljLVOpjZcUwMZV7halsT45Kdy7svvAHaSldloawtOaRvqoQFPviyWiKmTRelvpXkW4ommpKWyiJdVldHps3dZg/3r5DukvqMWJrE0TBgsciOfRb9958e/XqF4hI+g0A0JANDLYPJHBITAIs7L96/XcPnHuu8ACRxBZGEscpPxhFtixd0JDbU/w/UuaaWNNbMed5rJx8QdflNayh9j3fv+TMt+RP90ipkpQxlA+hdlOSpNSpDP4fJu2LLZN5wjWWxoUf+ejfZb761yfTUg6kASwBMVQaoE5ZVTUTaF2sY3WOMhZzVG6CqjZZA2DOjK61mvbEnPvcgVXVABtqL6w1kf1sFEhTzLVJ0LWsqEg3pevjWczq/rGidyoQk6PQWARZpLYangdLLdXDYq+J9IZDjwlDp9CSoiruGDCK/WJGQYX7+F+c/ptnfidzNzGHXrmuUCMDC8iqcgMZAA6xWjel3UeVqq4Z2pKZXwB5549hM8nb5kW/3jo5bT/A00ZA81mi/6yQ/gtECFj/pR/++OEPPLvnC2mp94TUu6i11FpZGqainEdmRTZXLLIzmGzr82BT1uEbCM+WHfgWs6WrWNimtD+2GuecWdj/3BCfAUvWBddC9736yC3G+FM3k3UdsEDLcdhCk4jQpHYK5D5SqNUKVZCoMacsr5jOmDQZkwbBXhebrootFyzbxefaV4ydaFxGTICzJjKGrtRM6WqetLRGAwY64lpG2tj8XGkKS+mAmDk6JP10fOLhQnr+G2mp74Q0oLbqdSw2sEfwSGWkLpsrprSVcbkl1UTLZGmxqs82dVRVbJ91Odi2UZXryPqSwUuIMWsJ5Nvf1LVaq2o24fO1Qjaer9CZAbVRT3Mp1l5OdlWHMVwvhoEqvoxWUT2IpW3Eljbo3rVlrPzj//zyk/ni7d8Ml7Ylsg4CxTaCP+8MCjfVbK4Dx2/jLorRklrVkWygORiotlBgVRAFYPWmmgkUOwnRQFbXohQ7bFNwXK63EMaRhYQjD1Z53X6eqvCjd0lUJL6RHBZNqa8J3gunGUNzyEAmOAEd5OKM7CEje1w+rfEY/H5BKyYTw3jFsLMyxQ5hAb4VJrV6HREXfaWgbimYXVG4ehW1BpkDI6V9ezvJMznDXNEPWB4BkoqBKcWoQtQJul2HYGd0d7KxfEmkbAZBx1VY2/IyEhPQOpEVlBYRQEBGds6XiPBmBKoRshYmNMMoNmSlHo6wD5G/Y2TbGd4xXpqqc+TsFVnUND5xmxzi/Is1QF6/taASuCY/7BDyu4DK526UcEe2BlpLZxI8r51yF9TFEASxgYwdXavIaw0whJIK0b+FPxlEcEuAfQVyW7lVNyul8MXWb0FKwmLVa6Qcn96volMwi9joFqx0/GVBaaBjS0vAfKjMrUh3o+DS8ovCIoXFEP4gQx5khAoQk+4mB+cABx88cOPO9z/+M5IDbJHtbbOzT4HEQGsikjJwE8SBRQh/C3bQL0vbVHlVWSZDwG3AkjcVZ2sz2PQ+Ea94MMSPfvvOr77/9YuvpBUPJ/ujaQeo0bJmSQpRNlegdkSNXQ3B+TRlag1L88ZNTx1+aNu9j4ck+LHTdCcxtmD/+/yb79xz/9c+kZayTKZ2QupvqUpVqyFc16ALh2Qidh7sz+MEkuSInA6nU+BdwRkiZBKjH3SdI1+2p+mczCRYldCMwYpmmHJ9EnjsOI9O/ATk20e0BgrX/7q5W65vP52ihE/LDaW+NgsCj0/4iJVz/tpop0LPWWSIEZ+znGtJXdIseDFXHevhLRKy04pumLEIYKcNlOWYs9p44xR/M++r5eC1PnvFy0MX/s/bt6al3rI0LNvlCk03I2pMg07Zwqno2PUe79xBA8ipI5PxHe8WLH16SX7jviuufWPP87ekpcwJabvlLXxjIALU5Q+tlTW5BuCLKnYyNfDxv43aJlJrdnXI720lkvmU1KOooelrBCa4eE6Uil8RLTAiwcLedcM3n3vm3PJLaamnLPVRYduOzBEpn7y3cxbRdWKLyE5uA4nudziwbxCD7c1mQ/JbHp7DCfFYHiE0WeXhencCXG6ayMkcI5KaIfJgSKimVbRNANvK+Z889vD7Ss8Pga2ckHYoarXeqqGSahE3pVVJosVdnhcGspe1CdiL2g6kT7y05VB2aueXHjlfemGaVNoG3UJwyJpKuKGFuFxBGuRIQQcc8Pi6NB1bwLNhcsEC/8ymT95+6dTH3ySsZZpuPbbPlPVla13abPVVZB0wOIRSuv5BeE1OtgwTwrwOscL+aEQwzcaYVwH5Mb0GE5wPzvN1oq4IYtHWID+Cfa71UYQ6HxX2834rMLufHPqSVS3Bn9n1yxgGY1MxhUzsmMBVWZOtBw4x44mIoVACUOOLDTxnHTZrtSBzDulzaFVBpxjSrQddkk6hBKBGkO55AHj3ieElVutYb4qztuMXhQuOG8SL+aYX7//uNV//8R0k0m5zXWSx3cQhgpx6lmIfnrjzxwocUOMQvu9oyXVlSUG67QnxeVdU+AbmDsdmziUAohL8sYZ5HF/4XurJsn4BcVgj1q50jWyd7EjAbHp0aTEJOs75z9QaeHmlypPEL55+7TdmXxl5NnTneGs3NEQgHr36wSOHds6epR0IlXXg1AP+2d0zv6/ni7/C4EkEiLP5LiahosKqEWv5vtf0p2eePLWNaHnA1rJlZb2r1kY5dRGmK7WTk/Vk51tNnICiGtC0kIQmyKxh+6pyJYNJPPqL+xfufs/4lTRymuRk8niSxRWF6B3k7JJhma6s1OV3RXEFuBIwRXBJ1r8txKRGSJ8APq6DNK3VYP+ISwITmgY+P2PqdO2l3slRxLZpiAtIx0vILSqBTiaS6cSu6WIN/OdPr/5w/6Nykay7XsVE1lE7kdBlHL861Y1t4rNqjPWew9K3Xs5Lf08X3W3dLLpiHeF09pheMGGnu9gykauN7YOvnfzb7T2vUuZ86r8MwiEJH6WpdrjkAZis1nySx6P389KD1AFTGiJA7ZSAnOJsncR8TK6ADaAFIPok8Bhc91aM3lTWlpdRraTycihnkJ3zQQprxUI3DbQHeSjxE2YHXsGjSQaGD2L8PGW0YBhaVcGpijeOO4mMlUaQp6jGJDIO2QcFd7CoKetmgySVOfeLSNa3brmnVScCruxyfAQVPuO4qcvy+tjCCpo3wRprlRJ28NZHR/I7C6ugS2zu861Fo6orTbzYFhDYH6jLACu6gP8Ha/5st/RNwOpoNV0SR60DEftJ0g0Jj2mB9PSQIDZGRmEii4HdfdJHnvSB/x2P7SynPYU17Hb/9VMz733p3/50lnQSiVUGAlWmAbtuF9zANznVT+EaygwyLdVDwAL6pVHfE+Jv14KonF2jKR0QRmlXEbLO5xhoBH2RA3qvKQ26X8IROd5PuLgG0Av1ujt9xPsgDGVTeB84w1bsTGnY8z0CzbS46CzaJ9aYLhlT2hH2J94ail9Ym7er0Hj5bP/lm7+aOLRjD9kaRpWwYhTSwiqzCateGSztsNDFLeqkTndfF3ZrULnjStPJP0JiV9yaU4eIyyU8WW+TCzlQrLdocDMvXhbGcs2RwaveXMP7zcl1cG4Ylp6sP8PDldZiXan62fZZzIygFbIwx8ryotbSb1FJ7Msx38K5EUxCQzFwQ+p6WHp4QhIRtLeTJ9uFilFu5wH2ON8+t/SbH3jgmv8lHocTlQW7DWJ2SRQCXRCbvrL1B/M/+vnPSOLA7ZLIrsgGPhGXG56OCX97RM9JBEZ4bfgWHxPivppBENyESG8BfbHgfuImsNMD0Tbjd1R7QPUfPDj+wGP558m+cMiujMyhJcY59wTWRuymiIoLEGPb9spn/u/75178ebDN3H/ogc/XKHPWnrTTAcaNXRxgYNIO31Vc/ux9u8/6O2B5jS6aOoUgFEK+MxavQnPMmoBfGMEeTXVKnNutt1xMBbc24ORfVlTn6NdTenyPmMkG2Tx+5pknPnbRZYdB+iekkSo96jUWyMEM5yjXCUecvpngEX7CeO2qcoAAGiDf7TN82wKaHdoE2Ukb3i9AZ1m9HUeVWq2OhOexfSndNuiF4chgHOT9nHdxLIe27Du1vWWk5XHLvvmXL915ev5si7jZbE2B2EsL/TfE7PufQZrRlLE5v2PKnu2pOF4OC2hV1hW8vLwt/Lj+h2R1vN28i/9uE4dmHjrJ+reFFppTu/EmpnhsZq5QOfJeEMdmtwxpvTWw5Uef/dx/3fN7B9P4ZSVKKiy4Te642VZjEen3nn3oktyD//hR8oabJG36F7sxEKhY1uXmylpFUzg9hayd9VNQRseu0jC19hWtXlaB+TT4fw+s3M7K4GnCFRuveyf1ssQ5k4r0Hzcm7komaHY5aO1MluO3QtLzbpNJfpEqcavbwISimys1mc6K03rKzt6Bx00g8xRCKnZqC6c0qgcCbYhAa+luROMbip3hb4ihsHXijhrzbTbWV1+8hjMs6yMKpLSC4rfWJ4wBVNTEU7+E/9IEfDoj4DEcPfRbO3mS4uFnL3KF+ENMtzU0VsLkSD60ZM2sUTfLin/MMsfLa3Ci9aV9X26cv237R7hncVucl35rFfYvoUUCl2mPAGDf1u07DlQwu1zR2a8usqbiYBTJUDLCycnozS2ZZO2wsmB3J9Zqm8UzKjqxSWcaKebEw1lSYYNXPSnC4RBpjYPZastaRTk80Qrw0RnVLQbSadFqPd4XC0OTnT+pqKR4SrAI9lw4VddQCeQmtVWk03H0bYDE9kiARMT0YY/BchwFG5a9jsJ5NOqBEelB/EHe12oTM9gnf7WSuq3QthoGG0NpuhLbd4QO98uII7V1cDuUMcbtsGW4rtyOn1qRuTlrrrDnyk0h57wnXgM5a9JUGByTZoQS16SdP+Qo1AXFpB6QPBzED0kvRpTtBx7YhfRfr3IYhsReqXCZFsGHszVckxXC1VdomSuWt41lA70kaeXo3p/3eFoXOh4dE/cRaCyIWeJI2Prp4vX3KmwMXnZ/Q/B26E7g4ix2tx0LpE8cP2ZrTqi8Q6GT1/ISZOfZ+RVUXyorSyjGboidOErwOrNpUN/h23/bkCKidY6RDse4/bHaFpFYlh+I0d4ukpgWsD6vCRMC/H0uMe0+SSusK4VeAqe3a4tL5NCpnit1uSq8j7SKAHb+LURr/FzfschB95QthrcdckeLbTQjizL+08ANL8p42NiozVvKj2r2WPz45wgM8HbQSdYaGqkQNmXCCol6G6HJOQ521TGR2C/YKF3HwJbjuKYRQUe3UTG6+y0a91RiGbhIXSn4Tr5jesfEjX+RLtI1pnjLwgqP1qxJcHDLmk6dlmCfkw9EdA5q3fTCu0Al9EBEeOn2b8ARDbPJYXsFYD0ndXQx3mInhoavkYE4jLjWvr4VeYJml4M2M1lvLca06r2CMgDI7opmGiBiokvebxH50vcwqZkV21XS6Syw6yGSk2LseshAsd0qJw7aYETWunj9so8eenVC4kiB2ktnIfThcWIy4BT8LSjrLwI36WftsjNbw8zwrrnzAttAJvutHu4YDGbtCwJiJywpfNa+NqMsmZOyHncDI5gg2NAdjNt4F9TExH1T8s2TH6XrR7fil+FXPQ3pcemZTkwPi81NWTq1x7+1ZEX6ONfaBKtcMEePe3Jr9XUwN18kPL6wp4cvtAHbUGOstEF7rJgf4eSFDCQRMTrTYux9PE650KA3O9lzprTWYocjq5Fiu4loBSZ5gejYKRXpYp5vc2DJxtDM1sAkoRJmjnl9ZWOqiGxbJ/E+myeUOj7znTdBnCK+cDL5IrdRMXsl73sxG8t7pF/haVDolHRaV5Bai3k1EDszN6kjXEsTsnLHXIdgdk0hixLkh/s7ur2qLG6rBxjRMEVO38De+CjBYtsV7d+Ik3Lz1Li66Jk8flzs1OWIVq/FdDGegDQh12WVrextoEt0g42z0GIEG3usWLDhnAwwkERWVF+lJL43qZRwV/ZbuP6yjleLIdOcM7hrobKghM4mF3RZNehNS8Ki2s5MFjkLTpIL+D0cXfYxhDzCju9azj5oQgZcMmY0LXbLjDVpDsmGoEi7jCBs8h1Hvuz4rjNRHzShkGtvUGZaSk1IYL3ix+sDnmLoxmommKiIXFxZtH55APfn3f3xLy5+vXLm8+t1caUN+6rmYzv/6KozXya3zvUu1eVloyz1NxDphiawve8NjrRUiJL1NUCw4LtJPGAcIr8mcJRgxJx+8bulRx9Z/QM5lFPBn1KgkF/51OyfX3Tu8ifoRR4MQ75bF/ANWJlZTUWmlLqGaxGZr8AIWNs1GLEndETvrbqCX0VJ8S0fD+kvtlG1RQbxK+R4UBZjsmHtC1oY3dzazXX8jC/zZ1LADi3wPXOoAx8zOsIhMYKPzAQIkMsEUNdLu/k60sU4bAwzXVqIVMAwbnbBd6vK9A32CA5yRZyj6hoMNiL56DtmrpDXP/mcBM5S+I6YPBkmT4aFVjvzNnz9iaf3XbLjG4VLYQ2ckAbxz55oBi7qEAvlX7a/eQaZztnhZPRN3+t73T5l239t/r69RLmZ/whSC7K0rmMfc+7+2Oy+Hm09c+YF75fe0B+D6HXuro5/dft6tTWnwkV2cZMdOea/SQ3Lz/ssXP3DHlCY/m7ug+skm2QaCpMEueWcc9FCMHDbF34naSKOwu69eYEv4Y2/Oj7Rux9RbPkueuDzlamSzpfotGmjKeXcEcHR/rr9qEIUKcFrJPgeq9cwZb2jT2HGJ/BBIW+dhXlhjCb0TopwC7B+KodmG4kq6VE/ldMFPynLMRSqZkuu061puEIGlpUlsyrrNYypiwOpsCCSXdTUljFn/UxB1O7YxzUzNCJ+dvithiHXQTLv/3O81Pr/ToPX93ZbwYxSNnYDzPu64Wyu/4/ueFUmuAQYmkPDve3lOOdOb6UWkzHIUJ0KVpxFfoFyAekNnA5/7NKHzn/6g09dl5YGvb+DJTebMNNY0KydKr3Nwb6e9K380YXgW3C8IjqtJeGIEaglBYstsOfo2Z8P7oH+H4FFEOzTdAAA";
+ private static final String METADATA_ETAG = null;
+ // CHECKSTYLE:ON (Maven checkstyle)
+
+ private static final Map<String, Service<?>> SERVICES = new ConcurrentHashMap<String, Service<?>>();
+
+ @SuppressWarnings("unchecked")
+ private static <C extends EdmEnabledODataClient> Service<C> getInstance(
+ final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
+
+ if (!SERVICES.containsKey(serviceRoot)) {
+ final Service<C> instance = new Service<C>(COMPRESSED_METADATA, METADATA_ETAG,
+ version, serviceRoot, transactional);
+ SERVICES.put(serviceRoot, instance);
+ }
+
+ return (Service<C>) SERVICES.get(serviceRoot);
+ }
+
+ /**
+ * Gives an OData 4.0 instance for given service root, operating in transactions (with batch requests).
+ *
+ * @param serviceRoot OData service root
+ * @return OData 4.0 instance for given service root, operating in transactions (with batch requests)
+ */
+ public static Service<EdmEnabledODataClient> getV4(
+ final String serviceRoot) {
+
+ return getV4(serviceRoot, true);
+ }
+
+ /**
+ * Gives an OData 4.0 instance for given service root.
+ *
+ * @param serviceRoot OData service root
+ * @param transactional whether operating in transactions (with batch requests) or not
+ * @return OData 4.0 instance for given service root
+ */
+ public static Service<EdmEnabledODataClient> getV4(
+ final String serviceRoot, final boolean transactional) {
+
+ return getInstance(ODataServiceVersion.V40, serviceRoot, transactional);
+ }
+
+ private final Map<String, Class<?>> entityTypes = new HashMap<String, Class<?>>();
+
+ private final Map<String, Class<?>> complexTypes = new HashMap<String, Class<?>>();
+
+ private final Map<String, Class<?>> enumTypes = new HashMap<String, Class<?>>();
+
+ private final Map<String, Class<? extends AbstractTerm>> terms = new HashMap<String, Class<? extends AbstractTerm>>();
+
+ public Service(final String compressedMetadata, final String metadataETag,
+ final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
+
+ super(compressedMetadata, metadataETag, version, serviceRoot, transactional);
+
+ // CHECKSTYLE:OFF (Maven checkstyle)
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+ CreditCardPI.class);
+ entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Account",
+ Account.class);
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.ProductDetail",
+ ProductDetail.class);
+ entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Order",
+ Order.class);
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.Statement",
+ Statement.class);
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.Subscription",
+ Subscription.class);
+ entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Person",
+ Person.class);
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.GiftCard",
+ GiftCard.class);
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.OrderDetail",
+ OrderDetail.class);
+ entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Product",
+ Product.class);
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
+ PaymentInstrument.class);
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.Customer",
+ Customer.class);
+ entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Club",
+ Club.class);
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.ProductReview",
+ ProductReview.class);
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.Department",
+ Department.class);
+ entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Asset",
+ Asset.class);
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.Employee",
+ Employee.class);
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
+ StoredPI.class);
+ entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Company",
+ Company.class);
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.CreditRecord",
+ CreditRecord.class);
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.LabourUnion",
+ LabourUnion.class);
+ entityTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.PublicCompany",
+ PublicCompany.class);
+ complexTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Address",
+ Address.class);
+ complexTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress",
+ CompanyAddress.class);
+ complexTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.AccountInfo",
+ AccountInfo.class);
+ complexTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.HomeAddress",
+ HomeAddress.class);
+ enumTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.AccessLevel",
+ AccessLevel.class);
+ enumTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Color",
+ Color.class);
+ enumTypes
+ .put(
+ "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory",
+ CompanyCategory.class);
+ terms.put("Microsoft.Test.OData.Services.ODataWCFService.IsBoss",
+ IsBoss.class);
+ // CHECKSTYLE:ON (Maven checkstyle)
+ }
+
+ @Override
+ public Class<?> getEntityTypeClass(final String name) {
+ return entityTypes.get(name);
+ }
+
+ @Override
+ public Class<?> getComplexTypeClass(final String name) {
+ return complexTypes.get(name);
+ }
+
+ @Override
+ public Class<?> getEnumTypeClass(final String name) {
+ return enumTypes.get(name);
+ }
+
+ @Override
+ public Class<? extends AbstractTerm> getTermClass(final String name) {
+ return terms.get(name);
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Accounts.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Accounts.java
new file mode 100644
index 0000000..61b8f7b
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Accounts.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Account;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Accounts",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+public interface Accounts
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Account, AccountCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Accounts>,
+ AbstractEntitySet<Account, java.lang.Integer, AccountCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Customers.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Customers.java
new file mode 100644
index 0000000..0974312
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Customers.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Customers",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+public interface Customers
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Customer, CustomerCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Customers>,
+ AbstractEntitySet<Customer, java.lang.Integer, CustomerCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Departments.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Departments.java
new file mode 100644
index 0000000..8917add
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Departments.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types
+ .DepartmentCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Departments",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+public interface Departments
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Department, DepartmentCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Departments>,
+ AbstractEntitySet<Department, java.lang.Integer, DepartmentCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Employees.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Employees.java
new file mode 100644
index 0000000..4b1bccf
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Employees.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Employees",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+public interface Employees
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Employee, EmployeeCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Employees>,
+ AbstractEntitySet<Employee, java.lang.Integer, EmployeeCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/InMemoryEntities.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/InMemoryEntities.java
new file mode 100644
index 0000000..cbe45ed
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/InMemoryEntities.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.io.InputStream;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import java.io.Serializable;
+
+import org.apache.olingo.ext.proxy.api.ComplexCollection;
+import org.apache.olingo.ext.proxy.api.ComplexType;
+import org.apache.olingo.ext.proxy.api.EdmStreamValue;
+import org.apache.olingo.ext.proxy.api.EntityCollection;
+import org.apache.olingo.ext.proxy.api.EntityType;
+import org.apache.olingo.ext.proxy.api.OperationType;
+import org.apache.olingo.ext.proxy.api.PersistenceManager;
+import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnion;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonComposableInvoker;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types
+ .ProductCollectionComposableInvoker;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityContainer(name = "InMemoryEntities",
+ namespace = "Microsoft.Test.OData.Services.ODataWCFService")
+public interface InMemoryEntities extends PersistenceManager {
+
+ Accounts getAccounts();
+
+ StoredPIs getStoredPIs();
+
+ Customers getCustomers();
+
+ Products getProducts();
+
+ OrderDetails getOrderDetails();
+
+ Departments getDepartments();
+
+ Employees getEmployees();
+
+ Orders getOrders();
+
+ People getPeople();
+
+ SubscriptionTemplates getSubscriptionTemplates();
+
+ ProductReviews getProductReviews();
+
+ ProductDetails getProductDetails();
+
+ @org.apache.olingo.ext.proxy.api.annotations.Singleton(
+ name = "PublicCompany",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+ Company
+ getPublicCompany();
+
+ @org.apache.olingo.ext.proxy.api.annotations.Singleton(
+ name = "DefaultStoredPI",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+ StoredPI
+ getDefaultStoredPI();
+
+ @org.apache.olingo.ext.proxy.api.annotations.Singleton(
+ name = "VipCustomer",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+ Customer
+ getVipCustomer();
+
+ @org.apache.olingo.ext.proxy.api.annotations.Singleton(
+ name = "Company",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+ Company getCompany();
+
+ @org.apache.olingo.ext.proxy.api.annotations.Singleton(
+ name = "Boss",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+ Person getBoss();
+
+ @org.apache.olingo.ext.proxy.api.annotations.Singleton(
+ name = "LabourUnion",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+ LabourUnion
+ getLabourUnion();
+
+ Operations operations();
+
+ public interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "GetBossEmails",
+ type = OperationType.FUNCTION,
+ isComposable = false,
+ referenceType = org.apache.olingo.ext.proxy.api.PrimitiveCollection.class,
+ returnType = "Collection(Edm.String)")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollectionInvoker<org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String>>
+ getBossEmails(
+ @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "start", type = "Edm.Int32", nullable = false) java.lang.Integer start,
+ @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "count", type = "Edm.Int32", nullable = false) java.lang.Integer count
+ );
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(
+ name = "GetPerson2",
+ type = OperationType.FUNCTION,
+ isComposable = true,
+ referenceType = Person.class,
+ returnType = "Microsoft.Test.OData.Services.ODataWCFService.Person")
+ PersonComposableInvoker
+ getPerson2(
+ @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "city", type = "Edm.String", nullable = false) java.lang.String city
+ );
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(
+ name = "GetDefaultColor",
+ type = OperationType.FUNCTION,
+ isComposable = true,
+ referenceType = Color.class,
+ returnType = "Microsoft.Test.OData.Services.ODataWCFService.Color")
+ org.apache.olingo.ext.proxy.api.Invoker<Color>
+ getDefaultColor(
+ );
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(
+ name = "GetPerson",
+ type = OperationType.FUNCTION,
+ isComposable = true,
+ referenceType = Person.class,
+ returnType = "Microsoft.Test.OData.Services.ODataWCFService.Person")
+ PersonComposableInvoker
+ getPerson(
+ @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "address",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address", nullable = false) Address address
+ );
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "GetProductsByAccessLevel",
+ type = OperationType.FUNCTION,
+ isComposable = false,
+ referenceType = org.apache.olingo.ext.proxy.api.PrimitiveCollection.class,
+ returnType = "Collection(Edm.String)")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollectionInvoker<org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String>>
+ getProductsByAccessLevel(
+ @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "accessLevel",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", nullable = false) AccessLevel accessLevel
+ );
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(
+ name = "GetAllProducts",
+ type = OperationType.FUNCTION,
+ isComposable = true,
+ referenceType = ProductCollection.class,
+ returnType = "Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)")
+ ProductCollectionComposableInvoker
+ getAllProducts(
+ );
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(
+ name = "ResetBossAddress",
+ type = OperationType.ACTION,
+ referenceType = Address.class,
+ returnType = "Microsoft.Test.OData.Services.ODataWCFService.Address")
+ org.apache.olingo.ext.proxy.api.StructuredInvoker<Address>
+ resetBossAddress(
+ @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "address",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address", nullable = false) Address address
+ );
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "ResetDataSource",
+ type = OperationType.ACTION)
+ org.apache.olingo.ext.proxy.api.Invoker<Void> resetDataSource(
+ );
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "Discount",
+ type = OperationType.ACTION)
+ org.apache.olingo.ext.proxy.api.Invoker<Void> discount(
+ @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "percentage", type = "Edm.Int32",
+ nullable = false) java.lang.Integer percentage
+ );
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "ResetBossEmail",
+ type = OperationType.ACTION,
+ referenceType = org.apache.olingo.ext.proxy.api.PrimitiveCollection.class,
+ returnType = "Collection(Edm.String)")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollectionInvoker<org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String>>
+ resetBossEmail(
+ @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "emails", type = "Collection(Edm.String)",
+ nullable = false) org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> emails
+ );
+
+ }
+
+ <NE extends EntityType<?>> NE newEntityInstance(Class<NE> ref);
+
+ <T extends EntityType<?>, NEC extends EntityCollection<T, ?, ?>> NEC newEntityCollection(Class<NEC> ref);
+
+ <NE extends ComplexType<?>> NE newComplexInstance(Class<NE> ref);
+
+ <T extends ComplexType<?>, NEC extends ComplexCollection<T, ?, ?>> NEC newComplexCollection(Class<NEC> ref);
+
+ <T extends Serializable, NEC extends PrimitiveCollection<T>> NEC newPrimitiveCollection(Class<T> ref);
+
+ EdmStreamValue newEdmStreamValue(String contentType, InputStream stream);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/OrderDetails.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/OrderDetails.java
new file mode 100644
index 0000000..c150e3b
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/OrderDetails.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetail;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types
+ .OrderDetailCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailKey;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "OrderDetails",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+public interface OrderDetails
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<OrderDetail, OrderDetailCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<OrderDetails>,
+ AbstractEntitySet<OrderDetail, OrderDetailKey, OrderDetailCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Orders.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Orders.java
new file mode 100644
index 0000000..7334de6
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Orders.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Orders",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+public interface Orders
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Order, OrderCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Orders>,
+ AbstractEntitySet<Order, java.lang.Integer, OrderCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/People.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/People.java
new file mode 100644
index 0000000..4b2a35a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/People.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "People",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+public interface People
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Person, PersonCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<People>,
+ AbstractEntitySet<Person, java.lang.Integer, PersonCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/ProductDetails.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/ProductDetails.java
new file mode 100644
index 0000000..b70fd7b
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/ProductDetails.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetail;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types
+ .ProductDetailCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailKey;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "ProductDetails",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+public interface ProductDetails
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<ProductDetail, ProductDetailCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ProductDetails>,
+ AbstractEntitySet<ProductDetail, ProductDetailKey, ProductDetailCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/ProductReviews.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/ProductReviews.java
new file mode 100644
index 0000000..04bb395
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/ProductReviews.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReview;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types
+ .ProductReviewCollection;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReviewKey;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "ProductReviews",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+public interface ProductReviews
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<ProductReview, ProductReviewCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ProductReviews>,
+ AbstractEntitySet<ProductReview, ProductReviewKey, ProductReviewCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Products.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Products.java
new file mode 100644
index 0000000..bc1f21c
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/Products.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Products",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+public interface Products
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Product, ProductCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Products>,
+ AbstractEntitySet<Product, java.lang.Integer, ProductCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/StoredPIs.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/StoredPIs.java
new file mode 100644
index 0000000..acf5a88
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/StoredPIs.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPICollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "StoredPIs",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+public interface StoredPIs
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<StoredPI, StoredPICollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<StoredPIs>,
+ AbstractEntitySet<StoredPI, java.lang.Integer, StoredPICollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/SubscriptionTemplates.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/SubscriptionTemplates.java
new file mode 100644
index 0000000..b912850
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/SubscriptionTemplates.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types.Subscription;
+import org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types
+ .SubscriptionCollection;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "SubscriptionTemplates",
+ container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
+public interface SubscriptionTemplates
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Subscription, SubscriptionCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<SubscriptionTemplates>,
+ AbstractEntitySet<Subscription, java.lang.Integer, SubscriptionCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/package-info.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/package-info.java
new file mode 100644
index 0000000..5faa3a5
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice;
+
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccessLevel.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccessLevel.java
new file mode 100644
index 0000000..f41b243
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccessLevel.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EnumType(name = "AccessLevel",
+ underlyingType = EdmPrimitiveTypeKind.Int32,
+ isFlags = true)
+public enum AccessLevel {
+ None(0),
+ Read(1),
+ Write(2),
+ Execute(4),
+ ReadWrite(3);
+
+ private java.lang.Integer value;
+
+ public java.lang.Integer getValue() {
+ return value;
+ }
+
+ private AccessLevel(final java.lang.Integer value) {
+ this.value = value;
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Account.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Account.java
new file mode 100644
index 0000000..2487465
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Account.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.OperationType;
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Account",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface Account
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Account>, org.apache.olingo.ext.proxy.api.StructuredQuery<Account> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AccountID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getAccountID();
+
+ void setAccountID(java.lang.Integer _accountID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Country",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCountry();
+
+ void setCountry(java.lang.String _country);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AccountInfo",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.AccountInfo",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ AccountInfo
+ getAccountInfo();
+
+ void
+ setAccountInfo(
+ AccountInfo _accountInfo);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "MyGiftCard",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.GiftCard",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "",
+ targetEntitySet = "",
+ containsTarget = true)
+ GiftCard
+ getMyGiftCard();
+
+ void
+ setMyGiftCard(
+ GiftCard _myGiftCard);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "AvailableSubscriptionTemplatess",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Subscription",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "SubscriptionTemplates",
+ containsTarget = false)
+ SubscriptionCollection
+ getAvailableSubscriptionTemplatess();
+
+ void
+ setAvailableSubscriptionTemplatess(
+ SubscriptionCollection _availableSubscriptionTemplatess);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(
+ name = "GetDefaultPI",
+ type = OperationType.FUNCTION,
+ isComposable = false,
+ referenceType = PaymentInstrument.class,
+ returnType = "Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument")
+ org.apache.olingo.ext.proxy.api.StructuredInvoker<PaymentInstrument>
+ getDefaultPI(
+ );
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(
+ name = "GetAccountInfo",
+ type = OperationType.FUNCTION,
+ isComposable = true,
+ referenceType = AccountInfo.class,
+ returnType = "Microsoft.Test.OData.Services.ODataWCFService.AccountInfo")
+ AccountInfoComposableInvoker
+ getAccountInfo(
+ );
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(
+ name = "RefreshDefaultPI",
+ type = OperationType.ACTION,
+ referenceType = PaymentInstrument.class,
+ returnType = "Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument")
+ org.apache.olingo.ext.proxy.api.StructuredInvoker<PaymentInstrument>
+ refreshDefaultPI(
+ @Parameter(name = "newDate", type = "Edm.DateTimeOffset", nullable = true) java.sql.Timestamp newDate
+ );
+
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "AccountID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getAccountIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Country",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getCountryAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "AccountInfo",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.AccountInfo")
+ org.apache.olingo.ext.proxy.api.Annotatable getAccountInfoAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "MyGiftCard",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.GiftCard")
+ org.apache.olingo.ext.proxy.api.Annotatable getMyGiftCardAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "MyPaymentInstruments",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument")
+ org.apache.olingo.ext.proxy.api.Annotatable getMyPaymentInstrumentsAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "ActiveSubscriptions",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Subscription")
+ org.apache.olingo.ext.proxy.api.Annotatable getActiveSubscriptionsAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(
+ name = "AvailableSubscriptionTemplatess",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Subscription")
+ org.apache.olingo.ext.proxy.api.Annotatable getAvailableSubscriptionTemplatessAnnotations();
+ }
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "MyPaymentInstruments",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Subscription",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "SubscriptionTemplates",
+ containsTarget = true)
+ Account.MyPaymentInstruments
+ getMyPaymentInstruments();
+
+ void
+ setMyPaymentInstruments(
+ Account.MyPaymentInstruments _myPaymentInstruments);
+
+ @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "MyPaymentInstruments", contained = true)
+ interface MyPaymentInstruments
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<PaymentInstrument, PaymentInstrumentCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<MyPaymentInstruments>,
+ AbstractEntitySet<PaymentInstrument, java.lang.Integer, PaymentInstrumentCollection> {
+ // No additional methods needed for now.
+ }
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ActiveSubscriptions",
+ type = "java.lang.Integer",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "SubscriptionTemplates",
+ containsTarget = true)
+ Account.ActiveSubscriptions
+ getActiveSubscriptions();
+
+ void
+ setActiveSubscriptions(
+ Account.ActiveSubscriptions _activeSubscriptions);
+
+ @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "ActiveSubscriptions", contained = true)
+ interface ActiveSubscriptions
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Subscription, SubscriptionCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ActiveSubscriptions>,
+ AbstractEntitySet<Subscription, java.lang.Integer, SubscriptionCollection> {
+ // No additional methods needed for now.
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountCollection.java
new file mode 100644
index 0000000..875ee01
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface AccountCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<AccountCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Account, AccountCollection, AccountCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountCollectionComposableInvoker.java
new file mode 100644
index 0000000..fd966bf
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface AccountCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<AccountCollection, AccountCollection.Operations> {
+
+ @Override
+ AccountCollectionComposableInvoker select(String... select);
+
+ @Override
+ AccountCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountComposableInvoker.java
new file mode 100644
index 0000000..1792bec
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountComposableInvoker.java
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+public interface AccountComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Account, Account.Operations>
+{
+
+ @Override
+ AccountComposableInvoker select(String... select);
+
+ @Override
+ AccountComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AccountID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getAccountID();
+
+ void setAccountID(java.lang.Integer _accountID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Country",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCountry();
+
+ void setCountry(java.lang.String _country);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AccountInfo",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.AccountInfo",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ AccountInfo
+ getAccountInfo();
+
+ void
+ setAccountInfo(
+ AccountInfo _accountInfo);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "MyGiftCard",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.GiftCard",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "",
+ targetEntitySet = "",
+ containsTarget = true)
+ GiftCard
+ getMyGiftCard();
+
+ void
+ setMyGiftCard(
+ GiftCard _myGiftCard);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "AvailableSubscriptionTemplatess",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Subscription",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "SubscriptionTemplates",
+ containsTarget = false)
+ SubscriptionCollection
+ getAvailableSubscriptionTemplatess();
+
+ void
+ setAvailableSubscriptionTemplatess(
+ SubscriptionCollection _availableSubscriptionTemplatess);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "MyPaymentInstruments",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Subscription",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "SubscriptionTemplates",
+ containsTarget = true)
+ Account.MyPaymentInstruments
+ getMyPaymentInstruments();
+
+ void
+ setMyPaymentInstruments(
+ Account.MyPaymentInstruments _myPaymentInstruments);
+
+ @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "MyPaymentInstruments", contained = true)
+ interface MyPaymentInstruments
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<PaymentInstrument, PaymentInstrumentCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<MyPaymentInstruments>,
+ AbstractEntitySet<PaymentInstrument, java.lang.Integer, PaymentInstrumentCollection> {
+ // No additional methods needed for now.
+ }
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ActiveSubscriptions",
+ type = "java.lang.Integer",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "SubscriptionTemplates",
+ containsTarget = true)
+ Account.ActiveSubscriptions
+ getActiveSubscriptions();
+
+ void
+ setActiveSubscriptions(
+ Account.ActiveSubscriptions _activeSubscriptions);
+
+ @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "ActiveSubscriptions", contained = true)
+ interface ActiveSubscriptions
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Subscription, SubscriptionCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ActiveSubscriptions>,
+ AbstractEntitySet<Subscription, java.lang.Integer, SubscriptionCollection> {
+ // No additional methods needed for now.
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfo.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfo.java
new file mode 100644
index 0000000..3ac9a0a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfo.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+import org.apache.olingo.ext.proxy.api.Annotatable;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.ComplexType(name = "AccountInfo",
+ isOpenType = true,
+ isAbstract = false)
+public interface AccountInfo
+ extends org.apache.olingo.ext.proxy.api.ComplexType<AccountInfo>,
+ org.apache.olingo.ext.proxy.api.StructuredQuery<AccountInfo>, AbstractOpenType {
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFirstName();
+
+ void setFirstName(java.lang.String _firstName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getLastName();
+
+ void setLastName(java.lang.String _lastName);
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FirstName",
+ type = "Edm.String")
+ Annotatable getFirstNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "LastName",
+ type = "Edm.String")
+ Annotatable getLastNameAnnotations();
+
+ }
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ //
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoCollection.java
new file mode 100644
index 0000000..940018e
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface AccountInfoCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<AccountInfoCollection>,
+org.apache.olingo.ext.proxy.api.ComplexCollection<AccountInfo, AccountInfoCollection, AccountInfoCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoCollectionComposableInvoker.java
new file mode 100644
index 0000000..54e8b00
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface AccountInfoCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<AccountInfoCollection, AccountInfoCollection.Operations> {
+
+ @Override
+ AccountInfoCollectionComposableInvoker select(String... select);
+
+ @Override
+ AccountInfoCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoComposableInvoker.java
new file mode 100644
index 0000000..85fb42d
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoComposableInvoker.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface AccountInfoComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<AccountInfo, AccountInfo.Operations>
+ , AbstractOpenType {
+
+ @Override
+ AccountInfoComposableInvoker select(String... select);
+
+ @Override
+ AccountInfoComposableInvoker expand(String... expand);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFirstName();
+
+ void setFirstName(java.lang.String _firstName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getLastName();
+
+ void setLastName(java.lang.String _lastName);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Address.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Address.java
new file mode 100644
index 0000000..7942c93
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Address.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.Annotatable;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.ComplexType(name = "Address",
+ isOpenType = false,
+ isAbstract = false)
+public interface Address
+ extends org.apache.olingo.ext.proxy.api.ComplexType<Address>,
+ org.apache.olingo.ext.proxy.api.StructuredQuery<Address> {
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getStreet();
+
+ void setStreet(java.lang.String _street);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCity();
+
+ void setCity(java.lang.String _city);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PostalCode",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getPostalCode();
+
+ void setPostalCode(java.lang.String _postalCode);
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Street",
+ type = "Edm.String")
+ Annotatable getStreetAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "City",
+ type = "Edm.String")
+ Annotatable getCityAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PostalCode",
+ type = "Edm.String")
+ Annotatable getPostalCodeAnnotations();
+
+ }
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressCollection.java
new file mode 100644
index 0000000..19e3b97
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface AddressCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<AddressCollection>,
+org.apache.olingo.ext.proxy.api.ComplexCollection<Address, AddressCollection, AddressCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressCollectionComposableInvoker.java
new file mode 100644
index 0000000..2c69252
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface AddressCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<AddressCollection, AddressCollection.Operations> {
+
+ @Override
+ AddressCollectionComposableInvoker select(String... select);
+
+ @Override
+ AddressCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressComposableInvoker.java
new file mode 100644
index 0000000..8f91d37
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressComposableInvoker.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface AddressComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Address, Address.Operations>
+{
+
+ @Override
+ AddressComposableInvoker select(String... select);
+
+ @Override
+ AddressComposableInvoker expand(String... expand);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getStreet();
+
+ void setStreet(java.lang.String _street);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCity();
+
+ void setCity(java.lang.String _city);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PostalCode",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getPostalCode();
+
+ void setPostalCode(java.lang.String _postalCode);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Asset.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Asset.java
new file mode 100644
index 0000000..2971cfd
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Asset.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Asset",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface Asset
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Asset>, org.apache.olingo.ext.proxy.api.StructuredQuery<Asset> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AssetID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getAssetID();
+
+ void setAssetID(java.lang.Integer _assetID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Number",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getNumber();
+
+ void setNumber(java.lang.Integer _number);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "AssetID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getAssetIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Number",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getNumberAnnotations();
+
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetCollection.java
new file mode 100644
index 0000000..5a12aec
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface AssetCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<AssetCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Asset, AssetCollection, AssetCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetCollectionComposableInvoker.java
new file mode 100644
index 0000000..e34a0bc
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface AssetCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<AssetCollection, AssetCollection.Operations> {
+
+ @Override
+ AssetCollectionComposableInvoker select(String... select);
+
+ @Override
+ AssetCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetComposableInvoker.java
new file mode 100644
index 0000000..0fe0306
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface AssetComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Asset, Asset.Operations>
+{
+
+ @Override
+ AssetComposableInvoker select(String... select);
+
+ @Override
+ AssetComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AssetID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getAssetID();
+
+ void setAssetID(java.lang.Integer _assetID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Number",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getNumber();
+
+ void setNumber(java.lang.Integer _number);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Club.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Club.java
new file mode 100644
index 0000000..6ae594e
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Club.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Club",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface Club
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Club>, org.apache.olingo.ext.proxy.api.StructuredQuery<Club> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ClubID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getClubID();
+
+ void setClubID(java.lang.Integer _clubID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ClubID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getClubIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
+
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubCollection.java
new file mode 100644
index 0000000..8ae996b
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface ClubCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ClubCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Club, ClubCollection, ClubCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubCollectionComposableInvoker.java
new file mode 100644
index 0000000..4365b50
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface ClubCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<ClubCollection, ClubCollection.Operations> {
+
+ @Override
+ ClubCollectionComposableInvoker select(String... select);
+
+ @Override
+ ClubCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubComposableInvoker.java
new file mode 100644
index 0000000..1061b01
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubComposableInvoker.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.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface ClubComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Club, Club.Operations>
+{
+
+ @Override
+ ClubComposableInvoker select(String... select);
+
+ @Override
+ ClubComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ClubID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getClubID();
+
+ void setClubID(java.lang.Integer _clubID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Color.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Color.java
new file mode 100644
index 0000000..db98e46
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Color.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EnumType(name = "Color",
+ underlyingType = EdmPrimitiveTypeKind.Int32,
+ isFlags = false)
+public enum Color {
+ Red(1),
+ Green(2),
+ Blue(4);
+
+ private java.lang.Integer value;
+
+ public java.lang.Integer getValue() {
+ return value;
+ }
+
+ private Color(final java.lang.Integer value) {
+ this.value = value;
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Company.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Company.java
new file mode 100644
index 0000000..f8bfff0
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Company.java
@@ -0,0 +1,232 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+import org.apache.olingo.ext.proxy.api.OperationType;
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Company",
+ openType = true,
+ hasStream = false,
+ isAbstract = false)
+public interface Company
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Company>, org.apache.olingo.ext.proxy.api.StructuredQuery<Company>,
+ AbstractOpenType {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getCompanyID();
+
+ void setCompanyID(java.lang.Integer _companyID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyCategory",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ CompanyCategory
+ getCompanyCategory();
+
+ void
+ setCompanyCategory(
+ CompanyCategory _companyCategory);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Revenue",
+ type = "Edm.Int64",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Long getRevenue();
+
+ void setRevenue(java.lang.Long _revenue);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Address getAddress();
+
+ void
+ setAddress(
+ Address _address);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Employees",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Employee",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Employees",
+ containsTarget = false)
+ EmployeeCollection
+ getEmployees();
+
+ void
+ setEmployees(
+ EmployeeCollection _employees);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "VipCustomer",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Customer",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "VipCustomer",
+ containsTarget = false)
+ Customer
+ getVipCustomer();
+
+ void
+ setVipCustomer(
+ Customer _vipCustomer);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Departments",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Departments",
+ containsTarget = false)
+ DepartmentCollection
+ getDepartments();
+
+ void
+ setDepartments(
+ DepartmentCollection _departments);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CoreDepartment",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Departments",
+ containsTarget = false)
+ Department
+ getCoreDepartment();
+
+ void
+ setCoreDepartment(
+ Department _coreDepartment);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "GetEmployeesCount",
+ type = OperationType.FUNCTION,
+ isComposable = false,
+ referenceType = java.lang.Integer.class, returnType = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Invoker<java.lang.Integer> getEmployeesCount(
+ );
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "IncreaseRevenue",
+ type = OperationType.ACTION,
+ referenceType = java.lang.Long.class, returnType = "Edm.Int64")
+ org.apache.olingo.ext.proxy.api.Invoker<java.lang.Long> increaseRevenue(
+ @Parameter(name = "IncreaseValue", type = "Edm.Int64", nullable = true) java.lang.Long increaseValue
+ );
+
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CompanyID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getCompanyIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CompanyCategory",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory")
+ org.apache.olingo.ext.proxy.api.Annotatable getCompanyCategoryAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Revenue",
+ type = "Edm.Int64")
+ org.apache.olingo.ext.proxy.api.Annotatable getRevenueAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Address",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address")
+ org.apache.olingo.ext.proxy.api.Annotatable getAddressAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Employees",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Employee")
+ org.apache.olingo.ext.proxy.api.Annotatable getEmployeesAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "VipCustomer",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Customer")
+ org.apache.olingo.ext.proxy.api.Annotatable getVipCustomerAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Departments",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Department")
+ org.apache.olingo.ext.proxy.api.Annotatable getDepartmentsAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "CoreDepartment",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Department")
+ org.apache.olingo.ext.proxy.api.Annotatable getCoreDepartmentAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddress.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddress.java
new file mode 100644
index 0000000..65a3871
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddress.java
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.Annotatable;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.ComplexType(name = "CompanyAddress",
+ isOpenType = false,
+ isAbstract = false,
+ baseType = "Microsoft.Test.OData.Services.ODataWCFService.Address")
+public interface CompanyAddress
+ extends Address {
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getStreet();
+
+ @Override
+ void setStreet(java.lang.String _street);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCity();
+
+ @Override
+ void setCity(java.lang.String _city);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PostalCode",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getPostalCode();
+
+ @Override
+ void setPostalCode(java.lang.String _postalCode);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCompanyName();
+
+ void setCompanyName(java.lang.String _companyName);
+
+ @Override
+ Annotations annotations();
+
+ interface Annotations
+ extends
+ Address.Annotations {
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Street",
+ type = "Edm.String")
+ Annotatable getStreetAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "City",
+ type = "Edm.String")
+ Annotatable getCityAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PostalCode",
+ type = "Edm.String")
+ Annotatable getPostalCodeAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CompanyName",
+ type = "Edm.String")
+ Annotatable getCompanyNameAnnotations();
+
+ }
+
+ @Override
+ Operations operations();
+
+ interface Operations
+ extends
+ Address.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressCollection.java
new file mode 100644
index 0000000..41f0fb2
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface CompanyAddressCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<CompanyAddressCollection>,
+org.apache.olingo.ext.proxy.api.ComplexCollection<CompanyAddress, CompanyAddressCollection, CompanyAddressCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressCollectionComposableInvoker.java
new file mode 100644
index 0000000..ed50f95
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface CompanyAddressCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<CompanyAddressCollection, CompanyAddressCollection.Operations> {
+
+ @Override
+ CompanyAddressCollectionComposableInvoker select(String... select);
+
+ @Override
+ CompanyAddressCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressComposableInvoker.java
new file mode 100644
index 0000000..3514e8a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface CompanyAddressComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<CompanyAddress, CompanyAddress.Operations>
+{
+
+ @Override
+ CompanyAddressComposableInvoker select(String... select);
+
+ @Override
+ CompanyAddressComposableInvoker expand(String... expand);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getStreet();
+
+ void setStreet(java.lang.String _street);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCity();
+
+ void setCity(java.lang.String _city);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PostalCode",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getPostalCode();
+
+ void setPostalCode(java.lang.String _postalCode);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCompanyName();
+
+ void setCompanyName(java.lang.String _companyName);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCategory.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCategory.java
new file mode 100644
index 0000000..0312a1a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCategory.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EnumType(name = "CompanyCategory",
+ underlyingType = EdmPrimitiveTypeKind.Int32,
+ isFlags = false)
+public enum CompanyCategory {
+ IT(0),
+ Communication(1),
+ Electronics(2),
+ Others(4);
+
+ private java.lang.Integer value;
+
+ public java.lang.Integer getValue() {
+ return value;
+ }
+
+ private CompanyCategory(final java.lang.Integer value) {
+ this.value = value;
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCollection.java
new file mode 100644
index 0000000..2a3fff3
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface CompanyCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<CompanyCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Company, CompanyCollection, CompanyCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCollectionComposableInvoker.java
new file mode 100644
index 0000000..fc61736
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface CompanyCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<CompanyCollection, CompanyCollection.Operations> {
+
+ @Override
+ CompanyCollectionComposableInvoker select(String... select);
+
+ @Override
+ CompanyCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyComposableInvoker.java
new file mode 100644
index 0000000..7a9fcc9
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyComposableInvoker.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+public interface CompanyComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Company, Company.Operations>
+ , AbstractOpenType {
+
+ @Override
+ CompanyComposableInvoker select(String... select);
+
+ @Override
+ CompanyComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getCompanyID();
+
+ void setCompanyID(java.lang.Integer _companyID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyCategory",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ CompanyCategory
+ getCompanyCategory();
+
+ void
+ setCompanyCategory(
+ CompanyCategory _companyCategory);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Revenue",
+ type = "Edm.Int64",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Long getRevenue();
+
+ void setRevenue(java.lang.Long _revenue);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Address getAddress();
+
+ void
+ setAddress(
+ Address _address);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Employees",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Employee",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Employees",
+ containsTarget = false)
+ EmployeeCollection
+ getEmployees();
+
+ void
+ setEmployees(
+ EmployeeCollection _employees);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "VipCustomer",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Customer",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "VipCustomer",
+ containsTarget = false)
+ Customer
+ getVipCustomer();
+
+ void
+ setVipCustomer(
+ Customer _vipCustomer);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Departments",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Departments",
+ containsTarget = false)
+ DepartmentCollection
+ getDepartments();
+
+ void
+ setDepartments(
+ DepartmentCollection _departments);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CoreDepartment",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Departments",
+ containsTarget = false)
+ Department
+ getCoreDepartment();
+
+ void
+ setCoreDepartment(
+ Department _coreDepartment);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPI.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPI.java
new file mode 100644
index 0000000..6873492
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPI.java
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.concurrent.Future;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "CreditCardPI",
+ openType = false,
+ hasStream = false,
+ isAbstract = false,
+ baseType = "Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument")
+public interface CreditCardPI
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ PaymentInstrument {
+
+ @Override
+ CreditCardPI load();
+
+ @Override
+ Future<? extends CreditCardPI> loadAsync();
+
+ @Override
+ CreditCardPI refs();
+
+ @Override
+ CreditCardPI expand(String... expand);
+
+ @Override
+ CreditCardPI select(String... select);
+
+ @Override
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PaymentInstrumentID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getPaymentInstrumentID();
+
+ @Override
+ void setPaymentInstrumentID(java.lang.Integer _paymentInstrumentID);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FriendlyName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFriendlyName();
+
+ @Override
+ void setFriendlyName(java.lang.String _friendlyName);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getCreatedDate();
+
+ @Override
+ void setCreatedDate(java.sql.Timestamp _createdDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CardNumber",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCardNumber();
+
+ void setCardNumber(java.lang.String _cardNumber);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CVV",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCVV();
+
+ void setCVV(java.lang.String _cVV);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HolderName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getHolderName();
+
+ void setHolderName(java.lang.String _holderName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Balance",
+ type = "Edm.Double",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Double getBalance();
+
+ void setBalance(java.lang.Double _balance);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ExperationDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getExperationDate();
+
+ void setExperationDate(java.sql.Timestamp _experationDate);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "TheStoredPI",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "StoredPIs",
+ containsTarget = false)
+ StoredPI
+ getTheStoredPI();
+
+ @Override
+ void
+ setTheStoredPI(
+ StoredPI _theStoredPI);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "BackupStoredPI",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "StoredPIs",
+ containsTarget = false)
+ StoredPI
+ getBackupStoredPI();
+
+ @Override
+ void
+ setBackupStoredPI(
+ StoredPI _backupStoredPI);
+
+ @Override
+ Operations operations();
+
+ interface Operations
+ extends
+ PaymentInstrument.Operations {
+ // No additional methods needed for now.
+ }
+
+ @Override
+ Annotations annotations();
+
+ interface Annotations
+ extends
+ PaymentInstrument.Annotations {
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PaymentInstrumentID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getPaymentInstrumentIDAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FriendlyName",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getFriendlyNameAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CreatedDate",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getCreatedDateAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CardNumber",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getCardNumberAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CVV",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getCVVAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "HolderName",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getHolderNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Balance",
+ type = "Edm.Double")
+ org.apache.olingo.ext.proxy.api.Annotatable getBalanceAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ExperationDate",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getExperationDateAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "TheStoredPI",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI")
+ org.apache.olingo.ext.proxy.api.Annotatable getTheStoredPIAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "BillingStatements",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Statement")
+ org.apache.olingo.ext.proxy.api.Annotatable getBillingStatementsAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "BackupStoredPI",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI")
+ org.apache.olingo.ext.proxy.api.Annotatable getBackupStoredPIAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "CreditRecords",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.CreditRecord")
+ org.apache.olingo.ext.proxy.api.Annotatable getCreditRecordsAnnotations();
+ }
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CreditRecords",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.CreditRecord",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "",
+ targetEntitySet = "",
+ containsTarget = true)
+ CreditCardPI.CreditRecords
+ getCreditRecords();
+
+ void
+ setCreditRecords(
+ CreditCardPI.CreditRecords _creditRecords);
+
+ @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "CreditRecords", contained = true)
+ interface CreditRecords
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<CreditRecord, CreditRecordCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<CreditRecords>,
+ AbstractEntitySet<CreditRecord, java.lang.Integer, CreditRecordCollection> {
+ // No additional methods needed for now.
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPICollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPICollection.java
new file mode 100644
index 0000000..8c12c94
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPICollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface CreditCardPICollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<CreditCardPICollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<CreditCardPI, CreditCardPICollection, CreditCardPICollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPICollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPICollectionComposableInvoker.java
new file mode 100644
index 0000000..b78a52b
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPICollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface CreditCardPICollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<CreditCardPICollection, CreditCardPICollection.Operations> {
+
+ @Override
+ CreditCardPICollectionComposableInvoker select(String... select);
+
+ @Override
+ CreditCardPICollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPIComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPIComposableInvoker.java
new file mode 100644
index 0000000..998396c
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPIComposableInvoker.java
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+public interface CreditCardPIComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<CreditCardPI, CreditCardPI.Operations>
+{
+
+ @Override
+ CreditCardPIComposableInvoker select(String... select);
+
+ @Override
+ CreditCardPIComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PaymentInstrumentID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getPaymentInstrumentID();
+
+ void setPaymentInstrumentID(java.lang.Integer _paymentInstrumentID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FriendlyName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFriendlyName();
+
+ void setFriendlyName(java.lang.String _friendlyName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getCreatedDate();
+
+ void setCreatedDate(java.sql.Timestamp _createdDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CardNumber",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCardNumber();
+
+ void setCardNumber(java.lang.String _cardNumber);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CVV",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCVV();
+
+ void setCVV(java.lang.String _cVV);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HolderName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getHolderName();
+
+ void setHolderName(java.lang.String _holderName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Balance",
+ type = "Edm.Double",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Double getBalance();
+
+ void setBalance(java.lang.Double _balance);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ExperationDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getExperationDate();
+
+ void setExperationDate(java.sql.Timestamp _experationDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "TheStoredPI",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "StoredPIs",
+ containsTarget = false)
+ StoredPI
+ getTheStoredPI();
+
+ void
+ setTheStoredPI(
+ StoredPI _theStoredPI);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "BackupStoredPI",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "StoredPIs",
+ containsTarget = false)
+ StoredPI
+ getBackupStoredPI();
+
+ void
+ setBackupStoredPI(
+ StoredPI _backupStoredPI);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CreditRecords",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.CreditRecord",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "",
+ targetEntitySet = "",
+ containsTarget = true)
+ CreditCardPI.CreditRecords
+ getCreditRecords();
+
+ void
+ setCreditRecords(
+ CreditCardPI.CreditRecords _creditRecords);
+
+ @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "CreditRecords", contained = true)
+ interface CreditRecords
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<CreditRecord, CreditRecordCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<CreditRecords>,
+ AbstractEntitySet<CreditRecord, java.lang.Integer, CreditRecordCollection> {
+ // No additional methods needed for now.
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecord.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecord.java
new file mode 100644
index 0000000..948bbc5
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecord.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "CreditRecord",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface CreditRecord
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<CreditRecord>,
+ org.apache.olingo.ext.proxy.api.StructuredQuery<CreditRecord> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreditRecordID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getCreditRecordID();
+
+ void setCreditRecordID(java.lang.Integer _creditRecordID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "IsGood",
+ type = "Edm.Boolean",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Boolean getIsGood();
+
+ void setIsGood(java.lang.Boolean _isGood);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Reason",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getReason();
+
+ void setReason(java.lang.String _reason);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getCreatedDate();
+
+ void setCreatedDate(java.sql.Timestamp _createdDate);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CreditRecordID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getCreditRecordIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "IsGood",
+ type = "Edm.Boolean")
+ org.apache.olingo.ext.proxy.api.Annotatable getIsGoodAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Reason",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getReasonAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CreatedDate",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getCreatedDateAnnotations();
+
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordCollection.java
new file mode 100644
index 0000000..9be7ecc
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface CreditRecordCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<CreditRecordCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<CreditRecord, CreditRecordCollection, CreditRecordCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordCollectionComposableInvoker.java
new file mode 100644
index 0000000..746fd51
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface CreditRecordCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<CreditRecordCollection, CreditRecordCollection.Operations> {
+
+ @Override
+ CreditRecordCollectionComposableInvoker select(String... select);
+
+ @Override
+ CreditRecordCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordComposableInvoker.java
new file mode 100644
index 0000000..f1e62ca
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordComposableInvoker.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface CreditRecordComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<CreditRecord, CreditRecord.Operations>
+{
+
+ @Override
+ CreditRecordComposableInvoker select(String... select);
+
+ @Override
+ CreditRecordComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreditRecordID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getCreditRecordID();
+
+ void setCreditRecordID(java.lang.Integer _creditRecordID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "IsGood",
+ type = "Edm.Boolean",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Boolean getIsGood();
+
+ void setIsGood(java.lang.Boolean _isGood);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Reason",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getReason();
+
+ void setReason(java.lang.String _reason);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getCreatedDate();
+
+ void setCreatedDate(java.sql.Timestamp _createdDate);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Customer.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Customer.java
new file mode 100644
index 0000000..ed6fdc1
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Customer.java
@@ -0,0 +1,357 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.concurrent.Future;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Customer",
+ openType = false,
+ hasStream = false,
+ isAbstract = false,
+ baseType = "Microsoft.Test.OData.Services.ODataWCFService.Person")
+public interface Customer
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ Person {
+
+ @Override
+ Customer load();
+
+ @Override
+ Future<? extends Customer> loadAsync();
+
+ @Override
+ Customer refs();
+
+ @Override
+ Customer expand(String... expand);
+
+ @Override
+ Customer select(String... select);
+
+ @Override
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getPersonID();
+
+ @Override
+ void setPersonID(java.lang.Integer _personID);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFirstName();
+
+ @Override
+ void setFirstName(java.lang.String _firstName);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getLastName();
+
+ @Override
+ void setLastName(java.lang.String _lastName);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "MiddleName",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getMiddleName();
+
+ @Override
+ void setMiddleName(java.lang.String _middleName);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HomeAddress",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Address
+ getHomeAddress();
+
+ @Override
+ void
+ setHomeAddress(
+ Address _homeAddress);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Home",
+ type = "Edm.GeographyPoint",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.commons.api.edm.geo.Point getHome();
+
+ @Override
+ void setHome(org.apache.olingo.commons.api.edm.geo.Point _home);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Numbers",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getNumbers();
+
+ @Override
+ void setNumbers(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _numbers);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Emails",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getEmails();
+
+ @Override
+ void setEmails(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _emails);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCity();
+
+ void setCity(java.lang.String _city);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Birthday",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getBirthday();
+
+ void setBirthday(java.sql.Timestamp _birthday);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TimeBetweenLastTwoOrders",
+ type = "Edm.Duration",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.math.BigDecimal getTimeBetweenLastTwoOrders();
+
+ void setTimeBetweenLastTwoOrders(java.math.BigDecimal _timeBetweenLastTwoOrders);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Parent",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Person",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "People",
+ containsTarget = false)
+ Person getParent();
+
+ @Override
+ void setParent(
+ Person _parent);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Orders",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Order",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Orders",
+ containsTarget = false)
+ OrderCollection
+ getOrders();
+
+ void
+ setOrders(
+ OrderCollection _orders);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Company",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Company",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Company",
+ containsTarget = false)
+ Company getCompany();
+
+ void
+ setCompany(
+ Company _company);
+
+ @Override
+ Operations operations();
+
+ interface Operations
+ extends
+ Person.Operations {
+ // No additional methods needed for now.
+ }
+
+ @Override
+ Annotations annotations();
+
+ interface Annotations
+ extends
+ Person.Annotations {
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PersonID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getPersonIDAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FirstName",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getFirstNameAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "LastName",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getLastNameAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "MiddleName",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getMiddleNameAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "HomeAddress",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address")
+ org.apache.olingo.ext.proxy.api.Annotatable getHomeAddressAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Home",
+ type = "Edm.GeographyPoint")
+ org.apache.olingo.ext.proxy.api.Annotatable getHomeAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Numbers",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNumbersAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Emails",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getEmailsAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "City",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getCityAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Birthday",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getBirthdayAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "TimeBetweenLastTwoOrders",
+ type = "Edm.Duration")
+ org.apache.olingo.ext.proxy.api.Annotatable getTimeBetweenLastTwoOrdersAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Parent",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Person")
+ org.apache.olingo.ext.proxy.api.Annotatable getParentAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Orders",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Order")
+ org.apache.olingo.ext.proxy.api.Annotatable getOrdersAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Company",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Company")
+ org.apache.olingo.ext.proxy.api.Annotatable getCompanyAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerCollection.java
new file mode 100644
index 0000000..864161a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface CustomerCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<CustomerCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Customer, CustomerCollection, CustomerCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerCollectionComposableInvoker.java
new file mode 100644
index 0000000..33b8444
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface CustomerCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<CustomerCollection, CustomerCollection.Operations> {
+
+ @Override
+ CustomerCollectionComposableInvoker select(String... select);
+
+ @Override
+ CustomerCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerComposableInvoker.java
new file mode 100644
index 0000000..2a268b1
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerComposableInvoker.java
@@ -0,0 +1,241 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface CustomerComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Customer, Customer.Operations>
+{
+
+ @Override
+ CustomerComposableInvoker select(String... select);
+
+ @Override
+ CustomerComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getPersonID();
+
+ void setPersonID(java.lang.Integer _personID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFirstName();
+
+ void setFirstName(java.lang.String _firstName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getLastName();
+
+ void setLastName(java.lang.String _lastName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "MiddleName",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getMiddleName();
+
+ void setMiddleName(java.lang.String _middleName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HomeAddress",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Address
+ getHomeAddress();
+
+ void
+ setHomeAddress(
+ Address _homeAddress);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Home",
+ type = "Edm.GeographyPoint",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.commons.api.edm.geo.Point getHome();
+
+ void setHome(org.apache.olingo.commons.api.edm.geo.Point _home);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Numbers",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getNumbers();
+
+ void setNumbers(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _numbers);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Emails",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getEmails();
+
+ void setEmails(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _emails);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCity();
+
+ void setCity(java.lang.String _city);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Birthday",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getBirthday();
+
+ void setBirthday(java.sql.Timestamp _birthday);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TimeBetweenLastTwoOrders",
+ type = "Edm.Duration",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.math.BigDecimal getTimeBetweenLastTwoOrders();
+
+ void setTimeBetweenLastTwoOrders(java.math.BigDecimal _timeBetweenLastTwoOrders);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Parent",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Person",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "People",
+ containsTarget = false)
+ Person getParent();
+
+ void setParent(
+ Person _parent);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Orders",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Order",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Orders",
+ containsTarget = false)
+ OrderCollection
+ getOrders();
+
+ void
+ setOrders(
+ OrderCollection _orders);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Company",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Company",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Company",
+ containsTarget = false)
+ Company getCompany();
+
+ void
+ setCompany(
+ Company _company);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Department.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Department.java
new file mode 100644
index 0000000..9070d22
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Department.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Department",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface Department
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Department>, org.apache.olingo.ext.proxy.api.StructuredQuery<Department> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DepartmentID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getDepartmentID();
+
+ void setDepartmentID(java.lang.Integer _departmentID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DepartmentNO",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getDepartmentNO();
+
+ void setDepartmentNO(java.lang.String _departmentNO);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Company",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Company",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Company",
+ containsTarget = false)
+ Company getCompany();
+
+ void
+ setCompany(
+ Company _company);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "DepartmentID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getDepartmentIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "DepartmentNO",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getDepartmentNOAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Company",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Company")
+ org.apache.olingo.ext.proxy.api.Annotatable getCompanyAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentCollection.java
new file mode 100644
index 0000000..514a3ee
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface DepartmentCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<DepartmentCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Department, DepartmentCollection, DepartmentCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentCollectionComposableInvoker.java
new file mode 100644
index 0000000..47ff436
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface DepartmentCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<DepartmentCollection, DepartmentCollection.Operations> {
+
+ @Override
+ DepartmentCollectionComposableInvoker select(String... select);
+
+ @Override
+ DepartmentCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentComposableInvoker.java
new file mode 100644
index 0000000..58cc11f
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentComposableInvoker.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface DepartmentComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Department, Department.Operations>
+{
+
+ @Override
+ DepartmentComposableInvoker select(String... select);
+
+ @Override
+ DepartmentComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DepartmentID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getDepartmentID();
+
+ void setDepartmentID(java.lang.Integer _departmentID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DepartmentNO",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getDepartmentNO();
+
+ void setDepartmentNO(java.lang.String _departmentNO);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Company",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Company",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Company",
+ containsTarget = false)
+ Company getCompany();
+
+ void
+ setCompany(
+ Company _company);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Employee.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Employee.java
new file mode 100644
index 0000000..f33ccb3
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Employee.java
@@ -0,0 +1,321 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.concurrent.Future;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Employee",
+ openType = false,
+ hasStream = false,
+ isAbstract = false,
+ baseType = "Microsoft.Test.OData.Services.ODataWCFService.Person")
+public interface Employee
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ Person {
+
+ @Override
+ Employee load();
+
+ @Override
+ Future<? extends Employee> loadAsync();
+
+ @Override
+ Employee refs();
+
+ @Override
+ Employee expand(String... expand);
+
+ @Override
+ Employee select(String... select);
+
+ @Override
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getPersonID();
+
+ @Override
+ void setPersonID(java.lang.Integer _personID);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFirstName();
+
+ @Override
+ void setFirstName(java.lang.String _firstName);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getLastName();
+
+ @Override
+ void setLastName(java.lang.String _lastName);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "MiddleName",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getMiddleName();
+
+ @Override
+ void setMiddleName(java.lang.String _middleName);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HomeAddress",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Address
+ getHomeAddress();
+
+ @Override
+ void
+ setHomeAddress(
+ Address _homeAddress);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Home",
+ type = "Edm.GeographyPoint",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.commons.api.edm.geo.Point getHome();
+
+ @Override
+ void setHome(org.apache.olingo.commons.api.edm.geo.Point _home);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Numbers",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getNumbers();
+
+ @Override
+ void setNumbers(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _numbers);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Emails",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getEmails();
+
+ @Override
+ void setEmails(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _emails);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DateHired",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getDateHired();
+
+ void setDateHired(java.sql.Timestamp _dateHired);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Office",
+ type = "Edm.GeographyPoint",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.commons.api.edm.geo.Point getOffice();
+
+ void setOffice(org.apache.olingo.commons.api.edm.geo.Point _office);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Parent",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Person",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "People",
+ containsTarget = false)
+ Person getParent();
+
+ @Override
+ void setParent(
+ Person _parent);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Company",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Company",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Company",
+ containsTarget = false)
+ Company getCompany();
+
+ void
+ setCompany(
+ Company _company);
+
+ @Override
+ Operations operations();
+
+ interface Operations
+ extends
+ Person.Operations {
+ // No additional methods needed for now.
+ }
+
+ @Override
+ Annotations annotations();
+
+ interface Annotations
+ extends
+ Person.Annotations {
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PersonID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getPersonIDAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FirstName",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getFirstNameAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "LastName",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getLastNameAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "MiddleName",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getMiddleNameAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "HomeAddress",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address")
+ org.apache.olingo.ext.proxy.api.Annotatable getHomeAddressAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Home",
+ type = "Edm.GeographyPoint")
+ org.apache.olingo.ext.proxy.api.Annotatable getHomeAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Numbers",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNumbersAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Emails",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getEmailsAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "DateHired",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getDateHiredAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Office",
+ type = "Edm.GeographyPoint")
+ org.apache.olingo.ext.proxy.api.Annotatable getOfficeAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Parent",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Person")
+ org.apache.olingo.ext.proxy.api.Annotatable getParentAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Company",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Company")
+ org.apache.olingo.ext.proxy.api.Annotatable getCompanyAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeCollection.java
new file mode 100644
index 0000000..0207f06
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface EmployeeCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<EmployeeCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Employee, EmployeeCollection, EmployeeCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeCollectionComposableInvoker.java
new file mode 100644
index 0000000..3e24a55
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface EmployeeCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<EmployeeCollection, EmployeeCollection.Operations> {
+
+ @Override
+ EmployeeCollectionComposableInvoker select(String... select);
+
+ @Override
+ EmployeeCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeComposableInvoker.java
new file mode 100644
index 0000000..136b7db
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeComposableInvoker.java
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface EmployeeComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Employee, Employee.Operations>
+{
+
+ @Override
+ EmployeeComposableInvoker select(String... select);
+
+ @Override
+ EmployeeComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getPersonID();
+
+ void setPersonID(java.lang.Integer _personID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFirstName();
+
+ void setFirstName(java.lang.String _firstName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getLastName();
+
+ void setLastName(java.lang.String _lastName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "MiddleName",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getMiddleName();
+
+ void setMiddleName(java.lang.String _middleName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HomeAddress",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Address
+ getHomeAddress();
+
+ void
+ setHomeAddress(
+ Address _homeAddress);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Home",
+ type = "Edm.GeographyPoint",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.commons.api.edm.geo.Point getHome();
+
+ void setHome(org.apache.olingo.commons.api.edm.geo.Point _home);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Numbers",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getNumbers();
+
+ void setNumbers(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _numbers);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Emails",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getEmails();
+
+ void setEmails(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _emails);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DateHired",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getDateHired();
+
+ void setDateHired(java.sql.Timestamp _dateHired);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Office",
+ type = "Edm.GeographyPoint",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.commons.api.edm.geo.Point getOffice();
+
+ void setOffice(org.apache.olingo.commons.api.edm.geo.Point _office);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Parent",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Person",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "People",
+ containsTarget = false)
+ Person getParent();
+
+ void setParent(
+ Person _parent);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Company",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Company",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Company",
+ containsTarget = false)
+ Company getCompany();
+
+ void
+ setCompany(
+ Company _company);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCard.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCard.java
new file mode 100644
index 0000000..0be3d7e
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCard.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.OperationType;
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "GiftCard",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface GiftCard
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<GiftCard>, org.apache.olingo.ext.proxy.api.StructuredQuery<GiftCard> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "GiftCardID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getGiftCardID();
+
+ void setGiftCardID(java.lang.Integer _giftCardID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "GiftCardNO",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getGiftCardNO();
+
+ void setGiftCardNO(java.lang.String _giftCardNO);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Amount",
+ type = "Edm.Double",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Double getAmount();
+
+ void setAmount(java.lang.Double _amount);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ExperationDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getExperationDate();
+
+ void setExperationDate(java.sql.Timestamp _experationDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OwnerName",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getOwnerName();
+
+ void setOwnerName(java.lang.String _ownerName);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "GetActualAmount",
+ type = OperationType.FUNCTION,
+ isComposable = false,
+ referenceType = java.lang.Double.class, returnType = "Edm.Double")
+ org.apache.olingo.ext.proxy.api.Invoker<java.lang.Double> getActualAmount(
+ @Parameter(name = "bonusRate", type = "Edm.Double", nullable = true) java.lang.Double bonusRate
+ );
+
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "GiftCardID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getGiftCardIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "GiftCardNO",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getGiftCardNOAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Amount",
+ type = "Edm.Double")
+ org.apache.olingo.ext.proxy.api.Annotatable getAmountAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ExperationDate",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getExperationDateAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "OwnerName",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getOwnerNameAnnotations();
+
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardCollection.java
new file mode 100644
index 0000000..1718099
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface GiftCardCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<GiftCardCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<GiftCard, GiftCardCollection, GiftCardCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardCollectionComposableInvoker.java
new file mode 100644
index 0000000..c53a6d0
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface GiftCardCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<GiftCardCollection, GiftCardCollection.Operations> {
+
+ @Override
+ GiftCardCollectionComposableInvoker select(String... select);
+
+ @Override
+ GiftCardCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardComposableInvoker.java
new file mode 100644
index 0000000..673e7e8
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardComposableInvoker.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface GiftCardComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<GiftCard, GiftCard.Operations>
+{
+
+ @Override
+ GiftCardComposableInvoker select(String... select);
+
+ @Override
+ GiftCardComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "GiftCardID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getGiftCardID();
+
+ void setGiftCardID(java.lang.Integer _giftCardID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "GiftCardNO",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getGiftCardNO();
+
+ void setGiftCardNO(java.lang.String _giftCardNO);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Amount",
+ type = "Edm.Double",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Double getAmount();
+
+ void setAmount(java.lang.Double _amount);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ExperationDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getExperationDate();
+
+ void setExperationDate(java.sql.Timestamp _experationDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OwnerName",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getOwnerName();
+
+ void setOwnerName(java.lang.String _ownerName);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddress.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddress.java
new file mode 100644
index 0000000..9b76b6a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddress.java
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.Annotatable;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.ComplexType(name = "HomeAddress",
+ isOpenType = false,
+ isAbstract = false,
+ baseType = "Microsoft.Test.OData.Services.ODataWCFService.Address")
+public interface HomeAddress
+ extends Address {
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getStreet();
+
+ @Override
+ void setStreet(java.lang.String _street);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCity();
+
+ @Override
+ void setCity(java.lang.String _city);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PostalCode",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getPostalCode();
+
+ @Override
+ void setPostalCode(java.lang.String _postalCode);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FamilyName",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFamilyName();
+
+ void setFamilyName(java.lang.String _familyName);
+
+ @Override
+ Annotations annotations();
+
+ interface Annotations
+ extends
+ Address.Annotations {
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Street",
+ type = "Edm.String")
+ Annotatable getStreetAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "City",
+ type = "Edm.String")
+ Annotatable getCityAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PostalCode",
+ type = "Edm.String")
+ Annotatable getPostalCodeAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FamilyName",
+ type = "Edm.String")
+ Annotatable getFamilyNameAnnotations();
+
+ }
+
+ @Override
+ Operations operations();
+
+ interface Operations
+ extends
+ Address.Operations {
+ // No additional methods needed for now.
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressCollection.java
new file mode 100644
index 0000000..6cd0d65
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface HomeAddressCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<HomeAddressCollection>,
+org.apache.olingo.ext.proxy.api.ComplexCollection<HomeAddress, HomeAddressCollection, HomeAddressCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressCollectionComposableInvoker.java
new file mode 100644
index 0000000..b4967b6
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface HomeAddressCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<HomeAddressCollection, HomeAddressCollection.Operations> {
+
+ @Override
+ HomeAddressCollectionComposableInvoker select(String... select);
+
+ @Override
+ HomeAddressCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressComposableInvoker.java
new file mode 100644
index 0000000..dcff261
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface HomeAddressComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<HomeAddress, HomeAddress.Operations>
+{
+
+ @Override
+ HomeAddressComposableInvoker select(String... select);
+
+ @Override
+ HomeAddressComposableInvoker expand(String... expand);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getStreet();
+
+ void setStreet(java.lang.String _street);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCity();
+
+ void setCity(java.lang.String _city);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PostalCode",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getPostalCode();
+
+ void setPostalCode(java.lang.String _postalCode);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FamilyName",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFamilyName();
+
+ void setFamilyName(java.lang.String _familyName);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/IsBoss.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/IsBoss.java
new file mode 100644
index 0000000..358460e
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/IsBoss.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.Term(name = "IsBoss",
+ type = "Edm.Boolean")
+public interface IsBoss extends AbstractTerm {
+ // No additional methods needed for now.
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnion.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnion.java
new file mode 100644
index 0000000..39d42d4
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnion.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "LabourUnion",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface LabourUnion
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<LabourUnion>,
+ org.apache.olingo.ext.proxy.api.StructuredQuery<LabourUnion> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LabourUnionID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getLabourUnionID();
+
+ void setLabourUnionID(java.lang.Integer _labourUnionID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "LabourUnionID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getLabourUnionIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
+
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionCollection.java
new file mode 100644
index 0000000..2c50f3d
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface LabourUnionCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<LabourUnionCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<LabourUnion, LabourUnionCollection, LabourUnionCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionCollectionComposableInvoker.java
new file mode 100644
index 0000000..9f735ed
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface LabourUnionCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<LabourUnionCollection, LabourUnionCollection.Operations> {
+
+ @Override
+ LabourUnionCollectionComposableInvoker select(String... select);
+
+ @Override
+ LabourUnionCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionComposableInvoker.java
new file mode 100644
index 0000000..7a96e1e
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionComposableInvoker.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.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface LabourUnionComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<LabourUnion, LabourUnion.Operations>
+{
+
+ @Override
+ LabourUnionComposableInvoker select(String... select);
+
+ @Override
+ LabourUnionComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LabourUnionID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getLabourUnionID();
+
+ void setLabourUnionID(java.lang.Integer _labourUnionID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Order.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Order.java
new file mode 100644
index 0000000..6f9fbbe
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Order.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Order",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface Order
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Order>, org.apache.olingo.ext.proxy.api.StructuredQuery<Order> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getOrderID();
+
+ void setOrderID(java.lang.Integer _orderID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getOrderDate();
+
+ void setOrderDate(java.sql.Timestamp _orderDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ShelfLife",
+ type = "Edm.Duration",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.math.BigDecimal getShelfLife();
+
+ void setShelfLife(java.math.BigDecimal _shelfLife);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderShelfLifes",
+ type = "Edm.Duration",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.math.BigDecimal> getOrderShelfLifes();
+
+ void setOrderShelfLifes(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.math.BigDecimal> _orderShelfLifes);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "LoggedInEmployee",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Employee",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Employees",
+ containsTarget = false)
+ Employee
+ getLoggedInEmployee();
+
+ void
+ setLoggedInEmployee(
+ Employee _loggedInEmployee);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CustomerForOrder",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Customer",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Customers",
+ containsTarget = false)
+ Customer
+ getCustomerForOrder();
+
+ void
+ setCustomerForOrder(
+ Customer _customerForOrder);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "OrderDetails",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.OrderDetail",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "OrderDetails",
+ containsTarget = false)
+ OrderDetailCollection
+ getOrderDetails();
+
+ void
+ setOrderDetails(
+ OrderDetailCollection _orderDetails);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "OrderID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getOrderIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "OrderDate",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getOrderDateAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ShelfLife",
+ type = "Edm.Duration")
+ org.apache.olingo.ext.proxy.api.Annotatable getShelfLifeAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "OrderShelfLifes",
+ type = "Edm.Duration")
+ org.apache.olingo.ext.proxy.api.Annotatable getOrderShelfLifesAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "LoggedInEmployee",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Employee")
+ org.apache.olingo.ext.proxy.api.Annotatable getLoggedInEmployeeAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "CustomerForOrder",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Customer")
+ org.apache.olingo.ext.proxy.api.Annotatable getCustomerForOrderAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "OrderDetails",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.OrderDetail")
+ org.apache.olingo.ext.proxy.api.Annotatable getOrderDetailsAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderCollection.java
new file mode 100644
index 0000000..9b00746
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface OrderCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<OrderCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Order, OrderCollection, OrderCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderCollectionComposableInvoker.java
new file mode 100644
index 0000000..0279223
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface OrderCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<OrderCollection, OrderCollection.Operations> {
+
+ @Override
+ OrderCollectionComposableInvoker select(String... select);
+
+ @Override
+ OrderCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderComposableInvoker.java
new file mode 100644
index 0000000..bb3e80b
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderComposableInvoker.java
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface OrderComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Order, Order.Operations>
+{
+
+ @Override
+ OrderComposableInvoker select(String... select);
+
+ @Override
+ OrderComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getOrderID();
+
+ void setOrderID(java.lang.Integer _orderID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getOrderDate();
+
+ void setOrderDate(java.sql.Timestamp _orderDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ShelfLife",
+ type = "Edm.Duration",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.math.BigDecimal getShelfLife();
+
+ void setShelfLife(java.math.BigDecimal _shelfLife);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderShelfLifes",
+ type = "Edm.Duration",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.math.BigDecimal> getOrderShelfLifes();
+
+ void setOrderShelfLifes(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.math.BigDecimal> _orderShelfLifes);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "LoggedInEmployee",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Employee",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Employees",
+ containsTarget = false)
+ Employee
+ getLoggedInEmployee();
+
+ void
+ setLoggedInEmployee(
+ Employee _loggedInEmployee);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CustomerForOrder",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Customer",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Customers",
+ containsTarget = false)
+ Customer
+ getCustomerForOrder();
+
+ void
+ setCustomerForOrder(
+ Customer _customerForOrder);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "OrderDetails",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.OrderDetail",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "OrderDetails",
+ containsTarget = false)
+ OrderDetailCollection
+ getOrderDetails();
+
+ void
+ setOrderDetails(
+ OrderDetailCollection _orderDetails);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetail.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetail.java
new file mode 100644
index 0000000..ff09261
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetail.java
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@KeyRef(OrderDetailKey.class)
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "OrderDetail",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface OrderDetail
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<OrderDetail>,
+ org.apache.olingo.ext.proxy.api.StructuredQuery<OrderDetail> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getOrderID();
+
+ void setOrderID(java.lang.Integer _orderID);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getProductID();
+
+ void setProductID(java.lang.Integer _productID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderPlaced",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getOrderPlaced();
+
+ void setOrderPlaced(java.sql.Timestamp _orderPlaced);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Quantity",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getQuantity();
+
+ void setQuantity(java.lang.Integer _quantity);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "UnitPrice",
+ type = "Edm.Single",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Float getUnitPrice();
+
+ void setUnitPrice(java.lang.Float _unitPrice);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ProductOrdered",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Product",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Products",
+ containsTarget = false)
+ ProductCollection
+ getProductOrdered();
+
+ void
+ setProductOrdered(
+ ProductCollection _productOrdered);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "AssociatedOrder",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Order",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Orders",
+ containsTarget = false)
+ Order
+ getAssociatedOrder();
+
+ void
+ setAssociatedOrder(
+ Order _associatedOrder);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "OrderID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getOrderIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getProductIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "OrderPlaced",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getOrderPlacedAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Quantity",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getQuantityAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "UnitPrice",
+ type = "Edm.Single")
+ org.apache.olingo.ext.proxy.api.Annotatable getUnitPriceAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "ProductOrdered",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Product")
+ org.apache.olingo.ext.proxy.api.Annotatable getProductOrderedAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "AssociatedOrder",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Order")
+ org.apache.olingo.ext.proxy.api.Annotatable getAssociatedOrderAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailCollection.java
new file mode 100644
index 0000000..4c64a9a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface OrderDetailCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<OrderDetailCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<OrderDetail, OrderDetailCollection, OrderDetailCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailCollectionComposableInvoker.java
new file mode 100644
index 0000000..c423577
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface OrderDetailCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<OrderDetailCollection, OrderDetailCollection.Operations> {
+
+ @Override
+ OrderDetailCollectionComposableInvoker select(String... select);
+
+ @Override
+ OrderDetailCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailComposableInvoker.java
new file mode 100644
index 0000000..a5c3178
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailComposableInvoker.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface OrderDetailComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<OrderDetail, OrderDetail.Operations>
+{
+
+ @Override
+ OrderDetailComposableInvoker select(String... select);
+
+ @Override
+ OrderDetailComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getOrderID();
+
+ void setOrderID(java.lang.Integer _orderID);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getProductID();
+
+ void setProductID(java.lang.Integer _productID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderPlaced",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getOrderPlaced();
+
+ void setOrderPlaced(java.sql.Timestamp _orderPlaced);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Quantity",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getQuantity();
+
+ void setQuantity(java.lang.Integer _quantity);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "UnitPrice",
+ type = "Edm.Single",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Float getUnitPrice();
+
+ void setUnitPrice(java.lang.Float _unitPrice);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ProductOrdered",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Product",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Products",
+ containsTarget = false)
+ ProductCollection
+ getProductOrdered();
+
+ void
+ setProductOrdered(
+ ProductCollection _productOrdered);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "AssociatedOrder",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Order",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Orders",
+ containsTarget = false)
+ Order
+ getAssociatedOrder();
+
+ void
+ setAssociatedOrder(
+ Order _associatedOrder);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailKey.java
new file mode 100644
index 0000000..b9658cd
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailKey.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
+
+@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
+public class OrderDetailKey extends AbstractEntityKey {
+
+ private static final long serialVersionUID = -4068508671802176607L;
+
+ private java.lang.Integer _orderID;
+
+ @CompoundKeyElement(name = "OrderID", position = 0)
+ public java.lang.Integer getOrderID() {
+ return _orderID;
+ }
+
+ public void setOrderID(final java.lang.Integer _orderID) {
+ this._orderID = _orderID;
+ }
+
+ private java.lang.Integer _productID;
+
+ @CompoundKeyElement(name = "ProductID", position = 1)
+ public java.lang.Integer getProductID() {
+ return _productID;
+ }
+
+ public void setProductID(final java.lang.Integer _productID) {
+ this._productID = _productID;
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrument.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrument.java
new file mode 100644
index 0000000..7be9777
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrument.java
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "PaymentInstrument",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface PaymentInstrument
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<PaymentInstrument>,
+ org.apache.olingo.ext.proxy.api.StructuredQuery<PaymentInstrument> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PaymentInstrumentID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getPaymentInstrumentID();
+
+ void setPaymentInstrumentID(java.lang.Integer _paymentInstrumentID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FriendlyName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFriendlyName();
+
+ void setFriendlyName(java.lang.String _friendlyName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getCreatedDate();
+
+ void setCreatedDate(java.sql.Timestamp _createdDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "TheStoredPI",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "StoredPIs",
+ containsTarget = false)
+ StoredPI
+ getTheStoredPI();
+
+ void
+ setTheStoredPI(
+ StoredPI _theStoredPI);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "BackupStoredPI",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "StoredPIs",
+ containsTarget = false)
+ StoredPI
+ getBackupStoredPI();
+
+ void
+ setBackupStoredPI(
+ StoredPI _backupStoredPI);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PaymentInstrumentID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getPaymentInstrumentIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FriendlyName",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getFriendlyNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CreatedDate",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getCreatedDateAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "TheStoredPI",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI")
+ org.apache.olingo.ext.proxy.api.Annotatable getTheStoredPIAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "BillingStatements",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Statement")
+ org.apache.olingo.ext.proxy.api.Annotatable getBillingStatementsAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "BackupStoredPI",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI")
+ org.apache.olingo.ext.proxy.api.Annotatable getBackupStoredPIAnnotations();
+ }
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "BillingStatements",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "StoredPIs",
+ containsTarget = true)
+ PaymentInstrument.BillingStatements
+ getBillingStatements();
+
+ void
+ setBillingStatements(
+ PaymentInstrument.BillingStatements _billingStatements);
+
+ @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "BillingStatements", contained = true)
+ interface BillingStatements
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Statement, StatementCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<BillingStatements>,
+ AbstractEntitySet<Statement, java.lang.Integer, StatementCollection> {
+ // No additional methods needed for now.
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentCollection.java
new file mode 100644
index 0000000..590f0cf
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface PaymentInstrumentCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<PaymentInstrumentCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<PaymentInstrument, PaymentInstrumentCollection, PaymentInstrumentCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentCollectionComposableInvoker.java
new file mode 100644
index 0000000..94f7fa9
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface PaymentInstrumentCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<PaymentInstrumentCollection, PaymentInstrumentCollection.Operations> {
+
+ @Override
+ PaymentInstrumentCollectionComposableInvoker select(String... select);
+
+ @Override
+ PaymentInstrumentCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentComposableInvoker.java
new file mode 100644
index 0000000..f2b614d
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentComposableInvoker.java
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+public interface PaymentInstrumentComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<PaymentInstrument, PaymentInstrument.Operations>
+{
+
+ @Override
+ PaymentInstrumentComposableInvoker select(String... select);
+
+ @Override
+ PaymentInstrumentComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PaymentInstrumentID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getPaymentInstrumentID();
+
+ void setPaymentInstrumentID(java.lang.Integer _paymentInstrumentID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FriendlyName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFriendlyName();
+
+ void setFriendlyName(java.lang.String _friendlyName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getCreatedDate();
+
+ void setCreatedDate(java.sql.Timestamp _createdDate);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "TheStoredPI",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "StoredPIs",
+ containsTarget = false)
+ StoredPI
+ getTheStoredPI();
+
+ void
+ setTheStoredPI(
+ StoredPI _theStoredPI);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "BackupStoredPI",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "StoredPIs",
+ containsTarget = false)
+ StoredPI
+ getBackupStoredPI();
+
+ void
+ setBackupStoredPI(
+ StoredPI _backupStoredPI);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "BillingStatements",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "StoredPIs",
+ containsTarget = true)
+ PaymentInstrument.BillingStatements
+ getBillingStatements();
+
+ void
+ setBillingStatements(
+ PaymentInstrument.BillingStatements _billingStatements);
+
+ @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "BillingStatements", contained = true)
+ interface BillingStatements
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Statement, StatementCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<BillingStatements>,
+ AbstractEntitySet<Statement, java.lang.Integer, StatementCollection> {
+ // No additional methods needed for now.
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Person.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Person.java
new file mode 100644
index 0000000..a5f006e
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Person.java
@@ -0,0 +1,240 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.OperationType;
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Person",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface Person
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Person>, org.apache.olingo.ext.proxy.api.StructuredQuery<Person> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getPersonID();
+
+ void setPersonID(java.lang.Integer _personID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFirstName();
+
+ void setFirstName(java.lang.String _firstName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getLastName();
+
+ void setLastName(java.lang.String _lastName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "MiddleName",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getMiddleName();
+
+ void setMiddleName(java.lang.String _middleName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HomeAddress",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Address
+ getHomeAddress();
+
+ void
+ setHomeAddress(
+ Address _homeAddress);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Home",
+ type = "Edm.GeographyPoint",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.commons.api.edm.geo.Point getHome();
+
+ void setHome(org.apache.olingo.commons.api.edm.geo.Point _home);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Numbers",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getNumbers();
+
+ void setNumbers(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _numbers);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Emails",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getEmails();
+
+ void setEmails(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _emails);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Parent",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Person",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "People",
+ containsTarget = false)
+ Person getParent();
+
+ void setParent(
+ Person _parent);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(
+ name = "GetHomeAddress",
+ type = OperationType.FUNCTION,
+ isComposable = true,
+ referenceType = HomeAddress.class,
+ returnType = "Microsoft.Test.OData.Services.ODataWCFService.HomeAddress")
+ HomeAddressComposableInvoker
+ getHomeAddress(
+ );
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(
+ name = "ResetAddress",
+ type = OperationType.ACTION,
+ referenceType = Person.class,
+ returnType = "Microsoft.Test.OData.Services.ODataWCFService.Person")
+ org.apache.olingo.ext.proxy.api.StructuredInvoker<Person>
+ resetAddress(
+ @Parameter(name = "addresses", type = "Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)",
+ nullable = false) AddressCollection addresses,
+ @Parameter(name = "index", type = "Edm.Int32", nullable = false) java.lang.Integer index
+ );
+
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PersonID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getPersonIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FirstName",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getFirstNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "LastName",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getLastNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "MiddleName",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getMiddleNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "HomeAddress",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address")
+ org.apache.olingo.ext.proxy.api.Annotatable getHomeAddressAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Home",
+ type = "Edm.GeographyPoint")
+ org.apache.olingo.ext.proxy.api.Annotatable getHomeAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Numbers",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNumbersAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Emails",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getEmailsAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Parent",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Person")
+ org.apache.olingo.ext.proxy.api.Annotatable getParentAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonCollection.java
new file mode 100644
index 0000000..4a50797
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface PersonCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<PersonCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Person, PersonCollection, PersonCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonCollectionComposableInvoker.java
new file mode 100644
index 0000000..e4a892e
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface PersonCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<PersonCollection, PersonCollection.Operations> {
+
+ @Override
+ PersonCollectionComposableInvoker select(String... select);
+
+ @Override
+ PersonCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonComposableInvoker.java
new file mode 100644
index 0000000..05e6083
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonComposableInvoker.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface PersonComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Person, Person.Operations>
+{
+
+ @Override
+ PersonComposableInvoker select(String... select);
+
+ @Override
+ PersonComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getPersonID();
+
+ void setPersonID(java.lang.Integer _personID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getFirstName();
+
+ void setFirstName(java.lang.String _firstName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getLastName();
+
+ void setLastName(java.lang.String _lastName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "MiddleName",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getMiddleName();
+
+ void setMiddleName(java.lang.String _middleName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HomeAddress",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Address
+ getHomeAddress();
+
+ void
+ setHomeAddress(
+ Address _homeAddress);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Home",
+ type = "Edm.GeographyPoint",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.commons.api.edm.geo.Point getHome();
+
+ void setHome(org.apache.olingo.commons.api.edm.geo.Point _home);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Numbers",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getNumbers();
+
+ void setNumbers(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _numbers);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Emails",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getEmails();
+
+ void setEmails(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _emails);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Parent",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Person",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "People",
+ containsTarget = false)
+ Person getParent();
+
+ void setParent(
+ Person _parent);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Product.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Product.java
new file mode 100644
index 0000000..8ef6b49
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Product.java
@@ -0,0 +1,266 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.OperationType;
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Product",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface Product
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Product>, org.apache.olingo.ext.proxy.api.StructuredQuery<Product> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getProductID();
+
+ void setProductID(java.lang.Integer _productID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "QuantityPerUnit",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getQuantityPerUnit();
+
+ void setQuantityPerUnit(java.lang.String _quantityPerUnit);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "UnitPrice",
+ type = "Edm.Single",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Float getUnitPrice();
+
+ void setUnitPrice(java.lang.Float _unitPrice);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "QuantityInStock",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getQuantityInStock();
+
+ void setQuantityInStock(java.lang.Integer _quantityInStock);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Discontinued",
+ type = "Edm.Boolean",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Boolean getDiscontinued();
+
+ void setDiscontinued(java.lang.Boolean _discontinued);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "UserAccess",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.AccessLevel",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ AccessLevel
+ getUserAccess();
+
+ void
+ setUserAccess(
+ AccessLevel _userAccess);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "SkinColor",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Color",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Color getSkinColor();
+
+ void
+ setSkinColor(
+ Color _skinColor);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CoverColors",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Color",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<Color>
+ getCoverColors();
+
+ void
+ setCoverColors(
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<Color> _coverColors);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Details",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.ProductDetail",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "ProductDetails",
+ containsTarget = false)
+ ProductDetailCollection
+ getDetails();
+
+ void
+ setDetails(
+ ProductDetailCollection _details);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(
+ name = "GetProductDetails",
+ type = OperationType.FUNCTION,
+ isComposable = true,
+ referenceType = ProductDetailCollection.class,
+ returnType = "Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)")
+ ProductDetailCollectionComposableInvoker
+ getProductDetails(
+ @Parameter(name = "count", type = "Edm.Int32", nullable = true) java.lang.Integer count
+ );
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(
+ name = "AddAccessRight",
+ type = OperationType.ACTION,
+ referenceType = AccessLevel.class,
+ returnType = "Microsoft.Test.OData.Services.ODataWCFService.AccessLevel")
+ org.apache.olingo.ext.proxy.api.Invoker<AccessLevel>
+ addAccessRight(
+ @Parameter(name = "accessRight", type = "Microsoft.Test.OData.Services.ODataWCFService.AccessLevel",
+ nullable = true) AccessLevel accessRight
+ );
+
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getProductIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "QuantityPerUnit",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getQuantityPerUnitAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "UnitPrice",
+ type = "Edm.Single")
+ org.apache.olingo.ext.proxy.api.Annotatable getUnitPriceAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "QuantityInStock",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getQuantityInStockAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Discontinued",
+ type = "Edm.Boolean")
+ org.apache.olingo.ext.proxy.api.Annotatable getDiscontinuedAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "UserAccess",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.AccessLevel")
+ org.apache.olingo.ext.proxy.api.Annotatable getUserAccessAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "SkinColor",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Color")
+ org.apache.olingo.ext.proxy.api.Annotatable getSkinColorAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CoverColors",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Color")
+ org.apache.olingo.ext.proxy.api.Annotatable getCoverColorsAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Details",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.ProductDetail")
+ org.apache.olingo.ext.proxy.api.Annotatable getDetailsAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductCollection.java
new file mode 100644
index 0000000..4faab64
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductCollection.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+import org.apache.olingo.ext.proxy.api.OperationType;
+import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+
+public interface ProductCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ProductCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Product, ProductCollection, ProductCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(
+ name = "Discount",
+ type = OperationType.ACTION,
+ referenceType = ProductCollection.class,
+ returnType = "Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)")
+ org.apache.olingo.ext.proxy.api.StructuredCollectionInvoker<ProductCollection>
+ discount(
+ @Parameter(name = "percentage", type = "Edm.Int32", nullable = false) java.lang.Integer percentage
+ );
+
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductCollectionComposableInvoker.java
new file mode 100644
index 0000000..a43fba0
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface ProductCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<ProductCollection, ProductCollection.Operations> {
+
+ @Override
+ ProductCollectionComposableInvoker select(String... select);
+
+ @Override
+ ProductCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductComposableInvoker.java
new file mode 100644
index 0000000..ad61add
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductComposableInvoker.java
@@ -0,0 +1,193 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface ProductComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Product, Product.Operations>
+{
+
+ @Override
+ ProductComposableInvoker select(String... select);
+
+ @Override
+ ProductComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getProductID();
+
+ void setProductID(java.lang.Integer _productID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "QuantityPerUnit",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getQuantityPerUnit();
+
+ void setQuantityPerUnit(java.lang.String _quantityPerUnit);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "UnitPrice",
+ type = "Edm.Single",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Float getUnitPrice();
+
+ void setUnitPrice(java.lang.Float _unitPrice);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "QuantityInStock",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getQuantityInStock();
+
+ void setQuantityInStock(java.lang.Integer _quantityInStock);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Discontinued",
+ type = "Edm.Boolean",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Boolean getDiscontinued();
+
+ void setDiscontinued(java.lang.Boolean _discontinued);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "UserAccess",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.AccessLevel",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ AccessLevel
+ getUserAccess();
+
+ void
+ setUserAccess(
+ AccessLevel _userAccess);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "SkinColor",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Color",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Color getSkinColor();
+
+ void
+ setSkinColor(
+ Color _skinColor);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CoverColors",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Color",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<Color>
+ getCoverColors();
+
+ void
+ setCoverColors(
+ org.apache.olingo.ext.proxy.api.PrimitiveCollection<Color> _coverColors);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Details",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.ProductDetail",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "ProductDetails",
+ containsTarget = false)
+ ProductDetailCollection
+ getDetails();
+
+ void
+ setDetails(
+ ProductDetailCollection _details);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetail.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetail.java
new file mode 100644
index 0000000..3118b8a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetail.java
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.OperationType;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
+
+@KeyRef(ProductDetailKey.class)
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "ProductDetail",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface ProductDetail
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<ProductDetail>,
+ org.apache.olingo.ext.proxy.api.StructuredQuery<ProductDetail> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getProductID();
+
+ void setProductID(java.lang.Integer _productID);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductDetailID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getProductDetailID();
+
+ void setProductDetailID(java.lang.Integer _productDetailID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getProductName();
+
+ void setProductName(java.lang.String _productName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Description",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getDescription();
+
+ void setDescription(java.lang.String _description);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "RelatedProduct",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Product",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Products",
+ containsTarget = false)
+ Product
+ getRelatedProduct();
+
+ void
+ setRelatedProduct(
+ Product _relatedProduct);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Reviews",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.ProductReview",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "ProductReviews",
+ containsTarget = false)
+ ProductReviewCollection
+ getReviews();
+
+ void
+ setReviews(
+ ProductReviewCollection _reviews);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.Operation(
+ name = "GetRelatedProduct",
+ type = OperationType.FUNCTION,
+ isComposable = true,
+ referenceType = Product.class,
+ returnType = "Microsoft.Test.OData.Services.ODataWCFService.Product")
+ ProductComposableInvoker
+ getRelatedProduct(
+ );
+
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getProductIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductDetailID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getProductDetailIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductName",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getProductNameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Description",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getDescriptionAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "RelatedProduct",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Product")
+ org.apache.olingo.ext.proxy.api.Annotatable getRelatedProductAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Reviews",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.ProductReview")
+ org.apache.olingo.ext.proxy.api.Annotatable getReviewsAnnotations();
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailCollection.java
new file mode 100644
index 0000000..351468d
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface ProductDetailCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ProductDetailCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<ProductDetail, ProductDetailCollection, ProductDetailCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailCollectionComposableInvoker.java
new file mode 100644
index 0000000..c5ab2bd
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface ProductDetailCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<ProductDetailCollection, ProductDetailCollection.Operations> {
+
+ @Override
+ ProductDetailCollectionComposableInvoker select(String... select);
+
+ @Override
+ ProductDetailCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailComposableInvoker.java
new file mode 100644
index 0000000..1413ee7
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailComposableInvoker.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface ProductDetailComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<ProductDetail, ProductDetail.Operations>
+{
+
+ @Override
+ ProductDetailComposableInvoker select(String... select);
+
+ @Override
+ ProductDetailComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getProductID();
+
+ void setProductID(java.lang.Integer _productID);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductDetailID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getProductDetailID();
+
+ void setProductDetailID(java.lang.Integer _productDetailID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getProductName();
+
+ void setProductName(java.lang.String _productName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Description",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getDescription();
+
+ void setDescription(java.lang.String _description);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "RelatedProduct",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Product",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Products",
+ containsTarget = false)
+ Product
+ getRelatedProduct();
+
+ void
+ setRelatedProduct(
+ Product _relatedProduct);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Reviews",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.ProductReview",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "ProductReviews",
+ containsTarget = false)
+ ProductReviewCollection
+ getReviews();
+
+ void
+ setReviews(
+ ProductReviewCollection _reviews);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailKey.java
new file mode 100644
index 0000000..fe42987
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailKey.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
+
+@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
+public class ProductDetailKey extends AbstractEntityKey {
+
+ private static final long serialVersionUID = -6268946147639590355L;
+
+ private java.lang.Integer _productID;
+
+ @CompoundKeyElement(name = "ProductID", position = 0)
+ public java.lang.Integer getProductID() {
+ return _productID;
+ }
+
+ public void setProductID(final java.lang.Integer _productID) {
+ this._productID = _productID;
+ }
+
+ private java.lang.Integer _productDetailID;
+
+ @CompoundKeyElement(name = "ProductDetailID", position = 1)
+ public java.lang.Integer getProductDetailID() {
+ return _productDetailID;
+ }
+
+ public void setProductDetailID(final java.lang.Integer _productDetailID) {
+ this._productDetailID = _productDetailID;
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReview.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReview.java
new file mode 100644
index 0000000..0aced06
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReview.java
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@KeyRef(ProductReviewKey.class)
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "ProductReview",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface ProductReview
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<ProductReview>,
+ org.apache.olingo.ext.proxy.api.StructuredQuery<ProductReview> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getProductID();
+
+ void setProductID(java.lang.Integer _productID);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductDetailID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getProductDetailID();
+
+ void setProductDetailID(java.lang.Integer _productDetailID);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ReviewTitle",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getReviewTitle();
+
+ void setReviewTitle(java.lang.String _reviewTitle);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "RevisionID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getRevisionID();
+
+ void setRevisionID(java.lang.Integer _revisionID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Comment",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getComment();
+
+ void setComment(java.lang.String _comment);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Author",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getAuthor();
+
+ void setAuthor(java.lang.String _author);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getProductIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductDetailID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getProductDetailIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ReviewTitle",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getReviewTitleAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "RevisionID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getRevisionIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Comment",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getCommentAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Author",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getAuthorAnnotations();
+
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewCollection.java
new file mode 100644
index 0000000..1a26007
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface ProductReviewCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ProductReviewCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<ProductReview, ProductReviewCollection, ProductReviewCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewCollectionComposableInvoker.java
new file mode 100644
index 0000000..9a10d65
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface ProductReviewCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<ProductReviewCollection, ProductReviewCollection.Operations> {
+
+ @Override
+ ProductReviewCollectionComposableInvoker select(String... select);
+
+ @Override
+ ProductReviewCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewComposableInvoker.java
new file mode 100644
index 0000000..5076205
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewComposableInvoker.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface ProductReviewComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<ProductReview, ProductReview.Operations>
+{
+
+ @Override
+ ProductReviewComposableInvoker select(String... select);
+
+ @Override
+ ProductReviewComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getProductID();
+
+ void setProductID(java.lang.Integer _productID);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductDetailID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getProductDetailID();
+
+ void setProductDetailID(java.lang.Integer _productDetailID);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ReviewTitle",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getReviewTitle();
+
+ void setReviewTitle(java.lang.String _reviewTitle);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "RevisionID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getRevisionID();
+
+ void setRevisionID(java.lang.Integer _revisionID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Comment",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getComment();
+
+ void setComment(java.lang.String _comment);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Author",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getAuthor();
+
+ void setAuthor(java.lang.String _author);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewKey.java
new file mode 100644
index 0000000..eff975b
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewKey.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
+
+@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
+public class ProductReviewKey extends AbstractEntityKey {
+
+ private static final long serialVersionUID = 5483520057777167030L;
+
+ private java.lang.Integer _productID;
+
+ @CompoundKeyElement(name = "ProductID", position = 0)
+ public java.lang.Integer getProductID() {
+ return _productID;
+ }
+
+ public void setProductID(final java.lang.Integer _productID) {
+ this._productID = _productID;
+ }
+
+ private java.lang.Integer _productDetailID;
+
+ @CompoundKeyElement(name = "ProductDetailID", position = 1)
+ public java.lang.Integer getProductDetailID() {
+ return _productDetailID;
+ }
+
+ public void setProductDetailID(final java.lang.Integer _productDetailID) {
+ this._productDetailID = _productDetailID;
+ }
+
+ private java.lang.String _reviewTitle;
+
+ @CompoundKeyElement(name = "ReviewTitle", position = 2)
+ public java.lang.String getReviewTitle() {
+ return _reviewTitle;
+ }
+
+ public void setReviewTitle(final java.lang.String _reviewTitle) {
+ this._reviewTitle = _reviewTitle;
+ }
+
+ private java.lang.Integer _revisionID;
+
+ @CompoundKeyElement(name = "RevisionID", position = 3)
+ public java.lang.Integer getRevisionID() {
+ return _revisionID;
+ }
+
+ public void setRevisionID(final java.lang.Integer _revisionID) {
+ this._revisionID = _revisionID;
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompany.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompany.java
new file mode 100644
index 0000000..cdace92
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompany.java
@@ -0,0 +1,345 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.concurrent.Future;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "PublicCompany",
+ openType = true,
+ hasStream = false,
+ isAbstract = false,
+ baseType = "Microsoft.Test.OData.Services.ODataWCFService.Company")
+public interface PublicCompany
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ Company,
+ AbstractOpenType {
+
+ @Override
+ PublicCompany load();
+
+ @Override
+ Future<? extends PublicCompany> loadAsync();
+
+ @Override
+ PublicCompany refs();
+
+ @Override
+ PublicCompany expand(String... expand);
+
+ @Override
+ PublicCompany select(String... select);
+
+ @Override
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getCompanyID();
+
+ @Override
+ void setCompanyID(java.lang.Integer _companyID);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyCategory",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ CompanyCategory
+ getCompanyCategory();
+
+ @Override
+ void
+ setCompanyCategory(
+ CompanyCategory _companyCategory);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Revenue",
+ type = "Edm.Int64",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Long getRevenue();
+
+ @Override
+ void setRevenue(java.lang.Long _revenue);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ @Override
+ void setName(java.lang.String _name);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Address getAddress();
+
+ @Override
+ void
+ setAddress(
+ Address _address);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "StockExchange",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getStockExchange();
+
+ void setStockExchange(java.lang.String _stockExchange);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Employees",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Employee",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Employees",
+ containsTarget = false)
+ EmployeeCollection
+ getEmployees();
+
+ @Override
+ void
+ setEmployees(
+ EmployeeCollection _employees);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "VipCustomer",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Customer",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "VipCustomer",
+ containsTarget = false)
+ Customer
+ getVipCustomer();
+
+ @Override
+ void
+ setVipCustomer(
+ Customer _vipCustomer);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Departments",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Departments",
+ containsTarget = false)
+ DepartmentCollection
+ getDepartments();
+
+ @Override
+ void
+ setDepartments(
+ DepartmentCollection _departments);
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CoreDepartment",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Departments",
+ containsTarget = false)
+ Department
+ getCoreDepartment();
+
+ @Override
+ void
+ setCoreDepartment(
+ Department _coreDepartment);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Club",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Club",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "",
+ targetEntitySet = "",
+ containsTarget = true)
+ Club getClub();
+
+ void setClub(
+ Club _club);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "LabourUnion",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.LabourUnion",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "LabourUnion",
+ containsTarget = false)
+ LabourUnion
+ getLabourUnion();
+
+ void
+ setLabourUnion(
+ LabourUnion _labourUnion);
+
+ @Override
+ Operations operations();
+
+ interface Operations
+ extends
+ Company.Operations {
+ // No additional methods needed for now.
+ }
+
+ @Override
+ Annotations annotations();
+
+ interface Annotations
+ extends
+ Company.Annotations {
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CompanyID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getCompanyIDAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CompanyCategory",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory")
+ org.apache.olingo.ext.proxy.api.Annotatable getCompanyCategoryAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Revenue",
+ type = "Edm.Int64")
+ org.apache.olingo.ext.proxy.api.Annotatable getRevenueAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Address",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address")
+ org.apache.olingo.ext.proxy.api.Annotatable getAddressAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "StockExchange",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getStockExchangeAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Employees",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Employee")
+ org.apache.olingo.ext.proxy.api.Annotatable getEmployeesAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "VipCustomer",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Customer")
+ org.apache.olingo.ext.proxy.api.Annotatable getVipCustomerAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Departments",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Department")
+ org.apache.olingo.ext.proxy.api.Annotatable getDepartmentsAnnotations();
+
+ @Override
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "CoreDepartment",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Department")
+ org.apache.olingo.ext.proxy.api.Annotatable getCoreDepartmentAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Assets",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Asset")
+ org.apache.olingo.ext.proxy.api.Annotatable getAssetsAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Club",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Club")
+ org.apache.olingo.ext.proxy.api.Annotatable getClubAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "LabourUnion",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.LabourUnion")
+ org.apache.olingo.ext.proxy.api.Annotatable getLabourUnionAnnotations();
+ }
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Assets",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.LabourUnion",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "LabourUnion",
+ containsTarget = true)
+ PublicCompany.Assets
+ getAssets();
+
+ void
+ setAssets(
+ PublicCompany.Assets _assets);
+
+ @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Assets", contained = true)
+ interface Assets
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Asset, AssetCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Assets>,
+ AbstractEntitySet<Asset, java.lang.Integer, AssetCollection> {
+ // No additional methods needed for now.
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyCollection.java
new file mode 100644
index 0000000..65b906f
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface PublicCompanyCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<PublicCompanyCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<PublicCompany, PublicCompanyCollection, PublicCompanyCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyCollectionComposableInvoker.java
new file mode 100644
index 0000000..4d71270
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface PublicCompanyCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<PublicCompanyCollection, PublicCompanyCollection.Operations> {
+
+ @Override
+ PublicCompanyCollectionComposableInvoker select(String... select);
+
+ @Override
+ PublicCompanyCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyComposableInvoker.java
new file mode 100644
index 0000000..dca239d
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyComposableInvoker.java
@@ -0,0 +1,232 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+public interface PublicCompanyComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<PublicCompany, PublicCompany.Operations>
+ , AbstractOpenType {
+
+ @Override
+ PublicCompanyComposableInvoker select(String... select);
+
+ @Override
+ PublicCompanyComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getCompanyID();
+
+ void setCompanyID(java.lang.Integer _companyID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyCategory",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ CompanyCategory
+ getCompanyCategory();
+
+ void
+ setCompanyCategory(
+ CompanyCategory _companyCategory);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Revenue",
+ type = "Edm.Int64",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Long getRevenue();
+
+ void setRevenue(java.lang.Long _revenue);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getName();
+
+ void setName(java.lang.String _name);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ Address getAddress();
+
+ void
+ setAddress(
+ Address _address);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "StockExchange",
+ type = "Edm.String",
+ nullable = true,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getStockExchange();
+
+ void setStockExchange(java.lang.String _stockExchange);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Employees",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Employee",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Employees",
+ containsTarget = false)
+ EmployeeCollection
+ getEmployees();
+
+ void
+ setEmployees(
+ EmployeeCollection _employees);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "VipCustomer",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Customer",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "VipCustomer",
+ containsTarget = false)
+ Customer
+ getVipCustomer();
+
+ void
+ setVipCustomer(
+ Customer _vipCustomer);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Departments",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Departments",
+ containsTarget = false)
+ DepartmentCollection
+ getDepartments();
+
+ void
+ setDepartments(
+ DepartmentCollection _departments);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CoreDepartment",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "Departments",
+ containsTarget = false)
+ Department
+ getCoreDepartment();
+
+ void
+ setCoreDepartment(
+ Department _coreDepartment);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Club",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.Club",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "",
+ targetEntitySet = "",
+ containsTarget = true)
+ Club getClub();
+
+ void setClub(
+ Club _club);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "LabourUnion",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.LabourUnion",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "LabourUnion",
+ containsTarget = false)
+ LabourUnion
+ getLabourUnion();
+
+ void
+ setLabourUnion(
+ LabourUnion _labourUnion);
+
+ @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Assets",
+ type = "Microsoft.Test.OData.Services.ODataWCFService.LabourUnion",
+ targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
+ targetContainer = "InMemoryEntities",
+ targetEntitySet = "LabourUnion",
+ containsTarget = true)
+ PublicCompany.Assets
+ getAssets();
+
+ void
+ setAssets(
+ PublicCompany.Assets _assets);
+
+ @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Assets", contained = true)
+ interface Assets
+ extends
+ org.apache.olingo.ext.proxy.api.EntitySet<Asset, AssetCollection>,
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Assets>,
+ AbstractEntitySet<Asset, java.lang.Integer, AssetCollection> {
+ // No additional methods needed for now.
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Statement.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Statement.java
new file mode 100644
index 0000000..4062570
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Statement.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Statement",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface Statement
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Statement>, org.apache.olingo.ext.proxy.api.StructuredQuery<Statement> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "StatementID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getStatementID();
+
+ void setStatementID(java.lang.Integer _statementID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TransactionType",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getTransactionType();
+
+ void setTransactionType(java.lang.String _transactionType);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TransactionDescription",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getTransactionDescription();
+
+ void setTransactionDescription(java.lang.String _transactionDescription);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Amount",
+ type = "Edm.Double",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Double getAmount();
+
+ void setAmount(java.lang.Double _amount);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "StatementID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getStatementIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "TransactionType",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getTransactionTypeAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "TransactionDescription",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getTransactionDescriptionAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Amount",
+ type = "Edm.Double")
+ org.apache.olingo.ext.proxy.api.Annotatable getAmountAnnotations();
+
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementCollection.java
new file mode 100644
index 0000000..2f07e87
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface StatementCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<StatementCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Statement, StatementCollection, StatementCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementCollectionComposableInvoker.java
new file mode 100644
index 0000000..df14aac
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface StatementCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<StatementCollection, StatementCollection.Operations> {
+
+ @Override
+ StatementCollectionComposableInvoker select(String... select);
+
+ @Override
+ StatementCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementComposableInvoker.java
new file mode 100644
index 0000000..c6b290a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementComposableInvoker.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface StatementComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Statement, Statement.Operations>
+{
+
+ @Override
+ StatementComposableInvoker select(String... select);
+
+ @Override
+ StatementComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "StatementID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getStatementID();
+
+ void setStatementID(java.lang.Integer _statementID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TransactionType",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getTransactionType();
+
+ void setTransactionType(java.lang.String _transactionType);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TransactionDescription",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getTransactionDescription();
+
+ void setTransactionDescription(java.lang.String _transactionDescription);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Amount",
+ type = "Edm.Double",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Double getAmount();
+
+ void setAmount(java.lang.Double _amount);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPI.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPI.java
new file mode 100644
index 0000000..2394581
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPI.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "StoredPI",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface StoredPI
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<StoredPI>, org.apache.olingo.ext.proxy.api.StructuredQuery<StoredPI> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "StoredPIID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getStoredPIID();
+
+ void setStoredPIID(java.lang.Integer _storedPIID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PIName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getPIName();
+
+ void setPIName(java.lang.String _pIName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PIType",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getPIType();
+
+ void setPIType(java.lang.String _pIType);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getCreatedDate();
+
+ void setCreatedDate(java.sql.Timestamp _createdDate);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "StoredPIID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getStoredPIIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PIName",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getPINameAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PIType",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getPITypeAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CreatedDate",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getCreatedDateAnnotations();
+
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPICollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPICollection.java
new file mode 100644
index 0000000..b2622d9
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPICollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface StoredPICollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<StoredPICollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<StoredPI, StoredPICollection, StoredPICollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPICollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPICollectionComposableInvoker.java
new file mode 100644
index 0000000..a9c65f5
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPICollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface StoredPICollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<StoredPICollection, StoredPICollection.Operations> {
+
+ @Override
+ StoredPICollectionComposableInvoker select(String... select);
+
+ @Override
+ StoredPICollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPIComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPIComposableInvoker.java
new file mode 100644
index 0000000..f6d5d49
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPIComposableInvoker.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface StoredPIComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<StoredPI, StoredPI.Operations>
+{
+
+ @Override
+ StoredPIComposableInvoker select(String... select);
+
+ @Override
+ StoredPIComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "StoredPIID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getStoredPIID();
+
+ void setStoredPIID(java.lang.Integer _storedPIID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PIName",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getPIName();
+
+ void setPIName(java.lang.String _pIName);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PIType",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getPIType();
+
+ void setPIType(java.lang.String _pIType);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getCreatedDate();
+
+ void setCreatedDate(java.sql.Timestamp _createdDate);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Subscription.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Subscription.java
new file mode 100644
index 0000000..6a63879
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/Subscription.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
+@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Subscription",
+ openType = false,
+ hasStream = false,
+ isAbstract = false)
+public interface Subscription
+ extends org.apache.olingo.ext.proxy.api.Annotatable,
+ org.apache.olingo.ext.proxy.api.EntityType<Subscription>,
+ org.apache.olingo.ext.proxy.api.StructuredQuery<Subscription> {
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "SubscriptionID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getSubscriptionID();
+
+ void setSubscriptionID(java.lang.Integer _subscriptionID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TemplateGuid",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getTemplateGuid();
+
+ void setTemplateGuid(java.lang.String _templateGuid);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Title",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getTitle();
+
+ void setTitle(java.lang.String _title);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Category",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCategory();
+
+ void setCategory(java.lang.String _category);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getCreatedDate();
+
+ void setCreatedDate(java.sql.Timestamp _createdDate);
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Annotations annotations();
+
+ interface Annotations {
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "SubscriptionID",
+ type = "Edm.Int32")
+ org.apache.olingo.ext.proxy.api.Annotatable getSubscriptionIDAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "TemplateGuid",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getTemplateGuidAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Title",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getTitleAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Category",
+ type = "Edm.String")
+ org.apache.olingo.ext.proxy.api.Annotatable getCategoryAnnotations();
+
+ @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CreatedDate",
+ type = "Edm.DateTimeOffset")
+ org.apache.olingo.ext.proxy.api.Annotatable getCreatedDateAnnotations();
+
+ }
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionCollection.java
new file mode 100644
index 0000000..ae35e6a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionCollection.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import java.util.Collection;
+// CHECKSTYLE:ON (Maven checkstyle)
+
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
+
+public interface SubscriptionCollection
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<SubscriptionCollection>,
+org.apache.olingo.ext.proxy.api.EntityCollection<Subscription, SubscriptionCollection, SubscriptionCollection> {
+
+ Operations operations();
+
+ interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
+ // No additional methods needed for now.
+ }
+
+ Object getAnnotation(Class<? extends AbstractTerm> term);
+
+ Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionCollectionComposableInvoker.java
new file mode 100644
index 0000000..82e628c
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionCollectionComposableInvoker.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.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+
+public interface SubscriptionCollectionComposableInvoker
+ extends
+ org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<SubscriptionCollection, SubscriptionCollection.Operations> {
+
+ @Override
+ SubscriptionCollectionComposableInvoker select(String... select);
+
+ @Override
+ SubscriptionCollectionComposableInvoker expand(String... expand);
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionComposableInvoker.java
new file mode 100644
index 0000000..6c0a2c8
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionComposableInvoker.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
+// CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+
+// CHECKSTYLE:ON (Maven checkstyle)
+
+public interface SubscriptionComposableInvoker
+ extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Subscription, Subscription.Operations>
+{
+
+ @Override
+ SubscriptionComposableInvoker select(String... select);
+
+ @Override
+ SubscriptionComposableInvoker expand(String... expand);
+
+ @Key
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "SubscriptionID",
+ type = "Edm.Int32",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.Integer getSubscriptionID();
+
+ void setSubscriptionID(java.lang.Integer _subscriptionID);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TemplateGuid",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getTemplateGuid();
+
+ void setTemplateGuid(java.lang.String _templateGuid);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Title",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getTitle();
+
+ void setTitle(java.lang.String _title);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Category",
+ type = "Edm.String",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.lang.String getCategory();
+
+ void setCategory(java.lang.String _category);
+
+ @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
+ type = "Edm.DateTimeOffset",
+ nullable = false,
+ defaultValue = "",
+ maxLenght = Integer.MAX_VALUE,
+ fixedLenght = false,
+ precision = 0,
+ scale = 0,
+ unicode = true,
+ collation = "",
+ srid = "")
+ java.sql.Timestamp getCreatedDate();
+
+ void setCreatedDate(java.sql.Timestamp _createdDate);
+
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/package-info.java b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/package-info.java
new file mode 100644
index 0000000..bb754bd
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/staticservice/microsoft/test/odata/services/odatawcfservice/types/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.staticservice.microsoft.test.odata.services.odatawcfservice.types;
+
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
deleted file mode 100644
index 260d35b..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/APIBasicDesignTestITCase.java
+++ /dev/null
@@ -1,622 +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.fit.proxy.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-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 java.io.IOException;
-import java.lang.reflect.Proxy;
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.TimeZone;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.ext.proxy.AbstractService;
-import org.apache.olingo.ext.proxy.api.EdmStreamValue;
-import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
-import org.apache.olingo.ext.proxy.commons.AbstractCollectionInvocationHandler;
-import org.apache.olingo.fit.proxy.v4.demo.odatademo.DemoService;
-import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AddressCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddress;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonComposableInvoker;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollectionComposableInvoker;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetail;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollectionComposableInvoker;
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.junit.Test;
-
-public class APIBasicDesignTestITCase extends AbstractTestITCase {
-
- protected AbstractService<EdmEnabledODataClient> getService() {
- return service;
- }
-
- protected InMemoryEntities getContainer() {
- return container;
- }
-
- @Test
- public void readEntitySet() {
- final OrderCollection orders = container.getOrders().execute();
- assertFalse(orders.isEmpty());
-
- final CustomerCollection customers = container.getCustomers().
- orderBy("PersonID").
- select("FirstName", "LastName", "Orders").
- expand("Orders").
- execute();
-
- assertEquals(2, customers.size());
- for (Customer customer : customers) {
- assertNotNull(customer.getFirstName());
- assertNotNull(customer.getLastName());
- }
- }
-
- @Test
- public void readWithReferences() {
- final Person person = container.getOrders().getByKey(8).getCustomerForOrder().refs().load();
- assertEquals("http://localhost:9080/stub/StaticService/V40/Static.svc/Customers(PersonID=1)",
- person.readEntityReferenceID());
-
- final OrderCollection orders = container.getCustomers().getByKey(1).getOrders().refs().execute();
- assertEquals("http://localhost:9080/stub/StaticService/V40/Static.svc/Orders(7)",
- orders.iterator().next().readEntityReferenceID());
- }
-
- @Test
- public void changeSingleNavigationProperty() {
- /*
- * See OData Spec 11.4.6.3
- * Alternatively, a relationship MAY be updated as part of an update to the source entity by including
- * the required binding information for the new target entity.
- *
- * => use PATCH instead of PUT
- */
- final Person person1 = container.getPeople().getByKey(1).load();
- final Person person5 = container.getPeople().getByKey(5).load();
-
- person1.setParent(person5);
- container.flush();
- }
-
- @Test
- public void addViaReference() {
- final Order order = container.getOrders().getByKey(8).load();
-
- final OrderCollection orders = container.newEntityCollection(OrderCollection.class);
- orders.addRef(order);
-
- container.getCustomers().getByKey(1).setOrders(orders);
- container.flush();
- }
-
- @Test
- public void readAndCheckForPrimitive() {
- final Customer customer = getContainer().getCustomers().getByKey(1);
- assertNotNull(customer);
- assertNull(customer.getPersonID());
-
- assertEquals(1, customer.load().getPersonID(), 0);
- service.getContext().detachAll();
- }
-
- @Test
- public void readAndCheckForComplex() {
- Customer customer = container.getCustomers().getByKey(1); // no http request
- Address homeAddress = customer.getHomeAddress();
- assertNotNull(homeAddress);
- assertNull(homeAddress.getCity());
- assertNull(homeAddress.getPostalCode());
- assertNull(homeAddress.getStreet());
-
- homeAddress.load(); // HTTP request at complex loading
- assertEquals("London", homeAddress.getCity());
- assertEquals("98052", homeAddress.getPostalCode());
- assertEquals("1 Microsoft Way", homeAddress.getStreet());
-
- getService().getContext().detachAll();
-
- homeAddress = container.getCustomers().getByKey(1).load().getHomeAddress(); // HTTP request at entity loading
- assertEquals("London", homeAddress.getCity());
- assertEquals("98052", homeAddress.getPostalCode());
- assertEquals("1 Microsoft Way", homeAddress.getStreet());
-
- getService().getContext().detachAll();
-
- customer = container.getOrders().getByKey(8).getCustomerForOrder();
- homeAddress = customer.getHomeAddress().select("City", "PostalCode").expand("SomethingElse"); // no HTTP request
- assertNotNull(homeAddress);
- assertNull(homeAddress.getCity());
- assertNull(homeAddress.getPostalCode());
- assertNull(homeAddress.getStreet());
-
- try {
- homeAddress.load();
- fail();
- } catch (Exception e) {
- // Generated URL
- // "<serviceroot>/Orders(8)/CustomerForOrder/HomeAddress?$select=City,PostalCode&$expand=SomethingElse"
- // curently unsupported by test service server
- homeAddress.clearQueryOptions();
- }
- }
-
- @Test
- public void readWholeEntitySet() {
- PersonCollection person = getContainer().getPeople().execute();
- assertEquals(5, person.size(), 0);
-
- int pageCount = 1;
- while (person.hasNextPage()) {
- pageCount++;
- assertFalse(person.nextPage().execute().isEmpty());
- }
-
- assertEquals(2, pageCount);
- service.getContext().detachAll(); // avoid influences
- }
-
- @Test
- public void loadWithSelect() {
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order order =
- getContainer().getOrders().getByKey(8);
- assertNull(order.getOrderID());
- assertNull(order.getOrderDate());
-
- order.select("OrderID");
- order.load();
-
- assertNull(order.getOrderDate());
- assertNotNull(order.getOrderID());
-
- order.clearQueryOptions();
- order.load();
- assertNotNull(order.getOrderDate());
- assertNotNull(order.getOrderID());
- service.getContext().detachAll(); // avoid influences
- }
-
- @Test
- public void loadWithSelectAndExpand() {
- final Customer customer = getContainer().getCustomers().getByKey(1);
-
- customer.expand("Orders");
- customer.select("Orders", "PersonID");
-
- customer.load();
- assertEquals(1, customer.getOrders().size());
- service.getContext().detachAll(); // avoid influences
- }
-
- @Test
- public void navigateLinks() {
- final Customer customer = getContainer().getCustomers().getByKey(1); // No HTTP Request
- assertNotNull(customer.getCompany().load().getCompanyID()); // singleton: single request
- assertEquals(1, customer.getOrders().execute().size()); // collection: single request
-
- final Order order = getContainer().getOrders().getByKey(8); // No HTTP Requests
- assertNotNull(order.getCustomerForOrder().load().getPersonID()); // entity type: single request
-
- service.getContext().detachAll(); // avoid influences
- }
-
- @Test
- public void createDelete() {
- // Create order ....
- final Order order = getContainer().newEntityInstance(Order.class);
- order.setOrderID(1105);
-
- final Calendar orderDate = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- orderDate.clear();
- orderDate.set(2011, 3, 4, 16, 3, 57);
- order.setOrderDate(new Timestamp(orderDate.getTimeInMillis()));
-
- order.setShelfLife(BigDecimal.ZERO);
-
- final PrimitiveCollection<BigDecimal> osl = getContainer().newPrimitiveCollection(BigDecimal.class);
- osl.add(BigDecimal.TEN.negate());
- osl.add(BigDecimal.TEN);
-
- order.setOrderShelfLifes(osl);
-
- getContainer().getOrders().add(order);
- getContainer().flush();
-
- Order actual = getContainer().getOrders().getByKey(1105);
- assertNull(actual.getOrderID());
-
- actual.load();
- assertEquals(1105, actual.getOrderID(), 0);
- assertEquals(orderDate.getTimeInMillis(), actual.getOrderDate().getTime());
- assertEquals(BigDecimal.ZERO, actual.getShelfLife());
- assertEquals(2, actual.getOrderShelfLifes().size());
-
- service.getContext().detachAll();
-
- // (1) Delete by key (see EntityCreateTestITCase)
- getContainer().getOrders().delete(1105);
- assertNull(getContainer().getOrders().getByKey(1105));
-
- service.getContext().detachAll(); // detach to show the second delete case
-
- // (2) Delete by object (see EntityCreateTestITCase)
- getContainer().getOrders().delete(getContainer().getOrders().getByKey(1105));
- assertNull(getContainer().getOrders().getByKey(1105));
-
- // (3) Delete by invoking delete method on the object itself
- service.getContext().detachAll(); // detach to show the third delete case
- getContainer().getOrders().getByKey(1105).delete();
- assertNull(getContainer().getOrders().getByKey(1105));
-
- getContainer().flush();
-
- service.getContext().detachAll();
- try {
- getContainer().getOrders().getByKey(1105).load();
- fail();
- } catch (IllegalArgumentException e) {
- // Test
- }
- service.getContext().detachAll(); // avoid influences
- }
-
- @Test
- public void deleteSingleProperty() {
- container.getCustomers().getByKey(1).delete("City");
- container.flush();
- }
-
- @Test
- public void deleteComplex() {
- container.getCustomers().getByKey(1).getHomeAddress().delete();
- container.flush();
- }
-
- @Test
- public void deleteCollection() {
- container.getCustomers().getByKey(1).getEmails().delete();
- container.flush();
- }
-
- @Test
- public void deleteEdmStreamProperty() throws IOException {
- // ---------------------------------------
- // Instantiate Demo Service
- // ---------------------------------------
- final org.apache.olingo.fit.proxy.v4.demo.Service<EdmEnabledODataClient> dservice =
- org.apache.olingo.fit.proxy.v4.demo.Service.getV4(testDemoServiceRootURL);
- dservice.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- final DemoService dcontainer = dservice.getEntityContainer(DemoService.class);
- assertNotNull(dcontainer);
- dservice.getContext().detachAll();
- // ---------------------------------------
- dcontainer.getPersonDetails().getByKey(1).delete("Photo");
- dcontainer.flush();
-
- dservice.getContext().detachAll(); // avoid influences
- }
-
- @Test
- public void updateComplexProperty() {
- Address homeAddress = container.getCustomers().getByKey(1).getHomeAddress();
- homeAddress.setCity("Pescara");
- homeAddress.setPostalCode("98052");
- container.flush();
-
- homeAddress = container.getCustomers().getByKey(1).getHomeAddress().load();
- assertEquals("Pescara", homeAddress.getCity());
- assertEquals("98052", homeAddress.getPostalCode());
- }
-
- @Test
- public void updateAndReadEdmStreamProperty() throws IOException {
- // ---------------------------------------
- // Instantiate Demo Service
- // ---------------------------------------
- final org.apache.olingo.fit.proxy.v4.demo.Service<EdmEnabledODataClient> dservice =
- org.apache.olingo.fit.proxy.v4.demo.Service.getV4(testDemoServiceRootURL);
- dservice.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- final DemoService dcontainer = dservice.getEntityContainer(DemoService.class);
- assertNotNull(dcontainer);
- dservice.getContext().detachAll();
- // ---------------------------------------
- final String random = RandomStringUtils.random(124, "abcdefghijklmnopqrstuvwxyz");
-
- final PersonDetail personDetail = dcontainer.getPersonDetails().getByKey(1); // NO HTTP Request
-
- // 1 HTTP Request to add an Edm.Stream property value about MediaEditLink Photo
- personDetail.setPhoto(dcontainer.newEdmStreamValue("application/octet-stream", IOUtils.toInputStream(random)));
-
- dcontainer.flush();
-
- final EdmStreamValue actual = dcontainer.getPersonDetails().getByKey(1).getPhoto().load(); // 1 HTTP Request
- assertEquals(random, IOUtils.toString(actual.getStream()));
-
- dservice.getContext().detachAll(); // avoid influences
- }
-
- @Test
- public void boundOperationsAfterCreate() {
- final Product product = getContainer().newEntityInstance(Product.class);
- product.setProductID(1012);
- product.setName("Latte");
- product.setQuantityPerUnit("100g Bag");
- product.setUnitPrice(3.24f);
- product.setQuantityInStock(100);
- product.setDiscontinued(false);
- product.setUserAccess(AccessLevel.Execute);
- product.setSkinColor(Color.Blue);
-
- final PrimitiveCollection<Color> cc = getContainer().newPrimitiveCollection(Color.class);
- cc.add(Color.Red);
- cc.add(Color.Green);
-
- product.setCoverColors(cc);
-
- final ProductDetail detail = getContainer().newEntityInstance(ProductDetail.class);
- detail.setProductID(product.getProductID());
- detail.setProductDetailID(1012);
- detail.setProductName("LatteHQ");
- detail.setDescription("High-Quality Milk");
-
- final ProductDetailCollection detailCollection = getContainer().newEntityCollection(ProductDetailCollection.class);
- detailCollection.add(detail);
-
- product.setDetails(detailCollection);
-
- getContainer().getProducts().add(product);
-
- // The first HTTP Request to create product and the linked product detail
- getContainer().flush();
-
- // The second HTTP request to access a bound operation via the local object
- assertNotNull(product.operations().addAccessRight(AccessLevel.None).execute());
-
- // The third HTTP Request to access a bound operation via entity URL
- final ProductDetailCollectionComposableInvoker result =
- container.getProducts().getByKey(1012).operations().getProductDetails(1);
- assertEquals(1, result.execute().size());
- }
-
- @Test
- public void workingWithPrimitiveCollections() throws IOException {
- final PrimitiveCollection<String> emails = container.getPeople().getByKey(1).getEmails();
- assertNotNull(emails);
- assertTrue(emails.isEmpty());
- assertFalse(emails.execute().isEmpty());
-
- getService().getContext().detachAll();
-
- // container.getOrders().getByKey(1).getCustomerForOrder().getEmails().execute().isEmpty());
- // Not supported by the test service BTW generates a single request as expected:
- // <service root>/Orders(1)/CustomerForOrder/Emails
- emails.add("fabio.martelli@tirasa.net");
- container.getPeople().getByKey(1).setEmails(emails);
-
- container.flush();
-
- boolean found = false;
- for (String email : container.getPeople().getByKey(1).getEmails().execute()) {
- if (email.equals("fabio.martelli@tirasa.net")) {
- found = true;
- }
- }
-
- assertTrue(found);
-
- getService().getContext().detachAll();
- }
-
- @Test
- public void workingWithSingletons() {
- assertNotNull(container.getCompany().getVipCustomer().load().getPersonID());
-
- container.getCompany().setName("new name");
- container.flush();
-
- assertEquals("new name", container.getCompany().load().getName());
- }
-
- @Test
- public void createAndCallOperation() {
- final Product product = container.newEntityInstance(Product.class);
- product.setProductID(1001);
- container.flush();
-
- container.getProducts().getByKey(1000).operations().getProductDetails(1).execute();
- }
-
- @Test
- public void workingWithOperations() {
- // Primitive collections (available only skip and top)
- final PrimitiveCollection<String> prods1 = container.operations().
- getProductsByAccessLevel(AccessLevel.None).
- skip(2).
- top(3).execute();
- assertNotNull(prods1);
- assertFalse(prods1.isEmpty());
-
- // Complex/Entity collection
- final ProductCollection prods2 = container.operations().getAllProducts().
- filter("name eq XXXX").
- select("Name", "ProductDetail").
- expand("ProductDetail").
- orderBy("Name").skip(3).top(5).execute();
- assertNotNull(prods2);
- assertFalse(prods2.isEmpty());
-
- // Complex/Entity
- final Person person = container.operations().getPerson2("London").
- select("Name").
- expand("Order").execute();
- assertNotNull(person);
-
- // Primitive (no query option available)
- final Double amount = container.getAccounts().getByKey(101).getMyGiftCard().operations().
- getActualAmount(1.1).execute();
- assertNotNull(amount);
-
- // POST ...
- final Address address = container.newComplexInstance(HomeAddress.class);
- address.setStreet("Via Le Mani Dal Naso, 123");
- address.setPostalCode("Tollo");
- address.setCity("66010");
-
- final AddressCollection ac = container.newComplexCollection(AddressCollection.class);
- final Person updated = container.getCustomers().getByKey(2).operations().
- resetAddress(ac, 0).select("Name").expand("Orders").execute();
- assertNotNull(updated);
- }
-
- @Test
- public void workingWithComposableOperations() {
- final ProductCollectionComposableInvoker invoker1 = container.operations().getAllProducts();
-
- // Complex/Entity collection (available filter, select, expand, orderBy, skip and top)
- invoker1.operations().discount(10). // discount is an operation of ProductCollecton
- filter("Name eq XXXX").
- select("Name", "ProductDetail").
- expand("ProductDetail").
- orderBy("Name").skip(3).top(5).execute();
-
- // Complex/Entity
- final PersonComposableInvoker invoker2 = container.operations().getPerson2("London");
-
- // a. whole entity
- final Person person = invoker2.select("Name").expand("Order").execute();
- assertNotNull(person);
- assertEquals(1, person.getPersonID(), 0);
-
- // b. primitive collection property
- final PrimitiveCollection<String> emails = invoker2.getEmails().execute();
- assertNotNull(emails);
- assertFalse(emails.isEmpty());
-
- // c. complex property
- final Address homeAddress = invoker2.getHomeAddress().load();
- assertNotNull(homeAddress);
-
- // d. navigation property
- final Person parent = invoker2.getParent().load();
- assertNotNull(parent);
- assertEquals(2, parent.getPersonID(), 0);
- }
-
- /**
- * Java client should support the deletion based on locally created entity.
- * See also <a href="https://issues.apache.org/jira/browse/OLINGO-395">Olingo Issue 395</a>.
- */
- @Test
- public void issueOLINGO395() {
- Order order = getContainer().newEntityInstance(Order.class);
- order.setOrderID(1105);
-
- final Calendar orderDate = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- orderDate.clear();
- orderDate.set(2011, 3, 4, 16, 3, 57);
- order.setOrderDate(new Timestamp(orderDate.getTimeInMillis()));
-
- order.setShelfLife(BigDecimal.ZERO);
-
- final PrimitiveCollection<BigDecimal> osl = getContainer().newPrimitiveCollection(BigDecimal.class);
- osl.add(BigDecimal.TEN.negate());
- osl.add(BigDecimal.TEN);
-
- order.setOrderShelfLifes(osl);
-
- getContainer().getOrders().add(order);
- getContainer().getOrders().delete(order);
-
- getContainer().flush();
-
- service.getContext().detachAll();
- try {
- getContainer().getOrders().getByKey(1105).load();
- fail();
- } catch (IllegalArgumentException e) {
- // Expected Exception
- }
- service.getContext().detachAll(); // avoid influences
-
- order = getContainer().newEntityInstance(Order.class);
- order.setOrderID(1105);
-
- getContainer().getOrders().delete(order);
- getContainer().flush(); // test service doesn't fail for delete requests about unexisting objects
-
- service.getContext().detachAll();
- try {
- getContainer().getOrders().getByKey(1105).load();
- fail();
- } catch (IllegalArgumentException e) {
- // Expected Exception
- }
- service.getContext().detachAll(); // avoid influences
- }
-
- @Test
- public void issueOLINGO398() {
- AbstractCollectionInvocationHandler<?, ?> handler = AbstractCollectionInvocationHandler.class.cast(
- Proxy.getInvocationHandler(container.getCustomers().getByKey(1).getOrders().
- select("OrderID", "CustomerForOrder").
- expand("CustomerForOrder").
- top(1).
- skip(2)));
-
- assertEquals("http://localhost:9080/stub/StaticService/V40/Static.svc/Customers(1)/Orders?"
- + "%24select=OrderID%2CCustomerForOrder&%24expand=CustomerForOrder&%24top=1&%24skip=2",
- handler.getRequestURI().toASCIIString());
-
- handler = AbstractCollectionInvocationHandler.class.cast(
- Proxy.getInvocationHandler(container.getCustomers().getByKey(1).getOrders().
- select("OrderID", "CustomerForOrder").
- expand("CustomerForOrder").
- top(1).
- skip(2)));
-
- assertEquals("http://localhost:9080/stub/StaticService/V40/Static.svc/Customers(1)/Orders?%24"
- + "select=OrderID%2CCustomerForOrder&%24expand=CustomerForOrder&%24top=1&%24skip=2",
- handler.getRequestURI().toASCIIString());
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java
deleted file mode 100644
index 7ef9511..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java
+++ /dev/null
@@ -1,149 +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.fit.proxy.v4;
-
-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.IOException;
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.TimeZone;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.ext.proxy.AbstractService;
-import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
-import org.apache.olingo.fit.AbstractBaseTestITCase;
-import org.apache.olingo.fit.proxy.v4.staticservice.Service;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order;
-import org.junit.BeforeClass;
-
-public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
-
- protected static String testStaticServiceRootURL;
-
- protected static String testDemoServiceRootURL;
-
- protected static String testKeyAsSegmentServiceRootURL;
-
- protected static String testActionOverloadingServiceRootURL;
-
- protected static String testOpenTypeServiceRootURL;
-
- protected static String testLargeModelServiceRootURL;
-
- protected static String testAuthServiceRootURL;
-
- protected static Service<EdmEnabledODataClient> service;
-
- protected static InMemoryEntities container;
-
- @BeforeClass
- public static void setUpODataServiceRoot() throws IOException {
- testStaticServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Static.svc";
- testDemoServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Demo.svc";
- testKeyAsSegmentServiceRootURL = "http://localhost:9080/stub/StaticService/V40/KeyAsSegment.svc";
- testActionOverloadingServiceRootURL = "http://localhost:9080/stub/StaticService/V40/ActionOverloading.svc";
- testOpenTypeServiceRootURL = "http://localhost:9080/stub/StaticService/V40/OpenType.svc";
- testLargeModelServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Static.svc/large";
- testAuthServiceRootURL = "http://localhost:9080/stub/DefaultService.svc/V40/Static.svc";
-
- service = Service.getV4(testStaticServiceRootURL);
- service.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- container = service.getEntityContainer(InMemoryEntities.class);
- assertNotNull(container);
- service.getContext().detachAll();
- }
-
- protected Customer readCustomer(final InMemoryEntities container, final int id) {
- final Customer customer = container.getCustomers().getByKey(id).load();
- assertNotNull(customer);
- assertEquals(id, customer.getPersonID(), 0);
-
- return customer;
- }
-
- protected void createPatchAndDeleteOrder(
- final InMemoryEntities container, final AbstractService<EdmEnabledODataClient> service) {
-
- // Create order ....
- final Order order = container.newEntityInstance(Order.class);
- order.setOrderID(105);
-
- final Calendar orderDate = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- orderDate.clear();
- orderDate.set(2011, 3, 4, 16, 3, 57);
- order.setOrderDate(new Timestamp(orderDate.getTimeInMillis()));
-
- order.setShelfLife(BigDecimal.ZERO);
-
- final PrimitiveCollection<BigDecimal> value = container.newPrimitiveCollection(BigDecimal.class);
- value.add(BigDecimal.TEN.negate());
- value.add(BigDecimal.TEN);
- order.setOrderShelfLifes(value);
-
- container.getOrders().add(order);
- container.flush();
-
- // Patch order ... (test for OLINGO-353)
- order.setShelfLife(BigDecimal.TEN);
- container.flush();
-
- Order actual = container.getOrders().getByKey(105).load();
- assertEquals(105, actual.getOrderID(), 0);
- assertEquals(orderDate.getTimeInMillis(), actual.getOrderDate().getTime());
- assertEquals(BigDecimal.TEN, actual.getShelfLife());
- assertEquals(2, actual.getOrderShelfLifes().size());
-
- // Delete order ...
- container.getOrders().delete(105);
- actual = container.getOrders().getByKey(105);
- assertNull(actual);
-
- service.getContext().detachAll();
- actual = container.getOrders().getByKey(105);
- assertNotNull(actual);
-
- container.getOrders().delete(105);
- actual = container.getOrders().getByKey(105);
- assertNull(actual);
-
- container.flush();
-
- service.getContext().detachAll();
- try {
- container.getOrders().getByKey(105).load();
- fail();
- } catch (IllegalArgumentException e) {
- // Expected Exception
- }
- }
-
- @Override
- protected ODataClient getClient() {
- throw new RuntimeException("This method should not be used from proxy tests.");
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AsyncTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AsyncTestITCase.java
deleted file mode 100644
index b0c1c03..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AsyncTestITCase.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
-import org.apache.commons.lang3.RandomStringUtils;
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonComposableInvoker;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollectionComposableInvoker;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.junit.Test;
-
-public class AsyncTestITCase extends AbstractTestITCase {
-
- @Test
- public void retrieveEntitySet() throws InterruptedException, ExecutionException {
- final Future<CustomerCollection> futureCustomers = container.getCustomers().executeAsync();
- assertNotNull(futureCustomers);
-
- while (!futureCustomers.isDone()) {
- Thread.sleep(1000L);
- }
-
- final CustomerCollection customers = futureCustomers.get();
- assertNotNull(customers);
- assertFalse(customers.isEmpty());
- for (Customer customer : customers) {
- assertNotNull(customer);
- }
- }
-
- @Test
- public void updateEntity() throws Exception {
- final String randomFirstName = RandomStringUtils.random(10, "abcedfghijklmnopqrstuvwxyz");
-
- final Person person = container.getPeople().getByKey(1);
- person.setFirstName(randomFirstName);
-
- final Future<Void> futureFlush = container.flushAsync();
- assertNotNull(futureFlush);
-
- while (!futureFlush.isDone()) {
- Thread.sleep(1000L);
- }
-
- final Future<? extends Person> futurePerson = container.getPeople().getByKey(1).loadAsync();
- assertEquals(randomFirstName, futurePerson.get().getFirstName());
- }
-
- @Test
- public void invoke() throws Exception {
- final ProductCollectionComposableInvoker invoker1 = container.operations().getAllProducts();
-
- final Future<ProductCollection> future1 = invoker1.operations().
- discount(10).
- filter("Name eq XXXX").
- select("Name", "ProductDetail").
- expand("ProductDetail").
- orderBy("Name").skip(3).top(5).executeAsync();
- while (!future1.isDone()) {
- Thread.sleep(1000L);
- }
- assertFalse(future1.get().isEmpty());
-
- final PersonComposableInvoker invoker2 = container.operations().getPerson2("London");
-
- final Future<Person> future2 = invoker2.select("Name").
- expand("Order").executeAsync();
- while (!future2.isDone()) {
- Thread.sleep(1000L);
- }
- assertNotNull(future2.get());
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityCreateTestITCase.java
deleted file mode 100644
index c6b9a67..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityCreateTestITCase.java
+++ /dev/null
@@ -1,52 +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.fit.proxy.v4;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.fit.proxy.v4.staticservice.Service;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
-
-public class AuthEntityCreateTestITCase extends EntityCreateTestITCase {
-
- private Service<EdmEnabledODataClient> ecf;
-
- private InMemoryEntities ime;
-
- @Override
- protected Service<EdmEnabledODataClient> getService() {
- if (ecf == null) {
- ecf = Service.getV4(testAuthServiceRootURL);
- ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- ecf.getClient().getConfiguration().
- setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
- }
- return ecf;
- }
-
- @Override
- protected InMemoryEntities getContainer() {
- if (ime == null) {
- ime = getService().getEntityContainer(InMemoryEntities.class);
- }
- return ime;
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityRetrieveTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityRetrieveTestITCase.java
deleted file mode 100644
index 1a359bb..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AuthEntityRetrieveTestITCase.java
+++ /dev/null
@@ -1,37 +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.fit.proxy.v4;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.fit.proxy.v4.staticservice.Service;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
-
-public class AuthEntityRetrieveTestITCase extends EntityRetrieveTestITCase {
-
- @Override
- protected InMemoryEntities getContainer() {
- final Service<EdmEnabledODataClient> ecf = Service.getV4(testAuthServiceRootURL);
- ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- ecf.getClient().getConfiguration().
- setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
- return ecf.getEntityContainer(InMemoryEntities.class);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/BoundOperationInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/BoundOperationInvokeTestITCase.java
deleted file mode 100644
index 6829d38..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/BoundOperationInvokeTestITCase.java
+++ /dev/null
@@ -1,119 +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.fit.proxy.v4;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.sql.Timestamp;
-import java.util.Calendar;
-
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfoComposableInvoker;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AddressCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddress;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductComposableInvoker;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollectionComposableInvoker;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailKey;
-import org.junit.Test;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public class BoundOperationInvokeTestITCase extends AbstractTestITCase {
-
- @Test
- public void getEmployeesCount() {
- assertNotNull(container.getCompany().load().operations().getEmployeesCount());
- }
-
- @Test
- public void getProductDetails() {
- final ProductDetailCollectionComposableInvoker result =
- container.getProducts().getByKey(5).operations().getProductDetails(1);
- assertEquals(1, result.execute().size());
- }
-
- @Test
- public void getRelatedProduct() {
- final ProductDetailKey key = new ProductDetailKey();
- key.setProductID(6);
- key.setProductDetailID(1);
-
- final ProductComposableInvoker product =
- container.getProductDetails().getByKey(key).operations().getRelatedProduct();
- assertEquals(6, product.execute().getProductID(), 0);
- }
-
- @Test
- public void getDefaultPI() {
- final PaymentInstrument pi = container.getAccounts().getByKey(101).operations().getDefaultPI().execute();
- assertEquals(101901, pi.getPaymentInstrumentID(), 0);
- }
-
- @Test
- public void getAccountInfo() {
- final AccountInfoComposableInvoker accountInfo =
- container.getAccounts().getByKey(101).operations().getAccountInfo();
- assertNotNull(accountInfo.execute());
- }
-
- @Test
- public void getActualAmount() {
- final Double amount =
- container.getAccounts().getByKey(101).getMyGiftCard().operations().getActualAmount(1.1).execute();
- assertEquals(41.79, amount, 0);
- }
-
- @Test
- public void increaseRevenue() {
- final Long result = container.getCompany().load().operations().increaseRevenue(12L).execute();
- assertNotNull(result);
- }
-
- @Test
- public void addAccessRight() {
- final AccessLevel accessLevel =
- container.getProducts().getByKey(5).operations().addAccessRight(AccessLevel.Execute).execute();
- assertNotNull(accessLevel);
- }
-
- @Test
- public void resetAddress() {
- final Address address = container.newComplexInstance(HomeAddress.class);
- address.setStreet("Via Le Mani Dal Naso, 123");
- address.setPostalCode("Tollo");
- address.setCity("66010");
-
- final AddressCollection ac = container.newComplexCollection(AddressCollection.class);
- ac.add(address);
-
- final Person person = container.getCustomers().getByKey(2).operations().resetAddress(ac, 0).execute();
- assertEquals(2, person.getPersonID(), 0);
- }
-
- @Test
- public void refreshDefaultPI() {
- final PaymentInstrument pi = container.getAccounts().getByKey(101).operations().
- refreshDefaultPI(new Timestamp(Calendar.getInstance().getTimeInMillis())).execute();
- assertEquals(101901, pi.getPaymentInstrumentID(), 0);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/ContextTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/ContextTestITCase.java
deleted file mode 100644
index 344492e..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/ContextTestITCase.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.TimeZone;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.ext.proxy.api.ODataFlushException;
-import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.Service;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
-import org.junit.Test;
-
-public class ContextTestITCase extends AbstractTestITCase {
-
- private void continueOnError(final Service<EdmEnabledODataClient> service, final InMemoryEntities container) {
- final Person person = container.newEntityInstance(Person.class);
- container.getPeople().add(person);
-
- final Employee employee = container.newEntityInstance(Employee.class);
- employee.setPersonID(199);
- employee.setFirstName("Fabio");
- employee.setLastName("Martelli");
-
- final PrimitiveCollection<String> emails = container.newPrimitiveCollection(String.class);
- emails.add("fabio.martelli@tirasa.net");
-
- employee.setEmails(emails);
- final Calendar date = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- date.clear();
- date.set(2011, 3, 4, 9, 0, 0);
- employee.setDateHired(new Timestamp(date.getTimeInMillis()));
- final Address homeAddress = container.newComplexInstance(Address.class);
- homeAddress.setCity("Pescara");
- homeAddress.setPostalCode("65100");
- homeAddress.setStreet("viale Gabriele D'Annunzio 256");
- employee.setHomeAddress(homeAddress);
-
- final PrimitiveCollection<String> numbers = container.newPrimitiveCollection(String.class);
- numbers.add("3204725072");
- numbers.add("08569930");
- employee.setNumbers(numbers);
-
- container.getPeople().add(employee);
-
- try {
- container.flush();
- fail();
- } catch (ODataFlushException e) {
- assertEquals(1, e.getErrors().size());
- assertEquals(0, e.getErrors().get(0).getIndex());
- assertNotNull(e.getErrors().get(0).getRequest());
- }
-
- service.getContext().detachAll();
- }
-
- @Test
- public void transactionalContinueOnError() {
- service.getClient().getConfiguration().setContinueOnError(true);
- continueOnError(service, container);
- service.getClient().getConfiguration().setContinueOnError(false);
- }
-
- @Test
- public void nonTransactionalContinueOnError() {
- final Service<EdmEnabledODataClient> _service = Service.getV4(testStaticServiceRootURL, false);
- _service.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- _service.getClient().getConfiguration().setContinueOnError(true);
-
- final InMemoryEntities _container = _service.getEntityContainer(InMemoryEntities.class);
-
- continueOnError(_service, _container);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/DerivedTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/DerivedTypeTestITCase.java
deleted file mode 100644
index 2cccc68..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/DerivedTypeTestITCase.java
+++ /dev/null
@@ -1,94 +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.fit.proxy.v4;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Calendar;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddress;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPI;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPICollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.junit.Test;
-
-public class DerivedTypeTestITCase extends AbstractTestITCase {
-
- @Test
- public void read() {
- final CustomerCollection customers = container.getPeople().execute(CustomerCollection.class);
- assertNotNull(customers);
-
- for (Object customer : customers) {
- assertTrue(customer instanceof Customer);
- }
-
- final CreditCardPICollection creditCards = container.getAccounts().getByKey(101).
- getMyPaymentInstruments().execute(CreditCardPICollection.class);
- assertNotNull(creditCards);
- for (Object creditCard : creditCards) {
- assertTrue(creditCard instanceof CreditCardPI);
- }
- }
-
- @Test
- public void createDelete() {
- final Customer customer = container.newEntityInstance(Customer.class);
- customer.setPersonID(976);
- customer.setFirstName("Test");
- customer.setLastName("Test");
-
- final Address homeAddress = container.newComplexInstance(CompanyAddress.class);
- homeAddress.setStreet("V.le Gabriele D'Annunzio");
- homeAddress.setCity("Pescara");
- homeAddress.setPostalCode("65127");
- customer.setHomeAddress(homeAddress);
-
- customer.setNumbers(container.newPrimitiveCollection(String.class)); // empty
- customer.setEmails(container.newPrimitiveCollection(String.class)); // empty
- customer.setCity("Pescara");
-
- final Calendar birthday = Calendar.getInstance();
- birthday.clear();
- birthday.set(1977, 8, 8);
- customer.setBirthday(new Timestamp(birthday.getTimeInMillis()));
-
- customer.setTimeBetweenLastTwoOrders(BigDecimal.valueOf(0.0000002));
-
- container.getPeople().add(customer);
- container.flush();
-
- final Person actual = container.getPeople().getByKey(976, Customer.class).load();
- assertTrue(actual instanceof Customer);
- assertTrue(actual.getHomeAddress() instanceof CompanyAddress);
-
- container.getPeople().delete(976);
-
- container.flush();
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java
deleted file mode 100644
index d6149fa..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java
+++ /dev/null
@@ -1,380 +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.fit.proxy.v4;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.TimeZone;
-
-import org.apache.commons.lang3.RandomUtils;
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.ext.proxy.AbstractService;
-import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddress;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetail;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailKey;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrumentCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetail;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection;
-import org.junit.Test;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-/**
- * This is the unit test class to check entity create operations.
- */
-public class EntityCreateTestITCase extends AbstractTestITCase {
-
- protected AbstractService<EdmEnabledODataClient> getService() {
- return service;
- }
-
- protected InMemoryEntities getContainer() {
- return container;
- }
-
- @Test
- public void createAndDelete() {
- createPatchAndDeleteOrder(getContainer(), getService());
- }
-
- @Test
- public void createEmployee() {
- final Integer id = 101;
-
- final Employee employee = getContainer().newEntityInstance(Employee.class);
- employee.setPersonID(id);
- employee.setFirstName("Fabio");
- employee.setLastName("Martelli");
-
- PrimitiveCollection<String> value = getContainer().newPrimitiveCollection(String.class);
- value.add("fabio.martelli@tirasa.net");
- employee.setEmails(value);
-
- final Calendar date = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- date.clear();
- date.set(2011, 3, 4, 9, 0, 0);
- employee.setDateHired(new Timestamp(date.getTimeInMillis()));
- final Address homeAddress = getContainer().newComplexInstance(HomeAddress.class);
- homeAddress.setCity("Pescara");
- homeAddress.setPostalCode("65100");
- homeAddress.setStreet("viale Gabriele D'Annunzio 256");
- employee.setHomeAddress(homeAddress);
-
- value = getContainer().newPrimitiveCollection(String.class);
- value.add("3204725072");
- value.add("08569930");
- employee.setNumbers(value);
-
- getContainer().getPeople().add(employee);
-
- getContainer().flush();
-
- Employee actual = getContainer().getPeople().getByKey(id, Employee.class).load();
- assertNotNull(actual);
- assertEquals(id, actual.getPersonID());
- assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity());
-
- getService().getContext().detachAll();
- actual = getContainer().getPeople().getByKey(id, Employee.class).load();
- assertNotNull(actual);
- assertEquals(id, actual.getPersonID());
- assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity());
-
- getContainer().getPeople().delete(actual.getPersonID());
- getContainer().flush();
-
- try {
- getContainer().getPeople().getByKey(id, Employee.class).load();
- fail();
- } catch (IllegalArgumentException e) {
- // Expected
- }
-
- getService().getContext().detachAll();
- try {
- getContainer().getPeople().getByKey(id, Employee.class).load();
- fail();
- } catch (IllegalArgumentException e) {
- // Expected
- }
- }
-
- @Test
- public void createWithNavigation() {
- final Integer id = 101;
-
- final Customer customer = getContainer().newEntityInstance(Customer.class);
- customer.setPersonID(id);
- customer.setPersonID(id);
- customer.setFirstName("Fabio");
- customer.setLastName("Martelli");
- customer.setCity("Pescara");
-
- PrimitiveCollection<String> value = getContainer().newPrimitiveCollection(String.class);
- value.add("fabio.martelli@tirasa.net");
- customer.setEmails(value);
-
- Address homeAddress = getContainer().newComplexInstance(HomeAddress.class);
- homeAddress.setCity("Pescara");
- homeAddress.setPostalCode("65100");
- homeAddress.setStreet("viale Gabriele D'Annunzio 256");
- customer.setHomeAddress(homeAddress);
-
- value = getContainer().newPrimitiveCollection(String.class);
- value.add("3204725072");
- value.add("08569930");
- customer.setNumbers(value);
-
- final OrderCollection orders = getContainer().newEntityCollection(OrderCollection.class);
- orders.add(getContainer().getOrders().getByKey(8));
- customer.setOrders(orders);
-
- getContainer().getCustomers().add(customer);
- getContainer().flush();
-
- Customer actual = readCustomer(getContainer(), id);
- assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity());
- assertEquals(1, actual.getOrders().execute().size());
- assertEquals(8, actual.getOrders().iterator().next().getOrderID(), 0);
-
- getContainer().getCustomers().delete(actual.getPersonID());
- getContainer().flush();
-
- try {
- getContainer().getCustomers().getByKey(id).load();
- fail();
- } catch (IllegalArgumentException e) {
- // Expected
- }
- }
-
- @Test
- public void createWithBackNavigation() {
- final Integer id = 102;
-
- // -------------------------------
- // Create a new order
- // -------------------------------
- Order order = getContainer().newEntityInstance(Order.class);
- order.setOrderID(id);
-
- final Calendar orderDate = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- orderDate.clear();
- orderDate.set(2011, 3, 4, 16, 3, 57);
- order.setOrderDate(new Timestamp(orderDate.getTimeInMillis()));
-
- order.setShelfLife(BigDecimal.TEN);
-
- PrimitiveCollection<BigDecimal> osl = getContainer().newPrimitiveCollection(BigDecimal.class);
- osl.add(BigDecimal.TEN.negate());
- osl.add(BigDecimal.TEN);
- order.setOrderShelfLifes(osl);
- // -------------------------------
-
- // -------------------------------
- // Create a new customer
- // -------------------------------
- final Customer customer = getContainer().newEntityInstance(Customer.class);
- customer.setPersonID(id);
- customer.setPersonID(id);
- customer.setFirstName("Fabio");
- customer.setLastName("Martelli");
- customer.setCity("Pescara");
-
- PrimitiveCollection<String> value = getContainer().newPrimitiveCollection(String.class);
- value.add("fabio.martelli@tirasa.net");
- customer.setEmails(value);
-
- final Address homeAddress = getContainer().newComplexInstance(HomeAddress.class);
- homeAddress.setCity("Pescara");
- homeAddress.setPostalCode("65100");
- homeAddress.setStreet("viale Gabriele D'Annunzio 256");
- customer.setHomeAddress(homeAddress);
-
- value = getContainer().newPrimitiveCollection(String.class);
- value.add("3204725072");
- value.add("08569930");
- customer.setNumbers(value);
-
- final OrderCollection orders = getContainer().newEntityCollection(OrderCollection.class);
- orders.add(order);
- customer.setOrders(orders);
- // -------------------------------
-
- // -------------------------------
- // Link customer to order
- // -------------------------------
- order.setCustomerForOrder(customer);
- // -------------------------------
-
- getContainer().getOrders().add(order);
- getContainer().flush();
-
- assertEquals(id, order.getOrderID());
- assertEquals(id, customer.getPersonID());
-
- Customer actual = readCustomer(getContainer(), id);
- assertEquals(homeAddress.getCity(), actual.getHomeAddress().getCity());
- assertEquals(1, actual.getOrders().execute().size());
- assertEquals(id, actual.getOrders().iterator().next().getOrderID());
-
- order = getContainer().getOrders().getByKey(id);
- assertNotNull(order);
- assertEquals(id, order.getCustomerForOrder().load().getPersonID());
-
- getContainer().getOrders().delete(actual.getOrders());
- getContainer().flush();
-
- try {
- getContainer().getOrders().getByKey(id).load();
- fail();
- } catch (IllegalArgumentException e) {
- // Expected
- }
-
- actual = readCustomer(getContainer(), id);
- assertTrue(actual.getOrders().isEmpty());
-
- getContainer().getCustomers().delete(actual.getPersonID());
- getContainer().flush();
-
- try {
- getContainer().getCustomers().getByKey(id).load();
- fail();
- } catch (IllegalArgumentException e) {
- // Expected
- }
- }
-
- @Test
- public void multiKey() {
- OrderDetail details = getContainer().newEntityInstance(OrderDetail.class);
- details.setOrderID(8);
- details.setProductID(1);
- details.setQuantity(100);
- details.setUnitPrice(5f);
-
- getContainer().getOrderDetails().add(details);
- getContainer().flush();
-
- OrderDetailKey key = new OrderDetailKey();
- key.setOrderID(8);
- key.setProductID(1);
-
- details = getContainer().getOrderDetails().getByKey(key).load();
- assertNotNull(details);
- assertEquals(Integer.valueOf(100), details.getQuantity());
- assertEquals(8, details.getOrderID(), 0);
- assertEquals(1, details.getProductID(), 0);
- assertEquals(5f, details.getUnitPrice(), 0);
-
- getContainer().getOrderDetails().delete(key);
- getContainer().flush();
-
- try {
- getContainer().getOrderDetails().getByKey(key).load();
- fail();
- } catch (IllegalArgumentException e) {
- // Expected
- }
- }
-
- @Test
- public void deepInsert() {
- Product product = getContainer().newEntityInstance(Product.class);
- product.setProductID(12);
- product.setName("Latte");
- product.setQuantityPerUnit("100g Bag");
- product.setUnitPrice(3.24f);
- product.setQuantityInStock(100);
- product.setDiscontinued(false);
- product.setUserAccess(AccessLevel.Execute);
- product.setSkinColor(Color.Blue);
-
- PrimitiveCollection<Color> value = getContainer().newPrimitiveCollection(Color.class);
- value.add(Color.Red);
- value.add(Color.Green);
- product.setCoverColors(value);
-
- final ProductDetail detail = getContainer().newEntityInstance(ProductDetail.class);
- detail.setProductID(product.getProductID());
- detail.setProductDetailID(12);
- detail.setProductName("LatteHQ");
- detail.setDescription("High-Quality Milk");
-
- final ProductDetailCollection detailCollection = getContainer().newEntityCollection(ProductDetailCollection.class);
- detailCollection.add(detail);
-
- product.setDetails(detailCollection);
-
- getContainer().getProducts().add(product);
- getContainer().flush();
-
- product = getContainer().getProducts().getByKey(12).load();
- assertEquals("Latte", product.getName());
- assertEquals(12, product.getDetails().execute().iterator().next().getProductDetailID(), 0);
- }
-
- @Test
- public void contained() {
- PaymentInstrumentCollection instruments =
- getContainer().getAccounts().getByKey(101).getMyPaymentInstruments().execute();
- final int sizeBefore = instruments.size();
-
- final PaymentInstrument instrument = getContainer().newEntityInstance(PaymentInstrument.class);
- instruments.add(instrument);
-
- final int id = RandomUtils.nextInt(101999, 105000);
- instrument.setPaymentInstrumentID(id);
- instrument.setFriendlyName("New one");
- instrument.setCreatedDate(new Timestamp(Calendar.getInstance().getTimeInMillis()));
-
- getContainer().flush();
-
- instruments = getContainer().getAccounts().getByKey(101).getMyPaymentInstruments().execute();
- final int sizeAfter = instruments.size();
- assertEquals(sizeBefore + 1, sizeAfter);
-
- getContainer().getAccounts().getByKey(101).getMyPaymentInstruments().delete(id);
-
- getContainer().flush();
-
- instruments = getContainer().getAccounts().getByKey(101).getMyPaymentInstruments().execute();
- final int sizeEnd = instruments.size();
- assertEquals(sizeBefore, sizeEnd);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityRetrieveTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityRetrieveTestITCase.java
deleted file mode 100644
index 7ee31b8..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityRetrieveTestITCase.java
+++ /dev/null
@@ -1,173 +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.fit.proxy.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 static org.junit.Assert.fail;
-
-import java.lang.reflect.Proxy;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.TimeZone;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.ext.proxy.commons.EntityInvocationHandler;
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetail;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailKey;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.junit.Test;
-
-/**
- * This is the unit test class to check entity retrieve operations.
- */
-public class EntityRetrieveTestITCase extends AbstractTestITCase {
-
- protected InMemoryEntities getContainer() {
- return container;
- }
-
- @Test
- public void exists() {
- assertTrue(getContainer().getCustomers().exists(1));
- assertFalse(getContainer().getOrders().exists(1));
- }
-
- @Test
- public void get() {
- readCustomer(getContainer(), 1);
- }
-
- @Test
- public void getAll() {
- final PersonCollection all = getContainer().getPeople().execute();
- assertNotNull(all);
- assertFalse(all.isEmpty());
- for (Person person : all) {
- assertNotNull(person);
- }
-
- final EmployeeCollection employees = getContainer().getPeople().execute(EmployeeCollection.class);
- assertNotNull(employees);
- assertFalse(employees.isEmpty());
- for (Employee employee : employees) {
- assertNotNull(employee);
- }
-
- final CustomerCollection customers = getContainer().getPeople().execute(CustomerCollection.class);
- assertNotNull(customers);
- assertFalse(customers.isEmpty());
- for (Customer customer : customers) {
- assertNotNull(customer);
- }
-
- assertTrue(all.size() > employees.size() + customers.size());
- }
-
- @Test
- public void navigate() {
- final Order order = getContainer().getOrders().getByKey(8).load();
- assertEquals(8, order.getOrderID(), 0);
-
- final Timestamp date = order.getOrderDate();
- assertNotNull(date);
- final Calendar actual = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- actual.clear();
- actual.set(2011, 2, 4, 16, 3, 57);
- assertEquals(actual.getTimeInMillis(), date.getTime());
-
- final Customer customer = getContainer().getCustomers().getByKey(1).load();
- assertNotNull(customer);
- assertEquals(1, customer.getPersonID(), 0);
- final Address address = customer.getHomeAddress();
- assertNotNull(address);
- assertEquals("98052", address.getPostalCode());
- }
-
- @Test
- public void withInlineEntry() {
- final Customer customer = readCustomer(getContainer(), 1);
- final Company company = customer.getCompany();
- assertEquals(0, company.load().getCompanyID(), 0);
- }
-
- @Test
- public void withInlineFeed() {
- final Customer customer = readCustomer(getContainer(), 1);
- final OrderCollection orders = customer.getOrders();
- assertEquals(1, orders.execute().size());
- assertEquals(8, orders.iterator().next().getOrderID(), 0);
- }
-
- @Test
- public void withActions() {
- final Product product = getContainer().getProducts().getByKey(5).load();
- assertEquals(5, product.getProductID(), 0);
-
- try {
- assertNotNull(product.operations().getClass().getMethod("addAccessRight", AccessLevel.class));
- } catch (Exception e) {
- fail();
- }
- }
-
- @Test
- public void multiKey() {
- final OrderDetailKey orderDetailKey = new OrderDetailKey();
- orderDetailKey.setOrderID(7);
- orderDetailKey.setProductID(5);
-
- final OrderDetail orderDetail = getContainer().getOrderDetails().getByKey(orderDetailKey).load();
- assertNotNull(orderDetail);
- assertEquals(7, orderDetail.getOrderID(), 0);
- assertEquals(5, orderDetail.getProductID(), 0);
- }
-
- @Test
- public void checkForETag() {
- final Order order = getContainer().getOrders().getByKey(8).load();
- assertTrue(StringUtils.isNotBlank(((EntityInvocationHandler) Proxy.getInvocationHandler(order)).getETag()));
- }
-
- @Test
- public void contained() {
- final PaymentInstrument instrument =
- getContainer().getAccounts().getByKey(101).getMyPaymentInstruments().getByKey(101901).load();
- assertEquals(101901, instrument.getPaymentInstrumentID(), 0);
- assertNotNull(instrument.getCreatedDate());
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntitySetTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntitySetTestITCase.java
deleted file mode 100644
index 37c2d0c..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntitySetTestITCase.java
+++ /dev/null
@@ -1,75 +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.fit.proxy.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
-import org.junit.Test;
-
-/**
- * This is the unit test class to check basic feed operations.
- */
-public class EntitySetTestITCase extends AbstractTestITCase {
-
- @Test
- public void count() {
- assertNotNull(container.getOrders());
- assertEquals(2, container.getOrders().count().longValue());
- }
-
- @Test
- public void getAll() {
- int count = 0;
- for (Customer customer : container.getCustomers().execute()) {
- assertNotNull(customer);
- count++;
- }
- assertEquals(2, count);
- }
-
- @Test
- public void iterator() {
- int count = 0;
- for (Customer customer : container.getCustomers()) {
- assertNotNull(customer);
- count++;
- }
- assertEquals(2, count);
- }
-
- @Test
- public void readEntitySetWithNextLink() {
- int count = 0;
- for (Person people : container.getPeople().execute()) {
- assertNotNull(people);
- count++;
- }
- assertEquals(5, count);
-
- int iterating = 0;
- for (Person person : container.getPeople()) {
- assertNotNull(person);
- iterating++;
- }
- assertEquals(count + 1, iterating);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityUpdateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityUpdateTestITCase.java
deleted file mode 100644
index ab3f075..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityUpdateTestITCase.java
+++ /dev/null
@@ -1,193 +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.fit.proxy.v4;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-
-import java.lang.reflect.Proxy;
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.UUID;
-
-import org.apache.commons.lang3.RandomUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.ext.proxy.AbstractService;
-import org.apache.olingo.ext.proxy.commons.EntityInvocationHandler;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddress;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetail;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailKey;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
-import org.junit.Test;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-/**
- * This is the unit test class to check entity update operations.
- */
-public class EntityUpdateTestITCase extends AbstractTestITCase {
-
- protected AbstractService<EdmEnabledODataClient> getService() {
- return service;
- }
-
- protected InMemoryEntities getContainer() {
- return container;
- }
-
- @Test
- public void update() {
- Person person = getContainer().getPeople().getByKey(1);
-
- final Address address = person.getHomeAddress();
- address.setCity("XXX");
-
- getContainer().flush();
-
- person = getContainer().getPeople().getByKey(1).load();
- assertEquals("XXX", person.getHomeAddress().getCity());
- }
-
- @Test
- public void multiKey() {
- final OrderDetailKey orderDetailKey = new OrderDetailKey();
- orderDetailKey.setOrderID(7);
- orderDetailKey.setProductID(5);
-
- OrderDetail orderDetail = getContainer().getOrderDetails().getByKey(orderDetailKey).load();
- assertNotNull(orderDetail);
- assertEquals(7, orderDetail.getOrderID(), 0);
- assertEquals(5, orderDetail.getProductID(), 0);
-
- orderDetail.setQuantity(5);
-
- getContainer().flush();
-
- orderDetail = getContainer().getOrderDetails().getByKey(orderDetailKey).load();
- assertEquals(5, orderDetail.getQuantity(), 0);
- }
-
- @Test
- public void patchLink() {
- // 1. create customer
- Customer customer = getContainer().newEntityInstance(Customer.class);
- customer.setPersonID(977);
- customer.setFirstName("Test");
- customer.setLastName("Test");
-
- final Address homeAddress = getContainer().newComplexInstance(CompanyAddress.class);
- homeAddress.setStreet("V.le Gabriele D'Annunzio");
- homeAddress.setCity("Pescara");
- homeAddress.setPostalCode("65127");
- customer.setHomeAddress(homeAddress);
-
- customer.setNumbers(getContainer().newPrimitiveCollection(String.class)); // empty
- customer.setEmails(getContainer().newPrimitiveCollection(String.class)); // empty
- customer.setCity("Pescara");
-
- final Calendar birthday = Calendar.getInstance();
- birthday.clear();
- birthday.set(1977, 8, 8);
- customer.setBirthday(new Timestamp(birthday.getTimeInMillis()));
-
- customer.setTimeBetweenLastTwoOrders(BigDecimal.valueOf(0.0000002));
-
- // 2. create order and set it to customer
- final int orderId = RandomUtils.nextInt(400, 410);
-
- Order order = getContainer().newEntityInstance(Order.class);
- order.setOrderID(orderId);
-
- final OrderCollection orders = getContainer().newEntityCollection(OrderCollection.class);
- orders.add(order);
-
- customer.setOrders(orders);
- order.setCustomerForOrder(customer);
-
- getContainer().getCustomers().add(customer);
- getContainer().flush();
-
- assertEquals(977, order.getCustomerForOrder().load().getPersonID(), 0);
- // order.getCustomerForOrder().load() caches Customer ... test server doesn't support something like the following
- // <service>/Orders(400)/CustomerForOrder/Orders
- // detach all and check for stored data ..
- getService().getContext().detachAll();
-
- // 3. check everything after flush
- order = getContainer().getOrders().getByKey(orderId).load();
- assertEquals(orderId, order.getOrderID(), 0);
-
- customer = getContainer().getCustomers().getByKey(977);
-
- // assertEquals(1, customer.getOrders().size());
-
- int count = 0;
- for (Order inside : customer.getOrders().execute()) {
- if (inside.getOrderID() == orderId) {
- count++;
- }
- }
- assertEquals(1, count);
- assertEquals(977, order.getCustomerForOrder().load().getPersonID(), 0);
-
- // 4. delete customer and order
- getContainer().getCustomers().delete(977);
- getContainer().getOrders().delete(orderId);
-
- getContainer().flush();
- }
-
- @Test
- public void concurrentModification() {
- Order order = getContainer().getOrders().getByKey(8).load();
- final String etag = ((EntityInvocationHandler) Proxy.getInvocationHandler(order)).getETag();
- assertTrue(StringUtils.isNotBlank(etag));
-
- order.setShelfLife(BigDecimal.TEN);
-
- getContainer().flush();
-
- order = getContainer().getOrders().getByKey(8).load();
- assertEquals(BigDecimal.TEN, order.getShelfLife());
- }
-
- @Test
- public void contained() {
- PaymentInstrument instrument =
- getContainer().getAccounts().getByKey(101).getMyPaymentInstruments().getByKey(101901);
-
- final String newName = UUID.randomUUID().toString();
- instrument.setFriendlyName(newName);
-
- getContainer().flush();
-
- instrument = getContainer().getAccounts().getByKey(101).getMyPaymentInstruments().getByKey(101901).load();
- assertEquals(newName, instrument.getFriendlyName());
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/FilterTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/FilterTestITCase.java
deleted file mode 100644
index 72e3643..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/FilterTestITCase.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.ext.proxy.api.Search;
-import org.apache.olingo.ext.proxy.api.Sort;
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.People;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection;
-import org.junit.Test;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public class FilterTestITCase extends AbstractTestITCase {
-
- @Test
- public void testFilterWithEntityType() {
- final People people = container.getPeople();
- final EmployeeCollection response = people.filter(service.getClient().getFilterFactory().lt("PersonID", 4))
- .execute(EmployeeCollection.class);
-
- assertEquals(1, response.size());
-
- for (final Employee employee : response) {
- assertEquals(Integer.valueOf(3), employee.getPersonID());
- }
- }
-
- @Test
- public void filterOrderby() {
- final People people = container.getPeople();
-
- PersonCollection result =
- people.filter(service.getClient().getFilterFactory().lt("PersonID", 3)).execute();
-
- // 1. check that result looks as expected
- assertEquals(2, result.size());
-
- // 2. extract PersonID values - sorted ASC by default
- final List<Integer> former = new ArrayList<Integer>(2);
- for (Person person : result) {
- final Integer personID = person.getPersonID();
- assertTrue(personID < 3);
- former.add(personID);
- }
-
- // 3. add orderby clause to filter above
- result = people.orderBy(new Sort("PersonID", Sort.Direction.DESC)).execute();
- assertEquals(2, result.size());
-
- // 4. extract again VIN value - now they were required to be sorted DESC
- final List<Integer> latter = new ArrayList<Integer>(2);
- for (Person person : result) {
- final Integer personID = person.getPersonID();
- assertTrue(personID < 3);
- latter.add(personID);
- }
-
- // 5. reverse latter and expect to be equal to former
- Collections.reverse(latter);
- assertEquals(former, latter);
- }
-
- @Test
- public void search() {
- final Search<Person, PersonCollection> search = container.getPeople().createSearch().setSearch(
- service.getClient().getSearchFactory().or(
- service.getClient().getSearchFactory().literal("Bob"),
- service.getClient().getSearchFactory().literal("Jill")));
-
- final PersonCollection result = search.getResult();
- assertFalse(result.isEmpty());
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/KeyAsSegmentTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/KeyAsSegmentTestITCase.java
deleted file mode 100644
index ac450de..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/KeyAsSegmentTestITCase.java
+++ /dev/null
@@ -1,73 +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.fit.proxy.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.fit.proxy.v4.staticservice.Service;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
-import org.junit.Test;
-
-public class KeyAsSegmentTestITCase extends AbstractTestITCase {
-
- private Service<EdmEnabledODataClient> ecf;
-
- private InMemoryEntities ime;
-
- protected Service<EdmEnabledODataClient> getService() {
- if (ecf == null) {
- ecf = Service.getV4(testKeyAsSegmentServiceRootURL);
- ecf.getClient().getConfiguration().setKeyAsSegment(true);
- ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- }
- return ecf;
- }
-
- protected InMemoryEntities getContainer() {
- if (ime == null) {
- ime = getService().getEntityContainer(InMemoryEntities.class);
- }
- return ime;
- }
-
- @Test
- public void read() {
- assertNotNull(getContainer().getAccounts().getByKey(101));
- }
-
- @Test
- public void createAndDelete() {
- createPatchAndDeleteOrder(getContainer(), getService());
- }
-
- @Test
- public void update() {
- Person person = getContainer().getPeople().getByKey(5);
- person.setMiddleName("middleN");
-
- container.flush();
-
- person = getContainer().getPeople().getByKey(5);
- assertEquals("middleN", person.getMiddleName());
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/MediaEntityTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/MediaEntityTestITCase.java
deleted file mode 100644
index 752fba5..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/MediaEntityTestITCase.java
+++ /dev/null
@@ -1,121 +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.fit.proxy.v4;
-
-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.IOException;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.UUID;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.ext.proxy.api.EdmStreamValue;
-import org.apache.olingo.fit.proxy.v4.demo.Service;
-import org.apache.olingo.fit.proxy.v4.demo.odatademo.DemoService;
-import org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Advertisement;
-import org.junit.Test;
-
-/**
- * This is the unit test class to check media entity retrieve operations.
- */
-public class MediaEntityTestITCase extends AbstractTestITCase {
-
- private Service<EdmEnabledODataClient> ecf;
-
- private DemoService ime;
-
- protected Service<EdmEnabledODataClient> getService() {
- if (ecf == null) {
- ecf = Service.getV4(testDemoServiceRootURL);
- ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- }
- return ecf;
- }
-
- protected DemoService getContainer() {
- if (ime == null) {
- ime = getService().getEntityContainer(DemoService.class);
- }
- return ime;
- }
-
- @Test
- public void read() throws IOException {
- final UUID uuid = UUID.fromString("f89dee73-af9f-4cd4-b330-db93c25ff3c7");
-
- final Advertisement adv = getContainer().getAdvertisements().getByKey(uuid);
- assertNull(adv.getAirDate()); // No HTTP request --> property null
-
- final EdmStreamValue res = adv.loadStream();
- assertEquals("application/octet-stream", res.getContentType());
- assertNotNull(res.getStream());
- IOUtils.closeQuietly(res.getStream());
-
- getService().getContext().detachAll();
- }
-
- @Test
- public void update() throws IOException {
- final UUID uuid = UUID.fromString("f89dee73-af9f-4cd4-b330-db93c25ff3c7");
- final Advertisement adv = getContainer().getAdvertisements().getByKey(uuid);
- final String random = RandomStringUtils.random(124, "abcdefghijklmnopqrstuvwxyz");
- adv.uploadStream(getContainer().newEdmStreamValue("application/octet-stream", IOUtils.toInputStream(random)));
- getContainer().flush();
- assertEquals(random,
- IOUtils.toString(getContainer().getAdvertisements().getByKey(uuid).loadStream().getStream()));
- getService().getContext().detachAll();
- }
-
- @Test
- public void create() throws IOException {
- final String random = RandomStringUtils.random(124, "abcdefghijklmnopqrstuvwxyz");
-
- final Advertisement adv = getContainer().newEntityInstance(Advertisement.class);
- adv.uploadStream(getContainer().newEdmStreamValue("application/octet-stream", IOUtils.toInputStream(random)));
- adv.setAirDate(new Timestamp(Calendar.getInstance().getTimeInMillis()));
-
- getContainer().getAdvertisements().add(adv);
- getContainer().flush();
-
- final UUID uuid = adv.getID();
- getService().getContext().detachAll();
-
- assertEquals(random, IOUtils.toString(getContainer().getAdvertisements().getByKey(uuid).loadStream().getStream()));
-
- getService().getContext().detachAll();
-
- getContainer().getAdvertisements().delete(uuid);
- getContainer().flush();
-
- try {
- getContainer().getAdvertisements().getByKey(uuid).load();
- fail();
- } catch (IllegalArgumentException e) {
- // expected
- }
- getService().getContext().detachAll();
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalAuthEntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalAuthEntityCreateTestITCase.java
deleted file mode 100644
index c96df84..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalAuthEntityCreateTestITCase.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.fit.proxy.v4.staticservice.Service;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
-
-public class NonTransactionalAuthEntityCreateTestITCase extends EntityCreateTestITCase {
-
- private Service<EdmEnabledODataClient> ecf;
-
- private InMemoryEntities ime;
-
- @Override
- protected Service<EdmEnabledODataClient> getService() {
- if (ecf == null) {
- ecf = Service.getV4(testAuthServiceRootURL, false);
- ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- ecf.getClient().getConfiguration().
- setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
- }
- return ecf;
- }
-
- @Override
- protected InMemoryEntities getContainer() {
- if (ime == null) {
- ime = getService().getEntityContainer(InMemoryEntities.class);
- }
- return ime;
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityCreateTestITCase.java
deleted file mode 100644
index 3a91b4c..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityCreateTestITCase.java
+++ /dev/null
@@ -1,49 +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.fit.proxy.v4;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.fit.proxy.v4.staticservice.Service;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
-
-public class NonTransactionalEntityCreateTestITCase extends EntityCreateTestITCase {
-
- private Service<EdmEnabledODataClient> ecf;
-
- private InMemoryEntities ime;
-
- @Override
- protected Service<EdmEnabledODataClient> getService() {
- if (ecf == null) {
- ecf = Service.getV4(testStaticServiceRootURL, false);
- ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- }
- return ecf;
- }
-
- @Override
- protected InMemoryEntities getContainer() {
- if (ime == null) {
- ime = getService().getEntityContainer(InMemoryEntities.class);
- }
- return ime;
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityUpdateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityUpdateTestITCase.java
deleted file mode 100644
index cee126b..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalEntityUpdateTestITCase.java
+++ /dev/null
@@ -1,48 +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.fit.proxy.v4;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.fit.proxy.v4.staticservice.Service;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
-
-public class NonTransactionalEntityUpdateTestITCase extends EntityUpdateTestITCase {
-
- private Service<EdmEnabledODataClient> ecf;
-
- private InMemoryEntities ime;
-
- @Override
- protected Service<EdmEnabledODataClient> getService() {
- if (ecf == null) {
- ecf = Service.getV4(testStaticServiceRootURL, false);
- ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- }
- return ecf;
- }
-
- @Override
- protected InMemoryEntities getContainer() {
- if (ime == null) {
- ime = getService().getEntityContainer(InMemoryEntities.class);
- }
- return ime;
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalMediaEntityTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalMediaEntityTestITCase.java
deleted file mode 100644
index df7fee8..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/NonTransactionalMediaEntityTestITCase.java
+++ /dev/null
@@ -1,49 +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.fit.proxy.v4;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.fit.proxy.v4.demo.Service;
-import org.apache.olingo.fit.proxy.v4.demo.odatademo.DemoService;
-
-public class NonTransactionalMediaEntityTestITCase extends MediaEntityTestITCase {
-
- private Service<EdmEnabledODataClient> ecf;
-
- private DemoService ime;
-
- @Override
- protected Service<EdmEnabledODataClient> getService() {
- if (ecf == null) {
- ecf = Service.getV4(testDemoServiceRootURL, false);
- ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- }
- return ecf;
- }
-
- @Override
- protected DemoService getContainer() {
- if (ime == null) {
- ime = getService().getEntityContainer(DemoService.class);
- }
- return ime;
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OpenTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OpenTypeTestITCase.java
deleted file mode 100644
index 0defe4d..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OpenTypeTestITCase.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.UUID;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.ext.proxy.api.annotations.EntityType;
-import org.apache.olingo.fit.proxy.v4.opentype.Service;
-import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.DefaultContainer;
-import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.AccountInfo;
-import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Color;
-import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.ContactDetails;
-import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.IndexedRow;
-import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row;
-import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowIndex;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class OpenTypeTestITCase extends AbstractTestITCase {
-
- private static Service<EdmEnabledODataClient> otservice;
-
- private static DefaultContainer otcontainer;
-
- @BeforeClass
- public static void initContainer() {
- otservice = Service.getV4(testOpenTypeServiceRootURL);
- otservice.getClient().getConfiguration().
- setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- otcontainer = otservice.getEntityContainer(DefaultContainer.class);
- assertNotNull(otcontainer);
- }
-
- @Test
- public void checkOpenTypeEntityTypesExist() {
- assertTrue(otcontainer.newEntityInstance(Row.class).getClass().getInterfaces()[0].
- getAnnotation(EntityType.class).openType());
- assertTrue(otcontainer.newEntityInstance(RowIndex.class).getClass().getInterfaces()[0].
- getAnnotation(EntityType.class).openType());
- assertTrue(otcontainer.newEntityInstance(IndexedRow.class).getClass().getInterfaces()[0].
- getAnnotation(EntityType.class).openType());
- otservice.getContext().detachAll();
- }
-
- @Test
- public void read() {
- Row row = otcontainer.getRow().getByKey(UUID.fromString("71f7d0dc-ede4-45eb-b421-555a2aa1e58f")).load();
- assertEquals(Double.class, row.readAdditionalProperty("Double").getClass());
- assertEquals("71f7d0dc-ede4-45eb-b421-555a2aa1e58f", row.getId().toString());
-
- row = otcontainer.getRow().getByKey(UUID.fromString("672b8250-1e6e-4785-80cf-b94b572e42b3")).load();
- assertEquals(BigDecimal.class, row.readAdditionalProperty("Decimal").getClass());
- }
-
- @Test
- public void cud() throws ParseException {
- final Integer id = 1426;
-
- RowIndex rowIndex = otcontainer.newEntityInstance(RowIndex.class);
- rowIndex.setId(id);
- rowIndex.addAdditionalProperty("aString", "string");
- rowIndex.addAdditionalProperty("aBoolean", true);
- rowIndex.addAdditionalProperty("aDouble", 1.5D);
- rowIndex.addAdditionalProperty("aByte", Byte.MAX_VALUE);
- rowIndex.addAdditionalProperty("aDate", Calendar.getInstance());
-
- final ContactDetails contact = otcontainer.newComplexInstance(ContactDetails.class);
- contact.setFirstContacted("text".getBytes());
-
- Calendar cal = Calendar.getInstance();
- cal.clear();
- cal.setTime(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").parse("2001-04-05T05:05:05.001"));
-
- contact.setLastContacted(new Timestamp(cal.getTimeInMillis()));
-
- cal = Calendar.getInstance();
- cal.clear();
- cal.setTime(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").parse("2001-04-05T05:05:04.001"));
- contact.setContacted(cal);
-
- contact.setGUID(UUID.randomUUID());
- contact.setPreferedContactTime(cal);
- contact.setByte(Short.valueOf("24"));
- contact.setSignedByte(Byte.MAX_VALUE);
- contact.setDouble(Double.valueOf(Double.MAX_VALUE));
- contact.setSingle(Float.MAX_VALUE);
- contact.setShort(Short.MAX_VALUE);
- contact.setInt(Integer.MAX_VALUE);
- rowIndex.addAdditionalProperty("aContact", contact);
- rowIndex.addAdditionalProperty("aColor", Color.Green);
-
- final AccountInfo ai = otcontainer.newComplexInstance(AccountInfo.class);
- ai.setFirstName("Fabio");
- ai.setLastName("Martelli");
- ai.addAdditionalProperty("email", "fabio.martelli@tirasa.net");
- rowIndex.addAdditionalProperty("info", ai);
-
- otcontainer.getRowIndex().add(rowIndex);
- otcontainer.flush();
-
- rowIndex = otcontainer.getRowIndex().getByKey(id).load();
- assertEquals(String.class, rowIndex.readAdditionalProperty("aString").getClass());
- assertEquals(Boolean.class, rowIndex.readAdditionalProperty("aBoolean").getClass());
- assertEquals(Double.class, rowIndex.readAdditionalProperty("aDouble").getClass());
- assertEquals(Byte.class, rowIndex.readAdditionalProperty("aByte").getClass());
- assertEquals(Byte.MAX_VALUE, rowIndex.readAdditionalProperty("aByte"));
- assertTrue(Calendar.class.isAssignableFrom(rowIndex.readAdditionalProperty("aDate").getClass()));
- assertEquals(ContactDetails.class, rowIndex.readAdditionalProperty("aContact").getClass().getInterfaces()[0]);
- assertEquals(Color.class, rowIndex.readAdditionalProperty("aColor").getClass());
- assertEquals(Color.Green, rowIndex.readAdditionalProperty("aColor"));
- assertEquals("Fabio", AccountInfo.class.cast(rowIndex.readAdditionalProperty("info")).getFirstName());
- assertEquals("Martelli", AccountInfo.class.cast(rowIndex.readAdditionalProperty("info")).getLastName());
- assertEquals("fabio.martelli@tirasa.net", AccountInfo.class.cast(rowIndex.readAdditionalProperty("info")).
- readAdditionalProperty("email"));
-
- otservice.getContext().detachAll();
-
- otcontainer.getRowIndex().delete(id);
- otcontainer.flush();
-
- try {
- otcontainer.getRowIndex().getByKey(id).load();
- fail();
- } catch (IllegalArgumentException e) {
- // Expected
- }
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OperationImportInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OperationImportInvokeTestITCase.java
deleted file mode 100644
index 723d31c..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OperationImportInvokeTestITCase.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color;
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddress;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonComposableInvoker;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollectionComposableInvoker;
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.junit.Test;
-
-public class OperationImportInvokeTestITCase extends AbstractTestITCase {
-
- @Test
- public void getDefaultColor() {
- final Color color = container.operations().getDefaultColor().execute();
- assertEquals(Color.Red, color);
- }
-
- @Test
- public void getPerson2() {
- final PersonComposableInvoker person = container.operations().getPerson2("London");
- assertEquals(1, person.execute().getPersonID(), 0);
- }
-
- @Test
- public void getPerson() {
- final Address address = container.newComplexInstance(HomeAddress.class);
- address.setStreet("1 Microsoft Way");
- address.setPostalCode("98052");
- address.setCity("London");
-
- final PersonComposableInvoker person = container.operations().getPerson(address);
- assertEquals(1, person.execute().getPersonID(), 0);
- }
-
- @Test
- public void getAllProducts() {
- final ProductCollectionComposableInvoker products = container.operations().getAllProducts();
- assertEquals(5, products.execute().size());
- }
-
- @Test
- public void getProductsByAccessLevel() {
- final PrimitiveCollection<String> products =
- container.operations().getProductsByAccessLevel(AccessLevel.None).execute();
- assertEquals(5, products.size());
- assertTrue(products.contains("Car"));
- }
-
- @Test
- public void discount() {
- container.operations().discount(22).execute();
- }
-
- @Test
- public void resetBossAddress() {
- final Address address = container.newComplexInstance(HomeAddress.class);
- address.setStreet("Via Le Mani Dal Naso, 123");
- address.setPostalCode("Tollo");
- address.setCity("66010");
-
- final Address actual = container.operations().resetBossAddress(address).execute();
- assertEquals(address.getStreet(), actual.getStreet());
- assertEquals(address.getPostalCode(), actual.getPostalCode());
- assertEquals(address.getCity(), actual.getCity());
- }
-
- @Test
- public void bossEmails() {
- PrimitiveCollection<String> be = container.newPrimitiveCollection(String.class);
- be.add("first@olingo.apache.org");
- be.add("second@olingo.apache.org");
-
- final PrimitiveCollection<String> result = container.operations().resetBossEmail(be).execute();
- assertEquals(2, result.size());
-
- final PrimitiveCollection<String> result2 = container.operations().getBossEmails(0, 100).execute();
- assertEquals(result, result2);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/PropertyTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/PropertyTestITCase.java
deleted file mode 100644
index 8231bfe..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/PropertyTestITCase.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.fit.proxy.v4;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
-import org.apache.olingo.ext.proxy.api.ODataFlushException;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI;
-import org.junit.Test;
-
-/**
- * This is the unit test class to check actions overloading.
- */
-public class PropertyTestITCase extends AbstractTestITCase {
-
- @Test
- public void nullNullableProperty() {
- final Customer customer = container.getCustomers().getByKey(1);
- customer.setFirstName(null);
- container.flush();
-
- assertNull(container.getCustomers().getByKey(1).getFirstName());
- }
-
- @Test
- public void nullNonNullableProperty() {
- final StoredPI storedPI = container.getStoredPIs().getByKey(1000);
- storedPI.setPIName(null);
-
- try {
- container.flush();
- fail();
- } catch (ODataFlushException e) {
- assertNotNull(e);
- }
- service.getContext().detachAll();
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/SingletonTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/SingletonTestITCase.java
deleted file mode 100644
index 9f62618..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/SingletonTestITCase.java
+++ /dev/null
@@ -1,77 +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.fit.proxy.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.olingo.ext.proxy.api.Annotatable;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.IsBoss;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
-import org.junit.Test;
-
-public class SingletonTestITCase extends AbstractTestITCase {
-
- @Test
- public void read() {
- final Company company = container.getCompany().load();
- assertEquals(0, company.getCompanyID(), 0);
- assertEquals(CompanyCategory.IT, company.getCompanyCategory());
- }
-
- @Test
- public void update() {
- final Company company = container.getCompany().load();
- company.setRevenue(132520L);
-
- container.flush();
-
- assertEquals(132520L, container.getCompany().load().getRevenue(), 0);
- }
-
- @Test
- public void readWithAnnotations() {
- final Company company = container.getCompany().load();
- assertTrue(company.readAnnotationTerms().isEmpty());
-
- final Person boss = container.getBoss().load();
- assertEquals(2, boss.getPersonID(), 0);
-
- assertEquals(1, boss.readAnnotationTerms().size());
- Object isBoss = boss.readAnnotation(IsBoss.class);
- assertTrue(isBoss instanceof Boolean);
- assertTrue((Boolean) isBoss);
-
- Annotatable annotations = boss.annotations().getFirstNameAnnotations();
- assertTrue(annotations.readAnnotationTerms().isEmpty());
-
- annotations = boss.annotations().getLastNameAnnotations();
- isBoss = annotations.readAnnotation(IsBoss.class);
- assertTrue(isBoss instanceof Boolean);
- assertFalse((Boolean) isBoss);
-
- annotations = boss.annotations().getParentAnnotations();
- isBoss = annotations.readAnnotation(IsBoss.class);
- assertTrue(isBoss instanceof Boolean);
- assertFalse((Boolean) isBoss);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/UnauthorizedEntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/UnauthorizedEntityCreateTestITCase.java
deleted file mode 100644
index 5a46da8..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/UnauthorizedEntityCreateTestITCase.java
+++ /dev/null
@@ -1,56 +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.fit.proxy.v4;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.fit.proxy.v4.staticservice.Service;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
-import org.junit.Test;
-
-public class UnauthorizedEntityCreateTestITCase extends AbstractTestITCase {
-
- private Service<EdmEnabledODataClient> ecf;
-
- private InMemoryEntities ime;
-
- public Service<EdmEnabledODataClient> getService() {
- if (ecf == null) {
- ecf = Service.getV4(testAuthServiceRootURL);
- ecf.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- ecf.getClient().getConfiguration().
- setHttpClientFactory(new BasicAuthHttpClientFactory("not_auth", "not_auth"));
- }
- return ecf;
- }
-
- @Test(expected = HttpClientException.class)
- public void unauthorizedCreate() {
- createPatchAndDeleteOrder(getContainer(), getService());
- }
-
- protected InMemoryEntities getContainer() {
- if (ime == null) {
- ime = getService().getEntityContainer(InMemoryEntities.class);
- }
- return ime;
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java
deleted file mode 100644
index f66881d..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java
+++ /dev/null
@@ -1,127 +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.fit.proxy.v4.demo;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.ext.proxy.AbstractService;
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public class Service<C extends EdmEnabledODataClient> extends AbstractService<C> {
-
- // CHECKSTYLE:OFF (Maven checkstyle)
- private static final String COMPRESSED_METADATA =
- "H4sIAAAAAAAAAMVaDYwcVR1/t7f3fW2PaylShS6mFFrLbq+9lsJhy/Z2e6zs0eP2esHjw8zNvNsbmZ0Z3ry92yVS1ERiwA8aFCFVVKIEI42mRgIYI6ggmjQmfAUTglHRhAgGAyGKJvp/b753ZvZmrhUbcuzMzvt//N7v/b9mH3kTdRkE7dNINSvogriIs5oiq1UtKyoyVmlW1AjOYqmWbdSU7NJo9rrJ8iSmgiRQoVTTlco3v7/r+D/OqacQahB0WTwx+XmDEkGkHlmPfWff7JrfnPxuCnWUURoebFD0kTKIy5nicqa4nCkObso5eCgH0nJFeHgMlO9JphyWlSiudV73hzfu3//CW8wBHZAYiY0E08sgePh7Gwrfvv4eiZveT/ACJlgVsUHRUPmTwpKQq1NZyZVlgzIrdyW2sjG+Dt02c8mml1MoVUaDDK0KJksyV7E7HkYFz6KxMupZwsSQNZWiYdNERVCruQolsH6scQs6ijqN2LsJUHjFM0gu/9gd194g7niBQ9JjgICaYDCx3YDA5ckQ8Mr++ZufvfTEqfwxjsSwB4lZ0x+moq+Mzq4JjUL4l6ZzOtvp9czzLNucbJ4Qocl2qPGZ5867/1fCNzpRRwmlDflW3NARQh3LafYXFu2OjUmFe83Q2PS5u15MP/qLm1NoANAAl8AYEw3YTkFVNQq2zitsO9d5GDMp6LBVQ9YDsGaCaHXdXjjg3ndkiRpow42Zpo7te+vANJk2x2GvBVnFhKLL4jFmaTRX9C8FYwZMaV4FfVit13w3Fuqqz8UuiknNsYfCowW8IKuy+wyQYjQZKUxwH/rJvb9+6lPp2zkdugRFNkkGDOhThRo2QBz27jpFfYcZLwq4pvEn18KupvjephLtbZ47yPa29LvX77vp6ZGHU6hrDnXNa3VVKqM1JkwVTKcEumiZlGYmWZ/7dYHAFQBj4wJxg9aJyoCkaDT2Fk07q1hsuSK+AxaOeZd9u187fsQYe+JafmYD7LKCgg0a4qChRgdg2luQDREcpyGQ7o1t0ZSNCEN1/lRja26uluEbG8L0tEFkiaIdYThptRo86ABVxVquMl0qMHwuTUYyx6S/jx28L5+q/DKFuudQr1pXFAYYsAziTBmrVbpI0XpPIC2pFFf5gfFuep9OsCjbkegCYKwhCgq2LtLsYHjIypDt0Ykm1UWqw+ezHOZmp8y7gc0wY8P5CJ4elqw9mcJEBAeFKmZC+iCdZMG63buCixtGbIBgu1zisf2a/dOrj2eLNzwTDZDl5QoYsG1lnzcH8UC6zjzoZx4UtDoLl+z+OQFHmPtDJVUkWDBwRVAEImPDecqO5A5S/Xp8hHQLYnY3ze+mE9VOeZfIDLUTxc+/cXLXay9HnLjE5ZRH/Pa7/mL88Mk/l/gB6rulDrFxQcbEYmI3FUgVU39oPNslGPtjp9xW4JKQxDWIuXv1S3f/dudPX78lhTrLaIPrbrEBpDDMcqQUO/K563P5EFFjIW6nWSJynT43sMPg3Exs51wDspAiDSqoNMwQ5vnkP++euf3KsYv5bnBiUzS7Gk/bKdrCswCcqCVBqVsnh6Cp1fgTJJSr5ulLJr5EssX/sHqZU+doO9DAlVVgxl1B1r9h3lms5cUai67ZIhQc3i+Bu91m6UrRzplF2cjAf0LGEFgxlOGszhgmmzPLMl3MLGmiMF83AwMszhwG6/ljWchkuiI0s7MjcAYMkcg6M6zBibK3fRD2BpaxILPYjQPsT5Gi7XlFydjrM+CXzMNlRlYzdBFnNBUgxBmDwgYlM29jwLzcNawOWoWNg5aADBMQbYX5kT3jWrE5NJDkKnVdB1IQNxb3c8X9ccxZNymLRDO0BZoZ14ieBTVbXYumIB3IoskrsIpfGouYOM6vID09WTk0AyK3rCyyJMURuLOkLgH9NdLckbH93pHJS9B2URm4aMBtSHvwv0OyKkCzCMoviFR+NW4ua0Qy4mg+e5FS/fJcbnl5OauxBinLwgyIvyhSfJ7C4Zmvs8sjRImjZD0jMJGri0BfOLKwwVgCFbk4KjzEPS1/tkcqK2hivcYyuuVR5jRciibZDGtqDi8cMXBM0CI92RbNOiIvCWJzCmKq2Iyppnc0tyu3a+fIbpB8YaTksmDQSU1i2TEWoSON/3CkilINSioGf6MRLttfVcSvosbdLpcl131fufTA5hsfepvXnsOCPTdxGlUoSDUd81I1tJfonYc6ccYuNqEyUYUlucofgRiosxPr9Lb9uv9O8hrNY/y6Z2979MY3P3SxOfJyGgUzq0Lxn5cklg8Riij0QwHt4jfYSC/mOIy1XqZTTYbmgaEn9n91wx0PRdakMTs6p4eyZP+18s6FI3c/9uUU6vN0CHOop67KoiZhNtjCC0JdobNO+RLSPyTop9r0Eh0dulU0YEzdtsIsIsKx/Zq5Jj0OrEq0oqsCAOJES3rmZH0cMEm2aJy1e2Rl4xqszI0/KWgZAjGOXLP11cFN7527PoW6ymiNYM9CNELbDKf6nZmIMwqyB0X+tf0GmKNg6uHcRxPOTP0mv3Xn1j1vjTx/JIXSc2ijxbKWZyByKMKtzbImSCC+qDJyShAbPoEbFKuSPVZqPaWIdZAD7dul+FPUvAcNhvO2K5459dSJ6iu8Yeo2cba576AZblmwt6Fok1uXtbbHYS1zm6jdw2/0JJrvFG2DmWcn33jwvutLzw+CZ3PoA7IqKnUJl1QLRDuBh/JoUyA8Nw/KqmQzvTv5mMexbHnzD46fLL1wiLdp/e6oM2Lzw9oByL92Yd8RjZ87OzgUG79rotxmeD4wdM8N5xe++I7ZYOru0DHY6bNK0LH6EBZonWDJ7hacCpXBT9Fa37VZfz4J0WUcIlpVYyTxXdjf99olL0V9/qofvlxj6SpgOHkK6PBdW6x7nKJzAthGrGiDs7ffAdU9wU1y1A276iyHmj7f4mtxZK+gJgykM6RlyIMdSGWDlR7zQwINg+YKG/U13ktX1cZWVeHPx1fb3WpxGCPa8zS+snUtB8ALZpv4F7hhd7JJhmNuhcpO8LMnFi666djOf/FYHxL2ElalMavpfKBaHvrx+pcrf3z3bf4+I7Sa7lsUDFY5CTVfZd1aRnfejOEE7YmecjFD3He4XAE0ugwL8w3kMffAArZ6/PczPlk9+/aNHXsw+zyvZwctoJrTeCH0tYabtWNWz1OuQKZtw+8f+PdzJ156N/hCqjV5QMZNlQptKNXJb7DXsAdOI0cwo/YfLVa/declj7QO58N6IXZgofbC0MzHm08ethawl8q6QKjqTFs3Wm/CqSwofNhHoNJyqjxPSU7QlcnYGnRz9v6nfvSFD2b2A+5zaK1oVnXGDM99IVXbCpFd94SBkDrq/HFNUTCvxi4OZo1tbEXHGuRJg4k1hGQJR6o/f4aKto9NiOSorBqs7XhrgXhrAUTVV3g34uuR+MgwSe8y4BkKxVxoWjYwDeSDuFOwW6xh/noIrmbkGj68sGDgIApezUP83SVwVK1jaRVSTDO6p4GNatUH0sjetku6pghUuqGvtHzNGt93FMxU8GVY/dlmMuBJfSaRfEkzlEitStsTyicvPLJ1BAjMQzv7pivU0F6GqLWgbbhs9c4+A6F++U0I8SoIrKvJfrnt2UzXwiTnpMdSv3LHbkPXawcZ8HQl1Npnl1a42nQterDG94N1Xmg8tARuawvc/ySyuHDZwTMGyc4kXL3eoL1KsOw53vsZhu2Jo97yewPrdtu1vWXNHP3yn1ZtD0no5u8ynDeCVQzJbbpUoD975bZ7K4/UeeHbJ0HAVc1XwVfE/HHHBNYM6HihythSsFf7XoNeAHXNkkBkVvX4f6dxUNMgfahjDf1o+M/SQmwOU4esf8PWO9ECbNJE8fDEdH7qqo8zPM5y315aOk9lyKdf/Pp7f4O6dM6ytaF3WKkHdFSJoC82pzRZbZ96BqC0EuuE/eKwuRI7nINh9Vhn/Fj4WsbQo2FpDjkYEY3k/zN8jNcNqtV4+Ajpqduk2rZtp2X74AzU3kqxAQ2UYRo1wOsALMo1IZiTXKuKUNJrTYxP3yq7xfBY1W9Lb0F272hbFvZeJZPVFGFW+cRHjt7JNZ8AR2Pg41kMFveazyfissXUUBb79IdwObArrppu/lC3DzzbunhcNhd15qsm2L3s+YNNGoTLB/EEViVMXJ5ZYajteemaWtTU9yOFIEcd1XzqsFCLZoG/gEUdZziYtRa/4ZWkf/IUpMK5kcPWtufQjmx8dyfqsnTGUj2y9kkmic5ronFY5A0ApHM0uzNw/78+E7hjhjAAAA==";
- private static final String METADATA_ETAG = null;
- // CHECKSTYLE:ON (Maven checkstyle)
-
- private static final Map<String, Service<?>> SERVICES = new ConcurrentHashMap<String, Service<?>>();
-
- @SuppressWarnings("unchecked")
- private static <C extends EdmEnabledODataClient> Service<C> getInstance(
- final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
-
- if (!SERVICES.containsKey(serviceRoot)) {
- final Service<C> instance = new Service<C>(COMPRESSED_METADATA, METADATA_ETAG,
- version, serviceRoot, transactional);
- SERVICES.put(serviceRoot, instance);
- }
-
- return (Service<C>) SERVICES.get(serviceRoot);
- }
-
- /**
- * Gives an OData 4.0 instance for given service root, operating in transactions (with batch requests).
- *
- * @param serviceRoot OData service root
- * @return OData 4.0 instance for given service root, operating in transactions (with batch requests)
- */
- public static Service<org.apache.olingo.client.api.EdmEnabledODataClient> getV4(
- final String serviceRoot) {
-
- return getV4(serviceRoot, true);
- }
-
- /**
- * Gives an OData 4.0 instance for given service root.
- *
- * @param serviceRoot OData service root
- * @param transactional whether operating in transactions (with batch requests) or not
- * @return OData 4.0 instance for given service root
- */
- public static Service<org.apache.olingo.client.api.EdmEnabledODataClient> getV4(
- final String serviceRoot, final boolean transactional) {
-
- return getInstance(ODataServiceVersion.V40, serviceRoot, transactional);
- }
-
- private final Map<String, Class<?>> entityTypes = new HashMap<String, Class<?>>();
-
- private final Map<String, Class<?>> complexTypes = new HashMap<String, Class<?>>();
-
- private final Map<String, Class<?>> enumTypes = new HashMap<String, Class<?>>();
-
- private final Map<String, Class<? extends AbstractTerm>> terms = new HashMap<String, Class<? extends AbstractTerm>>();
-
- public Service(final String compressedMetadata, final String metadataETag,
- final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
-
- super(compressedMetadata, metadataETag, version, serviceRoot, transactional);
-
- // CHECKSTYLE:OFF (Maven checkstyle)
- entityTypes.put("ODataDemo.Customer", org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Customer.class);
- entityTypes.put("ODataDemo.PersonDetail", org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail.class);
- entityTypes.put("ODataDemo.ProductDetail", org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail.class);
- entityTypes.put("ODataDemo.Employee", org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Employee.class);
- entityTypes.put("ODataDemo.Product", org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product.class);
- entityTypes.put("ODataDemo.Advertisement", org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Advertisement.class);
- entityTypes.put("ODataDemo.Category", org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Category.class);
- entityTypes.put("ODataDemo.Person", org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person.class);
- entityTypes.put("ODataDemo.Supplier", org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier.class);
- entityTypes.put("ODataDemo.FeaturedProduct",
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProduct.class);
- complexTypes.put("ODataDemo.Address", org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address.class);
- // CHECKSTYLE:ON (Maven checkstyle)
- }
-
- @Override
- public Class<?> getEntityTypeClass(final String name) {
- return entityTypes.get(name);
- }
-
- @Override
- public Class<?> getComplexTypeClass(final String name) {
- return complexTypes.get(name);
- }
-
- @Override
- public Class<?> getEnumTypeClass(final String name) {
- return enumTypes.get(name);
- }
-
- @Override
- public Class<? extends AbstractTerm> getTermClass(final String name) {
- return terms.get(name);
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/Advertisements.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/Advertisements.java
deleted file mode 100644
index e103a3f..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/Advertisements.java
+++ /dev/null
@@ -1,38 +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.fit.proxy.v4.demo.odatademo;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Advertisements", container = "ODataDemo.DemoService")
-public interface Advertisements
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Advertisement, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.AdvertisementCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Advertisements>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Advertisement, java.util.UUID, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.AdvertisementCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/Categories.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/Categories.java
deleted file mode 100644
index f195389..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/Categories.java
+++ /dev/null
@@ -1,38 +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.fit.proxy.v4.demo.odatademo;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Categories", container = "ODataDemo.DemoService")
-public interface Categories
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Category, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Categories>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Category, java.lang.Integer, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/DemoService.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/DemoService.java
deleted file mode 100644
index 3caa568..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/DemoService.java
+++ /dev/null
@@ -1,79 +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.fit.proxy.v4.demo.odatademo;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.io.InputStream;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import java.io.Serializable;
-
-import org.apache.olingo.ext.proxy.api.ComplexCollection;
-import org.apache.olingo.ext.proxy.api.ComplexType;
-import org.apache.olingo.ext.proxy.api.EdmStreamValue;
-import org.apache.olingo.ext.proxy.api.EntityCollection;
-import org.apache.olingo.ext.proxy.api.EntityType;
-import org.apache.olingo.ext.proxy.api.OperationType;
-import org.apache.olingo.ext.proxy.api.PersistenceManager;
-import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
-@org.apache.olingo.ext.proxy.api.annotations.EntityContainer(name = "DemoService",
- namespace = "ODataDemo")
-public interface DemoService extends PersistenceManager {
-
- Products getProducts();
-
- Advertisements getAdvertisements();
-
- Persons getPersons();
-
- Categories getCategories();
-
- PersonDetails getPersonDetails();
-
- Suppliers getSuppliers();
-
- ProductDetails getProductDetails();
-
- Operations operations();
-
- public interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "IncreaseSalaries",
- type = OperationType.ACTION)
- org.apache.olingo.ext.proxy.api.Invoker<Void> increaseSalaries(
- @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "percentage", type = "Edm.Int32",
- nullable = false) java.lang.Integer percentage
- );
-
- }
-
- <NE extends EntityType<?>> NE newEntityInstance(Class<NE> ref);
-
- <T extends EntityType<?>, NEC extends EntityCollection<T, ?, ?>> NEC newEntityCollection(Class<NEC> ref);
-
- <NE extends ComplexType<?>> NE newComplexInstance(Class<NE> ref);
-
- <T extends ComplexType<?>, NEC extends ComplexCollection<T, ?, ?>> NEC newComplexCollection(Class<NEC> ref);
-
- <T extends Serializable, NEC extends PrimitiveCollection<T>> NEC newPrimitiveCollection(Class<T> ref);
-
- EdmStreamValue newEdmStreamValue(String contentType, InputStream stream);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/PersonDetails.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/PersonDetails.java
deleted file mode 100644
index c0946c0..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/PersonDetails.java
+++ /dev/null
@@ -1,38 +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.fit.proxy.v4.demo.odatademo;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "PersonDetails", container = "ODataDemo.DemoService")
-public interface PersonDetails
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetailCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<PersonDetails>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail, java.lang.Integer, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetailCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/Persons.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/Persons.java
deleted file mode 100644
index e1586b6..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/Persons.java
+++ /dev/null
@@ -1,38 +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.fit.proxy.v4.demo.odatademo;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Persons", container = "ODataDemo.DemoService")
-public interface Persons
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Persons>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person, java.lang.Integer, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/ProductDetails.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/ProductDetails.java
deleted file mode 100644
index 79bce3a..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/ProductDetails.java
+++ /dev/null
@@ -1,38 +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.fit.proxy.v4.demo.odatademo;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "ProductDetails", container = "ODataDemo.DemoService")
-public interface ProductDetails
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetailCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ProductDetails>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail, java.lang.Integer, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetailCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/Products.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/Products.java
deleted file mode 100644
index 4daf4dd..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/Products.java
+++ /dev/null
@@ -1,38 +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.fit.proxy.v4.demo.odatademo;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Products", container = "ODataDemo.DemoService")
-public interface Products
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Products>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product, java.lang.Integer, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/Suppliers.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/Suppliers.java
deleted file mode 100644
index 6e2ee44..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/Suppliers.java
+++ /dev/null
@@ -1,38 +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.fit.proxy.v4.demo.odatademo;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Suppliers", container = "ODataDemo.DemoService")
-public interface Suppliers
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.SupplierCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Suppliers>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier, java.lang.Integer, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.SupplierCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/package-info.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/package-info.java
deleted file mode 100644
index 259416f..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/package-info.java
+++ /dev/null
@@ -1,20 +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.fit.proxy.v4.demo.odatademo;
-
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Address.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Address.java
deleted file mode 100644
index 24ac91e..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Address.java
+++ /dev/null
@@ -1,140 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.Annotatable;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
-@org.apache.olingo.ext.proxy.api.annotations.ComplexType(name = "Address",
- isOpenType = false,
- isAbstract = false)
-public interface Address
- extends org.apache.olingo.ext.proxy.api.ComplexType<Address>,
- org.apache.olingo.ext.proxy.api.StructuredQuery<Address> {
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getStreet();
-
- void setStreet(java.lang.String _street);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCity();
-
- void setCity(java.lang.String _city);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "State",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getState();
-
- void setState(java.lang.String _state);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ZipCode",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getZipCode();
-
- void setZipCode(java.lang.String _zipCode);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Country",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCountry();
-
- void setCountry(java.lang.String _country);
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Street",
- type = "Edm.String")
- Annotatable getStreetAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "City",
- type = "Edm.String")
- Annotatable getCityAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "State",
- type = "Edm.String")
- Annotatable getStateAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ZipCode",
- type = "Edm.String")
- Annotatable getZipCodeAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Country",
- type = "Edm.String")
- Annotatable getCountryAnnotations();
-
- }
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AddressCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AddressCollection.java
deleted file mode 100644
index 669a86c..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AddressCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface AddressCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.AddressCollection>,
-org.apache.olingo.ext.proxy.api.ComplexCollection<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.AddressCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.AddressCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AddressCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AddressCollectionComposableInvoker.java
deleted file mode 100644
index 98b0741..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AddressCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface AddressCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.AddressCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.AddressCollection.Operations> {
-
- @Override
- AddressCollectionComposableInvoker select(String... select);
-
- @Override
- AddressCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AddressComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AddressComposableInvoker.java
deleted file mode 100644
index 5a142e4..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AddressComposableInvoker.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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface AddressComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Address, Address.Operations>
-{
-
- @Override
- AddressComposableInvoker select(String... select);
-
- @Override
- AddressComposableInvoker expand(String... expand);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getStreet();
-
- void setStreet(java.lang.String _street);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCity();
-
- void setCity(java.lang.String _city);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "State",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getState();
-
- void setState(java.lang.String _state);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ZipCode",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getZipCode();
-
- void setZipCode(java.lang.String _zipCode);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Country",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCountry();
-
- void setCountry(java.lang.String _country);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Advertisement.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Advertisement.java
deleted file mode 100644
index ee6a8ac..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Advertisement.java
+++ /dev/null
@@ -1,123 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Advertisement",
- openType = false,
- hasStream = true,
- isAbstract = false)
-public interface Advertisement
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Advertisement>,
- org.apache.olingo.ext.proxy.api.StructuredQuery<Advertisement> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Guid",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.util.UUID getID();
-
- void setID(java.util.UUID _iD);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AirDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getAirDate();
-
- void setAirDate(java.sql.Timestamp _airDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "FeaturedProduct",
- type = "ODataDemo.FeaturedProduct",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Products",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProduct getFeaturedProduct();
-
- void setFeaturedProduct(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProduct _featuredProduct);
-
- void uploadStream(org.apache.olingo.ext.proxy.api.EdmStreamValue stream);
-
- org.apache.olingo.ext.proxy.api.EdmStreamValue loadStream();
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
- type = "Edm.Guid")
- org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "AirDate",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getAirDateAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "FeaturedProduct",
- type = "ODataDemo.FeaturedProduct")
- org.apache.olingo.ext.proxy.api.Annotatable getFeaturedProductAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AdvertisementCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AdvertisementCollection.java
deleted file mode 100644
index ae63639..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AdvertisementCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface AdvertisementCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.AdvertisementCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Advertisement, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.AdvertisementCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.AdvertisementCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AdvertisementCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AdvertisementCollectionComposableInvoker.java
deleted file mode 100644
index 184d5b8..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AdvertisementCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface AdvertisementCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.AdvertisementCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.AdvertisementCollection.Operations> {
-
- @Override
- AdvertisementCollectionComposableInvoker select(String... select);
-
- @Override
- AdvertisementCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AdvertisementComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AdvertisementComposableInvoker.java
deleted file mode 100644
index 6c7cd86..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/AdvertisementComposableInvoker.java
+++ /dev/null
@@ -1,96 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface AdvertisementComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Advertisement, Advertisement.Operations>
-{
-
- @Override
- AdvertisementComposableInvoker select(String... select);
-
- @Override
- AdvertisementComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Guid",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.util.UUID getID();
-
- void setID(java.util.UUID _iD);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AirDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getAirDate();
-
- void setAirDate(java.sql.Timestamp _airDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "FeaturedProduct",
- type = "ODataDemo.FeaturedProduct",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Products",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProduct getFeaturedProduct();
-
- void setFeaturedProduct(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProduct _featuredProduct);
-
- void uploadStream(org.apache.olingo.ext.proxy.api.EdmStreamValue stream);
-
- org.apache.olingo.ext.proxy.api.EdmStreamValue loadStream();
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Category.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Category.java
deleted file mode 100644
index b854543..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Category.java
+++ /dev/null
@@ -1,100 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Category",
- openType = true,
- hasStream = false,
- isAbstract = false)
-public interface Category
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Category>, org.apache.olingo.ext.proxy.api.StructuredQuery<Category>,
- AbstractOpenType {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getID();
-
- void setID(java.lang.Integer _iD);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Products",
- type = "ODataDemo.Product",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Products",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection getProducts();
-
- void setProducts(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection _products);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Products",
- type = "ODataDemo.Product")
- org.apache.olingo.ext.proxy.api.Annotatable getProductsAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CategoryCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CategoryCollection.java
deleted file mode 100644
index e915d36..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CategoryCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface CategoryCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Category, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CategoryCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CategoryCollectionComposableInvoker.java
deleted file mode 100644
index 11abe78..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CategoryCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface CategoryCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection.Operations> {
-
- @Override
- CategoryCollectionComposableInvoker select(String... select);
-
- @Override
- CategoryCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CategoryComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CategoryComposableInvoker.java
deleted file mode 100644
index ae60a27..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CategoryComposableInvoker.java
+++ /dev/null
@@ -1,78 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-public interface CategoryComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Category, Category.Operations>
- , AbstractOpenType {
-
- @Override
- CategoryComposableInvoker select(String... select);
-
- @Override
- CategoryComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getID();
-
- void setID(java.lang.Integer _iD);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Products",
- type = "ODataDemo.Product",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Products",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection getProducts();
-
- void setProducts(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection _products);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Customer.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Customer.java
deleted file mode 100644
index 48369c3..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Customer.java
+++ /dev/null
@@ -1,146 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.concurrent.Future;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Customer",
- openType = false,
- hasStream = false,
- isAbstract = false,
- baseType = "ODataDemo.Person")
-public interface Customer
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person {
-
- @Override
- Customer load();
-
- @Override
- Future<? extends Customer> loadAsync();
-
- @Override
- Customer refs();
-
- @Override
- Customer expand(String... expand);
-
- @Override
- Customer select(String... select);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- @Override
- java.lang.Integer getID();
-
- @Override
- void setID(java.lang.Integer _iD);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- @Override
- java.lang.String getName();
-
- @Override
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TotalExpense",
- type = "Edm.Decimal",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.math.BigDecimal getTotalExpense();
-
- void setTotalExpense(java.math.BigDecimal _totalExpense);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "PersonDetail",
- type = "ODataDemo.PersonDetail",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "PersonDetails",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail getPersonDetail();
-
- @Override
- void setPersonDetail(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail _personDetail);
-
- @Override
- Operations operations();
-
- interface Operations extends org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person.Operations {
- // No additional methods needed for now.
- }
-
- @Override
- Annotations annotations();
-
- interface Annotations extends org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person.Annotations {
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "TotalExpense",
- type = "Edm.Decimal")
- org.apache.olingo.ext.proxy.api.Annotatable getTotalExpenseAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "PersonDetail",
- type = "ODataDemo.PersonDetail")
- org.apache.olingo.ext.proxy.api.Annotatable getPersonDetailAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CustomerCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CustomerCollection.java
deleted file mode 100644
index 6d21b38..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CustomerCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface CustomerCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CustomerCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Customer, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CustomerCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CustomerCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CustomerCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CustomerCollectionComposableInvoker.java
deleted file mode 100644
index 34eb06b..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CustomerCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface CustomerCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CustomerCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CustomerCollection.Operations> {
-
- @Override
- CustomerCollectionComposableInvoker select(String... select);
-
- @Override
- CustomerCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CustomerComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CustomerComposableInvoker.java
deleted file mode 100644
index f1fa92b..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/CustomerComposableInvoker.java
+++ /dev/null
@@ -1,92 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface CustomerComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Customer, Customer.Operations>
-{
-
- @Override
- CustomerComposableInvoker select(String... select);
-
- @Override
- CustomerComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getID();
-
- void setID(java.lang.Integer _iD);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TotalExpense",
- type = "Edm.Decimal",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.math.BigDecimal getTotalExpense();
-
- void setTotalExpense(java.math.BigDecimal _totalExpense);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "PersonDetail",
- type = "ODataDemo.PersonDetail",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "PersonDetails",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail getPersonDetail();
-
- void setPersonDetail(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail _personDetail);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Employee.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Employee.java
deleted file mode 100644
index 15776d0..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Employee.java
+++ /dev/null
@@ -1,184 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.concurrent.Future;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Employee",
- openType = false,
- hasStream = false,
- isAbstract = false,
- baseType = "ODataDemo.Person")
-public interface Employee
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person {
-
- @Override
- Employee load();
-
- @Override
- Future<? extends Employee> loadAsync();
-
- @Override
- Employee refs();
-
- @Override
- Employee expand(String... expand);
-
- @Override
- Employee select(String... select);
-
- @Override
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getID();
-
- @Override
- void setID(java.lang.Integer _iD);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- @Override
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "EmployeeID",
- type = "Edm.Int64",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Long getEmployeeID();
-
- void setEmployeeID(java.lang.Long _employeeID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HireDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getHireDate();
-
- void setHireDate(java.sql.Timestamp _hireDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Salary",
- type = "Edm.Single",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Float getSalary();
-
- void setSalary(java.lang.Float _salary);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "PersonDetail",
- type = "ODataDemo.PersonDetail",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "PersonDetails",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail getPersonDetail();
-
- @Override
- void setPersonDetail(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail _personDetail);
-
- @Override
- Operations operations();
-
- interface Operations extends org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person.Operations {
- // No additional methods needed for now.
- }
-
- @Override
- Annotations annotations();
-
- interface Annotations extends org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person.Annotations {
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "EmployeeID",
- type = "Edm.Int64")
- org.apache.olingo.ext.proxy.api.Annotatable getEmployeeIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "HireDate",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getHireDateAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Salary",
- type = "Edm.Single")
- org.apache.olingo.ext.proxy.api.Annotatable getSalaryAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "PersonDetail",
- type = "ODataDemo.PersonDetail")
- org.apache.olingo.ext.proxy.api.Annotatable getPersonDetailAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/EmployeeCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/EmployeeCollection.java
deleted file mode 100644
index 5388121..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/EmployeeCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface EmployeeCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.EmployeeCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Employee, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.EmployeeCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.EmployeeCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/EmployeeCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/EmployeeCollectionComposableInvoker.java
deleted file mode 100644
index eebb122..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/EmployeeCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface EmployeeCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.EmployeeCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.EmployeeCollection.Operations> {
-
- @Override
- EmployeeCollectionComposableInvoker select(String... select);
-
- @Override
- EmployeeCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/EmployeeComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/EmployeeComposableInvoker.java
deleted file mode 100644
index 8bef4fb..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/EmployeeComposableInvoker.java
+++ /dev/null
@@ -1,122 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface EmployeeComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Employee, Employee.Operations>
-{
-
- @Override
- EmployeeComposableInvoker select(String... select);
-
- @Override
- EmployeeComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getID();
-
- void setID(java.lang.Integer _iD);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "EmployeeID",
- type = "Edm.Int64",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Long getEmployeeID();
-
- void setEmployeeID(java.lang.Long _employeeID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HireDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getHireDate();
-
- void setHireDate(java.sql.Timestamp _hireDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Salary",
- type = "Edm.Single",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Float getSalary();
-
- void setSalary(java.lang.Float _salary);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "PersonDetail",
- type = "ODataDemo.PersonDetail",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "PersonDetails",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail getPersonDetail();
-
- void setPersonDetail(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail _personDetail);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/FeaturedProduct.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/FeaturedProduct.java
deleted file mode 100644
index c2fe2e8..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/FeaturedProduct.java
+++ /dev/null
@@ -1,285 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.concurrent.Future;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "FeaturedProduct",
- openType = false,
- hasStream = false,
- isAbstract = false,
- baseType = "ODataDemo.Product")
-public interface FeaturedProduct
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product {
-
- @Override
- FeaturedProduct load();
-
- @Override
- Future<? extends FeaturedProduct> loadAsync();
-
- @Override
- FeaturedProduct refs();
-
- @Override
- FeaturedProduct expand(String... expand);
-
- @Override
- FeaturedProduct select(String... select);
-
- @Override
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getID();
-
- @Override
- void setID(java.lang.Integer _iD);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- @Override
- void setName(java.lang.String _name);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Description",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getDescription();
-
- @Override
- void setDescription(java.lang.String _description);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ReleaseDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getReleaseDate();
-
- @Override
- void setReleaseDate(java.sql.Timestamp _releaseDate);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DiscontinuedDate",
- type = "Edm.DateTimeOffset",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getDiscontinuedDate();
-
- @Override
- void setDiscontinuedDate(java.sql.Timestamp _discontinuedDate);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Rating",
- type = "Edm.Int16",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Short getRating();
-
- @Override
- void setRating(java.lang.Short _rating);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Price",
- type = "Edm.Double",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Double getPrice();
-
- @Override
- void setPrice(java.lang.Double _price);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Categories",
- type = "ODataDemo.Category",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Categories",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection getCategories();
-
- @Override
- void setCategories(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection _categories);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Supplier",
- type = "ODataDemo.Supplier",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Suppliers",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier getSupplier();
-
- @Override
- void setSupplier(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier _supplier);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ProductDetail",
- type = "ODataDemo.ProductDetail",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "ProductDetails",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail getProductDetail();
-
- @Override
- void setProductDetail(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail _productDetail);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Advertisement",
- type = "ODataDemo.Advertisement",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Advertisements",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Advertisement getAdvertisement();
-
- void setAdvertisement(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Advertisement _advertisement);
-
- @Override
- Operations operations();
-
- interface Operations extends org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product.Operations {
- // No additional methods needed for now.
- }
-
- @Override
- Annotations annotations();
-
- interface Annotations extends org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product.Annotations {
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Description",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getDescriptionAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ReleaseDate",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getReleaseDateAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "DiscontinuedDate",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getDiscontinuedDateAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Rating",
- type = "Edm.Int16")
- org.apache.olingo.ext.proxy.api.Annotatable getRatingAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Price",
- type = "Edm.Double")
- org.apache.olingo.ext.proxy.api.Annotatable getPriceAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Categories",
- type = "ODataDemo.Category")
- org.apache.olingo.ext.proxy.api.Annotatable getCategoriesAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Supplier",
- type = "ODataDemo.Supplier")
- org.apache.olingo.ext.proxy.api.Annotatable getSupplierAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "ProductDetail",
- type = "ODataDemo.ProductDetail")
- org.apache.olingo.ext.proxy.api.Annotatable getProductDetailAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Advertisement",
- type = "ODataDemo.Advertisement")
- org.apache.olingo.ext.proxy.api.Annotatable getAdvertisementAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/FeaturedProductCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/FeaturedProductCollection.java
deleted file mode 100644
index 9f7dcf5..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/FeaturedProductCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface FeaturedProductCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProductCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProduct, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProductCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProductCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/FeaturedProductCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/FeaturedProductCollectionComposableInvoker.java
deleted file mode 100644
index 140cb9d..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/FeaturedProductCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface FeaturedProductCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProductCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProductCollection.Operations> {
-
- @Override
- FeaturedProductCollectionComposableInvoker select(String... select);
-
- @Override
- FeaturedProductCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/FeaturedProductComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/FeaturedProductComposableInvoker.java
deleted file mode 100644
index ea80859..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/FeaturedProductComposableInvoker.java
+++ /dev/null
@@ -1,182 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface FeaturedProductComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<FeaturedProduct, FeaturedProduct.Operations>
-{
-
- @Override
- FeaturedProductComposableInvoker select(String... select);
-
- @Override
- FeaturedProductComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getID();
-
- void setID(java.lang.Integer _iD);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Description",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getDescription();
-
- void setDescription(java.lang.String _description);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ReleaseDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getReleaseDate();
-
- void setReleaseDate(java.sql.Timestamp _releaseDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DiscontinuedDate",
- type = "Edm.DateTimeOffset",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getDiscontinuedDate();
-
- void setDiscontinuedDate(java.sql.Timestamp _discontinuedDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Rating",
- type = "Edm.Int16",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Short getRating();
-
- void setRating(java.lang.Short _rating);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Price",
- type = "Edm.Double",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Double getPrice();
-
- void setPrice(java.lang.Double _price);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Categories",
- type = "ODataDemo.Category",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Categories",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection getCategories();
-
- void setCategories(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection _categories);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Supplier",
- type = "ODataDemo.Supplier",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Suppliers",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier getSupplier();
-
- void setSupplier(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier _supplier);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ProductDetail",
- type = "ODataDemo.ProductDetail",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "ProductDetails",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail getProductDetail();
-
- void setProductDetail(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail _productDetail);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Advertisement",
- type = "ODataDemo.Advertisement",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Advertisements",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Advertisement getAdvertisement();
-
- void setAdvertisement(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Advertisement _advertisement);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Person.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Person.java
deleted file mode 100644
index c81d527..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Person.java
+++ /dev/null
@@ -1,99 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Person",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface Person
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Person>, org.apache.olingo.ext.proxy.api.StructuredQuery<Person> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getID();
-
- void setID(java.lang.Integer _iD);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "PersonDetail",
- type = "ODataDemo.PersonDetail",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "PersonDetails",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail getPersonDetail();
-
- void setPersonDetail(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail _personDetail);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "PersonDetail",
- type = "ODataDemo.PersonDetail")
- org.apache.olingo.ext.proxy.api.Annotatable getPersonDetailAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonCollection.java
deleted file mode 100644
index 064af50..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface PersonCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonCollectionComposableInvoker.java
deleted file mode 100644
index 49f8c08..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface PersonCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonCollection.Operations> {
-
- @Override
- PersonCollectionComposableInvoker select(String... select);
-
- @Override
- PersonCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonComposableInvoker.java
deleted file mode 100644
index 7255bb1..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonComposableInvoker.java
+++ /dev/null
@@ -1,77 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface PersonComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Person, Person.Operations>
-{
-
- @Override
- PersonComposableInvoker select(String... select);
-
- @Override
- PersonComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getID();
-
- void setID(java.lang.Integer _iD);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "PersonDetail",
- type = "ODataDemo.PersonDetail",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "PersonDetails",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail getPersonDetail();
-
- void setPersonDetail(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail _personDetail);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonDetail.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonDetail.java
deleted file mode 100644
index 5918747..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonDetail.java
+++ /dev/null
@@ -1,176 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "PersonDetail",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface PersonDetail
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<PersonDetail>,
- org.apache.olingo.ext.proxy.api.StructuredQuery<PersonDetail> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getPersonID();
-
- void setPersonID(java.lang.Integer _personID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Age",
- type = "Edm.Byte",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Short getAge();
-
- void setAge(java.lang.Short _age);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Gender",
- type = "Edm.Boolean",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Boolean getGender();
-
- void setGender(java.lang.Boolean _gender);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Phone",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getPhone();
-
- void setPhone(java.lang.String _phone);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
- type = "ODataDemo.Address",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address getAddress();
-
- void setAddress(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address _address);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Photo",
- type = "Edm.Stream",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.EdmStreamValue getPhoto();
-
- void setPhoto(org.apache.olingo.ext.proxy.api.EdmStreamValue _photo);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Person",
- type = "ODataDemo.Person",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Persons",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person getPerson();
-
- void setPerson(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person _person);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PersonID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getPersonIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Age",
- type = "Edm.Byte")
- org.apache.olingo.ext.proxy.api.Annotatable getAgeAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Gender",
- type = "Edm.Boolean")
- org.apache.olingo.ext.proxy.api.Annotatable getGenderAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Phone",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getPhoneAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Address",
- type = "ODataDemo.Address")
- org.apache.olingo.ext.proxy.api.Annotatable getAddressAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Photo",
- type = "Edm.Stream")
- org.apache.olingo.ext.proxy.api.Annotatable getPhotoAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Person",
- type = "ODataDemo.Person")
- org.apache.olingo.ext.proxy.api.Annotatable getPersonAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonDetailCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonDetailCollection.java
deleted file mode 100644
index d672ffc..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonDetailCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface PersonDetailCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetailCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetailCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetailCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonDetailCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonDetailCollectionComposableInvoker.java
deleted file mode 100644
index e7d62d3..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonDetailCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface PersonDetailCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetailCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetailCollection.Operations> {
-
- @Override
- PersonDetailCollectionComposableInvoker select(String... select);
-
- @Override
- PersonDetailCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonDetailComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonDetailComposableInvoker.java
deleted file mode 100644
index 2d54c16..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/PersonDetailComposableInvoker.java
+++ /dev/null
@@ -1,137 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface PersonDetailComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<PersonDetail, PersonDetail.Operations>
-{
-
- @Override
- PersonDetailComposableInvoker select(String... select);
-
- @Override
- PersonDetailComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getPersonID();
-
- void setPersonID(java.lang.Integer _personID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Age",
- type = "Edm.Byte",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Short getAge();
-
- void setAge(java.lang.Short _age);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Gender",
- type = "Edm.Boolean",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Boolean getGender();
-
- void setGender(java.lang.Boolean _gender);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Phone",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getPhone();
-
- void setPhone(java.lang.String _phone);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
- type = "ODataDemo.Address",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address getAddress();
-
- void setAddress(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address _address);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Photo",
- type = "Edm.Stream",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.EdmStreamValue getPhoto();
-
- void setPhoto(org.apache.olingo.ext.proxy.api.EdmStreamValue _photo);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Person",
- type = "ODataDemo.Person",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Persons",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person getPerson();
-
- void setPerson(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person _person);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Product.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Product.java
deleted file mode 100644
index cb3ff03..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Product.java
+++ /dev/null
@@ -1,231 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.OperationType;
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-import org.apache.olingo.ext.proxy.api.annotations.Parameter;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Product",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface Product
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Product>, org.apache.olingo.ext.proxy.api.StructuredQuery<Product> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getID();
-
- void setID(java.lang.Integer _iD);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Description",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getDescription();
-
- void setDescription(java.lang.String _description);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ReleaseDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getReleaseDate();
-
- void setReleaseDate(java.sql.Timestamp _releaseDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DiscontinuedDate",
- type = "Edm.DateTimeOffset",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getDiscontinuedDate();
-
- void setDiscontinuedDate(java.sql.Timestamp _discontinuedDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Rating",
- type = "Edm.Int16",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Short getRating();
-
- void setRating(java.lang.Short _rating);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Price",
- type = "Edm.Double",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Double getPrice();
-
- void setPrice(java.lang.Double _price);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Categories",
- type = "ODataDemo.Category",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Categories",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection getCategories();
-
- void setCategories(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection _categories);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Supplier",
- type = "ODataDemo.Supplier",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Suppliers",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier getSupplier();
-
- void setSupplier(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier _supplier);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ProductDetail",
- type = "ODataDemo.ProductDetail",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "ProductDetails",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail getProductDetail();
-
- void setProductDetail(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail _productDetail);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "Discount",
- type = OperationType.ACTION,
- referenceType = java.lang.Double.class, returnType = "Edm.Double")
- org.apache.olingo.ext.proxy.api.Invoker<java.lang.Double>
- discount(
- @Parameter(name = "discountPercentage", type = "Edm.Int32", nullable = false) java.lang.Integer discountPercentage
- );
-
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Description",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getDescriptionAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ReleaseDate",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getReleaseDateAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "DiscontinuedDate",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getDiscontinuedDateAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Rating",
- type = "Edm.Int16")
- org.apache.olingo.ext.proxy.api.Annotatable getRatingAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Price",
- type = "Edm.Double")
- org.apache.olingo.ext.proxy.api.Annotatable getPriceAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Categories",
- type = "ODataDemo.Category")
- org.apache.olingo.ext.proxy.api.Annotatable getCategoriesAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Supplier",
- type = "ODataDemo.Supplier")
- org.apache.olingo.ext.proxy.api.Annotatable getSupplierAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "ProductDetail",
- type = "ODataDemo.ProductDetail")
- org.apache.olingo.ext.proxy.api.Annotatable getProductDetailAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductCollection.java
deleted file mode 100644
index b9e6bb4..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface ProductCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductCollectionComposableInvoker.java
deleted file mode 100644
index 3d6bb61..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface ProductCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection.Operations> {
-
- @Override
- ProductCollectionComposableInvoker select(String... select);
-
- @Override
- ProductCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductComposableInvoker.java
deleted file mode 100644
index 9968948..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductComposableInvoker.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface ProductComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Product, Product.Operations>
-{
-
- @Override
- ProductComposableInvoker select(String... select);
-
- @Override
- ProductComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getID();
-
- void setID(java.lang.Integer _iD);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Description",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getDescription();
-
- void setDescription(java.lang.String _description);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ReleaseDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getReleaseDate();
-
- void setReleaseDate(java.sql.Timestamp _releaseDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DiscontinuedDate",
- type = "Edm.DateTimeOffset",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getDiscontinuedDate();
-
- void setDiscontinuedDate(java.sql.Timestamp _discontinuedDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Rating",
- type = "Edm.Int16",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Short getRating();
-
- void setRating(java.lang.Short _rating);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Price",
- type = "Edm.Double",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Double getPrice();
-
- void setPrice(java.lang.Double _price);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Categories",
- type = "ODataDemo.Category",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Categories",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection getCategories();
-
- void setCategories(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.CategoryCollection _categories);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Supplier",
- type = "ODataDemo.Supplier",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Suppliers",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier getSupplier();
-
- void setSupplier(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier _supplier);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ProductDetail",
- type = "ODataDemo.ProductDetail",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "ProductDetails",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail getProductDetail();
-
- void setProductDetail(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail _productDetail);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetail.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetail.java
deleted file mode 100644
index a17e5c3..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetail.java
+++ /dev/null
@@ -1,100 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "ProductDetail",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface ProductDetail
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<ProductDetail>,
- org.apache.olingo.ext.proxy.api.StructuredQuery<ProductDetail> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getProductID();
-
- void setProductID(java.lang.Integer _productID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Details",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getDetails();
-
- void setDetails(java.lang.String _details);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Product",
- type = "ODataDemo.Product",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Products",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product getProduct();
-
- void setProduct(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product _product);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getProductIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Details",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getDetailsAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Product",
- type = "ODataDemo.Product")
- org.apache.olingo.ext.proxy.api.Annotatable getProductAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetailCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetailCollection.java
deleted file mode 100644
index 26e2eb9..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetailCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface ProductDetailCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetailCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetailCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetailCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetailCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetailCollectionComposableInvoker.java
deleted file mode 100644
index bdb8e02..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetailCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface ProductDetailCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetailCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetailCollection.Operations> {
-
- @Override
- ProductDetailCollectionComposableInvoker select(String... select);
-
- @Override
- ProductDetailCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetailComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetailComposableInvoker.java
deleted file mode 100644
index 4f37bbf..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/ProductDetailComposableInvoker.java
+++ /dev/null
@@ -1,77 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface ProductDetailComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<ProductDetail, ProductDetail.Operations>
-{
-
- @Override
- ProductDetailComposableInvoker select(String... select);
-
- @Override
- ProductDetailComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getProductID();
-
- void setProductID(java.lang.Integer _productID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Details",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getDetails();
-
- void setDetails(java.lang.String _details);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Product",
- type = "ODataDemo.Product",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Products",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product getProduct();
-
- void setProduct(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product _product);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Supplier.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Supplier.java
deleted file mode 100644
index b0f608b..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/Supplier.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("ODataDemo")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Supplier",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface Supplier
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Supplier>, org.apache.olingo.ext.proxy.api.StructuredQuery<Supplier> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getID();
-
- void setID(java.lang.Integer _iD);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
- type = "ODataDemo.Address",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address getAddress();
-
- void setAddress(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address _address);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Location",
- type = "Edm.GeographyPoint",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.commons.api.edm.geo.Point getLocation();
-
- void setLocation(org.apache.olingo.commons.api.edm.geo.Point _location);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Concurrency",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getConcurrency();
-
- void setConcurrency(java.lang.Integer _concurrency);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Products",
- type = "ODataDemo.Product",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Products",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection getProducts();
-
- void setProducts(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection _products);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Address",
- type = "ODataDemo.Address")
- org.apache.olingo.ext.proxy.api.Annotatable getAddressAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Location",
- type = "Edm.GeographyPoint")
- org.apache.olingo.ext.proxy.api.Annotatable getLocationAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Concurrency",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getConcurrencyAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Products",
- type = "ODataDemo.Product")
- org.apache.olingo.ext.proxy.api.Annotatable getProductsAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/SupplierCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/SupplierCollection.java
deleted file mode 100644
index 4731216..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/SupplierCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface SupplierCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.SupplierCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.SupplierCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.SupplierCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/SupplierCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/SupplierCollectionComposableInvoker.java
deleted file mode 100644
index 4f42313..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/SupplierCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface SupplierCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.demo.odatademo.types.SupplierCollection, org.apache.olingo.fit.proxy.v4.demo.odatademo.types.SupplierCollection.Operations> {
-
- @Override
- SupplierCollectionComposableInvoker select(String... select);
-
- @Override
- SupplierCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/SupplierComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/SupplierComposableInvoker.java
deleted file mode 100644
index f7c2d3b..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/SupplierComposableInvoker.java
+++ /dev/null
@@ -1,122 +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.fit.proxy.v4.demo.odatademo.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface SupplierComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Supplier, Supplier.Operations>
-{
-
- @Override
- SupplierComposableInvoker select(String... select);
-
- @Override
- SupplierComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getID();
-
- void setID(java.lang.Integer _iD);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
- type = "ODataDemo.Address",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address getAddress();
-
- void setAddress(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address _address);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Location",
- type = "Edm.GeographyPoint",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.commons.api.edm.geo.Point getLocation();
-
- void setLocation(org.apache.olingo.commons.api.edm.geo.Point _location);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Concurrency",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getConcurrency();
-
- void setConcurrency(java.lang.Integer _concurrency);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Products",
- type = "ODataDemo.Product",
- targetSchema = "ODataDemo",
- targetContainer = "DemoService",
- targetEntitySet = "Products",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection getProducts();
-
- void setProducts(org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductCollection _products);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/package-info.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/package-info.java
deleted file mode 100644
index 4b7b2b1..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/odatademo/types/package-info.java
+++ /dev/null
@@ -1,20 +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.fit.proxy.v4.demo.odatademo.types;
-
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java
deleted file mode 100644
index 365e10d..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java
+++ /dev/null
@@ -1,133 +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.fit.proxy.v4.opentype;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.ext.proxy.AbstractService;
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public class Service<C extends EdmEnabledODataClient> extends AbstractService<C> {
-
- // CHECKSTYLE:OFF (Maven checkstyle)
- private static final String COMPRESSED_METADATA =
- "H4sIAAAAAAAAAK1Ya2wUVRS+3d2+n6EVtahIjGgCzFIoUKgWS7c0q9tSu4WQAprbnbvbkXk5c3fZJTyCUX6gRhFfDRGUCCoCGlBCNP5Af4gmxgTQ8Euif4WEREKM+sNz57E7090uM9U/TffsPeee853vnseeuI4qdQ11KVqKwypOTBBOEQU5pXAJUSAy5RKKRjjCS1xWErlMJ7dxMDZIKOYxxVFJFeOHP15y8M870wGEshpa6c1M77hONZygDlvn3u/a0Pj96aMBVBFDITiYpWhBDMyFTXNh01zYNAdCIQyHwmAt3A+Hu+HyZf4uB7UoJVJw46/XJnsu32ABqIBEh2ck2L0Mgg8/aou8t+kAb7hep5Ek0YicIDpFLbFncAaH01QQwzFBp8zLJb69zPY1o52ji9qvBFAghhoYWnGiZQTjiqXeMIo4lLpjqDpDNF1QZIpmmS6KWE6F41QD/e7ss2gXCuqeswlQOM0zSFY9vvfJzYmFlw1IqnUwIGGdma0CBFb5Q8Bp++vrz604+UPvfgOJWQ4kNpjxsCtqY+gOCWcjpb80g1NZpltZ5BxLDteraTjHMpTdc/HeyW/xO0FUEUUhXdhOsipCqGJbiP0FpaWeMYkbUTM02l948afQ2W+2BlA9oAEhgTMmGpBOLMsKBV/HRZbOZgdjBrEKqWqxDoDOgKakVVuxviDP20oocBvJjuZUYsuawTWB5vog11iQiUbRSm+MyXSG+92q4Ey9ac15QS2R05JLkEzLrhArKdGkvD8UjkZIUpCFwhkgRac/UpjgHvvyze/O7wjtNuhQiUXBJBkwoFbGEtHBHHFmnaLFg0JCU3QlSblRwJtbx2jC2fTi1qlENmKxmdNpGGyC5CODAqxGTJVMLwgYgoCv+tpXyCHjTtfrK1bP3XLsjwCqGkOzsF0V8mkYQzWK5XRJTtSMY52wby1g2mScEVLGkWENNDUq5DNXp7ol/gu6w/nmCzvPbrl+z8NmQWfpcGSCoiaDVvC6of4Loo6QH6AbDEGD7rnmA65WtDkG6uqWL3reaNt7zPCtCDQIe7m/sG3bv8dvPtjx6rlXAqgW8iKnRZE96zFUnZaFhMITVr1JEqdFugGLaTsltVCtYkRO0QmKWh3lOCpTkjKeXQE+OK1qJCHY9ewB4L2ewCKxPoR0TeApWljqjSuSBCHmH3mKKOH4SDTC7FObIGZ6KipUeCtNawVNp1aeCK8yWR30I26NIGMtVzo985Ch2xjDU1VnMVV4bmRUkMi6ZFIntKyJWrd6ja1eVik0sD4aKZwfSAt82fOtw2a/5q3LmG+GeiNTNz2N4PKxhtbkKCncyT6VPV8XF1Iy4fNatUwrflu1qoiSBjYV0mB+Lq8Th9Q7dczPZXUq4xOKRgueAQ07lpfVCMIR1/mlS8oDFlPklEtheXGdNTXaKarvTSSUtEyjclKBFuyjTNjl10kqg9NDWHJiYow9ZT2uYXT2pAV+a+gR7zOku8Wy4jQ0/5eG9r/ubg2gyhhqNKcFkENOyrT+OrMxx0n+ULPdht26dbrBAOoodo/6nEjdLt/YN3/ZjY5L6wMoNIZmW+VtyhnoXCLenospmAfz/TKrijz0pqdJlhKZt5v21C6BEIDdEjFN5o3NqP96LOj5jACQLBenrx15e1P0UkMABcfQXYKcENM8icrWdBBREmkJbJTMSHtRo81B3eRtzjDgV8wEePBs29xPDp6OXl5rjD11hZFsGhgp6vQ79XAjyjZ41/C3+MHlBYWheK1ndIemA4WhfajlwOb7Ii/fNOIKqZhOWBFVUaylCHXFFALndNNH0yUBRtuZxBmVeaAhqrH/LROxuzZ542DQELB1ymO68xy0R8ALJ5MPPbV/8d9AwpJM8znSeRxFe4tGzZbPW6/Ef7sFo2jlNKNo7QTWoS4SLLnG0qkzaHAryVG0bPo9hDlSWO+NC54gxuRmLqdzzLwD+VTvK5nLTnVXV/f+I9wlYwJssEDKjZCkBZO5Ahcz3eO8OVwwyG5ru3ron4snf75VvKdMfatQ8AJR3g+/bN8c3Qos3GYEMtV3QCszKE94E80ZVgo/K5FLsMPx7IxkMuGekqE9f1tkCkla/R/KEUtXz67+1Lv7Fp0wdq78GF96vVLkCIF2SigKe9ur11kK7FcYFWsUOprFhdnWT0dUwCJ0O/a8BDnfuB0zuoYe8/eGi8PcMHn+zEtz7u8BRo6hpoTZW/VRo8yWaMRWuS2xpBXnfoYk8sToMgNmthQTvK+H/davGCz/u18+Pv7V8OTR/2s9tG0vUI/M/WDB5KfGqFSZFHFKBxJIRBq3ppoq96rXlIaHoYk5uGDUvaChEu3F+y9Tg8aNLNLjP0YPH8y8hqeN1OfPMqblq28NfTbn5LwzZh93BFSZya+9dhsPjhDYVys6Sr/rU7CODGgE7kMV0+wUp9gCBlbhRIklAvT7FFHRimnqp8Y6zAU7ucVF8n8Bw1KQnkUXAAA=";
- private static final String METADATA_ETAG = null;
- // CHECKSTYLE:ON (Maven checkstyle)
-
- private static final Map<String, Service<?>> SERVICES = new ConcurrentHashMap<String, Service<?>>();
-
- @SuppressWarnings("unchecked")
- private static <C extends EdmEnabledODataClient> Service<C> getInstance(
- final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
-
- if (!SERVICES.containsKey(serviceRoot)) {
- final Service<C> instance = new Service<C>(COMPRESSED_METADATA, METADATA_ETAG,
- version, serviceRoot, transactional);
- SERVICES.put(serviceRoot, instance);
- }
-
- return (Service<C>) SERVICES.get(serviceRoot);
- }
-
- /**
- * Gives an OData 4.0 instance for given service root, operating in transactions (with batch requests).
- *
- * @param serviceRoot OData service root
- * @return OData 4.0 instance for given service root, operating in transactions (with batch requests)
- */
- public static Service<EdmEnabledODataClient> getV4(
- final String serviceRoot) {
-
- return getV4(serviceRoot, true);
- }
-
- /**
- * Gives an OData 4.0 instance for given service root.
- *
- * @param serviceRoot OData service root
- * @param transactional whether operating in transactions (with batch requests) or not
- * @return OData 4.0 instance for given service root
- */
- public static Service<EdmEnabledODataClient> getV4(
- final String serviceRoot, final boolean transactional) {
-
- return getInstance(ODataServiceVersion.V40, serviceRoot, transactional);
- }
-
- private final Map<String, Class<?>> entityTypes = new HashMap<String, Class<?>>();
-
- private final Map<String, Class<?>> complexTypes = new HashMap<String, Class<?>>();
-
- private final Map<String, Class<?>> enumTypes = new HashMap<String, Class<?>>();
-
- private final Map<String, Class<? extends AbstractTerm>> terms = new HashMap<String, Class<? extends AbstractTerm>>();
-
- public Service(final String compressedMetadata, final String metadataETag,
- final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
-
- super(compressedMetadata, metadataETag, version, serviceRoot, transactional);
-
- // CHECKSTYLE:OFF (Maven checkstyle)
- entityTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV4.Row",
- org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row.class);
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.OpenTypesServiceV4.IndexedRow",
- org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.IndexedRow.class);
- entityTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV4.RowIndex",
- org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowIndex.class);
- complexTypes
- .put(
- "Microsoft.Test.OData.Services.OpenTypesServiceV4.AccountInfo",
- org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.AccountInfo.class);
- complexTypes
- .put(
- "Microsoft.Test.OData.Services.OpenTypesServiceV4.ContactDetails",
- org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.ContactDetails.class);
- enumTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV4.Color",
- org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Color.class);
- // CHECKSTYLE:ON (Maven checkstyle)
- }
-
- @Override
- public Class<?> getEntityTypeClass(final String name) {
- return entityTypes.get(name);
- }
-
- @Override
- public Class<?> getComplexTypeClass(final String name) {
- return complexTypes.get(name);
- }
-
- @Override
- public Class<?> getEnumTypeClass(final String name) {
- return enumTypes.get(name);
- }
-
- @Override
- public Class<? extends AbstractTerm> getTermClass(final String name) {
- return terms.get(name);
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/DefaultContainer.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/DefaultContainer.java
deleted file mode 100644
index f96fe46..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/DefaultContainer.java
+++ /dev/null
@@ -1,61 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.io.InputStream;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import java.io.Serializable;
-
-import org.apache.olingo.ext.proxy.api.ComplexCollection;
-import org.apache.olingo.ext.proxy.api.ComplexType;
-import org.apache.olingo.ext.proxy.api.EdmStreamValue;
-import org.apache.olingo.ext.proxy.api.EntityCollection;
-import org.apache.olingo.ext.proxy.api.EntityType;
-import org.apache.olingo.ext.proxy.api.PersistenceManager;
-import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
-@org.apache.olingo.ext.proxy.api.annotations.EntityContainer(name = "DefaultContainer",
- namespace = "Microsoft.Test.OData.Services.OpenTypesServiceV4")
-public interface DefaultContainer extends PersistenceManager {
-
- Row getRow();
-
- RowIndex getRowIndex();
-
- Operations operations();
-
- public interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- <NE extends EntityType<?>> NE newEntityInstance(Class<NE> ref);
-
- <T extends EntityType<?>, NEC extends EntityCollection<T, ?, ?>> NEC newEntityCollection(Class<NEC> ref);
-
- <NE extends ComplexType<?>> NE newComplexInstance(Class<NE> ref);
-
- <T extends ComplexType<?>, NEC extends ComplexCollection<T, ?, ?>> NEC newComplexCollection(Class<NEC> ref);
-
- <T extends Serializable, NEC extends PrimitiveCollection<T>> NEC newPrimitiveCollection(Class<T> ref);
-
- EdmStreamValue newEdmStreamValue(String contentType, InputStream stream);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/Row.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/Row.java
deleted file mode 100644
index a3f0ebe..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/Row.java
+++ /dev/null
@@ -1,39 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Row",
- container = "Microsoft.Test.OData.Services.OpenTypesServiceV4.DefaultContainer")
-public interface Row
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Row>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row, java.util.UUID, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/RowIndex.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/RowIndex.java
deleted file mode 100644
index e2d4cff..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/RowIndex.java
+++ /dev/null
@@ -1,39 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "RowIndex",
- container = "Microsoft.Test.OData.Services.OpenTypesServiceV4.DefaultContainer")
-public interface RowIndex
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowIndex, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowIndexCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<RowIndex>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowIndex, java.lang.Integer, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowIndexCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/package-info.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/package-info.java
deleted file mode 100644
index 2392a86..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/package-info.java
+++ /dev/null
@@ -1,20 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4;
-
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfo.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfo.java
deleted file mode 100644
index 5a73845..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfo.java
+++ /dev/null
@@ -1,84 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-import org.apache.olingo.ext.proxy.api.Annotatable;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
-@org.apache.olingo.ext.proxy.api.annotations.ComplexType(name = "AccountInfo",
- isOpenType = true,
- isAbstract = false)
-public interface AccountInfo
- extends org.apache.olingo.ext.proxy.api.ComplexType<AccountInfo>,
- org.apache.olingo.ext.proxy.api.StructuredQuery<AccountInfo>, AbstractOpenType {
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFirstName();
-
- void setFirstName(java.lang.String _firstName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getLastName();
-
- void setLastName(java.lang.String _lastName);
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FirstName",
- type = "Edm.String")
- Annotatable getFirstNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "LastName",
- type = "Edm.String")
- Annotatable getLastNameAnnotations();
-
- }
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfoCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfoCollection.java
deleted file mode 100644
index caf3355..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfoCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface AccountInfoCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.AccountInfoCollection>,
-org.apache.olingo.ext.proxy.api.ComplexCollection<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.AccountInfo, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.AccountInfoCollection, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.AccountInfoCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfoCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfoCollectionComposableInvoker.java
deleted file mode 100644
index bae485c..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfoCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface AccountInfoCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.AccountInfoCollection, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.AccountInfoCollection.Operations> {
-
- @Override
- AccountInfoCollectionComposableInvoker select(String... select);
-
- @Override
- AccountInfoCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfoComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfoComposableInvoker.java
deleted file mode 100644
index 33e364c..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfoComposableInvoker.java
+++ /dev/null
@@ -1,66 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface AccountInfoComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<AccountInfo, AccountInfo.Operations>
- , AbstractOpenType {
-
- @Override
- AccountInfoComposableInvoker select(String... select);
-
- @Override
- AccountInfoComposableInvoker expand(String... expand);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFirstName();
-
- void setFirstName(java.lang.String _firstName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getLastName();
-
- void setLastName(java.lang.String _lastName);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/Color.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/Color.java
deleted file mode 100644
index 46d8621..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/Color.java
+++ /dev/null
@@ -1,44 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
-@org.apache.olingo.ext.proxy.api.annotations.EnumType(name = "Color",
- underlyingType = EdmPrimitiveTypeKind.Int32,
- isFlags = false)
-public enum Color {
- Red(1),
- Green(2),
- Blue(4);
-
- private java.lang.Integer value;
-
- public java.lang.Integer getValue() {
- return value;
- }
-
- private Color(final java.lang.Integer value) {
- this.value = value;
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetails.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetails.java
deleted file mode 100644
index 5cb1a85..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetails.java
+++ /dev/null
@@ -1,273 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.Annotatable;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
-@org.apache.olingo.ext.proxy.api.annotations.ComplexType(name = "ContactDetails",
- isOpenType = false,
- isAbstract = false)
-public interface ContactDetails
- extends org.apache.olingo.ext.proxy.api.ComplexType<ContactDetails>,
- org.apache.olingo.ext.proxy.api.StructuredQuery<ContactDetails> {
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstContacted",
- type = "Edm.Binary",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- byte[] getFirstContacted();
-
- void setFirstContacted(byte[] _firstContacted);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastContacted",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getLastContacted();
-
- void setLastContacted(java.sql.Timestamp _lastContacted);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Contacted",
- type = "Edm.Date",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.util.Calendar getContacted();
-
- void setContacted(java.util.Calendar _contacted);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "GUID",
- type = "Edm.Guid",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.util.UUID getGUID();
-
- void setGUID(java.util.UUID _gUID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PreferedContactTime",
- type = "Edm.TimeOfDay",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.util.Calendar getPreferedContactTime();
-
- void setPreferedContactTime(java.util.Calendar _preferedContactTime);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Byte",
- type = "Edm.Byte",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Short getByte();
-
- void setByte(java.lang.Short _byte);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "SignedByte",
- type = "Edm.SByte",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Byte getSignedByte();
-
- void setSignedByte(java.lang.Byte _signedByte);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Double",
- type = "Edm.Double",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Double getDouble();
-
- void setDouble(java.lang.Double _double);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Single",
- type = "Edm.Single",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Float getSingle();
-
- void setSingle(java.lang.Float _single);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Short",
- type = "Edm.Int16",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Short getShort();
-
- void setShort(java.lang.Short _short);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Int",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getInt();
-
- void setInt(java.lang.Integer _int);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Long",
- type = "Edm.Int64",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Long getLong();
-
- void setLong(java.lang.Long _long);
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FirstContacted",
- type = "Edm.Binary")
- Annotatable getFirstContactedAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "LastContacted",
- type = "Edm.DateTimeOffset")
- Annotatable getLastContactedAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Contacted",
- type = "Edm.Date")
- Annotatable getContactedAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "GUID",
- type = "Edm.Guid")
- Annotatable getGUIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PreferedContactTime",
- type = "Edm.TimeOfDay")
- Annotatable getPreferedContactTimeAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Byte",
- type = "Edm.Byte")
- Annotatable getByteAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "SignedByte",
- type = "Edm.SByte")
- Annotatable getSignedByteAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Double",
- type = "Edm.Double")
- Annotatable getDoubleAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Single",
- type = "Edm.Single")
- Annotatable getSingleAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Short",
- type = "Edm.Int16")
- Annotatable getShortAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Int",
- type = "Edm.Int32")
- Annotatable getIntAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Long",
- type = "Edm.Int64")
- Annotatable getLongAnnotations();
-
- }
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetailsCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetailsCollection.java
deleted file mode 100644
index faa3e09..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetailsCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface ContactDetailsCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.ContactDetailsCollection>,
-org.apache.olingo.ext.proxy.api.ComplexCollection<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.ContactDetails, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.ContactDetailsCollection, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.ContactDetailsCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetailsCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetailsCollectionComposableInvoker.java
deleted file mode 100644
index 51b942b..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetailsCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface ContactDetailsCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.ContactDetailsCollection, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.ContactDetailsCollection.Operations> {
-
- @Override
- ContactDetailsCollectionComposableInvoker select(String... select);
-
- @Override
- ContactDetailsCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetailsComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetailsComposableInvoker.java
deleted file mode 100644
index 2bbf411..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetailsComposableInvoker.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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface ContactDetailsComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<ContactDetails, ContactDetails.Operations>
-{
-
- @Override
- ContactDetailsComposableInvoker select(String... select);
-
- @Override
- ContactDetailsComposableInvoker expand(String... expand);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstContacted",
- type = "Edm.Binary",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- byte[] getFirstContacted();
-
- void setFirstContacted(byte[] _firstContacted);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastContacted",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getLastContacted();
-
- void setLastContacted(java.sql.Timestamp _lastContacted);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Contacted",
- type = "Edm.Date",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.util.Calendar getContacted();
-
- void setContacted(java.util.Calendar _contacted);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "GUID",
- type = "Edm.Guid",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.util.UUID getGUID();
-
- void setGUID(java.util.UUID _gUID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PreferedContactTime",
- type = "Edm.TimeOfDay",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.util.Calendar getPreferedContactTime();
-
- void setPreferedContactTime(java.util.Calendar _preferedContactTime);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Byte",
- type = "Edm.Byte",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Short getByte();
-
- void setByte(java.lang.Short _byte);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "SignedByte",
- type = "Edm.SByte",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Byte getSignedByte();
-
- void setSignedByte(java.lang.Byte _signedByte);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Double",
- type = "Edm.Double",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Double getDouble();
-
- void setDouble(java.lang.Double _double);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Single",
- type = "Edm.Single",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Float getSingle();
-
- void setSingle(java.lang.Float _single);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Short",
- type = "Edm.Int16",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Short getShort();
-
- void setShort(java.lang.Short _short);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Int",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getInt();
-
- void setInt(java.lang.Integer _int);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Long",
- type = "Edm.Int64",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Long getLong();
-
- void setLong(java.lang.Long _long);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRow.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRow.java
deleted file mode 100644
index 3962c82..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRow.java
+++ /dev/null
@@ -1,93 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.concurrent.Future;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "IndexedRow",
- openType = true,
- hasStream = false,
- isAbstract = false,
- baseType = "Microsoft.Test.OData.Services.OpenTypesServiceV4.Row")
-public interface IndexedRow
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row,
- AbstractOpenType {
-
- @Override
- IndexedRow load();
-
- @Override
- Future<? extends IndexedRow> loadAsync();
-
- @Override
- IndexedRow refs();
-
- @Override
- IndexedRow expand(String... expand);
-
- @Override
- IndexedRow select(String... select);
-
- @Override
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Id",
- type = "Edm.Guid",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.util.UUID getId();
-
- @Override
- void setId(java.util.UUID _id);
-
- @Override
- Operations operations();
-
- interface Operations extends
- org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row.Operations {
- // No additional methods needed for now.
- }
-
- @Override
- Annotations annotations();
-
- interface Annotations extends
- org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row.Annotations {
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Id",
- type = "Edm.Guid")
- org.apache.olingo.ext.proxy.api.Annotatable getIdAnnotations();
-
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRowCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRowCollection.java
deleted file mode 100644
index a9af8e6..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRowCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface IndexedRowCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.IndexedRowCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.IndexedRow, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.IndexedRowCollection, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.IndexedRowCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRowCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRowCollectionComposableInvoker.java
deleted file mode 100644
index 7a7dfaf..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRowCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface IndexedRowCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.IndexedRowCollection, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.IndexedRowCollection.Operations> {
-
- @Override
- IndexedRowCollectionComposableInvoker select(String... select);
-
- @Override
- IndexedRowCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRowComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRowComposableInvoker.java
deleted file mode 100644
index 634afb6..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRowComposableInvoker.java
+++ /dev/null
@@ -1,53 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-public interface IndexedRowComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<IndexedRow, IndexedRow.Operations>
- , AbstractOpenType {
-
- @Override
- IndexedRowComposableInvoker select(String... select);
-
- @Override
- IndexedRowComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Id",
- type = "Edm.Guid",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.util.UUID getId();
-
- void setId(java.util.UUID _id);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/Row.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/Row.java
deleted file mode 100644
index 1511cdc..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/Row.java
+++ /dev/null
@@ -1,68 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Row",
- openType = true,
- hasStream = false,
- isAbstract = false)
-public interface Row
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Row>, org.apache.olingo.ext.proxy.api.StructuredQuery<Row>,
- AbstractOpenType {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Id",
- type = "Edm.Guid",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.util.UUID getId();
-
- void setId(java.util.UUID _id);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Id",
- type = "Edm.Guid")
- org.apache.olingo.ext.proxy.api.Annotatable getIdAnnotations();
-
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowCollection.java
deleted file mode 100644
index 7fc7ff2..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface RowCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowCollection, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowCollectionComposableInvoker.java
deleted file mode 100644
index 8219734..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface RowCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowCollection, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowCollection.Operations> {
-
- @Override
- RowCollectionComposableInvoker select(String... select);
-
- @Override
- RowCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowComposableInvoker.java
deleted file mode 100644
index 1b0e66b..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowComposableInvoker.java
+++ /dev/null
@@ -1,53 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-public interface RowComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Row, Row.Operations>
- , AbstractOpenType {
-
- @Override
- RowComposableInvoker select(String... select);
-
- @Override
- RowComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Id",
- type = "Edm.Guid",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.util.UUID getId();
-
- void setId(java.util.UUID _id);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndex.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndex.java
deleted file mode 100644
index 68e9374..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndex.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "RowIndex",
- openType = true,
- hasStream = false,
- isAbstract = false)
-public interface RowIndex
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<RowIndex>, org.apache.olingo.ext.proxy.api.StructuredQuery<RowIndex>,
- AbstractOpenType {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Id",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getId();
-
- void setId(java.lang.Integer _id);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Rows",
- type = "Microsoft.Test.OData.Services.OpenTypesServiceV4.Row",
- targetSchema = "Microsoft.Test.OData.Services.OpenTypesServiceV4",
- targetContainer = "DefaultContainer",
- targetEntitySet = "Row",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row getRows();
-
- void
- setRows(org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row _rows);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Id",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getIdAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Rows",
- type = "Microsoft.Test.OData.Services.OpenTypesServiceV4.Row")
- org.apache.olingo.ext.proxy.api.Annotatable getRowsAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndexCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndexCollection.java
deleted file mode 100644
index 4b57e8a..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndexCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface RowIndexCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowIndexCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowIndex, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowIndexCollection, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowIndexCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndexCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndexCollectionComposableInvoker.java
deleted file mode 100644
index 0fc3316..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndexCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface RowIndexCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowIndexCollection, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowIndexCollection.Operations> {
-
- @Override
- RowIndexCollectionComposableInvoker select(String... select);
-
- @Override
- RowIndexCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndexComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndexComposableInvoker.java
deleted file mode 100644
index d5852d1..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndexComposableInvoker.java
+++ /dev/null
@@ -1,64 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-public interface RowIndexComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<RowIndex, RowIndex.Operations>
- , AbstractOpenType {
-
- @Override
- RowIndexComposableInvoker select(String... select);
-
- @Override
- RowIndexComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Id",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getId();
-
- void setId(java.lang.Integer _id);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Rows",
- type = "Microsoft.Test.OData.Services.OpenTypesServiceV4.Row",
- targetSchema = "Microsoft.Test.OData.Services.OpenTypesServiceV4",
- targetContainer = "DefaultContainer",
- targetEntitySet = "Row",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row getRows();
-
- void
- setRows(org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row _rows);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/package-info.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/package-info.java
deleted file mode 100644
index bf860c4..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/package-info.java
+++ /dev/null
@@ -1,20 +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.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
-
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java
deleted file mode 100644
index 644cac4..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java
+++ /dev/null
@@ -1,215 +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.fit.proxy.v4.staticservice;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.ext.proxy.AbstractService;
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public class Service<C extends EdmEnabledODataClient> extends AbstractService<C> {
-
- // CHECKSTYLE:OFF (Maven checkstyle)
- private static final String COMPRESSED_METADATA =
- "H4sIAAAAAAAAAMU9fZAkVX09s7Mfs7Mf98V58nVQUcIJN8t9wB23eDi7O7s3YW5v2F0OPNFU78zb3fZmuofunr1ZK0ARS1KFGiHCyRWlGEqJMXfRHNESUpIiETVWKEshlKYIJIYKMZEqjMTEJJb5vff643X3655+Pbt4f1zN9L73+36/3+/93q/fnH1d6jV06aCmL+flplxdQXmtrqjLWr5aV5Bq5quajvKo1si3G/X86v78bUfLR5Ep12RTLjWa9flH/2TvI//9tlZaktq6dH08MIVFw9TlqsnA+trnDh4f/s75z6elVFnKwMC2KV1VBnBjFNwYBTdGwcFDZQwGjQG0sSIMHgfk14ohh2klEzV6bvunn5w5/MIbmIEmSGJPbElgvFgEX/jjbVN/+L5P1gjpgzpaQjpSq8gwpU3lD8qr8ljLVOpjZcUwMZV7halsT45Kdy7svvAHaSldloawtOaRvqoQFPviyWiKmTRelvpXkW4ommpKWyiJdVldHps3dZg/3r5DukvqMWJrE0TBgsciOfRb9958e/XqF4hI+g0A0JANDLYPJHBITAIs7L96/XcPnHuu8ACRxBZGEscpPxhFtixd0JDbU/w/UuaaWNNbMed5rJx8QdflNayh9j3fv+TMt+RP90ipkpQxlA+hdlOSpNSpDP4fJu2LLZN5wjWWxoUf+ejfZb761yfTUg6kASwBMVQaoE5ZVTUTaF2sY3WOMhZzVG6CqjZZA2DOjK61mvbEnPvcgVXVABtqL6w1kf1sFEhTzLVJ0LWsqEg3pevjWczq/rGidyoQk6PQWARZpLYangdLLdXDYq+J9IZDjwlDp9CSoiruGDCK/WJGQYX7+F+c/ptnfidzNzGHXrmuUCMDC8iqcgMZAA6xWjel3UeVqq4Z2pKZXwB5549hM8nb5kW/3jo5bT/A00ZA81mi/6yQ/gtECFj/pR/++OEPPLvnC2mp94TUu6i11FpZGqainEdmRTZXLLIzmGzr82BT1uEbCM+WHfgWs6WrWNimtD+2GuecWdj/3BCfAUvWBddC9736yC3G+FM3k3UdsEDLcdhCk4jQpHYK5D5SqNUKVZCoMacsr5jOmDQZkwbBXhebrootFyzbxefaV4ydaFxGTICzJjKGrtRM6WqetLRGAwY64lpG2tj8XGkKS+mAmDk6JP10fOLhQnr+G2mp74Q0oLbqdSw2sEfwSGWkLpsrprSVcbkl1UTLZGmxqs82dVRVbJ91Odi2UZXryPqSwUuIMWsJ5Nvf1LVaq2o24fO1Qjaer9CZAbVRT3Mp1l5OdlWHMVwvhoEqvoxWUT2IpW3Eljbo3rVlrPzj//zyk/ni7d8Ml7Ylsg4CxTaCP+8MCjfVbK4Dx2/jLorRklrVkWygORiotlBgVRAFYPWmmgkUOwnRQFbXohQ7bFNwXK63EMaRhYQjD1Z53X6eqvCjd0lUJL6RHBZNqa8J3gunGUNzyEAmOAEd5OKM7CEje1w+rfEY/H5BKyYTw3jFsLMyxQ5hAb4VJrV6HREXfaWgbimYXVG4ehW1BpkDI6V9ezvJMznDXNEPWB4BkoqBKcWoQtQJul2HYGd0d7KxfEmkbAZBx1VY2/IyEhPQOpEVlBYRQEBGds6XiPBmBKoRshYmNMMoNmSlHo6wD5G/Y2TbGd4xXpqqc+TsFVnUND5xmxzi/Is1QF6/taASuCY/7BDyu4DK526UcEe2BlpLZxI8r51yF9TFEASxgYwdXavIaw0whJIK0b+FPxlEcEuAfQVyW7lVNyul8MXWb0FKwmLVa6Qcn96volMwi9joFqx0/GVBaaBjS0vAfKjMrUh3o+DS8ovCIoXFEP4gQx5khAoQk+4mB+cABx88cOPO9z/+M5IDbJHtbbOzT4HEQGsikjJwE8SBRQh/C3bQL0vbVHlVWSZDwG3AkjcVZ2sz2PQ+Ea94MMSPfvvOr77/9YuvpBUPJ/ujaQeo0bJmSQpRNlegdkSNXQ3B+TRlag1L88ZNTx1+aNu9j4ck+LHTdCcxtmD/+/yb79xz/9c+kZayTKZ2QupvqUpVqyFc16ALh2Qidh7sz+MEkuSInA6nU+BdwRkiZBKjH3SdI1+2p+mczCRYldCMwYpmmHJ9EnjsOI9O/ATk20e0BgrX/7q5W65vP52ihE/LDaW+NgsCj0/4iJVz/tpop0LPWWSIEZ+znGtJXdIseDFXHevhLRKy04pumLEIYKcNlOWYs9p44xR/M++r5eC1PnvFy0MX/s/bt6al3rI0LNvlCk03I2pMg07Zwqno2PUe79xBA8ipI5PxHe8WLH16SX7jviuufWPP87ekpcwJabvlLXxjIALU5Q+tlTW5BuCLKnYyNfDxv43aJlJrdnXI720lkvmU1KOooelrBCa4eE6Uil8RLTAiwcLedcM3n3vm3PJLaamnLPVRYduOzBEpn7y3cxbRdWKLyE5uA4nudziwbxCD7c1mQ/JbHp7DCfFYHiE0WeXhencCXG6ayMkcI5KaIfJgSKimVbRNANvK+Z889vD7Ss8Pga2ckHYoarXeqqGSahE3pVVJosVdnhcGspe1CdiL2g6kT7y05VB2aueXHjlfemGaVNoG3UJwyJpKuKGFuFxBGuRIQQcc8Pi6NB1bwLNhcsEC/8ymT95+6dTH3ySsZZpuPbbPlPVla13abPVVZB0wOIRSuv5BeE1OtgwTwrwOscL+aEQwzcaYVwH5Mb0GE5wPzvN1oq4IYtHWID+Cfa71UYQ6HxX2834rMLufHPqSVS3Bn9n1yxgGY1MxhUzsmMBVWZOtBw4x44mIoVACUOOLDTxnHTZrtSBzDulzaFVBpxjSrQddkk6hBKBGkO55AHj3ieElVutYb4qztuMXhQuOG8SL+aYX7//uNV//8R0k0m5zXWSx3cQhgpx6lmIfnrjzxwocUOMQvu9oyXVlSUG67QnxeVdU+AbmDsdmziUAohL8sYZ5HF/4XurJsn4BcVgj1q50jWyd7EjAbHp0aTEJOs75z9QaeHmlypPEL55+7TdmXxl5NnTneGs3NEQgHr36wSOHds6epR0IlXXg1AP+2d0zv6/ni7/C4EkEiLP5LiahosKqEWv5vtf0p2eePLWNaHnA1rJlZb2r1kY5dRGmK7WTk/Vk51tNnICiGtC0kIQmyKxh+6pyJYNJPPqL+xfufs/4lTRymuRk8niSxRWF6B3k7JJhma6s1OV3RXEFuBIwRXBJ1r8txKRGSJ8APq6DNK3VYP+ISwITmgY+P2PqdO2l3slRxLZpiAtIx0vILSqBTiaS6cSu6WIN/OdPr/5w/6Nykay7XsVE1lE7kdBlHL861Y1t4rNqjPWew9K3Xs5Lf08X3W3dLLpiHeF09pheMGGnu9gykauN7YOvnfzb7T2vUuZ86r8MwiEJH6WpdrjkAZis1nySx6P389KD1AFTGiJA7ZSAnOJsncR8TK6ADaAFIPok8Bhc91aM3lTWlpdRraTycihnkJ3zQQprxUI3DbQHeSjxE2YHXsGjSQaGD2L8PGW0YBhaVcGpijeOO4mMlUaQp6jGJDIO2QcFd7CoKetmgySVOfeLSNa3brmnVScCruxyfAQVPuO4qcvy+tjCCpo3wRprlRJ28NZHR/I7C6ugS2zu861Fo6orTbzYFhDYH6jLACu6gP8Ha/5st/RNwOpoNV0SR60DEftJ0g0Jj2mB9PSQIDZGRmEii4HdfdJHnvSB/x2P7SynPYU17Hb/9VMz733p3/50lnQSiVUGAlWmAbtuF9zANznVT+EaygwyLdVDwAL6pVHfE+Jv14KonF2jKR0QRmlXEbLO5xhoBH2RA3qvKQ26X8IROd5PuLgG0Av1ujt9xPsgDGVTeB84w1bsTGnY8z0CzbS46CzaJ9aYLhlT2hH2J94ail9Ym7er0Hj5bP/lm7+aOLRjD9kaRpWwYhTSwiqzCateGSztsNDFLeqkTndfF3ZrULnjStPJP0JiV9yaU4eIyyU8WW+TCzlQrLdocDMvXhbGcs2RwaveXMP7zcl1cG4Ylp6sP8PDldZiXan62fZZzIygFbIwx8ryotbSb1FJ7Msx38K5EUxCQzFwQ+p6WHp4QhIRtLeTJ9uFilFu5wH2ON8+t/SbH3jgmv8lHocTlQW7DWJ2SRQCXRCbvrL1B/M/+vnPSOLA7ZLIrsgGPhGXG56OCX97RM9JBEZ4bfgWHxPivppBENyESG8BfbHgfuImsNMD0Tbjd1R7QPUfPDj+wGP558m+cMiujMyhJcY59wTWRuymiIoLEGPb9spn/u/75178ebDN3H/ogc/XKHPWnrTTAcaNXRxgYNIO31Vc/ux9u8/6O2B5jS6aOoUgFEK+MxavQnPMmoBfGMEeTXVKnNutt1xMBbc24ORfVlTn6NdTenyPmMkG2Tx+5pknPnbRZYdB+iekkSo96jUWyMEM5yjXCUecvpngEX7CeO2qcoAAGiDf7TN82wKaHdoE2Ukb3i9AZ1m9HUeVWq2OhOexfSndNuiF4chgHOT9nHdxLIe27Du1vWWk5XHLvvmXL915ev5si7jZbE2B2EsL/TfE7PufQZrRlLE5v2PKnu2pOF4OC2hV1hW8vLwt/Lj+h2R1vN28i/9uE4dmHjrJ+reFFppTu/EmpnhsZq5QOfJeEMdmtwxpvTWw5Uef/dx/3fN7B9P4ZSVKKiy4Te642VZjEen3nn3oktyD//hR8oabJG36F7sxEKhY1uXmylpFUzg9hayd9VNQRseu0jC19hWtXlaB+TT4fw+s3M7K4GnCFRuveyf1ssQ5k4r0Hzcm7komaHY5aO1MluO3QtLzbpNJfpEqcavbwISimys1mc6K03rKzt6Bx00g8xRCKnZqC6c0qgcCbYhAa+luROMbip3hb4ihsHXijhrzbTbWV1+8hjMs6yMKpLSC4rfWJ4wBVNTEU7+E/9IEfDoj4DEcPfRbO3mS4uFnL3KF+ENMtzU0VsLkSD60ZM2sUTfLin/MMsfLa3Ci9aV9X26cv237R7hncVucl35rFfYvoUUCl2mPAGDf1u07DlQwu1zR2a8usqbiYBTJUDLCycnozS2ZZO2wsmB3J9Zqm8UzKjqxSWcaKebEw1lSYYNXPSnC4RBpjYPZastaRTk80Qrw0RnVLQbSadFqPd4XC0OTnT+pqKR4SrAI9lw4VddQCeQmtVWk03H0bYDE9kiARMT0YY/BchwFG5a9jsJ5NOqBEelB/EHe12oTM9gnf7WSuq3QthoGG0NpuhLbd4QO98uII7V1cDuUMcbtsGW4rtyOn1qRuTlrrrDnyk0h57wnXgM5a9JUGByTZoQS16SdP+Qo1AXFpB6QPBzED0kvRpTtBx7YhfRfr3IYhsReqXCZFsGHszVckxXC1VdomSuWt41lA70kaeXo3p/3eFoXOh4dE/cRaCyIWeJI2Prp4vX3KmwMXnZ/Q/B26E7g4ix2tx0LpE8cP2ZrTqi8Q6GT1/ISZOfZ+RVUXyorSyjGboidOErwOrNpUN/h23/bkCKidY6RDse4/bHaFpFYlh+I0d4ukpgWsD6vCRMC/H0uMe0+SSusK4VeAqe3a4tL5NCpnit1uSq8j7SKAHb+LURr/FzfschB95QthrcdckeLbTQjizL+08ANL8p42NiozVvKj2r2WPz45wgM8HbQSdYaGqkQNmXCCol6G6HJOQ521TGR2C/YKF3HwJbjuKYRQUe3UTG6+y0a91RiGbhIXSn4Tr5jesfEjX+RLtI1pnjLwgqP1qxJcHDLmk6dlmCfkw9EdA5q3fTCu0Al9EBEeOn2b8ARDbPJYXsFYD0ndXQx3mInhoavkYE4jLjWvr4VeYJml4M2M1lvLca06r2CMgDI7opmGiBiokvebxH50vcwqZkV21XS6Syw6yGSk2LseshAsd0qJw7aYETWunj9so8eenVC4kiB2ktnIfThcWIy4BT8LSjrLwI36WftsjNbw8zwrrnzAttAJvutHu4YDGbtCwJiJywpfNa+NqMsmZOyHncDI5gg2NAdjNt4F9TExH1T8s2TH6XrR7fil+FXPQ3pcemZTkwPi81NWTq1x7+1ZEX6ONfaBKtcMEePe3Jr9XUwN18kPL6wp4cvtAHbUGOstEF7rJgf4eSFDCQRMTrTYux9PE650KA3O9lzprTWYocjq5Fiu4loBSZ5gejYKRXpYp5vc2DJxtDM1sAkoRJmjnl9ZWOqiGxbJ/E+myeUOj7znTdBnCK+cDL5IrdRMXsl73sxG8t7pF/haVDolHRaV5Bai3k1EDszN6kjXEsTsnLHXIdgdk0hixLkh/s7ur2qLG6rBxjRMEVO38De+CjBYtsV7d+Ik3Lz1Li66Jk8flzs1OWIVq/FdDGegDQh12WVrextoEt0g42z0GIEG3usWLDhnAwwkERWVF+lJL43qZRwV/ZbuP6yjleLIdOcM7hrobKghM4mF3RZNehNS8Ki2s5MFjkLTpIL+D0cXfYxhDzCju9azj5oQgZcMmY0LXbLjDVpDsmGoEi7jCBs8h1Hvuz4rjNRHzShkGtvUGZaSk1IYL3ix+sDnmLoxmommKiIXFxZtH55APfn3f3xLy5+vXLm8+t1caUN+6rmYzv/6KozXya3zvUu1eVloyz1NxDphiawve8NjrRUiJL1NUCw4LtJPGAcIr8mcJRgxJx+8bulRx9Z/QM5lFPBn1KgkF/51OyfX3Tu8ifoRR4MQ75bF/ANWJlZTUWmlLqGaxGZr8AIWNs1GLEndETvrbqCX0VJ8S0fD+kvtlG1RQbxK+R4UBZjsmHtC1oY3dzazXX8jC/zZ1LADi3wPXOoAx8zOsIhMYKPzAQIkMsEUNdLu/k60sU4bAwzXVqIVMAwbnbBd6vK9A32CA5yRZyj6hoMNiL56DtmrpDXP/mcBM5S+I6YPBkmT4aFVjvzNnz9iaf3XbLjG4VLYQ2ckAbxz55oBi7qEAvlX7a/eQaZztnhZPRN3+t73T5l239t/r69RLmZ/whSC7K0rmMfc+7+2Oy+Hm09c+YF75fe0B+D6HXuro5/dft6tTWnwkV2cZMdOea/SQ3Lz/ssXP3DHlCY/m7ug+skm2QaCpMEueWcc9FCMHDbF34naSKOwu69eYEv4Y2/Oj7Rux9RbPkueuDzlamSzpfotGmjKeXcEcHR/rr9qEIUKcFrJPgeq9cwZb2jT2HGJ/BBIW+dhXlhjCb0TopwC7B+KodmG4kq6VE/ldMFPynLMRSqZkuu061puEIGlpUlsyrrNYypiwOpsCCSXdTUljFn/UxB1O7YxzUzNCJ+dvithiHXQTLv/3O81Pr/ToPX93ZbwYxSNnYDzPu64Wyu/4/ueFUmuAQYmkPDve3lOOdOb6UWkzHIUJ0KVpxFfoFyAekNnA5/7NKHzn/6g09dl5YGvb+DJTebMNNY0KydKr3Nwb6e9K380YXgW3C8IjqtJeGIEaglBYstsOfo2Z8P7oH+H4FFEOzTdAAA";
- private static final String METADATA_ETAG = null;
- // CHECKSTYLE:ON (Maven checkstyle)
-
- private static final Map<String, Service<?>> SERVICES = new ConcurrentHashMap<String, Service<?>>();
-
- @SuppressWarnings("unchecked")
- private static <C extends EdmEnabledODataClient> Service<C> getInstance(
- final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
-
- if (!SERVICES.containsKey(serviceRoot)) {
- final Service<C> instance = new Service<C>(COMPRESSED_METADATA, METADATA_ETAG,
- version, serviceRoot, transactional);
- SERVICES.put(serviceRoot, instance);
- }
-
- return (Service<C>) SERVICES.get(serviceRoot);
- }
-
- /**
- * Gives an OData 4.0 instance for given service root, operating in transactions (with batch requests).
- *
- * @param serviceRoot OData service root
- * @return OData 4.0 instance for given service root, operating in transactions (with batch requests)
- */
- public static Service<EdmEnabledODataClient> getV4(
- final String serviceRoot) {
-
- return getV4(serviceRoot, true);
- }
-
- /**
- * Gives an OData 4.0 instance for given service root.
- *
- * @param serviceRoot OData service root
- * @param transactional whether operating in transactions (with batch requests) or not
- * @return OData 4.0 instance for given service root
- */
- public static Service<EdmEnabledODataClient> getV4(
- final String serviceRoot, final boolean transactional) {
-
- return getInstance(ODataServiceVersion.V40, serviceRoot, transactional);
- }
-
- private final Map<String, Class<?>> entityTypes = new HashMap<String, Class<?>>();
-
- private final Map<String, Class<?>> complexTypes = new HashMap<String, Class<?>>();
-
- private final Map<String, Class<?>> enumTypes = new HashMap<String, Class<?>>();
-
- private final Map<String, Class<? extends AbstractTerm>> terms = new HashMap<String, Class<? extends AbstractTerm>>();
-
- public Service(final String compressedMetadata, final String metadataETag,
- final ODataServiceVersion version, final String serviceRoot, final boolean transactional) {
-
- super(compressedMetadata, metadataETag, version, serviceRoot, transactional);
-
- // CHECKSTYLE:OFF (Maven checkstyle)
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPI.class);
- entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Account",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Account.class);
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.ProductDetail",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetail.class);
- entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Order",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order.class);
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.Statement",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Statement.class);
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.Subscription",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Subscription.class);
- entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Person",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person.class);
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.GiftCard",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.GiftCard.class);
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.OrderDetail",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetail.class);
- entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Product",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product.class);
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument.class);
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.Customer",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer.class);
- entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Club",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Club.class);
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.ProductReview",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReview.class);
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.Department",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department.class);
- entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Asset",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Asset.class);
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.Employee",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee.class);
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI.class);
- entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Company",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company.class);
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.CreditRecord",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecord.class);
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.LabourUnion",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnion.class);
- entityTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.PublicCompany",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PublicCompany.class);
- complexTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Address",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address.class);
- complexTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddress.class);
- complexTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.AccountInfo",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfo.class);
- complexTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.HomeAddress",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddress.class);
- enumTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.AccessLevel",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel.class);
- enumTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Color",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color.class);
- enumTypes
- .put(
- "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory.class);
- terms.put("Microsoft.Test.OData.Services.ODataWCFService.IsBoss",
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.IsBoss.class);
- // CHECKSTYLE:ON (Maven checkstyle)
- }
-
- @Override
- public Class<?> getEntityTypeClass(final String name) {
- return entityTypes.get(name);
- }
-
- @Override
- public Class<?> getComplexTypeClass(final String name) {
- return complexTypes.get(name);
- }
-
- @Override
- public Class<?> getEnumTypeClass(final String name) {
- return enumTypes.get(name);
- }
-
- @Override
- public Class<? extends AbstractTerm> getTermClass(final String name) {
- return terms.get(name);
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Accounts.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Accounts.java
deleted file mode 100644
index dbf9837..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Accounts.java
+++ /dev/null
@@ -1,39 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Accounts",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
-public interface Accounts
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Account, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Accounts>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Account, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Customers.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Customers.java
deleted file mode 100644
index e1f3c82..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Customers.java
+++ /dev/null
@@ -1,39 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Customers",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
-public interface Customers
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Customers>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Departments.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Departments.java
deleted file mode 100644
index f7337fc..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Departments.java
+++ /dev/null
@@ -1,39 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Departments",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
-public interface Departments
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Departments>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Employees.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Employees.java
deleted file mode 100644
index 17cf84c..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Employees.java
+++ /dev/null
@@ -1,39 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Employees",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
-public interface Employees
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Employees>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/InMemoryEntities.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/InMemoryEntities.java
deleted file mode 100644
index 95969e2..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/InMemoryEntities.java
+++ /dev/null
@@ -1,214 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.io.InputStream;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import java.io.Serializable;
-
-import org.apache.olingo.ext.proxy.api.ComplexCollection;
-import org.apache.olingo.ext.proxy.api.ComplexType;
-import org.apache.olingo.ext.proxy.api.EdmStreamValue;
-import org.apache.olingo.ext.proxy.api.EntityCollection;
-import org.apache.olingo.ext.proxy.api.EntityType;
-import org.apache.olingo.ext.proxy.api.OperationType;
-import org.apache.olingo.ext.proxy.api.PersistenceManager;
-import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityContainer(name = "InMemoryEntities",
- namespace = "Microsoft.Test.OData.Services.ODataWCFService")
-public interface InMemoryEntities extends PersistenceManager {
-
- Accounts getAccounts();
-
- StoredPIs getStoredPIs();
-
- Customers getCustomers();
-
- Products getProducts();
-
- OrderDetails getOrderDetails();
-
- Departments getDepartments();
-
- Employees getEmployees();
-
- Orders getOrders();
-
- People getPeople();
-
- SubscriptionTemplates getSubscriptionTemplates();
-
- ProductReviews getProductReviews();
-
- ProductDetails getProductDetails();
-
- @org.apache.olingo.ext.proxy.api.annotations.Singleton(
- name = "PublicCompany",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company
- getPublicCompany();
-
- @org.apache.olingo.ext.proxy.api.annotations.Singleton(
- name = "DefaultStoredPI",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI
- getDefaultStoredPI();
-
- @org.apache.olingo.ext.proxy.api.annotations.Singleton(
- name = "VipCustomer",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer
- getVipCustomer();
-
- @org.apache.olingo.ext.proxy.api.annotations.Singleton(
- name = "Company",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company getCompany();
-
- @org.apache.olingo.ext.proxy.api.annotations.Singleton(
- name = "Boss",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person getBoss();
-
- @org.apache.olingo.ext.proxy.api.annotations.Singleton(
- name = "LabourUnion",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnion
- getLabourUnion();
-
- Operations operations();
-
- public interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "GetBossEmails",
- type = OperationType.FUNCTION,
- isComposable = false,
- referenceType = org.apache.olingo.ext.proxy.api.PrimitiveCollection.class,
- returnType = "Collection(Edm.String)")
- org.apache.olingo.ext.proxy.api.PrimitiveCollectionInvoker<org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String>>
- getBossEmails(
- @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "start", type = "Edm.Int32", nullable = false) java.lang.Integer start,
- @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "count", type = "Edm.Int32", nullable = false) java.lang.Integer count
- );
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(
- name = "GetPerson2",
- type = OperationType.FUNCTION,
- isComposable = true,
- referenceType = org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person.class,
- returnType = "Microsoft.Test.OData.Services.ODataWCFService.Person")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonComposableInvoker
- getPerson2(
- @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "city", type = "Edm.String", nullable = false) java.lang.String city
- );
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(
- name = "GetDefaultColor",
- type = OperationType.FUNCTION,
- isComposable = true,
- referenceType = org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color.class,
- returnType = "Microsoft.Test.OData.Services.ODataWCFService.Color")
- org.apache.olingo.ext.proxy.api.Invoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color>
- getDefaultColor(
- );
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(
- name = "GetPerson",
- type = OperationType.FUNCTION,
- isComposable = true,
- referenceType = org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person.class,
- returnType = "Microsoft.Test.OData.Services.ODataWCFService.Person")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonComposableInvoker
- getPerson(
- @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "address",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address", nullable = false) org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address address
- );
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "GetProductsByAccessLevel",
- type = OperationType.FUNCTION,
- isComposable = false,
- referenceType = org.apache.olingo.ext.proxy.api.PrimitiveCollection.class,
- returnType = "Collection(Edm.String)")
- org.apache.olingo.ext.proxy.api.PrimitiveCollectionInvoker<org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String>>
- getProductsByAccessLevel(
- @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "accessLevel",
- type = "Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", nullable = false) org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel accessLevel
- );
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(
- name = "GetAllProducts",
- type = OperationType.FUNCTION,
- isComposable = true,
- referenceType = org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection.class,
- returnType = "Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollectionComposableInvoker
- getAllProducts(
- );
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(
- name = "ResetBossAddress",
- type = OperationType.ACTION,
- referenceType = org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address.class,
- returnType = "Microsoft.Test.OData.Services.ODataWCFService.Address")
- org.apache.olingo.ext.proxy.api.StructuredInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address>
- resetBossAddress(
- @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "address",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address", nullable = false) org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address address
- );
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "ResetDataSource",
- type = OperationType.ACTION)
- org.apache.olingo.ext.proxy.api.Invoker<Void> resetDataSource(
- );
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "Discount",
- type = OperationType.ACTION)
- org.apache.olingo.ext.proxy.api.Invoker<Void> discount(
- @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "percentage", type = "Edm.Int32",
- nullable = false) java.lang.Integer percentage
- );
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "ResetBossEmail",
- type = OperationType.ACTION,
- referenceType = org.apache.olingo.ext.proxy.api.PrimitiveCollection.class,
- returnType = "Collection(Edm.String)")
- org.apache.olingo.ext.proxy.api.PrimitiveCollectionInvoker<org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String>>
- resetBossEmail(
- @org.apache.olingo.ext.proxy.api.annotations.Parameter(name = "emails", type = "Collection(Edm.String)",
- nullable = false) org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> emails
- );
-
- }
-
- <NE extends EntityType<?>> NE newEntityInstance(Class<NE> ref);
-
- <T extends EntityType<?>, NEC extends EntityCollection<T, ?, ?>> NEC newEntityCollection(Class<NEC> ref);
-
- <NE extends ComplexType<?>> NE newComplexInstance(Class<NE> ref);
-
- <T extends ComplexType<?>, NEC extends ComplexCollection<T, ?, ?>> NEC newComplexCollection(Class<NEC> ref);
-
- <T extends Serializable, NEC extends PrimitiveCollection<T>> NEC newPrimitiveCollection(Class<T> ref);
-
- EdmStreamValue newEdmStreamValue(String contentType, InputStream stream);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/OrderDetails.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/OrderDetails.java
deleted file mode 100644
index 0ec3737..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/OrderDetails.java
+++ /dev/null
@@ -1,40 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailKey;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "OrderDetails",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
-public interface OrderDetails
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetail, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<OrderDetails>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetail, OrderDetailKey, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Orders.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Orders.java
deleted file mode 100644
index 93a5f93..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Orders.java
+++ /dev/null
@@ -1,39 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Orders",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
-public interface Orders
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Orders>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/People.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/People.java
deleted file mode 100644
index 5d73060..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/People.java
+++ /dev/null
@@ -1,39 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "People",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
-public interface People
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<People>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/ProductDetails.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/ProductDetails.java
deleted file mode 100644
index 30598fa..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/ProductDetails.java
+++ /dev/null
@@ -1,40 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailKey;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "ProductDetails",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
-public interface ProductDetails
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetail, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ProductDetails>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetail, ProductDetailKey, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/ProductReviews.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/ProductReviews.java
deleted file mode 100644
index a6353de..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/ProductReviews.java
+++ /dev/null
@@ -1,40 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReviewKey;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "ProductReviews",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
-public interface ProductReviews
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReview, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReviewCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ProductReviews>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReview, ProductReviewKey, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReviewCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Products.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Products.java
deleted file mode 100644
index 8381946..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/Products.java
+++ /dev/null
@@ -1,39 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Products",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
-public interface Products
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Products>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/StoredPIs.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/StoredPIs.java
deleted file mode 100644
index 0f57df9..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/StoredPIs.java
+++ /dev/null
@@ -1,39 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "StoredPIs",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
-public interface StoredPIs
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPICollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<StoredPIs>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPICollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/SubscriptionTemplates.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/SubscriptionTemplates.java
deleted file mode 100644
index ca5afce..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/SubscriptionTemplates.java
+++ /dev/null
@@ -1,39 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "SubscriptionTemplates",
- container = "Microsoft.Test.OData.Services.ODataWCFService.InMemoryEntities")
-public interface SubscriptionTemplates
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Subscription, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.SubscriptionCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<SubscriptionTemplates>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Subscription, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.SubscriptionCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/package-info.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/package-info.java
deleted file mode 100644
index f8ea3ce..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/package-info.java
+++ /dev/null
@@ -1,20 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice;
-
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccessLevel.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccessLevel.java
deleted file mode 100644
index 5d527ba..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccessLevel.java
+++ /dev/null
@@ -1,46 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EnumType(name = "AccessLevel",
- underlyingType = EdmPrimitiveTypeKind.Int32,
- isFlags = true)
-public enum AccessLevel {
- None(0),
- Read(1),
- Write(2),
- Execute(4),
- ReadWrite(3);
-
- private java.lang.Integer value;
-
- public java.lang.Integer getValue() {
- return value;
- }
-
- private AccessLevel(final java.lang.Integer value) {
- this.value = value;
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Account.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Account.java
deleted file mode 100644
index ea640be..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Account.java
+++ /dev/null
@@ -1,226 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.OperationType;
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-import org.apache.olingo.ext.proxy.api.annotations.Parameter;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Account",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface Account
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Account>, org.apache.olingo.ext.proxy.api.StructuredQuery<Account> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AccountID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getAccountID();
-
- void setAccountID(java.lang.Integer _accountID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Country",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCountry();
-
- void setCountry(java.lang.String _country);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AccountInfo",
- type = "Microsoft.Test.OData.Services.ODataWCFService.AccountInfo",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfo
- getAccountInfo();
-
- void
- setAccountInfo(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfo _accountInfo);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "MyGiftCard",
- type = "Microsoft.Test.OData.Services.ODataWCFService.GiftCard",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "",
- targetEntitySet = "",
- containsTarget = true)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.GiftCard
- getMyGiftCard();
-
- void
- setMyGiftCard(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.GiftCard _myGiftCard);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "AvailableSubscriptionTemplatess",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Subscription",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "SubscriptionTemplates",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.SubscriptionCollection
- getAvailableSubscriptionTemplatess();
-
- void
- setAvailableSubscriptionTemplatess(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.SubscriptionCollection _availableSubscriptionTemplatess);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(
- name = "GetDefaultPI",
- type = OperationType.FUNCTION,
- isComposable = false,
- referenceType = org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument.class,
- returnType = "Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument")
- org.apache.olingo.ext.proxy.api.StructuredInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument>
- getDefaultPI(
- );
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(
- name = "GetAccountInfo",
- type = OperationType.FUNCTION,
- isComposable = true,
- referenceType = org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfo.class,
- returnType = "Microsoft.Test.OData.Services.ODataWCFService.AccountInfo")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfoComposableInvoker
- getAccountInfo(
- );
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(
- name = "RefreshDefaultPI",
- type = OperationType.ACTION,
- referenceType = org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument.class,
- returnType = "Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument")
- org.apache.olingo.ext.proxy.api.StructuredInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument>
- refreshDefaultPI(
- @Parameter(name = "newDate", type = "Edm.DateTimeOffset", nullable = true) java.sql.Timestamp newDate
- );
-
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "AccountID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getAccountIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Country",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getCountryAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "AccountInfo",
- type = "Microsoft.Test.OData.Services.ODataWCFService.AccountInfo")
- org.apache.olingo.ext.proxy.api.Annotatable getAccountInfoAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "MyGiftCard",
- type = "Microsoft.Test.OData.Services.ODataWCFService.GiftCard")
- org.apache.olingo.ext.proxy.api.Annotatable getMyGiftCardAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "MyPaymentInstruments",
- type = "Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument")
- org.apache.olingo.ext.proxy.api.Annotatable getMyPaymentInstrumentsAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "ActiveSubscriptions",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Subscription")
- org.apache.olingo.ext.proxy.api.Annotatable getActiveSubscriptionsAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(
- name = "AvailableSubscriptionTemplatess",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Subscription")
- org.apache.olingo.ext.proxy.api.Annotatable getAvailableSubscriptionTemplatessAnnotations();
- }
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "MyPaymentInstruments",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Subscription",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "SubscriptionTemplates",
- containsTarget = true)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Account.MyPaymentInstruments
- getMyPaymentInstruments();
-
- void
- setMyPaymentInstruments(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Account.MyPaymentInstruments _myPaymentInstruments);
-
- @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "MyPaymentInstruments", contained = true)
- interface MyPaymentInstruments
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrumentCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<MyPaymentInstruments>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrumentCollection> {
- // No additional methods needed for now.
- }
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ActiveSubscriptions",
- type = "java.lang.Integer",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "SubscriptionTemplates",
- containsTarget = true)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Account.ActiveSubscriptions
- getActiveSubscriptions();
-
- void
- setActiveSubscriptions(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Account.ActiveSubscriptions _activeSubscriptions);
-
- @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "ActiveSubscriptions", contained = true)
- interface ActiveSubscriptions
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Subscription, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.SubscriptionCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ActiveSubscriptions>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Subscription, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.SubscriptionCollection> {
- // No additional methods needed for now.
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountCollection.java
deleted file mode 100644
index 2fcdd6f..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface AccountCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Account, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountCollectionComposableInvoker.java
deleted file mode 100644
index 64928d0..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface AccountCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountCollection.Operations> {
-
- @Override
- AccountCollectionComposableInvoker select(String... select);
-
- @Override
- AccountCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountComposableInvoker.java
deleted file mode 100644
index 6aa8ebd..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountComposableInvoker.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-public interface AccountComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Account, Account.Operations>
-{
-
- @Override
- AccountComposableInvoker select(String... select);
-
- @Override
- AccountComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AccountID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getAccountID();
-
- void setAccountID(java.lang.Integer _accountID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Country",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCountry();
-
- void setCountry(java.lang.String _country);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AccountInfo",
- type = "Microsoft.Test.OData.Services.ODataWCFService.AccountInfo",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfo
- getAccountInfo();
-
- void
- setAccountInfo(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfo _accountInfo);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "MyGiftCard",
- type = "Microsoft.Test.OData.Services.ODataWCFService.GiftCard",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "",
- targetEntitySet = "",
- containsTarget = true)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.GiftCard
- getMyGiftCard();
-
- void
- setMyGiftCard(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.GiftCard _myGiftCard);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "AvailableSubscriptionTemplatess",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Subscription",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "SubscriptionTemplates",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.SubscriptionCollection
- getAvailableSubscriptionTemplatess();
-
- void
- setAvailableSubscriptionTemplatess(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.SubscriptionCollection _availableSubscriptionTemplatess);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "MyPaymentInstruments",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Subscription",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "SubscriptionTemplates",
- containsTarget = true)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Account.MyPaymentInstruments
- getMyPaymentInstruments();
-
- void
- setMyPaymentInstruments(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Account.MyPaymentInstruments _myPaymentInstruments);
-
- @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "MyPaymentInstruments", contained = true)
- interface MyPaymentInstruments
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrumentCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<MyPaymentInstruments>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrumentCollection> {
- // No additional methods needed for now.
- }
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ActiveSubscriptions",
- type = "java.lang.Integer",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "SubscriptionTemplates",
- containsTarget = true)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Account.ActiveSubscriptions
- getActiveSubscriptions();
-
- void
- setActiveSubscriptions(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Account.ActiveSubscriptions _activeSubscriptions);
-
- @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "ActiveSubscriptions", contained = true)
- interface ActiveSubscriptions
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Subscription, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.SubscriptionCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<ActiveSubscriptions>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Subscription, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.SubscriptionCollection> {
- // No additional methods needed for now.
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfo.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfo.java
deleted file mode 100644
index 700d31e..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfo.java
+++ /dev/null
@@ -1,84 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-import org.apache.olingo.ext.proxy.api.Annotatable;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.ComplexType(name = "AccountInfo",
- isOpenType = true,
- isAbstract = false)
-public interface AccountInfo
- extends org.apache.olingo.ext.proxy.api.ComplexType<AccountInfo>,
- org.apache.olingo.ext.proxy.api.StructuredQuery<AccountInfo>, AbstractOpenType {
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFirstName();
-
- void setFirstName(java.lang.String _firstName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getLastName();
-
- void setLastName(java.lang.String _lastName);
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FirstName",
- type = "Edm.String")
- Annotatable getFirstNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "LastName",
- type = "Edm.String")
- Annotatable getLastNameAnnotations();
-
- }
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- //
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoCollection.java
deleted file mode 100644
index 2f19ddb..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface AccountInfoCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfoCollection>,
-org.apache.olingo.ext.proxy.api.ComplexCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfo, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfoCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfoCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoCollectionComposableInvoker.java
deleted file mode 100644
index 895d8e8..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface AccountInfoCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfoCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfoCollection.Operations> {
-
- @Override
- AccountInfoCollectionComposableInvoker select(String... select);
-
- @Override
- AccountInfoCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoComposableInvoker.java
deleted file mode 100644
index 22715ad..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AccountInfoComposableInvoker.java
+++ /dev/null
@@ -1,66 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface AccountInfoComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<AccountInfo, AccountInfo.Operations>
- , AbstractOpenType {
-
- @Override
- AccountInfoComposableInvoker select(String... select);
-
- @Override
- AccountInfoComposableInvoker expand(String... expand);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFirstName();
-
- void setFirstName(java.lang.String _firstName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getLastName();
-
- void setLastName(java.lang.String _lastName);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Address.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Address.java
deleted file mode 100644
index 6928f01..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Address.java
+++ /dev/null
@@ -1,102 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.Annotatable;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.ComplexType(name = "Address",
- isOpenType = false,
- isAbstract = false)
-public interface Address
- extends org.apache.olingo.ext.proxy.api.ComplexType<Address>,
- org.apache.olingo.ext.proxy.api.StructuredQuery<Address> {
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getStreet();
-
- void setStreet(java.lang.String _street);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCity();
-
- void setCity(java.lang.String _city);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PostalCode",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getPostalCode();
-
- void setPostalCode(java.lang.String _postalCode);
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Street",
- type = "Edm.String")
- Annotatable getStreetAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "City",
- type = "Edm.String")
- Annotatable getCityAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PostalCode",
- type = "Edm.String")
- Annotatable getPostalCodeAnnotations();
-
- }
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressCollection.java
deleted file mode 100644
index 8ab50b3..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface AddressCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AddressCollection>,
-org.apache.olingo.ext.proxy.api.ComplexCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AddressCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AddressCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressCollectionComposableInvoker.java
deleted file mode 100644
index 2235721..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface AddressCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AddressCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AddressCollection.Operations> {
-
- @Override
- AddressCollectionComposableInvoker select(String... select);
-
- @Override
- AddressCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressComposableInvoker.java
deleted file mode 100644
index 7df96e8..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AddressComposableInvoker.java
+++ /dev/null
@@ -1,78 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface AddressComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Address, Address.Operations>
-{
-
- @Override
- AddressComposableInvoker select(String... select);
-
- @Override
- AddressComposableInvoker expand(String... expand);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getStreet();
-
- void setStreet(java.lang.String _street);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCity();
-
- void setCity(java.lang.String _city);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PostalCode",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getPostalCode();
-
- void setPostalCode(java.lang.String _postalCode);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Asset.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Asset.java
deleted file mode 100644
index 1bf79ed..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Asset.java
+++ /dev/null
@@ -1,105 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Asset",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface Asset
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Asset>, org.apache.olingo.ext.proxy.api.StructuredQuery<Asset> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AssetID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getAssetID();
-
- void setAssetID(java.lang.Integer _assetID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Number",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getNumber();
-
- void setNumber(java.lang.Integer _number);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "AssetID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getAssetIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Number",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getNumberAnnotations();
-
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetCollection.java
deleted file mode 100644
index 9941a2c..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface AssetCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AssetCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Asset, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AssetCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AssetCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetCollectionComposableInvoker.java
deleted file mode 100644
index bc5e8c7..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface AssetCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AssetCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AssetCollection.Operations> {
-
- @Override
- AssetCollectionComposableInvoker select(String... select);
-
- @Override
- AssetCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetComposableInvoker.java
deleted file mode 100644
index 0a61cd2..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/AssetComposableInvoker.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface AssetComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Asset, Asset.Operations>
-{
-
- @Override
- AssetComposableInvoker select(String... select);
-
- @Override
- AssetComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "AssetID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getAssetID();
-
- void setAssetID(java.lang.Integer _assetID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Number",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getNumber();
-
- void setNumber(java.lang.Integer _number);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Club.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Club.java
deleted file mode 100644
index 5bdb8f4..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Club.java
+++ /dev/null
@@ -1,86 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Club",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface Club
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Club>, org.apache.olingo.ext.proxy.api.StructuredQuery<Club> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ClubID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getClubID();
-
- void setClubID(java.lang.Integer _clubID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ClubID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getClubIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
-
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubCollection.java
deleted file mode 100644
index 5d7c7e1..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface ClubCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ClubCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Club, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ClubCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ClubCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubCollectionComposableInvoker.java
deleted file mode 100644
index 5199212..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface ClubCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ClubCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ClubCollection.Operations> {
-
- @Override
- ClubCollectionComposableInvoker select(String... select);
-
- @Override
- ClubCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubComposableInvoker.java
deleted file mode 100644
index ee6852f..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ClubComposableInvoker.java
+++ /dev/null
@@ -1,67 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface ClubComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Club, Club.Operations>
-{
-
- @Override
- ClubComposableInvoker select(String... select);
-
- @Override
- ClubComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ClubID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getClubID();
-
- void setClubID(java.lang.Integer _clubID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Color.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Color.java
deleted file mode 100644
index 89276bc..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Color.java
+++ /dev/null
@@ -1,44 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EnumType(name = "Color",
- underlyingType = EdmPrimitiveTypeKind.Int32,
- isFlags = false)
-public enum Color {
- Red(1),
- Green(2),
- Blue(4);
-
- private java.lang.Integer value;
-
- public java.lang.Integer getValue() {
- return value;
- }
-
- private Color(final java.lang.Integer value) {
- this.value = value;
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Company.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Company.java
deleted file mode 100644
index c56d105..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Company.java
+++ /dev/null
@@ -1,232 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-import org.apache.olingo.ext.proxy.api.OperationType;
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-import org.apache.olingo.ext.proxy.api.annotations.Parameter;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Company",
- openType = true,
- hasStream = false,
- isAbstract = false)
-public interface Company
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Company>, org.apache.olingo.ext.proxy.api.StructuredQuery<Company>,
- AbstractOpenType {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getCompanyID();
-
- void setCompanyID(java.lang.Integer _companyID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyCategory",
- type = "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory
- getCompanyCategory();
-
- void
- setCompanyCategory(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory _companyCategory);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Revenue",
- type = "Edm.Int64",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Long getRevenue();
-
- void setRevenue(java.lang.Long _revenue);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address getAddress();
-
- void
- setAddress(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address _address);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Employees",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Employee",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Employees",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection
- getEmployees();
-
- void
- setEmployees(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection _employees);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "VipCustomer",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Customer",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "VipCustomer",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer
- getVipCustomer();
-
- void
- setVipCustomer(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer _vipCustomer);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Departments",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Departments",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection
- getDepartments();
-
- void
- setDepartments(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection _departments);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CoreDepartment",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Departments",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department
- getCoreDepartment();
-
- void
- setCoreDepartment(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department _coreDepartment);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "GetEmployeesCount",
- type = OperationType.FUNCTION,
- isComposable = false,
- referenceType = java.lang.Integer.class, returnType = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Invoker<java.lang.Integer> getEmployeesCount(
- );
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "IncreaseRevenue",
- type = OperationType.ACTION,
- referenceType = java.lang.Long.class, returnType = "Edm.Int64")
- org.apache.olingo.ext.proxy.api.Invoker<java.lang.Long> increaseRevenue(
- @Parameter(name = "IncreaseValue", type = "Edm.Int64", nullable = true) java.lang.Long increaseValue
- );
-
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CompanyID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getCompanyIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CompanyCategory",
- type = "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory")
- org.apache.olingo.ext.proxy.api.Annotatable getCompanyCategoryAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Revenue",
- type = "Edm.Int64")
- org.apache.olingo.ext.proxy.api.Annotatable getRevenueAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Address",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address")
- org.apache.olingo.ext.proxy.api.Annotatable getAddressAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Employees",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Employee")
- org.apache.olingo.ext.proxy.api.Annotatable getEmployeesAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "VipCustomer",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Customer")
- org.apache.olingo.ext.proxy.api.Annotatable getVipCustomerAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Departments",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Department")
- org.apache.olingo.ext.proxy.api.Annotatable getDepartmentsAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "CoreDepartment",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Department")
- org.apache.olingo.ext.proxy.api.Annotatable getCoreDepartmentAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddress.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddress.java
deleted file mode 100644
index b9ff18e..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddress.java
+++ /dev/null
@@ -1,136 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.Annotatable;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.ComplexType(name = "CompanyAddress",
- isOpenType = false,
- isAbstract = false,
- baseType = "Microsoft.Test.OData.Services.ODataWCFService.Address")
-public interface CompanyAddress
- extends org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address {
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getStreet();
-
- @Override
- void setStreet(java.lang.String _street);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCity();
-
- @Override
- void setCity(java.lang.String _city);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PostalCode",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getPostalCode();
-
- @Override
- void setPostalCode(java.lang.String _postalCode);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCompanyName();
-
- void setCompanyName(java.lang.String _companyName);
-
- @Override
- Annotations annotations();
-
- interface Annotations
- extends
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address.Annotations {
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Street",
- type = "Edm.String")
- Annotatable getStreetAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "City",
- type = "Edm.String")
- Annotatable getCityAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PostalCode",
- type = "Edm.String")
- Annotatable getPostalCodeAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CompanyName",
- type = "Edm.String")
- Annotatable getCompanyNameAnnotations();
-
- }
-
- @Override
- Operations operations();
-
- interface Operations
- extends
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressCollection.java
deleted file mode 100644
index 4e9398d..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface CompanyAddressCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddressCollection>,
-org.apache.olingo.ext.proxy.api.ComplexCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddress, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddressCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddressCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressCollectionComposableInvoker.java
deleted file mode 100644
index 4b64b4a..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface CompanyAddressCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddressCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddressCollection.Operations> {
-
- @Override
- CompanyAddressCollectionComposableInvoker select(String... select);
-
- @Override
- CompanyAddressCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressComposableInvoker.java
deleted file mode 100644
index d416150..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyAddressComposableInvoker.java
+++ /dev/null
@@ -1,93 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface CompanyAddressComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<CompanyAddress, CompanyAddress.Operations>
-{
-
- @Override
- CompanyAddressComposableInvoker select(String... select);
-
- @Override
- CompanyAddressComposableInvoker expand(String... expand);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getStreet();
-
- void setStreet(java.lang.String _street);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCity();
-
- void setCity(java.lang.String _city);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PostalCode",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getPostalCode();
-
- void setPostalCode(java.lang.String _postalCode);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCompanyName();
-
- void setCompanyName(java.lang.String _companyName);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCategory.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCategory.java
deleted file mode 100644
index 10ee926..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCategory.java
+++ /dev/null
@@ -1,45 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EnumType(name = "CompanyCategory",
- underlyingType = EdmPrimitiveTypeKind.Int32,
- isFlags = false)
-public enum CompanyCategory {
- IT(0),
- Communication(1),
- Electronics(2),
- Others(4);
-
- private java.lang.Integer value;
-
- public java.lang.Integer getValue() {
- return value;
- }
-
- private CompanyCategory(final java.lang.Integer value) {
- this.value = value;
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCollection.java
deleted file mode 100644
index 6fdc15c..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface CompanyCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCollectionComposableInvoker.java
deleted file mode 100644
index 575c61a..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface CompanyCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCollection.Operations> {
-
- @Override
- CompanyCollectionComposableInvoker select(String... select);
-
- @Override
- CompanyCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyComposableInvoker.java
deleted file mode 100644
index 11697fd..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CompanyComposableInvoker.java
+++ /dev/null
@@ -1,170 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-public interface CompanyComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Company, Company.Operations>
- , AbstractOpenType {
-
- @Override
- CompanyComposableInvoker select(String... select);
-
- @Override
- CompanyComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getCompanyID();
-
- void setCompanyID(java.lang.Integer _companyID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyCategory",
- type = "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory
- getCompanyCategory();
-
- void
- setCompanyCategory(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory _companyCategory);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Revenue",
- type = "Edm.Int64",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Long getRevenue();
-
- void setRevenue(java.lang.Long _revenue);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address getAddress();
-
- void
- setAddress(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address _address);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Employees",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Employee",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Employees",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection
- getEmployees();
-
- void
- setEmployees(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection _employees);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "VipCustomer",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Customer",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "VipCustomer",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer
- getVipCustomer();
-
- void
- setVipCustomer(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer _vipCustomer);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Departments",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Departments",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection
- getDepartments();
-
- void
- setDepartments(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection _departments);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CoreDepartment",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Departments",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department
- getCoreDepartment();
-
- void
- setCoreDepartment(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department _coreDepartment);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPI.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPI.java
deleted file mode 100644
index 7f0ee90..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPI.java
+++ /dev/null
@@ -1,303 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.concurrent.Future;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "CreditCardPI",
- openType = false,
- hasStream = false,
- isAbstract = false,
- baseType = "Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument")
-public interface CreditCardPI
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument {
-
- @Override
- CreditCardPI load();
-
- @Override
- Future<? extends CreditCardPI> loadAsync();
-
- @Override
- CreditCardPI refs();
-
- @Override
- CreditCardPI expand(String... expand);
-
- @Override
- CreditCardPI select(String... select);
-
- @Override
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PaymentInstrumentID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getPaymentInstrumentID();
-
- @Override
- void setPaymentInstrumentID(java.lang.Integer _paymentInstrumentID);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FriendlyName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFriendlyName();
-
- @Override
- void setFriendlyName(java.lang.String _friendlyName);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getCreatedDate();
-
- @Override
- void setCreatedDate(java.sql.Timestamp _createdDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CardNumber",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCardNumber();
-
- void setCardNumber(java.lang.String _cardNumber);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CVV",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCVV();
-
- void setCVV(java.lang.String _cVV);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HolderName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getHolderName();
-
- void setHolderName(java.lang.String _holderName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Balance",
- type = "Edm.Double",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Double getBalance();
-
- void setBalance(java.lang.Double _balance);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ExperationDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getExperationDate();
-
- void setExperationDate(java.sql.Timestamp _experationDate);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "TheStoredPI",
- type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "StoredPIs",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI
- getTheStoredPI();
-
- @Override
- void
- setTheStoredPI(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI _theStoredPI);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "BackupStoredPI",
- type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "StoredPIs",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI
- getBackupStoredPI();
-
- @Override
- void
- setBackupStoredPI(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI _backupStoredPI);
-
- @Override
- Operations operations();
-
- interface Operations
- extends
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument.Operations {
- // No additional methods needed for now.
- }
-
- @Override
- Annotations annotations();
-
- interface Annotations
- extends
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument.Annotations {
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PaymentInstrumentID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getPaymentInstrumentIDAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FriendlyName",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getFriendlyNameAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CreatedDate",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getCreatedDateAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CardNumber",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getCardNumberAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CVV",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getCVVAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "HolderName",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getHolderNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Balance",
- type = "Edm.Double")
- org.apache.olingo.ext.proxy.api.Annotatable getBalanceAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ExperationDate",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getExperationDateAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "TheStoredPI",
- type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI")
- org.apache.olingo.ext.proxy.api.Annotatable getTheStoredPIAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "BillingStatements",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Statement")
- org.apache.olingo.ext.proxy.api.Annotatable getBillingStatementsAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "BackupStoredPI",
- type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI")
- org.apache.olingo.ext.proxy.api.Annotatable getBackupStoredPIAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "CreditRecords",
- type = "Microsoft.Test.OData.Services.ODataWCFService.CreditRecord")
- org.apache.olingo.ext.proxy.api.Annotatable getCreditRecordsAnnotations();
- }
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CreditRecords",
- type = "Microsoft.Test.OData.Services.ODataWCFService.CreditRecord",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "",
- targetEntitySet = "",
- containsTarget = true)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPI.CreditRecords
- getCreditRecords();
-
- void
- setCreditRecords(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPI.CreditRecords _creditRecords);
-
- @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "CreditRecords", contained = true)
- interface CreditRecords
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecord, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecordCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<CreditRecords>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecord, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecordCollection> {
- // No additional methods needed for now.
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPICollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPICollection.java
deleted file mode 100644
index 2115db5..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPICollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface CreditCardPICollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPICollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPI, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPICollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPICollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPICollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPICollectionComposableInvoker.java
deleted file mode 100644
index 53278d1..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPICollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface CreditCardPICollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPICollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPICollection.Operations> {
-
- @Override
- CreditCardPICollectionComposableInvoker select(String... select);
-
- @Override
- CreditCardPICollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPIComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPIComposableInvoker.java
deleted file mode 100644
index 908763b..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditCardPIComposableInvoker.java
+++ /dev/null
@@ -1,206 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-public interface CreditCardPIComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<CreditCardPI, CreditCardPI.Operations>
-{
-
- @Override
- CreditCardPIComposableInvoker select(String... select);
-
- @Override
- CreditCardPIComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PaymentInstrumentID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getPaymentInstrumentID();
-
- void setPaymentInstrumentID(java.lang.Integer _paymentInstrumentID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FriendlyName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFriendlyName();
-
- void setFriendlyName(java.lang.String _friendlyName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getCreatedDate();
-
- void setCreatedDate(java.sql.Timestamp _createdDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CardNumber",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCardNumber();
-
- void setCardNumber(java.lang.String _cardNumber);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CVV",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCVV();
-
- void setCVV(java.lang.String _cVV);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HolderName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getHolderName();
-
- void setHolderName(java.lang.String _holderName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Balance",
- type = "Edm.Double",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Double getBalance();
-
- void setBalance(java.lang.Double _balance);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ExperationDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getExperationDate();
-
- void setExperationDate(java.sql.Timestamp _experationDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "TheStoredPI",
- type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "StoredPIs",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI
- getTheStoredPI();
-
- void
- setTheStoredPI(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI _theStoredPI);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "BackupStoredPI",
- type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "StoredPIs",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI
- getBackupStoredPI();
-
- void
- setBackupStoredPI(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI _backupStoredPI);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CreditRecords",
- type = "Microsoft.Test.OData.Services.ODataWCFService.CreditRecord",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "",
- targetEntitySet = "",
- containsTarget = true)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPI.CreditRecords
- getCreditRecords();
-
- void
- setCreditRecords(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPI.CreditRecords _creditRecords);
-
- @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "CreditRecords", contained = true)
- interface CreditRecords
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecord, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecordCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<CreditRecords>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecord, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecordCollection> {
- // No additional methods needed for now.
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecord.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecord.java
deleted file mode 100644
index 9821a49..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecord.java
+++ /dev/null
@@ -1,125 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "CreditRecord",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface CreditRecord
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<CreditRecord>,
- org.apache.olingo.ext.proxy.api.StructuredQuery<CreditRecord> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreditRecordID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getCreditRecordID();
-
- void setCreditRecordID(java.lang.Integer _creditRecordID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "IsGood",
- type = "Edm.Boolean",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Boolean getIsGood();
-
- void setIsGood(java.lang.Boolean _isGood);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Reason",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getReason();
-
- void setReason(java.lang.String _reason);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getCreatedDate();
-
- void setCreatedDate(java.sql.Timestamp _createdDate);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CreditRecordID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getCreditRecordIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "IsGood",
- type = "Edm.Boolean")
- org.apache.olingo.ext.proxy.api.Annotatable getIsGoodAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Reason",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getReasonAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CreatedDate",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getCreatedDateAnnotations();
-
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordCollection.java
deleted file mode 100644
index 6ce50c0..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface CreditRecordCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecordCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecord, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecordCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecordCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordCollectionComposableInvoker.java
deleted file mode 100644
index bdc36fb..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface CreditRecordCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecordCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecordCollection.Operations> {
-
- @Override
- CreditRecordCollectionComposableInvoker select(String... select);
-
- @Override
- CreditRecordCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordComposableInvoker.java
deleted file mode 100644
index 85ef555..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CreditRecordComposableInvoker.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface CreditRecordComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<CreditRecord, CreditRecord.Operations>
-{
-
- @Override
- CreditRecordComposableInvoker select(String... select);
-
- @Override
- CreditRecordComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreditRecordID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getCreditRecordID();
-
- void setCreditRecordID(java.lang.Integer _creditRecordID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "IsGood",
- type = "Edm.Boolean",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Boolean getIsGood();
-
- void setIsGood(java.lang.Boolean _isGood);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Reason",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getReason();
-
- void setReason(java.lang.String _reason);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getCreatedDate();
-
- void setCreatedDate(java.sql.Timestamp _createdDate);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Customer.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Customer.java
deleted file mode 100644
index be254e4..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Customer.java
+++ /dev/null
@@ -1,357 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.concurrent.Future;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Customer",
- openType = false,
- hasStream = false,
- isAbstract = false,
- baseType = "Microsoft.Test.OData.Services.ODataWCFService.Person")
-public interface Customer
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person {
-
- @Override
- Customer load();
-
- @Override
- Future<? extends Customer> loadAsync();
-
- @Override
- Customer refs();
-
- @Override
- Customer expand(String... expand);
-
- @Override
- Customer select(String... select);
-
- @Override
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getPersonID();
-
- @Override
- void setPersonID(java.lang.Integer _personID);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFirstName();
-
- @Override
- void setFirstName(java.lang.String _firstName);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getLastName();
-
- @Override
- void setLastName(java.lang.String _lastName);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "MiddleName",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getMiddleName();
-
- @Override
- void setMiddleName(java.lang.String _middleName);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HomeAddress",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address
- getHomeAddress();
-
- @Override
- void
- setHomeAddress(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address _homeAddress);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Home",
- type = "Edm.GeographyPoint",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.commons.api.edm.geo.Point getHome();
-
- @Override
- void setHome(org.apache.olingo.commons.api.edm.geo.Point _home);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Numbers",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getNumbers();
-
- @Override
- void setNumbers(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _numbers);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Emails",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getEmails();
-
- @Override
- void setEmails(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _emails);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCity();
-
- void setCity(java.lang.String _city);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Birthday",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getBirthday();
-
- void setBirthday(java.sql.Timestamp _birthday);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TimeBetweenLastTwoOrders",
- type = "Edm.Duration",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.math.BigDecimal getTimeBetweenLastTwoOrders();
-
- void setTimeBetweenLastTwoOrders(java.math.BigDecimal _timeBetweenLastTwoOrders);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Parent",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Person",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "People",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person getParent();
-
- @Override
- void setParent(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person _parent);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Orders",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Order",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Orders",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection
- getOrders();
-
- void
- setOrders(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection _orders);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Company",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Company",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Company",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company getCompany();
-
- void
- setCompany(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company _company);
-
- @Override
- Operations operations();
-
- interface Operations
- extends
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person.Operations {
- // No additional methods needed for now.
- }
-
- @Override
- Annotations annotations();
-
- interface Annotations
- extends
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person.Annotations {
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PersonID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getPersonIDAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FirstName",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getFirstNameAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "LastName",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getLastNameAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "MiddleName",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getMiddleNameAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "HomeAddress",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address")
- org.apache.olingo.ext.proxy.api.Annotatable getHomeAddressAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Home",
- type = "Edm.GeographyPoint")
- org.apache.olingo.ext.proxy.api.Annotatable getHomeAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Numbers",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNumbersAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Emails",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getEmailsAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "City",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getCityAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Birthday",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getBirthdayAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "TimeBetweenLastTwoOrders",
- type = "Edm.Duration")
- org.apache.olingo.ext.proxy.api.Annotatable getTimeBetweenLastTwoOrdersAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Parent",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Person")
- org.apache.olingo.ext.proxy.api.Annotatable getParentAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Orders",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Order")
- org.apache.olingo.ext.proxy.api.Annotatable getOrdersAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Company",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Company")
- org.apache.olingo.ext.proxy.api.Annotatable getCompanyAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerCollection.java
deleted file mode 100644
index e358eed..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface CustomerCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerCollectionComposableInvoker.java
deleted file mode 100644
index 1a7ba5c..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface CustomerCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CustomerCollection.Operations> {
-
- @Override
- CustomerCollectionComposableInvoker select(String... select);
-
- @Override
- CustomerCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerComposableInvoker.java
deleted file mode 100644
index 7525933..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/CustomerComposableInvoker.java
+++ /dev/null
@@ -1,241 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface CustomerComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Customer, Customer.Operations>
-{
-
- @Override
- CustomerComposableInvoker select(String... select);
-
- @Override
- CustomerComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getPersonID();
-
- void setPersonID(java.lang.Integer _personID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFirstName();
-
- void setFirstName(java.lang.String _firstName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getLastName();
-
- void setLastName(java.lang.String _lastName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "MiddleName",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getMiddleName();
-
- void setMiddleName(java.lang.String _middleName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HomeAddress",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address
- getHomeAddress();
-
- void
- setHomeAddress(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address _homeAddress);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Home",
- type = "Edm.GeographyPoint",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.commons.api.edm.geo.Point getHome();
-
- void setHome(org.apache.olingo.commons.api.edm.geo.Point _home);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Numbers",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getNumbers();
-
- void setNumbers(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _numbers);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Emails",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getEmails();
-
- void setEmails(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _emails);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCity();
-
- void setCity(java.lang.String _city);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Birthday",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getBirthday();
-
- void setBirthday(java.sql.Timestamp _birthday);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TimeBetweenLastTwoOrders",
- type = "Edm.Duration",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.math.BigDecimal getTimeBetweenLastTwoOrders();
-
- void setTimeBetweenLastTwoOrders(java.math.BigDecimal _timeBetweenLastTwoOrders);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Parent",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Person",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "People",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person getParent();
-
- void setParent(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person _parent);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Orders",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Order",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Orders",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection
- getOrders();
-
- void
- setOrders(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection _orders);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Company",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Company",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Company",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company getCompany();
-
- void
- setCompany(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company _company);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Department.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Department.java
deleted file mode 100644
index 7bd8869..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Department.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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Department",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface Department
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Department>, org.apache.olingo.ext.proxy.api.StructuredQuery<Department> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DepartmentID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getDepartmentID();
-
- void setDepartmentID(java.lang.Integer _departmentID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DepartmentNO",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getDepartmentNO();
-
- void setDepartmentNO(java.lang.String _departmentNO);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Company",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Company",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Company",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company getCompany();
-
- void
- setCompany(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company _company);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "DepartmentID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getDepartmentIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "DepartmentNO",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getDepartmentNOAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Company",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Company")
- org.apache.olingo.ext.proxy.api.Annotatable getCompanyAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentCollection.java
deleted file mode 100644
index 16a8183..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface DepartmentCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentCollectionComposableInvoker.java
deleted file mode 100644
index 88103be..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface DepartmentCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection.Operations> {
-
- @Override
- DepartmentCollectionComposableInvoker select(String... select);
-
- @Override
- DepartmentCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentComposableInvoker.java
deleted file mode 100644
index 08427f4..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/DepartmentComposableInvoker.java
+++ /dev/null
@@ -1,94 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface DepartmentComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Department, Department.Operations>
-{
-
- @Override
- DepartmentComposableInvoker select(String... select);
-
- @Override
- DepartmentComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DepartmentID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getDepartmentID();
-
- void setDepartmentID(java.lang.Integer _departmentID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DepartmentNO",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getDepartmentNO();
-
- void setDepartmentNO(java.lang.String _departmentNO);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Company",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Company",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Company",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company getCompany();
-
- void
- setCompany(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company _company);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Employee.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Employee.java
deleted file mode 100644
index f65a9e5..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Employee.java
+++ /dev/null
@@ -1,321 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.concurrent.Future;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Employee",
- openType = false,
- hasStream = false,
- isAbstract = false,
- baseType = "Microsoft.Test.OData.Services.ODataWCFService.Person")
-public interface Employee
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person {
-
- @Override
- Employee load();
-
- @Override
- Future<? extends Employee> loadAsync();
-
- @Override
- Employee refs();
-
- @Override
- Employee expand(String... expand);
-
- @Override
- Employee select(String... select);
-
- @Override
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getPersonID();
-
- @Override
- void setPersonID(java.lang.Integer _personID);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFirstName();
-
- @Override
- void setFirstName(java.lang.String _firstName);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getLastName();
-
- @Override
- void setLastName(java.lang.String _lastName);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "MiddleName",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getMiddleName();
-
- @Override
- void setMiddleName(java.lang.String _middleName);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HomeAddress",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address
- getHomeAddress();
-
- @Override
- void
- setHomeAddress(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address _homeAddress);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Home",
- type = "Edm.GeographyPoint",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.commons.api.edm.geo.Point getHome();
-
- @Override
- void setHome(org.apache.olingo.commons.api.edm.geo.Point _home);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Numbers",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getNumbers();
-
- @Override
- void setNumbers(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _numbers);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Emails",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getEmails();
-
- @Override
- void setEmails(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _emails);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DateHired",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getDateHired();
-
- void setDateHired(java.sql.Timestamp _dateHired);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Office",
- type = "Edm.GeographyPoint",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.commons.api.edm.geo.Point getOffice();
-
- void setOffice(org.apache.olingo.commons.api.edm.geo.Point _office);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Parent",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Person",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "People",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person getParent();
-
- @Override
- void setParent(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person _parent);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Company",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Company",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Company",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company getCompany();
-
- void
- setCompany(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company _company);
-
- @Override
- Operations operations();
-
- interface Operations
- extends
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person.Operations {
- // No additional methods needed for now.
- }
-
- @Override
- Annotations annotations();
-
- interface Annotations
- extends
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person.Annotations {
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PersonID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getPersonIDAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FirstName",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getFirstNameAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "LastName",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getLastNameAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "MiddleName",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getMiddleNameAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "HomeAddress",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address")
- org.apache.olingo.ext.proxy.api.Annotatable getHomeAddressAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Home",
- type = "Edm.GeographyPoint")
- org.apache.olingo.ext.proxy.api.Annotatable getHomeAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Numbers",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNumbersAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Emails",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getEmailsAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "DateHired",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getDateHiredAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Office",
- type = "Edm.GeographyPoint")
- org.apache.olingo.ext.proxy.api.Annotatable getOfficeAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Parent",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Person")
- org.apache.olingo.ext.proxy.api.Annotatable getParentAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Company",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Company")
- org.apache.olingo.ext.proxy.api.Annotatable getCompanyAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeCollection.java
deleted file mode 100644
index b9bf519..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface EmployeeCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeCollectionComposableInvoker.java
deleted file mode 100644
index d5556eb..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface EmployeeCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection.Operations> {
-
- @Override
- EmployeeCollectionComposableInvoker select(String... select);
-
- @Override
- EmployeeCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeComposableInvoker.java
deleted file mode 100644
index 2516340..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/EmployeeComposableInvoker.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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface EmployeeComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Employee, Employee.Operations>
-{
-
- @Override
- EmployeeComposableInvoker select(String... select);
-
- @Override
- EmployeeComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getPersonID();
-
- void setPersonID(java.lang.Integer _personID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFirstName();
-
- void setFirstName(java.lang.String _firstName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getLastName();
-
- void setLastName(java.lang.String _lastName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "MiddleName",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getMiddleName();
-
- void setMiddleName(java.lang.String _middleName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HomeAddress",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address
- getHomeAddress();
-
- void
- setHomeAddress(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address _homeAddress);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Home",
- type = "Edm.GeographyPoint",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.commons.api.edm.geo.Point getHome();
-
- void setHome(org.apache.olingo.commons.api.edm.geo.Point _home);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Numbers",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getNumbers();
-
- void setNumbers(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _numbers);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Emails",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getEmails();
-
- void setEmails(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _emails);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "DateHired",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getDateHired();
-
- void setDateHired(java.sql.Timestamp _dateHired);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Office",
- type = "Edm.GeographyPoint",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.commons.api.edm.geo.Point getOffice();
-
- void setOffice(org.apache.olingo.commons.api.edm.geo.Point _office);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Parent",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Person",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "People",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person getParent();
-
- void setParent(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person _parent);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Company",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Company",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Company",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company getCompany();
-
- void
- setCompany(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company _company);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCard.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCard.java
deleted file mode 100644
index d1432e6..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCard.java
+++ /dev/null
@@ -1,152 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.OperationType;
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-import org.apache.olingo.ext.proxy.api.annotations.Parameter;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "GiftCard",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface GiftCard
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<GiftCard>, org.apache.olingo.ext.proxy.api.StructuredQuery<GiftCard> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "GiftCardID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getGiftCardID();
-
- void setGiftCardID(java.lang.Integer _giftCardID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "GiftCardNO",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getGiftCardNO();
-
- void setGiftCardNO(java.lang.String _giftCardNO);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Amount",
- type = "Edm.Double",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Double getAmount();
-
- void setAmount(java.lang.Double _amount);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ExperationDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getExperationDate();
-
- void setExperationDate(java.sql.Timestamp _experationDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OwnerName",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getOwnerName();
-
- void setOwnerName(java.lang.String _ownerName);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "GetActualAmount",
- type = OperationType.FUNCTION,
- isComposable = false,
- referenceType = java.lang.Double.class, returnType = "Edm.Double")
- org.apache.olingo.ext.proxy.api.Invoker<java.lang.Double> getActualAmount(
- @Parameter(name = "bonusRate", type = "Edm.Double", nullable = true) java.lang.Double bonusRate
- );
-
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "GiftCardID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getGiftCardIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "GiftCardNO",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getGiftCardNOAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Amount",
- type = "Edm.Double")
- org.apache.olingo.ext.proxy.api.Annotatable getAmountAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ExperationDate",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getExperationDateAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "OwnerName",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getOwnerNameAnnotations();
-
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardCollection.java
deleted file mode 100644
index 988128e..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface GiftCardCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.GiftCardCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.GiftCard, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.GiftCardCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.GiftCardCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardCollectionComposableInvoker.java
deleted file mode 100644
index 40cab5b..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface GiftCardCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.GiftCardCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.GiftCardCollection.Operations> {
-
- @Override
- GiftCardCollectionComposableInvoker select(String... select);
-
- @Override
- GiftCardCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardComposableInvoker.java
deleted file mode 100644
index 0672afd..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/GiftCardComposableInvoker.java
+++ /dev/null
@@ -1,112 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface GiftCardComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<GiftCard, GiftCard.Operations>
-{
-
- @Override
- GiftCardComposableInvoker select(String... select);
-
- @Override
- GiftCardComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "GiftCardID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getGiftCardID();
-
- void setGiftCardID(java.lang.Integer _giftCardID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "GiftCardNO",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getGiftCardNO();
-
- void setGiftCardNO(java.lang.String _giftCardNO);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Amount",
- type = "Edm.Double",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Double getAmount();
-
- void setAmount(java.lang.Double _amount);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ExperationDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getExperationDate();
-
- void setExperationDate(java.sql.Timestamp _experationDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OwnerName",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getOwnerName();
-
- void setOwnerName(java.lang.String _ownerName);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddress.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddress.java
deleted file mode 100644
index 02e7ec4..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddress.java
+++ /dev/null
@@ -1,136 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.Annotatable;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.ComplexType(name = "HomeAddress",
- isOpenType = false,
- isAbstract = false,
- baseType = "Microsoft.Test.OData.Services.ODataWCFService.Address")
-public interface HomeAddress
- extends org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address {
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getStreet();
-
- @Override
- void setStreet(java.lang.String _street);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCity();
-
- @Override
- void setCity(java.lang.String _city);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PostalCode",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getPostalCode();
-
- @Override
- void setPostalCode(java.lang.String _postalCode);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FamilyName",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFamilyName();
-
- void setFamilyName(java.lang.String _familyName);
-
- @Override
- Annotations annotations();
-
- interface Annotations
- extends
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address.Annotations {
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Street",
- type = "Edm.String")
- Annotatable getStreetAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "City",
- type = "Edm.String")
- Annotatable getCityAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PostalCode",
- type = "Edm.String")
- Annotatable getPostalCodeAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FamilyName",
- type = "Edm.String")
- Annotatable getFamilyNameAnnotations();
-
- }
-
- @Override
- Operations operations();
-
- interface Operations
- extends
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address.Operations {
- // No additional methods needed for now.
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressCollection.java
deleted file mode 100644
index eae20c4..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface HomeAddressCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddressCollection>,
-org.apache.olingo.ext.proxy.api.ComplexCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddress, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddressCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddressCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressCollectionComposableInvoker.java
deleted file mode 100644
index aa5ed6e..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface HomeAddressCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddressCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddressCollection.Operations> {
-
- @Override
- HomeAddressCollectionComposableInvoker select(String... select);
-
- @Override
- HomeAddressCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressComposableInvoker.java
deleted file mode 100644
index 8c9f177..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/HomeAddressComposableInvoker.java
+++ /dev/null
@@ -1,93 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface HomeAddressComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<HomeAddress, HomeAddress.Operations>
-{
-
- @Override
- HomeAddressComposableInvoker select(String... select);
-
- @Override
- HomeAddressComposableInvoker expand(String... expand);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Street",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getStreet();
-
- void setStreet(java.lang.String _street);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "City",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCity();
-
- void setCity(java.lang.String _city);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PostalCode",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getPostalCode();
-
- void setPostalCode(java.lang.String _postalCode);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FamilyName",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFamilyName();
-
- void setFamilyName(java.lang.String _familyName);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/IsBoss.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/IsBoss.java
deleted file mode 100644
index 8df09d5..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/IsBoss.java
+++ /dev/null
@@ -1,31 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.Term(name = "IsBoss",
- type = "Edm.Boolean")
-public interface IsBoss extends AbstractTerm {
- // No additional methods needed for now.
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnion.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnion.java
deleted file mode 100644
index 8abed01..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnion.java
+++ /dev/null
@@ -1,87 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "LabourUnion",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface LabourUnion
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<LabourUnion>,
- org.apache.olingo.ext.proxy.api.StructuredQuery<LabourUnion> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LabourUnionID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getLabourUnionID();
-
- void setLabourUnionID(java.lang.Integer _labourUnionID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "LabourUnionID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getLabourUnionIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
-
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionCollection.java
deleted file mode 100644
index 901a50b..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface LabourUnionCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnionCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnion, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnionCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnionCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionCollectionComposableInvoker.java
deleted file mode 100644
index b2a0d0b..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface LabourUnionCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnionCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnionCollection.Operations> {
-
- @Override
- LabourUnionCollectionComposableInvoker select(String... select);
-
- @Override
- LabourUnionCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionComposableInvoker.java
deleted file mode 100644
index ed3d991..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/LabourUnionComposableInvoker.java
+++ /dev/null
@@ -1,67 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface LabourUnionComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<LabourUnion, LabourUnion.Operations>
-{
-
- @Override
- LabourUnionComposableInvoker select(String... select);
-
- @Override
- LabourUnionComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LabourUnionID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getLabourUnionID();
-
- void setLabourUnionID(java.lang.Integer _labourUnionID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Order.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Order.java
deleted file mode 100644
index bec3700..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Order.java
+++ /dev/null
@@ -1,174 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Order",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface Order
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Order>, org.apache.olingo.ext.proxy.api.StructuredQuery<Order> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getOrderID();
-
- void setOrderID(java.lang.Integer _orderID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getOrderDate();
-
- void setOrderDate(java.sql.Timestamp _orderDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ShelfLife",
- type = "Edm.Duration",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.math.BigDecimal getShelfLife();
-
- void setShelfLife(java.math.BigDecimal _shelfLife);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderShelfLifes",
- type = "Edm.Duration",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.math.BigDecimal> getOrderShelfLifes();
-
- void setOrderShelfLifes(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.math.BigDecimal> _orderShelfLifes);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "LoggedInEmployee",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Employee",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Employees",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee
- getLoggedInEmployee();
-
- void
- setLoggedInEmployee(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee _loggedInEmployee);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CustomerForOrder",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Customer",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Customers",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer
- getCustomerForOrder();
-
- void
- setCustomerForOrder(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer _customerForOrder);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "OrderDetails",
- type = "Microsoft.Test.OData.Services.ODataWCFService.OrderDetail",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "OrderDetails",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailCollection
- getOrderDetails();
-
- void
- setOrderDetails(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailCollection _orderDetails);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "OrderID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getOrderIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "OrderDate",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getOrderDateAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ShelfLife",
- type = "Edm.Duration")
- org.apache.olingo.ext.proxy.api.Annotatable getShelfLifeAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "OrderShelfLifes",
- type = "Edm.Duration")
- org.apache.olingo.ext.proxy.api.Annotatable getOrderShelfLifesAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "LoggedInEmployee",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Employee")
- org.apache.olingo.ext.proxy.api.Annotatable getLoggedInEmployeeAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "CustomerForOrder",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Customer")
- org.apache.olingo.ext.proxy.api.Annotatable getCustomerForOrderAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "OrderDetails",
- type = "Microsoft.Test.OData.Services.ODataWCFService.OrderDetail")
- org.apache.olingo.ext.proxy.api.Annotatable getOrderDetailsAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderCollection.java
deleted file mode 100644
index f7575f7..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface OrderCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderCollectionComposableInvoker.java
deleted file mode 100644
index 7e64e1f..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface OrderCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection.Operations> {
-
- @Override
- OrderCollectionComposableInvoker select(String... select);
-
- @Override
- OrderCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderComposableInvoker.java
deleted file mode 100644
index 94817ee..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderComposableInvoker.java
+++ /dev/null
@@ -1,136 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface OrderComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Order, Order.Operations>
-{
-
- @Override
- OrderComposableInvoker select(String... select);
-
- @Override
- OrderComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getOrderID();
-
- void setOrderID(java.lang.Integer _orderID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getOrderDate();
-
- void setOrderDate(java.sql.Timestamp _orderDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ShelfLife",
- type = "Edm.Duration",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.math.BigDecimal getShelfLife();
-
- void setShelfLife(java.math.BigDecimal _shelfLife);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderShelfLifes",
- type = "Edm.Duration",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.math.BigDecimal> getOrderShelfLifes();
-
- void setOrderShelfLifes(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.math.BigDecimal> _orderShelfLifes);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "LoggedInEmployee",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Employee",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Employees",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee
- getLoggedInEmployee();
-
- void
- setLoggedInEmployee(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee _loggedInEmployee);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CustomerForOrder",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Customer",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Customers",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer
- getCustomerForOrder();
-
- void
- setCustomerForOrder(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer _customerForOrder);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "OrderDetails",
- type = "Microsoft.Test.OData.Services.ODataWCFService.OrderDetail",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "OrderDetails",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailCollection
- getOrderDetails();
-
- void
- setOrderDetails(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailCollection _orderDetails);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetail.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetail.java
deleted file mode 100644
index 28b3f45..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetail.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@KeyRef(OrderDetailKey.class)
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "OrderDetail",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface OrderDetail
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<OrderDetail>,
- org.apache.olingo.ext.proxy.api.StructuredQuery<OrderDetail> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getOrderID();
-
- void setOrderID(java.lang.Integer _orderID);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getProductID();
-
- void setProductID(java.lang.Integer _productID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderPlaced",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getOrderPlaced();
-
- void setOrderPlaced(java.sql.Timestamp _orderPlaced);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Quantity",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getQuantity();
-
- void setQuantity(java.lang.Integer _quantity);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "UnitPrice",
- type = "Edm.Single",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Float getUnitPrice();
-
- void setUnitPrice(java.lang.Float _unitPrice);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ProductOrdered",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Product",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Products",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection
- getProductOrdered();
-
- void
- setProductOrdered(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection _productOrdered);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "AssociatedOrder",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Order",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Orders",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order
- getAssociatedOrder();
-
- void
- setAssociatedOrder(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order _associatedOrder);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "OrderID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getOrderIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getProductIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "OrderPlaced",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getOrderPlacedAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Quantity",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getQuantityAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "UnitPrice",
- type = "Edm.Single")
- org.apache.olingo.ext.proxy.api.Annotatable getUnitPriceAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "ProductOrdered",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Product")
- org.apache.olingo.ext.proxy.api.Annotatable getProductOrderedAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "AssociatedOrder",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Order")
- org.apache.olingo.ext.proxy.api.Annotatable getAssociatedOrderAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailCollection.java
deleted file mode 100644
index 4001219..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface OrderDetailCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetail, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailCollectionComposableInvoker.java
deleted file mode 100644
index f859295..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface OrderDetailCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailCollection.Operations> {
-
- @Override
- OrderDetailCollectionComposableInvoker select(String... select);
-
- @Override
- OrderDetailCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailComposableInvoker.java
deleted file mode 100644
index 64f3bcb..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailComposableInvoker.java
+++ /dev/null
@@ -1,139 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface OrderDetailComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<OrderDetail, OrderDetail.Operations>
-{
-
- @Override
- OrderDetailComposableInvoker select(String... select);
-
- @Override
- OrderDetailComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getOrderID();
-
- void setOrderID(java.lang.Integer _orderID);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getProductID();
-
- void setProductID(java.lang.Integer _productID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "OrderPlaced",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getOrderPlaced();
-
- void setOrderPlaced(java.sql.Timestamp _orderPlaced);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Quantity",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getQuantity();
-
- void setQuantity(java.lang.Integer _quantity);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "UnitPrice",
- type = "Edm.Single",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Float getUnitPrice();
-
- void setUnitPrice(java.lang.Float _unitPrice);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "ProductOrdered",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Product",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Products",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection
- getProductOrdered();
-
- void
- setProductOrdered(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection _productOrdered);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "AssociatedOrder",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Order",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Orders",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order
- getAssociatedOrder();
-
- void
- setAssociatedOrder(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order _associatedOrder);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailKey.java
deleted file mode 100644
index 27fd5f3..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/OrderDetailKey.java
+++ /dev/null
@@ -1,53 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
-
-@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
-public class OrderDetailKey extends AbstractEntityKey {
-
- private static final long serialVersionUID = -4068508671802176607L;
-
- private java.lang.Integer _orderID;
-
- @CompoundKeyElement(name = "OrderID", position = 0)
- public java.lang.Integer getOrderID() {
- return _orderID;
- }
-
- public void setOrderID(final java.lang.Integer _orderID) {
- this._orderID = _orderID;
- }
-
- private java.lang.Integer _productID;
-
- @CompoundKeyElement(name = "ProductID", position = 1)
- public java.lang.Integer getProductID() {
- return _productID;
- }
-
- public void setProductID(final java.lang.Integer _productID) {
- this._productID = _productID;
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrument.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrument.java
deleted file mode 100644
index ae5e408..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrument.java
+++ /dev/null
@@ -1,165 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "PaymentInstrument",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface PaymentInstrument
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<PaymentInstrument>,
- org.apache.olingo.ext.proxy.api.StructuredQuery<PaymentInstrument> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PaymentInstrumentID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getPaymentInstrumentID();
-
- void setPaymentInstrumentID(java.lang.Integer _paymentInstrumentID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FriendlyName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFriendlyName();
-
- void setFriendlyName(java.lang.String _friendlyName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getCreatedDate();
-
- void setCreatedDate(java.sql.Timestamp _createdDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "TheStoredPI",
- type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "StoredPIs",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI
- getTheStoredPI();
-
- void
- setTheStoredPI(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI _theStoredPI);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "BackupStoredPI",
- type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "StoredPIs",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI
- getBackupStoredPI();
-
- void
- setBackupStoredPI(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI _backupStoredPI);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PaymentInstrumentID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getPaymentInstrumentIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FriendlyName",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getFriendlyNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CreatedDate",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getCreatedDateAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "TheStoredPI",
- type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI")
- org.apache.olingo.ext.proxy.api.Annotatable getTheStoredPIAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "BillingStatements",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Statement")
- org.apache.olingo.ext.proxy.api.Annotatable getBillingStatementsAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "BackupStoredPI",
- type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI")
- org.apache.olingo.ext.proxy.api.Annotatable getBackupStoredPIAnnotations();
- }
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "BillingStatements",
- type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "StoredPIs",
- containsTarget = true)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument.BillingStatements
- getBillingStatements();
-
- void
- setBillingStatements(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument.BillingStatements _billingStatements);
-
- @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "BillingStatements", contained = true)
- interface BillingStatements
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Statement, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StatementCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<BillingStatements>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Statement, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StatementCollection> {
- // No additional methods needed for now.
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentCollection.java
deleted file mode 100644
index 7c83d51..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface PaymentInstrumentCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrumentCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrumentCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrumentCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentCollectionComposableInvoker.java
deleted file mode 100644
index f8ce983..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface PaymentInstrumentCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrumentCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrumentCollection.Operations> {
-
- @Override
- PaymentInstrumentCollectionComposableInvoker select(String... select);
-
- @Override
- PaymentInstrumentCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentComposableInvoker.java
deleted file mode 100644
index 1e14355..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PaymentInstrumentComposableInvoker.java
+++ /dev/null
@@ -1,132 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-public interface PaymentInstrumentComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<PaymentInstrument, PaymentInstrument.Operations>
-{
-
- @Override
- PaymentInstrumentComposableInvoker select(String... select);
-
- @Override
- PaymentInstrumentComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PaymentInstrumentID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getPaymentInstrumentID();
-
- void setPaymentInstrumentID(java.lang.Integer _paymentInstrumentID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FriendlyName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFriendlyName();
-
- void setFriendlyName(java.lang.String _friendlyName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getCreatedDate();
-
- void setCreatedDate(java.sql.Timestamp _createdDate);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "TheStoredPI",
- type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "StoredPIs",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI
- getTheStoredPI();
-
- void
- setTheStoredPI(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI _theStoredPI);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "BackupStoredPI",
- type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "StoredPIs",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI
- getBackupStoredPI();
-
- void
- setBackupStoredPI(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI _backupStoredPI);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "BillingStatements",
- type = "Microsoft.Test.OData.Services.ODataWCFService.StoredPI",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "StoredPIs",
- containsTarget = true)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument.BillingStatements
- getBillingStatements();
-
- void
- setBillingStatements(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument.BillingStatements _billingStatements);
-
- @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "BillingStatements", contained = true)
- interface BillingStatements
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Statement, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StatementCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<BillingStatements>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Statement, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StatementCollection> {
- // No additional methods needed for now.
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Person.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Person.java
deleted file mode 100644
index 0042c94..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Person.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.OperationType;
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-import org.apache.olingo.ext.proxy.api.annotations.Parameter;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Person",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface Person
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Person>, org.apache.olingo.ext.proxy.api.StructuredQuery<Person> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getPersonID();
-
- void setPersonID(java.lang.Integer _personID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFirstName();
-
- void setFirstName(java.lang.String _firstName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getLastName();
-
- void setLastName(java.lang.String _lastName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "MiddleName",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getMiddleName();
-
- void setMiddleName(java.lang.String _middleName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HomeAddress",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address
- getHomeAddress();
-
- void
- setHomeAddress(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address _homeAddress);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Home",
- type = "Edm.GeographyPoint",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.commons.api.edm.geo.Point getHome();
-
- void setHome(org.apache.olingo.commons.api.edm.geo.Point _home);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Numbers",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getNumbers();
-
- void setNumbers(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _numbers);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Emails",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getEmails();
-
- void setEmails(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _emails);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Parent",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Person",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "People",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person getParent();
-
- void setParent(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person _parent);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(
- name = "GetHomeAddress",
- type = OperationType.FUNCTION,
- isComposable = true,
- referenceType = org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddress.class,
- returnType = "Microsoft.Test.OData.Services.ODataWCFService.HomeAddress")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddressComposableInvoker
- getHomeAddress(
- );
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(
- name = "ResetAddress",
- type = OperationType.ACTION,
- referenceType = org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person.class,
- returnType = "Microsoft.Test.OData.Services.ODataWCFService.Person")
- org.apache.olingo.ext.proxy.api.StructuredInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person>
- resetAddress(
- @Parameter(name = "addresses", type = "Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)",
- nullable = false) org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AddressCollection addresses,
- @Parameter(name = "index", type = "Edm.Int32", nullable = false) java.lang.Integer index
- );
-
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PersonID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getPersonIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "FirstName",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getFirstNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "LastName",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getLastNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "MiddleName",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getMiddleNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "HomeAddress",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address")
- org.apache.olingo.ext.proxy.api.Annotatable getHomeAddressAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Home",
- type = "Edm.GeographyPoint")
- org.apache.olingo.ext.proxy.api.Annotatable getHomeAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Numbers",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNumbersAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Emails",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getEmailsAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Parent",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Person")
- org.apache.olingo.ext.proxy.api.Annotatable getParentAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonCollection.java
deleted file mode 100644
index 66ae176..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface PersonCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonCollectionComposableInvoker.java
deleted file mode 100644
index 2692c1a..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface PersonCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PersonCollection.Operations> {
-
- @Override
- PersonCollectionComposableInvoker select(String... select);
-
- @Override
- PersonCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonComposableInvoker.java
deleted file mode 100644
index d362f63..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PersonComposableInvoker.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface PersonComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Person, Person.Operations>
-{
-
- @Override
- PersonComposableInvoker select(String... select);
-
- @Override
- PersonComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PersonID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getPersonID();
-
- void setPersonID(java.lang.Integer _personID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "FirstName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getFirstName();
-
- void setFirstName(java.lang.String _firstName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "LastName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getLastName();
-
- void setLastName(java.lang.String _lastName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "MiddleName",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getMiddleName();
-
- void setMiddleName(java.lang.String _middleName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "HomeAddress",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address
- getHomeAddress();
-
- void
- setHomeAddress(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address _homeAddress);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Home",
- type = "Edm.GeographyPoint",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.commons.api.edm.geo.Point getHome();
-
- void setHome(org.apache.olingo.commons.api.edm.geo.Point _home);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Numbers",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getNumbers();
-
- void setNumbers(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _numbers);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Emails",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> getEmails();
-
- void setEmails(org.apache.olingo.ext.proxy.api.PrimitiveCollection<java.lang.String> _emails);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Parent",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Person",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "People",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person getParent();
-
- void setParent(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person _parent);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Product.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Product.java
deleted file mode 100644
index 3b0bba0..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Product.java
+++ /dev/null
@@ -1,266 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.OperationType;
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-import org.apache.olingo.ext.proxy.api.annotations.Parameter;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Product",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface Product
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Product>, org.apache.olingo.ext.proxy.api.StructuredQuery<Product> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getProductID();
-
- void setProductID(java.lang.Integer _productID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "QuantityPerUnit",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getQuantityPerUnit();
-
- void setQuantityPerUnit(java.lang.String _quantityPerUnit);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "UnitPrice",
- type = "Edm.Single",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Float getUnitPrice();
-
- void setUnitPrice(java.lang.Float _unitPrice);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "QuantityInStock",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getQuantityInStock();
-
- void setQuantityInStock(java.lang.Integer _quantityInStock);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Discontinued",
- type = "Edm.Boolean",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Boolean getDiscontinued();
-
- void setDiscontinued(java.lang.Boolean _discontinued);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "UserAccess",
- type = "Microsoft.Test.OData.Services.ODataWCFService.AccessLevel",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel
- getUserAccess();
-
- void
- setUserAccess(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel _userAccess);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "SkinColor",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Color",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color getSkinColor();
-
- void
- setSkinColor(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color _skinColor);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CoverColors",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Color",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color>
- getCoverColors();
-
- void
- setCoverColors(
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color> _coverColors);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Details",
- type = "Microsoft.Test.OData.Services.ODataWCFService.ProductDetail",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "ProductDetails",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection
- getDetails();
-
- void
- setDetails(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection _details);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(
- name = "GetProductDetails",
- type = OperationType.FUNCTION,
- isComposable = true,
- referenceType = org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection.class,
- returnType = "Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollectionComposableInvoker
- getProductDetails(
- @Parameter(name = "count", type = "Edm.Int32", nullable = true) java.lang.Integer count
- );
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(
- name = "AddAccessRight",
- type = OperationType.ACTION,
- referenceType = org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel.class,
- returnType = "Microsoft.Test.OData.Services.ODataWCFService.AccessLevel")
- org.apache.olingo.ext.proxy.api.Invoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel>
- addAccessRight(
- @Parameter(name = "accessRight", type = "Microsoft.Test.OData.Services.ODataWCFService.AccessLevel",
- nullable = true) org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel accessRight
- );
-
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getProductIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "QuantityPerUnit",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getQuantityPerUnitAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "UnitPrice",
- type = "Edm.Single")
- org.apache.olingo.ext.proxy.api.Annotatable getUnitPriceAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "QuantityInStock",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getQuantityInStockAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Discontinued",
- type = "Edm.Boolean")
- org.apache.olingo.ext.proxy.api.Annotatable getDiscontinuedAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "UserAccess",
- type = "Microsoft.Test.OData.Services.ODataWCFService.AccessLevel")
- org.apache.olingo.ext.proxy.api.Annotatable getUserAccessAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "SkinColor",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Color")
- org.apache.olingo.ext.proxy.api.Annotatable getSkinColorAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CoverColors",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Color")
- org.apache.olingo.ext.proxy.api.Annotatable getCoverColorsAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Details",
- type = "Microsoft.Test.OData.Services.ODataWCFService.ProductDetail")
- org.apache.olingo.ext.proxy.api.Annotatable getDetailsAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductCollection.java
deleted file mode 100644
index 71e88a4..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductCollection.java
+++ /dev/null
@@ -1,53 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-import org.apache.olingo.ext.proxy.api.OperationType;
-import org.apache.olingo.ext.proxy.api.annotations.Parameter;
-
-public interface ProductCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(
- name = "Discount",
- type = OperationType.ACTION,
- referenceType = org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection.class,
- returnType = "Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)")
- org.apache.olingo.ext.proxy.api.StructuredCollectionInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection>
- discount(
- @Parameter(name = "percentage", type = "Edm.Int32", nullable = false) java.lang.Integer percentage
- );
-
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductCollectionComposableInvoker.java
deleted file mode 100644
index 21f811d..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface ProductCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductCollection.Operations> {
-
- @Override
- ProductCollectionComposableInvoker select(String... select);
-
- @Override
- ProductCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductComposableInvoker.java
deleted file mode 100644
index cab441d..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductComposableInvoker.java
+++ /dev/null
@@ -1,193 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface ProductComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Product, Product.Operations>
-{
-
- @Override
- ProductComposableInvoker select(String... select);
-
- @Override
- ProductComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getProductID();
-
- void setProductID(java.lang.Integer _productID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "QuantityPerUnit",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getQuantityPerUnit();
-
- void setQuantityPerUnit(java.lang.String _quantityPerUnit);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "UnitPrice",
- type = "Edm.Single",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Float getUnitPrice();
-
- void setUnitPrice(java.lang.Float _unitPrice);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "QuantityInStock",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getQuantityInStock();
-
- void setQuantityInStock(java.lang.Integer _quantityInStock);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Discontinued",
- type = "Edm.Boolean",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Boolean getDiscontinued();
-
- void setDiscontinued(java.lang.Boolean _discontinued);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "UserAccess",
- type = "Microsoft.Test.OData.Services.ODataWCFService.AccessLevel",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel
- getUserAccess();
-
- void
- setUserAccess(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel _userAccess);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "SkinColor",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Color",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color getSkinColor();
-
- void
- setSkinColor(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color _skinColor);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CoverColors",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Color",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color>
- getCoverColors();
-
- void
- setCoverColors(
- org.apache.olingo.ext.proxy.api.PrimitiveCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color> _coverColors);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Details",
- type = "Microsoft.Test.OData.Services.ODataWCFService.ProductDetail",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "ProductDetails",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection
- getDetails();
-
- void
- setDetails(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection _details);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetail.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetail.java
deleted file mode 100644
index 41b78cc..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetail.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.OperationType;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
-
-@KeyRef(ProductDetailKey.class)
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "ProductDetail",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface ProductDetail
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<ProductDetail>,
- org.apache.olingo.ext.proxy.api.StructuredQuery<ProductDetail> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getProductID();
-
- void setProductID(java.lang.Integer _productID);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductDetailID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getProductDetailID();
-
- void setProductDetailID(java.lang.Integer _productDetailID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getProductName();
-
- void setProductName(java.lang.String _productName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Description",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getDescription();
-
- void setDescription(java.lang.String _description);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "RelatedProduct",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Product",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Products",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product
- getRelatedProduct();
-
- void
- setRelatedProduct(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product _relatedProduct);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Reviews",
- type = "Microsoft.Test.OData.Services.ODataWCFService.ProductReview",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "ProductReviews",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReviewCollection
- getReviews();
-
- void
- setReviews(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReviewCollection _reviews);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
-
- @org.apache.olingo.ext.proxy.api.annotations.Operation(
- name = "GetRelatedProduct",
- type = OperationType.FUNCTION,
- isComposable = true,
- referenceType = org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product.class,
- returnType = "Microsoft.Test.OData.Services.ODataWCFService.Product")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductComposableInvoker
- getRelatedProduct(
- );
-
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getProductIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductDetailID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getProductDetailIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductName",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getProductNameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Description",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getDescriptionAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "RelatedProduct",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Product")
- org.apache.olingo.ext.proxy.api.Annotatable getRelatedProductAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Reviews",
- type = "Microsoft.Test.OData.Services.ODataWCFService.ProductReview")
- org.apache.olingo.ext.proxy.api.Annotatable getReviewsAnnotations();
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailCollection.java
deleted file mode 100644
index 92783ad..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface ProductDetailCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetail, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailCollectionComposableInvoker.java
deleted file mode 100644
index 3c2c40a..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface ProductDetailCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetailCollection.Operations> {
-
- @Override
- ProductDetailCollectionComposableInvoker select(String... select);
-
- @Override
- ProductDetailCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailComposableInvoker.java
deleted file mode 100644
index de647a9..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailComposableInvoker.java
+++ /dev/null
@@ -1,124 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface ProductDetailComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<ProductDetail, ProductDetail.Operations>
-{
-
- @Override
- ProductDetailComposableInvoker select(String... select);
-
- @Override
- ProductDetailComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getProductID();
-
- void setProductID(java.lang.Integer _productID);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductDetailID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getProductDetailID();
-
- void setProductDetailID(java.lang.Integer _productDetailID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getProductName();
-
- void setProductName(java.lang.String _productName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Description",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getDescription();
-
- void setDescription(java.lang.String _description);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "RelatedProduct",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Product",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Products",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product
- getRelatedProduct();
-
- void
- setRelatedProduct(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product _relatedProduct);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Reviews",
- type = "Microsoft.Test.OData.Services.ODataWCFService.ProductReview",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "ProductReviews",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReviewCollection
- getReviews();
-
- void
- setReviews(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReviewCollection _reviews);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailKey.java
deleted file mode 100644
index 19f0f1b..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductDetailKey.java
+++ /dev/null
@@ -1,53 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
-
-@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
-public class ProductDetailKey extends AbstractEntityKey {
-
- private static final long serialVersionUID = -6268946147639590355L;
-
- private java.lang.Integer _productID;
-
- @CompoundKeyElement(name = "ProductID", position = 0)
- public java.lang.Integer getProductID() {
- return _productID;
- }
-
- public void setProductID(final java.lang.Integer _productID) {
- this._productID = _productID;
- }
-
- private java.lang.Integer _productDetailID;
-
- @CompoundKeyElement(name = "ProductDetailID", position = 1)
- public java.lang.Integer getProductDetailID() {
- return _productDetailID;
- }
-
- public void setProductDetailID(final java.lang.Integer _productDetailID) {
- this._productDetailID = _productDetailID;
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReview.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReview.java
deleted file mode 100644
index fa433ed..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReview.java
+++ /dev/null
@@ -1,168 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@KeyRef(ProductReviewKey.class)
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "ProductReview",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface ProductReview
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<ProductReview>,
- org.apache.olingo.ext.proxy.api.StructuredQuery<ProductReview> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getProductID();
-
- void setProductID(java.lang.Integer _productID);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductDetailID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getProductDetailID();
-
- void setProductDetailID(java.lang.Integer _productDetailID);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ReviewTitle",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getReviewTitle();
-
- void setReviewTitle(java.lang.String _reviewTitle);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "RevisionID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getRevisionID();
-
- void setRevisionID(java.lang.Integer _revisionID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Comment",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getComment();
-
- void setComment(java.lang.String _comment);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Author",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getAuthor();
-
- void setAuthor(java.lang.String _author);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getProductIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ProductDetailID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getProductDetailIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "ReviewTitle",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getReviewTitleAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "RevisionID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getRevisionIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Comment",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getCommentAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Author",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getAuthorAnnotations();
-
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewCollection.java
deleted file mode 100644
index bdbc9cd..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface ProductReviewCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReviewCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReview, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReviewCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReviewCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewCollectionComposableInvoker.java
deleted file mode 100644
index 1d584c5..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface ProductReviewCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReviewCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReviewCollection.Operations> {
-
- @Override
- ProductReviewCollectionComposableInvoker select(String... select);
-
- @Override
- ProductReviewCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewComposableInvoker.java
deleted file mode 100644
index dea9b42..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewComposableInvoker.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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface ProductReviewComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<ProductReview, ProductReview.Operations>
-{
-
- @Override
- ProductReviewComposableInvoker select(String... select);
-
- @Override
- ProductReviewComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getProductID();
-
- void setProductID(java.lang.Integer _productID);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ProductDetailID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getProductDetailID();
-
- void setProductDetailID(java.lang.Integer _productDetailID);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "ReviewTitle",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getReviewTitle();
-
- void setReviewTitle(java.lang.String _reviewTitle);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "RevisionID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getRevisionID();
-
- void setRevisionID(java.lang.Integer _revisionID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Comment",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getComment();
-
- void setComment(java.lang.String _comment);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Author",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getAuthor();
-
- void setAuthor(java.lang.String _author);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewKey.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewKey.java
deleted file mode 100644
index f02b3e4..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/ProductReviewKey.java
+++ /dev/null
@@ -1,75 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
-
-@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
-public class ProductReviewKey extends AbstractEntityKey {
-
- private static final long serialVersionUID = 5483520057777167030L;
-
- private java.lang.Integer _productID;
-
- @CompoundKeyElement(name = "ProductID", position = 0)
- public java.lang.Integer getProductID() {
- return _productID;
- }
-
- public void setProductID(final java.lang.Integer _productID) {
- this._productID = _productID;
- }
-
- private java.lang.Integer _productDetailID;
-
- @CompoundKeyElement(name = "ProductDetailID", position = 1)
- public java.lang.Integer getProductDetailID() {
- return _productDetailID;
- }
-
- public void setProductDetailID(final java.lang.Integer _productDetailID) {
- this._productDetailID = _productDetailID;
- }
-
- private java.lang.String _reviewTitle;
-
- @CompoundKeyElement(name = "ReviewTitle", position = 2)
- public java.lang.String getReviewTitle() {
- return _reviewTitle;
- }
-
- public void setReviewTitle(final java.lang.String _reviewTitle) {
- this._reviewTitle = _reviewTitle;
- }
-
- private java.lang.Integer _revisionID;
-
- @CompoundKeyElement(name = "RevisionID", position = 3)
- public java.lang.Integer getRevisionID() {
- return _revisionID;
- }
-
- public void setRevisionID(final java.lang.Integer _revisionID) {
- this._revisionID = _revisionID;
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompany.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompany.java
deleted file mode 100644
index 5fc32a0..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompany.java
+++ /dev/null
@@ -1,345 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.concurrent.Future;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "PublicCompany",
- openType = true,
- hasStream = false,
- isAbstract = false,
- baseType = "Microsoft.Test.OData.Services.ODataWCFService.Company")
-public interface PublicCompany
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company,
- AbstractOpenType {
-
- @Override
- PublicCompany load();
-
- @Override
- Future<? extends PublicCompany> loadAsync();
-
- @Override
- PublicCompany refs();
-
- @Override
- PublicCompany expand(String... expand);
-
- @Override
- PublicCompany select(String... select);
-
- @Override
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getCompanyID();
-
- @Override
- void setCompanyID(java.lang.Integer _companyID);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyCategory",
- type = "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory
- getCompanyCategory();
-
- @Override
- void
- setCompanyCategory(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory _companyCategory);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Revenue",
- type = "Edm.Int64",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Long getRevenue();
-
- @Override
- void setRevenue(java.lang.Long _revenue);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- @Override
- void setName(java.lang.String _name);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address getAddress();
-
- @Override
- void
- setAddress(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address _address);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "StockExchange",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getStockExchange();
-
- void setStockExchange(java.lang.String _stockExchange);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Employees",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Employee",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Employees",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection
- getEmployees();
-
- @Override
- void
- setEmployees(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection _employees);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "VipCustomer",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Customer",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "VipCustomer",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer
- getVipCustomer();
-
- @Override
- void
- setVipCustomer(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer _vipCustomer);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Departments",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Departments",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection
- getDepartments();
-
- @Override
- void
- setDepartments(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection _departments);
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CoreDepartment",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Departments",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department
- getCoreDepartment();
-
- @Override
- void
- setCoreDepartment(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department _coreDepartment);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Club",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Club",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "",
- targetEntitySet = "",
- containsTarget = true)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Club getClub();
-
- void setClub(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Club _club);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "LabourUnion",
- type = "Microsoft.Test.OData.Services.ODataWCFService.LabourUnion",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "LabourUnion",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnion
- getLabourUnion();
-
- void
- setLabourUnion(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnion _labourUnion);
-
- @Override
- Operations operations();
-
- interface Operations
- extends
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company.Operations {
- // No additional methods needed for now.
- }
-
- @Override
- Annotations annotations();
-
- interface Annotations
- extends
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company.Annotations {
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CompanyID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getCompanyIDAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CompanyCategory",
- type = "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory")
- org.apache.olingo.ext.proxy.api.Annotatable getCompanyCategoryAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Revenue",
- type = "Edm.Int64")
- org.apache.olingo.ext.proxy.api.Annotatable getRevenueAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Address",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address")
- org.apache.olingo.ext.proxy.api.Annotatable getAddressAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "StockExchange",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getStockExchangeAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Employees",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Employee")
- org.apache.olingo.ext.proxy.api.Annotatable getEmployeesAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "VipCustomer",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Customer")
- org.apache.olingo.ext.proxy.api.Annotatable getVipCustomerAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Departments",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Department")
- org.apache.olingo.ext.proxy.api.Annotatable getDepartmentsAnnotations();
-
- @Override
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "CoreDepartment",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Department")
- org.apache.olingo.ext.proxy.api.Annotatable getCoreDepartmentAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Assets",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Asset")
- org.apache.olingo.ext.proxy.api.Annotatable getAssetsAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Club",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Club")
- org.apache.olingo.ext.proxy.api.Annotatable getClubAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "LabourUnion",
- type = "Microsoft.Test.OData.Services.ODataWCFService.LabourUnion")
- org.apache.olingo.ext.proxy.api.Annotatable getLabourUnionAnnotations();
- }
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Assets",
- type = "Microsoft.Test.OData.Services.ODataWCFService.LabourUnion",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "LabourUnion",
- containsTarget = true)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PublicCompany.Assets
- getAssets();
-
- void
- setAssets(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PublicCompany.Assets _assets);
-
- @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Assets", contained = true)
- interface Assets
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Asset, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AssetCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Assets>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Asset, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AssetCollection> {
- // No additional methods needed for now.
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyCollection.java
deleted file mode 100644
index 1d5eb10..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface PublicCompanyCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PublicCompanyCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PublicCompany, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PublicCompanyCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PublicCompanyCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyCollectionComposableInvoker.java
deleted file mode 100644
index 2778d7f..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface PublicCompanyCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PublicCompanyCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PublicCompanyCollection.Operations> {
-
- @Override
- PublicCompanyCollectionComposableInvoker select(String... select);
-
- @Override
- PublicCompanyCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyComposableInvoker.java
deleted file mode 100644
index 29a46c8..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/PublicCompanyComposableInvoker.java
+++ /dev/null
@@ -1,232 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.AbstractOpenType;
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-public interface PublicCompanyComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<PublicCompany, PublicCompany.Operations>
- , AbstractOpenType {
-
- @Override
- PublicCompanyComposableInvoker select(String... select);
-
- @Override
- PublicCompanyComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getCompanyID();
-
- void setCompanyID(java.lang.Integer _companyID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyCategory",
- type = "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory
- getCompanyCategory();
-
- void
- setCompanyCategory(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory _companyCategory);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Revenue",
- type = "Edm.Int64",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Long getRevenue();
-
- void setRevenue(java.lang.Long _revenue);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getName();
-
- void setName(java.lang.String _name);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address getAddress();
-
- void
- setAddress(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address _address);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "StockExchange",
- type = "Edm.String",
- nullable = true,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getStockExchange();
-
- void setStockExchange(java.lang.String _stockExchange);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Employees",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Employee",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Employees",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection
- getEmployees();
-
- void
- setEmployees(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection _employees);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "VipCustomer",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Customer",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "VipCustomer",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer
- getVipCustomer();
-
- void
- setVipCustomer(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer _vipCustomer);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Departments",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Departments",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection
- getDepartments();
-
- void
- setDepartments(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection _departments);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CoreDepartment",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "Departments",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department
- getCoreDepartment();
-
- void
- setCoreDepartment(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department _coreDepartment);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Club",
- type = "Microsoft.Test.OData.Services.ODataWCFService.Club",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "",
- targetEntitySet = "",
- containsTarget = true)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Club getClub();
-
- void setClub(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Club _club);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "LabourUnion",
- type = "Microsoft.Test.OData.Services.ODataWCFService.LabourUnion",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "LabourUnion",
- containsTarget = false)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnion
- getLabourUnion();
-
- void
- setLabourUnion(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnion _labourUnion);
-
- @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Assets",
- type = "Microsoft.Test.OData.Services.ODataWCFService.LabourUnion",
- targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
- targetContainer = "InMemoryEntities",
- targetEntitySet = "LabourUnion",
- containsTarget = true)
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PublicCompany.Assets
- getAssets();
-
- void
- setAssets(
- org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PublicCompany.Assets _assets);
-
- @org.apache.olingo.ext.proxy.api.annotations.EntitySet(name = "Assets", contained = true)
- interface Assets
- extends
- org.apache.olingo.ext.proxy.api.EntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Asset, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AssetCollection>,
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<Assets>,
- AbstractEntitySet<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Asset, java.lang.Integer, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AssetCollection> {
- // No additional methods needed for now.
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Statement.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Statement.java
deleted file mode 100644
index bfbeb6d..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Statement.java
+++ /dev/null
@@ -1,124 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Statement",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface Statement
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Statement>, org.apache.olingo.ext.proxy.api.StructuredQuery<Statement> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "StatementID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getStatementID();
-
- void setStatementID(java.lang.Integer _statementID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TransactionType",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getTransactionType();
-
- void setTransactionType(java.lang.String _transactionType);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TransactionDescription",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getTransactionDescription();
-
- void setTransactionDescription(java.lang.String _transactionDescription);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Amount",
- type = "Edm.Double",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Double getAmount();
-
- void setAmount(java.lang.Double _amount);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "StatementID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getStatementIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "TransactionType",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getTransactionTypeAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "TransactionDescription",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getTransactionDescriptionAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Amount",
- type = "Edm.Double")
- org.apache.olingo.ext.proxy.api.Annotatable getAmountAnnotations();
-
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementCollection.java
deleted file mode 100644
index 67e223d..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface StatementCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StatementCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Statement, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StatementCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StatementCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementCollectionComposableInvoker.java
deleted file mode 100644
index 62924a6..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface StatementCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StatementCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StatementCollection.Operations> {
-
- @Override
- StatementCollectionComposableInvoker select(String... select);
-
- @Override
- StatementCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementComposableInvoker.java
deleted file mode 100644
index 1a5d30f..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StatementComposableInvoker.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface StatementComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Statement, Statement.Operations>
-{
-
- @Override
- StatementComposableInvoker select(String... select);
-
- @Override
- StatementComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "StatementID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getStatementID();
-
- void setStatementID(java.lang.Integer _statementID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TransactionType",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getTransactionType();
-
- void setTransactionType(java.lang.String _transactionType);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TransactionDescription",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getTransactionDescription();
-
- void setTransactionDescription(java.lang.String _transactionDescription);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Amount",
- type = "Edm.Double",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Double getAmount();
-
- void setAmount(java.lang.Double _amount);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPI.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPI.java
deleted file mode 100644
index 608b023..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPI.java
+++ /dev/null
@@ -1,124 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "StoredPI",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface StoredPI
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<StoredPI>, org.apache.olingo.ext.proxy.api.StructuredQuery<StoredPI> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "StoredPIID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getStoredPIID();
-
- void setStoredPIID(java.lang.Integer _storedPIID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PIName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getPIName();
-
- void setPIName(java.lang.String _pIName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PIType",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getPIType();
-
- void setPIType(java.lang.String _pIType);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getCreatedDate();
-
- void setCreatedDate(java.sql.Timestamp _createdDate);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "StoredPIID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getStoredPIIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PIName",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getPINameAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "PIType",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getPITypeAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CreatedDate",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getCreatedDateAnnotations();
-
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPICollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPICollection.java
deleted file mode 100644
index 25e78e2..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPICollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface StoredPICollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPICollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPICollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPICollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPICollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPICollectionComposableInvoker.java
deleted file mode 100644
index d8d1f36..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPICollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface StoredPICollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPICollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPICollection.Operations> {
-
- @Override
- StoredPICollectionComposableInvoker select(String... select);
-
- @Override
- StoredPICollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPIComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPIComposableInvoker.java
deleted file mode 100644
index 3fba8d6..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/StoredPIComposableInvoker.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface StoredPIComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<StoredPI, StoredPI.Operations>
-{
-
- @Override
- StoredPIComposableInvoker select(String... select);
-
- @Override
- StoredPIComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "StoredPIID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getStoredPIID();
-
- void setStoredPIID(java.lang.Integer _storedPIID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PIName",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getPIName();
-
- void setPIName(java.lang.String _pIName);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "PIType",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getPIType();
-
- void setPIType(java.lang.String _pIType);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getCreatedDate();
-
- void setCreatedDate(java.sql.Timestamp _createdDate);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Subscription.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Subscription.java
deleted file mode 100644
index 406d78a..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/Subscription.java
+++ /dev/null
@@ -1,144 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
-@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Subscription",
- openType = false,
- hasStream = false,
- isAbstract = false)
-public interface Subscription
- extends org.apache.olingo.ext.proxy.api.Annotatable,
- org.apache.olingo.ext.proxy.api.EntityType<Subscription>,
- org.apache.olingo.ext.proxy.api.StructuredQuery<Subscription> {
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "SubscriptionID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getSubscriptionID();
-
- void setSubscriptionID(java.lang.Integer _subscriptionID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TemplateGuid",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getTemplateGuid();
-
- void setTemplateGuid(java.lang.String _templateGuid);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Title",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getTitle();
-
- void setTitle(java.lang.String _title);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Category",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCategory();
-
- void setCategory(java.lang.String _category);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getCreatedDate();
-
- void setCreatedDate(java.sql.Timestamp _createdDate);
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Annotations annotations();
-
- interface Annotations {
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "SubscriptionID",
- type = "Edm.Int32")
- org.apache.olingo.ext.proxy.api.Annotatable getSubscriptionIDAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "TemplateGuid",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getTemplateGuidAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Title",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getTitleAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Category",
- type = "Edm.String")
- org.apache.olingo.ext.proxy.api.Annotatable getCategoryAnnotations();
-
- @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CreatedDate",
- type = "Edm.DateTimeOffset")
- org.apache.olingo.ext.proxy.api.Annotatable getCreatedDateAnnotations();
-
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionCollection.java
deleted file mode 100644
index d8471fd..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionCollection.java
+++ /dev/null
@@ -1,41 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import java.util.Collection;
-// CHECKSTYLE:ON (Maven checkstyle)
-
-import org.apache.olingo.ext.proxy.api.AbstractTerm;
-
-public interface SubscriptionCollection
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionQuery<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.SubscriptionCollection>,
-org.apache.olingo.ext.proxy.api.EntityCollection<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Subscription, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.SubscriptionCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.SubscriptionCollection> {
-
- Operations operations();
-
- interface Operations extends org.apache.olingo.ext.proxy.api.Operations {
- // No additional methods needed for now.
- }
-
- Object getAnnotation(Class<? extends AbstractTerm> term);
-
- Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionCollectionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionCollectionComposableInvoker.java
deleted file mode 100644
index 269782e..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionCollectionComposableInvoker.java
+++ /dev/null
@@ -1,32 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-
-public interface SubscriptionCollectionComposableInvoker
- extends
- org.apache.olingo.ext.proxy.api.StructuredCollectionComposableInvoker<org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.SubscriptionCollection, org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.SubscriptionCollection.Operations> {
-
- @Override
- SubscriptionCollectionComposableInvoker select(String... select);
-
- @Override
- SubscriptionCollectionComposableInvoker expand(String... expand);
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionComposableInvoker.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionComposableInvoker.java
deleted file mode 100644
index ebe9959..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/SubscriptionComposableInvoker.java
+++ /dev/null
@@ -1,112 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
-// CHECKSTYLE:OFF (Maven checkstyle)
-import org.apache.olingo.ext.proxy.api.annotations.Key;
-
-// CHECKSTYLE:ON (Maven checkstyle)
-
-public interface SubscriptionComposableInvoker
- extends org.apache.olingo.ext.proxy.api.StructuredComposableInvoker<Subscription, Subscription.Operations>
-{
-
- @Override
- SubscriptionComposableInvoker select(String... select);
-
- @Override
- SubscriptionComposableInvoker expand(String... expand);
-
- @Key
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "SubscriptionID",
- type = "Edm.Int32",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.Integer getSubscriptionID();
-
- void setSubscriptionID(java.lang.Integer _subscriptionID);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "TemplateGuid",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getTemplateGuid();
-
- void setTemplateGuid(java.lang.String _templateGuid);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Title",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getTitle();
-
- void setTitle(java.lang.String _title);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Category",
- type = "Edm.String",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.lang.String getCategory();
-
- void setCategory(java.lang.String _category);
-
- @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CreatedDate",
- type = "Edm.DateTimeOffset",
- nullable = false,
- defaultValue = "",
- maxLenght = Integer.MAX_VALUE,
- fixedLenght = false,
- precision = 0,
- scale = 0,
- unicode = true,
- collation = "",
- srid = "")
- java.sql.Timestamp getCreatedDate();
-
- void setCreatedDate(java.sql.Timestamp _createdDate);
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/package-info.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/package-info.java
deleted file mode 100644
index 50d10e3..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/microsoft/test/odata/services/odatawcfservice/types/package-info.java
+++ /dev/null
@@ -1,20 +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.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;
-
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java
index 0c40003..1aada74 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java
@@ -25,6 +25,7 @@
import java.math.BigDecimal;
import java.net.URI;
import java.util.Calendar;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -32,16 +33,20 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
+import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
import org.apache.olingo.client.api.communication.response.ODataInvokeResponse;
import org.apache.olingo.client.api.domain.ClientCollectionValue;
import org.apache.olingo.client.api.domain.ClientComplexValue;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientObjectFactory;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.client.core.ODataClientFactory;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
import org.junit.Test;
@@ -50,68 +55,80 @@
@Test
public void noReturnTypeAction() throws Exception {
- URI actionURI =
- getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRT").build();
- ODataInvokeResponse<ClientProperty> response =
- getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class).execute();
- assertEquals(204, response.getStatusCode());
- }
-
- @Test
- public void primitveAction() throws Exception {
- URI actionURI =
- getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTString").build();
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRT").build();
ODataInvokeResponse<ClientProperty> response =
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class).execute();
- assertEquals(200, response.getStatusCode());
+ assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
+ }
+
+ @Test
+ public void primitiveAction() throws Exception {
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTString").build();
+ ODataInvokeResponse<ClientProperty> response =
+ getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class).execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
assertEquals("UARTString string value", response.getBody().getPrimitiveValue().toValue());
}
@Test
- public void primitveActionInvalidParameters() throws Exception {
- Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
- parameters.put("Invalid", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(1));
- URI actionURI =
- getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTString").build();
+ public void primitiveActionMinimalResponse() throws Exception {
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTString").build();
+ ODataInvokeRequest<ClientProperty> request = getClient().getInvokeRequestFactory()
+ .getActionInvokeRequest(actionURI, ClientProperty.class);
+ request.setPrefer(getClient().newPreferences().returnMinimal());
+ final ODataInvokeResponse<ClientProperty> response = request.execute();
+ assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
+ assertEquals("return=minimal", response.getHeader(HttpHeader.PREFERENCE_APPLIED).iterator().next());
+ }
+
+ @Test
+ public void primitiveActionInvalidParameters() throws Exception {
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTString").build();
+ Map<String, ClientValue> parameters = Collections.singletonMap("Invalid",
+ (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(1));
try {
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
- .execute();
+ .execute();
fail("Expected an ODataClientErrorException");
} catch (ODataClientErrorException e) {
- assertEquals(400, e.getStatusLine().getStatusCode());
+ assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode());
}
}
@Test
- public void primitveCollectionAction() throws Exception {
- URI actionURI =
- getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollStringTwoParam").build();
+ public void primitiveCollectionAction() throws Exception {
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTCollStringTwoParam").build();
Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
- parameters.put("ParameterDuration", getClient().getObjectFactory().newPrimitiveValueBuilder().setType(
- EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal(1)).build());
+ parameters.put("ParameterDuration", getClient().getObjectFactory().newPrimitiveValueBuilder()
+ .setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal(1)).build());
ODataInvokeResponse<ClientProperty> response =
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
- .execute();
- assertEquals(200, response.getStatusCode());
+ .execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
ClientCollectionValue<ClientValue> valueArray = response.getBody().getCollectionValue();
assertEquals(3, valueArray.size());
Iterator<ClientValue> iterator = valueArray.iterator();
- assertEquals("PT1S", iterator.next().asPrimitive().toValue());
- assertEquals("PT2S", iterator.next().asPrimitive().toValue());
- assertEquals("PT3S", iterator.next().asPrimitive().toValue());
+ assertEquals("UARTCollStringTwoParam duration value: PT1S", iterator.next().asPrimitive().toValue());
+ assertEquals("UARTCollStringTwoParam duration value: PT2S", iterator.next().asPrimitive().toValue());
+ assertEquals("UARTCollStringTwoParam duration value: PT3S", iterator.next().asPrimitive().toValue());
}
@Test
public void complexAction() throws Exception {
- URI actionURI =
- getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCTTwoPrimParam").build();
- Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
- parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTCTTwoPrimParam").build();
+ Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
+ (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
ODataInvokeResponse<ClientProperty> response =
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
- .execute();
- assertEquals(200, response.getStatusCode());
+ .execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
ClientComplexValue complexValue = response.getBody().getComplexValue();
ClientProperty propInt16 = complexValue.get("PropertyInt16");
assertNotNull(propInt16);
@@ -123,28 +140,28 @@
@Test
public void complexCollectionActionNoContent() throws Exception {
- URI actionURI =
- getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollCTTwoPrimParam").build();
- Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
- parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 0));
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTCollCTTwoPrimParam").build();
+ Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
+ (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 0));
ODataInvokeResponse<ClientProperty> response =
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
- .execute();
- assertEquals(200, response.getStatusCode());
+ .execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
ClientCollectionValue<ClientValue> complexValueCollection = response.getBody().getCollectionValue();
assertEquals(0, complexValueCollection.size());
}
@Test
public void complexCollectionActionSubContent() throws Exception {
- URI actionURI =
- getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollCTTwoPrimParam").build();
- Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
- parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 1));
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTCollCTTwoPrimParam").build();
+ Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
+ (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 1));
ODataInvokeResponse<ClientProperty> response =
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
- .execute();
- assertEquals(200, response.getStatusCode());
+ .execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
ClientCollectionValue<ClientValue> complexValueCollection = response.getBody().getCollectionValue();
assertEquals(1, complexValueCollection.size());
Iterator<ClientValue> iterator = complexValueCollection.iterator();
@@ -156,14 +173,14 @@
@Test
public void complexCollectionActionAllContent() throws Exception {
- URI actionURI =
- getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollCTTwoPrimParam").build();
- Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
- parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTCollCTTwoPrimParam").build();
+ Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
+ (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
ODataInvokeResponse<ClientProperty> response =
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters)
- .execute();
- assertEquals(200, response.getStatusCode());
+ .execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
ClientCollectionValue<ClientValue> complexValueCollection = response.getBody().getCollectionValue();
assertEquals(3, complexValueCollection.size());
Iterator<ClientValue> iterator = complexValueCollection.iterator();
@@ -183,15 +200,14 @@
@Test
public void entityActionETTwoKeyTwoPrim() throws Exception {
- URI actionURI =
- getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTETTwoKeyTwoPrimParam").build();
- Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
- parameters
- .put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) -365));
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTETTwoKeyTwoPrimParam").build();
+ Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
+ (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) -365));
ODataInvokeResponse<ClientEntity> response =
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntity.class, parameters)
- .execute();
- assertEquals(200, response.getStatusCode());
+ .execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
ClientEntity entity = response.getBody();
ClientProperty propInt16 = entity.getProperty("PropertyInt16");
assertNotNull(propInt16);
@@ -203,15 +219,14 @@
@Test
public void entityCollectionActionETKeyNav() throws Exception {
- URI actionURI =
- getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollETKeyNavParam").build();
- Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
- parameters
- .put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTCollETKeyNavParam").build();
+ Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
+ (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
ODataInvokeResponse<ClientEntitySet> response =
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters)
- .execute();
- assertEquals(200, response.getStatusCode());
+ .execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
ClientEntitySet entitySet = response.getBody();
assertEquals(3, entitySet.getEntities().size());
Integer key = 1;
@@ -223,51 +238,49 @@
@Test
public void entityCollectionActionETKeyNavEmptyCollection() throws Exception {
- URI actionURI =
- getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollETKeyNavParam").build();
- Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
- parameters
- .put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 0));
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTCollETKeyNavParam").build();
+ Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
+ (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 0));
ODataInvokeResponse<ClientEntitySet> response =
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters)
- .execute();
- assertEquals(200, response.getStatusCode());
+ .execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
ClientEntitySet entitySet = response.getBody();
assertEquals(0, entitySet.getEntities().size());
}
@Test
public void entityCollectionActionETKeyNavNegativeParam() throws Exception {
- URI actionURI =
- getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollETKeyNavParam").build();
- Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
- parameters
- .put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) -10));
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTCollETKeyNavParam").build();
+ Map<String, ClientValue> parameters = Collections.singletonMap("ParameterInt16",
+ (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) -10));
ODataInvokeResponse<ClientEntitySet> response =
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters)
- .execute();
- assertEquals(200, response.getStatusCode());
+ .execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
ClientEntitySet entitySet = response.getBody();
assertEquals(0, entitySet.getEntities().size());
}
@Test
public void entityCollectionActionETAllPrim() throws Exception {
- URI actionURI =
- getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollESAllPrimParam").build();
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTCollESAllPrimParam").build();
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
time.clear();
time.set(Calendar.HOUR_OF_DAY, 3);
time.set(Calendar.MINUTE, 0);
time.set(Calendar.SECOND, 0);
- Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
- parameters
- .put("ParameterTimeOfDay", getClient().getObjectFactory().newPrimitiveValueBuilder().setType(
- EdmPrimitiveTypeKind.TimeOfDay).setValue(time).build());
+ Map<String, ClientValue> parameters = Collections.singletonMap(
+ "ParameterTimeOfDay",
+ (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder()
+ .setType(EdmPrimitiveTypeKind.TimeOfDay).setValue(time).build());
ODataInvokeResponse<ClientEntitySet> response =
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters)
- .execute();
- assertEquals(200, response.getStatusCode());
+ .execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
ClientEntitySet entitySet = response.getBody();
assertEquals(3, entitySet.getEntities().size());
Integer key = 1;
@@ -279,26 +292,84 @@
@Test
public void entityActionETAllPrim() throws Exception {
- URI actionURI =
- getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTESAllPrimParam").build();
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTESAllPrimParam").build();
Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
dateTime.clear();
dateTime.set(1012, 2, 0, 0, 0, 0);
- Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
- parameters
- .put("ParameterDate", getClient().getObjectFactory().newPrimitiveValueBuilder().setType(
- EdmPrimitiveTypeKind.Date).setValue(dateTime).build());
+ Map<String, ClientValue> parameters = Collections.singletonMap(
+ "ParameterDate",
+ (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder()
+ .setType(EdmPrimitiveTypeKind.Date).setValue(dateTime).build());
ODataInvokeResponse<ClientEntity> response =
getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntity.class, parameters)
- .execute();
- // Check 201
- assertEquals(201, response.getStatusCode());
+ .execute();
+ assertEquals(HttpStatusCode.CREATED.getStatusCode(), response.getStatusCode());
+ assertEquals(TecSvcConst.BASE_URI + "/ESAllPrim(1)", response.getHeader(HttpHeader.LOCATION).iterator().next());
}
+ @Test
+ public void entityActionETAllPrimNoContent() throws Exception {
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTESAllPrimParam").build();
+ final Map<String, ClientValue> parameters = Collections.singletonMap(
+ "ParameterDate",
+ (ClientValue) getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("2000-02-29"));
+ ODataInvokeRequest<ClientEntity> request = getClient().getInvokeRequestFactory()
+ .getActionInvokeRequest(actionURI, ClientEntity.class, parameters);
+ request.setPrefer(getClient().newPreferences().returnMinimal());
+ final ODataInvokeResponse<ClientEntity> response = request.execute();
+ assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
+ assertEquals("return=minimal", response.getHeader(HttpHeader.PREFERENCE_APPLIED).iterator().next());
+ final String location = TecSvcConst.BASE_URI + "/ESAllPrim(1)";
+ assertEquals(location, response.getHeader(HttpHeader.LOCATION).iterator().next());
+ assertEquals(location, response.getHeader(HttpHeader.ODATA_ENTITY_ID).iterator().next());
+ }
+
+ @Test
+ public void airtCollStringTwoParanNotNull() {
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTCollStringTwoParam").build();
+ final Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
+ final ClientObjectFactory of = getClient().getObjectFactory();
+ parameters.put("ParameterInt16", of.newPrimitiveValueBuilder().buildInt16((short) 2));
+ parameters.put("ParameterDuration", of.newPrimitiveValueBuilder().buildDuration(BigDecimal.valueOf(1)));
+ final ODataInvokeResponse<ClientProperty> response = getClient()
+ .getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters).execute();
+
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
+ ClientCollectionValue<ClientValue> collectionValue = response.getBody().getCollectionValue().asCollection();
+ assertEquals(2, collectionValue.size());
+ final Iterator<ClientValue> iter = collectionValue.iterator();
+
+ assertEquals("UARTCollStringTwoParam duration value: PT1S", iter.next().asPrimitive().toValue());
+ assertEquals("UARTCollStringTwoParam duration value: PT2S", iter.next().asPrimitive().toValue());
+ }
+
+ @Test
+ public void airtCollStringTwoParanNull() {
+ final URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendActionCallSegment("AIRTCollStringTwoParam").build();
+ final Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
+ final ClientObjectFactory of = getClient().getObjectFactory();
+ parameters.put("ParameterInt16", of.newPrimitiveValueBuilder().buildInt16((short) 2));
+ parameters.put("ParameterDuration", of.newPrimitiveValueBuilder().buildDuration(null));
+ final ODataInvokeResponse<ClientProperty> response = getClient()
+ .getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters).execute();
+
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
+ ClientCollectionValue<ClientValue> collectionValue = response.getBody().getCollectionValue().asCollection();
+ assertEquals(2, collectionValue.size());
+ final Iterator<ClientValue> iter = collectionValue.iterator();
+
+ assertEquals("UARTCollStringTwoParam int16 value: 2", iter.next().asPrimitive().toValue());
+ assertEquals("UARTCollStringTwoParam duration value: null", iter.next().asPrimitive().toValue());
+ }
+
@Override
protected ODataClient getClient() {
ODataClient odata = ODataClientFactory.getClient();
- odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON_NO_METADATA);
+ odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
return odata;
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java
new file mode 100644
index 0000000..4736df6
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java
@@ -0,0 +1,332 @@
+/*
+ * 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.tecsvc.client;
+
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.ODataClientErrorException;
+import org.apache.olingo.client.api.communication.request.AsyncBatchRequestWrapper;
+import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
+import org.apache.olingo.client.api.communication.request.ODataRequest;
+import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
+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.response.AsyncResponseWrapper;
+import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
+import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
+import org.apache.olingo.client.api.communication.response.ODataResponse;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientObjectFactory;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.fit.AbstractBaseTestITCase;
+import org.apache.olingo.fit.tecsvc.TecSvcConst;
+import org.apache.olingo.server.tecsvc.async.TechnicalAsyncService;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+public final class AsyncSupportITCase extends AbstractBaseTestITCase {
+ private static final String ES_ALL_PRIM = "ESAllPrim";
+ private static final String NAV_PROPERTY_ET_TWO_PRIM_ONE = "NavPropertyETTwoPrimOne";
+ private static final String SERVICE_URI = TecSvcConst.BASE_URI;
+ public static final int SLEEP_TIMEOUT_IN_MS = 100;
+
+ @Test
+ public void readEntity() throws Exception {
+ ODataClient client = getClient();
+ URI uri = client.newURIBuilder(SERVICE_URI)
+ .appendEntitySetSegment(ES_ALL_PRIM)
+ .appendKeySegment(32767).build();
+
+ //
+ final ODataRetrieveResponse<ClientEntity> response = getClient().getRetrieveRequestFactory()
+ .getEntityRequest(uri).execute();
+ assertEquals(32767, response.getBody().getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertEquals(200, response.getStatusCode());
+
+ // first async request
+
+ ODataRequest re1 = getClient().getRetrieveRequestFactory()
+ .getEntityRequest(uri)
+ .addCustomHeader(HttpHeader.PREFER, "respond-async; " + TechnicalAsyncService.TEC_ASYNC_SLEEP + "=1");
+ AsyncResponseWrapper<ODataResponse> first = client.getAsyncRequestFactory().getAsyncRequestWrapper(re1).execute();
+
+ assertTrue(first.isPreferenceApplied());
+
+ // second async request
+ ODataRequest re2 = getClient().getRetrieveRequestFactory()
+ .getEntityRequest(uri)
+ .addCustomHeader(HttpHeader.PREFER, "respond-async; " + TechnicalAsyncService.TEC_ASYNC_SLEEP + "=1");
+ AsyncResponseWrapper<ODataResponse> second = client.getAsyncRequestFactory().getAsyncRequestWrapper(re2).execute();
+ assertTrue(second.isPreferenceApplied());
+
+ // get result of first async request
+ assertFalse(first.isDone());
+
+ waitTillDone(first, 2);
+ assertTrue(first.isDone());
+
+ assertNotNull(first.getODataResponse());
+ ODataResponse firstResponse = first.getODataResponse();
+ assertEquals(200, firstResponse.getStatusCode());
+ ResWrap<Entity> entity = getClient().getDeserializer(ContentType.APPLICATION_JSON)
+ .toEntity(firstResponse.getRawResponse());
+ assertEquals(32767, entity.getPayload().getProperty("PropertyInt16").asPrimitive());
+ assertEquals("First Resource - positive values", entity.getPayload().getProperty("PropertyString").asPrimitive());
+ }
+
+ @Test
+ public void readEntitySet() throws Exception {
+ ODataClient client = getClient();
+ URI uri = client.newURIBuilder(SERVICE_URI)
+ .appendEntitySetSegment(ES_ALL_PRIM)
+ .build();
+
+ //
+ final ODataRetrieveResponse<ClientEntitySet> response = getClient().getRetrieveRequestFactory()
+ .getEntitySetRequest(uri).execute();
+ assertEquals(200, response.getStatusCode());
+ ClientEntitySet responseBody = response.getBody();
+ assertEquals(3, responseBody.getEntities().size());
+ checkEntityAvailableWith(responseBody, "PropertyInt16", 32767);
+
+ // first async request
+ ODataRequest re1 = getClient().getRetrieveRequestFactory()
+ .getEntitySetRequest(uri)
+ .addCustomHeader(HttpHeader.PREFER, "respond-async; " + TechnicalAsyncService.TEC_ASYNC_SLEEP + "=1");
+ AsyncResponseWrapper<ODataResponse> first = client.getAsyncRequestFactory().getAsyncRequestWrapper(re1).execute();
+
+ assertTrue(first.isPreferenceApplied());
+
+ // second async request
+ ODataRequest re2 = getClient().getRetrieveRequestFactory()
+ .getEntitySetRequest(uri)
+ .addCustomHeader(HttpHeader.PREFER, "respond-async; " + TechnicalAsyncService.TEC_ASYNC_SLEEP + "=1");
+ AsyncResponseWrapper<ODataResponse> second = client.getAsyncRequestFactory().getAsyncRequestWrapper(re2).execute();
+ assertTrue(second.isPreferenceApplied());
+
+ // get result of first async request
+ assertFalse(first.isDone());
+
+ waitTillDone(first, 2);
+ assertTrue(first.isDone());
+
+ assertNotNull(first.getODataResponse());
+ ODataResponse firstResponse = first.getODataResponse();
+ assertEquals(200, firstResponse.getStatusCode());
+ assertEquals(2, firstResponse.getHeaderNames().size());
+ assertEquals("4.0", firstResponse.getHeader("OData-Version").iterator().next());
+ ResWrap<EntityCollection> firWrap = getClient().getDeserializer(ContentType.APPLICATION_JSON)
+ .toEntitySet(firstResponse.getRawResponse());
+ EntityCollection firstResponseEntitySet = firWrap.getPayload();
+ assertEquals(3, firstResponseEntitySet.getEntities().size());
+ Entity firstResponseEntity = firstResponseEntitySet.getEntities().get(0);
+ assertEquals(32767, firstResponseEntity.getProperty("PropertyInt16").asPrimitive());
+ assertEquals("First Resource - positive values", firstResponseEntity.getProperty("PropertyString").asPrimitive());
+ }
+
+ @Test
+ public void createEntity() throws Exception {
+ ODataClient client = getClient();
+ URI uri = client.newURIBuilder(SERVICE_URI)
+ .appendEntitySetSegment(ES_ALL_PRIM).build();
+
+ //
+ final ClientObjectFactory factory = client.getObjectFactory();
+ ClientEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim"));
+ newEntity.getProperties().add(factory.newPrimitiveProperty("PropertyInt64",
+ factory.newPrimitiveValueBuilder().buildInt32(42)));
+ newEntity.addLink(factory.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_PRIM_ONE,
+ client.newURIBuilder(SERVICE_URI)
+ .appendEntitySetSegment("ESTwoPrim")
+ .appendKeySegment(32766)
+ .build()));
+
+ final ODataEntityCreateRequest<ClientEntity> createRequest =
+ client.getCUDRequestFactory().getEntityCreateRequest(uri, newEntity);
+ createRequest.addCustomHeader(HttpHeader.PREFER, "respond-async; " + TechnicalAsyncService.TEC_ASYNC_SLEEP + "=1");
+ assertNotNull(createRequest);
+ AsyncResponseWrapper<ODataResponse> asyncResponse =
+ client.getAsyncRequestFactory().getAsyncRequestWrapper(createRequest).execute();
+
+ assertTrue(asyncResponse.isPreferenceApplied());
+ assertFalse(asyncResponse.isDone());
+
+ waitTillDone(asyncResponse, 10);
+
+ @SuppressWarnings("unchecked")
+ final ODataEntityCreateResponse<ClientEntity> createResponse =
+ (ODataEntityCreateResponse<ClientEntity>) asyncResponse.getODataResponse();
+
+ assertEquals(HttpStatusCode.CREATED.getStatusCode(), createResponse.getStatusCode());
+ assertEquals(SERVICE_URI + "/ESAllPrim(1)", createResponse.getHeader(HttpHeader.LOCATION).iterator().next());
+ final ClientEntity createdEntity = createResponse.getBody();
+ assertNotNull(createdEntity);
+ final ClientProperty property1 = createdEntity.getProperty("PropertyInt64");
+ assertNotNull(property1);
+ assertEquals(42, property1.getPrimitiveValue().toValue());
+ final ClientProperty property2 = createdEntity.getProperty("PropertyDecimal");
+ assertNotNull(property2);
+ assertNull(property2.getPrimitiveValue());
+ }
+
+ @Test
+ @Ignore("mibo: Does currently not work as expected -> issue in ODataClient?")
+ public void getBatchRequest() throws Exception {
+ ODataClient client = getClient();
+ final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
+
+// final BatchManager payload = request.payloadManager();
+
+ // create new request
+// ODataEntityRequest<ClientEntity> getRequest = appendGetRequest(client, payload, "ESAllPrim", 32767, false);
+// payload.addRequest(getRequest);
+
+ //
+ request.addCustomHeader(HttpHeader.PREFER,
+ "respond-async; " + TechnicalAsyncService.TEC_ASYNC_SLEEP + "=1");
+ ODataBatchableRequest getRequest = appendGetRequest(client, "ESAllPrim", 32767, false);
+ AsyncBatchRequestWrapper asyncRequest =
+ client.getAsyncRequestFactory().getAsyncBatchRequestWrapper(request);
+ asyncRequest.addRetrieve(getRequest);
+ AsyncResponseWrapper<ODataBatchResponse> asyncResponse = asyncRequest.execute();
+
+// Future<ODataBatchResponse> test = payload.getAsyncResponse();
+// ODataBatchResponse res = payload.getResponse();
+//
+// while(!test.isDone()) {
+// System.out.println("Wait...");
+// TimeUnit.SECONDS.sleep(1);
+// }
+
+// // Fetch result
+// final ODataBatchResponse response = asyncResponse.getODataResponse();
+
+ waitTillDone(asyncResponse, 3);
+// assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode());
+// assertEquals("Accepted", response.getStatusMessage());
+
+ ODataResponse firstResponse = asyncResponse.getODataResponse();
+ assertEquals(200, firstResponse.getStatusCode());
+ assertEquals(2, firstResponse.getHeaderNames().size());
+ assertEquals("4.0", firstResponse.getHeader("OData-Version").iterator().next());
+
+ ResWrap<Entity> firWrap = getClient().getDeserializer(ContentType.APPLICATION_JSON)
+ .toEntity(firstResponse.getRawResponse());
+ Entity entity = firWrap.getPayload();
+ assertEquals(32767, entity.getProperty("PropertyInt16").asPrimitive());
+ assertEquals("First Resource - positive values", entity.getProperty("PropertyString").asPrimitive());
+ }
+
+
+ /**
+ * Test delete with async prefer header but without async support from TecSvc.
+ */
+ @Test
+ public void deleteEntity() throws Exception {
+ ODataClient client = getClient();
+ URI uri = client.newURIBuilder(SERVICE_URI)
+ .appendEntitySetSegment(ES_ALL_PRIM)
+ .appendKeySegment(32767).build();
+
+ // asyncDeleteRequest async request
+ ODataRequest deleteRequest = getClient().getCUDRequestFactory().getDeleteRequest(uri)
+ .addCustomHeader(HttpHeader.PREFER, "respond-async; " + TechnicalAsyncService.TEC_ASYNC_SLEEP + "=5");
+ AsyncResponseWrapper<ODataResponse> asyncDeleteRequest =
+ client.getAsyncRequestFactory().getAsyncRequestWrapper(deleteRequest).execute();
+
+ waitTillDone(asyncDeleteRequest, 5);
+
+ ODataResponse response = asyncDeleteRequest.getODataResponse();
+ assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
+
+ // Check that the deleted entity is really gone.
+ // This check has to be in the same session in order to access the same data provider.
+ ODataEntityRequest<ClientEntity> entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri);
+ entityRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next());
+ try {
+ entityRequest.execute();
+ fail("Expected exception not thrown!");
+ } catch (final ODataClientErrorException e) {
+ assertEquals(HttpStatusCode.NOT_FOUND.getStatusCode(), e.getStatusLine().getStatusCode());
+ }
+ }
+
+ private ODataEntityRequest<ClientEntity> appendGetRequest(final ODataClient client, final String segment,
+ final Object key, final boolean isRelative)
+ throws URISyntaxException {
+
+ final URIBuilder targetURI = client.newURIBuilder(SERVICE_URI);
+ targetURI.appendEntitySetSegment(segment).appendKeySegment(key);
+ final URI uri = (isRelative) ? new URI(SERVICE_URI).relativize(targetURI.build()) : targetURI.build();
+
+ ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(uri);
+ queryReq.setFormat(ContentType.JSON);
+ return queryReq;
+ }
+
+ private void checkEntityAvailableWith(ClientEntitySet entitySet, String property, Object value) {
+ List<ClientEntity> entities = entitySet.getEntities();
+ for (ClientEntity entity : entities) {
+ ClientProperty ep = entity.getProperty("PropertyInt16");
+ if(ep != null) {
+ assertEquals(value, ep.getPrimitiveValue().toValue());
+ return;
+ }
+ }
+ fail("Entity with property '" + property +
+ "' and value '" + value + "' not found in entitySet '" + entitySet + "'");
+ }
+
+ private void waitTillDone(AsyncResponseWrapper<?> async, int maxWaitInSeconds) throws InterruptedException {
+ int waitCounter = maxWaitInSeconds * 1000;
+ while(!async.isDone() && waitCounter > 0) {
+ TimeUnit.MILLISECONDS.sleep(SLEEP_TIMEOUT_IN_MS);
+ waitCounter -= SLEEP_TIMEOUT_IN_MS;
+ }
+ }
+
+ @Override
+ protected ODataClient getClient() {
+ ODataClient odata = ODataClientFactory.getClient();
+ odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
+ return odata;
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandlingITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandlingITCase.java
index 2166235..c0b1c69 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandlingITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandlingITCase.java
@@ -25,6 +25,7 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
import org.junit.Test;
@@ -44,8 +45,7 @@
connection.setRequestProperty(HttpHeader.X_HTTP_METHOD_OVERRIDE, "differentValue");
connection.connect();
- int code = connection.getResponseCode();
- assertEquals(400, code);
+ assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), connection.getResponseCode());
}
@Override
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java
index 819aab7..a8c3941 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java
@@ -28,6 +28,7 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import java.math.BigDecimal;
import java.net.URI;
import java.util.Collections;
import java.util.Iterator;
@@ -40,16 +41,19 @@
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.ODataPropertyUpdateRequest;
import org.apache.olingo.client.api.communication.request.cud.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
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.ODataPropertyUpdateResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ClientAnnotation;
import org.apache.olingo.client.api.domain.ClientComplexValue;
@@ -65,22 +69,47 @@
import org.apache.olingo.client.api.edm.xml.Reference;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.commons.api.ODataError;
+import org.apache.olingo.commons.api.ex.ODataError;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
+import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
public class BasicITCase extends AbstractBaseTestITCase {
+
+ private static final String CONTENT_TYPE_JSON_IEEE754_COMPATIBLE =
+ ContentType.create(ContentType.JSON, ContentType.PARAMETER_IEEE754_COMPATIBLE, "true").toContentTypeString();
+ private static final String SERVICE_NAMESPACE = "olingo.odata.test1";
+ private static final String ET_ALL_PRIM_NAME = "ETAllPrim";
+ private static final FullQualifiedName ET_ALL_PRIM = new FullQualifiedName(SERVICE_NAMESPACE, ET_ALL_PRIM_NAME);
+
+ private static final String PROPERTY_INT16 = "PropertyInt16";
+ private static final String PROPERTY_INT64 = "PropertyInt64";
+ private static final String PROPERTY_DECIMAL = "PropertyDecimal";
+ private static final String PROPERTY_COMP_ALL_PRIM = "PropertyCompAllPrim";
+ private static final String NAV_PROPERTY_ET_TWO_PRIM_ONE = "NavPropertyETTwoPrimOne";
private static final String SERVICE_URI = TecSvcConst.BASE_URI;
+ private static final String ES_ALL_PRIM = "ESAllPrim";
+ private static final String ES_TWO_PRIM = "ESTwoPrim";
+ private static final String ES_KEY_NAV = "ESKeyNav";
+
+ void assertShortOrInt(int value, Object n) {
+ if (n instanceof Number) {
+ assertEquals(value, ((Number)n).intValue());
+ } else {
+ Assert.fail();
+ }
+ }
+
@Test
public void readServiceDocument() {
ODataServiceDocumentRequest request = getClient().getRetrieveRequestFactory()
@@ -92,7 +121,6 @@
ClientServiceDocument serviceDocument = response.getBody();
assertNotNull(serviceDocument);
-
assertThat(serviceDocument.getEntitySetNames(), hasItem("ESAllPrim"));
assertThat(serviceDocument.getFunctionImportNames(), hasItem("FICRTCollCTTwoPrim"));
assertThat(serviceDocument.getSingletonNames(), hasItem("SIMedia"));
@@ -143,7 +171,7 @@
final ODataRetrieveResponse<ClientEntitySet> response = request.execute();
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
- assertThat(response.getContentType(), containsString(ContentType.APPLICATION_JSON.toContentTypeString()));
+ assertContentType(response.getContentType());
final ClientEntitySet entitySet = response.getBody();
assertNotNull(entitySet);
@@ -161,9 +189,21 @@
final ClientProperty property = entity.getProperty("PropertyInt16");
assertNotNull(property);
assertNotNull(property.getPrimitiveValue());
- assertEquals(0, property.getPrimitiveValue().toValue());
+ if (isJson()) {
+ assertEquals(0, property.getPrimitiveValue().toValue());
+ } else {
+ assertEquals((short)0, property.getPrimitiveValue().toValue());
+ }
+ }
+
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_JSON.toContentTypeString()));
}
+ private boolean isJson() {
+ return getClient().getConfiguration().getDefaultPubFormat().equals(ContentType.JSON);
+ }
+
@Test
public void readEntityCollectionCount() {
final ODataValueRequest request = getClient().getRetrieveRequestFactory()
@@ -206,7 +246,7 @@
final ODataRetrieveResponse<ClientEntity> response = request.execute();
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
- assertThat(response.getContentType(), containsString(ContentType.APPLICATION_JSON.toContentTypeString()));
+ assertContentType(response.getContentType());
final ClientEntity entity = response.getBody();
assertNotNull(entity);
@@ -215,9 +255,15 @@
assertNotNull(property.getCollectionValue());
assertEquals(3, property.getCollectionValue().size());
Iterator<ClientValue> iterator = property.getCollectionValue().iterator();
- assertEquals(1000, iterator.next().asPrimitive().toValue());
- assertEquals(2000, iterator.next().asPrimitive().toValue());
- assertEquals(30112, iterator.next().asPrimitive().toValue());
+ if(isJson()) {
+ assertEquals(1000, iterator.next().asPrimitive().toValue());
+ assertEquals(2000, iterator.next().asPrimitive().toValue());
+ assertEquals(30112, iterator.next().asPrimitive().toValue());
+ } else {
+ assertEquals((short)1000, iterator.next().asPrimitive().toValue());
+ assertEquals((short)2000, iterator.next().asPrimitive().toValue());
+ assertEquals((short)30112, iterator.next().asPrimitive().toValue());
+ }
}
@Test
@@ -249,7 +295,7 @@
patchEntity.getProperties().add(factory.newPrimitiveProperty("PropertyString",
factory.newPrimitiveValueBuilder().buildString("new")));
patchEntity.getProperties().add(factory.newPrimitiveProperty("PropertyDecimal",
- factory.newPrimitiveValueBuilder().buildDouble(42.875)));
+ factory.newPrimitiveValueBuilder().buildDecimal(new BigDecimal(42.875))));
patchEntity.getProperties().add(factory.newPrimitiveProperty("PropertyInt64",
factory.newPrimitiveValueBuilder().buildInt64(null)));
final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESAllPrim").appendKeySegment(32767)
@@ -267,13 +313,22 @@
assertEquals("new", property1.getPrimitiveValue().toValue());
final ClientProperty property2 = entity.getProperty("PropertyDecimal");
assertNotNull(property2);
- assertEquals(42.875, property2.getPrimitiveValue().toValue());
+ if (isJson()) {
+ assertEquals(42.875, property2.getPrimitiveValue().toValue());
+ } else {
+ assertEquals(new BigDecimal(42.875), property2.getPrimitiveValue().toValue());
+ }
final ClientProperty property3 = entity.getProperty("PropertyInt64");
assertNotNull(property3);
assertNull(property3.getPrimitiveValue());
final ClientProperty property4 = entity.getProperty("PropertyDuration");
assertNotNull(property4);
- assertEquals("PT6S", property4.getPrimitiveValue().toValue());
+ if (isJson()) {
+ assertEquals("PT6S", property4.getPrimitiveValue().toValue());
+ } else {
+ assertEquals(new BigDecimal(6), property4.getPrimitiveValue().toValue());
+ }
+
}
@Test
@@ -282,7 +337,7 @@
final ClientObjectFactory factory = client.getObjectFactory();
ClientEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim"));
newEntity.getProperties().add(factory.newPrimitiveProperty("PropertyInt64",
- factory.newPrimitiveValueBuilder().buildInt32(42)));
+ factory.newPrimitiveValueBuilder().buildInt64((long)42)));
final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESAllPrim").appendKeySegment(32767)
.build();
@@ -296,7 +351,11 @@
assertNotNull(entity);
final ClientProperty property1 = entity.getProperty("PropertyInt64");
assertNotNull(property1);
- assertEquals(42, property1.getPrimitiveValue().toValue());
+ if (isJson()) {
+ assertEquals(42, property1.getPrimitiveValue().toValue());
+ } else {
+ assertEquals((long)42, property1.getPrimitiveValue().toValue());
+ }
final ClientProperty property2 = entity.getProperty("PropertyDecimal");
assertNotNull(property2);
assertNull(property2.getPrimitiveValue());
@@ -312,7 +371,7 @@
factory.newComplexProperty("PropertyComp",
factory.newComplexValue("olingo.odata.test1.CTTwoPrim").add(
factory.newPrimitiveProperty("PropertyInt16",
- factory.newPrimitiveValueBuilder().buildInt32(42)))))));
+ factory.newPrimitiveValueBuilder().buildInt16((short)42)))))));
final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESCompComp").appendKeySegment(1).build();
final ODataEntityUpdateRequest<ClientEntity> request = client.getCUDRequestFactory().getEntityUpdateRequest(
uri, UpdateType.PATCH, patchEntity);
@@ -327,7 +386,11 @@
assertNotNull(complex);
final ClientProperty property1 = complex.get("PropertyInt16");
assertNotNull(property1);
- assertEquals(42, property1.getPrimitiveValue().toValue());
+ if (isJson()) {
+ assertEquals(42, property1.getPrimitiveValue().toValue());
+ } else {
+ assertEquals((short)42, property1.getPrimitiveValue().toValue());
+ }
final ClientProperty property2 = complex.get("PropertyString");
assertNotNull(property2);
assertEquals("String 1", property2.getPrimitiveValue().toValue());
@@ -375,8 +438,8 @@
final ClientObjectFactory factory = client.getObjectFactory();
ClientEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim"));
newEntity.getProperties().add(factory.newPrimitiveProperty("PropertyInt64",
- factory.newPrimitiveValueBuilder().buildInt32(42)));
- newEntity.addLink(factory.newEntityNavigationLink("NavPropertyETTwoPrimOne",
+ factory.newPrimitiveValueBuilder().buildInt64((long)42)));
+ newEntity.addLink(factory.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_PRIM_ONE,
client.newURIBuilder(SERVICE_URI)
.appendEntitySetSegment("ESTwoPrim")
.appendKeySegment(32766)
@@ -394,16 +457,40 @@
assertNotNull(createdEntity);
final ClientProperty property1 = createdEntity.getProperty("PropertyInt64");
assertNotNull(property1);
- assertEquals(42, property1.getPrimitiveValue().toValue());
+ if(isJson()) {
+ assertEquals(42, property1.getPrimitiveValue().toValue());
+ } else {
+ assertEquals((long)42, property1.getPrimitiveValue().toValue());
+ }
final ClientProperty property2 = createdEntity.getProperty("PropertyDecimal");
assertNotNull(property2);
assertNull(property2.getPrimitiveValue());
}
@Test
+ public void createEntityMinimalResponse() throws Exception {
+ final ODataClient client = getClient();
+ final ClientObjectFactory factory = client.getObjectFactory();
+ ClientEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETTwoPrim"));
+ newEntity.getProperties().add(factory.newPrimitiveProperty("PropertyString",
+ factory.newPrimitiveValueBuilder().buildString("new")));
+ ODataEntityCreateRequest<ClientEntity> request = client.getCUDRequestFactory().getEntityCreateRequest(
+ client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESTwoPrim").build(),
+ newEntity);
+ request.setPrefer(getClient().newPreferences().returnMinimal());
+
+ final ODataEntityCreateResponse<ClientEntity> response = request.execute();
+ assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
+ assertEquals("return=minimal", response.getHeader(HttpHeader.PREFERENCE_APPLIED).iterator().next());
+ final String location = SERVICE_URI + "/ESTwoPrim(1)";
+ assertEquals(location, response.getHeader(HttpHeader.LOCATION).iterator().next());
+ assertEquals(location, response.getHeader(HttpHeader.ODATA_ENTITY_ID).iterator().next());
+ }
+
+ @Test
public void readEntityWithExpandedNavigationProperty() {
- final ODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
- client.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ final ODataClient client = getClient(SERVICE_URI);
+ client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
final URI uri = client.newURIBuilder(SERVICE_URI)
.appendEntitySetSegment("ESKeyNav")
@@ -459,30 +546,20 @@
entity.getProperties().add(
of.newCollectionProperty("CollPropertyComp",
of.newCollectionValue("CTPrimComp")
- .add(
- of.newComplexValue("CTPrimComp")
- .add(
- of.newPrimitiveProperty("PropertyInt16", of.newPrimitiveValueBuilder()
- .buildInt16(
- (short) 42)))
- .add(
- of.newComplexProperty("PropertyComp", of.newComplexValue("CTAllPrim")
- .add(
- of.newPrimitiveProperty("PropertyString", of
- .newPrimitiveValueBuilder()
- .buildString("42"))))))
- .add(
- of.newComplexValue("CTPrimComp")
- .add(
- of.newPrimitiveProperty("PropertyInt16", of.newPrimitiveValueBuilder()
- .buildInt16(
- (short) 43)))
- .add(
- of.newComplexProperty("PropertyComp", of.newComplexValue("CTAllPrim")
- .add(
- of.newPrimitiveProperty("PropertyString", of
- .newPrimitiveValueBuilder()
- .buildString("43"))))))));
+ .add(of.newComplexValue("CTPrimComp")
+ .add(of.newPrimitiveProperty("PropertyInt16",
+ of.newPrimitiveValueBuilder().buildInt16((short) 42)))
+ .add(of.newComplexProperty("PropertyComp",
+ of.newComplexValue("CTAllPrim")
+ .add(of.newPrimitiveProperty("PropertyString",
+ of.newPrimitiveValueBuilder().buildString("42"))))))
+ .add(of.newComplexValue("CTPrimComp")
+ .add(of.newPrimitiveProperty("PropertyInt16",
+ of.newPrimitiveValueBuilder().buildInt16((short) 43)))
+ .add(of.newComplexProperty("PropertyComp",
+ of.newComplexValue("CTAllPrim")
+ .add(of.newPrimitiveProperty("PropertyString",
+ of.newPrimitiveValueBuilder().buildString("43"))))))));
final URI uri = getClient().newURIBuilder(SERVICE_URI)
.appendEntitySetSegment("ESKeyNav")
@@ -503,14 +580,22 @@
.iterator();
ClientComplexValue complexProperty = collectionIterator.next().asComplex();
- assertEquals(42, complexProperty.get("PropertyInt16").getPrimitiveValue().toValue());
+ if (isJson()) {
+ assertEquals(42, complexProperty.get("PropertyInt16").getPrimitiveValue().toValue());
+ } else {
+ assertEquals((short)42, complexProperty.get("PropertyInt16").getPrimitiveValue().toValue());
+ }
assertNotNull(complexProperty.get("PropertyComp"));
ClientComplexValue innerComplexProperty = complexProperty.get("PropertyComp").getComplexValue();
assertEquals("42", innerComplexProperty.get("PropertyString").getPrimitiveValue().toValue());
complexProperty = collectionIterator.next().asComplex();
- assertEquals(43, complexProperty.get("PropertyInt16").getPrimitiveValue().toValue());
+ if (isJson()) {
+ assertEquals(43, complexProperty.get("PropertyInt16").getPrimitiveValue().toValue());
+ } else {
+ assertEquals((short)43, complexProperty.get("PropertyInt16").getPrimitiveValue().toValue());
+ }
assertNotNull(complexProperty.get("PropertyComp"));
innerComplexProperty = complexProperty.get("PropertyComp").getComplexValue();
@@ -572,7 +657,11 @@
assertEquals(2, newEntity.getProperty("CollPropertyComp").getCollectionValue().size());
final Iterator<ClientValue> iter = newEntity.getProperty("CollPropertyComp").getCollectionValue().iterator();
final ClientComplexValue complexProperty1 = iter.next().asComplex();
- assertEquals(1, complexProperty1.get("PropertyInt16").getPrimitiveValue().toValue());
+ if (isJson()) {
+ assertEquals(1, complexProperty1.get("PropertyInt16").getPrimitiveValue().toValue());
+ } else {
+ assertEquals((short)1, complexProperty1.get("PropertyInt16").getPrimitiveValue().toValue());
+ }
assertNotNull(complexProperty1.get("PropertyComp"));
final ClientComplexValue innerComplexProperty1 = complexProperty1.get("PropertyComp").getComplexValue();
assertEquals("1", innerComplexProperty1.get("PropertyString").getPrimitiveValue().toValue());
@@ -598,8 +687,14 @@
assertNotNull(complexProperty2.get("PropertyComp"));
final ClientComplexValue innerComplexProperty2 = complexProperty2.get("PropertyComp").getComplexValue();
assertEquals("2", innerComplexProperty2.get("PropertyString").getPrimitiveValue().toValue());
- assertEquals(2, innerComplexProperty2.get("PropertyInt16").getPrimitiveValue().toValue());
- assertEquals(Double.valueOf(2), innerComplexProperty2.get("PropertySingle").getPrimitiveValue().toValue());
+ if(isJson()) {
+ assertEquals(2, innerComplexProperty2.get("PropertyInt16").getPrimitiveValue().toValue());
+ assertEquals(Double.valueOf(2), innerComplexProperty2.get("PropertySingle").getPrimitiveValue().toValue());
+ } else {
+ assertEquals((short)2, innerComplexProperty2.get("PropertyInt16").getPrimitiveValue().toValue());
+ assertEquals(Float.valueOf(2), innerComplexProperty2.get("PropertySingle").getPrimitiveValue().toValue());
+ }
+
assertTrue(innerComplexProperty2.get("PropertyBinary").hasNullValue());
assertTrue(innerComplexProperty2.get("PropertyBoolean").hasNullValue());
assertTrue(innerComplexProperty2.get("PropertyByte").hasNullValue());
@@ -620,7 +715,7 @@
@Test
public void complexPropertyWithNotNullablePrimitiveValue() {
- final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
+ final ODataClient client = getClient(SERVICE_URI);
final ClientObjectFactory of = client.getObjectFactory();
// PropertyComp is null, but the primitive values in PropertyComp must not be null
@@ -637,7 +732,7 @@
@Test
public void upsert() throws EdmPrimitiveTypeException {
- final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
+ final EdmEnabledODataClient client = getClient(SERVICE_URI);
final ClientObjectFactory of = client.getObjectFactory();
final ClientEntity entity = of.newEntity(new FullQualifiedName("olingo.odata.test1", "ETTwoPrim"));
@@ -669,7 +764,7 @@
@Test
public void updatePropertyWithNull() {
- final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
+ final ODataClient client = getClient(SERVICE_URI);
final ClientObjectFactory of = client.getObjectFactory();
final URI targetURI = client.newURIBuilder(SERVICE_URI)
@@ -681,18 +776,20 @@
entity.getProperties().add(of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder()
.buildString(null)));
- final ODataEntityUpdateResponse<ClientEntity> updateResponse = client.getCUDRequestFactory()
- .getEntityUpdateRequest(targetURI, UpdateType.PATCH, entity)
- .execute();
+ ODataEntityUpdateRequest<ClientEntity> request = client.getCUDRequestFactory()
+ .getEntityUpdateRequest(targetURI, UpdateType.PATCH, entity);
+ request.setPrefer(getClient().newPreferences().returnRepresentation());
+ final ODataEntityUpdateResponse<ClientEntity> response = request.execute();
- assertEquals(HttpStatusCode.OK.getStatusCode(), updateResponse.getStatusCode());
- assertTrue(updateResponse.getBody().getProperty("PropertyString").hasNullValue());
- assertEquals(34, updateResponse.getBody().getProperty("PropertyDecimal").getPrimitiveValue().toValue());
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
+ assertEquals("return=representation", response.getHeader(HttpHeader.PREFERENCE_APPLIED).iterator().next());
+ assertTrue(response.getBody().getProperty("PropertyString").hasNullValue());
+ assertShortOrInt(34, response.getBody().getProperty("PropertyDecimal").getPrimitiveValue().toValue());
}
@Test(expected = ODataClientErrorException.class)
public void updatePropertyWithNullNotAllowed() {
- final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
+ final EdmEnabledODataClient client = getClient(SERVICE_URI);
final ClientObjectFactory of = client.getObjectFactory();
final URI targetURI = client.newURIBuilder(SERVICE_URI)
@@ -709,9 +806,9 @@
@Test
public void updateMerge() {
- final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
+ final EdmEnabledODataClient client = getClient(SERVICE_URI);
final ClientObjectFactory of = client.getObjectFactory();
-
+
final URI targetURI = client.newURIBuilder(SERVICE_URI)
.appendEntitySetSegment("ESKeyNav")
.appendKeySegment(1)
@@ -743,23 +840,23 @@
.expand("NavPropertyETKeyNavOne", "NavPropertyETKeyNavMany")
.build());
entityRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
- final ODataRetrieveResponse<ClientEntity> entitytResponse = entityRequest.execute();
+ final ODataRetrieveResponse<ClientEntity> entityResponse = entityRequest.execute();
- assertEquals(HttpStatusCode.OK.getStatusCode(), entitytResponse.getStatusCode());
- assertEquals(1, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavOne")
+ assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode());
+ assertShortOrInt(1, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavOne")
.asInlineEntity()
.getEntity()
.getProperty("PropertyInt16")
.getPrimitiveValue()
.toValue());
- assertEquals(3, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
+ assertEquals(3, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
.asInlineEntitySet()
.getEntitySet()
.getEntities()
.size());
- assertEquals(1, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
+ assertShortOrInt(1, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
.asInlineEntitySet()
.getEntitySet()
.getEntities()
@@ -768,7 +865,7 @@
.getPrimitiveValue()
.toValue());
- assertEquals(2, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
+ assertShortOrInt(2, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
.asInlineEntitySet()
.getEntitySet()
.getEntities()
@@ -777,7 +874,7 @@
.getPrimitiveValue()
.toValue());
- assertEquals(3, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
+ assertShortOrInt(3, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
.asInlineEntitySet()
.getEntitySet()
.getEntities()
@@ -786,7 +883,7 @@
.getPrimitiveValue()
.toValue());
- final Iterator<ClientValue> collectionIterator = entitytResponse.getBody()
+ final Iterator<ClientValue> collectionIterator = entityResponse.getBody()
.getProperty("CollPropertyString")
.getCollectionValue()
.iterator();
@@ -794,7 +891,7 @@
assertEquals("Single entry!", collectionIterator.next().asPrimitive().toValue());
assertFalse(collectionIterator.hasNext());
- final ClientComplexValue complexValue = entitytResponse.getBody()
+ final ClientComplexValue complexValue = entityResponse.getBody()
.getProperty("PropertyCompAllPrim")
.getComplexValue();
@@ -803,7 +900,7 @@
@Test
public void updateReplace() {
- final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
+ final EdmEnabledODataClient client = getClient(SERVICE_URI);
final ClientObjectFactory of = client.getObjectFactory();
final URI targetURI = client.newURIBuilder(SERVICE_URI)
@@ -825,14 +922,14 @@
.add(of.newPrimitiveValueBuilder().buildString("Single entry!"))));
entity.getProperties().add(of.newComplexProperty("PropertyCompAllPrim",
of.newComplexValue("CTAllPrim")
- .add(of.newPrimitiveProperty("PropertyString",
- of.newPrimitiveValueBuilder().buildString("Changed")))));
+ .add(of.newPrimitiveProperty("PropertyString", of.newPrimitiveValueBuilder().buildString("Changed")))));
- final ODataEntityUpdateResponse<ClientEntity> response = client.getCUDRequestFactory()
- .getEntityUpdateRequest(targetURI, UpdateType.REPLACE, entity)
- .execute();
-
- assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
+ ODataEntityUpdateRequest<ClientEntity> request = client.getCUDRequestFactory()
+ .getEntityUpdateRequest(targetURI, UpdateType.REPLACE, entity);
+ request.setPrefer(getClient().newPreferences().returnMinimal());
+ final ODataEntityUpdateResponse<ClientEntity> response = request.execute();
+ assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
+ assertEquals("return=minimal", response.getHeader(HttpHeader.PREFERENCE_APPLIED).iterator().next());
final String cookie = response.getHeader(HttpHeader.SET_COOKIE).iterator().next();
final ODataEntityRequest<ClientEntity> entityRequest = client.getRetrieveRequestFactory()
@@ -843,23 +940,23 @@
.expand("NavPropertyETKeyNavOne", "NavPropertyETKeyNavMany")
.build());
entityRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
- final ODataRetrieveResponse<ClientEntity> entitytResponse = entityRequest.execute();
+ final ODataRetrieveResponse<ClientEntity> entityResponse = entityRequest.execute();
- assertEquals(HttpStatusCode.OK.getStatusCode(), entitytResponse.getStatusCode());
- assertEquals(1, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavOne")
+ assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode());
+ assertShortOrInt(1, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavOne")
.asInlineEntity()
.getEntity()
.getProperty("PropertyInt16")
.getPrimitiveValue()
.toValue());
- assertEquals(3, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
+ assertEquals(3, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
.asInlineEntitySet()
.getEntitySet()
.getEntities()
.size());
- assertEquals(1, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
+ assertShortOrInt(1, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
.asInlineEntitySet()
.getEntitySet()
.getEntities()
@@ -868,7 +965,7 @@
.getPrimitiveValue()
.toValue());
- assertEquals(2, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
+ assertShortOrInt(2, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
.asInlineEntitySet()
.getEntitySet()
.getEntities()
@@ -877,7 +974,7 @@
.getPrimitiveValue()
.toValue());
- assertEquals(3, entitytResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
+ assertShortOrInt(3, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
.asInlineEntitySet()
.getEntitySet()
.getEntities()
@@ -886,7 +983,7 @@
.getPrimitiveValue()
.toValue());
- final Iterator<ClientValue> collectionIterator = entitytResponse.getBody()
+ final Iterator<ClientValue> collectionIterator = entityResponse.getBody()
.getProperty("CollPropertyString")
.getCollectionValue()
.iterator();
@@ -894,7 +991,7 @@
assertEquals("Single entry!", collectionIterator.next().asPrimitive().toValue());
assertFalse(collectionIterator.hasNext());
- final ClientComplexValue propCompAllPrim = entitytResponse.getBody()
+ final ClientComplexValue propCompAllPrim = entityResponse.getBody()
.getProperty("PropertyCompAllPrim")
.getComplexValue();
@@ -902,25 +999,374 @@
assertTrue(propCompAllPrim.get("PropertyInt16").hasNullValue());
assertTrue(propCompAllPrim.get("PropertyDate").hasNullValue());
- final ClientComplexValue propCompTwoPrim = entitytResponse.getBody()
+ final ClientComplexValue propCompTwoPrim = entityResponse.getBody()
.getProperty("PropertyCompTwoPrim")
.getComplexValue();
assertEquals("Must not be null", propCompTwoPrim.get("PropertyString").getPrimitiveValue().toValue());
- assertEquals(42, propCompTwoPrim.get("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(42, propCompTwoPrim.get("PropertyInt16").getPrimitiveValue().toValue());
- assertNotNull(entitytResponse.getBody().getProperty("PropertyCompNav").getComplexValue());
- assertTrue(entitytResponse.getBody()
+ assertNotNull(entityResponse.getBody().getProperty("PropertyCompNav").getComplexValue());
+ assertTrue(entityResponse.getBody()
.getProperty("PropertyCompNav")
.getComplexValue()
.get("PropertyInt16")
.hasNullValue());
}
+
+ @Test
+ public void createEntityWithIEEE754CompatibleParameter() {
+ final ODataClient client = getClient(SERVICE_URI);
+ client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
+ final ClientObjectFactory of = client.getObjectFactory();
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM).build();
+ final URI linkURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_PRIM)
+ .appendKeySegment(32767).build();
+
+ final ClientEntity newEntity = of.newEntity(ET_ALL_PRIM);
+ newEntity.getProperties().add(of.newPrimitiveProperty(PROPERTY_INT64,
+ of.newPrimitiveValueBuilder().buildInt64(Long.MAX_VALUE)));
+ newEntity.getProperties().add(of.newPrimitiveProperty(PROPERTY_DECIMAL,
+ of.newPrimitiveValueBuilder().buildDecimal(BigDecimal.valueOf(34))));
+ newEntity.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_PRIM_ONE, linkURI));
+
+ final ODataEntityCreateRequest<ClientEntity> request = client.getCUDRequestFactory()
+ .getEntityCreateRequest(uri, newEntity);
+ request.setContentType(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ request.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataEntityCreateResponse<ClientEntity> response = request.execute();
+
+ assertEquals(Long.MAX_VALUE, response.getBody().getProperty(PROPERTY_INT64).getPrimitiveValue().toValue());
+ assertEquals(BigDecimal.valueOf(34), response.getBody().getProperty(PROPERTY_DECIMAL)
+ .getPrimitiveValue().toValue());
+ }
+
+ @Test
+ public void createEntityWithIEEE754CompatibleParameterNull() {
+ final ODataClient client = getClient(SERVICE_URI);
+ client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
+ final ClientObjectFactory of = client.getObjectFactory();
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM).build();
+ final URI linkURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_PRIM)
+ .appendKeySegment(32767).build();
+
+ final ClientEntity newEntity = of.newEntity(ET_ALL_PRIM);
+ newEntity.getProperties().add(of.newPrimitiveProperty(PROPERTY_INT64,
+ of.newPrimitiveValueBuilder().buildInt64(null)));
+ newEntity.getProperties().add(of.newPrimitiveProperty(PROPERTY_DECIMAL,
+ of.newPrimitiveValueBuilder().buildDecimal(null)));
+ newEntity.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_PRIM_ONE, linkURI));
+
+ final ODataEntityCreateRequest<ClientEntity> request = client.getCUDRequestFactory()
+ .getEntityCreateRequest(uri, newEntity);
+ request.setContentType(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ request.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataEntityCreateResponse<ClientEntity> response = request.execute();
+
+ assertTrue(response.getBody().getProperty(PROPERTY_INT64).hasNullValue());
+ assertTrue(response.getBody().getProperty(PROPERTY_DECIMAL).hasNullValue());
+ }
+
+ @Test
+ public void updateEntityWithIEEE754CompatibleParameter() {
+ final ODataClient client = getClient(SERVICE_URI);
+ client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
+ final ClientObjectFactory of = client.getObjectFactory();
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM).appendKeySegment(0).build();
+
+ final ClientEntity entity = of.newEntity(ET_ALL_PRIM);
+ entity.getProperties().add(of.newPrimitiveProperty(PROPERTY_INT64,
+ of.newPrimitiveValueBuilder().buildInt64(Long.MAX_VALUE)));
+ entity.getProperties().add(of.newPrimitiveProperty(PROPERTY_DECIMAL,
+ of.newPrimitiveValueBuilder().buildDecimal(BigDecimal.valueOf(Long.MAX_VALUE))));
+
+ final ODataEntityUpdateRequest<ClientEntity> requestUpdate = client.getCUDRequestFactory()
+ .getEntityUpdateRequest(uri, UpdateType.PATCH, entity);
+ requestUpdate.setContentType(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ requestUpdate.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataEntityUpdateResponse<ClientEntity> responseUpdate = requestUpdate.execute();
+
+ String cookie = responseUpdate.getHeader(HttpHeader.SET_COOKIE).iterator().next();
+
+ final ODataEntityRequest<ClientEntity> requestGet = client.getRetrieveRequestFactory().getEntityRequest(uri);
+ requestGet.addCustomHeader(HttpHeader.COOKIE, cookie);
+ requestGet.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataRetrieveResponse<ClientEntity> responseGet = requestGet.execute();
+
+ assertEquals(Long.MAX_VALUE, responseGet.getBody().getProperty(PROPERTY_INT64).getPrimitiveValue().toValue());
+ assertEquals(BigDecimal.valueOf(Long.MAX_VALUE), responseGet.getBody().getProperty(PROPERTY_DECIMAL)
+ .getPrimitiveValue()
+ .toValue());
+ }
+
+ @Test
+ public void updateEntityWithIEEE754CompatibleParameterNull() {
+ final ODataClient client = getClient(SERVICE_URI);
+ client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
+ final ClientObjectFactory of = client.getObjectFactory();
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM).appendKeySegment(0).build();
+
+ final ClientEntity entity = of.newEntity(ET_ALL_PRIM);
+ entity.getProperties().add(of.newPrimitiveProperty(PROPERTY_INT64,
+ of.newPrimitiveValueBuilder().buildInt64(null)));
+ entity.getProperties().add(of.newPrimitiveProperty(PROPERTY_DECIMAL,
+ of.newPrimitiveValueBuilder().buildDecimal(null)));
+
+ final ODataEntityUpdateRequest<ClientEntity> requestUpdate = client.getCUDRequestFactory()
+ .getEntityUpdateRequest(uri, UpdateType.PATCH, entity);
+ requestUpdate.setContentType(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ requestUpdate.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataEntityUpdateResponse<ClientEntity> responseUpdate = requestUpdate.execute();
+
+ String cookie = responseUpdate.getHeader(HttpHeader.SET_COOKIE).iterator().next();
+
+ final ODataEntityRequest<ClientEntity> requestGet = client.getRetrieveRequestFactory().getEntityRequest(uri);
+ requestGet.addCustomHeader(HttpHeader.COOKIE, cookie);
+ requestGet.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataRetrieveResponse<ClientEntity> responseGet = requestGet.execute();
+
+ assertTrue(responseGet.getBody().getProperty(PROPERTY_INT64).hasNullValue());
+ assertTrue(responseGet.getBody().getProperty(PROPERTY_DECIMAL).hasNullValue());
+ }
+
+ @Test
+ public void updateEntityWithIEEE754CompatibleParameterWithNullString() {
+ final ODataClient client = getClient(SERVICE_URI);
+ client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
+ final ClientObjectFactory of = client.getObjectFactory();
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM).appendKeySegment(0).build();
+
+ final ClientEntity entity = of.newEntity(ET_ALL_PRIM);
+ entity.getProperties().add(of.newPrimitiveProperty(PROPERTY_INT64,
+ of.newPrimitiveValueBuilder().buildString("null")));
+ entity.getProperties().add(of.newPrimitiveProperty(PROPERTY_DECIMAL,
+ of.newPrimitiveValueBuilder().buildString("null")));
+
+ final ODataEntityUpdateRequest<ClientEntity> requestUpdate = client.getCUDRequestFactory()
+ .getEntityUpdateRequest(uri, UpdateType.PATCH, entity);
+ requestUpdate.setContentType(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ requestUpdate.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+
+ try {
+ requestUpdate.execute();
+ fail();
+ } catch(ODataClientErrorException e) {
+ assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode());
+ }
+ }
+
+ @Test
+ public void updateEdmInt64PropertyWithIEE754CompatibleParameter() {
+ final ODataClient client = getClient(SERVICE_URI);
+ client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
+ final ClientObjectFactory of = client.getObjectFactory();
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM)
+ .appendKeySegment(0)
+ .appendPropertySegment(PROPERTY_INT64).build();
+
+ final ODataPropertyUpdateRequest requestUpdate = client.getCUDRequestFactory()
+ .getPropertyPrimitiveValueUpdateRequest(uri,
+ of.newPrimitiveProperty(PROPERTY_INT64,
+ of.newPrimitiveValueBuilder().buildInt64(Long.MAX_VALUE)));
+
+ requestUpdate.setContentType(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ requestUpdate.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataPropertyUpdateResponse responseUpdate = requestUpdate.execute();
+ String cookie = responseUpdate.getHeader(HttpHeader.SET_COOKIE).iterator().next();
+
+ final ODataPropertyRequest<ClientProperty> requestGet = client.getRetrieveRequestFactory().getPropertyRequest(uri);
+ requestGet.addCustomHeader(HttpHeader.COOKIE, cookie);
+ requestGet.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataRetrieveResponse<ClientProperty> responseGet = requestGet.execute();
+
+ assertEquals(Long.MAX_VALUE, responseGet.getBody().getPrimitiveValue().toValue());
+ }
+
+ @Test
+ public void updateComplexPropertyWithIEEE754CompatibleParamter() {
+ final ODataClient client = getClient(SERVICE_URI);
+ client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
+ final ClientObjectFactory of = client.getObjectFactory();
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV)
+ .appendKeySegment(1)
+ .appendPropertySegment(PROPERTY_COMP_ALL_PRIM).build();
+
+ final ODataPropertyUpdateRequest requestUpdate = client.getCUDRequestFactory()
+ .getPropertyComplexValueUpdateRequest(uri, UpdateType.PATCH,
+ of.newComplexProperty(PROPERTY_COMP_ALL_PRIM,
+ of.newComplexValue("CTAllPrim")
+ .add(of.newPrimitiveProperty(PROPERTY_INT64,
+ of.newPrimitiveValueBuilder().buildInt64(Long.MIN_VALUE)))
+ .add(of.newPrimitiveProperty(PROPERTY_DECIMAL,
+ of.newPrimitiveValueBuilder().buildDecimal(BigDecimal.valueOf(12345678912L))))
+ .add(of.newPrimitiveProperty(PROPERTY_INT16,
+ of.newPrimitiveValueBuilder().buildInt16((short) 2)))));
+
+ requestUpdate.setContentType(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ requestUpdate.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataPropertyUpdateResponse responseUpdate = requestUpdate.execute();
+ String cookie = responseUpdate.getHeader(HttpHeader.SET_COOKIE).iterator().next();
+
+ final ODataPropertyRequest<ClientProperty> requestGet = client.getRetrieveRequestFactory().getPropertyRequest(uri);
+ requestGet.addCustomHeader(HttpHeader.COOKIE, cookie);
+ requestGet.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataRetrieveResponse<ClientProperty> responseGet = requestGet.execute();
+
+ final ClientComplexValue complexValue = responseGet.getBody().getComplexValue();
+
+ assertEquals(Long.MIN_VALUE, complexValue.get(PROPERTY_INT64).getPrimitiveValue().toValue());
+ assertEquals(BigDecimal.valueOf(12345678912L), complexValue.get(PROPERTY_DECIMAL).getPrimitiveValue().toValue());
+ assertEquals(2, complexValue.get(PROPERTY_INT16).getPrimitiveValue().toValue());
+ }
+
+ @Test
+ public void updateProperyEdmDecimaltWithIEE754CompatibleParameter() {
+ final ODataClient client = getClient(SERVICE_URI);
+ client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
+ final ClientObjectFactory of = client.getObjectFactory();
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM)
+ .appendKeySegment(0)
+ .appendPropertySegment(PROPERTY_DECIMAL).build();
+
+ final ODataPropertyUpdateRequest requestUpdate = client.getCUDRequestFactory()
+ .getPropertyPrimitiveValueUpdateRequest(uri,
+ of.newPrimitiveProperty(PROPERTY_DECIMAL,
+ of.newPrimitiveValueBuilder().buildInt64(Long.MAX_VALUE)));
+
+ requestUpdate.setContentType(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ requestUpdate.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataPropertyUpdateResponse responseUpdate = requestUpdate.execute();
+ String cookie = responseUpdate.getHeader(HttpHeader.SET_COOKIE).iterator().next();
+
+ final ODataPropertyRequest<ClientProperty> requestGet = client.getRetrieveRequestFactory().getPropertyRequest(uri);
+ requestGet.addCustomHeader(HttpHeader.COOKIE, cookie);
+ requestGet.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataRetrieveResponse<ClientProperty> responseGet = requestGet.execute();
+
+ assertEquals(BigDecimal.valueOf(Long.MAX_VALUE), responseGet.getBody().getPrimitiveValue().toValue());
+ }
+
+ @Test
+ public void readESAllPrimCollectionWithIEEE754CompatibleParameter() {
+ final ODataClient client = getClient(SERVICE_URI);
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM)
+ .orderBy(PROPERTY_INT16)
+ .build();
+
+ final ODataEntitySetRequest<ClientEntitySet> request = client.getRetrieveRequestFactory().getEntitySetRequest(uri);
+ request.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataRetrieveResponse<ClientEntitySet> response = request.execute();
+
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
+ final List<ClientEntity> entities = response.getBody().getEntities();
+ assertEquals(3, entities.size());
+
+ ClientEntity entity = entities.get(0);
+ assertEquals(-32768, entity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertEquals(Long.MIN_VALUE, entity.getProperty(PROPERTY_INT64).getPrimitiveValue().toValue());
+ assertEquals(BigDecimal.valueOf(-34), entity.getProperty(PROPERTY_DECIMAL).getPrimitiveValue().toValue());
+
+ entity = entities.get(1);
+ assertEquals(0, entity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertEquals(0L, entity.getProperty(PROPERTY_INT64).getPrimitiveValue().toValue());
+ assertEquals(BigDecimal.valueOf(0), entity.getProperty(PROPERTY_DECIMAL).getPrimitiveValue().toValue());
+
+ entity = entities.get(2);
+ assertEquals(32767, entity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertEquals(Long.MAX_VALUE, entity.getProperty(PROPERTY_INT64).getPrimitiveValue().toValue());
+ assertEquals(BigDecimal.valueOf(34), entity.getProperty(PROPERTY_DECIMAL).getPrimitiveValue().toValue());
+ }
+
+ @Test
+ public void readESKeyNavCheckComplexPropertyWithIEEE754CompatibleParameter() {
+ final ODataClient client = getClient(SERVICE_URI);
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(1).build();
+
+ final ODataEntityRequest<ClientEntity> request = client.getRetrieveRequestFactory().getEntityRequest(uri);
+ request.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataRetrieveResponse<ClientEntity> response = request.execute();
+
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
+ assertEquals(1, response.getBody().getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+
+ assertEquals(BigDecimal.valueOf(34), response.getBody().getProperty(PROPERTY_COMP_ALL_PRIM)
+ .getComplexValue()
+ .get(PROPERTY_DECIMAL)
+ .getPrimitiveValue()
+ .toValue());
+
+ assertEquals(Long.MAX_VALUE, response.getBody().getProperty(PROPERTY_COMP_ALL_PRIM)
+ .getComplexValue()
+ .get(PROPERTY_INT64)
+ .getPrimitiveValue()
+ .toValue());
+ }
+
+ @Test
+ public void readESKEyNavComplexPropertyWithIEEE754CompatibleParameter() {
+ final ODataClient client = getClient(SERVICE_URI);
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV)
+ .appendKeySegment(1)
+ .appendNavigationSegment(PROPERTY_COMP_ALL_PRIM)
+ .build();
+ ODataPropertyRequest<ClientProperty> request = client.getRetrieveRequestFactory().getPropertyRequest(uri);
+ request.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataRetrieveResponse<ClientProperty> response = request.execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
+
+ assertEquals(BigDecimal.valueOf(34), response.getBody().getComplexValue()
+ .get(PROPERTY_DECIMAL)
+ .getPrimitiveValue()
+ .toValue());
+
+ assertEquals(Long.MAX_VALUE, response.getBody().getComplexValue()
+ .get(PROPERTY_INT64)
+ .getPrimitiveValue()
+ .toValue());
+ }
+
+ @Test
+ @Ignore
+ public void readEdmInt64PropertyWithIEEE754ComaptibleParameter() {
+ final ODataClient client = getClient(SERVICE_URI);
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV)
+ .appendKeySegment(1)
+ .appendPropertySegment(PROPERTY_COMP_ALL_PRIM)
+ .appendPropertySegment(PROPERTY_INT64)
+ .build();
+ ODataPropertyRequest<ClientProperty> request = client.getRetrieveRequestFactory().getPropertyRequest(uri);
+ request.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataRetrieveResponse<ClientProperty> response = request.execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
+
+ assertEquals(Long.MAX_VALUE, response.getBody().getPrimitiveValue().toValue());
+ }
+
+ @Test
+ @Ignore
+ public void readEdmDecimalPropertyWithIEEE754ComaptibleParameter() {
+ final ODataClient client = getClient(SERVICE_URI);
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV)
+ .appendKeySegment(1)
+ .appendPropertySegment(PROPERTY_COMP_ALL_PRIM)
+ .appendPropertySegment(PROPERTY_DECIMAL)
+ .build();
+ ODataPropertyRequest<ClientProperty> request = client.getRetrieveRequestFactory().getPropertyRequest(uri);
+ request.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
+ final ODataRetrieveResponse<ClientProperty> response = request.execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
+
+ assertEquals(BigDecimal.valueOf(34), response.getBody().getPrimitiveValue().toValue());
+ }
@Override
protected ODataClient getClient() {
ODataClient odata = ODataClientFactory.getClient();
- odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
return odata;
}
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.JSON);
+ }
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicXmlITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicXmlITCase.java
new file mode 100644
index 0000000..4398c60
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicXmlITCase.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.fit.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class BasicXmlITCase extends BasicITCase {
+
+ @Override
+ protected ODataClient getClient() {
+ ODataClient odata = ODataClientFactory.getClient();
+ odata.getConfiguration().setDefaultPubFormat(ContentType.APPLICATION_ATOM_XML);
+ return odata;
+ }
+
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_ATOM_XML.toContentTypeString()));
+ }
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.APPLICATION_ATOM_XML);
+ }
+}
\ No newline at end of file
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BatchClientITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BatchClientITCase.java
index 72a4ef3..970a4d9 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BatchClientITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BatchClientITCase.java
@@ -18,9 +18,11 @@
*/
package org.apache.olingo.fit.tecsvc.client;
+import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.net.URI;
@@ -48,19 +50,18 @@
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.uri.URIBuilder;
import org.apache.olingo.client.core.communication.request.batch.ODataChangesetResponseItem;
+import org.apache.olingo.commons.api.format.PreferenceName;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
-import org.apache.olingo.fit.v4.AbstractTestITCase;
+import org.apache.olingo.fit.base.AbstractTestITCase;
import org.junit.Before;
import org.junit.Test;
public class BatchClientITCase extends AbstractTestITCase {
- private final static String ACCEPT = ContentType.APPLICATION_OCTET_STREAM.toContentTypeString();
private static final String SERVICE_URI = TecSvcConst.BASE_URI;
private static final String SERVICE_NAMESPACE = "olingo.odata.test1";
private static final String ES_NOT_AVAILABLE_NAME = "ESNotAvailable";
@@ -70,6 +71,7 @@
@Before
public void setup() {
+ client.getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
client.getConfiguration().setContinueOnError(false);
}
@@ -98,7 +100,6 @@
entity.getProperties().add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder()
.buildString("1")));
final ODataBatchRequest batchRequest = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
- batchRequest.setAccept(ACCEPT);
final BatchManager payloadManager = batchRequest.payloadManager();
final ODataChangeset changeset = payloadManager.addChangeset();
final URI targetURI = client.newURIBuilder(SERVICE_URI)
@@ -123,19 +124,22 @@
assertTrue(changeSetResponse.isBreaking());
assertEquals(HttpStatusCode.NOT_FOUND.getStatusCode(), updateResponse.getStatusCode());
- assertEquals(ODataFormat.JSON.toString(), updateResponse.getContentType());
+ assertContentType(updateResponse.getContentType());
}
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_JSON.toContentTypeString()));
+ }
+
@Test
public void emptyBatchRequest() {
// create your request
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
- request.setAccept(ACCEPT);
final BatchManager payload = request.payloadManager();
final ODataBatchResponse response = payload.getResponse();
- assertEquals(202, response.getStatusCode());
+ assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode());
assertEquals("Accepted", response.getStatusMessage());
final Iterator<ODataBatchResponseItem> iter = response.getBody();
@@ -145,7 +149,6 @@
@Test
public void getBatchRequestWithRelativeUris() throws URISyntaxException {
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
- request.setAccept(ACCEPT);
final BatchManager payload = request.payloadManager();
@@ -155,7 +158,7 @@
// Fetch result
final ODataBatchResponse response = payload.getResponse();
- assertEquals(202, response.getStatusCode());
+ assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode());
assertEquals("Accepted", response.getStatusMessage());
final Iterator<ODataBatchResponseItem> iter = response.getBody();
@@ -164,20 +167,19 @@
ODataBatchResponseItem item = iter.next();
assertFalse(item.isChangeset());
- ODataResponse oDataResonse = item.next();
- assertNotNull(oDataResonse);
- assertEquals(HttpStatusCode.OK.getStatusCode(), oDataResonse.getStatusCode());
- assertEquals(1, oDataResonse.getHeader("OData-Version").size());
- assertEquals("4.0", oDataResonse.getHeader("OData-Version").toArray()[0]);
- assertEquals(1, oDataResonse.getHeader("Content-Length").size());
- assertEquals("605", oDataResonse.getHeader("Content-Length").toArray()[0]);
- assertEquals("application/json;odata.metadata=minimal", oDataResonse.getContentType());
+ ODataResponse oDataResponse = item.next();
+ assertNotNull(oDataResponse);
+ assertEquals(HttpStatusCode.OK.getStatusCode(), oDataResponse.getStatusCode());
+ assertEquals(1, oDataResponse.getHeader("OData-Version").size());
+ assertEquals("4.0", oDataResponse.getHeader("OData-Version").toArray()[0]);
+ assertEquals(1, oDataResponse.getHeader("Content-Length").size());
+ assertEquals("605", oDataResponse.getHeader("Content-Length").toArray()[0]);
+ assertEquals(ContentType.JSON.toContentTypeString(), oDataResponse.getContentType());
}
@Test
public void getBatchRequest() throws URISyntaxException {
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
- request.setAccept(ACCEPT);
final BatchManager payload = request.payloadManager();
@@ -187,7 +189,7 @@
// Fetch result
final ODataBatchResponse response = payload.getResponse();
- assertEquals(202, response.getStatusCode());
+ assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode());
assertEquals("Accepted", response.getStatusMessage());
final Iterator<ODataBatchResponseItem> iter = response.getBody();
@@ -196,20 +198,19 @@
ODataBatchResponseItem item = iter.next();
assertFalse(item.isChangeset());
- ODataResponse oDataResonse = item.next();
- assertNotNull(oDataResonse);
- assertEquals(HttpStatusCode.OK.getStatusCode(), oDataResonse.getStatusCode());
- assertEquals(1, oDataResonse.getHeader("OData-Version").size());
- assertEquals("4.0", oDataResonse.getHeader("OData-Version").toArray()[0]);
- assertEquals(1, oDataResonse.getHeader("Content-Length").size());
- assertEquals("605", oDataResonse.getHeader("Content-Length").toArray()[0]);
- assertEquals("application/json;odata.metadata=minimal", oDataResonse.getContentType());
+ ODataResponse oDataResponse = item.next();
+ assertNotNull(oDataResponse);
+ assertEquals(HttpStatusCode.OK.getStatusCode(), oDataResponse.getStatusCode());
+ assertEquals(1, oDataResponse.getHeader("OData-Version").size());
+ assertEquals("4.0", oDataResponse.getHeader("OData-Version").toArray()[0]);
+ assertEquals(1, oDataResponse.getHeader("Content-Length").size());
+ assertEquals("605", oDataResponse.getHeader("Content-Length").toArray()[0]);
+ assertEquals(ContentType.JSON.toContentTypeString(), oDataResponse.getContentType());
}
@Test
public void testErrorWithoutContinueOnErrorPreferHeader() throws URISyntaxException {
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
- request.setAccept(ACCEPT);
final BatchManager payload = request.payloadManager();
@@ -219,7 +220,7 @@
// Fetch result
final ODataBatchResponse response = payload.getResponse();
- assertEquals(202, response.getStatusCode());
+ assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode());
final Iterator<ODataBatchResponseItem> iter = response.getBody();
@@ -228,23 +229,23 @@
ODataBatchResponseItem item = iter.next();
assertFalse(item.isChangeset());
- ODataResponse oDataResonse = item.next();
- assertNotNull(oDataResonse);
- assertEquals(HttpStatusCode.OK.getStatusCode(), oDataResonse.getStatusCode());
- assertEquals(1, oDataResonse.getHeader("OData-Version").size());
- assertEquals("4.0", oDataResonse.getHeader("OData-Version").toArray()[0]);
- assertEquals(1, oDataResonse.getHeader("Content-Length").size());
- assertEquals("605", oDataResonse.getHeader("Content-Length").toArray()[0]);
- assertEquals("application/json;odata.metadata=minimal", oDataResonse.getContentType());
+ ODataResponse oDataResponse = item.next();
+ assertNotNull(oDataResponse);
+ assertEquals(HttpStatusCode.OK.getStatusCode(), oDataResponse.getStatusCode());
+ assertEquals(1, oDataResponse.getHeader("OData-Version").size());
+ assertEquals("4.0", oDataResponse.getHeader("OData-Version").toArray()[0]);
+ assertEquals(1, oDataResponse.getHeader("Content-Length").size());
+ assertEquals("605", oDataResponse.getHeader("Content-Length").toArray()[0]);
+ assertEquals(ContentType.JSON.toContentTypeString(), oDataResponse.getContentType());
// Check second get request
assertTrue(iter.hasNext());
item = iter.next();
assertFalse(item.isChangeset());
- oDataResonse = item.next();
- assertNotNull(oDataResonse);
- assertEquals(HttpStatusCode.NOT_FOUND.getStatusCode(), oDataResonse.getStatusCode());
+ oDataResponse = item.next();
+ assertNotNull(oDataResponse);
+ assertEquals(HttpStatusCode.NOT_FOUND.getStatusCode(), oDataResponse.getStatusCode());
// Check if third request is available
assertFalse(iter.hasNext());
@@ -253,17 +254,16 @@
@Test
public void testInvalidAbsoluteUri() throws URISyntaxException {
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
- request.setAccept(ACCEPT);
final BatchManager payload = request.payloadManager();
final URI uri = new URI(SERVICE_URI + "/../ESAllPrim(32767)");
final ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(uri);
- queryReq.setFormat(ODataFormat.JSON);
+ queryReq.setFormat(ContentType.JSON);
payload.addRequest(queryReq);
// Fetch result
final ODataBatchResponse response = payload.getResponse();
- assertEquals(202, response.getStatusCode());
+ assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode());
final Iterator<ODataBatchResponseItem> bodyIterator = response.getBody();
assertTrue(bodyIterator.hasNext());
@@ -272,18 +272,17 @@
assertFalse(item.isChangeset());
final ODataResponse oDataResponse = item.next();
- assertEquals(400, oDataResponse.getStatusCode());
+ assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), oDataResponse.getStatusCode());
}
@Test(expected = HttpClientException.class)
public void testInvalidHost() throws URISyntaxException {
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
- request.setAccept(ACCEPT);
final BatchManager payload = request.payloadManager();
final URI uri = new URI("http://otherhost/odata/ESAllPrim(32767)");
final ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(uri);
- queryReq.setFormat(ODataFormat.JSON);
+ queryReq.setFormat(ContentType.JSON);
payload.addRequest(queryReq);
// Fetch result
@@ -293,12 +292,11 @@
@Test(expected = HttpClientException.class)
public void testInvalidAbsoluteRequest() throws URISyntaxException {
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
- request.setAccept(ACCEPT);
final BatchManager payload = request.payloadManager();
final URI uri = new URI("/ESAllPrim(32767)");
final ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(uri);
- queryReq.setFormat(ODataFormat.JSON);
+ queryReq.setFormat(ContentType.JSON);
payload.addRequest(queryReq);
// Fetch result
@@ -306,10 +304,9 @@
}
@Test
- public void testErrorWithContinueOnErrorPreferHeader() throws URISyntaxException {
+ public void errorWithContinueOnErrorPreferHeader() throws Exception {
client.getConfiguration().setContinueOnError(true);
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
- request.setAccept(ACCEPT);
final BatchManager payload = request.payloadManager();
@@ -319,7 +316,9 @@
// Fetch result
final ODataBatchResponse response = payload.getResponse();
- assertEquals(202, response.getStatusCode());
+ assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode());
+ assertEquals(PreferenceName.CONTINUE_ON_ERROR.getName(),
+ response.getHeader(HttpHeader.PREFERENCE_APPLIED).iterator().next());
final Iterator<ODataBatchResponseItem> bodyIterator = response.getBody();
@@ -328,46 +327,44 @@
ODataBatchResponseItem item = bodyIterator.next();
assertFalse(item.isChangeset());
- ODataResponse oDataResonse = item.next();
- assertNotNull(oDataResonse);
- assertEquals(HttpStatusCode.OK.getStatusCode(), oDataResonse.getStatusCode());
- assertEquals(1, oDataResonse.getHeader("OData-Version").size());
- assertEquals("4.0", oDataResonse.getHeader("OData-Version").toArray()[0]);
- assertEquals(1, oDataResonse.getHeader("Content-Length").size());
- assertEquals("605", oDataResonse.getHeader("Content-Length").toArray()[0]);
- assertEquals("application/json;odata.metadata=minimal", oDataResonse.getContentType());
+ ODataResponse oDataResponse = item.next();
+ assertNotNull(oDataResponse);
+ assertEquals(HttpStatusCode.OK.getStatusCode(), oDataResponse.getStatusCode());
+ assertEquals(1, oDataResponse.getHeader(HttpHeader.ODATA_VERSION).size());
+ assertEquals("4.0", oDataResponse.getHeader(HttpHeader.ODATA_VERSION).toArray()[0]);
+ assertEquals(1, oDataResponse.getHeader(HttpHeader.CONTENT_LENGTH).size());
+ assertEquals("605", oDataResponse.getHeader(HttpHeader.CONTENT_LENGTH).toArray()[0]);
+ assertEquals(ContentType.JSON.toContentTypeString(), oDataResponse.getContentType());
// Check second get request
assertTrue(bodyIterator.hasNext());
item = bodyIterator.next();
assertFalse(item.isChangeset());
- oDataResonse = item.next();
- assertNotNull(oDataResonse);
- assertEquals(HttpStatusCode.NOT_FOUND.getStatusCode(), oDataResonse.getStatusCode());
+ oDataResponse = item.next();
+ assertNotNull(oDataResponse);
+ assertEquals(HttpStatusCode.NOT_FOUND.getStatusCode(), oDataResponse.getStatusCode());
// Check if third request is available
assertTrue(bodyIterator.hasNext());
item = bodyIterator.next();
assertFalse(item.isChangeset());
- oDataResonse = item.next();
- assertNotNull(oDataResonse);
- assertEquals(HttpStatusCode.OK.getStatusCode(), oDataResonse.getStatusCode());
- assertEquals(1, oDataResonse.getHeader("OData-Version").size());
- assertEquals("4.0", oDataResonse.getHeader("OData-Version").toArray()[0]);
- assertEquals(1, oDataResonse.getHeader("Content-Length").size());
- assertEquals("513", oDataResonse.getHeader("Content-Length").toArray()[0]);
- assertEquals("application/json;odata.metadata=minimal", oDataResonse.getContentType());
+ oDataResponse = item.next();
+ assertNotNull(oDataResponse);
+ assertEquals(HttpStatusCode.OK.getStatusCode(), oDataResponse.getStatusCode());
+ assertEquals(1, oDataResponse.getHeader(HttpHeader.ODATA_VERSION).size());
+ assertEquals("4.0", oDataResponse.getHeader(HttpHeader.ODATA_VERSION).iterator().next());
+ assertEquals(1, oDataResponse.getHeader(HttpHeader.CONTENT_LENGTH).size());
+ assertEquals("517", oDataResponse.getHeader(HttpHeader.CONTENT_LENGTH).iterator().next());
+ assertEquals(ContentType.JSON.toContentTypeString(), oDataResponse.getContentType());
}
@Test
- @SuppressWarnings("unchecked")
public void changesetWithReferences() throws EdmPrimitiveTypeException, URISyntaxException {
// create your request
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
final ClientObjectFactory of = client.getObjectFactory();
- request.setAccept(ACCEPT);
final BatchManager streamManager = request.payloadManager();
final ODataChangeset changeset = streamManager.addChangeset();
@@ -389,7 +386,7 @@
// add create request
final ODataEntityCreateRequest<ClientEntity> createReq =
client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), entityESAllPrim);
- createReq.setFormat(ODataFormat.JSON);
+ createReq.setFormat(ContentType.JSON);
changeset.addRequest(createReq);
// retrieve request reference
@@ -403,7 +400,7 @@
final ODataEntityUpdateRequest<ClientEntity> updateReq = client.getCUDRequestFactory().getEntityUpdateRequest(
URI.create("$" + createRequestRef), UpdateType.PATCH, entityUpdate);
- updateReq.setFormat(ODataFormat.JSON);
+ updateReq.setFormat(ContentType.JSON);
changeset.addRequest(updateReq);
@@ -421,7 +418,7 @@
ODataResponse res = chgitem.next();
assertEquals(HttpStatusCode.CREATED.getStatusCode(), res.getStatusCode());
assertTrue(res instanceof ODataEntityCreateResponse);
- final ODataEntityCreateResponse<ClientEntity> createResponse = ((ODataEntityCreateResponse<ClientEntity>) res);
+ final ODataEntityCreateResponse<?> createResponse = ((ODataEntityCreateResponse<?>) res);
res = chgitem.next();
assertEquals(HttpStatusCode.OK.getStatusCode(), res.getStatusCode());
@@ -429,7 +426,7 @@
final ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().getEntitySetRequest(
new URI(createResponse.getHeader(HttpHeader.LOCATION).iterator().next() + "/NavPropertyETTwoPrimMany"));
- req.setFormat(ODataFormat.JSON);
+ req.setFormat(ContentType.JSON);
req.addCustomHeader(HttpHeader.COOKIE, cookie);
final ODataRetrieveResponse<ClientEntitySet> getResponse = req.execute();
@@ -442,11 +439,9 @@
}
@Test
- @SuppressWarnings("unchecked")
public void changesetBatchRequest() throws URISyntaxException {
final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(SERVICE_URI);
final ClientObjectFactory of = client.getObjectFactory();
- request.setAccept(ACCEPT);
final BatchManager payload = request.payloadManager();
// -----------------------------
@@ -478,7 +473,7 @@
final ODataEntityCreateRequest<ClientEntity> createRequest =
client.getCUDRequestFactory().getEntityCreateRequest(editLink, postEntity);
- createRequest.setFormat(ODataFormat.JSON);
+ createRequest.setFormat(ContentType.JSON);
changeset.addRequest(createRequest);
@@ -497,7 +492,7 @@
ODataEntityUpdateRequest<ClientEntity> changeReq =
client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patchEntity);
- changeReq.setFormat(ODataFormat.JSON);
+ changeReq.setFormat(ContentType.JSON);
changeset.addRequest(changeReq);
// ------------------------
@@ -518,7 +513,7 @@
.build()));
changeReq = client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patchEntity);
- changeReq.setFormat(ODataFormat.JSON);
+ changeReq.setFormat(ContentType.JSON);
changeset.addRequest(changeReq);
// -----------------------------
@@ -530,7 +525,7 @@
// - Fetch result
// -----------------------------
final ODataBatchResponse response = payload.getResponse();
- assertEquals(202, response.getStatusCode());
+ assertEquals(HttpStatusCode.ACCEPTED.getStatusCode(), response.getStatusCode());
final Iterator<ODataBatchResponseItem> bodyIterator = response.getBody();
// Check first get request
@@ -540,7 +535,9 @@
assertTrue(item.hasNext());
final ODataResponse response0 = item.next();
assertTrue(response0 instanceof ODataRetrieveResponse);
- assertEquals(34, ((ODataRetrieveResponse<ClientEntity>) response0).getBody()
+ @SuppressWarnings("unchecked")
+ ODataRetrieveResponse<ClientEntity> retrieveResponse = (ODataRetrieveResponse<ClientEntity>) response0;
+ assertEquals(34, retrieveResponse.getBody()
.getProperty("PropertyDecimal")
.getPrimitiveValue()
.toValue());
@@ -555,7 +552,7 @@
final ODataResponse response1 = item.next();
assertEquals(HttpStatusCode.CREATED.getStatusCode(), response1.getStatusCode());
assertTrue(response1 instanceof ODataEntityCreateResponse);
- assertEquals(3.1415, ((ODataEntityCreateResponse<ClientEntity>) response1).getBody().getProperty("PropertyDouble")
+ assertEquals(3.1415, ((ODataEntityCreateResponse<?>) response1).getBody().getProperty("PropertyDouble")
.getPrimitiveValue()
.toValue());
// Update
@@ -569,7 +566,7 @@
final ODataResponse response3 = item.next();
assertEquals(HttpStatusCode.CREATED.getStatusCode(), response3.getStatusCode());
assertTrue(response3 instanceof ODataEntityUpdateResponse);
- assertEquals(3.1415, ((ODataEntityUpdateResponse<ClientEntity>) response3).getBody().getProperty("PropertyDouble")
+ assertEquals(3.1415, ((ODataEntityUpdateResponse<?>) response3).getBody().getProperty("PropertyDouble")
.getPrimitiveValue()
.toValue());
@@ -580,7 +577,9 @@
assertTrue(item.hasNext());
final ODataResponse response4 = item.next();
assertTrue(response4 instanceof ODataRetrieveResponse);
- assertEquals(3.1415, ((ODataRetrieveResponse<ClientEntity>) response4).getBody()
+ @SuppressWarnings("unchecked")
+ final ODataRetrieveResponse<ClientEntity> retrieveResponse2 = (ODataRetrieveResponse<ClientEntity>) response4;
+ assertEquals(3.1415, retrieveResponse2.getBody()
.getProperty("PropertyDouble")
.getPrimitiveValue()
.toValue());
@@ -594,7 +593,7 @@
final URI uri = (isRelative) ? new URI(SERVICE_URI).relativize(targetURI.build()) : targetURI.build();
ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(uri);
- queryReq.setFormat(ODataFormat.JSON);
+ queryReq.setFormat(ContentType.JSON);
manager.addRequest(queryReq);
}
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BatchClientXmlITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BatchClientXmlITCase.java
new file mode 100644
index 0000000..70ab164
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BatchClientXmlITCase.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.fit.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class BatchClientXmlITCase extends BatchClientITCase {
+ @Override
+ protected ODataClient getClient() {
+ ODataClient odata = ODataClientFactory.getClient();
+ odata.getConfiguration().setDefaultPubFormat(ContentType.APPLICATION_ATOM_XML);
+ return odata;
+ }
+
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_ATOM_XML.toContentTypeString()));
+ }
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.APPLICATION_ATOM_XML);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java
index 48c4a00..9d1a9ed 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingITCase.java
@@ -38,12 +38,10 @@
import org.apache.olingo.client.api.domain.ClientInlineEntity;
import org.apache.olingo.client.api.domain.ClientLink;
import org.apache.olingo.client.api.domain.ClientObjectFactory;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.client.core.ODataClientFactory;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
@@ -51,7 +49,7 @@
import org.junit.Test;
public class BindingITCase extends AbstractBaseTestITCase {
- private static final String SERVICE_URI = TecSvcConst.BASE_URI;
+ protected static final String SERVICE_URI = TecSvcConst.BASE_URI;
private static final String SERVICE_NAMESPACE = "olingo.odata.test1";
private static final String ES_KEY_NAV = "ESKeyNav";
@@ -156,22 +154,26 @@
final ODataRetrieveResponse<ClientEntity> entityGetResponse = entityGetRequest.execute();
// NAV_PROPERTY_ET_KEY_NAV_ONE
- assertEquals(1, entityGetResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_ONE).getComplexValue().get(
- PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertEquals(Short.valueOf((short) 1), entityGetResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)
+ .asInlineEntity().getEntity().getProperty(PROPERTY_INT16).getPrimitiveValue().toCastValue(Short.class));
// NAV_PROPERTY_ET_KEY_NAV_MANY(0)
- Iterator<ClientValue> iterator =
- entityGetResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_MANY).getCollectionValue().iterator();
- assertEquals(2, iterator.next().asComplex().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+ Iterator<ClientEntity> iterator = entityGetResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY)
+ .asInlineEntitySet().getEntitySet().getEntities().iterator();
+ assertEquals(Short.valueOf((short) 2), iterator.next().getProperty(PROPERTY_INT16).getPrimitiveValue()
+ .toCastValue(Short.class));
// NAV_PROPERTY_ET_KEY_NAV_MANY(1)
- assertEquals(3, iterator.next().asComplex().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertEquals(Short.valueOf((short) 3), iterator.next().getProperty(PROPERTY_INT16).getPrimitiveValue()
+ .toCastValue(Short.class));
// NAV_PROPERTY_ET_TWO_KEY_NAV_MANY(0)
- assertEquals(1, entityGetResponse.getBody().getProperty(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).getCollectionValue()
- .iterator().next().asComplex().get(PROPERTY_INT16).getPrimitiveValue().toValue());
- assertEquals("1", entityGetResponse.getBody().getProperty(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).getCollectionValue()
- .iterator().next().asComplex().get(PROPERTY_STRING).getPrimitiveValue().toValue());
+ assertEquals(Short.valueOf((short)1), entityGetResponse.getBody()
+ .getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).asInlineEntitySet().getEntitySet().getEntities()
+ .iterator().next().getProperty(PROPERTY_INT16).getPrimitiveValue().toCastValue(Short.class));
+ assertEquals("1", entityGetResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY)
+ .asInlineEntitySet().getEntitySet().getEntities().iterator().next()
+ .getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
// Check if partner navigation link has been set up
final URI etTwoKeyNavEntityURI =
@@ -182,12 +184,12 @@
etTwoKeyNavEntityRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
final ODataRetrieveResponse<ClientEntity> etTwoKeyNavEntityResponse = etTwoKeyNavEntityRequest.execute();
- assertEquals(entityInt16Key, etTwoKeyNavEntityResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_ONE)
- .getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toCastValue(Short.class));
+ assertEquals(entityInt16Key, etTwoKeyNavEntityResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)
+ .asInlineEntity().getEntity().getProperty(PROPERTY_INT16).getPrimitiveValue().toCastValue(Short.class));
}
@Test
- public void testUpdateBinding() {
+ public void testUpdateBinding() throws Exception {
// The entity MUST NOT contain related entities as inline content. It MAY contain binding information
// for navigation properties. For single-valued navigation properties this replaces the relationship.
// For collection-valued navigation properties this adds to the relationship.
@@ -224,15 +226,19 @@
entityRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
final ODataRetrieveResponse<ClientEntity> entityResponse = entityRequest.execute();
- assertEquals(3, entityResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_ONE).getComplexValue().get(
- PROPERTY_INT16).getPrimitiveValue().toValue());
- assertEquals(3, entityResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_MANY).getCollectionValue().size());
+ assertEquals(Short.valueOf((short) 3), entityResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)
+ .asInlineEntity().getEntity().getProperty(PROPERTY_INT16).getPrimitiveValue().toCastValue(Short.class));
+ assertEquals(3, entityResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY).asInlineEntitySet()
+ .getEntitySet().getEntities().size());
- Iterator<ClientValue> iterator =
- entityResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_MANY).getCollectionValue().iterator();
- assertEquals(1, iterator.next().asComplex().get(PROPERTY_INT16).getPrimitiveValue().toValue());
- assertEquals(2, iterator.next().asComplex().get(PROPERTY_INT16).getPrimitiveValue().toValue());
- assertEquals(3, iterator.next().asComplex().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+ Iterator<ClientEntity> iterator = entityResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY)
+ .asInlineEntitySet().getEntitySet().getEntities().iterator();
+ assertEquals(Short.valueOf((short) 1), iterator.next().getProperty(PROPERTY_INT16).getPrimitiveValue()
+ .toCastValue(Short.class));
+ assertEquals(Short.valueOf((short) 2), iterator.next().getProperty(PROPERTY_INT16).getPrimitiveValue()
+ .toCastValue(Short.class));
+ assertEquals(Short.valueOf((short) 3), iterator.next().getProperty(PROPERTY_INT16).getPrimitiveValue()
+ .toCastValue(Short.class));
}
@Test
@@ -275,56 +281,9 @@
}
@Test
- public void testUpdateSingleNavigationPropertyWithNull() {
- final ODataClient client = getClient();
- final URI entityURI =
- client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(1).build();
- final ClientObjectFactory of = client.getObjectFactory();
-
- // Request to single (non collection) navigation property
- ClientEntity entity = of.newEntity(ET_KEY_NAV);
- final ClientProperty navPropery = of.newComplexProperty(NAV_PROPERTY_ET_KEY_NAV_ONE, null);
- entity.getProperties().add(navPropery);
-
- ODataEntityUpdateResponse<ClientEntity> updateResponse =
- client.getCUDRequestFactory().getEntityUpdateRequest(entityURI, UpdateType.PATCH, entity).execute();
- assertEquals(HttpStatusCode.OK.getStatusCode(), updateResponse.getStatusCode());
-
- final ODataEntityRequest<ClientEntity> getRequest =
- client.getRetrieveRequestFactory().getEntityRequest(
- client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(1).expand(
- NAV_PROPERTY_ET_KEY_NAV_ONE).build());
- getRequest.addCustomHeader(HttpHeader.COOKIE, updateResponse.getHeader(HttpHeader.SET_COOKIE).iterator().next());
- final ODataRetrieveResponse<ClientEntity> getResponse = getRequest.execute();
-
- ClientProperty property = getResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_ONE);
- assertEquals(null, property.getPrimitiveValue());
- }
-
- @Test
- public void testUpdateCollectionNavigationPropertyWithNull() {
- final ODataClient client = getClient();
- final URI entityURI =
- client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(1).build();
- final ClientObjectFactory of = client.getObjectFactory();
-
- // Request to single (non collection) navigation property
- ClientEntity entity = of.newEntity(ET_KEY_NAV);
- final ClientProperty navPropery = of.newComplexProperty(NAV_PROPERTY_ET_KEY_NAV_MANY, null);
- entity.getProperties().add(navPropery);
-
- try {
- client.getCUDRequestFactory().getEntityUpdateRequest(entityURI, UpdateType.PATCH, entity).execute();
- fail();
- } catch (ODataClientErrorException e) {
- assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode());
- }
- }
-
- @Test
public void testDeepInsertWithBindingSameNavigationProperty() {
- final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
- client.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ final EdmEnabledODataClient client = getClient();
+ client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
final ClientObjectFactory of = client.getObjectFactory();
final ClientEntity entity = of.newEntity(ET_KEY_NAV);
@@ -344,7 +303,7 @@
client.newURIBuilder(SERVICE_URI)
.appendEntitySetSegment(ES_TWO_KEY_NAV)
.appendKeySegment(new LinkedHashMap<String, Object>() {
- private static final long serialVersionUID = 3109256773218160485L;
+ private static final long serialVersionUID = 1L;
{
put(PROPERTY_INT16, 3);
@@ -389,10 +348,9 @@
.toValue());
}
- @Override
- protected ODataClient getClient() {
- ODataClient odata = ODataClientFactory.getClient();
- odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ protected EdmEnabledODataClient getClient() {
+ EdmEnabledODataClient odata = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
+ odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
return odata;
}
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingXmlITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingXmlITCase.java
new file mode 100644
index 0000000..538f82c
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BindingXmlITCase.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.fit.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class BindingXmlITCase extends BindingITCase {
+
+ @Override
+ protected EdmEnabledODataClient getClient() {
+ EdmEnabledODataClient odata = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
+ odata.getConfiguration().setDefaultPubFormat(ContentType.APPLICATION_ATOM_XML);
+ return odata;
+ }
+
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_ATOM_XML.toContentTypeString()));
+ }
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.APPLICATION_ATOM_XML);
+ }
+}
\ No newline at end of file
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ConditionalITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ConditionalITCase.java
index 9f5efc3..e4443fa 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ConditionalITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ConditionalITCase.java
@@ -51,14 +51,15 @@
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.core.ODataClientFactory;
import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
import org.junit.Test;
-public final class ConditionalITCase extends AbstractBaseTestITCase {
+public class ConditionalITCase extends AbstractBaseTestITCase {
private final ODataClient client = getClient();
@@ -123,14 +124,14 @@
public void updateWithoutIfMatch() throws Exception {
executeAndExpectError(
client.getCUDRequestFactory().getEntityUpdateRequest(
- uriEntity, UpdateType.PATCH, client.getObjectFactory().newEntity(null)),
+ uriEntity, UpdateType.PATCH, client.getObjectFactory().newEntity(new FullQualifiedName("olingo.Order"))),
HttpStatusCode.PRECONDITION_REQUIRED);
}
@Test
public void updateWithWrongIfMatch() throws Exception {
ODataEntityUpdateRequest<ClientEntity> request = client.getCUDRequestFactory().getEntityUpdateRequest(
- uriEntity, UpdateType.PATCH, client.getObjectFactory().newEntity(null));
+ uriEntity, UpdateType.PATCH, client.getObjectFactory().newEntity(new FullQualifiedName("olingo.Order")));
request.setIfMatch("W/\"1\"");
executeAndExpectError(request, HttpStatusCode.PRECONDITION_FAILED);
}
@@ -173,7 +174,7 @@
final ODataDeleteResponse response = deleteRequest.execute();
ODataEntityUpdateRequest<ClientEntity> request = client.getCUDRequestFactory().getEntityUpdateRequest(
- uriEntity, UpdateType.PATCH, client.getObjectFactory().newEntity(null));
+ uriEntity, UpdateType.PATCH, client.getObjectFactory().newEntity(new FullQualifiedName("olingo.Order")));
request.setIfMatch(eTag);
// This request has to be in the same session as the first in order to access the same data provider.
request.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next());
@@ -195,6 +196,15 @@
}
@Test
+ public void updatePropertyWithoutIfMatch() throws Exception {
+ final ODataPropertyUpdateRequest request = client.getCUDRequestFactory().getPropertyPrimitiveValueUpdateRequest(
+ uriProperty,
+ client.getObjectFactory().newPrimitiveProperty("PropertyDuration",
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("PT42S")));
+ executeAndExpectError(request, HttpStatusCode.PRECONDITION_REQUIRED);
+ }
+
+ @Test
public void updatePropertyWithWrongIfMatch() throws Exception {
ODataPropertyUpdateRequest request = client.getCUDRequestFactory().getPropertyPrimitiveValueUpdateRequest(
uriProperty,
@@ -205,6 +215,15 @@
}
@Test
+ public void updatePropertyValueWithoutIfMatch() throws Exception {
+ final ODataValueUpdateRequest request = client.getCUDRequestFactory().getValueUpdateRequest(
+ uriPropertyValue,
+ UpdateType.REPLACE,
+ client.getObjectFactory().newPrimitiveValueBuilder().buildString("PT42S"));
+ executeAndExpectError(request, HttpStatusCode.PRECONDITION_REQUIRED);
+ }
+
+ @Test
public void updatePropertyValueWithWrongIfMatch() throws Exception {
ODataValueUpdateRequest request = client.getCUDRequestFactory().getValueUpdateRequest(
uriPropertyValue,
@@ -215,6 +234,12 @@
}
@Test
+ public void deletePropertyWithoutIfMatch() throws Exception {
+ final ODataDeleteRequest request = client.getCUDRequestFactory().getDeleteRequest(uriProperty);
+ executeAndExpectError(request, HttpStatusCode.PRECONDITION_REQUIRED);
+ }
+
+ @Test
public void deletePropertyWithWrongIfMatch() throws Exception {
ODataDeleteRequest request = client.getCUDRequestFactory().getDeleteRequest(uriProperty);
request.setIfMatch("W/\"1\"");
@@ -232,6 +257,12 @@
}
@Test
+ public void deletePropertyValueWithoutIfMatch() throws Exception {
+ final ODataDeleteRequest request = client.getCUDRequestFactory().getDeleteRequest(uriPropertyValue);
+ executeAndExpectError(request, HttpStatusCode.PRECONDITION_REQUIRED);
+ }
+
+ @Test
public void deletePropertyValueWithWrongIfMatch() throws Exception {
ODataDeleteRequest request = client.getCUDRequestFactory().getDeleteRequest(uriPropertyValue);
request.setIfMatch("W/\"1\"");
@@ -251,7 +282,7 @@
@Override
protected ODataClient getClient() {
ODataClient odata = ODataClientFactory.getClient();
- odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
return odata;
}
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ConditionalXmlITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ConditionalXmlITCase.java
new file mode 100644
index 0000000..3afa8c9
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ConditionalXmlITCase.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.fit.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class ConditionalXmlITCase extends ConditionalITCase {
+
+ @Override
+ protected ODataClient getClient() {
+ ODataClient odata = ODataClientFactory.getClient();
+ odata.getConfiguration().setDefaultPubFormat(ContentType.APPLICATION_ATOM_XML);
+ return odata;
+ }
+
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_ATOM_XML.toContentTypeString()));
+ }
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.APPLICATION_ATOM_XML);
+ }
+}
\ No newline at end of file
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java
index b4b8efe..56cd373 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertITCase.java
@@ -51,7 +51,7 @@
import org.apache.olingo.client.core.ODataClientFactory;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
@@ -59,6 +59,19 @@
import org.junit.Ignore;
import org.junit.Test;
+/**
+ * The issue I see with this unit test, or in general with JSON metadata=minimal case is
+ * none of the navigation properties will be represented as such in deserialized form, because
+ * no navigation link information will be written when metadata=minimal. The client will
+ * interpret those results as complex properties (which I do not think is right).
+ *
+ * Where as in the atom+xml case, there is no intermediate results, it is equivalent to
+ * metadata=full, thus the navigation links and inline content is correctly represented through
+ * deserialization.
+ *
+ * For above reason, the DeepInsertXMLITCase case re-written slightly differently.
+ *
+ */
public class DeepInsertITCase extends AbstractBaseTestITCase {
private static final String SERVICE_URI = TecSvcConst.BASE_URI;
@@ -90,8 +103,8 @@
@Test
public void testDeepInsertExpandedResponse() {
- final ODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
- client.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ final ODataClient client = getClient(SERVICE_URI);
+ client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
final URI createURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build();
final ClientObjectFactory of = client.getObjectFactory();
final ClientEntity entity = of.newEntity(ET_KEY_NAV);
@@ -272,7 +285,8 @@
inlineEntitySingle.getProperties()
.add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("43")));
inlineEntitySingle.getProperties().add(
- of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 430)))));
inlineEntitySingle.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 431)))));
@@ -293,7 +307,8 @@
.add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 441)))));
inlineEntityCol1.getProperties().add(
- of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 440)))));
inlineEntityCol1.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 442)))
@@ -308,7 +323,8 @@
.add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 451)))));
inlineEntityCol2.getProperties().add(
- of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 450)))));
inlineEntityCol2.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 452)))
@@ -545,7 +561,7 @@
@Test
public void testConsistency() throws EdmPrimitiveTypeException {
- final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
+ final EdmEnabledODataClient client = getClient(SERVICE_URI);
final ClientObjectFactory of = client.getObjectFactory();
final String cookie = getCookie();
@@ -574,7 +590,7 @@
@Test
public void testInvalidType() throws EdmPrimitiveTypeException {
- final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
+ final EdmEnabledODataClient client = getClient(SERVICE_URI);
final ClientObjectFactory of = client.getObjectFactory();
final String cookie = getCookie();
@@ -613,7 +629,7 @@
@Test
@Ignore
public void testDeepInsertOnNavigationPropertyInComplexProperty() {
- final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
+ final EdmEnabledODataClient client = getClient(SERVICE_URI);
final ClientObjectFactory of = client.getObjectFactory();
final ClientEntity inlineEntity = of.newEntity(ET_TWO_KEY_NAV);
@@ -704,8 +720,8 @@
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 43)));
inlineEntitySingle.getProperties()
.add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("43")));
- inlineEntitySingle.getProperties().add(
- of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+ inlineEntitySingle.getProperties().add(of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 43)))));
inlineEntitySingle.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 431)))));
@@ -726,7 +742,8 @@
.add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 441)))));
inlineEntityCol1.getProperties().add(
- of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 441)))));
inlineEntityCol1.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 442)))
@@ -741,7 +758,8 @@
.add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 451)))));
inlineEntityCol2.getProperties().add(
- of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 451)))));
inlineEntityCol2.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 452)))
@@ -900,7 +918,11 @@
@Override
protected ODataClient getClient() {
ODataClient odata = ODataClientFactory.getClient();
- odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
return odata;
}
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI,ContentType.JSON);
+ }
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertXmlITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertXmlITCase.java
new file mode 100644
index 0000000..4e9da85
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/DeepInsertXmlITCase.java
@@ -0,0 +1,960 @@
+/*
+ * 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.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.ODataClientErrorException;
+import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
+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.request.retrieve.ODataEntitySetRequest;
+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.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientInlineEntity;
+import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
+import org.apache.olingo.client.api.domain.ClientLink;
+import org.apache.olingo.client.api.domain.ClientObjectFactory;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.fit.AbstractBaseTestITCase;
+import org.apache.olingo.fit.tecsvc.TecSvcConst;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * see the class comment on {@link DeepInsertITCase}
+ */
+public class DeepInsertXmlITCase extends AbstractBaseTestITCase {
+
+ private static final String SERVICE_URI = TecSvcConst.BASE_URI;
+ private static final String SERVICE_NAMESPACE = "olingo.odata.test1";
+ private static final String ES_KEY_NAV = "ESKeyNav";
+ private static final String ES_TWO_KEY_NAV = "ESTwoKeyNav";
+ private static final String ET_KEY_NAV_NAME = "ETKeyNav";
+ private static final String ET_TWO_KEY_NAV_NAME = "ETTwoKeyNav";
+ private static final FullQualifiedName ET_KEY_NAV = new FullQualifiedName(SERVICE_NAMESPACE, ET_KEY_NAV_NAME);
+ private static final FullQualifiedName ET_TWO_KEY_NAV =
+ new FullQualifiedName(SERVICE_NAMESPACE, ET_TWO_KEY_NAV_NAME);
+ private static final String CT_PRIM_COMP = "CTPrimComp";
+ private static final String CT_TWO_PRIM = "CTTwoPrim";
+ private static final String CT_ALL_PRIM = "CTAllPrim";
+ private static final String CT_NAV_FIVE_PROP = "CTNavFiveProp";
+ private static final String CT_BASE_PRIM_COMP_NAV = "CTBasePrimCompNav";
+ private static final String PROPERTY_INT16 = "PropertyInt16";
+ private static final String PROPERTY_STRING = "PropertyString";
+ private static final String PROPERTY_COMP = "PropertyComp";
+ private static final String PROPERTY_COMP_NAV = "PropertyCompNav";
+ private static final String PROPERTY_COMP_COMP_NAV = "PropertyCompCompNav";
+ private static final String PROPERTY_COMP_TWO_PRIM = "PropertyCompTwoPrim";
+ private static final String PROPERTY_COMP_ALL_PRIM = "PropertyCompAllPrim";
+ private static final String NAV_PROPERTY_ET_KEY_NAV_ONE = "NavPropertyETKeyNavOne";
+ private static final String NAV_PROPERTY_ET_TWO_KEY_NAV_ONE = "NavPropertyETTwoKeyNavOne";
+ private static final String NAV_PROPERTY_ET_TWO_KEY_NAV_MANY = "NavPropertyETTwoKeyNavMany";
+ private static final String COL_PROPERTY_STRING = "CollPropertyString";
+ private static final String COL_PROPERTY_COMP_NAV = "CollPropertyCompNav";
+ private static final String EDM_STRING = "Edm.String";
+
+ void assertShortOrInt(int value, Object n) {
+ if (n instanceof Number) {
+ assertEquals(value, ((Number)n).intValue());
+ } else {
+ Assert.fail();
+ }
+ }
+
+ @Test
+ public void testDeepInsertExpandedResponse() {
+ final ODataClient client = getClient(SERVICE_URI);
+ client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
+ final URI createURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build();
+ final ClientObjectFactory of = client.getObjectFactory();
+ final ClientEntity entity = of.newEntity(ET_KEY_NAV);
+
+ // Root entity
+ entity.getProperties().add(
+ of.newPrimitiveProperty(PROPERTY_STRING,
+ of.newPrimitiveValueBuilder().buildString("String Property level 0")));
+ entity.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 41)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString(
+ "String Property level 0, complex level 1")))));
+
+ // First level NavPropertyETTwoKeyNavOne => Type ETTwoKeyNav
+ final ClientEntity firstLevelTwoKeyNav = of.newEntity(ET_TWO_KEY_NAV);
+ firstLevelTwoKeyNav.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString(
+ "String Property level 1, complex level 1")))));
+ firstLevelTwoKeyNav.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+ firstLevelTwoKeyNav.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
+ final ClientInlineEntity firstLevelTwoKeyOneInline =
+ of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, firstLevelTwoKeyNav);
+ entity.addLink(firstLevelTwoKeyOneInline);
+
+ // Second level NavPropertyETTwoKeyNavOne => Type ETTwoKeyNav
+ final ClientEntity secondLevelTwoKeyNav = of.newEntity(ET_TWO_KEY_NAV);
+ secondLevelTwoKeyNav.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 421)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString(
+ "String Property level 2, complex level 1")))));
+ secondLevelTwoKeyNav.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+ secondLevelTwoKeyNav.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
+
+ // Binding links
+ secondLevelTwoKeyNav.addLink(of.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, client.newURIBuilder(
+ SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(new LinkedHashMap<String, Object>() {
+ private static final long serialVersionUID = 3109256773218160485L;
+ {
+ put(PROPERTY_INT16, 3);
+ put(PROPERTY_STRING, "1");
+ }
+ }).build()));
+
+ final ClientInlineEntity secondLevelTwoKeyOneInline =
+ of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, secondLevelTwoKeyNav);
+ firstLevelTwoKeyNav.addLink(secondLevelTwoKeyOneInline);
+
+ // Third level NavPropertyETTwoKeyNavMany => Type ETTwoKeyNav
+ final ClientEntity thirdLevelTwoKeyNavMany1 = of.newEntity(ET_TWO_KEY_NAV);
+ thirdLevelTwoKeyNavMany1.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 431)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString(
+ "String Property level 3, complex level 1")))));
+ thirdLevelTwoKeyNavMany1.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+ thirdLevelTwoKeyNavMany1.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
+
+ final ClientEntity thirdLevelTwoKeyNavMany2 = of.newEntity(ET_TWO_KEY_NAV);
+ thirdLevelTwoKeyNavMany2.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 432)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString(
+ "String Property level 3, complex level 1")))));
+ thirdLevelTwoKeyNavMany2.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+ thirdLevelTwoKeyNavMany2.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
+
+ final ClientEntitySet entitySetThirdLevelTwoKeyNavMany = of.newEntitySet();
+ entitySetThirdLevelTwoKeyNavMany.getEntities().add(thirdLevelTwoKeyNavMany1);
+ entitySetThirdLevelTwoKeyNavMany.getEntities().add(thirdLevelTwoKeyNavMany2);
+ secondLevelTwoKeyNav.addLink(of.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY,
+ entitySetThirdLevelTwoKeyNavMany));
+
+ // First level NavPropertyETTwoKeyNavMany => Type ETTwoKeyNav
+ final ClientEntity firstLevelTwoKeyNavMany1 = of.newEntity(ET_TWO_KEY_NAV);
+ firstLevelTwoKeyNavMany1.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 422)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString(
+ "String Property level 1, complex level 1")))));
+ firstLevelTwoKeyNavMany1.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+ firstLevelTwoKeyNavMany1.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
+
+ final ClientEntitySet entitySetfirstLevelTwoKeyNavMany = of.newEntitySet();
+ entitySetfirstLevelTwoKeyNavMany.getEntities().add(firstLevelTwoKeyNavMany1);
+ entity.addLink(of.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY,
+ entitySetfirstLevelTwoKeyNavMany));
+
+ final ODataEntityCreateResponse<ClientEntity> createResponse =
+ client.getCUDRequestFactory().getEntityCreateRequest(createURI, entity).execute();
+
+ // Check response
+ final ClientEntity resultEntityFirstLevel =
+ createResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE)
+ .asInlineEntity().getEntity();
+ assertEquals(42, resultEntityFirstLevel.getProperty(PROPERTY_COMP_TWO_PRIM)
+ .getComplexValue().get(PROPERTY_INT16)
+ .getPrimitiveValue().toValue());
+ assertEquals("String Property level 1, complex level 1",
+ resultEntityFirstLevel.getProperty(PROPERTY_COMP_TWO_PRIM)
+ .getComplexValue().get(PROPERTY_STRING)
+ .getPrimitiveValue().toValue());
+
+ final ClientEntity resultEntitySecondLevel =
+ resultEntityFirstLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE).asInlineEntity().getEntity();
+ assertEquals(421, resultEntitySecondLevel.getProperty(PROPERTY_COMP_TWO_PRIM)
+ .getComplexValue().get(PROPERTY_INT16)
+ .getPrimitiveValue().toValue());
+ assertEquals("String Property level 2, complex level 1", resultEntitySecondLevel
+ .getProperty(PROPERTY_COMP_TWO_PRIM)
+ .getComplexValue().get(PROPERTY_STRING)
+ .getPrimitiveValue().toValue());
+
+ final ClientEntitySet thirdLevelEntitySetNavMany =
+ resultEntitySecondLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY)
+ .asInlineEntitySet().getEntitySet();
+ assertEquals(2, thirdLevelEntitySetNavMany.getEntities().size());
+
+ assertEquals(431, thirdLevelEntitySetNavMany.getEntities().get(0).getProperty(PROPERTY_COMP_TWO_PRIM)
+ .getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertEquals("String Property level 3, complex level 1", thirdLevelEntitySetNavMany.getEntities().get(0)
+ .getProperty(PROPERTY_COMP_TWO_PRIM).getComplexValue().get(PROPERTY_STRING).getPrimitiveValue().toValue());
+
+ assertEquals(432, thirdLevelEntitySetNavMany.getEntities().get(1).getProperty(PROPERTY_COMP_TWO_PRIM)
+ .getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertEquals("String Property level 3, complex level 1", thirdLevelEntitySetNavMany.getEntities().get(1)
+ .getProperty(PROPERTY_COMP_TWO_PRIM).getComplexValue().get(PROPERTY_STRING).getPrimitiveValue().toValue());
+
+ final ClientEntitySet firstLevelEntitySetNavMany =
+ createResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY)
+ .asInlineEntitySet().getEntitySet();
+ assertEquals(1, firstLevelEntitySetNavMany.getEntities().size());
+ assertEquals(422, firstLevelEntitySetNavMany.getEntities().get(0).getProperty(PROPERTY_COMP_TWO_PRIM)
+ .getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertEquals("String Property level 1, complex level 1", firstLevelEntitySetNavMany.getEntities().get(0)
+ .getProperty(PROPERTY_COMP_TWO_PRIM).getComplexValue()
+ .get(PROPERTY_STRING).getPrimitiveValue().toValue());
+ }
+
+ @Test
+ public void testSimpleDeepInsert() throws EdmPrimitiveTypeException {
+ final ODataClient client = getClient();
+ final URI createURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build();
+ final ClientObjectFactory of = client.getObjectFactory();
+ final ClientEntity entity = client.getObjectFactory().newEntity(ET_KEY_NAV);
+
+ // Prepare entity(EntitySet: ESKeyNav, Type: ETKeyNav)
+ entity.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)));
+ entity.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")));
+ entity.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))));
+ entity.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_ALL_PRIM, of.newComplexValue(CT_ALL_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))));
+ entity.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))));
+ entity.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))
+ .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16,
+ of.newPrimitiveValueBuilder().buildInt16((short) 42)))))));
+
+ // Non collection navigation property
+ // Create related entity(EntitySet: ESTwoKeyNav, Type: ETTwoKeyNav, Nav. Property: NavPropertyETTwoKeyNavOne)
+ final ClientEntity inlineEntitySingle = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV);
+ inlineEntitySingle.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 43)));
+ inlineEntitySingle.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("43")));
+ inlineEntitySingle.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 430)))));
+ inlineEntitySingle.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 431)))));
+ inlineEntitySingle.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 432)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("432")))));
+
+ // Collection navigation property
+ // The navigation property has a partner navigation property named "NavPropertyETKeyNavOne"
+ // Create related entity(EntitySet: ESTwoKeyNav, Type: NavPropertyETTwoKeyNavMany
+ final ClientEntity inlineEntityCol1 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV);
+ inlineEntityCol1.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 44)));
+ inlineEntityCol1.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("44")));
+ inlineEntityCol1.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 441)))));
+ inlineEntityCol1.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 440)))));
+ inlineEntityCol1.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 442)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("442")))));
+
+ final ClientEntity inlineEntityCol2 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV);
+ inlineEntityCol2.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 45)));
+ inlineEntityCol2.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("45")));
+ inlineEntityCol2.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 451)))));
+ inlineEntityCol2.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 450)))));
+ inlineEntityCol2.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 452)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("452")))));
+
+ final ClientInlineEntity newDeepInsertEntityLink =
+ of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, inlineEntitySingle);
+ final ClientEntitySet newDeepInsertEntitySet = of.newEntitySet();
+ newDeepInsertEntitySet.getEntities().add(inlineEntityCol1);
+ newDeepInsertEntitySet.getEntities().add(inlineEntityCol2);
+ final ClientInlineEntitySet newDeepInsertEntitySetLink =
+ of.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, newDeepInsertEntitySet);
+
+ entity.addLink(newDeepInsertEntityLink);
+ entity.addLink(newDeepInsertEntitySetLink);
+
+ // Perform create request
+ final ODataEntityCreateResponse<ClientEntity> responseCreate = client.getCUDRequestFactory()
+ .getEntityCreateRequest(createURI, entity)
+ .execute();
+ assertEquals(HttpStatusCode.CREATED.getStatusCode(), responseCreate.getStatusCode());
+
+ final String cookie = responseCreate.getHeader(HttpHeader.SET_COOKIE).toString();
+
+ // Fetch ESKeyNav entity with expand of NavPropertyETTwoKeyNavOne nav. property
+ ClientProperty propertyInt16 = responseCreate.getBody().getProperty(PROPERTY_INT16);
+ final URI esKeyNavURI =
+ client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(
+ propertyInt16.getPrimitiveValue().toValue()).expand(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE,
+ NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).build();
+
+ final ODataEntityRequest<ClientEntity> esKeyNavRequest = client.getRetrieveRequestFactory()
+ .getEntityRequest(esKeyNavURI);
+ esKeyNavRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
+ final ODataRetrieveResponse<ClientEntity> esKeyNavResponse = esKeyNavRequest.execute();
+
+ ClientEntity clientEntity = esKeyNavResponse.getBody();
+ // Check nav. property NavPropertyETTwoKeyNavOne
+ assertNotNull(clientEntity.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE));
+ ClientInlineEntity navOne = (ClientInlineEntity)clientEntity.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE);
+ assertShortOrInt(431, navOne.getEntity().getProperty(
+ PROPERTY_COMP_NAV).getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+
+ // Check nav. property NavPropertyETTwoKeyNavMany
+ assertNotNull(esKeyNavResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY));
+ ClientInlineEntitySet navMany = (ClientInlineEntitySet)clientEntity
+ .getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY);
+ assertEquals(2, navMany.getEntitySet().getEntities().size());
+
+ assertShortOrInt(441, navMany.getEntitySet().getEntities().get(0).getProperty(PROPERTY_COMP_NAV)
+ .getValue().asComplex().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(451, navMany.getEntitySet().getEntities().get(1).getProperty(PROPERTY_COMP_NAV)
+ .getValue().asComplex().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+
+ // Fetch ESTwoKeyNav entities and check if available and the partner relation have been set up
+ // Check ESTwoKeyNav(Created via NavPropertyETTwoKeyNavOne)
+ Map<String, Object> composedKey = new HashMap<String, Object>();
+ composedKey.put(PROPERTY_INT16, navOne.getEntity().getProperty(PROPERTY_INT16)
+ .getPrimitiveValue().toValue());
+ composedKey.put(PROPERTY_STRING, navOne.getEntity().getProperty(PROPERTY_STRING)
+ .getPrimitiveValue().toValue());
+
+ final URI esTwoKeyNavEntitySingleURI = client.newURIBuilder(SERVICE_URI)
+ .appendEntitySetSegment(ES_TWO_KEY_NAV)
+ .appendKeySegment(composedKey)
+ .build();
+ final ODataEntityRequest<ClientEntity> esTwoKeyNavSingleRequest = client.getRetrieveRequestFactory()
+ .getEntityRequest(esTwoKeyNavEntitySingleURI);
+ esTwoKeyNavSingleRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
+ final ODataRetrieveResponse<ClientEntity> esTwoKeyNavSingleResponse = esTwoKeyNavSingleRequest.execute();
+ assertShortOrInt(431, esTwoKeyNavSingleResponse.getBody().getProperty(PROPERTY_COMP_NAV).getComplexValue()
+ .get(PROPERTY_INT16).getPrimitiveValue().toValue());
+
+ // Check ESTwoKeyNav(Created via NavPropertyETTwoKeyNavMany(0))
+ composedKey.clear();
+ composedKey.put(PROPERTY_INT16, navMany.getEntitySet().getEntities().get(0).getProperty(PROPERTY_INT16)
+ .getPrimitiveValue().toValue());
+ composedKey.put(PROPERTY_STRING, navMany.getEntitySet().getEntities().get(0).getProperty(PROPERTY_STRING)
+ .getPrimitiveValue().toValue());
+
+ URI esTwoKeyNavEntityManyOneURI =
+ client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(composedKey)
+ .expand(NAV_PROPERTY_ET_KEY_NAV_ONE).build();
+
+ final ODataEntityRequest<ClientEntity> esTwoKeyNavManyOneRequest =
+ client.getRetrieveRequestFactory().getEntityRequest(esTwoKeyNavEntityManyOneURI);
+ esTwoKeyNavManyOneRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
+ final ODataRetrieveResponse<ClientEntity> esTwoKeyNavManyOneResponse = esTwoKeyNavManyOneRequest.execute();
+
+ assertShortOrInt(441, esTwoKeyNavManyOneResponse.getBody().getProperty(PROPERTY_COMP_NAV)
+ .getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+
+ assertNotNull(esTwoKeyNavManyOneResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE));
+ ClientInlineEntity nvLink = (ClientInlineEntity)esTwoKeyNavManyOneResponse.getBody()
+ .getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE);
+ assertEquals(propertyInt16.getPrimitiveValue().toValue(), nvLink.getEntity().getProperty(PROPERTY_INT16)
+ .getPrimitiveValue().toValue());
+
+ // Check ESTwoKeyNav(Created via NavPropertyETTwoKeyNavMany(1))
+ composedKey.clear();
+ composedKey.put(PROPERTY_INT16, navMany.getEntitySet().getEntities().get(1).getProperty(PROPERTY_INT16)
+ .getPrimitiveValue().toValue());
+ composedKey.put(PROPERTY_STRING, navMany.getEntitySet().getEntities().get(1).getProperty(PROPERTY_STRING)
+ .getPrimitiveValue().toValue());
+
+ URI esTwoKeyNavEntityManyTwoURI =
+ client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(composedKey)
+ .expand(NAV_PROPERTY_ET_KEY_NAV_ONE).build();
+
+ final ODataEntityRequest<ClientEntity> esTwoKeyNavManyTwoRequest =
+ client.getRetrieveRequestFactory().getEntityRequest(esTwoKeyNavEntityManyTwoURI);
+ esTwoKeyNavManyTwoRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
+ final ODataRetrieveResponse<ClientEntity> esTwoKeyNavManyTwoResponse = esTwoKeyNavManyTwoRequest.execute();
+
+ assertShortOrInt(451, esTwoKeyNavManyTwoResponse.getBody().getProperty(PROPERTY_COMP_NAV)
+ .getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertNotNull(esTwoKeyNavManyTwoResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE));
+
+ nvLink = (ClientInlineEntity)esTwoKeyNavManyTwoResponse.getBody()
+ .getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE);
+ assertEquals(propertyInt16.getPrimitiveValue().toValue(), nvLink.getEntity().getProperty(PROPERTY_INT16)
+ .getPrimitiveValue().toValue());
+ }
+
+ @Test
+ public void testDeepInsertSameEntitySet() throws EdmPrimitiveTypeException {
+ final ODataClient client = getClient();
+ final URI createURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build();
+ final ClientObjectFactory of = client.getObjectFactory();
+ final ClientEntity entity = client.getObjectFactory().newEntity(ET_KEY_NAV);
+
+ // Prepare entity(EntitySet: ESKeyNav, Type: ETKeyNav)
+ entity.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)));
+ entity.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")));
+ entity.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))));
+ entity.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_ALL_PRIM, of.newComplexValue(CT_ALL_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))));
+ entity.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))));
+ entity.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))
+ .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16,
+ of.newPrimitiveValueBuilder().buildInt16((short) 42)))))));
+ entity.addLink(of.newEntityNavigationLink("NavPropertyETTwoKeyNavOne",
+ client.newURIBuilder(SERVICE_URI)
+ .appendEntitySetSegment(ES_TWO_KEY_NAV)
+ .appendKeySegment(new LinkedHashMap<String, Object>() {
+ private static final long serialVersionUID = 1L;
+
+ {
+ put(PROPERTY_INT16, 1);
+ put(PROPERTY_STRING, "1");
+ }
+ })
+ .build()));
+
+ // Prepare inline entity(EntitySet: ESKeyNav, Type: ETKeyNav)
+ final ClientEntity innerEntity = of.newEntity(ET_KEY_NAV);
+ innerEntity.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 43)));
+ innerEntity.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("43")));
+ innerEntity.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 431)))));
+ innerEntity.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_ALL_PRIM, of.newComplexValue(CT_ALL_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("431")))));
+ innerEntity.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 431)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("431")))));
+ innerEntity
+ .getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("431")))
+ .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder()
+ .buildInt16((short) 431)))))));
+ innerEntity.addLink(of.newEntityNavigationLink("NavPropertyETTwoKeyNavOne",
+ client.newURIBuilder(SERVICE_URI)
+ .appendEntitySetSegment(ES_TWO_KEY_NAV)
+ .appendKeySegment(new LinkedHashMap<String, Object>() {
+ private static final long serialVersionUID = 1L;
+
+ {
+ put(PROPERTY_INT16, 1);
+ put(PROPERTY_STRING, "1");
+ }
+ })
+ .build()));
+
+ ClientInlineEntity inlineEntity = of.newDeepInsertEntity(NAV_PROPERTY_ET_KEY_NAV_ONE, innerEntity);
+ entity.addLink(inlineEntity);
+
+ final ODataEntityCreateResponse<ClientEntity> responseCreate =
+ client.getCUDRequestFactory().getEntityCreateRequest(createURI, entity).execute();
+ final String cookie = responseCreate.getHeader(HttpHeader.SET_COOKIE).iterator().next();
+ final Short esKeyNavEntityKey =
+ responseCreate.getBody().getProperty(PROPERTY_INT16).getPrimitiveValue().toCastValue(Short.class);
+
+ // Fetch Entity
+ URI fetchEntityURI =
+ client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(esKeyNavEntityKey)
+ .expand(NAV_PROPERTY_ET_KEY_NAV_ONE).build();
+
+ ODataEntityRequest<ClientEntity> entityRequest =
+ client.getRetrieveRequestFactory().getEntityRequest(fetchEntityURI);
+ entityRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
+ final ODataRetrieveResponse<ClientEntity> entityResponse = entityRequest.execute();
+
+ ClientEntity clientEntity = entityResponse.getBody();
+ ClientInlineEntity navOne =
+ (ClientInlineEntity) clientEntity.getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE);
+
+ // Check values
+ assertShortOrInt(431, navOne.getEntity().getProperty(PROPERTY_COMP_NAV).getComplexValue()
+ .get(PROPERTY_INT16).getPrimitiveValue().toValue());
+
+ Short innerEntityInt16Key = navOne.getEntity().getProperty(PROPERTY_INT16)
+ .getPrimitiveValue().toCastValue(Short.class);
+
+ final URI innerEntityURI =
+ client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(innerEntityInt16Key)
+ .build();
+ final ODataEntityRequest<ClientEntity> innerRequest =
+ client.getRetrieveRequestFactory().getEntityRequest(innerEntityURI);
+ innerRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
+ ODataRetrieveResponse<ClientEntity> innerResponse = innerRequest.execute();
+
+ assertShortOrInt(431, innerResponse.getBody().getProperty(PROPERTY_COMP_NAV)
+ .getComplexValue().get(PROPERTY_INT16)
+ .getPrimitiveValue().toValue());
+ }
+
+ @Test
+ public void testConsistency() throws EdmPrimitiveTypeException {
+ final EdmEnabledODataClient client = getClient(SERVICE_URI);
+ final ClientObjectFactory of = client.getObjectFactory();
+ final String cookie = getCookie();
+
+ // Do not set PropertyString(Nullable=false)
+ final ClientEntity entity = of.newEntity(ET_KEY_NAV);
+ entity.getProperties().add(
+ of.newCollectionProperty(COL_PROPERTY_STRING,
+ of.newCollectionValue(EDM_STRING).add(
+ of.newPrimitiveValueBuilder().buildString("Test"))));
+
+ final URI targetURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build();
+
+ try {
+ ODataEntityCreateRequest<ClientEntity> request = client.getCUDRequestFactory()
+ .getEntityCreateRequest(targetURI, entity);
+ request.addCustomHeader(HttpHeader.COOKIE, cookie);
+ request.execute();
+ fail("Expecting bad request");
+ } catch (ODataClientErrorException e) {
+ assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode());
+ }
+
+ // Entity must not be created
+ validateSet(targetURI, cookie, (short) 1, (short) 2, (short) 3);
+ }
+
+ @Test
+ public void testInvalidType() throws EdmPrimitiveTypeException {
+ final EdmEnabledODataClient client = getClient(SERVICE_URI);
+ final ClientObjectFactory of = client.getObjectFactory();
+ final String cookie = getCookie();
+
+ final ClientEntity entity = of.newEntity(ET_KEY_NAV);
+ entity.getProperties().add(of.newPrimitiveProperty(PROPERTY_STRING,
+ of.newPrimitiveValueBuilder().buildInt32(1)));
+ final URI targetURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build();
+
+ try {
+ ODataEntityCreateRequest<ClientEntity> request = client.getCUDRequestFactory()
+ .getEntityCreateRequest(targetURI, entity);
+ request.addCustomHeader(HttpHeader.COOKIE, cookie);
+ request.execute();
+ } catch (ODataClientErrorException e) {
+ assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode());
+ }
+
+ validateSet(targetURI, cookie, (short) 1, (short) 2, (short) 3);
+
+ entity.getProperties().add(
+ of.newCollectionProperty(PROPERTY_STRING,
+ of.newCollectionValue(EDM_STRING).add(
+ of.newPrimitiveValueBuilder().buildString("Test"))));
+
+ try {
+ ODataEntityCreateRequest<ClientEntity> request = client.getCUDRequestFactory()
+ .getEntityCreateRequest(targetURI, entity);
+ request.addCustomHeader(HttpHeader.COOKIE, cookie);
+ request.execute();
+ } catch (ODataClientErrorException e) {
+ assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode());
+ }
+
+ validateSet(targetURI, cookie, (short) 1, (short) 2, (short) 3);
+ }
+
+ @Test
+ @Ignore
+ public void testDeepInsertOnNavigationPropertyInComplexProperty() {
+ final EdmEnabledODataClient client = getClient(SERVICE_URI);
+ final ClientObjectFactory of = client.getObjectFactory();
+
+ final ClientEntity inlineEntity = of.newEntity(ET_TWO_KEY_NAV);
+ inlineEntity.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+ inlineEntity.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
+ inlineEntity.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 1)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("1")))));
+
+ final ClientEntity entity = of.newEntity(ET_TWO_KEY_NAV);
+ entity.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)));
+ entity.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_BASE_PRIM_COMP_NAV)));
+ entity.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 2)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("2")))));
+
+ final ClientLink link = of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, inlineEntity);
+ final ClientComplexValue complexValueCreate = of.newComplexValue(CT_NAV_FIVE_PROP);
+ complexValueCreate.getNavigationLinks().add(link);
+
+ entity.getProperties().add(
+ of.newCollectionProperty(COL_PROPERTY_COMP_NAV, of.newCollectionValue(CT_NAV_FIVE_PROP)
+ .add(complexValueCreate)));
+
+ final URI targetURI = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).build();
+ final ODataEntityCreateResponse<ClientEntity> response = client.getCUDRequestFactory()
+ .getEntityCreateRequest(targetURI, entity)
+ .execute();
+
+ assertEquals(HttpStatusCode.CREATED.getStatusCode(), response.getStatusCode());
+ final Iterator<ClientValue> iter = response.getBody()
+ .getProperty(COL_PROPERTY_COMP_NAV)
+ .getCollectionValue()
+ .iterator();
+
+ assertTrue(iter.hasNext());
+ final ClientComplexValue complexValue = iter.next().asComplex();
+ final ClientLink linkedEntity = complexValue.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE);
+ assertNotNull(linkedEntity);
+ assertEquals(1, linkedEntity.asInlineEntity()
+ .getEntity()
+ .getProperty(PROPERTY_INT16)
+ .getPrimitiveValue()
+ .toValue());
+ }
+
+ @Test
+ public void testDeepUpsert() {
+ final ODataClient client = getClient();
+ final URI updateURI = client.newURIBuilder(SERVICE_URI)
+ .appendEntitySetSegment(ES_KEY_NAV)
+ .appendKeySegment(815)
+ .build();
+ final ClientObjectFactory of = client.getObjectFactory();
+ final ClientEntity entity = client.getObjectFactory().newEntity(ET_KEY_NAV);
+
+ // Prepare entity(EntitySet: ESKeyNav, Type: ETKeyNav)
+ entity.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)));
+ entity.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")));
+ entity.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))));
+ entity.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_ALL_PRIM, of.newComplexValue(CT_ALL_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))));
+ entity.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))));
+ entity.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))
+ .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16,
+ of.newPrimitiveValueBuilder().buildInt16((short) 42)))))));
+
+ // Non collection navigation property
+ // Create related entity(EntitySet: ESTwoKeyNav, Type: ETTwoKeyNav, Nav. Property: NavPropertyETTwoKeyNavOne)
+ final ClientEntity inlineEntitySingle = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV);
+ inlineEntitySingle.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 43)));
+ inlineEntitySingle.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("43")));
+ inlineEntitySingle.getProperties().add(of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 43)))));
+ inlineEntitySingle.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 431)))));
+ inlineEntitySingle.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 432)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("432")))));
+
+ // Collection navigation property
+ // The navigation property has a partner navigation property named "NavPropertyETKeyNavOne"
+ // Create related entity(EntitySet: ESTwoKeyNav, Type: NavPropertyETTwoKeyNavMany
+ final ClientEntity inlineEntityCol1 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV);
+ inlineEntityCol1.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 44)));
+ inlineEntityCol1.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("44")));
+ inlineEntityCol1.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 441)))));
+ inlineEntityCol1.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 441)))));
+ inlineEntityCol1.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 442)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("442")))));
+
+ final ClientEntity inlineEntityCol2 = client.getObjectFactory().newEntity(ET_TWO_KEY_NAV);
+ inlineEntityCol2.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 45)));
+ inlineEntityCol2.getProperties()
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("45")));
+ inlineEntityCol2.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 451)))));
+ inlineEntityCol2.getProperties().add(
+ of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 451)))));
+ inlineEntityCol2.getProperties()
+ .add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
+ .add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 452)))
+ .add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("452")))));
+
+ final ClientInlineEntity newDeepInsertEntityLink =
+ of.newDeepInsertEntity(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE, inlineEntitySingle);
+ final ClientEntitySet newDeepInsertEntitySet = of.newEntitySet();
+ newDeepInsertEntitySet.getEntities().add(inlineEntityCol1);
+ newDeepInsertEntitySet.getEntities().add(inlineEntityCol2);
+ final ClientInlineEntitySet newDeepInsertEntitySetLink =
+ of.newDeepInsertEntitySet(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, newDeepInsertEntitySet);
+
+ entity.addLink(newDeepInsertEntityLink);
+ entity.addLink(newDeepInsertEntitySetLink);
+
+ // Perform update request (upsert)
+ final ODataEntityUpdateResponse<ClientEntity> responseCreate = client.getCUDRequestFactory()
+ .getEntityUpdateRequest(updateURI, UpdateType.PATCH, entity)
+ .execute();
+ assertEquals(HttpStatusCode.CREATED.getStatusCode(), responseCreate.getStatusCode());
+
+ final String cookie = responseCreate.getHeader(HttpHeader.SET_COOKIE).toString();
+
+ // Fetch ESKeyNav entity with expand of NavPropertyETTwoKeyNavOne nav. property
+ ClientProperty propertyInt16 = responseCreate.getBody().getProperty(PROPERTY_INT16);
+ final URI esKeyNavURI =
+ client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(
+ propertyInt16.getPrimitiveValue().toValue()).expand(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE,
+ NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).build();
+
+ final ODataEntityRequest<ClientEntity> esKeyNavRequest = client.getRetrieveRequestFactory()
+ .getEntityRequest(esKeyNavURI);
+ esKeyNavRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
+ final ODataRetrieveResponse<ClientEntity> esKeyNavResponse = esKeyNavRequest.execute();
+
+ // Check nav. property NavPropertyETTwoKeyNavOne
+ assertNotNull(esKeyNavResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE));
+ ClientInlineEntity navOne = (ClientInlineEntity)esKeyNavResponse.getBody()
+ .getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE);
+ assertShortOrInt(431, navOne.getEntity().getProperty(PROPERTY_COMP_NAV).getComplexValue()
+ .get(PROPERTY_INT16).getPrimitiveValue().toValue());
+
+ // Check nav. property NavPropertyETTwoKeyNavMany
+ assertNotNull(esKeyNavResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY));
+ ClientInlineEntitySet navMany = (ClientInlineEntitySet)esKeyNavResponse.getBody()
+ .getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY);
+ assertEquals(2, navMany.getEntitySet().getEntities().size());
+
+ assertShortOrInt(441, navMany.getEntitySet().getEntities().get(0).getProperty(PROPERTY_COMP_NAV).getValue()
+ .asComplex().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+
+ assertShortOrInt(451, navMany.getEntitySet().getEntities().get(1).getProperty(PROPERTY_COMP_NAV).getValue()
+ .asComplex().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+
+ // Fetch ESTwoKeyNav entities and check if available and the partner relation have been set up
+ // Check ESTwoKeyNav(Created via NavPropertyETTwoKeyNavOne)
+ Map<String, Object> composedKey = new HashMap<String, Object>();
+ composedKey.put(PROPERTY_INT16, navOne.getEntity().getProperty(PROPERTY_INT16)
+ .getPrimitiveValue().toValue());
+ composedKey.put(PROPERTY_STRING, navOne.getEntity().getProperty(PROPERTY_STRING)
+ .getPrimitiveValue().toValue());
+
+ final URI esTwoKeyNavEntitySingleURI = client.newURIBuilder(SERVICE_URI)
+ .appendEntitySetSegment(ES_TWO_KEY_NAV)
+ .appendKeySegment(composedKey)
+ .build();
+
+ final ODataEntityRequest<ClientEntity> esTwoKeyNavSingleRequest = client.getRetrieveRequestFactory()
+ .getEntityRequest(esTwoKeyNavEntitySingleURI);
+ esTwoKeyNavSingleRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
+ final ODataRetrieveResponse<ClientEntity> esTwoKeyNavSingleResponse = esTwoKeyNavSingleRequest.execute();
+ assertShortOrInt(431, esTwoKeyNavSingleResponse.getBody().getProperty(PROPERTY_COMP_NAV)
+ .getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+
+ // Check ESTwoKeyNav(Created via NavPropertyETTwoKeyNavMany(0))
+ composedKey.clear();
+ composedKey.put(PROPERTY_INT16, navMany.getEntitySet().getEntities().get(0)
+ .getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ composedKey.put(PROPERTY_STRING,navMany.getEntitySet().getEntities().get(0)
+ .getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
+
+ URI esTwoKeyNavEntityManyOneURI =
+ client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(composedKey)
+ .expand(NAV_PROPERTY_ET_KEY_NAV_ONE).build();
+
+ final ODataEntityRequest<ClientEntity> esTwoKeyNavManyOneRequest =
+ client.getRetrieveRequestFactory().getEntityRequest(esTwoKeyNavEntityManyOneURI);
+ esTwoKeyNavManyOneRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
+ final ODataRetrieveResponse<ClientEntity> esTwoKeyNavManyOneResponse = esTwoKeyNavManyOneRequest.execute();
+
+ assertShortOrInt(441, esTwoKeyNavManyOneResponse.getBody().getProperty(PROPERTY_COMP_NAV)
+ .getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertNotNull(esTwoKeyNavManyOneResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE));
+ ClientInlineEntity nvLink = (ClientInlineEntity)esTwoKeyNavManyOneResponse.getBody()
+ .getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE);
+ assertEquals(propertyInt16.getPrimitiveValue().toValue(), nvLink.getEntity().getProperty(PROPERTY_INT16)
+ .getPrimitiveValue().toValue());
+
+ // Check ESTwoKeyNav(Created via NavPropertyETTwoKeyNavMany(1))
+ composedKey.clear();
+ composedKey.put(PROPERTY_INT16, navMany.getEntitySet().getEntities().get(1)
+ .getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ composedKey.put(PROPERTY_STRING,navMany.getEntitySet().getEntities().get(1)
+ .getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
+
+ URI esTwoKeyNavEntityManyTwoURI =
+ client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_KEY_NAV).appendKeySegment(composedKey)
+ .expand(NAV_PROPERTY_ET_KEY_NAV_ONE).build();
+
+ final ODataEntityRequest<ClientEntity> esTwoKeyNavManyTwoRequest =
+ client.getRetrieveRequestFactory().getEntityRequest(esTwoKeyNavEntityManyTwoURI);
+ esTwoKeyNavManyTwoRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
+ final ODataRetrieveResponse<ClientEntity> esTwoKeyNavManyTwoResponse = esTwoKeyNavManyTwoRequest.execute();
+
+ assertShortOrInt(451, esTwoKeyNavManyTwoResponse.getBody().getProperty(PROPERTY_COMP_NAV)
+ .getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertNotNull(esTwoKeyNavManyTwoResponse.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE));
+ nvLink = (ClientInlineEntity)esTwoKeyNavManyTwoResponse.getBody()
+ .getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE);
+ assertEquals(propertyInt16.getPrimitiveValue().toValue(),nvLink.getEntity()
+ .getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ }
+
+ private String getCookie() {
+ final EdmEnabledODataClient client = getClient(SERVICE_URI);
+ final ODataRetrieveResponse<ClientEntitySet> response = client.getRetrieveRequestFactory()
+ .getEntitySetRequest(client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build())
+ .execute();
+
+ return response.getHeader(HttpHeader.SET_COOKIE).iterator().next();
+ }
+
+ private void validateSet(final URI uri, final String cookie, final short... keys)
+ throws EdmPrimitiveTypeException {
+ final EdmEnabledODataClient client = getClient(SERVICE_URI);
+ final ODataEntitySetRequest<ClientEntitySet> request = client.getRetrieveRequestFactory()
+ .getEntitySetRequest(uri);
+ request.addCustomHeader(HttpHeader.COOKIE, cookie);
+ final ODataRetrieveResponse<ClientEntitySet> response = request.execute();
+
+ assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
+ assertEquals(3, response.getBody().getEntities().size());
+
+ for (final ClientEntity responseEntity : response.getBody().getEntities()) {
+ short propertyInt16 = responseEntity.getProperty(PROPERTY_INT16)
+ .getPrimitiveValue().toCastValue(Short.class);
+
+ boolean found = false;
+ for (int i = 0; i < keys.length && !found; i++) {
+ if (propertyInt16 == keys[i]) {
+ found = true;
+ }
+ }
+
+ if (!found) {
+ fail("Invalid key " + propertyInt16);
+ }
+ }
+ }
+
+ protected ODataClient getClient() {
+ ODataClient odata = ODataClientFactory.getClient();
+ odata.getConfiguration().setDefaultPubFormat(ContentType.APPLICATION_ATOM_XML);
+ return odata;
+ }
+
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_ATOM_XML.toContentTypeString()));
+ }
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.APPLICATION_ATOM_XML);
+ }
+}
\ No newline at end of file
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/EdmEnabledClientITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/EdmEnabledClientITCase.java
deleted file mode 100644
index 05622bf..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/EdmEnabledClientITCase.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.tecsvc.client;
-
-import static org.junit.Assert.*;
-
-import java.net.URI;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.fit.AbstractBaseTestITCase;
-import org.apache.olingo.fit.tecsvc.TecSvcConst;
-import org.junit.Test;
-
-public class EdmEnabledClientITCase extends AbstractBaseTestITCase {
-
- private static final String SERVICE_URI = TecSvcConst.BASE_URI;
- private static final String ES_KEY_NAV = "ESKeyNav";
- private static final String NAV_PROPERTY_ET_KEY_NAV_ONE = "NavPropertyETKeyNavOne";
-
- @Test
- public void readSingleValuedNavigationPropertyWithNullValue() {
- final ODataClient client = getClient();
- final URI uri = client.newURIBuilder(SERVICE_URI)
- .appendEntitySetSegment(ES_KEY_NAV)
- .appendKeySegment(3)
- .expand(NAV_PROPERTY_ET_KEY_NAV_ONE)
- .build();
-
-
- final ODataRetrieveResponse<ClientEntity> response = getClient().getRetrieveRequestFactory()
- .getEntityRequest(uri)
- .execute();
-
- assertEquals(0, response.getBody().getNavigationLinks().size());
- assertNull(response.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE));
- }
-
- @Override
- protected ODataClient getClient() {
- final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
- return client;
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/EntityReferencesITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/EntityReferencesITCase.java
index e6c2bcf..c650c5f 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/EntityReferencesITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/EntityReferencesITCase.java
@@ -37,13 +37,15 @@
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.client.api.domain.ClientInlineEntity;
import org.apache.olingo.client.api.uri.QueryOption;
import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
+import org.junit.Assert;
import org.junit.Test;
public class EntityReferencesITCase extends AbstractBaseTestITCase {
@@ -63,6 +65,15 @@
private static final String PROPERTY_INT16 = "PropertyInt16";
private static final String PROPERTY_STRING = "PropertyString";
+
+ void assertShortOrInt(int value, Object n) {
+ if (n instanceof Number) {
+ assertEquals(value, ((Number)n).intValue());
+ } else {
+ Assert.fail();
+ }
+ }
+
@Test
public void testOrderBy() {
final ODataClient client = getClient();
@@ -249,9 +260,12 @@
.asInlineEntitySet()
.getEntitySet();
assertEquals(3, inlineEntitySet.getEntities().size());
- assertEquals(1, inlineEntitySet.getEntities().get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
- assertEquals(2, inlineEntitySet.getEntities().get(1).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
- assertEquals(3, inlineEntitySet.getEntities().get(2).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, inlineEntitySet.getEntities().get(0)
+ .getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(2, inlineEntitySet.getEntities().get(1)
+ .getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(3, inlineEntitySet.getEntities().get(2)
+ .getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
}
@Test
@@ -287,9 +301,12 @@
.asInlineEntitySet()
.getEntitySet();
assertEquals(3, inlineEntitySet.getEntities().size());
- assertEquals(1, inlineEntitySet.getEntities().get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
- assertEquals(2, inlineEntitySet.getEntities().get(1).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
- assertEquals(3, inlineEntitySet.getEntities().get(2).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, inlineEntitySet.getEntities().get(0)
+ .getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(2, inlineEntitySet.getEntities().get(1)
+ .getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(3, inlineEntitySet.getEntities().get(2)
+ .getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
}
@Test
@@ -385,7 +402,7 @@
final ODataRetrieveResponse<ClientEntity> responseGet = requestGet.execute();
assertEquals(HttpStatusCode.OK.getStatusCode(), responseGet.getStatusCode());
- assertEquals(3, responseGet.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)
+ assertShortOrInt(3, responseGet.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)
.asInlineEntity()
.getEntity()
.getProperty(PROPERTY_INT16)
@@ -419,7 +436,7 @@
final ODataRetrieveResponse<ClientEntity> responseGet = requestGet.execute();
assertEquals(HttpStatusCode.OK.getStatusCode(), responseGet.getStatusCode());
- assertEquals(3, responseGet.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)
+ assertShortOrInt(3, responseGet.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)
.asInlineEntity()
.getEntity()
.getProperty(PROPERTY_INT16)
@@ -595,7 +612,8 @@
.getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)
.asInlineEntity().getEntity();
- assertEquals(3, inlineEntity.getProperty(PROPERTY_INT16).getPrimitiveValue().asPrimitive().toValue());
+ assertShortOrInt(3, inlineEntity.getProperty(PROPERTY_INT16)
+ .getPrimitiveValue().asPrimitive().toValue());
}
@Test
@@ -645,9 +663,12 @@
.getEntitySet();
assertEquals(3, inlineEntitySet.getEntities().size());
- assertEquals(1, inlineEntitySet.getEntities().get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
- assertEquals(2, inlineEntitySet.getEntities().get(1).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
- assertEquals(3, inlineEntitySet.getEntities().get(2).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, inlineEntitySet.getEntities().get(0)
+ .getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(2, inlineEntitySet.getEntities().get(1)
+ .getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(3, inlineEntitySet.getEntities().get(2)
+ .getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
}
@Test
@@ -673,13 +694,13 @@
requestGet.addCustomHeader(HttpHeader.COOKIE, cookie);
final ODataRetrieveResponse<ClientEntity> responseGet = requestGet.execute();
- assertEquals(1, responseGet.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY)
+ assertShortOrInt(1, responseGet.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY)
.asInlineEntitySet()
.getEntitySet()
.getEntities()
.size());
- assertEquals(2, responseGet.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY)
+ assertShortOrInt(2, responseGet.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY)
.asInlineEntitySet()
.getEntitySet()
.getEntities()
@@ -711,7 +732,14 @@
requestGet.addCustomHeader(HttpHeader.COOKIE, cookie);
final ODataRetrieveResponse<ClientEntity> responseGet = requestGet.execute();
- assertEquals(0, responseGet.getBody().getNavigationLinks().size());
+
+ if(isJson()) {
+ assertEquals(0, responseGet.getBody().getNavigationLinks().size());
+ } else {
+ // in xml the links will be always present; but the content will not be if no $expand unlike
+ // json;metadata=minimal; json=full is same as application/xml
+ assertEquals(6, responseGet.getBody().getNavigationLinks().size());
+ }
}
@Test
@@ -807,7 +835,11 @@
assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), ex.getStatusLine().getStatusCode());
}
}
-
+
+ private boolean isJson() {
+ return getClient().getConfiguration().getDefaultPubFormat().equals(ContentType.JSON);
+ }
+
@Test
public void testNavigateTwoTimesThanDeleteReferenceInCollection() {
final ODataClient client = getClient();
@@ -834,8 +866,15 @@
final ODataEntityRequest<ClientEntity> requestGet = client.getRetrieveRequestFactory().getEntityRequest(uriGet);
requestGet.addCustomHeader(HttpHeader.COOKIE, cookie);
final ODataRetrieveResponse<ClientEntity> responseGet = requestGet.execute();
+ if(isJson()) {
+ assertNull(responseGet.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE));
+ } else {
+ // in xml the links will be always present; but the content will not be if no $expand unlike
+ // json;metadata=minimal; json=full is same as application/xml
+ Assert.assertFalse(responseGet.getBody()
+ .getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE) instanceof ClientInlineEntity);
+ }
- assertNull(responseGet.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE));
}
@Test
@@ -872,7 +911,7 @@
.getEntities()
.size());
- assertEquals(3, responseGet.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY)
+ assertShortOrInt(3, responseGet.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY)
.asInlineEntitySet()
.getEntitySet()
.getEntities()
@@ -908,7 +947,15 @@
getRequestESTwoKeyNav.addCustomHeader(HttpHeader.COOKIE, cookie);
final ODataRetrieveResponse<ClientEntity> responseGetRequestESTwoKeyNav = getRequestESTwoKeyNav.execute();
// Entity has been removed
- assertNull(responseGetRequestESTwoKeyNav.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE));
+ if(isJson()) {
+ assertNull(responseGetRequestESTwoKeyNav.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE));
+ } else {
+ // in xml the links will be always present; but the content will not be if no $expand unlike
+ // json;metadata=minimal; json=full is same as application/xml
+ Assert.assertFalse(responseGetRequestESTwoKeyNav.getBody()
+ .getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE) instanceof ClientInlineEntity);
+ }
+
final URI uriGetESKeyNav = client.newURIBuilder(SERVICE_URI)
.appendEntitySetSegment(ES_KEY_NAV)
@@ -929,10 +976,10 @@
// The Entities in the collection are still there
assertEquals(2, navEntities.size());
- assertEquals(1, navEntities.get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, navEntities.get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
assertEquals("1", navEntities.get(0).getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
- assertEquals(1, navEntities.get(1).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, navEntities.get(1).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
assertEquals("2", navEntities.get(1).getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
}
@@ -967,7 +1014,7 @@
.getEntities();
assertEquals(1, navEntities.size());
- assertEquals(1, navEntities.get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, navEntities.get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
assertEquals("2", navEntities.get(0).getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
final Map<String, Object> esTwoKEyNavKey = new HashMap<String, Object>();
@@ -981,7 +1028,58 @@
.getEntityRequest(uriGetESTwoKeyNav);
requestGetESTwoKey.addCustomHeader(HttpHeader.COOKIE, cookie);
final ODataRetrieveResponse<ClientEntity> responseGetESTwoKeyNav = requestGetESTwoKey.execute();
- assertNull(responseGetESTwoKeyNav.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE));
+
+ if(isJson()) {
+ assertNull(responseGetESTwoKeyNav.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE));
+ } else {
+ // in xml the links will be always present; but the content will not be if no $expand unlike
+ // json;metadata=minimal; json=full is same as application/xml
+ Assert.assertFalse(responseGetESTwoKeyNav.getBody()
+ .getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE) instanceof ClientInlineEntity);
+ }
+ }
+
+ @Test
+ public void testCreateMissingNavigationProperty() throws Exception {
+ final ODataClient client = getClient();
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendRefSegment().build();
+ final URI ref = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(1).build();
+
+ try {
+ client.getCUDRequestFactory().getReferenceAddingRequest(new URI(SERVICE_URI), uri, ref).execute();
+ } catch (ODataClientErrorException e) {
+ assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode());
+ }
+ }
+
+ @Test
+ public void testUpdateMissingNavigationProperty() throws Exception {
+ final ODataClient client = getClient();
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV)
+ .appendKeySegment(1)
+ .appendRefSegment()
+ .build();
+ final URI ref = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(1).build();
+
+ try {
+ client.getCUDRequestFactory().getReferenceSingleChangeRequest(new URI(SERVICE_URI), uri, ref).execute();
+ } catch (ODataClientErrorException e) {
+ assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode());
+ }
+ }
+
+ @Test
+ public void testDeleteMissingNavigationProperty() {
+ final ODataClient client = getClient();
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV)
+ .appendRefSegment()
+ .build();
+
+ try {
+ client.getCUDRequestFactory().getDeleteRequest(uri);
+ } catch (ODataClientErrorException e) {
+ assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode());
+ }
}
private void sendRequest(final URI uri, final int count, final String... expected) {
@@ -1001,9 +1099,13 @@
@Override
protected ODataClient getClient() {
- final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
- client.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ final EdmEnabledODataClient client = ODataClientFactory.getEdmEnabledClient(SERVICE_URI, ContentType.JSON);
+ client.getConfiguration().setDefaultPubFormat(ContentType.JSON);
return client;
}
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.JSON);
+ }
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/EntityReferencesXmlITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/EntityReferencesXmlITCase.java
new file mode 100644
index 0000000..3a3627b
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/EntityReferencesXmlITCase.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.fit.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class EntityReferencesXmlITCase extends EntityReferencesITCase {
+
+ @Override
+ protected ODataClient getClient() {
+ ODataClient odata = ODataClientFactory.getClient();
+ odata.getConfiguration().setDefaultPubFormat(ContentType.APPLICATION_ATOM_XML);
+ return odata;
+ }
+
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_ATOM_XML.toContentTypeString()));
+ }
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.APPLICATION_ATOM_XML);
+ }
+}
\ No newline at end of file
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java
index 1ae1f22..72a6726 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectITCase.java
@@ -24,6 +24,7 @@
import java.util.List;
+import org.apache.olingo.client.api.EdmEnabledODataClient;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
@@ -34,13 +35,23 @@
import org.apache.olingo.client.api.domain.ClientLinkType;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
+import org.junit.Assert;
import org.junit.Test;
-public final class ExpandSelectITCase extends AbstractBaseTestITCase {
+public class ExpandSelectITCase extends AbstractBaseTestITCase {
+ void assertShortOrInt(int value, Object n) {
+ if (n instanceof Number) {
+ assertEquals(value, ((Number)n).intValue());
+ } else {
+ Assert.fail();
+ }
+ }
+
@Test
public void readSelect() {
final ODataClient client = getClient();
@@ -64,7 +75,7 @@
ClientProperty property = entity.getProperty("PropertyInt16");
assertNotNull(property);
assertNotNull(property.getPrimitiveValue());
- assertEquals(Integer.valueOf(Short.MAX_VALUE), property.getPrimitiveValue().toValue());
+ assertShortOrInt(Integer.valueOf(Short.MAX_VALUE), property.getPrimitiveValue().toValue());
property = entity.getProperty("PropertyInt32");
assertNotNull(property);
@@ -72,6 +83,10 @@
assertEquals(Integer.MAX_VALUE, property.getPrimitiveValue().toValue());
}
+ private boolean isJson() {
+ return getClient().getConfiguration().getDefaultPubFormat().equals(ContentType.JSON);
+ }
+
@Test
public void readExpandSelect() {
final ODataClient client = getClient();
@@ -96,7 +111,13 @@
assertNotNull(property.getPrimitiveValue());
assertEquals("Test String2", property.getPrimitiveValue().toValue());
- assertNull(entity.getNavigationLink("NavPropertyETAllPrimOne"));
+ if(isJson()) {
+ assertNull(entity.getNavigationLink("NavPropertyETAllPrimOne"));
+ } else {
+ // in xml the links will be always present; but the content will not be if no $expand unlike
+ // json;metadata=minimal; json=full is same as application/xml
+ Assert.assertFalse(entity.getNavigationLink("NavPropertyETAllPrimOne") instanceof ClientInlineEntity);
+ }
final ClientLink link = entity.getNavigationLink("NavPropertyETAllPrimMany");
assertNotNull(link);
@@ -108,7 +129,7 @@
assertEquals(2, entities.size());
final ClientEntity inlineEntity = entities.get(0);
assertEquals(2, inlineEntity.getProperties().size());
- assertEquals(-128, inlineEntity.getProperty("PropertySByte").getPrimitiveValue().toValue());
+ assertShortOrInt(-128, inlineEntity.getProperty("PropertySByte").getPrimitiveValue().toValue());
assertEquals(new java.sql.Timestamp(85754000),
inlineEntity.getProperty("PropertyTimeOfDay").getPrimitiveValue().toValue());
}
@@ -130,7 +151,13 @@
assertNotNull(entity);
assertEquals(2, entity.getProperties().size());
- assertNull(entity.getNavigationLink("NavPropertyETAllPrimMany"));
+ if(isJson()) {
+ assertNull(entity.getNavigationLink("NavPropertyETAllPrimMany"));
+ } else {
+ // in xml the links will be always present; but the content will not be if no $expand unlike
+ // json;metadata=minimal; json=full is same as application/xml
+ Assert.assertFalse(entity.getNavigationLink("NavPropertyETAllPrimMany") instanceof ClientInlineEntity);
+ }
final ClientLink link = entity.getNavigationLink("NavPropertyETAllPrimOne");
assertNotNull(link);
@@ -145,12 +172,37 @@
final ClientEntity innerEntity = innerLink.asInlineEntity().getEntity();
assertNotNull(innerEntity);
assertEquals(2, innerEntity.getProperties().size());
- assertEquals(32767, innerEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, innerEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("Test String4", innerEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
}
+ @Test
+ public void expandSingleValuedNavigationPropertyWithNullValue() {
+ final ODataClient client = getClient();
+ final ODataRetrieveResponse<ClientEntity> response = client.getRetrieveRequestFactory()
+ .getEntityRequest(client.newURIBuilder(TecSvcConst.BASE_URI)
+ .appendEntitySetSegment("ESKeyNav").appendKeySegment(3).expand("NavPropertyETKeyNavOne").build())
+ .execute();
+
+ if(isJson()) {
+ // this will be only true in the json;metadata=minimal case not always
+ assertEquals(0, response.getBody().getNavigationLinks().size());
+ assertNull(response.getBody().getNavigationLink("NavPropertyETKeyNavOne"));
+ } else {
+ // in xml the links will be always present; but the content will not be if no $expand unlike
+ // json;metadata=minimal; json=full is same as application/xml
+ assertEquals(6, response.getBody().getNavigationLinks().size());
+ Assert.assertFalse(response.getBody()
+ .getNavigationLink("NavPropertyETKeyNavOne") instanceof ClientInlineEntity);
+ }
+ }
+
@Override
protected ODataClient getClient() {
- return ODataClientFactory.getEdmEnabledClient(TecSvcConst.BASE_URI);
+ return ODataClientFactory.getEdmEnabledClient(TecSvcConst.BASE_URI, ContentType.JSON);
}
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.JSON);
+ }
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectXmlITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectXmlITCase.java
new file mode 100644
index 0000000..a589cb1
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandSelectXmlITCase.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.fit.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class ExpandSelectXmlITCase extends ExpandSelectITCase {
+
+ @Override
+ protected ODataClient getClient() {
+ ODataClient odata = ODataClientFactory.getClient();
+ odata.getConfiguration().setDefaultPubFormat(ContentType.APPLICATION_ATOM_XML);
+ return odata;
+ }
+
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_ATOM_XML.toContentTypeString()));
+ }
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.APPLICATION_ATOM_XML);
+ }
+}
\ No newline at end of file
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsITCase.java
index 7516e4d..7aa230d 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsITCase.java
@@ -29,17 +29,19 @@
import org.apache.olingo.client.api.EdmEnabledODataClient;
import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.communication.ODataServerErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.client.api.uri.QueryOption;
import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
+import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
@@ -53,6 +55,14 @@
private static final String PROPERTY_INT16 = "PropertyInt16";
private static final String PROPERTY_STRING = "PropertyString";
+ void assertShortOrInt(int value, Object n) {
+ if (n instanceof Number) {
+ assertEquals(value, ((Number)n).intValue());
+ } else {
+ Assert.fail();
+ }
+ }
+
@Test
public void testFilter() {
final Map<QueryOption, Object> options = new HashMap<QueryOption, Object>();
@@ -64,26 +74,26 @@
assertEquals(4, entities.size());
for (final ClientEntity entity : entities) {
- final Object propInt16 = entity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue();
+ final Number propInt16 = (Number)entity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue();
final Object propString = entity.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue();
final ClientEntitySet inlineEntitySet =
entity.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).asInlineEntitySet().getEntitySet();
- if (propInt16.equals(1) && propString.equals("1")) {
+ if (propInt16.intValue() == 1 && propString.equals("1")) {
assertEquals(1, inlineEntitySet.getEntities().size());
final ClientEntity inlineEntity = inlineEntitySet.getEntities().get(0);
- assertEquals(1, inlineEntity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, inlineEntity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
assertEquals("2", inlineEntity.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
- } else if (propInt16.equals(1) && propString.equals("2")) {
+ } else if (propInt16.intValue() == 1 && propString.equals("2")) {
assertEquals(0, inlineEntitySet.getEntities().size());
- } else if (propInt16.equals(2) && propString.equals("1")) {
+ } else if (propInt16.intValue() == 2 && propString.equals("1")) {
assertEquals(1, inlineEntitySet.getEntities().size());
final ClientEntity inlineEntity = inlineEntitySet.getEntities().get(0);
- assertEquals(1, inlineEntity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, inlineEntity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
assertEquals("2", inlineEntity.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
- } else if (propInt16.equals(3) && propString.equals("1")) {
+ } else if (propInt16.intValue() == 3 && propString.equals("1")) {
assertEquals(0, inlineEntitySet.getEntities().size());
} else {
fail();
@@ -196,22 +206,22 @@
assertEquals(4, entities.size());
for (final ClientEntity entity : entities) {
- final Object propInt16 = entity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue();
+ final Number propInt16 = (Number)entity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue();
final Object propString = entity.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue();
final ClientEntitySet inlineEntitySet =
entity.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).asInlineEntitySet().getEntitySet();
- if (propInt16.equals(1) && propString.equals("1")) {
+ if (propInt16.intValue() == 1 && propString.equals("1")) {
assertEquals(1, inlineEntitySet.getEntities().size());
final ClientEntity inlineEntity = inlineEntitySet.getEntities().get(0);
- assertEquals(1, inlineEntity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, inlineEntity.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
assertEquals("2", inlineEntity.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
- } else if (propInt16.equals(1) && propString.equals("2")) {
+ } else if (propInt16.intValue() == 1 && propString.equals("2")) {
assertEquals(0, inlineEntitySet.getEntities().size());
- } else if (propInt16.equals(2) && propString.equals("1")) {
+ } else if (propInt16.intValue() == 2 && propString.equals("1")) {
assertEquals(0, inlineEntitySet.getEntities().size());
- } else if (propInt16.equals(3) && propString.equals("1")) {
+ } else if (propInt16.intValue() == 3 && propString.equals("1")) {
assertEquals(0, inlineEntitySet.getEntities().size());
} else {
fail();
@@ -276,7 +286,7 @@
final ClientEntitySet entitySet =
response.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_MANY).asInlineEntitySet().getEntitySet();
assertEquals(1, entitySet.getEntities().size());
- assertEquals(1, entitySet.getEntities().get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, entitySet.getEntities().get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
}
@Test
@@ -336,7 +346,7 @@
.getEntities()
.get(0);
- assertEquals(1, entitySecondLevel.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, entitySecondLevel.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
assertEquals("2", entitySecondLevel.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
assertNotNull(entitySecondLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY));
@@ -352,7 +362,7 @@
.getEntities()
.get(0);
- assertEquals(1, entityThirdLevel.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, entityThirdLevel.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
assertEquals("1", entityThirdLevel.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
assertNotNull(entityThirdLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY));
@@ -367,10 +377,10 @@
.getEntitySet()
.getEntities();
- assertEquals(1, fourthLevelEntites.get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, fourthLevelEntites.get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
assertEquals("1", fourthLevelEntites.get(0).getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
- assertEquals(1, fourthLevelEntites.get(1).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, fourthLevelEntites.get(1).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
assertEquals("2", fourthLevelEntites.get(1).getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
}
@@ -412,7 +422,7 @@
.getEntities()
.get(0);
- assertEquals(1, entitySecondLevel.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, entitySecondLevel.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
assertEquals("2", entitySecondLevel.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
assertNotNull(entitySecondLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY));
@@ -428,7 +438,7 @@
.getEntities()
.get(0);
- assertEquals(1, entityThirdLevel.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, entityThirdLevel.getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
assertEquals("1", entityThirdLevel.getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
assertNotNull(entityThirdLevel.getNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY));
@@ -443,10 +453,101 @@
.getEntitySet()
.getEntities();
- assertEquals(1, fourthLevelEntites.get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
+ assertShortOrInt(1, fourthLevelEntites.get(0).getProperty(PROPERTY_INT16).getPrimitiveValue().toValue());
assertEquals("1", fourthLevelEntites.get(0).getProperty(PROPERTY_STRING).getPrimitiveValue().toValue());
}
+ @Test
+ public void expandWithSearchQuery() {
+ final ODataClient client = getClient();
+ final Map<QueryOption, Object> expandOptions = new HashMap<QueryOption, Object>();
+ expandOptions.put(QueryOption.SEARCH, "abc");
+ expandOptions.put(QueryOption.FILTER, "PropertyInt16 eq 1");
+
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV)
+ .expandWithOptions(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, expandOptions)
+ .build();
+
+ final ODataEntitySetRequest<ClientEntitySet> request = client.getRetrieveRequestFactory().getEntitySetRequest(uri);
+
+ try {
+ request.execute();
+ } catch(ODataServerErrorException e) {
+ assertEquals("HTTP/1.1 501 Not Implemented", e.getMessage());
+ }
+ }
+
+ @Test
+ public void expandWithLevels() {
+ final ODataClient client = getClient();
+ final Map<QueryOption, Object> expandOptions = new HashMap<QueryOption, Object>();
+ expandOptions.put(QueryOption.LEVELS, 2);
+
+ // expand=*($levels=2)
+ URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV)
+ .expandWithOptions("*", expandOptions)
+ .build();
+
+ try {
+ client.getRetrieveRequestFactory().getEntitySetRequest(uri);
+ } catch(ODataServerErrorException e) {
+ assertEquals("HTTP/1.1 501 Not Implemented", e.getMessage());
+ }
+
+ // expand=NavPropertyETTwoKeyNavMany($levels=2)
+ expandOptions.clear();
+ expandOptions.put(QueryOption.LEVELS, 2);
+ uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV)
+ .expandWithOptions(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, expandOptions)
+ .build();
+
+ try {
+ client.getRetrieveRequestFactory().getEntitySetRequest(uri);
+ } catch(ODataServerErrorException e) {
+ assertEquals("HTTP/1.1 501 Not Implemented", e.getMessage());
+ }
+
+ // expand=NavPropertyETTwoKeyNavMany($expand=NavPropertyETTwoKeyNavMany($levels=2))
+ expandOptions.clear();
+ expandOptions.put(QueryOption.EXPAND, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY + "($levels=2)");
+ uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV)
+ .expandWithOptions(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, expandOptions)
+ .build();
+
+ try {
+ client.getRetrieveRequestFactory().getEntitySetRequest(uri);
+ } catch(ODataServerErrorException e) {
+ assertEquals("HTTP/1.1 501 Not Implemented", e.getMessage());
+ }
+
+ // expand=NavPropertyETTwoKeyNavMany($expand=NavPropertyETTwoKeyNavMany($levels=2);$levels=3)
+ expandOptions.clear();
+ expandOptions.put(QueryOption.LEVELS, 2);
+ uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV)
+ .expandWithOptions(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, expandOptions)
+ .build();
+
+ try {
+ client.getRetrieveRequestFactory().getEntitySetRequest(uri);
+ } catch(ODataServerErrorException e) {
+ assertEquals("HTTP/1.1 501 Not Implemented", e.getMessage());
+ }
+
+ // expand=NavPropertyETTwoKeyNavMany($expand=NavPropertyETTwoKeyNavMany($levels=2))
+ expandOptions.clear();
+ expandOptions.put(QueryOption.EXPAND, NAV_PROPERTY_ET_TWO_KEY_NAV_MANY + "($levels=2)");
+ expandOptions.put(QueryOption.LEVELS, 3);
+ uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV)
+ .expandWithOptions(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY, expandOptions)
+ .build();
+
+ try {
+ client.getRetrieveRequestFactory().getEntitySetRequest(uri);
+ } catch(ODataServerErrorException e) {
+ assertEquals("HTTP/1.1 501 Not Implemented", e.getMessage());
+ }
+ }
+
private ODataRetrieveResponse<ClientEntitySet> buildRequest(final String entitySet, final String navigationProperty,
final Map<QueryOption, Object> expandOptions) {
return buildRequest(entitySet, navigationProperty, expandOptions, null);
@@ -470,8 +571,12 @@
@Override
protected ODataClient getClient() {
- EdmEnabledODataClient odata = ODataClientFactory.getEdmEnabledClient(SERVICE_URI);
- odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ EdmEnabledODataClient odata = ODataClientFactory.getEdmEnabledClient(SERVICE_URI, ContentType.JSON);
+ odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
return odata;
}
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.JSON);
+ }
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsXmlITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsXmlITCase.java
new file mode 100644
index 0000000..6e21cbc
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ExpandWithSystemQueryOptionsXmlITCase.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.fit.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class ExpandWithSystemQueryOptionsXmlITCase extends ExpandWithSystemQueryOptionsITCase {
+
+ @Override
+ protected ODataClient getClient() {
+ ODataClient odata = ODataClientFactory.getClient();
+ odata.getConfiguration().setDefaultPubFormat(ContentType.APPLICATION_ATOM_XML);
+ return odata;
+ }
+
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_ATOM_XML.toContentTypeString()));
+ }
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.APPLICATION_ATOM_XML);
+ }
+}
\ No newline at end of file
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
index 1e27357..dfcfd50 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryITCase.java
@@ -34,7 +34,7 @@
import org.apache.olingo.client.api.domain.ClientObjectFactory;
import org.apache.olingo.client.core.ODataClientFactory;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
@@ -61,24 +61,24 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
-
+
@Test
public void testBooleanLiteral() {
ODataRetrieveResponse<ClientEntitySet> response = sendRequest(ES_ALL_PRIM, "PropertyBoolean eq false");
assertEquals(2, response.getBody().getEntities().size());
ClientEntity clientEntity = response.getBody().getEntities().get(0);
- assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
clientEntity = response.getBody().getEntities().get(1);
- assertEquals(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
response = sendRequest(ES_ALL_PRIM, "PropertyBoolean eq true");
assertEquals(1, response.getBody().getEntities().size());
clientEntity = response.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -87,7 +87,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -97,7 +97,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -108,7 +108,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -120,7 +120,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -129,11 +129,11 @@
assertEquals(2, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(1);
- assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("2", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
}
@@ -144,7 +144,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
}
@@ -165,7 +165,7 @@
assertEquals(1, response.getBody().getEntities().size());
ClientEntity clientEntity = response.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -183,17 +183,17 @@
sendRequest(ES_TWO_KEY_NAV, "PropertyString eq '2' and PropertyInt16 eq 1");
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("2", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
result = sendRequest(ES_TWO_KEY_NAV, "PropertyString eq '2' or PropertyInt16 eq 1");
assertEquals(2, result.getBody().getEntities().size());
clientEntity = result.getBody().getEntities().get(0);
- assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(1);
- assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("2", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
}
@@ -252,9 +252,8 @@
ODataRetrieveResponse<ClientEntitySet> response =
sendRequest(ES_ALL_PRIM, "substring(PropertyString, -1, 1) eq 'F'");
assertEquals(1, response.getBody().getEntities().size());
-
- assertEquals(32767, response.getBody().getEntities().get(0).getProperty("PropertyInt16").getPrimitiveValue()
- .toValue());
+ assertShortOrInt(32767, response.getBody().getEntities().get(0).getProperty("PropertyInt16")
+ .getPrimitiveValue().toValue());
// -1 should be treated as 0, Same values substring(PropertyString, 0, 0) returns the empty String
response = sendRequest(ES_ALL_PRIM, "substring(PropertyString, 0, -1) eq ''");
@@ -344,21 +343,21 @@
assertEquals(3, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
- assertEquals(11, clientEntity.getProperty("PropertyComp").getComplexValue().get("PropertyInt16")
+ assertShortOrInt(11, clientEntity.getProperty("PropertyComp").getComplexValue().get("PropertyInt16")
.getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(1);
- assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("2", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
- assertEquals(11, clientEntity.getProperty("PropertyComp").getComplexValue().get("PropertyInt16")
+ assertShortOrInt(11, clientEntity.getProperty("PropertyComp").getComplexValue().get("PropertyInt16")
.getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(2);
- assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
- assertEquals(11, clientEntity.getProperty("PropertyComp").getComplexValue().get("PropertyInt16")
+ assertShortOrInt(11, clientEntity.getProperty("PropertyComp").getComplexValue().get("PropertyInt16")
.getPrimitiveValue().toValue());
}
@@ -368,11 +367,11 @@
assertEquals(2, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(2, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(2, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(1);
- assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
}
@@ -382,11 +381,11 @@
assertEquals(2, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(2, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(2, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(1);
- assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
}
@@ -396,11 +395,11 @@
assertEquals(2, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(2, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(2, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(1);
- assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
}
@@ -430,7 +429,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -441,19 +440,19 @@
assertEquals(4, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(1);
- assertEquals(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(1, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("2", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(2);
- assertEquals(2, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(2, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(3);
- assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
}
@@ -470,7 +469,15 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ }
+
+ void assertShortOrInt(int value, Object n) {
+ if (n instanceof Number) {
+ assertEquals(value, ((Number)n).intValue());
+ } else {
+ Assert.fail();
+ }
}
@Test
@@ -479,7 +486,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -488,13 +495,13 @@
assertEquals(3, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(1);
- assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(2);
- assertEquals(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -503,7 +510,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -512,13 +519,13 @@
assertEquals(3, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(1);
- assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(2);
- assertEquals(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -527,7 +534,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -536,10 +543,10 @@
assertEquals(2, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(1);
- assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -548,7 +555,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -557,7 +564,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -566,7 +573,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -575,7 +582,7 @@
assertEquals(1, response.getBody().getEntities().size());
ClientEntity clientEntity = response.getBody().getEntities().get(0);
- assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -584,7 +591,7 @@
assertEquals(1, response.getBody().getEntities().size());
ClientEntity clientEntity = response.getBody().getEntities().get(0);
- assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -594,11 +601,11 @@
assertEquals(2, response.getBody().getEntities().size());
ClientEntity clientEntity = response.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("W/\"32767\"", clientEntity.getETag());
clientEntity = response.getBody().getEntities().get(1);
- assertEquals(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("W/\"0\"", clientEntity.getETag());
}
@@ -638,14 +645,14 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq floor(3.1)");
assertEquals(1, result.getBody().getEntities().size());
clientEntity = result.getBody().getEntities().get(0);
- assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
}
@@ -655,14 +662,14 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq ceiling(2.6)");
assertEquals(1, result.getBody().getEntities().size());
clientEntity = result.getBody().getEntities().get(0);
- assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
}
@@ -672,28 +679,28 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq round(2.4)");
assertEquals(1, result.getBody().getEntities().size());
clientEntity = result.getBody().getEntities().get(0);
- assertEquals(2, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(2, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq round(2.6)");
assertEquals(1, result.getBody().getEntities().size());
clientEntity = result.getBody().getEntities().get(0);
- assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
result = sendRequest(ES_TWO_KEY_NAV, "PropertyInt16 eq round(3.1)");
assertEquals(1, result.getBody().getEntities().size());
clientEntity = result.getBody().getEntities().get(0);
- assertEquals(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(3, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
assertEquals("1", clientEntity.getProperty("PropertyString").getPrimitiveValue().toValue());
}
@@ -703,10 +710,10 @@
assertEquals(2, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
clientEntity = result.getBody().getEntities().get(1);
- assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -716,7 +723,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -725,7 +732,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -735,7 +742,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -745,7 +752,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -755,7 +762,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -765,7 +772,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(-32768, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -775,7 +782,7 @@
assertEquals(1, result.getBody().getEntities().size());
ClientEntity clientEntity = result.getBody().getEntities().get(0);
- assertEquals(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -793,7 +800,7 @@
assertEquals(1, response.getBody().getEntities().size());
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -803,7 +810,7 @@
assertEquals(1, response.getBody().getEntities().size());
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -820,7 +827,7 @@
assertEquals(1, response.getBody().getEntities().size());
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -830,7 +837,7 @@
assertEquals(1, response.getBody().getEntities().size());
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -840,7 +847,7 @@
assertEquals(1, response.getBody().getEntities().size());
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -850,7 +857,7 @@
assertEquals(1, response.getBody().getEntities().size());
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
- assertEquals(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(32767, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -860,7 +867,7 @@
assertEquals(1, response.getBody().getEntities().size());
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
- assertEquals(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -870,7 +877,7 @@
assertEquals(1, response.getBody().getEntities().size());
final ClientEntity clientEntity = response.getBody().getEntities().get(0);
- assertEquals(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
+ assertShortOrInt(0, clientEntity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
}
@Test
@@ -968,12 +975,65 @@
result = sendRequest("ESKeyNav", "PropertyCompCompNav/PropertyCompNav/PropertyInt16 eq null", cookie);
assertEquals(1, result.getBody().getEntities().size());
}
-
+
@Test
- public void testSringFunctionWithoutStringParameters() {
- fail("ESServerSidePaging", "filter=contains(PropertyInt16, 3) eq 'hallo'", HttpStatusCode.BAD_REQUEST);
+ public void testFilterNotBooleanExpression() {
+ // Check that only boolean expression are allowed
+ fail("ESAllPrim", "PropertytString", HttpStatusCode.BAD_REQUEST);
+ fail("ESAllPrim", "PropertyInt16", HttpStatusCode.BAD_REQUEST);
+ fail("ESAllPrim", "PropertyInt32", HttpStatusCode.BAD_REQUEST);
+ fail("ESAllPrim", "PropertyInt64", HttpStatusCode.BAD_REQUEST);
+ fail("ESAllPrim", "PropertyDate", HttpStatusCode.BAD_REQUEST);
+ fail("ESAllPrim", "PropertyDuation", HttpStatusCode.BAD_REQUEST);
+ fail("ESAllPrim", "PropertyTimeOfDay", HttpStatusCode.BAD_REQUEST);
+ fail("ESAllPrim", "PropertyByte", HttpStatusCode.BAD_REQUEST);
+ fail("ESAllPrim", "PropertyDouble", HttpStatusCode.BAD_REQUEST);
+ fail("ESAllPrim", "PropertySingle", HttpStatusCode.BAD_REQUEST);
+ }
+
+ @Test
+ public void testComparisonOnStringOperands() {
+ // If check if the expression is true => All entry are returned
+ ODataRetrieveResponse<ClientEntitySet> result = sendRequest(ES_ALL_PRIM, "'Tes' lt 'Test'");
+ assertEquals(3, result.getBody().getEntities().size());
+
+ result = sendRequest(ES_ALL_PRIM, "'Test' le 'Test'");
+ assertEquals(3, result.getBody().getEntities().size());
+
+ result = sendRequest(ES_ALL_PRIM, "'Test1' le 'Test'");
+ assertEquals(0, result.getBody().getEntities().size());
+
+ result = sendRequest(ES_ALL_PRIM, "'Test1' gt 'Test'");
+ assertEquals(3, result.getBody().getEntities().size());
+
+ result = sendRequest(ES_ALL_PRIM, "'Tes' gt 'Test'");
+ assertEquals(0, result.getBody().getEntities().size());
+
+ result = sendRequest(ES_ALL_PRIM, "'Test' ge 'Test'");
+ assertEquals(3, result.getBody().getEntities().size());
+
+ result = sendRequest(ES_ALL_PRIM, "'Test' eq 'Test'");
+ assertEquals(3, result.getBody().getEntities().size());
+
+ result = sendRequest(ES_ALL_PRIM, "'Test1' ne 'Test'");
+ assertEquals(3, result.getBody().getEntities().size());
+ }
+
+ @Test
+ public void testCastException() {
+ fail("ESAllPrim", "PropertyInt16 eq '1'", HttpStatusCode.BAD_REQUEST);
+ fail("ESAllPrim", "PropertyInt16 eq 03:26:05", HttpStatusCode.BAD_REQUEST);
+ fail("ESAllPrim", "PropertyInt16 eq true", HttpStatusCode.BAD_REQUEST);
+ fail("ESAllPrim", "PropertyInt16 eq 2012-12-03T07:16:23Z", HttpStatusCode.BAD_REQUEST);
+ fail("ESAllPrim", "PropertyInt16 eq duration'PT4S'", HttpStatusCode.BAD_REQUEST);
}
+
+ @Test
+ public void testStringFunctionWithoutStringParameters() {
+ fail("ESServerSidePaging", "contains(PropertyInt16, 3) eq 'hallo'", HttpStatusCode.BAD_REQUEST);
+ }
+
private ODataRetrieveResponse<ClientEntitySet> sendRequest(final String entitySet, final String filterString) {
return sendRequest(entitySet, filterString, null);
}
@@ -1008,7 +1068,7 @@
@Override
protected ODataClient getClient() {
ODataClient odata = ODataClientFactory.getClient();
- odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
return odata;
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryXmlITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryXmlITCase.java
new file mode 100644
index 0000000..e755386
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FilterSystemQueryXmlITCase.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.fit.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class FilterSystemQueryXmlITCase extends FilterSystemQueryITCase {
+
+ @Override
+ protected ODataClient getClient() {
+ ODataClient odata = ODataClientFactory.getClient();
+ odata.getConfiguration().setDefaultPubFormat(ContentType.APPLICATION_ATOM_XML);
+ return odata;
+ }
+
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_ATOM_XML.toContentTypeString()));
+ }
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.APPLICATION_ATOM_XML);
+ }
+}
\ No newline at end of file
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportITCase.java
index 5632bda..6e97f2d 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportITCase.java
@@ -22,31 +22,45 @@
import static org.junit.Assert.assertNotNull;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
+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;
import org.apache.olingo.client.api.communication.response.ODataInvokeResponse;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ClientCollectionValue;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
+import org.junit.Assert;
import org.junit.Test;
public class FunctionImportITCase extends AbstractBaseTestITCase {
+ void assertShortOrInt(int value, Object n) {
+ if (n instanceof Number) {
+ assertEquals(value, ((Number)n).intValue());
+ } else {
+ Assert.fail();
+ }
+ }
+
@Test
public void entity() throws Exception {
final ODataInvokeRequest<ClientEntity> request = getClient().getInvokeRequestFactory()
@@ -62,7 +76,7 @@
assertNotNull(entity);
final ClientProperty property = entity.getProperty("PropertyInt16");
assertNotNull(property);
- assertEquals(1, property.getPrimitiveValue().toValue());
+ assertShortOrInt(1, property.getPrimitiveValue().toValue());
}
@Test
@@ -80,7 +94,7 @@
assertNotNull(entity);
final ClientProperty property = entity.getProperty("PropertyInt16");
assertNotNull(property);
- assertEquals(1, property.getPrimitiveValue().toValue());
+ assertShortOrInt(1, property.getPrimitiveValue().toValue());
}
@Test
@@ -129,7 +143,7 @@
final ClientProperty property = entity.getProperty("PropertyInt16");
assertNotNull(property);
assertNotNull(property.getPrimitiveValue());
- assertEquals(1, property.getPrimitiveValue().toValue());
+ assertShortOrInt(1, property.getPrimitiveValue().toValue());
}
@Test
@@ -150,7 +164,7 @@
final ClientProperty property = response.getBody();
assertNotNull(property);
assertNotNull(property.getPrimitiveValue());
- assertEquals(2, property.getPrimitiveValue().toValue());
+ assertShortOrInt(2, property.getPrimitiveValue().toValue());
}
@Test
@@ -176,7 +190,7 @@
final ClientProperty property = response.getBody();
assertNotNull(property);
- assertEquals(16, property.getPrimitiveValue().toValue());
+ assertShortOrInt(16, property.getPrimitiveValue().toValue());
}
@Test
@@ -220,10 +234,81 @@
assertEquals("UFCRTCTTwoPrim string value", response.getBody().toValue());
}
+ @Test
+ public void testFICRTStringTwoParamNotNull() {
+ final Map<String, Object> keys = new HashMap<String, Object>();
+ keys.put("ParameterInt16", 3);
+ keys.put("ParameterString", "ab");
+
+ ODataPropertyRequest<ClientProperty> request = getClient().getRetrieveRequestFactory()
+ .getPropertyRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendPropertySegment("FICRTStringTwoParam").appendKeySegment(keys).build());
+ final ODataRetrieveResponse<ClientProperty> response = request.execute();
+ assertEquals("\"ab\",\"ab\",\"ab\"", response.getBody().getPrimitiveValue().toValue());
+ }
+
+ @Test
+ public void testFICRTStringTwoParamNull() {
+ final Map<String, Object> keys = new HashMap<String, Object>();
+ keys.put("ParameterInt16", 1);
+
+ ODataPropertyRequest<ClientProperty> request = getClient().getRetrieveRequestFactory()
+ .getPropertyRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendPropertySegment("FICRTStringTwoParam").appendKeySegment(keys).build());
+ final ODataRetrieveResponse<ClientProperty> response = request.execute();
+ assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
+ }
+
+ @Test
+ public void testFICRTCollCTTwoPrimTwoParamNotNull() {
+ final Map<String, Object> keys = new HashMap<String, Object>();
+ keys.put("ParameterInt16", 2);
+ keys.put("ParameterString", "TestString");
+
+ ODataPropertyRequest<ClientProperty> request = getClient().getRetrieveRequestFactory()
+ .getPropertyRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendEntitySetSegment("FICRTCollCTTwoPrimTwoParam").appendKeySegment(keys).build());
+ final ODataRetrieveResponse<ClientProperty> response = request.execute();
+ final ClientCollectionValue<ClientValue> collection = response.getBody().getCollectionValue().asCollection();
+ final Iterator<ClientValue> iter = collection.iterator();
+
+ ClientComplexValue complexValue = iter.next().asComplex();
+ assertShortOrInt(1, complexValue.get("PropertyInt16").getPrimitiveValue().toValue());
+ assertEquals("UFCRTCollCTTwoPrimTwoParam string value: TestString", complexValue.get("PropertyString")
+ .getPrimitiveValue().toValue());
+ complexValue = iter.next().asComplex();
+ assertShortOrInt(2, complexValue.get("PropertyInt16").getPrimitiveValue().toValue());
+ assertEquals("UFCRTCollCTTwoPrimTwoParam string value: TestString", complexValue.get("PropertyString")
+ .getPrimitiveValue().toValue());
+ }
+
+ @Test
+ public void testFICRTCollCTTwoPrimTwoParamNull() {
+ final Map<String, Object> keys = new HashMap<String, Object>();
+ keys.put("ParameterInt16", 2);
+ keys.put("ParameterString", null);
+
+ ODataPropertyRequest<ClientProperty> request = getClient().getRetrieveRequestFactory()
+ .getPropertyRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI)
+ .appendEntitySetSegment("FICRTCollCTTwoPrimTwoParam").appendKeySegment(keys).build());
+ final ODataRetrieveResponse<ClientProperty> response = request.execute();
+ final ClientCollectionValue<ClientValue> collection = response.getBody().getCollectionValue().asCollection();
+ final Iterator<ClientValue> iter = collection.iterator();
+
+ ClientComplexValue complexValue = iter.next().asComplex();
+ assertShortOrInt(1, complexValue.get("PropertyInt16").getPrimitiveValue().toValue());
+ assertEquals("UFCRTCollCTTwoPrimTwoParam int16 value: 2", complexValue.get("PropertyString")
+ .getPrimitiveValue().toValue());
+ complexValue = iter.next().asComplex();
+ assertShortOrInt(2, complexValue.get("PropertyInt16").getPrimitiveValue().toValue());
+ assertEquals("UFCRTCollCTTwoPrimTwoParamstring value: null", complexValue.get("PropertyString")
+ .getPrimitiveValue().toValue());
+ }
+
@Override
protected ODataClient getClient() {
ODataClient odata = ODataClientFactory.getClient();
- odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
return odata;
}
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportXmlITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportXmlITCase.java
new file mode 100644
index 0000000..9e8aa6e
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/FunctionImportXmlITCase.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.fit.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class FunctionImportXmlITCase extends FunctionImportITCase {
+
+ @Override
+ protected ODataClient getClient() {
+ ODataClient odata = ODataClientFactory.getClient();
+ odata.getConfiguration().setDefaultPubFormat(ContentType.APPLICATION_ATOM_XML);
+ return odata;
+ }
+
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_ATOM_XML.toContentTypeString()));
+ }
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.APPLICATION_ATOM_XML);
+ }
+}
\ No newline at end of file
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java
index 3bd14c1..8c7f2ad 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java
@@ -43,15 +43,21 @@
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.core.ODataClientFactory;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
+import org.junit.Assert;
import org.junit.Test;
-public final class MediaITCase extends AbstractBaseTestITCase {
-
+public class MediaITCase extends AbstractBaseTestITCase {
+ void assertShortOrInt(int value, Object n) {
+ if (n instanceof Number) {
+ assertEquals(value, ((Number)n).intValue());
+ } else {
+ Assert.fail();
+ }
+ }
@Test
public void read() throws Exception {
final ODataClient client = getClient();
@@ -139,7 +145,7 @@
final ClientProperty property = entity.getProperty("PropertyInt16");
assertNotNull(property);
assertNotNull(property.getPrimitiveValue());
- assertEquals(5, property.getPrimitiveValue().toValue());
+ assertShortOrInt(5, property.getPrimitiveValue().toValue());
// Check that the media stream has been created.
// This check has to be in the same session in order to access the same data provider.
@@ -156,7 +162,7 @@
@Override
protected ODataClient getClient() {
ODataClient odata = ODataClientFactory.getClient();
- odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
return odata;
}
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaXmlITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaXmlITCase.java
new file mode 100644
index 0000000..24d67d1
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaXmlITCase.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.fit.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class MediaXmlITCase extends MediaITCase {
+
+ @Override
+ protected ODataClient getClient() {
+ ODataClient odata = ODataClientFactory.getClient();
+ odata.getConfiguration().setDefaultPubFormat(ContentType.APPLICATION_ATOM_XML);
+ return odata;
+ }
+
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_ATOM_XML.toContentTypeString()));
+ }
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.APPLICATION_ATOM_XML);
+ }
+}
\ No newline at end of file
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java
index e20d44e..efcb168 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationITCase.java
@@ -20,6 +20,9 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
@@ -27,16 +30,60 @@
import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
+import org.apache.olingo.fit.util.StringHelper;
+import org.junit.Assert;
import org.junit.Test;
-public final class NavigationITCase extends AbstractBaseTestITCase {
+public class NavigationITCase extends AbstractBaseTestITCase {
private final ODataClient client = getClient();
+
+ void assertShortOrInt(int value, Object n) {
+ if (n instanceof Number) {
+ assertEquals(value, ((Number)n).intValue());
+ } else {
+ Assert.fail();
+ }
+ }
+
+ @Test
+ public void navigationToEntityWithRelativeContextUrl() throws Exception {
+ // zero navigation
+ final InputStream zeroLevelResponse = client.getRetrieveRequestFactory().getEntityRequest(
+ client.newURIBuilder(TecSvcConst.BASE_URI)
+ .appendEntitySetSegment("ESAllPrim").
+ appendKeySegment(32767).build()).rawExecute();
+
+ String zeroLevelResponseBody = StringHelper.asString(zeroLevelResponse);
+ assertTrue(zeroLevelResponseBody.contains("\"$metadata#ESAllPrim/$entity\""));
+
+ // one navigation
+ final InputStream oneLevelResponse = client.getRetrieveRequestFactory().getEntityRequest(
+ client.newURIBuilder(TecSvcConst.BASE_URI)
+ .appendEntitySetSegment("ESAllPrim").appendKeySegment(32767)
+ .appendNavigationSegment("NavPropertyETTwoPrimOne").build())
+ .rawExecute();
+
+ String oneLevelResponseBody = StringHelper.asString(oneLevelResponse);
+ assertTrue(oneLevelResponseBody.contains("\"../$metadata#ESTwoPrim/$entity\""));
+
+ // two navigation
+ final InputStream twoLevelResponse = client.getRetrieveRequestFactory().getEntityRequest(
+ client.newURIBuilder(TecSvcConst.BASE_URI)
+ .appendEntitySetSegment("ESTwoPrim").appendKeySegment(32767)
+ .appendNavigationSegment("NavPropertyETAllPrimOne")
+ .appendNavigationSegment("NavPropertyETTwoPrimMany").appendKeySegment(-365).build())
+ .rawExecute();
+
+ String twoLevelResponseBody = StringHelper.asString(twoLevelResponse);
+ assertTrue(twoLevelResponseBody.contains("\"../../$metadata#ESTwoPrim/$entity\""));
+ }
+
@Test
public void oneLevelToEntity() throws Exception {
final ODataRetrieveResponse<ClientEntity> response =
@@ -129,13 +176,13 @@
final ClientProperty property = response.getBody();
assertNotNull(property);
assertNotNull(property.getPrimitiveValue());
- assertEquals(1, property.getPrimitiveValue().toValue());
+ assertShortOrInt(1, property.getPrimitiveValue().toValue());
}
@Override
protected ODataClient getClient() {
ODataClient odata = ODataClientFactory.getClient();
- odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
return odata;
}
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationXmlITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationXmlITCase.java
new file mode 100644
index 0000000..7b00c77
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/NavigationXmlITCase.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.fit.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class NavigationXmlITCase extends NavigationITCase {
+
+ @Override
+ protected ODataClient getClient() {
+ ODataClient odata = ODataClientFactory.getClient();
+ odata.getConfiguration().setDefaultPubFormat(ContentType.APPLICATION_ATOM_XML);
+ return odata;
+ }
+
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_ATOM_XML.toContentTypeString()));
+ }
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.APPLICATION_ATOM_XML);
+ }
+}
\ No newline at end of file
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java
index aa91ed9..f576afa 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryITCase.java
@@ -30,7 +30,7 @@
import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.client.api.domain.ClientValuable;
import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
@@ -164,7 +164,7 @@
@Override
protected ODataClient getClient() {
ODataClient odata = ODataClientFactory.getClient();
- odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
return odata;
}
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryOptionXmlITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryOptionXmlITCase.java
new file mode 100644
index 0000000..574c819
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/OrderBySystemQueryOptionXmlITCase.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.fit.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class OrderBySystemQueryOptionXmlITCase extends OrderBySystemQueryITCase {
+
+ @Override
+ protected ODataClient getClient() {
+ ODataClient odata = ODataClientFactory.getClient();
+ odata.getConfiguration().setDefaultPubFormat(ContentType.APPLICATION_ATOM_XML);
+ return odata;
+ }
+
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_ATOM_XML.toContentTypeString()));
+ }
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.APPLICATION_ATOM_XML);
+ }
+}
\ No newline at end of file
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java
index 1dbd0e6..8f3e63c 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexITCase.java
@@ -50,7 +50,6 @@
import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.client.core.ODataClientFactory;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
@@ -73,7 +72,7 @@
ODataRetrieveResponse<ClientProperty> response = request.execute();
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
- assertThat(response.getContentType(), containsString(ContentType.APPLICATION_JSON.toContentTypeString()));
+ assertContentType(response.getContentType());
final ClientProperty property = response.getBody();
assertNotNull(property);
@@ -90,9 +89,19 @@
.appendPropertySegment("PropertyString")
.build());
ODataRetrieveResponse<ClientProperty> response = request.execute();
- String actualResult = IOUtils.toString(response.getRawResponse(), "UTF-8");
- assertTrue(actualResult.startsWith("{\"@odata.context\":\"$metadata#ESTwoPrim(32766)/PropertyString\","));
- assertTrue(actualResult.endsWith("\"value\":\"Test String1\"}"));
+
+ if (isJson()) {
+ String actualResult = IOUtils.toString(response.getRawResponse(), "UTF-8");
+ assertTrue(actualResult.startsWith("{\"@odata.context\":\"$metadata#ESTwoPrim(32766)/PropertyString\","));
+ assertTrue(actualResult.endsWith("\"value\":\"Test String1\"}"));
+ } else {
+ ClientProperty property = response.getBody();
+ assertEquals("Test String1", property.getPrimitiveValue().toValue());
+ }
+ }
+
+ private boolean isJson() {
+ return getClient().getConfiguration().getDefaultPubFormat().equals(ContentType.JSON);
}
@Test
@@ -142,6 +151,10 @@
assertTrue(property.getCollectionValue().isEmpty());
}
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_JSON.toContentTypeString()));
+ }
+
@Test
public void readComplexProperty() throws Exception {
final ODataPropertyRequest<ClientProperty> request = getClient().getRetrieveRequestFactory()
@@ -152,7 +165,7 @@
.build());
ODataRetrieveResponse<ClientProperty> response = request.execute();
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
- assertThat(response.getContentType(), containsString(ContentType.APPLICATION_JSON.toContentTypeString()));
+ assertContentType(response.getContentType());
final ClientProperty property = response.getBody();
assertNotNull(property);
@@ -169,9 +182,16 @@
.appendPropertySegment("PropertyComp")
.build());
ODataRetrieveResponse<ClientProperty> response = request.execute();
- String actualResult = IOUtils.toString(response.getRawResponse(), "UTF-8");
- assertTrue(actualResult.startsWith("{\"@odata.context\":\"$metadata#ESMixPrimCollComp(7)/PropertyComp\","));
- assertTrue(actualResult.endsWith("\"PropertyInt16\":222,\"PropertyString\":\"TEST B\"}"));
+
+ if (isJson()) {
+ String actualResult = IOUtils.toString(response.getRawResponse(), "UTF-8");
+ assertTrue(actualResult.startsWith("{\"@odata.context\":\"$metadata#ESMixPrimCollComp(7)/PropertyComp\","));
+ assertTrue(actualResult.endsWith("\"PropertyInt16\":222,\"PropertyString\":\"TEST B\"}"));
+ } else {
+ ClientProperty property = response.getBody();
+ assertEquals((short)222, property.getComplexValue().get("PropertyInt16").getValue().asPrimitive().toValue());
+ assertEquals("TEST B", property.getComplexValue().get("PropertyString").getValue().asPrimitive().toValue());
+ }
}
@Test
@@ -233,7 +253,7 @@
final ODataPropertyUpdateResponse response = request.execute();
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
- assertThat(response.getContentType(), containsString(ContentType.APPLICATION_JSON.toContentTypeString()));
+ assertContentType(response.getContentType());
final ClientProperty property = response.getBody();
assertNotNull(property);
@@ -264,7 +284,11 @@
assertNotNull(property.getComplexValue());
final ClientComplexValue value = property.getComplexValue();
assertEquals("Test String42", value.get("PropertyString").getPrimitiveValue().toValue());
- assertEquals(222, value.get("PropertyInt16").getPrimitiveValue().toValue());
+ if(isJson()) {
+ assertEquals(222, value.get("PropertyInt16").getPrimitiveValue().toValue());
+ } else {
+ assertEquals((short)222, value.get("PropertyInt16").getPrimitiveValue().toValue());
+ }
}
@Test
@@ -368,6 +392,21 @@
}
@Test
+ public void updatePropertyValueMinimalResponse() throws Exception {
+ ODataValueUpdateRequest request = getClient().getCUDRequestFactory().getValueUpdateRequest(
+ getClient().newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESTwoPrim").appendKeySegment(32766)
+ .appendPropertySegment("PropertyString")
+ .build(),
+ UpdateType.REPLACE,
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("Test String1"));
+ request.setPrefer(getClient().newPreferences().returnMinimal());
+
+ final ODataValueUpdateResponse response = request.execute();
+ assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
+ assertEquals("return=minimal", response.getHeader(HttpHeader.PREFERENCE_APPLIED).iterator().next());
+ }
+
+ @Test
public void readPrimitiveCollectionCount() {
final ODataValueRequest request = getClient().getRetrieveRequestFactory()
.getValueRequest(getClient().newURIBuilder(SERVICE_URI)
@@ -405,7 +444,7 @@
@Override
protected ODataClient getClient() {
ODataClient odata = ODataClientFactory.getClient();
- odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
return odata;
}
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexXmlITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexXmlITCase.java
new file mode 100644
index 0000000..b6070a5
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/PrimitiveComplexXmlITCase.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.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class PrimitiveComplexXmlITCase extends PrimitiveComplexITCase {
+ @Override
+ protected ODataClient getClient() {
+ ODataClient odata = ODataClientFactory.getClient();
+ odata.getConfiguration().setDefaultPubFormat(ContentType.APPLICATION_ATOM_XML);
+ return odata;
+ }
+
+ protected void assertContentType(String content) {
+ try {
+ assertThat(content, containsString(ContentType.APPLICATION_ATOM_XML.toContentTypeString()));
+ } catch(AssertionError t) {
+ assertThat(content, containsString(ContentType.APPLICATION_XML.toContentTypeString()));
+ }
+ }
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.APPLICATION_ATOM_XML);
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
index bbd9d51..1249903 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionITCase.java
@@ -25,11 +25,14 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
+import org.apache.olingo.client.api.communication.ODataServerErrorException;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
@@ -211,7 +214,7 @@
// Check initial next link format
URI nextLink = response.getBody().getNext();
- assertEquals(SERVICE_URI + "/ESServerSidePaging?%24skiptoken=1", nextLink.toASCIIString());
+ assertEquals(SERVICE_URI + "/ESServerSidePaging?%24skiptoken=1%2A10", nextLink.toASCIIString());
// Check subsequent next links
response = client.getRetrieveRequestFactory()
@@ -219,7 +222,7 @@
.execute();
nextLink = response.getBody().getNext();
- assertEquals(SERVICE_URI + "/ESServerSidePaging?%24skiptoken=2", nextLink.toASCIIString());
+ assertEquals(SERVICE_URI + "/ESServerSidePaging?%24skiptoken=2%2A10", nextLink.toASCIIString());
}
@Test
@@ -236,7 +239,7 @@
// Check initial next link format
URI nextLink = response.getBody().getNext();
- assertEquals(SERVICE_URI + "/ESServerSidePaging?%24count=true&%24skiptoken=1",
+ assertEquals(SERVICE_URI + "/ESServerSidePaging?%24count=true&%24skiptoken=1%2A10",
nextLink.toASCIIString());
int token = 1;
@@ -250,7 +253,7 @@
nextLink = response.getBody().getNext();
if (nextLink != null) {
- assertEquals(SERVICE_URI + "/ESServerSidePaging?%24count=true&%24skiptoken=" + token,
+ assertEquals(SERVICE_URI + "/ESServerSidePaging?%24count=true&%24skiptoken=" + token + "%2A10",
nextLink.toASCIIString());
}
}
@@ -259,6 +262,19 @@
}
@Test
+ public void nextLinkFormatWithClientPageSize() {
+ final ODataClient client = getClient();
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_SERVER_SIDE_PAGING).build();
+ ODataEntitySetRequest<ClientEntitySet> request = client.getRetrieveRequestFactory().getEntitySetRequest(uri);
+ request.setPrefer(getClient().newPreferences().maxPageSize(7));
+
+ final ODataRetrieveResponse<ClientEntitySet> response = request.execute();
+ assertEquals("odata.maxpagesize=7", response.getHeader(HttpHeader.PREFERENCE_APPLIED).iterator().next());
+ assertEquals(SERVICE_URI + '/' + ES_SERVER_SIDE_PAGING + "?%24skiptoken=1%2A" + 7,
+ response.getBody().getNext().toASCIIString());
+ }
+
+ @Test
public void testNegativeSkip() {
ODataClient client = getClient();
URI uri = client.newURIBuilder(SERVICE_URI)
@@ -292,11 +308,28 @@
assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), e.getStatusLine().getStatusCode());
}
}
-
+
+ @Test
+ public void testNegativeSearch() {
+ ODataClient client = getClient();
+ URI uri = client.newURIBuilder(SERVICE_URI)
+ .appendEntitySetSegment(ES_ALL_PRIM)
+ .search("ABC")
+ .build();
+ try {
+ client.getRetrieveRequestFactory()
+ .getEntitySetRequest(uri)
+ .execute();
+ fail();
+ } catch (ODataServerErrorException e) {
+ assertEquals("HTTP/1.1 501 Not Implemented", e.getMessage());
+ }
+ }
+
@Override
protected ODataClient getClient() {
ODataClient odata = ODataClientFactory.getClient();
- odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ odata.getConfiguration().setDefaultPubFormat(ContentType.JSON);
return odata;
}
}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionXmlITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionXmlITCase.java
new file mode 100644
index 0000000..5178241
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/SystemQueryOptionXmlITCase.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.fit.tecsvc.client;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class SystemQueryOptionXmlITCase extends SystemQueryOptionITCase {
+
+ @Override
+ protected ODataClient getClient() {
+ ODataClient odata = ODataClientFactory.getClient();
+ odata.getConfiguration().setDefaultPubFormat(ContentType.APPLICATION_ATOM_XML);
+ return odata;
+ }
+
+ protected void assertContentType(String content) {
+ assertThat(content, containsString(ContentType.APPLICATION_ATOM_XML.toContentTypeString()));
+ }
+
+ protected EdmEnabledODataClient getClient(String serviceURI) {
+ return ODataClientFactory.getEdmEnabledClient(serviceURI, ContentType.APPLICATION_ATOM_XML);
+ }
+}
\ No newline at end of file
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicAsyncITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicAsyncITCase.java
new file mode 100644
index 0000000..fa0e4b3
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicAsyncITCase.java
@@ -0,0 +1,259 @@
+/*
+ * 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.tecsvc.http;
+
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpMethod;
+import org.apache.olingo.fit.AbstractBaseTestITCase;
+import org.apache.olingo.fit.tecsvc.TecSvcConst;
+import org.apache.olingo.fit.util.StringHelper;
+import org.apache.olingo.server.tecsvc.async.TechnicalAsyncService;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import java.util.regex.Pattern;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * Test support of asynchronous batch within the TecSvc without using the OData client library (only
+ * use java.net.* components for plain http communication).
+ */
+public class BasicAsyncITCase extends AbstractBaseTestITCase {
+
+ private static final String SERVICE_URI = TecSvcConst.BASE_URI + "/";
+
+ private static final String HEADER_CONTENT_TRANSFER_ENCODING_BINARY = "Content-Transfer-Encoding: binary";
+ private static final String HEADER_CONTENT_TYPE_HTTP =
+ HttpHeader.CONTENT_TYPE + ": " + ContentType.APPLICATION_HTTP.toContentTypeString();
+ private static final String DEFAULT_BATCH_BOUNDARY = "batch_123";
+ private static final String ACCEPT_HEADER_VALUE = ContentType.APPLICATION_JSON.toContentTypeString();
+
+ private static final String CRLF = "\r\n";
+ private static final String DEFAULT_ENCODING = "utf-8";
+ public static final long SLEEP_TIMEOUT_IN_MS = 200;
+
+ /**
+ * Works
+ */
+ @Test
+ public void batchAsync() throws Exception {
+ final String content = getDefaultRequest("ESAllPrim(32767)");
+ final HttpURLConnection connection = postBatch(StringHelper.encapsulate(content), DEFAULT_BATCH_BOUNDARY, 1);
+ StringHelper.Stream response = StringHelper.toStream(connection.getInputStream());
+
+ assertEquals(0, response.byteLength());
+
+ Map<String, List<String>> headerFields = connection.getHeaderFields();
+ assertEquals("HTTP/1.1 202 Accepted", headerFields.get(null).get(0));
+ assertTrue(Pattern.matches("http:\\/\\/localhost:9080\\/odata-server-tecsvc\\/status\\/\\d*",
+ headerFields.get("Location").get(0)));
+ assertEquals("respond-async", headerFields.get("Preference-Applied").get(0));
+
+ // get async response (still pending)
+ String respondUri = headerFields.get("Location").get(0);
+ HttpURLConnection statusRequest = getRequest(new URL(respondUri), Collections.<String, String>emptyMap());
+ StringHelper.Stream statusBody = StringHelper.toStream(statusRequest.getInputStream());
+ Map<String, List<String>> statusHeaderFields = statusRequest.getHeaderFields();
+ assertEquals("HTTP/1.1 202 Accepted", statusHeaderFields.get(null).get(0));
+ assertEquals(0, statusBody.byteLength());
+
+ // get async response (now finished)
+ HttpURLConnection result = waitTillDone(respondUri, 4);
+
+ StringHelper.Stream resultBody = StringHelper.toStream(result.getInputStream());
+ Map<String, List<String>> resultHeaderFields = result.getHeaderFields();
+ String resBody = resultBody.asString();
+
+ assertEquals("HTTP/1.1 200 OK", resultHeaderFields.get(null).get(0));
+ assertEquals(1013, resultBody.byteLength());
+ contains(resBody,
+ "HTTP/1.1 200 OK",
+ "OData-Version: 4.0",
+ "Content-Length: 605",
+ "\"@odata.context\":\"$metadata#ESAllPrim/$entity\"",
+ "\"PropertyInt16\":32767",
+ "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\",",
+ "--batch_", "--");
+ }
+
+ /**
+ * Test with changeset
+ */
+ @Test
+ public void asyncChangesetViaPost() throws Exception {
+ InputStream content = Thread.currentThread().getContextClassLoader().getResourceAsStream("basicBatchPost.batch");
+ final HttpURLConnection connection = postBatch(content, "batch_8194-cf13-1f56", 1);
+ StringHelper.Stream response = StringHelper.toStream(connection.getInputStream());
+ assertEquals(0, response.byteLength());
+
+ Map<String, List<String>> headerFields = connection.getHeaderFields();
+ assertEquals("HTTP/1.1 202 Accepted", headerFields.get(null).get(0));
+ // because of generated status id it is only checked that the location starts correct and contains a number
+ assertTrue(Pattern.matches("http:\\/\\/localhost:9080\\/odata-server-tecsvc\\/status\\/\\d*",
+ headerFields.get("Location").get(0)));
+ assertEquals("respond-async", headerFields.get("Preference-Applied").get(0));
+
+ // get async response (still pending)
+ String respondUri = headerFields.get("Location").get(0);
+ HttpURLConnection statusRequest = getRequest(new URL(respondUri), Collections.<String, String>emptyMap());
+ StringHelper.Stream statusBody = StringHelper.toStream(statusRequest.getInputStream());
+ Map<String, List<String>> statusHeaderFields = statusRequest.getHeaderFields();
+ assertEquals("HTTP/1.1 202 Accepted", statusHeaderFields.get(null).get(0));
+ assertEquals(0, statusBody.byteLength());
+
+ // get async response (now finished)
+ HttpURLConnection result = waitTillDone(respondUri, 4);
+ StringHelper.Stream resultBody = StringHelper.toStream(result.getInputStream());
+ Map<String, List<String>> resultHeaderFields = result.getHeaderFields();
+ String resBody = resultBody.asString();
+ assertEquals("HTTP/1.1 200 OK", resultHeaderFields.get(null).get(0));
+ assertEquals(2324, resultBody.byteLength());
+ contains(resBody,
+ "HTTP/1.1 200 OK",
+ "OData-Version: 4.0",
+ "Content-Length: 605",
+ "\"@odata.context\":\"$metadata#ESAllPrim/$entity\"",
+ "\"PropertyInt16\":32767",
+ "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\",",
+ "--batch_", "--");
+ }
+
+ /**
+ * Validates that the content contains all given values in same order as the parameters are given.
+ * If the content does not contain a value or not in the given order <code>Assert.fail()</code> is called.
+ *
+ * @param content content which is checked
+ * @param values values which must be in content (and in correct order)
+ */
+ private void contains(String content, String... values) {
+ int index = 0;
+ for (String value : values) {
+ int currentIndex = content.indexOf(value, index);
+ if(currentIndex == -1) {
+ if(content.contains(value)) {
+ int foundIndex = content.indexOf(value);
+ fail("Expected value '" + value + "' was found but not were expected " +
+ "(started to search from position '" + index + "' but found first occurrence at index '" +
+ foundIndex + "').");
+ } else {
+ fail("Expected value '" + value + "' was not found");
+ }
+ }
+ index = currentIndex;
+ }
+ }
+
+ private String getDefaultRequest(final String uri) {
+ return "--" + DEFAULT_BATCH_BOUNDARY + CRLF
+ + HEADER_CONTENT_TRANSFER_ENCODING_BINARY + CRLF
+ + HEADER_CONTENT_TYPE_HTTP + CRLF
+ + CRLF
+ + "GET " + uri + " HTTP/1.1" + CRLF
+ + CRLF
+ + CRLF
+ + "--" + DEFAULT_BATCH_BOUNDARY + "--";
+ }
+
+ private HttpURLConnection waitTillDone(String location, int maxWaitInSeconds) throws Exception {
+ HttpURLConnection result = null;
+ int waitCounter = maxWaitInSeconds * 1000;
+
+ while(result == null && waitCounter > 0) {
+ HttpURLConnection statusRequest = getRequest(new URL(location), Collections.<String, String>emptyMap());
+ Map<String, List<String>> statusHeaderFields = statusRequest.getHeaderFields();
+ String statusHeader = statusHeaderFields.get(null).get(0);
+ if("HTTP/1.1 202 Accepted".equals(statusHeader)) {
+ TimeUnit.MILLISECONDS.sleep(SLEEP_TIMEOUT_IN_MS);
+ waitCounter -= SLEEP_TIMEOUT_IN_MS;
+ } else if("HTTP/1.1 200 OK".equals(statusHeader)) {
+ result = statusRequest;
+ } else {
+ throw new RuntimeException("Unexpected status header ('" + statusHeader +
+ "') for async status request on: " + location);
+ }
+ }
+ return result;
+ }
+
+ private HttpURLConnection postRequest(final URL url, final String content, final Map<String, String> headers)
+ throws IOException {
+ final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setRequestMethod(HttpMethod.POST.toString());
+ //
+ for (Map.Entry<String, String> header : headers.entrySet()) {
+ connection.setRequestProperty(header.getKey(), header.getValue());
+ }
+ //
+ connection.setDoOutput(true);
+ final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
+ writer.append(content);
+ writer.close();
+ connection.connect();
+ return connection;
+ }
+
+ private HttpURLConnection getRequest(URL url, Map<String, String> headers) throws IOException {
+ final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setRequestMethod(HttpMethod.GET.toString());
+ //
+ for (Map.Entry<String, String> header : headers.entrySet()) {
+ connection.setRequestProperty(header.getKey(), header.getValue());
+ }
+ //
+ connection.connect();
+ return connection;
+ }
+
+ private HttpURLConnection postBatch(final InputStream content, String batchBoundary, int sleepTime)
+ throws IOException {
+
+ Map<String, String> headers = new HashMap<String, String>();
+ String contentTypeValue = ContentType.create(
+ ContentType.MULTIPART_MIXED, "boundary", batchBoundary).toContentTypeString();
+ headers.put(HttpHeader.CONTENT_TYPE, contentTypeValue);
+ headers.put(HttpHeader.ACCEPT, ACCEPT_HEADER_VALUE);
+ if(sleepTime >= 0) {
+ headers.put(HttpHeader.PREFER, "respond-async; " +
+ TechnicalAsyncService.TEC_ASYNC_SLEEP + "=" + String.valueOf(sleepTime));
+ }
+
+ StringHelper.Stream s = StringHelper.toStream(content);
+ final URL url = new URL(SERVICE_URI + "$batch");
+ return postRequest(url, s.asString(DEFAULT_ENCODING), headers);
+ }
+
+ @Override
+ protected ODataClient getClient() {
+ return null;
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicBatchITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicBatchITCase.java
index 65d8830..38b3cf6 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicBatchITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicBatchITCase.java
@@ -31,6 +31,7 @@
import java.net.URL;
import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.commons.api.http.HttpStatusCode;
@@ -40,12 +41,16 @@
public class BasicBatchITCase extends AbstractBaseTestITCase {
- private static final String HEADER_CONTENT_TRANSFER_ENCODING_BINARY = "Content-Transfer-Encoding: binary";
- private static final String HEADER_CONTENT_TYPE_HTTP = "Content-Type: application/http";
private static final String SERVICE_URI = TecSvcConst.BASE_URI + "/";
- private static final String CONTENT_TYPE_HEADER_VALUE = " multipart/mixed;boundary=batch_123";
+
+ private static final String HEADER_CONTENT_TRANSFER_ENCODING_BINARY = "Content-Transfer-Encoding: binary";
+ private static final String HEADER_CONTENT_TYPE_HTTP =
+ HttpHeader.CONTENT_TYPE + ": " + ContentType.APPLICATION_HTTP.toContentTypeString();
+ private static final String CONTENT_TYPE_HEADER_VALUE = " "
+ + ContentType.create(ContentType.MULTIPART_MIXED, "boundary", "batch_123").toContentTypeString();
+ private static final String ACCEPT_HEADER_VALUE = ContentType.APPLICATION_JSON.toContentTypeString();
+
private static final String CRLF = "\r\n";
- private static final String ACCEPT_HEADER_VALUE = "application/json";
@Test
public void test() throws IOException {
@@ -110,7 +115,7 @@
}
private void blankLine(final BufferedReader reader) throws IOException {
- assertEquals("", reader.readLine()); // CRLF becomes to an empty string
+ assertEquals("", reader.readLine()); // CRLF becomes an empty string
}
private String getRequest(final String uri) {
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicHttpITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicHttpITCase.java
index 1a66f11..e097581 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicHttpITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/BasicHttpITCase.java
@@ -19,13 +19,17 @@
package org.apache.olingo.fit.tecsvc.http;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.net.HttpURLConnection;
import java.net.URL;
+import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpMethod;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
import org.junit.Test;
@@ -39,13 +43,11 @@
URL url = new URL(SERVICE_URI + "?$format=json");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setRequestMethod("GET");
+ connection.setRequestMethod(HttpMethod.GET.name());
connection.connect();
- int code = connection.getResponseCode();
- assertEquals(200, code);
- String ct = connection.getHeaderField(HttpHeader.CONTENT_TYPE);
- assertEquals(ContentType.create("application/json;odata.metadata=minimal"), ContentType.create(ct));
+ assertEquals(HttpStatusCode.OK.getStatusCode(), connection.getResponseCode());
+ assertEquals(ContentType.JSON, ContentType.create(connection.getHeaderField(HttpHeader.CONTENT_TYPE)));
}
@Test
@@ -54,15 +56,13 @@
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setRequestMethod("GET");
+ connection.setRequestMethod(HttpMethod.GET.name());
connection.setRequestProperty(HttpHeader.ACCEPT, "application/json;q=0.2;odata.metadata=minimal");
connection.connect();
- int code = connection.getResponseCode();
- assertEquals(200, code);
- String ct = connection.getHeaderField(HttpHeader.CONTENT_TYPE);
- assertEquals(ContentType.create("application/json;odata.metadata=minimal"), ContentType.create(ct));
+ assertEquals(HttpStatusCode.OK.getStatusCode(), connection.getResponseCode());
+ assertEquals(ContentType.JSON, ContentType.create(connection.getHeaderField(HttpHeader.CONTENT_TYPE)));
}
@Test
@@ -71,15 +71,13 @@
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setRequestMethod("GET");
+ connection.setRequestMethod(HttpMethod.GET.name());
connection.setRequestProperty(HttpHeader.ACCEPT, "application/json");
connection.connect();
- int code = connection.getResponseCode();
- assertEquals(200, code);
- String ct = connection.getHeaderField(HttpHeader.CONTENT_TYPE);
- assertEquals(ContentType.create("application/json;odata.metadata=minimal"), ContentType.create(ct));
+ assertEquals(HttpStatusCode.OK.getStatusCode(), connection.getResponseCode());
+ assertEquals(ContentType.JSON, ContentType.create(connection.getHeaderField(HttpHeader.CONTENT_TYPE)));
}
@Test
@@ -88,15 +86,14 @@
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setRequestMethod("GET");
+ connection.setRequestMethod(HttpMethod.GET.name());
connection.setRequestProperty(HttpHeader.ACCEPT, "application/json;q=0.2;odata.metadata=minimal;charset=utf-8");
connection.connect();
- int code = connection.getResponseCode();
- assertEquals(200, code);
- String ct = connection.getHeaderField(HttpHeader.CONTENT_TYPE);
- assertEquals(ContentType.create("application/json;odata.metadata=minimal;charset=utf-8"), ContentType.create(ct));
+ assertEquals(HttpStatusCode.OK.getStatusCode(), connection.getResponseCode());
+ assertEquals(ContentType.create(ContentType.JSON, ContentType.PARAMETER_CHARSET, "utf-8"),
+ ContentType.create(connection.getHeaderField(HttpHeader.CONTENT_TYPE)));
}
@Test
@@ -105,16 +102,48 @@
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setRequestMethod("GET");
+ connection.setRequestMethod(HttpMethod.GET.name());
connection.setRequestProperty(HttpHeader.ODATA_MAX_VERSION, "4.0");
connection.setRequestProperty(HttpHeader.ACCEPT, "*/*");
connection.connect();
- int code = connection.getResponseCode();
- assertEquals(200, code);
- String v = connection.getHeaderField(HttpHeader.ODATA_VERSION);
- assertEquals("4.0", v);
+ assertEquals(HttpStatusCode.OK.getStatusCode(), connection.getResponseCode());
+ assertEquals("4.0", connection.getHeaderField(HttpHeader.ODATA_VERSION));
+ }
+
+ @Test
+ public void testIEEE754ParameterContentNegotiation() throws Exception {
+ final URL url = new URL(SERVICE_URI + "/ESAllPrim(32767)?$format=application/json;IEEE754Compatible=true");
+ final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setRequestMethod(HttpMethod.GET.name());
+ connection.setRequestProperty(HttpHeader.ACCEPT, "application/json;IEEE754Compatible=false");
+ connection.connect();
+
+ assertEquals(HttpStatusCode.OK.getStatusCode(), connection.getResponseCode());
+ assertEquals(ContentType.create(ContentType.JSON, ContentType.PARAMETER_IEEE754_COMPATIBLE, "true"),
+ ContentType.create(connection.getContentType()));
+ final String content = IOUtils.toString(connection.getInputStream());
+
+ assertTrue(content.contains("\"PropertyDecimal\":\"34\""));
+ assertTrue(content.contains("\"PropertyInt64\":\"9223372036854775807\""));
+ }
+
+ @Test
+ public void testIEEE754ParameterViaAcceptHeader() throws Exception {
+ final URL url = new URL(SERVICE_URI + "/ESAllPrim(32767)");
+ final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setRequestMethod(HttpMethod.GET.name());
+ connection.setRequestProperty(HttpHeader.ACCEPT, "application/json;IEEE754Compatible=true");
+ connection.connect();
+
+ assertEquals(HttpStatusCode.OK.getStatusCode(), connection.getResponseCode());
+ assertEquals(ContentType.create(ContentType.JSON, ContentType.PARAMETER_IEEE754_COMPATIBLE, "true"),
+ ContentType.create(connection.getContentType()));
+ final String content = IOUtils.toString(connection.getInputStream());
+
+ assertTrue(content.contains("\"PropertyDecimal\":\"34\""));
+ assertTrue(content.contains("\"PropertyInt64\":\"9223372036854775807\""));
}
@Override
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/EntityReferenceITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/EntityReferenceITCase.java
index bcfc096..359feb7 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/EntityReferenceITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/EntityReferenceITCase.java
@@ -21,16 +21,17 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import java.io.InputStream;
-import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
+import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpMethod;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
-import org.apache.olingo.server.core.deserializer.batch.BufferedReaderIncludingLineEndings;
import org.junit.Test;
public class EntityReferenceITCase extends AbstractBaseTestITCase {
@@ -41,49 +42,34 @@
@Test
public void testContextURlSingleEntity() throws Exception {
- URL url = new URL(SERVICE_URI + "/ESAllPrim(0)/$ref");
+ URL url = new URL(SERVICE_URI + "/ESAllPrim(0)/$ref");
- HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setRequestProperty(HttpHeader.ACCEPT, "application/json");
- connection.setRequestMethod("GET");
- connection.connect();
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setRequestProperty(HttpHeader.ACCEPT, ContentType.APPLICATION_JSON.toContentTypeString());
+ connection.setRequestMethod(HttpMethod.GET.name());
+ connection.connect();
- int code = connection.getResponseCode();
- assertEquals(200, code);
-
- final String content = getString(connection.getInputStream());
- assertTrue(content.contains(CONTEXT_ENTITY_REFERENCE));
- }
+ assertEquals(HttpStatusCode.OK.getStatusCode(), connection.getResponseCode());
+
+ final String content = IOUtils.toString(connection.getInputStream());
+ assertTrue(content.contains(CONTEXT_ENTITY_REFERENCE));
+ }
@Test
public void testContextURLEntityCollection() throws Exception {
URL url = new URL(SERVICE_URI + "/ESAllPrim/$ref");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setRequestProperty(HttpHeader.ACCEPT, "application/json");
- connection.setRequestMethod("GET");
+ connection.setRequestProperty(HttpHeader.ACCEPT, ContentType.APPLICATION_JSON.toContentTypeString());
+ connection.setRequestMethod(HttpMethod.GET.name());
connection.connect();
- int code = connection.getResponseCode();
- assertEquals(200, code);
-
- final String content = getString(connection.getInputStream());
+ assertEquals(HttpStatusCode.OK.getStatusCode(), connection.getResponseCode());
+
+ final String content = IOUtils.toString(connection.getInputStream());
assertTrue(content.contains(CONTEXT_COLLECTION_REFERENCE));
}
-
- private String getString(final InputStream in) throws Exception {
- final StringBuilder builder = new StringBuilder();
- final BufferedReaderIncludingLineEndings reader = new BufferedReaderIncludingLineEndings(new InputStreamReader(in));
-
- String line;
- while((line = reader.readLine()) != null) {
- builder.append(line);
- }
-
- reader.close();
- return builder.toString();
- }
-
+
@Override
protected ODataClient getClient() {
return null;
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/PingITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/PingITCase.java
index b016a4b..5a20f29 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/PingITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/PingITCase.java
@@ -25,6 +25,8 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpMethod;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
import org.junit.Test;
@@ -41,12 +43,11 @@
LOG.debug("ping request: " + SERVICE_URI);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setRequestMethod("GET");
+ connection.setRequestMethod(HttpMethod.GET.name());
connection.setRequestProperty(HttpHeader.ACCEPT, "*/*");
connection.connect();
- int code = connection.getResponseCode();
- assertEquals(200, code);
+ assertEquals(HttpStatusCode.OK.getStatusCode(), connection.getResponseCode());
}
@Test
@@ -57,12 +58,11 @@
LOG.debug("redirect request: " + REDIRECT_URI);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setRequestMethod("GET");
+ connection.setRequestMethod(HttpMethod.GET.name());
connection.setRequestProperty(HttpHeader.ACCEPT, "*/*");
connection.connect();
- int code = connection.getResponseCode();
- assertEquals(200, code);
+ assertEquals(HttpStatusCode.OK.getStatusCode(), connection.getResponseCode());
}
@Override
diff --git a/fit/src/test/java/org/apache/olingo/fit/util/StringHelper.java b/fit/src/test/java/org/apache/olingo/fit/util/StringHelper.java
new file mode 100644
index 0000000..8b2e9a1
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/util/StringHelper.java
@@ -0,0 +1,214 @@
+/*******************************************************************************
+ * 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.util;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+import java.util.Random;
+
+/**
+ *
+ */
+public class StringHelper {
+
+ public static final String DEFAULT_ENCODING = "UTF-8";
+
+ public static class Stream {
+ private final byte[] data;
+
+ private Stream(final byte[] data) {
+ this.data = data;
+ }
+
+ public Stream(final String content, final String charset) throws UnsupportedEncodingException {
+ this(content.getBytes(charset));
+ }
+
+ public InputStream asStream() {
+ return new ByteArrayInputStream(data);
+ }
+
+ public byte[] asArray() {
+ return data;
+ }
+
+ public int byteLength() {
+ if(data == null) {
+ return -1;
+ }
+ return data.length;
+ }
+
+ public String asString() {
+ return asString(DEFAULT_ENCODING);
+ }
+
+ public String asString(final String charsetName) {
+ return new String(data, Charset.forName(charsetName));
+ }
+
+ public Stream print(final OutputStream out) throws IOException {
+ out.write(data);
+ return this;
+ }
+
+ public Stream print() throws IOException {
+ return print(System.out);
+ }
+
+ public String asStringWithLineSeparation(String separator) throws IOException {
+ BufferedReader br = new BufferedReader(new StringReader(asString()));
+ StringBuilder sb = new StringBuilder(br.readLine());
+ String line = br.readLine();
+ while (line != null) {
+ sb.append(separator).append(line);
+ line = br.readLine();
+ }
+ return sb.toString();
+ }
+
+ public InputStream asStreamWithLineSeparation(String separator) throws IOException {
+ String asString = asStringWithLineSeparation(separator);
+ return new ByteArrayInputStream(asString.getBytes(DEFAULT_ENCODING));
+ }
+
+ /**
+ * Number of lines separated by line breaks (<code>CRLF</code>).
+ * A content string like <code>text\r\nmoreText</code> will result in
+ * a line count of <code>2</code>.
+ *
+ * @return lines count
+ */
+ public int linesCount() {
+ return StringHelper.countLines(asString(), "\r\n");
+ }
+ }
+
+ public static Stream toStream(final InputStream stream) throws IOException {
+ byte[] result = new byte[0];
+ byte[] tmp = new byte[8192];
+ int readCount = stream.read(tmp);
+ while (readCount >= 0) {
+ byte[] innerTmp = new byte[result.length + readCount];
+ System.arraycopy(result, 0, innerTmp, 0, result.length);
+ System.arraycopy(tmp, 0, innerTmp, result.length, readCount);
+ result = innerTmp;
+ readCount = stream.read(tmp);
+ }
+ stream.close();
+ return new Stream(result);
+ }
+
+ public static Stream toStream(final String content) {
+ return toStream(content, DEFAULT_ENCODING);
+ }
+
+ public static Stream toStream(final String content, final String charset) {
+ try {
+ return new Stream(content, charset);
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException("UTF-8 should be supported on each system.");
+ }
+ }
+
+ /**
+ * Read the input stream into an string with default encoding (see StringHelper.DEFAULT_ENCODING).
+ *
+ * @param in stream which is read
+ * @return content of stream as string
+ * @throws IOException
+ */
+ public static String asString(final InputStream in) throws IOException {
+ return toStream(in).asString();
+ }
+
+ public static int countLines(final String content, final String lineBreak) {
+ if (content == null) {
+ return -1;
+ }
+
+ int lastPos = content.indexOf(lineBreak);
+ int count = 1;
+
+ while (lastPos >= 0) {
+ lastPos = content.indexOf(lineBreak, lastPos + 1);
+ count++;
+ }
+ return count;
+ }
+
+ /**
+ * Encapsulate given content in an {@link InputStream} with charset <code>UTF-8</code>.
+ *
+ * @param content to encapsulate content
+ * @return content as stream
+ */
+ public static InputStream encapsulate(final String content) {
+ try {
+ return encapsulate(content, DEFAULT_ENCODING);
+ } catch (UnsupportedEncodingException e) {
+ // we know that UTF-8 is supported
+ throw new RuntimeException("UTF-8 MUST be supported.", e);
+ }
+ }
+
+ /**
+ * Encapsulate given content in an {@link InputStream} with given charset.
+ *
+ * @param content to encapsulate content
+ * @param charset to be used charset
+ * @return content as stream
+ * @throws UnsupportedEncodingException if charset is not supported
+ */
+ public static InputStream encapsulate(final String content, final String charset)
+ throws UnsupportedEncodingException {
+ return new ByteArrayInputStream(content.getBytes(charset));
+ }
+
+ /**
+ * Generate a string with given length containing random upper case characters ([A-Z]).
+ *
+ * @param len length of to generated string
+ * @return random upper case characters ([A-Z]).
+ */
+ public static InputStream generateDataStream(final int len) {
+ return encapsulate(generateData(len));
+ }
+
+ /**
+ * Generates a string with given length containing random upper case characters ([A-Z]).
+ * @param len length of the generated string
+ * @return random upper case characters ([A-Z])
+ */
+ public static String generateData(final int len) {
+ Random random = new Random();
+ StringBuilder b = new StringBuilder(len);
+ for (int j = 0; j < len; j++) {
+ final char c = (char) ('A' + random.nextInt('Z' - 'A' + 1));
+ b.append(c);
+ }
+ return b.toString();
+ }
+}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java
deleted file mode 100644
index 5339bff..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/AbstractTestITCase.java
+++ /dev/null
@@ -1,173 +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.fit.v4;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.startsWith;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.util.Calendar;
-import java.util.TimeZone;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.client.api.ODataClient;
-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.response.ODataDeleteResponse;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ClientCollectionValue;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.domain.ClientValue;
-import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.fit.AbstractBaseTestITCase;
-import org.junit.BeforeClass;
-
-public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
-
- protected static final ODataClient client = ODataClientFactory.getClient();
-
- protected static EdmEnabledODataClient edmClient;
-
- protected static String testStaticServiceRootURL;
-
- protected static String testDemoServiceRootURL;
-
- protected static String testVocabulariesServiceRootURL;
-
- protected static String testNorthwindRootURL;
-
- protected static String testKeyAsSegmentServiceRootURL;
-
- protected static String testOpenTypeServiceRootURL;
-
- protected static String testLargeModelServiceRootURL;
-
- protected static String testAuthServiceRootURL;
-
- protected static String testOAuth2ServiceRootURL;
-
- @BeforeClass
- public static void setUpODataServiceRoot() throws IOException {
- testStaticServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Static.svc";
- testDemoServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Demo.svc";
- testVocabulariesServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Vocabularies.svc";
- testNorthwindRootURL = "http://localhost:9080/stub/StaticService/V40/NorthWind.svc";
- testKeyAsSegmentServiceRootURL = "http://localhost:9080/stub/StaticService/V40/KeyAsSegment.svc";
- testOpenTypeServiceRootURL = "http://localhost:9080/stub/StaticService/V40/OpenType.svc";
- testLargeModelServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Static.svc/large";
- testAuthServiceRootURL = "http://localhost:9080/stub/DefaultService.svc/V40/Static.svc";
- testOAuth2ServiceRootURL = "http://localhost:9080/stub/StaticService/V40/OAuth2.svc";
-
- edmClient = ODataClientFactory.getEdmEnabledClient(testStaticServiceRootURL);
-
- edmClient.getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- client.getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- }
-
- @Override
- protected ODataClient getClient() {
- return client;
- }
-
- protected ClientEntity read(final ODataFormat format, final URI editLink) {
- final ODataEntityRequest<ClientEntity> req = getClient().getRetrieveRequestFactory().getEntityRequest(editLink);
- req.setFormat(format);
-
- final ODataRetrieveResponse<ClientEntity> res = req.execute();
- final ClientEntity entity = res.getBody();
-
- assertNotNull(entity);
-
- if (ODataFormat.JSON_FULL_METADATA == format || ODataFormat.ATOM == format) {
- assertEquals(req.getURI(), entity.getEditLink());
- }
-
- return entity;
- }
-
- protected void createAndDeleteOrder(final String serviceRoot, final ODataFormat format, final int id) {
-
- final ClientEntity order = getClient().getObjectFactory().newEntity(
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order"));
-
- final ClientProperty orderId = getClient().getObjectFactory().newPrimitiveProperty("OrderID",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id));
- order.getProperties().add(orderId);
-
- Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- dateTime.set(2011, 2, 4, 16, 3, 57);
- final ClientProperty orderDate = getClient().getObjectFactory().newPrimitiveProperty("OrderDate",
- getClient().getObjectFactory().newPrimitiveValueBuilder()
- .setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build());
- order.getProperties().add(orderDate);
-
- final ClientProperty shelfLife = getClient().getObjectFactory().newPrimitiveProperty("ShelfLife",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Duration).setValue(BigDecimal.TEN.scaleByPowerOfTen(7)).build());
- order.getProperties().add(shelfLife);
-
- final ClientCollectionValue<ClientValue> orderShelfLifesValue = getClient().getObjectFactory().
- newCollectionValue("Collection(Duration)");
- orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000001")).build());
- orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build());
- final ClientProperty orderShelfLifes = getClient().getObjectFactory().
- newCollectionProperty("OrderShelfLifes", orderShelfLifesValue);
- order.getProperties().add(orderShelfLifes);
-
- final ODataEntityCreateRequest<ClientEntity> req = getClient().getCUDRequestFactory().getEntityCreateRequest(
- getClient().newURIBuilder(serviceRoot).
- appendEntitySetSegment("Orders").build(), order);
- req.setFormat(format);
- final ClientEntity created = req.execute().getBody();
- assertNotNull(created);
- assertEquals(2, created.getProperty("OrderShelfLifes").getCollectionValue().size());
-
- if (format == ODataFormat.JSON_NO_METADATA) {
- assertEquals(0, created.getNavigationLinks().size());
- assertNull(created.getEditLink());
- } else if (format == ODataFormat.JSON_FULL_METADATA) {
- assertEquals(3, created.getNavigationLinks().size());
- assertThat(created.getTypeName().getNamespace(), is("Microsoft.Test.OData.Services.ODataWCFService"));
- assertThat(created.getEditLink().toASCIIString(), startsWith("http://localhost:9080/stub/StaticService"));
- } else if (format == ODataFormat.JSON || format == ODataFormat.APPLICATION_JSON) {
- assertEquals(0, created.getNavigationLinks().size());
- assertNull(created.getEditLink());
- }
-
- final URI deleteURI = getClient().newURIBuilder(serviceRoot).
- appendEntitySetSegment("Orders").appendKeySegment(id).build();
- final ODataDeleteRequest deleteReq = getClient().getCUDRequestFactory().getDeleteRequest(deleteURI);
- final ODataDeleteResponse deleteRes = deleteReq.execute();
- assertEquals(204, deleteRes.getStatusCode());
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/AsyncTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/AsyncTestITCase.java
deleted file mode 100644
index ded0d97..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/AsyncTestITCase.java
+++ /dev/null
@@ -1,165 +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.fit.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.net.URI;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
-import org.apache.olingo.client.api.communication.request.AsyncRequestWrapper;
-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.AsyncResponseWrapper;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.domain.ClientInlineEntity;
-import org.apache.olingo.client.api.domain.ClientLink;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class AsyncTestITCase extends AbstractTestITCase {
-
- @Test
- public void clientAsync() throws InterruptedException, ExecutionException {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customers");
- final Future<ODataRetrieveResponse<ClientEntitySet>> futureRes =
- client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).asyncExecute();
- assertNotNull(futureRes);
-
- while (!futureRes.isDone()) {
- Thread.sleep(1000L);
- }
-
- final ODataRetrieveResponse<ClientEntitySet> res = futureRes.get();
- assertNotNull(res);
- assertEquals(200, res.getStatusCode());
- assertFalse(res.getBody().getEntities().isEmpty());
- }
-
- private void withInlineEntry(final ODataFormat format) {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
-
- final ODataEntityRequest<ClientEntity> req =
- client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(format);
-
- final AsyncRequestWrapper<ODataRetrieveResponse<ClientEntity>> async =
- client.getAsyncRequestFactory().<ODataRetrieveResponse<ClientEntity>> getAsyncRequestWrapper(req);
-
- final AsyncResponseWrapper<ODataRetrieveResponse<ClientEntity>> responseWrapper = async.execute();
-
- assertFalse(responseWrapper.isPreferenceApplied());
-
- final ODataRetrieveResponse<ClientEntity> res = responseWrapper.getODataResponse();
- final ClientEntity entity = res.getBody();
-
- assertNotNull(entity);
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
- assertEquals(testStaticServiceRootURL + "/Customers(1)", entity.getEditLink().toASCIIString());
-
- assertEquals(3, entity.getNavigationLinks().size());
-
- if (ODataFormat.ATOM == format) {
- assertTrue(entity.getAssociationLinks().isEmpty());
- // In JSON, association links for each $ref link will exist.
- }
-
- boolean found = false;
-
- for (ClientLink link : entity.getNavigationLinks()) {
- if (link instanceof ClientInlineEntity) {
- final ClientEntity inline = ((ClientInlineEntity) link).getEntity();
- assertNotNull(inline);
-
- final List<? extends ClientProperty> 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 withInlineEntryAsAtom() {
- withInlineEntry(ODataFormat.ATOM);
- }
-
- @Test
- public void withInlineEntryAsJSON() {
- // this needs to be full, otherwise there is no mean to recognize links
- withInlineEntry(ODataFormat.JSON_FULL_METADATA);
- }
-
- private void asyncOrders(final ODataFormat format) {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("async").appendEntitySetSegment("Orders");
-
- final ODataEntitySetRequest<ClientEntitySet> req =
- client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
- req.setFormat(format);
-
- final AsyncRequestWrapper<ODataRetrieveResponse<ClientEntitySet>> async =
- client.getAsyncRequestFactory().<ODataRetrieveResponse<ClientEntitySet>> getAsyncRequestWrapper(req);
- async.callback(URI.create("http://client.service.it/callback/endpoint"));
-
- final AsyncResponseWrapper<ODataRetrieveResponse<ClientEntitySet>> responseWrapper = async.execute();
-
- assertTrue(responseWrapper.isPreferenceApplied());
- assertTrue(responseWrapper.isDone());
-
- final ODataRetrieveResponse<ClientEntitySet> res = responseWrapper.getODataResponse();
- final ClientEntitySet entitySet = res.getBody();
-
- assertFalse(entitySet.getEntities().isEmpty());
- }
-
- @Test
- public void asyncOrdersAsAtom() {
- asyncOrders(ODataFormat.ATOM);
- }
-
- @Test
- public void asyncOrdersAsJSON() {
- asyncOrders(ODataFormat.JSON);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.java
deleted file mode 100644
index 47d50c0..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/AuthBatchTestITCase.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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-
-import java.net.URI;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.communication.header.HeaderName;
-import org.apache.olingo.client.api.communication.request.batch.BatchManager;
-import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
-import org.apache.olingo.client.api.communication.request.batch.ODataChangeset;
-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.ODataBatchResponse;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class AuthBatchTestITCase extends AbstractTestITCase {
-
- private final static ContentType ACCEPT = ContentType.APPLICATION_OCTET_STREAM;
-
- @Test
- public void clean() throws EdmPrimitiveTypeException {
- final ODataClient authclient = ODataClientFactory.getClient();
- batchRequest(authclient, testStaticServiceRootURL);
- }
-
- @Test
- public void authorized() throws EdmPrimitiveTypeException {
- final ODataClient authclient = ODataClientFactory.getClient();
- authclient.getConfiguration().setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
- batchRequest(authclient, testAuthServiceRootURL);
- }
-
- @Test(expected = HttpClientException.class)
- public void unauthorized() throws EdmPrimitiveTypeException {
- final ODataClient unauthclient = ODataClientFactory.getClient();
- unauthclient.getConfiguration().setHttpClientFactory(new BasicAuthHttpClientFactory("not_auth", "not_auth"));
- batchRequest(unauthclient, testAuthServiceRootURL);
- }
-
- private void batchRequest(final ODataClient client, final String baseURL) throws EdmPrimitiveTypeException {
- // create your request
- final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(baseURL);
- request.setAccept(ACCEPT.toContentTypeString());
- request.addCustomHeader("User-Agent", "Apache Olingo OData Client");
- request.addCustomHeader(HeaderName.acceptCharset, "UTF-8");
-
- final BatchManager streamManager = request.payloadManager();
-
- // -------------------------------------------
- // Add retrieve item
- // -------------------------------------------
- // prepare URI
- URIBuilder targetURI = client.newURIBuilder(baseURL);
- targetURI.appendEntitySetSegment("Customers").appendKeySegment(1);
-
- // create new request
- ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
- queryReq.setFormat(ODataFormat.JSON);
-
- streamManager.addRequest(queryReq);
- // -------------------------------------------
-
- // -------------------------------------------
- // Add changeset item
- // -------------------------------------------
- final ODataChangeset changeset = streamManager.addChangeset();
-
- // Update Customer into the changeset
- targetURI = client.newURIBuilder(baseURL).appendEntitySetSegment("Customers").appendKeySegment(1);
- final URI editLink = targetURI.build();
-
- final ClientEntity patch = client.getObjectFactory().newEntity(
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
- patch.setEditLink(editLink);
-
- patch.getProperties().add(client.getObjectFactory().newPrimitiveProperty(
- "LastName",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("new last name")));
-
- final ODataEntityUpdateRequest<ClientEntity> changeReq =
- client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patch);
- changeReq.setFormat(ODataFormat.JSON_FULL_METADATA);
-
- changeset.addRequest(changeReq);
- // -------------------------------------------
-
- final ODataBatchResponse response = streamManager.getResponse();
- assertEquals(200, response.getStatusCode());
- assertEquals("OK", response.getStatusMessage());
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
deleted file mode 100644
index 50a6260..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
+++ /dev/null
@@ -1,658 +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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URI;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.http.HttpResponse;
-import org.apache.olingo.client.api.ODataBatchConstants;
-import org.apache.olingo.client.api.communication.header.HeaderName;
-import org.apache.olingo.client.api.communication.request.AsyncBatchRequestWrapper;
-import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
-import org.apache.olingo.client.api.communication.request.batch.BatchManager;
-import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
-import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
-import org.apache.olingo.client.api.communication.request.batch.ODataChangeset;
-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.request.retrieve.ODataEntitySetRequest;
-import org.apache.olingo.client.api.communication.response.AsyncResponse;
-import org.apache.olingo.client.api.communication.response.AsyncResponseWrapper;
-import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
-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.ODataResponse;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
-import org.apache.olingo.client.core.communication.request.Wrapper;
-import org.apache.olingo.client.core.communication.request.batch.ODataChangesetResponseItem;
-import org.apache.olingo.client.core.communication.request.batch.ODataSingleResponseItem;
-import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
-import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl.ODataEntityResponseImpl;
-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.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class BatchTestITCase extends AbstractTestITCase {
-
- private static final String PREFIX = "!!PREFIX!!";
-
- private static final String SUFFIX = "!!SUFFIX!!";
-
- private static final int MAX = 10000;
-
- private final static String ACCEPT = ContentType.APPLICATION_OCTET_STREAM.toContentTypeString();
-
- @Test
- public void stringStreaming() {
- final TestStreamManager streaming = new TestStreamManager();
-
- new StreamingThread(streaming).start();
-
- streaming.addObject((PREFIX + "\n").getBytes());
-
- for (int i = 0; i <= MAX; i++) {
- streaming.addObject((i + ") send info\n").getBytes());
- }
-
- streaming.addObject(SUFFIX.getBytes());
- streaming.finalizeBody();
- }
-
- @Test
- public void emptyBatchRequest() {
- // create your request
- final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
- request.setAccept(ACCEPT);
-
- final BatchManager payload = request.payloadManager();
- final ODataBatchResponse response = payload.getResponse();
-
- assertEquals(200, response.getStatusCode());
- assertEquals("OK", response.getStatusMessage());
-
- final Iterator<ODataBatchResponseItem> iter = response.getBody();
- assertFalse(iter.hasNext());
- }
-
- @Test
- public void changesetWithError() {
- // create your request
- final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
- request.setAccept(ACCEPT);
-
- final BatchManager payload = request.payloadManager();
- final ODataChangeset changeset = payload.addChangeset();
-
- URIBuilder targetURI;
- ODataEntityCreateRequest<ClientEntity> createReq;
-
- targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
- for (int i = 1; i <= 2; i++) {
- // Create Customer into the changeset
- createReq = client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), newOrder(100 + i));
- createReq.setFormat(ODataFormat.JSON);
- changeset.addRequest(createReq);
- }
-
- targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("WrongEntitySet");
- createReq = client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), newOrder(105));
- createReq.setFormat(ODataFormat.JSON);
- changeset.addRequest(createReq);
-
- targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
- for (int i = 3; i <= 4; i++) {
- // Create Customer into the changeset
- createReq = client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), newOrder(100 + i));
- createReq.setFormat(ODataFormat.JSON);
- changeset.addRequest(createReq);
- }
-
- final ODataBatchResponse response = payload.getResponse();
- assertEquals(200, response.getStatusCode());
- assertEquals("OK", response.getStatusMessage());
-
- final Iterator<ODataBatchResponseItem> iter = response.getBody();
- // retrieve the first item (ODataRetrieve)
- ODataBatchResponseItem item = iter.next();
-
- ODataChangesetResponseItem retitem = (ODataChangesetResponseItem) item;
- ODataResponse res = retitem.next();
- assertEquals(404, res.getStatusCode());
- assertEquals("Not Found", res.getStatusMessage());
- assertEquals(Integer.valueOf(3), Integer.valueOf(
- res.getHeader(ODataBatchConstants.CHANGESET_CONTENT_ID_NAME).iterator().next()));
-
- assertFalse(retitem.hasNext());
- assertFalse(iter.hasNext());
- }
-
- @Test
- public void continueOnError() {
- continueOnError(true);
- }
-
- @Test
- public void doNotContinueOnError() {
- continueOnError(false);
- }
-
- private void continueOnError(final boolean continueOnError) {
- final boolean preContinueOnError = client.getConfiguration().isContinueOnError();
- client.getConfiguration().setContinueOnError(continueOnError);
-
- // create your request
- final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
- request.setAccept(ACCEPT);
-
- final BatchManager streamManager = request.payloadManager();
-
- // -------------------------------------------
- // Add retrieve item
- // -------------------------------------------
- // prepare URI
- URIBuilder targetURI = client.newURIBuilder(testStaticServiceRootURL);
- targetURI.appendEntitySetSegment("UnexistingEntitySet").appendKeySegment(1);
-
- // create new request
- ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
- queryReq.setFormat(ODataFormat.JSON);
-
- streamManager.addRequest(queryReq);
- // -------------------------------------------
-
- // -------------------------------------------
- // Add retrieve item
- // -------------------------------------------
- // prepare URI
- targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
-
- // create new request
- queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
-
- streamManager.addRequest(queryReq);
- // -------------------------------------------
-
- final ODataBatchResponse response = streamManager.getResponse();
- assertEquals(200, response.getStatusCode());
- assertEquals("OK", response.getStatusMessage());
- final Iterator<ODataBatchResponseItem> iter = response.getBody();
-
- // retrieve the first item (ODataRetrieve)
- ODataBatchResponseItem item = iter.next();
- assertTrue(item instanceof ODataSingleResponseItem);
-
- ODataSingleResponseItem retitem = (ODataSingleResponseItem) item;
- ODataResponse res = retitem.next();
- assertEquals(404, res.getStatusCode());
- assertEquals("Not Found", res.getStatusMessage());
-
- if (continueOnError) {
- item = iter.next();
- assertTrue(item instanceof ODataSingleResponseItem);
-
- retitem = (ODataSingleResponseItem) item;
- res = retitem.next();
- assertTrue(res instanceof ODataEntityResponseImpl);
- assertEquals(200, res.getStatusCode());
- assertEquals("OK", res.getStatusMessage());
- }
-
- client.getConfiguration().setContinueOnError(preContinueOnError);
- }
-
- @Test
- @SuppressWarnings("unchecked")
- public void changesetWithReference() throws EdmPrimitiveTypeException {
- // create your request
- final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
- request.setAccept(ACCEPT);
- final BatchManager streamManager = request.payloadManager();
-
- final ODataChangeset changeset = streamManager.addChangeset();
- ClientEntity order = newOrder(20);
-
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
-
- // add create request
- final ODataEntityCreateRequest<ClientEntity> createReq =
- client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), order);
-
- changeset.addRequest(createReq);
-
- // retrieve request reference
- int createRequestRef = changeset.getLastContentId();
-
- // add update request: link CustomerInfo(17) to the new customer
- final ClientEntity customerChanges = client.getObjectFactory().newEntity(order.getTypeName());
- customerChanges.addLink(client.getObjectFactory().newEntitySetNavigationLink(
- "OrderDetails",
- client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("OrderDetails").
- appendKeySegment(new HashMap<String, Object>() {
- private static final long serialVersionUID = 3109256773218160485L;
-
- {
- put("OrderID", 7);
- put("ProductID", 5);
- }
- }).build()));
-
- final ODataEntityUpdateRequest<ClientEntity> updateReq = client.getCUDRequestFactory().getEntityUpdateRequest(
- URI.create("$" + createRequestRef), UpdateType.PATCH, customerChanges);
-
- changeset.addRequest(updateReq);
-
- final ODataBatchResponse response = streamManager.getResponse();
- assertEquals(200, response.getStatusCode());
- assertEquals("OK", response.getStatusMessage());
-
- // verify response payload ...
- final Iterator<ODataBatchResponseItem> iter = response.getBody();
-
- final ODataBatchResponseItem item = iter.next();
- assertTrue(item instanceof ODataChangesetResponseItem);
-
- final ODataChangesetResponseItem chgitem = (ODataChangesetResponseItem) item;
-
- ODataResponse res = chgitem.next();
- assertEquals(201, res.getStatusCode());
- assertTrue(res instanceof ODataEntityCreateResponse);
-
- order = ((ODataEntityCreateResponse<ClientEntity>) res).getBody();
- final ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().getEntitySetRequest(
- URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString() + "/OrderDetails"));
-
- assertEquals(Integer.valueOf(7),
- req.execute().getBody().getEntities().get(0).getProperty("OrderID").getPrimitiveValue().
- toCastValue(Integer.class));
-
- res = chgitem.next();
- assertEquals(204, res.getStatusCode());
- assertTrue(res instanceof ODataEntityUpdateResponse);
-
- // clean ...
- assertEquals(204, client.getCUDRequestFactory().getDeleteRequest(
- URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString())).execute().
- getStatusCode());
-
- try {
- client.getRetrieveRequestFactory().getEntityRequest(
- URIUtils.getURI(testStaticServiceRootURL, order.getEditLink().toASCIIString())).
- execute().getBody();
- fail();
- } catch (Exception e) {
- // ignore
- }
- }
-
- @Test
- @SuppressWarnings("unchecked")
- public void batchRequestWithOutsideUpdates() throws EdmPrimitiveTypeException {
- // create your request
- final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
- request.setAccept(ACCEPT);
- final BatchManager streamManager = request.payloadManager();
-
- // -------------------------------------------
- // Add retrieve item
- // -------------------------------------------
- // prepare URI
- URIBuilder targetURI = client.newURIBuilder(testStaticServiceRootURL);
- targetURI.appendEntitySetSegment("Customers").appendKeySegment(1).
- expand("Orders").select("PersonID,Orders/OrderID");
-
- // create new request
- ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
- queryReq.setFormat(ODataFormat.JSON);
-
- streamManager.addRequest(queryReq);
- // -------------------------------------------
-
- // -------------------------------------------
- // Add new order with outside item
- // -------------------------------------------
- // prepare URI
- targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
- final ClientEntity original = newOrder(2000);
- final ODataEntityCreateRequest<ClientEntity> createReq =
- client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original);
- createReq.setFormat(ODataFormat.JSON);
- streamManager.addRequest(createReq);
- // -------------------------------------------
-
- final ODataBatchResponse response = streamManager.getResponse();
- assertEquals(200, response.getStatusCode());
- assertEquals("OK", response.getStatusMessage());
- final Iterator<ODataBatchResponseItem> iter = response.getBody();
-
- // retrieve the first item (ODataRetrieve)
- ODataBatchResponseItem item = iter.next();
- assertTrue(item instanceof ODataSingleResponseItem);
-
- ODataSingleResponseItem retitem = (ODataSingleResponseItem) item;
- ODataResponse res = retitem.next();
- assertTrue(res instanceof ODataEntityResponseImpl);
- assertEquals(200, res.getStatusCode());
- assertEquals("OK", res.getStatusMessage());
-
- // retrieve the second item (ODataChangeset)
- item = iter.next();
- assertTrue(item instanceof ODataSingleResponseItem);
-
- final ODataSingleResponseItem outitem = (ODataSingleResponseItem) item;
- res = outitem.next();
- assertTrue(res instanceof ODataEntityCreateResponse);
- assertEquals(201, res.getStatusCode());
- assertEquals("Created", res.getStatusMessage());
-
- final ODataEntityCreateResponse<ClientEntity> entres = (ODataEntityCreateResponse<ClientEntity>) res;
- final ClientEntity entity = entres.getBody();
- assertEquals(2000, entity.getProperty("OrderID").getPrimitiveValue().toCastValue(Integer.class).intValue());
-
- assertFalse(iter.hasNext());
- }
-
- @Test
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public void batchRequest() throws EdmPrimitiveTypeException {
- // create your request
- final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(testStaticServiceRootURL);
- request.setAccept(ACCEPT);
-
- final BatchManager streamManager = request.payloadManager();
-
- // -------------------------------------------
- // Add retrieve item
- // -------------------------------------------
- // prepare URI
- URIBuilder targetURI = client.newURIBuilder(testStaticServiceRootURL);
- targetURI.appendEntitySetSegment("Customers").appendKeySegment(1);
-
- // create new request
- ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
- queryReq.setFormat(ODataFormat.JSON);
-
- streamManager.addRequest(queryReq);
- // -------------------------------------------
-
- // -------------------------------------------
- // Add changeset item
- // -------------------------------------------
- final ODataChangeset changeset = streamManager.addChangeset();
-
- // Update Customer into the changeset
- targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
- final URI editLink = targetURI.build();
-
- final ClientEntity patch = client.getObjectFactory().newEntity(
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
- patch.setEditLink(editLink);
-
- patch.getProperties().add(client.getObjectFactory().newPrimitiveProperty(
- "LastName",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("new last name")));
-
- final ODataEntityUpdateRequest<ClientEntity> changeReq =
- client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patch);
- changeReq.setFormat(ODataFormat.JSON_FULL_METADATA);
-
- changeset.addRequest(changeReq);
-
- // Create Order into the changeset
- targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
- final ClientEntity original = newOrder(1000);
- final ODataEntityCreateRequest<ClientEntity> createReq =
- client.getCUDRequestFactory().getEntityCreateRequest(targetURI.build(), original);
- createReq.setFormat(ODataFormat.JSON);
- changeset.addRequest(createReq);
- // -------------------------------------------
-
- // -------------------------------------------
- // Add retrieve item
- // -------------------------------------------
- // prepare URI
- targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
-
- // create new request
- queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
-
- streamManager.addRequest(queryReq);
- // -------------------------------------------
-
- final ODataBatchResponse response = streamManager.getResponse();
- assertEquals(200, response.getStatusCode());
- assertEquals("OK", response.getStatusMessage());
- final Iterator<ODataBatchResponseItem> iter = response.getBody();
-
- // retrieve the first item (ODataRetrieve)
- ODataBatchResponseItem item = iter.next();
- assertTrue(item instanceof ODataSingleResponseItem);
-
- ODataSingleResponseItem retitem = (ODataSingleResponseItem) item;
- ODataResponse res = retitem.next();
- assertTrue(res instanceof ODataEntityResponseImpl);
- assertEquals(200, res.getStatusCode());
- assertEquals("OK", res.getStatusMessage());
-
- ODataEntityRequestImpl<ClientEntity>.ODataEntityResponseImpl entres =
- (ODataEntityRequestImpl.ODataEntityResponseImpl) res;
-
- ClientEntity entity = entres.getBody();
- assertEquals(1, entity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0);
-
- // retrieve the second item (ODataChangeset)
- item = iter.next();
- assertTrue(item instanceof ODataChangesetResponseItem);
-
- final ODataChangesetResponseItem chgitem = (ODataChangesetResponseItem) item;
- res = chgitem.next();
- assertTrue(res instanceof ODataEntityUpdateResponse);
- assertEquals(204, res.getStatusCode());
- assertEquals("No Content", res.getStatusMessage());
-
- res = chgitem.next();
- assertTrue(res instanceof ODataEntityCreateResponse);
- assertEquals(201, res.getStatusCode());
- assertEquals("Created", res.getStatusMessage());
-
- final ODataEntityCreateResponse<ClientEntity> createres = (ODataEntityCreateResponse<ClientEntity>) res;
- entity = createres.getBody();
- assertEquals(new Integer(1000), entity.getProperty("OrderID").getPrimitiveValue().toCastValue(Integer.class));
-
- // retrieve the third item (ODataRetrieve)
- item = iter.next();
- assertTrue(item instanceof ODataSingleResponseItem);
-
- retitem = (ODataSingleResponseItem) item;
- res = retitem.next();
- assertTrue(res instanceof ODataEntityResponseImpl);
- assertEquals(200, res.getStatusCode());
- assertEquals("OK", res.getStatusMessage());
-
- entres = (ODataEntityRequestImpl.ODataEntityResponseImpl) res;
- entity = entres.getBody();
- assertEquals("new last name", entity.getProperty("LastName").getPrimitiveValue().toCastValue(String.class));
-
- assertFalse(iter.hasNext());
- }
-
- @Test
- public void async() {
- // create your request
- final ODataBatchRequest request = client.getBatchRequestFactory().getBatchRequest(
- URI.create(testStaticServiceRootURL + "/async/").normalize().toASCIIString());
- request.setAccept(ACCEPT);
-
- final AsyncBatchRequestWrapper async = client.getAsyncRequestFactory().getAsyncBatchRequestWrapper(request);
-
- // -------------------------------------------
- // Add retrieve item
- // -------------------------------------------
- // prepare URI
- URIBuilder targetURI = client.newURIBuilder(testStaticServiceRootURL);
- targetURI.appendEntitySetSegment("People").appendKeySegment(5);
-
- // create new request
- ODataEntityRequest<ClientEntity> queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
- queryReq.setFormat(ODataFormat.JSON);
-
- async.addRetrieve(queryReq);
- // -------------------------------------------
-
- // -------------------------------------------
- // Add retrieve item
- // -------------------------------------------
- // prepare URI
- targetURI = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").appendKeySegment(1);
-
- // create new request
- queryReq = client.getRetrieveRequestFactory().getEntityRequest(targetURI.build());
-
- async.addRetrieve(queryReq);
- // -------------------------------------------
-
- final AsyncResponseWrapper<ODataBatchResponse> responseWrapper = async.execute();
-
- assertTrue(responseWrapper.isPreferenceApplied());
- assertTrue(responseWrapper.isDone());
-
- final ODataBatchResponse response = responseWrapper.getODataResponse();
-
- assertEquals(200, response.getStatusCode());
- assertEquals("Ok", response.getStatusMessage());
- final Iterator<ODataBatchResponseItem> iter = response.getBody();
-
- // retrieve the first item (ODataRetrieve)
- final ODataBatchResponseItem item = iter.next();
- assertTrue(item instanceof ODataSingleResponseItem);
-
- // The service return interim results to an asynchronously executing batch.
- final ODataSingleResponseItem retitem = (ODataSingleResponseItem) item;
- final ODataResponse res = retitem.next();
- assertTrue(res instanceof AsyncResponse);
- assertEquals(202, res.getStatusCode());
- assertEquals("Accepted", res.getStatusMessage());
-
- final Collection<String> newMonitorLocation = res.getHeader(HeaderName.location);
- if (newMonitorLocation != null && !newMonitorLocation.isEmpty()) {
- responseWrapper.forceNextMonitorCheck(URI.create(newMonitorLocation.iterator().next()));
- // .... now you can start again with isDone() and getODataResponse().
- }
-
- assertFalse(retitem.hasNext());
- assertFalse(iter.hasNext());
- }
-
- private static class TestStreamManager extends AbstractODataStreamManager<ODataBatchResponse> {
-
- public TestStreamManager() {
- super(new Wrapper<Future<HttpResponse>>());
- }
-
- public ODataPayloadManager<ODataBatchResponse> addObject(final byte[] src) {
- stream(src);
- return this;
- }
-
- @Override
- protected ODataBatchResponse getResponse(final long timeout, final TimeUnit unit) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
- };
-
- /**
- * To be used for debug purposes.
- */
- private static class StreamingThread extends Thread {
-
- private final TestStreamManager streaming;
-
- public StreamingThread(final TestStreamManager streaming) {
- super();
- this.streaming = streaming;
- }
-
- @Override
- public void run() {
- try {
- final StringBuilder builder = new StringBuilder();
-
- byte[] buff = new byte[1024];
-
- int len;
-
- while ((len = streaming.getBody().read(buff)) >= 0) {
- builder.append(new String(buff, 0, len));
- }
-
- assertTrue(builder.toString().startsWith(PREFIX));
- assertTrue(builder.toString().contains((MAX / 2) + ") send info"));
- assertTrue(builder.toString().contains((MAX / 3) + ") send info"));
- assertTrue(builder.toString().contains((MAX / 20) + ") send info"));
- assertTrue(builder.toString().contains((MAX / 30) + ") send info"));
- assertTrue(builder.toString().contains(MAX + ") send info"));
- assertTrue(builder.toString().endsWith(SUFFIX));
-
- } catch (IOException e) {
- fail();
- }
- }
- }
-
- private ClientEntity newOrder(final int id) {
- final ClientEntity order = getClient().getObjectFactory().
- newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order"));
-
- order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderID",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id)));
- order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderDate",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).build()));
- order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ShelfLife",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build()));
- order.getProperties().add(getClient().getObjectFactory().newCollectionProperty("OrderShelfLifes",
- getClient().getObjectFactory().newCollectionValue(EdmPrimitiveTypeKind.Duration.name()).add(
- getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Duration).
- setValue(new BigDecimal("0.0000002")).build())));
-
- return order;
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/BoundOperationInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/BoundOperationInvokeTestITCase.java
deleted file mode 100644
index 890b878..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/BoundOperationInvokeTestITCase.java
+++ /dev/null
@@ -1,459 +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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.TimeZone;
-
-import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
-import org.apache.olingo.client.api.domain.ClientCollectionValue;
-import org.apache.olingo.client.api.domain.ClientComplexValue;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.domain.ClientEnumValue;
-import org.apache.olingo.client.api.domain.ClientOperation;
-import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.domain.ClientSingleton;
-import org.apache.olingo.client.api.domain.ClientValue;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class BoundOperationInvokeTestITCase extends AbstractTestITCase {
-
- private void functions(final ODataFormat format) throws EdmPrimitiveTypeException {
- // GetEmployeesCount
- URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Company");
- final ODataEntityRequest<ClientSingleton> singletonReq =
- client.getRetrieveRequestFactory().getSingletonRequest(builder.build());
- singletonReq.setFormat(format);
- final ClientSingleton company = singletonReq.execute().getBody();
- assertNotNull(company);
-
- ClientOperation boundOp = company.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount");
- assertNotNull(boundOp);
-
- final ODataInvokeRequest<ClientProperty> getEmployeesCountReq =
- client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientProperty.class);
- getEmployeesCountReq.setFormat(format);
- final ClientProperty getEmployeesCountRes = getEmployeesCountReq.execute().getBody();
- assertNotNull(getEmployeesCountRes);
- assertTrue(getEmployeesCountRes.hasPrimitiveValue());
-
- // GetProductDetails
- builder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Products").appendKeySegment(5);
- ODataEntityRequest<ClientEntity> entityReq = client.getRetrieveRequestFactory().
- getEntityRequest(builder.build());
- entityReq.setFormat(format);
- ClientEntity entity = entityReq.execute().getBody();
- assertNotNull(entity);
-
- boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails");
- assertNotNull(boundOp);
-
- final ClientPrimitiveValue count = client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(1);
- final ODataInvokeRequest<ClientEntitySet> getProductDetailsReq =
- client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientEntitySet.class,
- Collections.<String, ClientValue> singletonMap("count", count));
- getProductDetailsReq.setFormat(format);
- final ClientEntitySet getProductDetailsRes = getProductDetailsReq.execute().getBody();
- assertNotNull(getProductDetailsRes);
- assertEquals(1, getProductDetailsRes.getEntities().size());
-
- // GetRelatedProduct
- final Map<String, Object> keyMap = new LinkedHashMap<String, Object>();
- keyMap.put("ProductID", 6);
- keyMap.put("ProductDetailID", 1);
- builder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("ProductDetails").appendKeySegment(keyMap);
- entityReq = client.getRetrieveRequestFactory().getEntityRequest(builder.build());
- entityReq.setFormat(format);
- entity = entityReq.execute().getBody();
- assertNotNull(entity);
-
- boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct");
- assertNotNull(boundOp);
-
- final ODataInvokeRequest<ClientEntity> getRelatedProductReq =
- client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientEntity.class);
- getRelatedProductReq.setFormat(format);
- final ClientEntity getRelatedProductRes = getRelatedProductReq.execute().getBody();
- assertNotNull(getRelatedProductRes);
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Product",
- getRelatedProductRes.getTypeName().toString());
- assertEquals(6, getRelatedProductRes.getProperty("ProductID").getPrimitiveValue().toCastValue(Integer.class), 0);
-
- // GetDefaultPI
- builder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Accounts").appendKeySegment(102);
- entityReq = client.getRetrieveRequestFactory().getEntityRequest(builder.build());
- entityReq.setFormat(format);
- entity = entityReq.execute().getBody();
- assertNotNull(entity);
-
- boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI");
- assertNotNull(boundOp);
-
- final ODataInvokeRequest<ClientEntity> getDefaultPIReq =
- client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientEntity.class);
- getDefaultPIReq.setFormat(format);
- final ClientEntity getDefaultPIRes = getDefaultPIReq.execute().getBody();
- assertNotNull(getDefaultPIRes);
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
- getDefaultPIRes.getTypeName().toString());
- assertEquals(102901,
- getDefaultPIRes.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0);
-
- // GetAccountInfo
- boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo");
- assertNotNull(boundOp);
-
- final ODataInvokeRequest<ClientProperty> getAccountInfoReq =
- client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientProperty.class);
- getAccountInfoReq.setFormat(format);
- final ClientProperty getAccountInfoRes = getAccountInfoReq.execute().getBody();
- assertNotNull(getAccountInfoRes);
- assertTrue(getAccountInfoRes.hasComplexValue());
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.AccountInfo",
- getAccountInfoRes.getComplexValue().getTypeName());
-
- // GetActualAmount
- entityReq = client.getRetrieveRequestFactory().getEntityRequest(
- entity.getNavigationLink("MyGiftCard").getLink());
- entityReq.setFormat(format);
- entity = entityReq.execute().getBody();
- assertNotNull(entity);
- assertEquals(301, entity.getProperty("GiftCardID").getPrimitiveValue().toCastValue(Integer.class), 0);
-
- boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount");
- assertNotNull(boundOp);
-
- final ClientPrimitiveValue bonusRate = client.getObjectFactory().newPrimitiveValueBuilder().buildDouble(1.1);
- final ODataInvokeRequest<ClientProperty> getActualAmountReq =
- client.getInvokeRequestFactory().getFunctionInvokeRequest(boundOp.getTarget(), ClientProperty.class,
- Collections.<String, ClientValue> singletonMap("bonusRate", bonusRate));
- getActualAmountReq.setFormat(format);
- final ClientProperty getActualAmountRes = getActualAmountReq.execute().getBody();
- assertNotNull(getActualAmountRes);
- assertEquals(41.79, getActualAmountRes.getPrimitiveValue().toCastValue(Double.class), 0);
- }
-
- @Test
- public void atomFunctions() throws EdmPrimitiveTypeException {
- functions(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonFunctions() throws EdmPrimitiveTypeException {
- functions(ODataFormat.JSON_FULL_METADATA);
- }
-
- @Test
- public void edmEnabledFunctions() throws EdmPrimitiveTypeException {
- // GetEmployeesCount
- final ODataInvokeRequest<ClientProperty> getEmployeesCountReq =
- edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest(
- edmClient.newURIBuilder().appendSingletonSegment("Company").build(),
- new FullQualifiedName(("Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount")),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Company"),
- false);
- final ClientProperty getEmployeesCountRes = getEmployeesCountReq.execute().getBody();
- assertNotNull(getEmployeesCountRes);
- assertTrue(getEmployeesCountRes.hasPrimitiveValue());
-
- // GetProductDetails
- final ClientPrimitiveValue count = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildInt32(1);
- final ODataInvokeRequest<ClientEntitySet> getProductDetailsReq =
- edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest(
- edmClient.newURIBuilder().appendEntitySetSegment("Products").appendKeySegment(5).build(),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails"),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Product"),
- false,
- Collections.<String, ClientValue> singletonMap("count", count));
- final ClientEntitySet getProductDetailsRes = getProductDetailsReq.execute().getBody();
- assertNotNull(getProductDetailsRes);
- assertEquals(1, getProductDetailsRes.getEntities().size());
-
- // GetRelatedProduct
- final Map<String, Object> keyMap = new LinkedHashMap<String, Object>();
- keyMap.put("ProductID", 6);
- keyMap.put("ProductDetailID", 1);
- URIBuilder builder = edmClient.newURIBuilder().appendEntitySetSegment("ProductDetails").appendKeySegment(keyMap);
-
- final ODataInvokeRequest<ClientEntity> getRelatedProductReq =
- edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest(
- builder.build(),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GetRelatedProduct"),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.ProductDetail"),
- false);
- final ClientEntity getRelatedProductRes = getRelatedProductReq.execute().getBody();
- assertNotNull(getRelatedProductRes);
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Product",
- getRelatedProductRes.getTypeName().toString());
- assertEquals(6, getRelatedProductRes.getProperty("ProductID").getPrimitiveValue().toCastValue(Integer.class), 0);
-
- // GetDefaultPI
- final ODataInvokeRequest<ClientEntity> getDefaultPIReq =
- edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest(
- edmClient.newURIBuilder().appendEntitySetSegment("Accounts").appendKeySegment(102).build(),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Account"),
- false);
- final ClientEntity getDefaultPIRes = getDefaultPIReq.execute().getBody();
- assertNotNull(getDefaultPIRes);
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
- getDefaultPIRes.getTypeName().toString());
- assertEquals(102901,
- getDefaultPIRes.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0);
-
- // GetAccountInfo
- final ODataInvokeRequest<ClientProperty> getAccountInfoReq =
- edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest(
- edmClient.newURIBuilder().appendEntitySetSegment("Accounts").appendKeySegment(102).build(),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Account"),
- false);
- final ClientProperty getAccountInfoRes = getAccountInfoReq.execute().getBody();
- assertNotNull(getAccountInfoRes);
- assertTrue(getAccountInfoRes.hasComplexValue());
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.AccountInfo",
- getAccountInfoRes.getComplexValue().getTypeName());
-
- // GetActualAmount
- final ClientPrimitiveValue bonusRate = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildDouble(1.1);
- final ODataInvokeRequest<ClientProperty> getActualAmountReq =
- edmClient.getInvokeRequestFactory().getBoundFunctionInvokeRequest(
- edmClient.newURIBuilder().appendEntitySetSegment("Accounts").appendKeySegment(102).
- appendNavigationSegment("MyGiftCard").build(),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GetActualAmount"),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.GiftCard"),
- false,
- Collections.<String, ClientValue> singletonMap("bonusRate", bonusRate));
- final ClientProperty getActualAmountRes = getActualAmountReq.execute().getBody();
- assertNotNull(getActualAmountRes);
- assertEquals(41.79, getActualAmountRes.getPrimitiveValue().toCastValue(Double.class), 0);
- }
-
- private void actions(final ODataFormat format) throws EdmPrimitiveTypeException {
- // IncreaseRevenue
- URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Company");
- ODataEntityRequest<ClientEntity> entityReq =
- client.getRetrieveRequestFactory().getEntityRequest(builder.build());
- entityReq.setFormat(format);
- ClientEntity entity = entityReq.execute().getBody();
- assertNotNull(entity);
-
- ClientOperation boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue");
- assertNotNull(boundOp);
-
- final ClientPrimitiveValue increaseValue =
- client.getObjectFactory().newPrimitiveValueBuilder().buildInt64(12L);
- final ODataInvokeRequest<ClientProperty> increaseRevenueReq =
- client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ClientProperty.class,
- Collections.<String, ClientValue> singletonMap("IncreaseValue", increaseValue));
- increaseRevenueReq.setFormat(format);
- final ClientProperty increaseRevenueRes = increaseRevenueReq.execute().getBody();
- assertNotNull(increaseRevenueRes);
- assertTrue(increaseRevenueRes.hasPrimitiveValue());
-
- // AddAccessRight
- builder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Products").appendKeySegment(5);
- entityReq = client.getRetrieveRequestFactory().getEntityRequest(builder.build());
- entityReq.setFormat(format);
- entity = entityReq.execute().getBody();
- assertNotNull(entity);
-
- boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight");
- assertNotNull(boundOp);
-
- final ClientEnumValue accessRight = client.getObjectFactory().
- newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "Execute");
- final ODataInvokeRequest<ClientProperty> getProductDetailsReq =
- client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ClientProperty.class,
- Collections.<String, ClientValue> singletonMap("accessRight", accessRight));
- getProductDetailsReq.setFormat(format);
- final ClientProperty getProductDetailsRes = getProductDetailsReq.execute().getBody();
- assertNotNull(getProductDetailsRes);
- assertTrue(getProductDetailsRes.hasEnumValue());
-
- // ResetAddress
- builder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customers").appendKeySegment(2);
- entityReq = client.getRetrieveRequestFactory().getEntityRequest(builder.build());
- entityReq.setFormat(format);
- entity = entityReq.execute().getBody();
- assertNotNull(entity);
-
- boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.ResetAddress");
- assertNotNull(boundOp);
-
- final ClientCollectionValue<ClientValue> addresses =
- client.getObjectFactory().
- newCollectionValue("Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)");
- final ClientComplexValue address = client.getObjectFactory().
- newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address");
- address.add(client.getObjectFactory().newPrimitiveProperty("Street",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("Piazza La Bomba E Scappa")));
- address.add(client.getObjectFactory().newPrimitiveProperty("City",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("Tollo")));
- address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("66010")));
- addresses.add(address);
- final ClientPrimitiveValue index = client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(0);
- final Map<String, ClientValue> params = new LinkedHashMap<String, ClientValue>(2);
- params.put("addresses", addresses);
- params.put("index", index);
- final ODataInvokeRequest<ClientEntity> resetAddressReq =
- client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ClientEntity.class, params);
- resetAddressReq.setFormat(format);
- final ClientEntity resetAddressRes = resetAddressReq.execute().getBody();
- assertNotNull(resetAddressRes);
- assertEquals(2, resetAddressRes.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0);
-
- // RefreshDefaultPI
- builder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Accounts").appendKeySegment(102);
- entityReq = client.getRetrieveRequestFactory().getEntityRequest(builder.build());
- entityReq.setFormat(format);
- entity = entityReq.execute().getBody();
- assertNotNull(entity);
-
- boundOp = entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI");
- assertNotNull(boundOp);
-
- Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- dateTime.set(2014, 3, 9, 0, 0, 0);
- final ClientPrimitiveValue newDate = client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build();
- final ODataInvokeRequest<ClientEntity> getDefaultPIReq =
- client.getInvokeRequestFactory().getActionInvokeRequest(boundOp.getTarget(), ClientEntity.class,
- Collections.<String, ClientValue> singletonMap("newDate", newDate));
- getDefaultPIReq.setFormat(format);
- final ClientEntity getDefaultPIRes = getDefaultPIReq.execute().getBody();
- assertNotNull(getDefaultPIRes);
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
- getDefaultPIRes.getTypeName().toString());
- assertEquals(102901,
- getDefaultPIRes.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0);
- }
-
- @Test
- public void atomActions() throws EdmPrimitiveTypeException {
- actions(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonActions() throws EdmPrimitiveTypeException {
- actions(ODataFormat.JSON_FULL_METADATA);
- }
-
- @Test
- public void edmEnabledActions() throws EdmPrimitiveTypeException {
- // IncreaseRevenue
- final ClientPrimitiveValue increaseValue = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildInt64(12L);
- final ODataInvokeRequest<ClientProperty> increaseRevenueReq =
- edmClient.getInvokeRequestFactory().getBoundActionInvokeRequest(
- edmClient.newURIBuilder().appendSingletonSegment("Company").build(),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.IncreaseRevenue"),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Company"),
- false,
- Collections.<String, ClientValue> singletonMap("IncreaseValue", increaseValue));
- final ClientProperty increaseRevenueRes = increaseRevenueReq.execute().getBody();
- assertNotNull(increaseRevenueRes);
- assertTrue(increaseRevenueRes.hasPrimitiveValue());
-
- // AddAccessRight
- final ClientEnumValue accessRight = edmClient.getObjectFactory().
- newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "Execute");
- final ODataInvokeRequest<ClientProperty> getProductDetailsReq =
- edmClient.getInvokeRequestFactory().getBoundActionInvokeRequest(
- edmClient.newURIBuilder().appendEntitySetSegment("Products").appendKeySegment(5).build(),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight"),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Product"),
- false,
- Collections.<String, ClientValue> singletonMap("accessRight", accessRight));
- final ClientProperty getProductDetailsRes = getProductDetailsReq.execute().getBody();
- assertNotNull(getProductDetailsRes);
- assertTrue(getProductDetailsRes.hasEnumValue());
-
- // ResetAddress
- final ClientCollectionValue<ClientValue> addresses =
- edmClient.getObjectFactory().
- newCollectionValue("Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)");
- final ClientComplexValue address = edmClient.getObjectFactory().
- newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address");
- address.add(edmClient.getObjectFactory().newPrimitiveProperty("Street",
- edmClient.getObjectFactory().newPrimitiveValueBuilder().buildString("Piazza La Bomba E Scappa")));
- address.add(edmClient.getObjectFactory().newPrimitiveProperty("City",
- edmClient.getObjectFactory().newPrimitiveValueBuilder().buildString("Tollo")));
- address.add(edmClient.getObjectFactory().newPrimitiveProperty("PostalCode",
- edmClient.getObjectFactory().newPrimitiveValueBuilder().buildString("66010")));
- addresses.add(address);
- final ClientPrimitiveValue index = edmClient.getObjectFactory().newPrimitiveValueBuilder().buildInt32(0);
- final Map<String, ClientValue> params = new LinkedHashMap<String, ClientValue>(2);
- params.put("addresses", addresses);
- params.put("index", index);
- final Map<String, Object> keys = new HashMap<String, Object>();
- keys.put("PersonID", 2);
- final ODataInvokeRequest<ClientEntity> resetAddressReq =
- edmClient.getInvokeRequestFactory().getBoundActionInvokeRequest(
- edmClient.newURIBuilder().appendEntitySetSegment("Customers").appendKeySegment(keys).build(),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Person"),
- false,
- params);
- final ClientEntity resetAddressRes = resetAddressReq.execute().getBody();
- assertNotNull(resetAddressRes);
- assertEquals(2, resetAddressRes.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0);
-
- // RefreshDefaultPI
- Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- dateTime.set(2014, 3, 9, 0, 0, 0);
- final ClientPrimitiveValue newDate = edmClient.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build();
- final ODataInvokeRequest<ClientEntity> getDefaultPIReq =
- edmClient.getInvokeRequestFactory().getBoundActionInvokeRequest(
- edmClient.newURIBuilder().appendEntitySetSegment("Accounts").appendKeySegment(102).build(),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"),
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Account"),
- false,
- Collections.<String, ClientValue> singletonMap("newDate", newDate));
- final ClientEntity getDefaultPIRes = getDefaultPIReq.execute().getBody();
- assertNotNull(getDefaultPIRes);
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
- getDefaultPIRes.getTypeName().toString());
- assertEquals(102901,
- getDefaultPIRes.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/ConformanceTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/ConformanceTestITCase.java
deleted file mode 100644
index 472928f..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/ConformanceTestITCase.java
+++ /dev/null
@@ -1,422 +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.fit.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.math.BigDecimal;
-import java.net.URI;
-import java.util.Calendar;
-import java.util.TimeZone;
-
-import org.apache.olingo.client.api.communication.header.HeaderName;
-import org.apache.olingo.client.api.communication.request.AsyncRequestWrapper;
-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.ODataDeltaRequest;
-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.AsyncResponseWrapper;
-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.domain.ClientCollectionValue;
-import org.apache.olingo.client.api.domain.ClientDelta;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.domain.ClientValue;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.core.http.BasicAuthHttpClientFactory;
-import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
-import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-/**
- * 13.2 Interoperable OData Clients
- * <br />
- * http://docs.oasis-open.org/odata/odata/v4.0/os/part1-protocol/odata-v4.0-os-part1-protocol.html#_Toc372793762
- */
-public class ConformanceTestITCase extends AbstractTestITCase {
-
- /**
- * 1. MUST specify the OData-MaxVersion header in requests (section 8.2.6).
- */
- @Test
- public void item1() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
-
- final ODataEntityRequest<ClientEntity> req =
- client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-
- assertEquals("4.0", req.getHeader("OData-MaxVersion"));
- assertEquals("4.0", req.getHeader(HeaderName.odataMaxVersion.toString()));
-
- assertNotNull(req.execute().getBody());
- }
-
- /**
- * 2. MUST specify OData-Version (section 8.1.5) and Content-Type (section 8.1.1) in any request with a payload.
- */
- @Test
- public void item2() {
- final ClientEntity order = getClient().getObjectFactory().newEntity(
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order"));
-
- final ClientProperty orderId = getClient().getObjectFactory().newPrimitiveProperty("OrderID",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(2000));
- order.getProperties().add(orderId);
-
- Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- dateTime.set(2011, 2, 4, 16, 3, 57);
- final ClientProperty orderDate = getClient().getObjectFactory().newPrimitiveProperty("OrderDate",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build());
- order.getProperties().add(orderDate);
-
- final ClientProperty shelfLife = getClient().getObjectFactory().newPrimitiveProperty("ShelfLife",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000001")).build());
- order.getProperties().add(shelfLife);
-
- final ClientCollectionValue<ClientValue> orderShelfLifesValue = getClient().getObjectFactory().
- newCollectionValue("Collection(Duration)");
- orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000001")).build());
- orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build());
- final ClientProperty orderShelfLifes = getClient().getObjectFactory().
- newCollectionProperty("OrderShelfLifes", orderShelfLifesValue);
- order.getProperties().add(orderShelfLifes);
-
- final ODataEntityCreateRequest<ClientEntity> req = getClient().getCUDRequestFactory().getEntityCreateRequest(
- getClient().newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Orders").build(), order);
- req.setFormat(ODataFormat.JSON_FULL_METADATA);
-
- // check for OData-Version
- assertEquals("4.0", req.getHeader("OData-Version"));
- assertEquals("4.0", req.getHeader(HeaderName.odataVersion.toString()));
-
- // check for Content-Type
- assertEquals(
- ODataFormat.JSON_FULL_METADATA.getContentType().toContentTypeString(),
- req.getHeader("Content-Type"));
- assertEquals(
- ODataFormat.JSON_FULL_METADATA.getContentType().toContentTypeString(),
- req.getHeader(HeaderName.contentType.toString()));
- assertEquals(
- ODataFormat.JSON_FULL_METADATA.getContentType().toContentTypeString(),
- req.getContentType());
-
- final ClientEntity created = req.execute().getBody();
- assertNotNull(created);
-
- final URI deleteURI = created.getEditLink() == null
- ? getClient().newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Orders").appendKeySegment(2000).build()
- : created.getEditLink();
- final ODataDeleteRequest deleteReq = getClient().getCUDRequestFactory().getDeleteRequest(deleteURI);
- final ODataDeleteResponse deleteRes = deleteReq.execute();
- assertEquals(204, deleteRes.getStatusCode());
- }
-
- /**
- * 4. MUST follow redirects (section 9.1.5).
- */
- @Test
- public void item4() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("redirect").
- appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
-
- final ODataEntityRequest<ClientEntity> req =
- client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-
- assertEquals("4.0", req.getHeader("OData-MaxVersion"));
- assertEquals("4.0", req.getHeader(HeaderName.odataMaxVersion.toString()));
-
- final ODataRetrieveResponse<ClientEntity> res = req.execute();
- final ClientEntity entity = res.getBody();
-
- assertNotNull(entity);
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
- assertTrue(entity.getProperty("Home").hasPrimitiveValue());
- assertEquals("Edm.GeographyPoint", entity.getProperty("Home").getPrimitiveValue().getTypeName());
- }
-
- /**
- * 5. MUST correctly handle next links (section 11.2.5.7).
- */
- @Test
- public void item5() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People");
-
- ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().
- getEntitySetRequest(uriBuilder.build());
- req.setFormat(ODataFormat.JSON_FULL_METADATA);
- req.setPrefer(client.newPreferences().maxPageSize(5));
-
- ODataRetrieveResponse<ClientEntitySet> res = req.execute();
- ClientEntitySet feed = res.getBody();
-
- assertNotNull(feed);
-
- assertEquals(5, feed.getEntities().size());
- assertNotNull(feed.getNext());
-
- final URI expected = URI.create(testStaticServiceRootURL + "/People?$skiptoken=5");
- final URI found = URIUtils.getURI(testStaticServiceRootURL, feed.getNext().toASCIIString());
-
- assertEquals(expected, found);
-
- req = client.getRetrieveRequestFactory().getEntitySetRequest(found);
- req.setFormat(ODataFormat.JSON_FULL_METADATA);
-
- res = req.execute();
- feed = res.getBody();
-
- assertNotNull(feed);
- }
-
- /**
- * 6. MUST support instances returning properties and navigation properties not specified in metadata (section 11.2).
- */
- @Test
- public void item6() {
- final Integer id = 2000;
-
- ClientEntity rowIndex = getClient().getObjectFactory().newEntity(
- new FullQualifiedName("Microsoft.Test.OData.Services.OpenTypesServiceV4.RowIndex"));
- getClient().getBinder().add(rowIndex,
- getClient().getObjectFactory().newPrimitiveProperty("Id",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id)));
-
- // add property not in metadata
- getClient().getBinder().add(rowIndex,
- getClient().getObjectFactory().newPrimitiveProperty("aString",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("string")));
-
- // add navigation property not in metadata
- rowIndex.addLink(client.getObjectFactory().newEntityNavigationLink(
- "Row", URI.create(testOpenTypeServiceRootURL + "/Row(71f7d0dc-ede4-45eb-b421-555a2aa1e58f)")));
-
- final ODataEntityCreateRequest<ClientEntity> createReq = getClient().getCUDRequestFactory().
- getEntityCreateRequest(getClient().newURIBuilder(testOpenTypeServiceRootURL).
- appendEntitySetSegment("RowIndex").build(), rowIndex);
-
- final ODataEntityCreateResponse<ClientEntity> createRes = createReq.execute();
- assertEquals(201, createRes.getStatusCode());
-
- final URIBuilder builder = getClient().newURIBuilder(testOpenTypeServiceRootURL).
- appendEntitySetSegment("RowIndex").appendKeySegment(id);
-
- rowIndex = read(ODataFormat.JSON_FULL_METADATA, builder.build());
- assertNotNull(rowIndex);
- assertEquals(EdmPrimitiveTypeKind.Int32, rowIndex.getProperty("Id").getPrimitiveValue().getTypeKind());
- assertEquals(EdmPrimitiveTypeKind.String, rowIndex.getProperty("aString").getPrimitiveValue().getTypeKind());
- assertNotNull(rowIndex.getNavigationLink("Row"));
-
- final ODataDeleteResponse deleteRes = getClient().getCUDRequestFactory().
- getDeleteRequest(rowIndex.getEditLink()).execute();
- assertEquals(204, deleteRes.getStatusCode());
- }
-
- /**
- * 7. MUST generate PATCH requests for updates, if the client supports updates (section 11.4.3).
- */
- @Test
- public void item7() {
- final URI uri = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customers").appendKeySegment(1).build();
-
- final ClientEntity patch = client.getObjectFactory().newEntity(
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
- patch.setEditLink(uri);
-
- final String newname = "New Name (" + System.currentTimeMillis() + ")";
- patch.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("FirstName",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildString(newname)));
-
- final ODataEntityUpdateRequest<ClientEntity> req =
- getClient().getCUDRequestFactory().getEntityUpdateRequest(UpdateType.PATCH, patch);
-
- final ODataEntityUpdateResponse<ClientEntity> res = req.execute();
- assertEquals(204, res.getStatusCode());
-
- final ClientEntity actual = read(ODataFormat.JSON, uri);
-
- assertEquals(newname, actual.getProperty("FirstName").getPrimitiveValue().toString());
- }
-
- /**
- * 8. SHOULD support basic authentication as specified in [RFC2617] over HTTPS.
- * <br />
- * Unfortunately no service over HTTPs is available yet.
- */
- @Test
- public void item8() {
- client.getConfiguration().setHttpClientFactory(new BasicAuthHttpClientFactory("odatajclient", "odatajclient"));
-
- final URIBuilder uriBuilder = client.newURIBuilder(testAuthServiceRootURL).
- appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
-
- final ODataEntityRequest<ClientEntity> req =
- client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(ODataFormat.JSON_FULL_METADATA);
-
- assertNotNull(req.execute().getBody());
-
- client.getConfiguration().setHttpClientFactory(new DefaultHttpClientFactory());
- }
-
- /**
- * 9. MAY request entity references in place of entities previously returned in the response (section 11.2.7).
- */
- @Test
- public void item9() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Orders").appendKeySegment(8).appendNavigationSegment("CustomerForOrder").
- appendRefSegment();
-
- ODataEntityRequest<ClientEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(ODataFormat.JSON_FULL_METADATA);
-
- ODataRetrieveResponse<ClientEntity> res = req.execute();
- assertNotNull(res);
-
- final ClientEntity entity = res.getBody();
- assertNotNull(entity);
- assertTrue(entity.getId().toASCIIString().endsWith("/StaticService/V40/Static.svc/Customers(PersonID=1)"));
-
- final URI referenceURI = client.newURIBuilder(testStaticServiceRootURL).
- appendEntityIdSegment(entity.getId().toASCIIString()).build();
-
- req = client.getRetrieveRequestFactory().getEntityRequest(referenceURI);
- req.setFormat(ODataFormat.JSON_FULL_METADATA);
-
- res = req.execute();
- assertNotNull(res);
- assertNotNull(res.getBody());
- }
-
- /**
- * 10. MAY support deleted entities, link entities, deleted link entities in a delta response (section 11.3).
- */
- @Test
- public void item10() {
- final ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().getEntitySetRequest(
- client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").build());
- req.setPrefer(client.newPreferences().trackChanges());
-
- final ClientEntitySet customers = req.execute().getBody();
- assertNotNull(customers);
- assertNotNull(customers.getDeltaLink());
-
- final ODataDeltaRequest deltaReq = client.getRetrieveRequestFactory().getDeltaRequest(customers.getDeltaLink());
- deltaReq.setFormat(ODataFormat.JSON_FULL_METADATA);
-
- final ClientDelta delta = deltaReq.execute().getBody();
- assertNotNull(delta);
-
- assertNotNull(delta.getDeltaLink());
- assertTrue(delta.getDeltaLink().isAbsolute());
- assertEquals(5, delta.getCount(), 0);
-
- assertEquals(1, delta.getDeletedEntities().size());
- assertTrue(delta.getDeletedEntities().get(0).getId().isAbsolute());
- assertTrue(delta.getDeletedEntities().get(0).getId().toASCIIString().endsWith("Customers('ANTON')"));
-
- assertEquals(1, delta.getAddedLinks().size());
- assertTrue(delta.getAddedLinks().get(0).getSource().isAbsolute());
- assertTrue(delta.getAddedLinks().get(0).getSource().toASCIIString().endsWith("Customers('BOTTM')"));
- assertEquals("Orders", delta.getAddedLinks().get(0).getRelationship());
-
- assertEquals(1, delta.getDeletedLinks().size());
- assertTrue(delta.getDeletedLinks().get(0).getSource().isAbsolute());
- assertTrue(delta.getDeletedLinks().get(0).getSource().toASCIIString().endsWith("Customers('ALFKI')"));
- assertEquals("Orders", delta.getDeletedLinks().get(0).getRelationship());
-
- assertEquals(2, delta.getEntities().size());
- ClientProperty property = delta.getEntities().get(0).getProperty("ContactName");
- assertNotNull(property);
- assertTrue(property.hasPrimitiveValue());
- property = delta.getEntities().get(1).getProperty("ShippingAddress");
- assertNotNull(property);
- assertTrue(property.hasComplexValue());
- }
-
- /**
- * 11. MAY support asynchronous responses (section 9.1.3).
- */
- @Test
- public void item11() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("async").appendEntitySetSegment("Orders");
-
- final ODataEntitySetRequest<ClientEntitySet> req =
- client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
- req.setFormat(ODataFormat.JSON_FULL_METADATA);
-
- final AsyncRequestWrapper<ODataRetrieveResponse<ClientEntitySet>> async =
- client.getAsyncRequestFactory().<ODataRetrieveResponse<ClientEntitySet>> getAsyncRequestWrapper(req);
- async.callback(URI.create("http://client.service.it/callback/endpoint"));
-
- final AsyncResponseWrapper<ODataRetrieveResponse<ClientEntitySet>> responseWrapper = async.execute();
-
- assertTrue(responseWrapper.isPreferenceApplied());
- assertTrue(responseWrapper.isDone());
-
- final ODataRetrieveResponse<ClientEntitySet> res = responseWrapper.getODataResponse();
- final ClientEntitySet entitySet = res.getBody();
-
- assertFalse(entitySet.getEntities().isEmpty());
- }
-
- /**
- * 12. MAY support odata.metadata=minimal in a JSON response (see [OData-JSON]).
- */
- @Test
- public void item12() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
-
- final ODataEntityRequest<ClientEntity> req =
- client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(ODataFormat.JSON);
-
- assertEquals("application/json;odata.metadata=minimal", req.getHeader("Accept"));
- assertEquals("application/json;odata.metadata=minimal", req.getHeader(HeaderName.accept.toString()));
- assertEquals("application/json;odata.metadata=minimal", req.getAccept());
-
- final ODataRetrieveResponse<ClientEntity> res = req.execute();
- assertTrue(res.getContentType().startsWith("application/json; odata.metadata=minimal"));
-
- assertNotNull(res.getBody());
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/DeltaTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/DeltaTestITCase.java
deleted file mode 100644
index 1d02141..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/DeltaTestITCase.java
+++ /dev/null
@@ -1,86 +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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.olingo.client.api.communication.request.retrieve.ODataDeltaRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
-import org.apache.olingo.client.api.domain.ClientDelta;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class DeltaTestITCase extends AbstractTestITCase {
-
- private void parse(final ODataFormat format) {
- final ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().getEntitySetRequest(
- client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").build());
- req.setPrefer(client.newPreferences().trackChanges());
-
- final ClientEntitySet customers = req.execute().getBody();
- assertNotNull(customers);
- assertNotNull(customers.getDeltaLink());
-
- final ODataDeltaRequest deltaReq = client.getRetrieveRequestFactory().getDeltaRequest(customers.getDeltaLink());
- deltaReq.setFormat(format);
-
- final ClientDelta delta = deltaReq.execute().getBody();
- assertNotNull(delta);
-
- assertNotNull(delta.getDeltaLink());
- assertTrue(delta.getDeltaLink().isAbsolute());
- assertEquals(5, delta.getCount(), 0);
-
- assertEquals(1, delta.getDeletedEntities().size());
- assertTrue(delta.getDeletedEntities().get(0).getId().isAbsolute());
- assertTrue(delta.getDeletedEntities().get(0).getId().toASCIIString().endsWith("Customers('ANTON')"));
-
- assertEquals(1, delta.getAddedLinks().size());
- assertTrue(delta.getAddedLinks().get(0).getSource().isAbsolute());
- assertTrue(delta.getAddedLinks().get(0).getSource().toASCIIString().endsWith("Customers('BOTTM')"));
- assertEquals("Orders", delta.getAddedLinks().get(0).getRelationship());
-
- assertEquals(1, delta.getDeletedLinks().size());
- assertTrue(delta.getDeletedLinks().get(0).getSource().isAbsolute());
- assertTrue(delta.getDeletedLinks().get(0).getSource().toASCIIString().endsWith("Customers('ALFKI')"));
- assertEquals("Orders", delta.getDeletedLinks().get(0).getRelationship());
-
- assertEquals(2, delta.getEntities().size());
- ClientProperty property = delta.getEntities().get(0).getProperty("ContactName");
- assertNotNull(property);
- assertTrue(property.hasPrimitiveValue());
- property = delta.getEntities().get(1).getProperty("ShippingAddress");
- assertNotNull(property);
- assertTrue(property.hasComplexValue());
- }
-
- @Test
- public void atomParse() {
- parse(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonParse() {
- parse(ODataFormat.JSON);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/DerivedTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/DerivedTypeTestITCase.java
deleted file mode 100644
index 401f6e8..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/DerivedTypeTestITCase.java
+++ /dev/null
@@ -1,150 +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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-
-import java.math.BigDecimal;
-import java.util.Calendar;
-import java.util.TimeZone;
-
-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.ODataEntityCreateResponse;
-import org.apache.olingo.client.api.domain.ClientComplexValue;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.domain.ClientValuable;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class DerivedTypeTestITCase extends AbstractTestITCase {
-
- private void read(final ODataFormat format) {
- // 1. entity set
- URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").
- appendDerivedEntityTypeSegment("Microsoft.Test.OData.Services.ODataWCFService.Customer");
- ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().
- getEntitySetRequest(uriBuilder.build());
- req.setFormat(format);
-
- for (ClientEntity customer : req.execute().getBody().getEntities()) {
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", customer.getTypeName().toString());
- }
-
- // 2. contained entity set
- uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Accounts").appendKeySegment(101).
- appendNavigationSegment("MyPaymentInstruments").
- appendDerivedEntityTypeSegment("Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI");
- req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
- req.setFormat(format);
-
- for (ClientEntity customer : req.execute().getBody().getEntities()) {
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI", customer.getTypeName().toString());
- }
- }
-
- @Test
- public void readfromAtom() {
- read(ODataFormat.ATOM);
- }
-
- @Test
- public void readfromJSON() {
- read(ODataFormat.JSON_FULL_METADATA);
- }
-
- private void createDelete(final ODataFormat format) {
- final ClientEntity customer = client.getObjectFactory().
- newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
-
- customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("PersonID",
- client.getObjectFactory().newPrimitiveValueBuilder().buildInt32(976)));
- customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("FirstName",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("Test")));
- customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("LastName",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("Test")));
-
- final ClientComplexValue homeAddress =
- client.getObjectFactory().newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress");
- homeAddress.add(client.getObjectFactory().newPrimitiveProperty("Street",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("V.le Gabriele D'Annunzio")));
- homeAddress.add(client.getObjectFactory().newPrimitiveProperty("City",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("Pescara")));
- homeAddress.add(client.getObjectFactory().newPrimitiveProperty("PostalCode",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("65127")));
- homeAddress.add(client.getObjectFactory().newPrimitiveProperty("CompanyName",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("Tirasa")));
- customer.getProperties().add(client.getObjectFactory().newComplexProperty("HomeAddress", homeAddress));
-
- customer.getProperties().add(client.getObjectFactory().newCollectionProperty("Numbers",
- client.getObjectFactory().newCollectionValue("Edm.String")));
- customer.getProperties().add(client.getObjectFactory().newCollectionProperty("Emails",
- client.getObjectFactory().newCollectionValue("Edm.String")));
- customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("City",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("Pescara")));
- final Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- dateTime.set(1977, 8, 8, 0, 0, 0);
- customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Birthday",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build()));
- customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("TimeBetweenLastTwoOrders",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build()));
-
- final ODataEntityCreateRequest<ClientEntity> createReq = client.getCUDRequestFactory().
- getEntityCreateRequest(
- client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People").build(),
- customer);
- createReq.setFormat(format);
-
- final ODataEntityCreateResponse<ClientEntity> createRes = createReq.execute();
- assertEquals(201, createRes.getStatusCode());
-
- final ODataEntityRequest<ClientEntity> fetchReq = client.getRetrieveRequestFactory().
- getEntityRequest(client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").appendKeySegment(976).build());
- fetchReq.setFormat(format);
-
- final ClientEntity actual = fetchReq.execute().getBody();
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", actual.getTypeName().toString());
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress",
- ((ClientValuable) actual.getProperty("HomeAddress")).getValue().getTypeName());
-
- final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest(actual.getEditLink());
- assertEquals(204, deleteReq.execute().getStatusCode());
- }
-
- @Test
- public void createDeleteAsAtom() {
- createDelete(ODataFormat.ATOM);
- }
-
- @Test
- public void createDeleteAsJSON() {
- createDelete(ODataFormat.JSON_FULL_METADATA);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/EntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/EntityCreateTestITCase.java
deleted file mode 100644
index 7966495..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/EntityCreateTestITCase.java
+++ /dev/null
@@ -1,191 +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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.net.URI;
-import java.util.Calendar;
-
-import org.apache.commons.lang3.RandomUtils;
-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.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
-import org.apache.olingo.client.api.domain.ClientLink;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class EntityCreateTestITCase extends AbstractTestITCase {
-
- @Test
- public void atomCreateAndDelete() {
- createAndDeleteOrder(testStaticServiceRootURL, ODataFormat.ATOM, 1000);
- }
-
- @Test
- public void jsonCreateAndDelete() {
- createAndDeleteOrder(testStaticServiceRootURL, ODataFormat.JSON, 1001);
- createAndDeleteOrder(testStaticServiceRootURL, ODataFormat.JSON_NO_METADATA, 1001);
- createAndDeleteOrder(testStaticServiceRootURL, ODataFormat.JSON_FULL_METADATA, 1001);
- }
-
- private void onContained(final ODataFormat format) {
- final URI uri = getClient().newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Accounts").
- appendKeySegment(101).appendNavigationSegment("MyPaymentInstruments").build();
-
- // 1. read contained collection before any operation
- ClientEntitySet instruments = getClient().getRetrieveRequestFactory().getEntitySetRequest(uri).execute().getBody();
- assertNotNull(instruments);
- final int sizeBefore = instruments.getCount();
-
- // 2. instantiate an ODataEntity of the same type as the collection above
- final ClientEntity instrument = getClient().getObjectFactory().
- newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument"));
-
- int id = RandomUtils.nextInt(101999, 105000);
- instrument.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("PaymentInstrumentID",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id)));
- instrument.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("FriendlyName",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("New one")));
- instrument.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("CreatedDate",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).build()));
-
- // 3. create it as contained entity
- final ODataEntityCreateRequest<ClientEntity> req = getClient().getCUDRequestFactory().
- getEntityCreateRequest(uri, instrument);
- req.setFormat(format);
-
- final ODataEntityCreateResponse<ClientEntity> res = req.execute();
- assertEquals(201, res.getStatusCode());
-
- // 4. verify that the contained collection effectively grew
- instruments = getClient().getRetrieveRequestFactory().getEntitySetRequest(uri).execute().getBody();
- assertNotNull(instruments);
- final int sizeAfter = instruments.getCount();
- assertEquals(sizeBefore + 1, sizeAfter);
-
- // 5. remove the contained entity created above
- final ODataDeleteResponse deleteRes = getClient().getCUDRequestFactory().
- getDeleteRequest(getClient().newURIBuilder(uri.toASCIIString()).appendKeySegment(id).build()).execute();
- assertEquals(204, deleteRes.getStatusCode());
-
- // 6. verify that the contained collection effectively reduced
- instruments = getClient().getRetrieveRequestFactory().getEntitySetRequest(uri).execute().getBody();
- assertNotNull(instruments);
- final int sizeEnd = instruments.getCount();
- assertEquals(sizeBefore, sizeEnd);
- }
-
- @Test
- public void atomOnContained() {
- onContained(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonOnContained() {
- onContained(ODataFormat.JSON);
- }
-
- private void deepInsert(final ODataFormat format, final int productId, final int productDetailId)
- throws EdmPrimitiveTypeException {
-
- final ClientEntity product = getClient().getObjectFactory().
- newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Product"));
- product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ProductID",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(productId)));
- product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Name",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("Latte")));
- product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("QuantityPerUnit",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("100g Bag")));
- product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("UnitPrice",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildSingle(3.24f)));
- product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("QuantityInStock",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(100)));
- product.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Discontinued",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildBoolean(false)));
- product.getProperties().add(getClient().getObjectFactory().newEnumProperty("UserAccess",
- getClient().getObjectFactory().
- newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "Execute")));
- product.getProperties().add(getClient().getObjectFactory().newEnumProperty("SkinColor",
- getClient().getObjectFactory().
- newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Blue")));
- product.getProperties().add(getClient().getObjectFactory().newCollectionProperty("CoverColors",
- getClient().getObjectFactory().
- newCollectionValue("Microsoft.Test.OData.Services.ODataWCFService.Color")));
- product.getProperty("CoverColors").getCollectionValue().add(getClient().getObjectFactory().
- newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Green"));
- product.getProperty("CoverColors").getCollectionValue().add(getClient().getObjectFactory().
- newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Red"));
-
- final ClientEntity detail = getClient().getObjectFactory().
- newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.ProductDetail"));
- detail.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ProductID",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(productId)));
- detail.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ProductDetailID",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(productDetailId)));
- detail.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ProductName",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("LatteHQ")));
- detail.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Description",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("High-Quality Milk")));
-
- final ClientEntitySet details = getClient().getObjectFactory().newEntitySet();
- details.getEntities().add(detail);
-
- final ClientInlineEntitySet inlineDetails = getClient().getObjectFactory().
- newDeepInsertEntitySet("Details", details);
- product.addLink(inlineDetails);
-
- final ODataEntityCreateRequest<ClientEntity> req = getClient().getCUDRequestFactory().getEntityCreateRequest(
- getClient().newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Products").build(), product);
- req.setFormat(format);
- final ODataEntityCreateResponse<ClientEntity> res = req.execute();
- assertEquals(201, res.getStatusCode());
-
- final ClientEntity createdProduct = res.getBody();
- assertEquals(productId,
- createdProduct.getProperty("ProductID").getPrimitiveValue().toCastValue(Integer.class), 0);
-
- final ClientLink createdLink = createdProduct.getNavigationLink("Details");
- assertNotNull(createdLink);
-
- final ClientEntitySet createdProductDetails =
- getClient().getRetrieveRequestFactory().getEntitySetRequest(createdLink.getLink()).execute().getBody();
- assertNotNull(createdProductDetails);
- assertEquals(productDetailId, createdProductDetails.getEntities().iterator().next().
- getProperty("ProductDetailID").getPrimitiveValue().toCastValue(Integer.class), 0);
- }
-
- @Test
- public void atomDeepInsert() throws EdmPrimitiveTypeException {
- deepInsert(ODataFormat.ATOM, 10, 10);
- }
-
- @Test
- public void jsonDeepInsert() throws EdmPrimitiveTypeException {
- deepInsert(ODataFormat.JSON_FULL_METADATA, 11, 11);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/EntityRetrieveTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/EntityRetrieveTestITCase.java
deleted file mode 100644
index 91461db..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/EntityRetrieveTestITCase.java
+++ /dev/null
@@ -1,371 +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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.net.URI;
-import java.sql.Timestamp;
-import java.util.LinkedHashMap;
-import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.client.api.ODataClient;
-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.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.domain.ClientInlineEntity;
-import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
-import org.apache.olingo.client.api.domain.ClientLink;
-import org.apache.olingo.client.api.domain.ClientLinkType;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-/**
- * This is the unit test class to check entity retrieve operations.
- */
-public class EntityRetrieveTestITCase extends AbstractTestITCase {
-
- private void withInlineEntity(final ODataClient client, final ODataFormat format) {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
-
- final ODataEntityRequest<ClientEntity> req = client.getRetrieveRequestFactory().
- getEntityRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ODataRetrieveResponse<ClientEntity> res = req.execute();
- final ClientEntity entity = res.getBody();
-
- assertNotNull(entity);
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
- assertTrue(entity.getProperty("Home").hasPrimitiveValue());
- assertEquals("Edm.GeographyPoint", entity.getProperty("Home").getPrimitiveValue().getTypeName());
-
- // In JSON with minimal metadata, links are not provided
- if (format == ODataFormat.ATOM || format == ODataFormat.JSON_FULL_METADATA) {
- assertEquals(testStaticServiceRootURL + "/Customers(1)", entity.getEditLink().toASCIIString());
- assertEquals(3, entity.getNavigationLinks().size());
-
- if (ODataFormat.ATOM == format) {
- assertTrue(entity.getAssociationLinks().isEmpty());
- // In JSON, association links for each $ref link will exist.
- }
-
- boolean found = false;
-
- for (ClientLink link : entity.getNavigationLinks()) {
- if (link instanceof ClientInlineEntity) {
- final ClientEntity inline = ((ClientInlineEntity) link).getEntity();
- assertNotNull(inline);
-
- final List<? extends ClientProperty> 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 withInlineEntityFromAtom() {
- withInlineEntity(client, ODataFormat.ATOM);
- }
-
- @Test
- public void withInlineEntityFromFullJSON() {
- withInlineEntity(client, ODataFormat.JSON_FULL_METADATA);
- }
-
- @Test
- public void withInlineEntityFromJSON() {
- withInlineEntity(edmClient, ODataFormat.JSON);
- }
-
- private void withInlineEntitySet(final ODataClient client, final ODataFormat format) {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customers").appendKeySegment(1).expand("Orders");
-
- final ODataEntityRequest<ClientEntity> req = client.getRetrieveRequestFactory().
- getEntityRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ODataRetrieveResponse<ClientEntity> res = req.execute();
- final ClientEntity entity = res.getBody();
- assertNotNull(entity);
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
-
- // In JSON with minimal metadata, links are not provided
- if (format == ODataFormat.ATOM || format == ODataFormat.JSON_FULL_METADATA) {
- boolean found = false;
- for (ClientLink link : entity.getNavigationLinks()) {
- if (link instanceof ClientInlineEntitySet) {
- final ClientEntitySet inline = ((ClientInlineEntitySet) link).getEntitySet();
- assertNotNull(inline);
-
- found = true;
- }
- }
- assertTrue(found);
- }
- }
-
- @Test
- public void withInlineEntitySetFromAtom() {
- withInlineEntitySet(client, ODataFormat.ATOM);
- }
-
- @Test
- public void withInlineEntitySetFromFullJSON() {
- withInlineEntitySet(client, ODataFormat.JSON_FULL_METADATA);
- }
-
- @Test
- public void withInlineEntitySetFromJSON() {
- withInlineEntitySet(edmClient, ODataFormat.JSON);
- }
-
- private void rawRequest(final ODataFormat format) {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").appendKeySegment(5);
-
- final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
- req.setFormat(format.getContentType().toContentTypeString());
-
- final ODataRawResponse res = req.execute();
- assertNotNull(res);
-
- final ResWrap<ClientEntitySet> entitySet = res.getBodyAs(ClientEntitySet.class);
- assertNull(entitySet);
-
- final ResWrap<ClientEntity> entity = res.getBodyAs(ClientEntity.class);
- assertTrue(entity.getPayload().getId().toASCIIString().endsWith("/StaticService/V40/Static.svc/People(5)"));
- }
-
- @Test
- public void rawRequestAsAtom() {
- rawRequest(ODataFormat.ATOM);
- }
-
- @Test
- public void rawRequestAsJSON() {
- // this needs to be full, otherwise reference will not be provided
- rawRequest(ODataFormat.JSON_FULL_METADATA);
- }
-
- private void multiKey(final ODataFormat format) throws EdmPrimitiveTypeException {
- final LinkedHashMap<String, Object> multiKey = new LinkedHashMap<String, Object>();
- multiKey.put("ProductID", "6");
- multiKey.put("ProductDetailID", 1);
-
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("ProductDetails").appendKeySegment(multiKey);
-
- final ODataEntityRequest<ClientEntity> req =
- client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ODataRetrieveResponse<ClientEntity> res = req.execute();
- final ClientEntity entity = res.getBody();
- assertNotNull(entity);
- assertEquals(Integer.valueOf(1),
- entity.getProperty("ProductDetailID").getPrimitiveValue().toCastValue(Integer.class));
- }
-
- @Test
- public void multiKeyAsAtom() throws EdmPrimitiveTypeException {
- multiKey(ODataFormat.ATOM);
- }
-
- @Test
- public void multiKeyAsJSON() throws EdmPrimitiveTypeException {
- multiKey(ODataFormat.JSON_FULL_METADATA);
- }
-
- private void checkForETag(final ODataClient client, final ODataFormat format) {
- final URIBuilder uriBuilder =
- client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders").appendKeySegment(8);
-
- final ODataEntityRequest<ClientEntity> req =
- client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ODataRetrieveResponse<ClientEntity> res = req.execute();
- assertEquals(200, res.getStatusCode());
-
- final String etag = res.getETag();
- assertTrue(StringUtils.isNotBlank(etag));
-
- final ClientEntity order = res.getBody();
- assertEquals(etag, order.getETag());
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Order", order.getTypeName().toString());
- assertEquals("Edm.Int32", order.getProperty("OrderID").getPrimitiveValue().getTypeName());
- assertEquals("Edm.DateTimeOffset", order.getProperty("OrderDate").getPrimitiveValue().getTypeName());
- assertEquals("Edm.Duration", order.getProperty("ShelfLife").getPrimitiveValue().getTypeName());
- assertEquals("Collection(Edm.Duration)", order.getProperty("OrderShelfLifes").getCollectionValue().getTypeName());
- }
-
- @Test
- public void checkForETagAsAtom() {
- checkForETag(client, ODataFormat.ATOM);
- }
-
- @Test
- public void checkForETagAsFullJSON() {
- checkForETag(client, ODataFormat.JSON_FULL_METADATA);
- }
-
- @Test
- public void checkForETagAsJSON() {
- checkForETag(edmClient, ODataFormat.JSON);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void issue99() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Orders");
-
- final ODataEntityRequest<ClientEntity> req =
- client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(ODataFormat.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();
- }
-
- private void reference(final ODataFormat format) {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Orders").appendKeySegment(8).appendNavigationSegment("CustomerForOrder").
- appendRefSegment();
-
- ODataEntityRequest<ClientEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(format);
-
- ODataRetrieveResponse<ClientEntity> res = req.execute();
- assertNotNull(res);
-
- final ClientEntity entity = res.getBody();
- assertNotNull(entity);
- assertTrue(entity.getId().toASCIIString().endsWith("/StaticService/V40/Static.svc/Customers(PersonID=1)"));
-
- final URI referenceURI = client.newURIBuilder(testStaticServiceRootURL).
- appendEntityIdSegment(entity.getId().toASCIIString()).build();
-
- req = client.getRetrieveRequestFactory().getEntityRequest(referenceURI);
- req.setFormat(format);
-
- res = req.execute();
- assertNotNull(res);
- assertNotNull(res.getBody());
- }
-
- @Test
- public void atomReference() {
- reference(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonReference() {
- reference(ODataFormat.JSON_FULL_METADATA);
- }
-
- private void contained(final ODataClient client, final ODataFormat format) throws EdmPrimitiveTypeException {
- final URI uri = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Accounts").appendKeySegment(101).
- appendNavigationSegment("MyPaymentInstruments").appendKeySegment(101902).build();
- final ODataEntityRequest<ClientEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uri);
- req.setFormat(format);
-
- final ClientEntity contained = req.execute().getBody();
- assertNotNull(contained);
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", contained.getTypeName().toString());
- assertEquals(101902,
- contained.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0);
- assertEquals("Edm.DateTimeOffset", contained.getProperty("CreatedDate").getPrimitiveValue().getTypeName());
- assertNotNull(contained.getProperty("CreatedDate").getPrimitiveValue().toCastValue(Timestamp.class));
- }
-
- @Test
- public void containedFromAtom() throws EdmPrimitiveTypeException {
- contained(client, ODataFormat.ATOM);
- }
-
- @Test
- public void containedFromFullJSON() throws EdmPrimitiveTypeException {
- contained(client, ODataFormat.JSON_FULL_METADATA);
- }
-
- @Test
- public void containedFromJSON() throws EdmPrimitiveTypeException {
- contained(edmClient, ODataFormat.JSON);
- }
-
- private void entitySetNavigationLink(final ODataClient client, final ODataFormat format) {
- final URI uri = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Accounts").appendKeySegment(101).build();
- final ODataEntityRequest<ClientEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uri);
- req.setFormat(format);
-
- final ClientEntity entity = req.execute().getBody();
- assertNotNull(entity);
-
- // With JSON, entity set navigation links are only recognizable via Edm
- if (format == ODataFormat.ATOM || client instanceof EdmEnabledODataClient) {
- assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("MyPaymentInstruments").getType());
- assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("ActiveSubscriptions").getType());
- }
- }
-
- @Test
- public void entitySetNavigationLinkFromAtom() {
- entitySetNavigationLink(client, ODataFormat.ATOM);
- }
-
- @Test
- public void entitySetNavigationLinkFromJSON() {
- // only JSON_FULL_METADATA has links, only Edm can recognize entity set navigation
- entitySetNavigationLink(edmClient, ODataFormat.JSON_FULL_METADATA);
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/EntitySetTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/EntitySetTestITCase.java
deleted file mode 100644
index b94e891..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/EntitySetTestITCase.java
+++ /dev/null
@@ -1,178 +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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.apache.olingo.client.api.ODataClient;
-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.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.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.domain.ClientEntitySetIterator;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-/**
- * This is the unit test class to check basic feed operations.
- */
-public class EntitySetTestITCase extends AbstractTestITCase {
-
- private void rawRequest(final ODataFormat format) {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People");
-
- final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
- req.setFormat(format.getContentType().toContentTypeString());
-
- final ODataRawResponse res = req.execute();
- assertNotNull(res);
-
- final ResWrap<ClientEntitySet> entitySet = res.getBodyAs(ClientEntitySet.class);
- assertNotNull(entitySet.getPayload());
- assertTrue(entitySet.getContextURL().toASCIIString().endsWith("$metadata#People"));
- }
-
- @Test
- public void rawRequestAsAtom() throws IOException {
- rawRequest(ODataFormat.ATOM);
- }
-
- @Test
- public void rawRequestAsJSON() throws IOException {
- rawRequest(ODataFormat.JSON);
- }
-
- private void readWithInlineCount(final ODataClient client, final ODataFormat format) {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").count(true);
-
- final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
- req.setFormat(format.getContentType().toContentTypeString());
-
- final ODataRawResponse res = req.execute();
- assertNotNull(res);
-
- final ResWrap<ClientEntitySet> entitySet = res.getBodyAs(ClientEntitySet.class);
- assertEquals(5, entitySet.getPayload().getEntities().size());
-
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Address",
- entitySet.getPayload().getEntities().get(2).getProperty("HomeAddress").getComplexValue().getTypeName());
- }
-
- @Test
- public void readWithInlineCountAsJSON() throws IOException {
- readWithInlineCount(edmClient, ODataFormat.JSON);
- }
-
- @Test
- public void readWithInlineCountAsFullJSON() throws IOException {
- readWithInlineCount(client, ODataFormat.JSON_FULL_METADATA);
- }
-
- @Test
- public void readWithInlineCountAsAtom() throws IOException {
- readWithInlineCount(client, ODataFormat.ATOM);
- }
-
- private void readODataEntitySetIterator(final ODataFormat format) {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People");
-
- final ODataEntitySetIteratorRequest<ClientEntitySet, ClientEntity> req =
- client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ODataRetrieveResponse<ClientEntitySetIterator<ClientEntitySet, ClientEntity>> res = req.execute();
- final ClientEntitySetIterator<ClientEntitySet, ClientEntity> feedIterator = res.getBody();
-
- assertNotNull(feedIterator);
-
- int count = 0;
-
- while (feedIterator.hasNext()) {
- assertNotNull(feedIterator.next());
- count++;
- }
- assertEquals(5, count);
- assertTrue(feedIterator.getNext().toASCIIString().endsWith("People?$skiptoken=5"));
- }
-
- @Test
- public void readODataEntitySetIteratorFromAtom() {
- readODataEntitySetIterator(ODataFormat.ATOM);
- }
-
- @Test
- public void readODataEntitySetIteratorFromJSON() {
- readODataEntitySetIterator(ODataFormat.JSON);
- }
-
- @Test
- public void readODataEntitySetIteratorFromJSONFull() {
- readODataEntitySetIterator(ODataFormat.JSON_FULL_METADATA);
- }
-
- @Test
- public void readODataEntitySetIteratorFromJSONNo() {
- readODataEntitySetIterator(ODataFormat.JSON_NO_METADATA);
- }
-
- private void readWithNext(final ODataFormat format) {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People");
-
- final ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().
- getEntitySetRequest(uriBuilder.build());
- req.setFormat(format);
- req.setPrefer(client.newPreferences().maxPageSize(5));
-
- final ODataRetrieveResponse<ClientEntitySet> res = req.execute();
- final ClientEntitySet feed = res.getBody();
-
- assertNotNull(feed);
-
- assertEquals(5, feed.getEntities().size());
- assertNotNull(feed.getNext());
-
- final URI expected = URI.create(testStaticServiceRootURL + "/People?$skiptoken=5");
- final URI found = URIUtils.getURI(testStaticServiceRootURL, feed.getNext().toASCIIString());
-
- assertEquals(expected, found);
- }
-
- @Test
- public void readWithNextFromAtom() {
- readWithNext(ODataFormat.ATOM);
- }
-
- @Test
- public void readWithNextFromJSON() {
- readWithNext(ODataFormat.JSON_FULL_METADATA);
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/EntityUpdateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/EntityUpdateTestITCase.java
deleted file mode 100644
index 6ac0e8d..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/EntityUpdateTestITCase.java
+++ /dev/null
@@ -1,185 +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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.math.BigDecimal;
-import java.net.URI;
-import java.util.Calendar;
-import java.util.TimeZone;
-import java.util.UUID;
-
-import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
-import org.apache.olingo.client.api.communication.request.cud.ODataReferenceAddingRequest;
-import org.apache.olingo.client.api.communication.request.cud.UpdateType;
-import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
-import org.apache.olingo.client.api.communication.response.ODataReferenceAddingResponse;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientLink;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class EntityUpdateTestITCase extends AbstractTestITCase {
-
- private void upsert(final UpdateType updateType, final ODataFormat format) {
- final ClientEntity order = getClient().getObjectFactory().
- newEntity(new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order"));
-
- order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderID",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(9)));
- order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("OrderDate",
- getClient().getObjectFactory().newPrimitiveValueBuilder()
- .setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(
- Calendar.getInstance(TimeZone.getTimeZone("GMT"))).build()));
- order.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("ShelfLife",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build()));
-
- final URI upsertURI = getClient().newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Orders").appendKeySegment(9).build();
- final ODataEntityUpdateRequest<ClientEntity> req = getClient().getCUDRequestFactory().
- getEntityUpdateRequest(upsertURI, updateType, order);
- req.setFormat(format);
-
- req.execute();
- try {
- final ClientEntity read = read(format, upsertURI);
- assertNotNull(read);
- assertEquals(order.getProperty("OrderID"), read.getProperty("OrderID"));
- assertEquals(order.getProperty("OrderDate").getPrimitiveValue().toString(),
- read.getProperty("OrderDate").getPrimitiveValue().toString());
- assertEquals(order.getProperty("ShelfLife").getPrimitiveValue().toString(),
- read.getProperty("ShelfLife").getPrimitiveValue().toString());
- } finally {
- getClient().getCUDRequestFactory().getDeleteRequest(upsertURI).execute();
- }
- }
-
- @Test
- @Ignore
- public void testUpateSingleValuedNavtiogationReference() throws Exception {
- URI targetURI =
- getClient().newURIBuilder(testStaticServiceRootURL)
- .appendEntitySetSegment("People")
- .appendKeySegment(1)
- .appendNavigationSegment("Parent")
- .build();
-
- URI reference = getClient().newURIBuilder(testStaticServiceRootURL)
- .appendEntitySetSegment("People")
- .appendKeySegment(0)
- .build();
-
- final ODataReferenceAddingRequest request =
- getClient().getCUDRequestFactory().getReferenceSingleChangeRequest(new URI(testStaticServiceRootURL),
- targetURI, reference);
-
- final ODataReferenceAddingResponse response = request.execute();
-
- assertEquals(204, response.getStatusCode());
- }
-
- @Test
- public void atomUpsert() {
- upsert(UpdateType.PATCH, ODataFormat.ATOM);
- upsert(UpdateType.REPLACE, ODataFormat.ATOM);
- }
-
- @Test
- public void jsonUpsert() {
- upsert(UpdateType.PATCH, ODataFormat.JSON);
- upsert(UpdateType.REPLACE, ODataFormat.JSON);
- }
-
- private void onContained(final ODataFormat format) {
- final String newName = UUID.randomUUID().toString();
- final ClientEntity changes = getClient().getObjectFactory().newEntity(
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument"));
- changes.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("FriendlyName",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildString(newName)));
-
- final URI uri = getClient().newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Accounts").appendKeySegment(101).
- appendNavigationSegment("MyPaymentInstruments").appendKeySegment(101901).build();
- final ODataEntityUpdateRequest<ClientEntity> req = getClient().getCUDRequestFactory().
- getEntityUpdateRequest(uri, UpdateType.PATCH, changes);
- req.setFormat(format);
-
- final ODataEntityUpdateResponse<ClientEntity> res = req.execute();
- assertEquals(204, res.getStatusCode());
-
- final ClientEntity actual = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody();
- assertNotNull(actual);
- assertEquals(newName, actual.getProperty("FriendlyName").getPrimitiveValue().toString());
- }
-
- @Test
- public void atomOnContained() {
- onContained(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonOnContained() {
- onContained(ODataFormat.JSON);
- }
-
- private void bindOperation(final ODataFormat format) throws EdmPrimitiveTypeException {
- final ClientEntity changes = getClient().getObjectFactory().newEntity(
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
- final ClientLink parent = getClient().getObjectFactory().newEntityNavigationLink("Parent",
- getClient().newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").appendKeySegment(1).build());
- changes.getNavigationLinks().add(parent);
-
- final URI uri = getClient().newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").appendKeySegment(5).build();
- final ODataEntityUpdateRequest<ClientEntity> req = getClient().getCUDRequestFactory().
- getEntityUpdateRequest(uri, UpdateType.PATCH, changes);
- req.setFormat(format);
-
- final ODataEntityUpdateResponse<ClientEntity> res = req.execute();
- assertEquals(204, res.getStatusCode());
-
- final ClientEntity updated = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody();
- assertNotNull(updated);
- final ClientLink updatedLink = updated.getNavigationLink("Parent");
- assertNotNull(updatedLink);
-
- final ClientEntity updatedEntity = getClient().getRetrieveRequestFactory().getEntityRequest(updatedLink.getLink()).
- execute().getBody();
- assertNotNull(updatedEntity);
- assertEquals(1, updatedEntity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0);
- }
-
- @Test
- public void atomBindOperation() throws EdmPrimitiveTypeException {
- bindOperation(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonBindOperation() throws EdmPrimitiveTypeException {
- bindOperation(ODataFormat.JSON);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java
deleted file mode 100644
index 33d3ba4..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/ErrorResponseTestITCase.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.net.URI;
-import java.util.Map;
-
-import org.apache.olingo.client.api.communication.ODataClientErrorException;
-import org.apache.olingo.commons.api.ODataError;
-import org.apache.olingo.commons.api.ODataErrorDetail;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class ErrorResponseTestITCase extends AbstractTestITCase {
-
- @Test
- public void jsonError() {
- final URI readURI = getClient().newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customers").appendKeySegment(32).
- build();
-
- try {
- read(ODataFormat.JSON, readURI);
- fail("should have got exception");
- } catch (Exception ex) {
- final ODataError err = ((ODataClientErrorException) ex).getODataError();
-
- // verify details
- final ODataErrorDetail detail = err.getDetails().get(0);
- assertEquals("Code should be correct", "301", detail.getCode());
- assertEquals("Target should be correct", "$search", detail.getTarget());
- assertEquals("Message should be correct", "$search query option not supported", detail.getMessage());
-
- // verify inner error dictionary
- final Map<String, String> innerErr = err.getInnerError();
- assertEquals("innerError dictionary size should be correct", 2, innerErr.size());
- assertEquals("innerError['context'] should be correct",
- "{\"key1\":\"for debug deployment only\"}", innerErr.get("context"));
- assertEquals("innerError['trace'] should be correct",
- "[\"callmethod1 etc\",\"callmethod2 etc\"]", innerErr.get("trace"));
- }
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/FilterFactoryTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/FilterFactoryTestITCase.java
deleted file mode 100644
index b7a4f8c..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/FilterFactoryTestITCase.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.uri.FilterArgFactory;
-import org.apache.olingo.client.api.uri.FilterFactory;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.api.uri.URIFilter;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class FilterFactoryTestITCase extends AbstractTestITCase {
-
- private FilterFactory getFilterFactory() {
- return getClient().getFilterFactory();
- }
-
- private FilterArgFactory getFilterArgFactory() {
- return getFilterFactory().getArgFactory();
- }
-
- @Test
- public void crossjoin() {
- final URIFilter filter = getFilterFactory().eq(
- getFilterArgFactory().property("Orders/OrderID"), getFilterArgFactory().property("Customers/Order"));
-
- final URIBuilder uriBuilder =
- client.newURIBuilder(testStaticServiceRootURL).appendCrossjoinSegment("Customers", "Orders").filter(filter);
-
- final ODataEntitySetRequest<ClientEntitySet> req =
- client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
- req.setFormat(ODataFormat.JSON_FULL_METADATA);
-
- final ClientEntitySet feed = req.execute().getBody();
- assertEquals(3, feed.getEntities().size());
-
- for (ClientEntity entity : feed.getEntities()) {
- assertEquals(2, entity.getNavigationLinks().size());
- }
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.java
deleted file mode 100644
index 648dcec..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.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.math.BigDecimal;
-import java.net.URI;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ClientAnnotation;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.domain.ClientLink;
-import org.apache.olingo.client.api.domain.ClientLinkType;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-/**
- * The test cases in this class are inspired by client conformance criteria defined in the <a
- * href="http://docs.oasis-open.org/odata/odata-json-format/v4.0/os/odata-json-format-v4.0-os.html#_Toc372793094">specs
- * </a>.
- */
-public class JSONFormatConformanceTestITCase extends AbstractTestITCase {
-
- /**
- * MUST either:
- * <ol>
- * <li>understand <tt>odata.metadata=minimal</tt> (section 3.1.1) or</li>
- * <li>explicitly specify <tt>odata.metadata=none</tt>(section 3.1.3) or <tt>odata.metadata=full</tt> (section 3.1.2)
- * in the request (client)</li>
- * </ol>
- * .
- */
- @Test
- public void item1() throws EdmPrimitiveTypeException {
- final URI uri = edmClient.newURIBuilder().
- appendEntitySetSegment("Accounts").appendKeySegment(102).
- appendNavigationSegment("MyPaymentInstruments").appendKeySegment(102902).build();
- final ODataEntityRequest<ClientEntity> req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri);
-
- // request format (via Accept header) is set to minimal by default
- assertEquals("application/json;odata.metadata=minimal", req.getAccept());
-
- final ODataRetrieveResponse<ClientEntity> res = req.execute();
-
- // response is odata.metadata=minimal
- assertFalse(res.getContentType().contains("odata.metadata=none"));
- assertFalse(res.getContentType().contains("odata.metadata=full"));
-
- // response payload is understood
- final ClientEntity entity = res.getBody();
- assertNotNull(entity);
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", entity.getTypeName().toString());
- assertEquals(102902, entity.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0);
- assertEquals("Edm.DateTimeOffset", entity.getProperty("CreatedDate").getPrimitiveValue().getTypeName());
- }
-
- /**
- * MUST be prepared to consume a response with full metadata.
- */
- @Test
- public void item2() {
- final URI uri = edmClient.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Accounts").appendKeySegment(102).build();
- final ODataEntityRequest<ClientEntity> req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri);
- req.setFormat(ODataFormat.JSON_FULL_METADATA);
-
- // request format (via Accept header) is set to full metadata
- assertEquals("application/json;odata.metadata=full", req.getAccept());
-
- final ODataRetrieveResponse<ClientEntity> res = req.execute();
-
- // response is odata.metadata=full
- assertTrue(res.getContentType().contains("odata.metadata=full"));
-
- // response payload is understood (including links, only returned with full metadata)
- final ClientEntity entity = res.getBody();
- assertNotNull(entity);
- assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("MyPaymentInstruments").getType());
- assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, entity.getNavigationLink("ActiveSubscriptions").getType());
- }
-
- /**
- * MUST be prepared to receive all data types (section 7.1)
- * <ol>
- * <li>defined in this specification (client)</li>
- * <li>exposed by the service (service)</li>
- * </ol>
- * .
- */
- @Test
- public void item3() throws Exception {
- final String fromSection71 = "{"
- + "\"NullValue\": null,"
- + "\"TrueValue\": true,"
- + "\"FalseValue\": false,"
- + "\"BinaryValue@odata.type\": \"Binary\","
- + "\"BinaryValue\": \"T0RhdGE\","
- + "\"IntegerValue\": -128,"
- + "\"DoubleValue\": 3.1415926535897931,"
- + "\"SingleValue@odata.type\": \"Single\","
- + "\"SingleValue\": \"INF\","
- + "\"DecimalValue@odata.type\": \"Decimal\","
- + "\"DecimalValue\": 34.95,"
- + "\"StringValue\": \"Say \\\"Hello\\\",\\nthen go\","
- + "\"DateValue@odata.type\": \"Date\","
- + "\"DateValue\": \"2012-12-03\","
- + "\"DateTimeOffsetValue@odata.type\": \"DateTimeOffset\","
- + "\"DateTimeOffsetValue\": \"2012-12-03T07:16:23Z\","
- + "\"DurationValue@odata.type\": \"Duration\","
- + "\"DurationValue\": \"P12DT23H59M59.999999999999S\","
- + "\"TimeOfDayValue@odata.type\": \"TimeOfDay\","
- + "\"TimeOfDayValue\": \"07:59:59.999\","
- + "\"GuidValue@odata.type\": \"Guid\","
- + "\"GuidValue\": \"01234567-89ab-cdef-0123-456789abcdef\","
- + "\"Int64Value@odata.type\": \"Int64\","
- + "\"Int64Value\": 0,"
- + "\"ColorEnumValue@odata.type\": \"Test.Color\","
- + "\"ColorEnumValue\": \"Yellow\","
- + "\"GeographyPoint\": {\"type\": \"Point\",\"coordinates\":[142.1,64.1]}"
- + "}";
-
- final ClientEntity entity = client.getReader().readEntity(IOUtils.toInputStream(fromSection71), ODataFormat.JSON);
-
- assertTrue(entity.getProperty("NullValue").hasNullValue());
-
- assertEquals(EdmPrimitiveTypeKind.Boolean, entity.getProperty("TrueValue").getPrimitiveValue().getTypeKind());
- assertEquals(Boolean.TRUE, entity.getProperty("TrueValue").getPrimitiveValue().toCastValue(Boolean.class));
-
- assertEquals(EdmPrimitiveTypeKind.Boolean, entity.getProperty("FalseValue").getPrimitiveValue().getTypeKind());
- assertEquals(Boolean.FALSE, entity.getProperty("FalseValue").getPrimitiveValue().toCastValue(Boolean.class));
-
- assertEquals(EdmPrimitiveTypeKind.Binary, entity.getProperty("BinaryValue").getPrimitiveValue().getTypeKind());
-
- assertEquals(EdmPrimitiveTypeKind.Int32, entity.getProperty("IntegerValue").getPrimitiveValue().getTypeKind());
- assertEquals(-128, entity.getProperty("IntegerValue").getPrimitiveValue().toCastValue(Integer.class), 0);
-
- assertEquals(EdmPrimitiveTypeKind.Double, entity.getProperty("DoubleValue").getPrimitiveValue().getTypeKind());
- assertEquals(3.1415926535897931,
- entity.getProperty("DoubleValue").getPrimitiveValue().toCastValue(Double.class), 0);
-
- assertEquals(EdmPrimitiveTypeKind.Single, entity.getProperty("SingleValue").getPrimitiveValue().getTypeKind());
- assertEquals(Float.POSITIVE_INFINITY,
- entity.getProperty("SingleValue").getPrimitiveValue().toCastValue(Float.class), 0);
-
- assertEquals(EdmPrimitiveTypeKind.Decimal, entity.getProperty("DecimalValue").getPrimitiveValue().getTypeKind());
- assertEquals(BigDecimal.valueOf(34.95),
- entity.getProperty("DecimalValue").getPrimitiveValue().toCastValue(BigDecimal.class));
-
- assertEquals(EdmPrimitiveTypeKind.String, entity.getProperty("StringValue").getPrimitiveValue().getTypeKind());
- assertEquals("Say \"Hello\",\nthen go",
- entity.getProperty("StringValue").getPrimitiveValue().toCastValue(String.class));
-
- assertEquals(EdmPrimitiveTypeKind.Date, entity.getProperty("DateValue").getPrimitiveValue().getTypeKind());
-
- assertEquals(EdmPrimitiveTypeKind.DateTimeOffset,
- entity.getProperty("DateTimeOffsetValue").getPrimitiveValue().getTypeKind());
-
- assertEquals(EdmPrimitiveTypeKind.Duration, entity.getProperty("DurationValue").getPrimitiveValue().getTypeKind());
-
- assertEquals(EdmPrimitiveTypeKind.TimeOfDay,
- entity.getProperty("TimeOfDayValue").getPrimitiveValue().getTypeKind());
-
- assertEquals(EdmPrimitiveTypeKind.Guid, entity.getProperty("GuidValue").getPrimitiveValue().getTypeKind());
-
- assertEquals(EdmPrimitiveTypeKind.Int64, entity.getProperty("Int64Value").getPrimitiveValue().getTypeKind());
-
- assertTrue(entity.getProperty("ColorEnumValue").hasEnumValue());
-
- assertEquals(EdmPrimitiveTypeKind.GeographyPoint,
- entity.getProperty("GeographyPoint").getPrimitiveValue().getTypeKind());
- }
-
- /**
- * MUST interpret all odata annotations defined according to the OData-Version header of the payload (section 4.5).
- */
- @Test
- public void item4() throws Exception {
- final String fromSection45_1 = "{"
- + "\"@odata.context\": \"http://host/service/$metadata#Customers/$entity\","
- + "\"@odata.metadataEtag\": \"W/\\\"A1FF3E230954908F\\\"\","
- + "\"@odata.etag\": \"W/\\\"A1FF3E230954908G\\\"\","
- + "\"@odata.type\": \"#Model.VipCustomer\","
- + "\"@odata.id\": \"http://host/service/Employees(PersonID=3)\","
- + "\"@odata.editLink\": \"People(976)\","
- + "\"@odata.mediaEditLink\": \"Employees(1)/$value\","
- + "\"@odata.mediaContentType\": \"image/jpeg\","
- + "\"@odata.mediaEtag\": \"W/\\\"A1FF3E230954908H\\\"\","
- + "\"Parent@odata.navigationLink\": \"People(976)/Parent\","
- + "\"Parent@odata.associationLink\": \"People(976)/Parent\""
- + "}";
-
- final ResWrap<Entity> entity =
- client.getDeserializer(ODataFormat.JSON).toEntity(IOUtils.toInputStream(fromSection45_1));
-
- assertEquals("http://host/service/$metadata#Customers/$entity", entity.getContextURL().toASCIIString());
- assertEquals("W/\"A1FF3E230954908F\"", entity.getMetadataETag());
- assertEquals("W/\"A1FF3E230954908G\"", entity.getPayload().getETag());
- assertEquals("Model.VipCustomer", entity.getPayload().getType());
- assertEquals("http://host/service/Employees(PersonID=3)", entity.getPayload().getId().toASCIIString());
- assertEquals("People(976)", entity.getPayload().getEditLink().getHref());
- assertEquals("Employees(1)/$value", entity.getPayload().getMediaContentSource().toASCIIString());
- assertEquals("image/jpeg", entity.getPayload().getMediaContentType());
- assertEquals("W/\"A1FF3E230954908H\"", entity.getPayload().getMediaETag());
- assertEquals("People(976)/Parent", entity.getPayload().getNavigationLink("Parent").getHref());
- assertEquals("People(976)/Parent", entity.getPayload().getAssociationLink("Parent").getHref());
-
- final String fromSection45_2 = "{"
- + " \"@odata.count\": 5,"
- + " \"value\": [],"
- + " \"@odata.nextLink\": \"Customers?$expand=Orders&$skipToken=5\","
- + " \"@odata.deltaLink\": \"Customers?$expand=Orders&$deltatoken=8015\""
- + "}";
-
- final ResWrap<EntityCollection> entitySet =
- client.getDeserializer(ODataFormat.JSON).toEntitySet(IOUtils.toInputStream(fromSection45_2));
-
- assertEquals(5, entitySet.getPayload().getCount(), 0);
- assertEquals("Customers?$expand=Orders&$skipToken=5", entitySet.getPayload().getNext().toASCIIString());
- assertEquals("Customers?$expand=Orders&$deltatoken=8015", entitySet.getPayload().getDeltaLink().toASCIIString());
- }
-
- /**
- * MUST be prepared to receive any annotations, including custom annotations and <tt>odata</tt> annotations not
- * defined in the <tt>OData-Version</tt> header of the payload (section 20).
- */
- @Test
- public void item5() throws Exception {
- final String sample = "{"
- + " \"@odata.context\": \"http://host/service/$metadata#Customers\","
- + " \"@odata.notdefined\": 11,"
- + " \"@com.contoso.customer.setkind\": \"VIPs\","
- + " \"value\": ["
- + " {"
- + " \"@com.contoso.display.highlight\": true,"
- + " \"ID\": \"ALFKI\","
- + " \"CompanyName@com.contoso.display.style\": { \"title\": true, \"order\": 1 },"
- + " \"CompanyName\": \"Alfreds Futterkiste\","
- + " \"Orders@com.contoso.display.style\": { \"order\": 2 },"
- + " \"Orders@odata.navigationLink\": \"People(976)/Orders\""
- + " }"
- + " ]"
- + "}";
-
- final ClientEntitySet entitySet = client.getReader().
- readEntitySet(IOUtils.toInputStream(sample), ODataFormat.JSON);
-
- assertEquals(2, entitySet.getAnnotations().size());
-
- final ClientAnnotation notdefined = entitySet.getAnnotations().get(0);
- assertEquals("odata.notdefined", notdefined.getTerm());
- assertEquals(11, notdefined.getPrimitiveValue().toCastValue(Integer.class), 0);
-
- final ClientAnnotation setkind = entitySet.getAnnotations().get(1);
- assertEquals("com.contoso.customer.setkind", setkind.getTerm());
- assertEquals("VIPs", setkind.getPrimitiveValue().toCastValue(String.class));
-
- final ClientEntity entity = entitySet.getEntities().get(0);
- assertEquals(1, entity.getAnnotations().size());
-
- final ClientAnnotation highlight = entity.getAnnotations().get(0);
- assertEquals("com.contoso.display.highlight", highlight.getTerm());
- assertEquals(Boolean.TRUE, highlight.getPrimitiveValue().toCastValue(Boolean.class));
-
- final ClientProperty property = entity.getProperty("CompanyName");
- assertEquals(1, property.getAnnotations().size());
-
- final ClientAnnotation style = property.getAnnotations().get(0);
- assertEquals("com.contoso.display.style", style.getTerm());
- assertTrue(style.hasComplexValue());
- assertEquals(Boolean.TRUE, style.getComplexValue().get("title").getPrimitiveValue().toCastValue(Boolean.class));
- assertEquals(1, style.getComplexValue().get("order").getPrimitiveValue().toCastValue(Integer.class), 0);
-
- final ClientLink orders = entity.getNavigationLink("Orders");
- assertEquals(1, orders.getAnnotations().size());
-
- final ClientAnnotation style2 = orders.getAnnotations().get(0);
- assertEquals("com.contoso.display.style", style2.getTerm());
- assertTrue(style2.hasComplexValue());
- assertEquals(2, style2.getComplexValue().get("order").getPrimitiveValue().toCastValue(Integer.class), 0);
- }
-
- /**
- * MUST NOT require <tt>odata.streaming=true</tt> in the <tt>Content-Type</tt> header (section 4.4).
- */
- @Test
- public void item6() throws EdmPrimitiveTypeException {
- final URI uri = edmClient.newURIBuilder().
- appendEntitySetSegment("Accounts").appendKeySegment(102).
- appendNavigationSegment("MyPaymentInstruments").appendKeySegment(102902).build();
- final ODataEntityRequest<ClientEntity> req = edmClient.getRetrieveRequestFactory().getEntityRequest(uri);
-
- // request format (via Accept header) does not contain odata.streaming=true
- assertEquals("application/json;odata.metadata=minimal", req.getAccept());
-
- final ODataRetrieveResponse<ClientEntity> res = req.execute();
-
- // response payload is understood
- final ClientEntity entity = res.getBody();
- assertNotNull(entity);
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument", entity.getTypeName().toString());
- assertEquals(102902, entity.getProperty("PaymentInstrumentID").getPrimitiveValue().toCastValue(Integer.class), 0);
- assertEquals("Edm.DateTimeOffset", entity.getProperty("CreatedDate").getPrimitiveValue().getTypeName());
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/KeyAsSegmentTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/KeyAsSegmentTestITCase.java
deleted file mode 100644
index f3e7d76..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/KeyAsSegmentTestITCase.java
+++ /dev/null
@@ -1,127 +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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-
-import java.net.URI;
-
-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.ODataEntityUpdateResponse;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class KeyAsSegmentTestITCase extends AbstractTestITCase {
-
- @BeforeClass
- public static void enableKeyAsSegment() {
- client.getConfiguration().setKeyAsSegment(true);
- }
-
- @AfterClass
- public static void disableKeyAsSegment() {
- client.getConfiguration().setKeyAsSegment(false);
- }
-
- private void read(final ODataFormat format) {
- final URIBuilder uriBuilder = client.newURIBuilder(testKeyAsSegmentServiceRootURL).
- appendEntitySetSegment("Accounts").appendKeySegment(101);
-
- final ODataEntityRequest<ClientEntity> req =
- client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ODataRetrieveResponse<ClientEntity> res = req.execute();
- final ClientEntity entity = res.getBody();
- assertNotNull(entity);
-
- // In JSON with minimal metadata, links are not provided
- if (format == ODataFormat.ATOM || format == ODataFormat.JSON_FULL_METADATA) {
- assertFalse(entity.getEditLink().toASCIIString().contains("("));
- assertFalse(entity.getEditLink().toASCIIString().contains(")"));
- }
- }
-
- @Test
- public void atomRead() {
- read(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonRead() {
- read(ODataFormat.JSON);
- }
-
- @Test
- public void atomCreateAndDelete() {
- createAndDeleteOrder(testKeyAsSegmentServiceRootURL, ODataFormat.ATOM, 1000);
- }
-
- @Test
- public void jsonCreateAndDelete() {
- createAndDeleteOrder(testKeyAsSegmentServiceRootURL, ODataFormat.JSON_FULL_METADATA, 1001);
- }
-
- private void update(final ODataFormat format) {
- final ClientEntity changes = getClient().getObjectFactory().newEntity(
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
- final ClientProperty middleName = getClient().getObjectFactory().newPrimitiveProperty("MiddleName",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("middle"));
- changes.getProperties().add(middleName);
-
- final URI uri = getClient().newURIBuilder(testKeyAsSegmentServiceRootURL).
- appendEntitySetSegment("People").appendKeySegment(5).build();
- final ODataEntityUpdateRequest<ClientEntity> req = getClient().getCUDRequestFactory().
- getEntityUpdateRequest(uri, UpdateType.PATCH, changes);
- req.setFormat(format);
-
- final ODataEntityUpdateResponse<ClientEntity> res = req.execute();
- assertEquals(204, res.getStatusCode());
-
- final ClientEntity updated = getClient().getRetrieveRequestFactory().getEntityRequest(uri).execute().getBody();
- assertNotNull(updated);
- assertFalse(updated.getEditLink().toASCIIString().contains("("));
- assertFalse(updated.getEditLink().toASCIIString().contains(")"));
-
- final ClientProperty updatedMiddleName = updated.getProperty("MiddleName");
- assertNotNull(updatedMiddleName);
- assertEquals("middle", updatedMiddleName.getPrimitiveValue().toString());
- }
-
- @Test
- public void atomUpdate() {
- update(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonUpdate() {
- update(ODataFormat.JSON);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.java
deleted file mode 100644
index a39e71b..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/MediaEntityTestITCase.java
+++ /dev/null
@@ -1,183 +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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.UUID;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.communication.header.HeaderName;
-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.request.retrieve.ODataMediaRequest;
-import org.apache.olingo.client.api.communication.request.streamed.MediaEntityCreateStreamManager;
-import org.apache.olingo.client.api.communication.request.streamed.MediaEntityUpdateStreamManager;
-import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest;
-import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest;
-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.ODataMediaEntityUpdateResponse;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientValuable;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class MediaEntityTestITCase extends AbstractTestITCase {
-
- private void read(final ODataClient client, final ODataFormat format) throws IOException {
- final URIBuilder builder = client.newURIBuilder(testDemoServiceRootURL).
- appendEntitySetSegment("Advertisements").
- appendKeySegment(UUID.fromString("f89dee73-af9f-4cd4-b330-db93c25ff3c7"));
- final ODataEntityRequest<ClientEntity> entityReq =
- client.getRetrieveRequestFactory().getEntityRequest(builder.build());
- entityReq.setFormat(format);
-
- final ClientEntity entity = entityReq.execute().getBody();
- assertNotNull(entity);
- assertTrue(entity.isMediaEntity());
- // cast to workaround JDK 6 bug, fixed in JDK 7
- assertEquals(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName().toString(),
- ((ClientValuable) entity.getProperty("AirDate")).getValue().getTypeName());
-
- final ODataMediaRequest streamReq = client.getRetrieveRequestFactory().
- getMediaRequest(entity.getMediaContentSource());
- final ODataRetrieveResponse<InputStream> streamRes = streamReq.execute();
- assertEquals(200, streamRes.getStatusCode());
-
- final byte[] actual = new byte[Integer.parseInt(streamRes.getHeader("Content-Length").iterator().next())];
- IOUtils.read(streamRes.getBody(), actual, 0, actual.length);
- }
-
- @Test
- public void readAsAtom() throws IOException {
- read(client, ODataFormat.ATOM);
- }
-
- @Test
- public void readAsJSON() throws IOException {
- read(ODataClientFactory.getEdmEnabledClient(testDemoServiceRootURL), ODataFormat.JSON);
- }
-
- @Test
- public void readAsJSONFull() throws IOException {
- read(client, ODataFormat.JSON_FULL_METADATA);
- }
-
- private void create(final ODataFormat format) throws IOException {
- final String random = RandomStringUtils.random(110);
- final InputStream input = IOUtils.toInputStream(random);
-
- final URI uri = client.newURIBuilder(testDemoServiceRootURL).appendEntitySetSegment("Advertisements").build();
- final ODataMediaEntityCreateRequest<ClientEntity> createReq =
- client.getCUDRequestFactory().getMediaEntityCreateRequest(uri, input);
- final MediaEntityCreateStreamManager<ClientEntity> streamManager = createReq.payloadManager();
-
- final ODataMediaEntityCreateResponse<ClientEntity> createRes = streamManager.getResponse();
- assertEquals(201, createRes.getStatusCode());
-
- final Collection<String> location = createRes.getHeader(HeaderName.location);
- assertNotNull(location);
- final URI createdLocation = URI.create(location.iterator().next());
-
- final ClientEntity changes = client.getObjectFactory().
- newEntity(new FullQualifiedName("ODataDemo.Advertisement"));
- changes.getProperties().add(client.getObjectFactory().newPrimitiveProperty("AirDate",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).build()));
-
- final ODataEntityUpdateRequest<ClientEntity> updateReq = getClient().getCUDRequestFactory().
- getEntityUpdateRequest(createdLocation, UpdateType.PATCH, changes);
- updateReq.setFormat(format);
-
- final ODataEntityUpdateResponse<ClientEntity> updateRes = updateReq.execute();
- assertEquals(204, updateRes.getStatusCode());
-
- final ODataMediaRequest retrieveReq = client.getRetrieveRequestFactory().
- getMediaEntityRequest(client.newURIBuilder(createdLocation.toASCIIString()).build());
- final ODataRetrieveResponse<InputStream> retrieveRes = retrieveReq.execute();
- assertEquals(200, retrieveRes.getStatusCode());
-
- final byte[] actual = new byte[Integer.parseInt(retrieveRes.getHeader("Content-Length").iterator().next())];
- IOUtils.read(retrieveRes.getBody(), actual, 0, actual.length);
- assertEquals(random, new String(actual));
- }
-
- @Test
- public void createAsAtom() throws IOException {
- create(ODataFormat.ATOM);
- }
-
- @Test
- public void createAsJSON() throws IOException {
- create(ODataFormat.JSON);
- }
-
- private void update(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
- final URI uri = client.newURIBuilder(testDemoServiceRootURL).
- appendEntitySetSegment("Advertisements").
- appendKeySegment(UUID.fromString("f89dee73-af9f-4cd4-b330-db93c25ff3c7")).build();
-
- final String random = RandomStringUtils.random(124);
-
- // 1. update providing media content
- final ODataMediaEntityUpdateRequest<ClientEntity> updateReq = client.getCUDRequestFactory().
- getMediaEntityUpdateRequest(uri, IOUtils.toInputStream(random));
- updateReq.setFormat(format);
-
- final MediaEntityUpdateStreamManager<ClientEntity> streamManager = updateReq.payloadManager();
- final ODataMediaEntityUpdateResponse<ClientEntity> createRes = streamManager.getResponse();
- assertEquals(204, createRes.getStatusCode());
-
- // 2. check that media content was effectively uploaded
- final ODataMediaRequest streamReq = client.getRetrieveRequestFactory().getMediaEntityRequest(uri);
- final ODataRetrieveResponse<InputStream> streamRes = streamReq.execute();
- assertEquals(200, streamRes.getStatusCode());
-
- final byte[] actual = new byte[Integer.parseInt(streamRes.getHeader("Content-Length").iterator().next())];
- IOUtils.read(streamRes.getBody(), actual, 0, actual.length);
- assertEquals(random, new String(actual));
- }
-
- @Test
- public void updateAsAtom() throws IOException, EdmPrimitiveTypeException {
- update(ODataFormat.ATOM);
- }
-
- @Test
- public void updateAsJSON() throws IOException, EdmPrimitiveTypeException {
- update(ODataFormat.JSON);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java
deleted file mode 100644
index 41c64f2..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java
+++ /dev/null
@@ -1,146 +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.fit.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 org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-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.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmSchema;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.annotation.EdmRecord;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmBoolean;
-import org.junit.Test;
-
-public class MetadataTestITCase extends AbstractTestITCase {
-
- @Test
- public void retrieve() throws EdmPrimitiveTypeException {
- final Edm edm = client.getRetrieveRequestFactory().getMetadataRequest(testStaticServiceRootURL).execute().getBody();
- assertNotNull(edm);
-
- final EdmEntityType order = edm.getEntityType(
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService", "Order"));
- assertNotNull(order);
-
- final EdmProperty orderDate = order.getStructuralProperty("OrderDate");
- assertNotNull(orderDate);
- assertEquals("Edm.DateTimeOffset", orderDate.getType().getFullQualifiedName().toString());
-
- final EdmTerm isBoss = edm.getTerm(new FullQualifiedName(edm.getSchemas().get(0).getNamespace(), "IsBoss"));
- assertNotNull(isBoss);
- assertEquals(EdmBoolean.getInstance(), isBoss.getType());
-
- final EdmEntitySet orders = edm.getSchemas().get(0).getEntityContainer().getEntitySet("Orders");
- assertNotNull(orders);
- assertFalse(orders.getAnnotations().isEmpty());
- assertTrue(orders.getAnnotations().get(0).getExpression().isDynamic());
- assertTrue(orders.getAnnotations().get(0).getExpression().asDynamic().isRecord());
- final EdmRecord record = orders.getAnnotations().get(0).getExpression().asDynamic().asRecord();
- assertNotNull(record);
- assertEquals(3, record.getPropertyValues().size());
- assertTrue(record.getPropertyValues().get(0).getValue().isConstant());
- assertTrue((Boolean) record.getPropertyValues().get(0).getValue().asConstant().getValue().asPrimitive());
- assertTrue(record.getPropertyValues().get(1).getValue().asDynamic().isCollection());
- assertEquals(1, record.getPropertyValues().get(1).getValue().asDynamic().asCollection().getItems().size());
- assertTrue(record.getPropertyValues().get(1).getValue().asDynamic().asCollection().getItems().get(0).isDynamic());
- assertEquals("OrderID", record.getPropertyValues().get(1).getValue().asDynamic().asCollection().
- getItems().get(0).asDynamic().asPropertyPath().getValue());
- }
-
- @Test
- public void include() {
- final Edm edm = client.getRetrieveRequestFactory().getMetadataRequest(testNorthwindRootURL).execute().getBody();
- assertNotNull(edm);
-
- final EdmEntityContainer container = edm.getEntityContainer(
- new FullQualifiedName("ODataWebExperimental.Northwind.Model", "NorthwindEntities"));
- assertNotNull(container);
-
- final EdmEntitySet categories = container.getEntitySet("Categories");
- assertNotNull(categories);
- assertEquals("NorthwindModel", categories.getEntityType().getNamespace());
- }
-
- @Test
- public void vocabularies() {
- final Edm edm = client.getRetrieveRequestFactory().
- getMetadataRequest(testVocabulariesServiceRootURL).execute().getBody();
- assertNotNull(edm);
-
- // 1. core
- final EdmSchema core = edm.getSchema("Org.OData.Core.V1");
- assertNotNull(core);
- final EdmSchema coreAlias = edm.getSchema("Core");
- assertEquals(core, coreAlias);
-
- final EdmTerm descriptionTerm = edm.getTerm(new FullQualifiedName("Core.Description"));
- assertNotNull(descriptionTerm);
- assertEquals(descriptionTerm.getFullQualifiedName(),
- edm.getTerm(new FullQualifiedName("Org.OData.Core.V1.Description")).getFullQualifiedName());
-
- final EdmAnnotation description = core.getAnnotation(descriptionTerm);
- assertNotNull(description);
- // assertEquals("Core terms needed to write vocabularies",
- // description.getExpression().asConstant().getValue().asPrimitive().toString());
- assertEquals("Core terms needed to write vocabularies",
- description.getExpression().asConstant().getValueAsString());
-
- final EdmTerm isLanguageDependent = edm.getTerm(new FullQualifiedName("Core.IsLanguageDependent"));
- assertNotNull(isLanguageDependent);
- assertTrue(isLanguageDependent.getAppliesTo().contains(EdmProperty.class));
- assertTrue(isLanguageDependent.getAppliesTo().contains(EdmTerm.class));
- assertEquals(edm.getTypeDefinition(new FullQualifiedName("Core.Tag")), isLanguageDependent.getType());
- assertEquals(EdmBoolean.getInstance(), ((EdmTypeDefinition) isLanguageDependent.getType()).getUnderlyingType());
- assertNotNull(isLanguageDependent.getAnnotation(descriptionTerm));
-
- final EdmTerm permissions = edm.getTerm(new FullQualifiedName("Core.Permissions"));
- assertNotNull(permissions);
- assertTrue(permissions.getType() instanceof EdmEnumType);
-
- // 2. measures
- final EdmSchema measures = edm.getSchema("UoM");
- assertNotNull(measures);
-
- final EdmTerm scale = edm.getTerm(new FullQualifiedName("UoM.Scale"));
- assertNotNull(scale);
-
- final EdmAnnotation requiresTypeInScale = edm.getAnnotation(
- scale.getFullQualifiedName(), edm.getTerm(new FullQualifiedName("Core.RequiresType")));
- assertNotNull(requiresTypeInScale);
- assertEquals("Edm.Decimal", requiresTypeInScale.getExpression().asConstant().getValueAsString());
-
- // 3. capabilities
- final EdmTerm deleteRestrictions = edm.getTerm(new FullQualifiedName("Capabilities.DeleteRestrictions"));
- assertNotNull(deleteRestrictions);
- assertEquals(deleteRestrictions.getType().getFullQualifiedName(),
- edm.getComplexType(new FullQualifiedName("Capabilities.DeleteRestrictionsType")).getFullQualifiedName());
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java
deleted file mode 100644
index 7e8c131..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/OAuth2TestITCase.java
+++ /dev/null
@@ -1,145 +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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.net.URI;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.fit.CXFOAuth2HttpClientFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class OAuth2TestITCase extends AbstractTestITCase {
-
- private static final URI OAUTH2_GRANT_SERVICE_URI =
- URI.create("http://localhost:9080/stub/StaticService/oauth2/authorize");
-
- private static final URI OAUTH2_TOKEN_SERVICE_URI =
- URI.create("http://localhost:9080/stub/StaticService/oauth2/token");
-
- private EdmEnabledODataClient _edmClient;
-
- @BeforeClass
- public static void enableOAuth2() {
- client.getConfiguration().setHttpClientFactory(
- new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI));
- }
-
- @AfterClass
- public static void disableOAuth2() {
- client.getConfiguration().setHttpClientFactory(new DefaultHttpClientFactory());
- }
-
- protected ODataClient getLocalClient() {
- ODataClient localClient = ODataClientFactory.getClient();
- localClient.getConfiguration().setHttpClientFactory(
- new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI));
- return localClient;
- }
-
- protected EdmEnabledODataClient getEdmClient() {
- if (_edmClient == null) {
- _edmClient = ODataClientFactory.getEdmEnabledClient(testOAuth2ServiceRootURL);
- _edmClient.getConfiguration().setHttpClientFactory(
- new CXFOAuth2HttpClientFactory(OAUTH2_GRANT_SERVICE_URI, OAUTH2_TOKEN_SERVICE_URI));
- }
-
- return _edmClient;
- }
-
- private void read(final ODataClient client, final ODataFormat format) {
- final URIBuilder uriBuilder =
- client.newURIBuilder(testOAuth2ServiceRootURL).appendEntitySetSegment("Orders").appendKeySegment(8);
-
- final ODataEntityRequest<ClientEntity> req =
- client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ODataRetrieveResponse<ClientEntity> res = req.execute();
- assertEquals(200, res.getStatusCode());
-
- final String etag = res.getETag();
- assertTrue(StringUtils.isNotBlank(etag));
-
- final ClientEntity order = res.getBody();
- assertEquals(etag, order.getETag());
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Order", order.getTypeName().toString());
- assertEquals("Edm.Int32", order.getProperty("OrderID").getPrimitiveValue().getTypeName());
- assertEquals("Edm.DateTimeOffset", order.getProperty("OrderDate").getPrimitiveValue().getTypeName());
- assertEquals("Edm.Duration", order.getProperty("ShelfLife").getPrimitiveValue().getTypeName());
- assertEquals("Collection(Edm.Duration)", order.getProperty("OrderShelfLifes").getCollectionValue().getTypeName());
- }
-
- @Test
- public void testOAuth() {
- try {
- readAsAtom();
- } catch (Exception e) {
- System.out.println("failed for readAsAtom");
- }
-
- try {
- readAsFullJSON();
- } catch (Exception e) {
- System.out.println("failed for readAsFullJSON");
- }
-
- try {
- readAsJSON();
- } catch (Exception e) {
- System.out.println("failed for readAsJSON");
- }
-
- try {
- createAndDelete();
- } catch (Exception e) {
- System.out.println("failed for createAndDelete");
- }
- }
-
- public void readAsAtom() {
- read(getLocalClient(), ODataFormat.ATOM);
- }
-
- public void readAsFullJSON() {
- read(getLocalClient(), ODataFormat.JSON_FULL_METADATA);
- }
-
- public void readAsJSON() {
- read(getEdmClient(), ODataFormat.JSON);
- }
-
- public void createAndDelete() {
- createAndDeleteOrder(testOAuth2ServiceRootURL, ODataFormat.JSON, 1002);
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/OpenTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/OpenTypeTestITCase.java
deleted file mode 100644
index f4fe4f8..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/OpenTypeTestITCase.java
+++ /dev/null
@@ -1,190 +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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Calendar;
-import java.util.TimeZone;
-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.domain.ClientComplexValue;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmSchema;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class OpenTypeTestITCase extends AbstractTestITCase {
-
- @Test
- public void checkOpenTypeEntityTypesExist() {
- final Edm metadata = getClient().getRetrieveRequestFactory().
- getMetadataRequest(testOpenTypeServiceRootURL).execute().getBody();
-
- final EdmSchema schema = metadata.getSchemas().get(0);
-
- assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "Row")).isOpenType());
- assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "IndexedRow")).isOpenType());
- assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "RowIndex")).isOpenType());
- }
-
- private ClientEntity readRow(final ODataFormat format, final String uuid) {
- final URIBuilder builder = getClient().newURIBuilder(testOpenTypeServiceRootURL).
- appendEntitySetSegment("Row").appendKeySegment(UUID.fromString(uuid));
- return read(format, builder.build());
- }
-
- private void read(final ODataFormat format) {
- ClientEntity row = readRow(format, "71f7d0dc-ede4-45eb-b421-555a2aa1e58f");
- assertEquals(EdmPrimitiveTypeKind.Double, row.getProperty("Double").getPrimitiveValue().getTypeKind());
- assertEquals(EdmPrimitiveTypeKind.Guid, row.getProperty("Id").getPrimitiveValue().getTypeKind());
-
- row = readRow(format, "672b8250-1e6e-4785-80cf-b94b572e42b3");
- assertEquals(EdmPrimitiveTypeKind.Decimal, row.getProperty("Decimal").getPrimitiveValue().getTypeKind());
- }
-
- @Test
- public void readAsAtom() {
- read(ODataFormat.ATOM);
- }
-
- @Test
- public void readAsJSON() {
- read(ODataFormat.JSON_FULL_METADATA);
- }
-
- private void cud(final ODataFormat format) {
- final Integer id = 1426;
-
- ClientEntity rowIndex = getClient().getObjectFactory().newEntity(
- new FullQualifiedName("Microsoft.Test.OData.Services.OpenTypesServiceV4.RowIndex"));
- getClient().getBinder().add(rowIndex,
- getClient().getObjectFactory().newPrimitiveProperty("Id",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id)));
- getClient().getBinder().add(rowIndex,
- getClient().getObjectFactory().newPrimitiveProperty("aString",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("string")));
- getClient().getBinder().add(rowIndex,
- getClient().getObjectFactory().newPrimitiveProperty("aBoolean",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildBoolean(true)));
- getClient().getBinder().add(rowIndex,
- getClient().getObjectFactory().newPrimitiveProperty("aDouble",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildDouble(1.5D)));
- getClient().getBinder().add(rowIndex,
- getClient().getObjectFactory().newPrimitiveProperty("aByte",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).
- build()));
- getClient().getBinder().add(rowIndex,
- getClient().getObjectFactory().newPrimitiveProperty("aDate",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).
- build()));
- getClient().getBinder().add(rowIndex,
- getClient().getObjectFactory().newPrimitiveProperty("aDate",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(Calendar.getInstance()).
- build()));
- getClient().getBinder().add(rowIndex,
- getClient().getObjectFactory().newEnumProperty("aColor", getClient().getObjectFactory().
- newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Blue")));
-
- final ClientComplexValue contactDetails = getClient().getObjectFactory().newComplexValue(
- "Microsoft.Test.OData.Services.OpenTypesServiceV4.ContactDetails");
- contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("FirstContacted",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildBinary("text".getBytes())));
- Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT+00:01"));
- dateTime.set(2014, 3, 5, 5, 5, 5);
- dateTime.set(Calendar.MILLISECOND, 1);
- contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("LastContacted",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build()));
- Calendar date = Calendar.getInstance();
- date.set(2001, 3, 5);
- contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("Contacted",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Date).setValue(date).build()));
- contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("GUID",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildGuid(UUID.randomUUID())));
- contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("PreferedContactTime",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Duration).setValue(0).build()));
- contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("Byte",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Byte).setValue(24).build()));
- contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("SignedByte",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).build()));
- contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("Double",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildDouble(Double.MAX_VALUE)));
- contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("Single",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildSingle(Float.MAX_VALUE)));
- contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("Short",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16(Short.MAX_VALUE)));
- contactDetails.add(getClient().getObjectFactory().newPrimitiveProperty("Int",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(Integer.MAX_VALUE)));
- getClient().getBinder().add(rowIndex,
- getClient().getObjectFactory().newComplexProperty("aContact", contactDetails));
-
- final ODataEntityCreateRequest<ClientEntity> createReq = getClient().getCUDRequestFactory().
- getEntityCreateRequest(getClient().newURIBuilder(testOpenTypeServiceRootURL).
- appendEntitySetSegment("RowIndex").build(), rowIndex);
- createReq.setFormat(format);
- final ODataEntityCreateResponse<ClientEntity> createRes = createReq.execute();
- assertEquals(201, createRes.getStatusCode());
-
- final URIBuilder builder = getClient().newURIBuilder(testOpenTypeServiceRootURL).
- appendEntitySetSegment("RowIndex").appendKeySegment(id);
- rowIndex = read(format, builder.build());
- assertNotNull(rowIndex);
- assertEquals(EdmPrimitiveTypeKind.Int32, rowIndex.getProperty("Id").getPrimitiveValue().getTypeKind());
- assertEquals(EdmPrimitiveTypeKind.String, rowIndex.getProperty("aString").getPrimitiveValue().getTypeKind());
- assertEquals(EdmPrimitiveTypeKind.Boolean, rowIndex.getProperty("aBoolean").getPrimitiveValue().getTypeKind());
- assertTrue(rowIndex.getProperty("aDouble").hasPrimitiveValue());
- assertTrue(rowIndex.getProperty("aByte").hasPrimitiveValue());
- assertTrue(rowIndex.getProperty("aDate").hasPrimitiveValue());
- assertNotNull(rowIndex.getProperty("aColor"));
- assertTrue(rowIndex.getProperty("aContact").hasComplexValue());
- assertTrue(rowIndex.getProperty("aContact").getComplexValue().get("SignedByte").hasPrimitiveValue());
-
- final ODataDeleteResponse deleteRes = getClient().getCUDRequestFactory().
- getDeleteRequest(rowIndex.getEditLink()).execute();
- assertEquals(204, deleteRes.getStatusCode());
- }
-
- @Test
- public void cudAsAtom() {
- cud(ODataFormat.ATOM);
- }
-
- @Test
- public void cudAsJSON() {
- cud(ODataFormat.JSON_FULL_METADATA);
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java
deleted file mode 100644
index 1b27efa..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java
+++ /dev/null
@@ -1,294 +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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.olingo.client.api.communication.request.invoke.ClientNoContent;
-import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
-import org.apache.olingo.client.api.domain.ClientCollectionValue;
-import org.apache.olingo.client.api.domain.ClientComplexValue;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.domain.ClientEnumValue;
-import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.domain.ClientValue;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class OperationImportInvokeTestITCase extends AbstractTestITCase {
-
- private void functionImports(final ODataFormat format) throws EdmPrimitiveTypeException {
- // GetDefaultColor
- final ODataInvokeRequest<ClientProperty> defaultColorReq = getClient().getInvokeRequestFactory().
- getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
- appendOperationCallSegment("GetDefaultColor").build(), ClientProperty.class);
- defaultColorReq.setFormat(format);
- final ClientProperty defaultColor = defaultColorReq.execute().getBody();
- assertNotNull(defaultColor);
- assertTrue(defaultColor.hasEnumValue());
- assertEquals("Red", defaultColor.getEnumValue().getValue());
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", defaultColor.getEnumValue().getTypeName());
-
- // GetPerson2
- final ClientPrimitiveValue city = getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("London");
-
- final ODataInvokeRequest<ClientEntity> person2Req = getClient().getInvokeRequestFactory().
- getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
- appendOperationCallSegment("GetPerson2").build(), ClientEntity.class,
- Collections.<String, ClientValue> singletonMap("city", city));
- person2Req.setFormat(format);
- final ClientEntity person2 = person2Req.execute().getBody();
- assertNotNull(person2);
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", person2.getTypeName().toString());
- assertEquals(1, person2.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0);
-
- // GetPerson
- final ClientComplexValue address = getClient().getObjectFactory().
- newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address");
- address.add(client.getObjectFactory().newPrimitiveProperty("Street",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("1 Microsoft Way")));
- address.add(client.getObjectFactory().newPrimitiveProperty("City",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("London")));
- address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("98052")));
-
- final ODataInvokeRequest<ClientEntity> personReq = getClient().getInvokeRequestFactory().
- getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
- appendOperationCallSegment("GetPerson").build(), ClientEntity.class,
- Collections.<String, ClientValue> singletonMap("address", address));
- personReq.setFormat(format);
- final ClientEntity person = personReq.execute().getBody();
- assertNotNull(person);
- assertEquals(person2, person);
-
- // GetAllProducts
- final ODataInvokeRequest<ClientEntitySet> productsReq = getClient().getInvokeRequestFactory()
- .getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
- appendOperationCallSegment("GetAllProducts").build(), ClientEntitySet.class);
- productsReq.setFormat(format);
- final ClientEntitySet products = productsReq.execute().getBody();
- assertNotNull(products);
- assertEquals(5, products.getEntities().size());
-
- // GetProductsByAccessLevel
- final ClientEnumValue accessLevel = getClient().getObjectFactory().
- newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "None");
-
- final ODataInvokeRequest<ClientProperty> prodByALReq = getClient().getInvokeRequestFactory().
- getFunctionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
- appendOperationCallSegment("GetProductsByAccessLevel").build(), ClientProperty.class,
- Collections.<String, ClientValue> singletonMap("accessLevel", accessLevel));
- prodByALReq.setFormat(format);
- final ClientProperty prodByAL = prodByALReq.execute().getBody();
- assertNotNull(prodByAL);
- assertTrue(prodByAL.hasCollectionValue());
- assertEquals(5, prodByAL.getCollectionValue().size());
- assertTrue(prodByAL.getCollectionValue().asJavaCollection().contains("Car"));
- }
-
- @Test
- public void atomFunctionImports() throws EdmPrimitiveTypeException {
- functionImports(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonFunctionImports() throws EdmPrimitiveTypeException {
- functionImports(ODataFormat.JSON_FULL_METADATA);
- }
-
- @Test
- public void edmEnabledFunctionImports() throws EdmPrimitiveTypeException {
- // GetDefaultColor
- final ODataInvokeRequest<ClientProperty> defaultColorReq = edmClient.getInvokeRequestFactory().
- getFunctionImportInvokeRequest("GetDefaultColor");
- final ClientProperty defaultColor = defaultColorReq.execute().getBody();
- assertNotNull(defaultColor);
- assertTrue(defaultColor.hasEnumValue());
- assertEquals("Red", defaultColor.getEnumValue().getValue());
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", defaultColor.getEnumValue().getTypeName());
-
- // GetPerson2
- final ClientPrimitiveValue city =
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("London");
- final ODataInvokeRequest<ClientEntity> person2Req = edmClient.getInvokeRequestFactory().
- getFunctionImportInvokeRequest(
- "GetPerson2", Collections.<String, ClientValue> singletonMap("city", city));
- final ClientEntity person2 = person2Req.execute().getBody();
- assertNotNull(person2);
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", person2.getTypeName().toString());
- assertEquals(1, person2.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class), 0);
-
- // GetPerson
- final ClientComplexValue address = getClient().getObjectFactory().
- newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address");
- address.add(client.getObjectFactory().newPrimitiveProperty("Street",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("1 Microsoft Way")));
- address.add(client.getObjectFactory().newPrimitiveProperty("City",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("London")));
- address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("98052")));
-
- final ODataInvokeRequest<ClientEntity> personReq = edmClient.getInvokeRequestFactory().
- getFunctionImportInvokeRequest(
- "GetPerson", Collections.<String, ClientValue> singletonMap("address", address));
- final ClientEntity person = personReq.execute().getBody();
- assertNotNull(person);
- assertEquals(person2, person);
-
- // GetAllProducts
- final ODataInvokeRequest<ClientEntitySet> productsReq = edmClient.getInvokeRequestFactory().
- getFunctionImportInvokeRequest("GetAllProducts");
- final ClientEntitySet products = productsReq.execute().getBody();
- assertNotNull(products);
- assertEquals(5, products.getEntities().size());
-
- // GetProductsByAccessLevel
- final ClientEnumValue accessLevel = getClient().getObjectFactory().
- newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.AccessLevel", "None");
-
- final ODataInvokeRequest<ClientProperty> prodByALReq = edmClient.getInvokeRequestFactory().
- getFunctionImportInvokeRequest(
- "GetProductsByAccessLevel",
- Collections.<String, ClientValue> singletonMap("accessLevel", accessLevel));
- final ClientProperty prodByAL = prodByALReq.execute().getBody();
- assertNotNull(prodByAL);
- assertTrue(prodByAL.hasCollectionValue());
- assertEquals(5, prodByAL.getCollectionValue().size());
- assertTrue(prodByAL.getCollectionValue().asJavaCollection().contains("Car"));
- }
-
- private void actionImports(final ODataFormat format) {
- // Discount
- final ClientPrimitiveValue percentage = getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(22);
- final ODataInvokeRequest<ClientNoContent> discountReq = getClient().getInvokeRequestFactory().
- getActionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
- appendOperationCallSegment("Discount").build(), ClientNoContent.class,
- Collections.<String, ClientValue> singletonMap("percentage", percentage));
- discountReq.setFormat(format);
- final ClientNoContent discount = discountReq.execute().getBody();
- assertNotNull(discount);
-
- // ResetBossAddress
- final ClientComplexValue address = getClient().getObjectFactory().
- newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address");
- address.add(client.getObjectFactory().newPrimitiveProperty("Street",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("Via Le Mani Dal Naso, 123")));
- address.add(client.getObjectFactory().newPrimitiveProperty("City",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("Tollo")));
- address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("66010")));
-
- final ODataInvokeRequest<ClientProperty> resetBossAddressReq = getClient().getInvokeRequestFactory().
- getActionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
- appendOperationCallSegment("ResetBossAddress").build(), ClientProperty.class,
- Collections.<String, ClientValue> singletonMap("address", address));
- resetBossAddressReq.setFormat(format);
- final ClientProperty resetBossAddress = resetBossAddressReq.execute().getBody();
- assertNotNull(resetBossAddress);
- assertEquals(address, resetBossAddress.getComplexValue());
- }
-
- @Test
- public void atomActionImports() {
- actionImports(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonActionImports() {
- actionImports(ODataFormat.JSON_FULL_METADATA);
- }
-
- @Test
- public void edmEnabledActionImports() {
- // Discount
- final ClientPrimitiveValue percentage = getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(22);
- final ODataInvokeRequest<ClientNoContent> discountReq = edmClient.getInvokeRequestFactory().
- getActionImportInvokeRequest(
- "Discount", Collections.<String, ClientValue> singletonMap("percentage", percentage));
- final ClientNoContent discount = discountReq.execute().getBody();
- assertNotNull(discount);
-
- // ResetBossAddress
- final ClientComplexValue address = getClient().getObjectFactory().
- newComplexValue("Microsoft.Test.OData.Services.ODataWCFService.Address");
- address.add(client.getObjectFactory().newPrimitiveProperty("Street",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("Via Le Mani Dal Naso, 123")));
- address.add(client.getObjectFactory().newPrimitiveProperty("City",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("Tollo")));
- address.add(client.getObjectFactory().newPrimitiveProperty("PostalCode",
- client.getObjectFactory().newPrimitiveValueBuilder().buildString("66010")));
-
- final ODataInvokeRequest<ClientProperty> resetBossAddressReq = edmClient.getInvokeRequestFactory().
- getActionImportInvokeRequest(
- "ResetBossAddress", Collections.<String, ClientValue> singletonMap("address", address));
- final ClientProperty resetBossAddress = resetBossAddressReq.execute().getBody();
- assertNotNull(resetBossAddress);
- assertEquals(address.getTypeName(), resetBossAddress.getComplexValue().getTypeName());
- }
-
- private void bossEmails(final ODataFormat format) {
- // ResetBossEmail
- final ClientCollectionValue<ClientValue> emails =
- getClient().getObjectFactory().newCollectionValue("Collection(Edm.String)");
- emails.add(getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("first@olingo.apache.org"));
- emails.add(getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("second@olingo.apache.org"));
- ODataInvokeRequest<ClientProperty> bossEmailsReq = getClient().getInvokeRequestFactory().
- getActionInvokeRequest(getClient().newURIBuilder(testStaticServiceRootURL).
- appendOperationCallSegment("ResetBossEmail").build(), ClientProperty.class,
- Collections.<String, ClientValue> singletonMap("emails", emails));
- bossEmailsReq.setFormat(format);
- final ClientProperty bossEmails = bossEmailsReq.execute().getBody();
- assertNotNull(bossEmails);
- assertTrue(bossEmails.hasCollectionValue());
- assertEquals(2, bossEmails.getCollectionValue().size());
-
- final Map<String, ClientValue> params = new LinkedHashMap<String, ClientValue>(2);
- params.put("start", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(0));
- params.put("count", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(100));
- bossEmailsReq = getClient().getInvokeRequestFactory().getFunctionInvokeRequest(
- getClient().newURIBuilder(testStaticServiceRootURL).
- appendOperationCallSegment("GetBossEmails").build(), ClientProperty.class, params);
- bossEmailsReq.setFormat(format);
- final ClientProperty bossEmailsViaGET = bossEmailsReq.execute().getBody();
- assertNotNull(bossEmailsViaGET);
- assertTrue(bossEmailsViaGET.hasCollectionValue());
- assertEquals(2, bossEmailsViaGET.getCollectionValue().size());
- assertEquals(bossEmails.getCollectionValue().asJavaCollection(),
- bossEmailsViaGET.getCollectionValue().asJavaCollection());
- }
-
- @Test
- public void atomBossEmails() throws EdmPrimitiveTypeException {
- bossEmails(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonBossEmails() throws EdmPrimitiveTypeException {
- bossEmails(ODataFormat.JSON_FULL_METADATA);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/PropertyTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/PropertyTestITCase.java
deleted file mode 100644
index e2c6250..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/PropertyTestITCase.java
+++ /dev/null
@@ -1,203 +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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.IOException;
-
-import org.apache.olingo.client.api.ODataClient;
-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.ODataPropertyUpdateRequest;
-import org.apache.olingo.client.api.communication.request.cud.UpdateType;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
-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.ODataPropertyUpdateResponse;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.domain.ClientValuable;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.junit.Test;
-
-public class PropertyTestITCase extends AbstractTestITCase {
-
- private void _enum(final ODataClient client, final ODataFormat format) {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Products").appendKeySegment(5).appendPropertySegment("CoverColors");
- final ODataPropertyRequest<ClientProperty> req = client.getRetrieveRequestFactory().
- getPropertyRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ClientProperty prop = req.execute().getBody();
- assertNotNull(prop);
- // cast to workaround JDK 6 bug, fixed in JDK 7
- assertEquals("Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)",
- ((ClientValuable) prop).getValue().getTypeName());
- }
-
- @Test
- public void enumFromXML() {
- _enum(client, ODataFormat.XML);
- }
-
- @Test
- public void enumFromJSON() {
- _enum(edmClient, ODataFormat.JSON);
- }
-
- @Test
- public void enumFromFullJSON() {
- _enum(client, ODataFormat.JSON_FULL_METADATA);
- }
-
- private void geospatial(final ODataClient client, final ODataFormat format) {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Home");
- final ODataPropertyRequest<ClientProperty> req = client.getRetrieveRequestFactory().
- getPropertyRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ClientProperty prop = req.execute().getBody();
- assertNotNull(prop);
- // cast to workaround JDK 6 bug, fixed in JDK 7
- assertEquals("Edm.GeographyPoint", ((ClientValuable) prop).getValue().getTypeName());
- }
-
- @Test
- public void geospatialFromXML() {
- geospatial(client, ODataFormat.XML);
- }
-
- @Test
- public void geospatialFromJSON() {
- geospatial(edmClient, ODataFormat.JSON);
- }
-
- @Test
- public void geospatialFromFullJSON() {
- geospatial(client, ODataFormat.JSON_FULL_METADATA);
- }
-
- private void complex(final ODataClient client, final ODataFormat format) {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customers").appendKeySegment(2).appendPropertySegment("HomeAddress");
- final ODataPropertyRequest<ClientProperty> req = client.getRetrieveRequestFactory().
- getPropertyRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ClientProperty prop = req.execute().getBody();
- assertNotNull(prop);
- // cast to workaround JDK 6 bug, fixed in JDK 7
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Address",
- ((ClientValuable) prop).getValue().getTypeName());
- }
-
- @Test
- public void complexFromXML() {
- complex(client, ODataFormat.XML);
- }
-
- @Test
- public void complexFromJSON() {
- complex(edmClient, ODataFormat.JSON);
- }
-
- @Test
- public void complexFromFullJSON() {
- complex(client, ODataFormat.JSON_FULL_METADATA);
- }
-
- private void updateComplexProperty(final ODataFormat format, final UpdateType type) throws IOException {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customers").appendKeySegment(1).appendPropertySegment("HomeAddress");
-
- ODataPropertyRequest<ClientProperty> retrieveReq =
- client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
- retrieveReq.setFormat(format);
-
- ODataRetrieveResponse<ClientProperty> retrieveRes = retrieveReq.execute();
- assertEquals(200, retrieveRes.getStatusCode());
-
- ClientProperty homeAddress = client.getObjectFactory().newComplexProperty("HomeAddress",
- client.getObjectFactory().newComplexValue(retrieveRes.getBody().getComplexValue().getTypeName()));
-
- homeAddress.getComplexValue().add(client.getObjectFactory().
- newPrimitiveProperty("City", client.getObjectFactory().newPrimitiveValueBuilder().buildString("Pescara")));
-
- final ODataPropertyUpdateRequest updateReq = client.getCUDRequestFactory().
- getPropertyComplexValueUpdateRequest(uriBuilder.build(), type, homeAddress);
- if (client.getConfiguration().isUseXHTTPMethod()) {
- assertEquals(HttpMethod.POST, updateReq.getMethod());
- } else {
- assertEquals(type.getMethod(), updateReq.getMethod());
- }
- updateReq.setFormat(format);
-
- final ODataPropertyUpdateResponse updateRes = updateReq.execute();
- assertEquals(204, updateRes.getStatusCode());
-
- retrieveReq = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
- retrieveReq.setFormat(format);
-
- retrieveRes = retrieveReq.execute();
- assertEquals(200, retrieveRes.getStatusCode());
-
- homeAddress = retrieveRes.getBody();
- assertEquals("Pescara", homeAddress.getComplexValue().get("City").getPrimitiveValue().toString());
- }
-
- @Test
- public void patchComplexPropertyAsJSON() throws IOException {
- updateComplexProperty(ODataFormat.JSON_FULL_METADATA, UpdateType.PATCH);
- }
-
- @Test
- public void createAndDelete() {
- // 1. create
- final ClientEntity category = client.getObjectFactory().newEntity(null);
- category.setId(client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Categories").appendKeySegment(1).build());
-
- final URIBuilder createBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Products").appendKeySegment(0).appendNavigationSegment("Categories").
- appendRefSegment();
- final ODataEntityCreateRequest<ClientEntity> createReq = client.getCUDRequestFactory().
- getEntityCreateRequest(createBuilder.build(), category);
-
- final ODataEntityCreateResponse<ClientEntity> createRes = createReq.execute();
- assertEquals(204, createRes.getStatusCode());
-
- // 2. delete
- final URIBuilder deleteBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Products").appendKeySegment(0).appendNavigationSegment("Categories").
- appendKeySegment(1).appendRefSegment();
- final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().
- getDeleteRequest(deleteBuilder.build());
-
- final ODataDeleteResponse deleteRes = deleteReq.execute();
- assertEquals(204, deleteRes.getStatusCode());
- }
-
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/PropertyValueTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/PropertyValueTestITCase.java
deleted file mode 100644
index 123c169..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/PropertyValueTestITCase.java
+++ /dev/null
@@ -1,138 +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.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-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.domain.ClientPrimitiveValue;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.domain.ClientValuable;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class PropertyValueTestITCase extends AbstractTestITCase {
-
- @Test
- public void retrieveIntPropertyValueTest() throws EdmPrimitiveTypeException {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PersonID");
- final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
- req.setFormat(ODataFormat.TEXT_PLAIN);
- assertEquals("5", req.execute().getBody().toString());
- }
-
- @Test
- public void retrieveBooleanPropertyValueTest() throws EdmPrimitiveTypeException {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("IsRegistered");
- final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
- req.setFormat(ODataFormat.TEXT_PLAIN);
- assertEquals("true", req.execute().getBody().toString());
- }
-
- @Test
- public void retrieveStringPropertyValueTest() throws EdmPrimitiveTypeException {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("FirstName");
- final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
- req.setFormat(ODataFormat.TEXT_PLAIN);
- assertEquals("Peter", req.execute().getBody().toString());
- }
-
- @Test
- public void retrieveDatePropertyValueTest() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Orders").appendKeySegment(8).appendPropertySegment("OrderDate");
- final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
- req.setFormat(ODataFormat.TEXT_PLAIN);
- final ClientPrimitiveValue property = req.execute().getBody();
- assertEquals("2011-03-04T16:03:57Z", property.toString());
- }
-
- @Test
- public void retrieveDecimalPropertyValueTest() throws EdmPrimitiveTypeException {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Height");
- final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
- req.setFormat(ODataFormat.TEXT_PLAIN);
- final ClientPrimitiveValue property = req.execute().getBody();
- assertEquals("179", property.toString());
- }
-
- @Test
- public void retrieveBinaryPropertyValueTest() throws IOException {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC");
- final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
- req.setFormat(ODataFormat.TEXT_PLAIN);
- final ClientPrimitiveValue 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.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC");
- final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
- req.setAccept(ODataFormat.ATOM.getContentType().toContentTypeString());
- req.execute().getBody();
- }
-
- @Test(expected = ODataClientErrorException.class)
- public void retrieveBinaryPropertyValueTestWithXML() throws IOException {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC");
- final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
- req.setAccept(ODataFormat.XML.getContentType().toContentTypeString());
- req.execute().getBody();
- }
-
- @Test
- public void retrieveCollectionPropertyValueTest() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Numbers");
- final ODataPropertyRequest<ClientProperty> req = client.getRetrieveRequestFactory().
- getPropertyRequest(uriBuilder.build());
- req.setFormat(ODataFormat.XML);
- final ClientProperty property = req.execute().getBody();
- // cast to workaround JDK 6 bug, fixed in JDK 7
- assertTrue(((ClientValuable) property).getValue().isCollection());
- assertEquals("555-555-5555", property.getCollectionValue().iterator().next().asPrimitive().toString());
- }
-
- @Test
- public void retrieveNullPropertyValueTest() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("HomeAddress");
- final ODataValueRequest req = client.getRetrieveRequestFactory().getPropertyValueRequest(uriBuilder.build());
- req.setFormat(ODataFormat.TEXT_PLAIN);
- final ClientPrimitiveValue property = req.execute().getBody();
- assertTrue(StringUtils.isBlank(property.toString()));
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/QueryOptionsTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/QueryOptionsTestITCase.java
deleted file mode 100644
index 19af510..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/QueryOptionsTestITCase.java
+++ /dev/null
@@ -1,246 +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.fit.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.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
-import org.apache.olingo.client.api.uri.QueryOption;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-/**
- * This is the unit test class to check for query options.
- */
-public class QueryOptionsTestITCase extends AbstractTestITCase {
-
- /**
- * Test <tt>$expand</tt>.
- */
- public void expand() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customers").appendKeySegment(1).expand("Orders");
-
- final ODataEntityRequest<ClientEntity> req =
- client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-
- final ClientEntity customer = req.execute().getBody();
- assertTrue(customer.getNavigationLink("Orders") instanceof ClientInlineEntitySet);
- }
-
- @Test
- public void expandWithFilter() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customers").appendKeySegment(1).
- expandWithOptions("Orders", Collections.<QueryOption, Object> singletonMap(
- QueryOption.FILTER, getClient().getFilterFactory().gt("OrderID", 7).build()));
-
- final ODataEntityRequest<ClientEntity> req =
- client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-
- final ClientEntity customer = req.execute().getBody();
- assertTrue(customer.getNavigationLink("Orders") instanceof ClientInlineEntitySet);
- }
-
- /**
- * Test <tt>$filter</tt> and <tt>$orderby</tt>.
- *
- * @see org.apache.olingo.fit.v4.FilterFactoryTestITCase for more tests.
- */
- @Test
- public void filterOrderby() throws EdmPrimitiveTypeException {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").filter("(PersonID lt 3)");
-
- // 1. check that filtered entity set looks as expected
- ODataEntitySetRequest<ClientEntitySet> req =
- client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
-
- ClientEntitySet feed = req.execute().getBody();
- assertNotNull(feed);
- assertEquals(2, feed.getEntities().size());
-
- // 2. extract PersonID values - sorted ASC by default
- final List<Integer> former = new ArrayList<Integer>(2);
- for (ClientEntity entity : feed.getEntities()) {
- final Integer personID = entity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class);
- assertTrue(personID < 3);
- former.add(personID);
- }
-
- // 3. add orderby clause to filter above
- req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.orderBy("PersonID desc").build());
-
- feed = req.execute().getBody();
- assertNotNull(feed);
- assertEquals(2, feed.getEntities().size());
-
- // 4. extract again VIN value - now they were required to be sorted DESC
- final List<Integer> latter = new ArrayList<Integer>(2);
- for (ClientEntity entity : feed.getEntities()) {
- final Integer personID = entity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class);
- assertTrue(personID < 3);
- latter.add(personID);
- }
-
- // 5. reverse latter and expect to be equal to former
- Collections.reverse(latter);
- assertEquals(former, latter);
- }
-
- /**
- * Test <tt>$format</tt>.
- */
- @Test
- public void format() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customers").appendKeySegment(1).format("json");
-
- final ODataEntityRequest<ClientEntity> req =
- client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(ODataFormat.ATOM);
-
- final ODataRetrieveResponse<ClientEntity> res = req.execute();
- assertNotNull(res);
- assertTrue(res.getContentType().replaceAll(" ", "").
- startsWith(ODataFormat.JSON.getContentType().toContentTypeString()));
- }
-
- /**
- * Test <tt>$skip</tt>.
- */
- public void skip() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People");
-
- // 1. check that filtered entity set looks as expected
- final ODataEntitySetRequest<ClientEntitySet> req =
- client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.skip(2).build());
-
- final ClientEntitySet feed = req.execute().getBody();
- assertEquals(3, feed.getEntities().size());
- }
-
- /**
- * Test <tt>$top</tt>.
- */
- public void top() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("People");
-
- // 1. check that filtered entity set looks as expected
- final ODataEntitySetRequest<ClientEntitySet> req = client.getRetrieveRequestFactory().
- getEntitySetRequest(uriBuilder.top(2).build());
-
- final ClientEntitySet feed = req.execute().getBody();
- assertEquals(2, feed.getEntities().size());
- }
-
- /**
- * Test <tt>$skiptoken</tt>.
- */
- @Test
- public void skiptoken() throws EdmPrimitiveTypeException {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL);
- uriBuilder.appendEntitySetSegment("People").skipToken("5");
-
- final ODataEntitySetRequest<ClientEntitySet> req =
- client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
-
- final ClientEntitySet feed = req.execute().getBody();
- assertNotNull(feed);
- assertEquals(1, feed.getEntities().size());
-
- for (ClientEntity entity : feed.getEntities()) {
- assertTrue(entity.getProperty("PersonID").getPrimitiveValue().toCastValue(Integer.class) > 5);
- }
- }
-
- /**
- * Test <tt>$inlinecount</tt>.
- */
- @Test
- public void count() {
- final URIBuilder uriBuilder =
- client.newURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").count(true);
-
- final ODataEntitySetRequest<ClientEntitySet> req =
- client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
-
- final ClientEntitySet feed = req.execute().getBody();
- assertNotNull(feed);
- assertEquals(Integer.valueOf(feed.getEntities().size()), feed.getCount());
- }
-
- /**
- * Test <tt>$select</tt>.
- */
- @Test
- public void select() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("Customers").appendKeySegment(1).select("PersonID,Orders").expand("Orders");
-
- final ODataEntityRequest<ClientEntity> req =
- client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-
- final ClientEntity customer = req.execute().getBody();
- assertEquals(1, customer.getProperties().size());
- assertEquals(1, customer.getNavigationLinks().size());
- assertTrue((customer.getNavigationLinks().get(0) instanceof ClientInlineEntitySet));
- }
-
- @Test
- public void issue253() {
- final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("relatedEntitySelect").appendEntitySetSegment("Customers").appendKeySegment(1).
- expandWithSelect("Orders", "OrderID", "OrderDetails");
-
- final ODataEntityRequest<ClientEntity> req =
- client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
-
- final ODataRetrieveResponse<ClientEntity> res = req.execute();
- assertEquals(200, res.getStatusCode());
- }
-
- @Test
- public void search() {
- final URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).
- appendEntitySetSegment("People").search(client.getSearchFactory().
- or(client.getSearchFactory().literal("Bob"), client.getSearchFactory().literal("Jill")));
-
- final ODataEntitySetRequest<ClientEntitySet> req =
- client.getRetrieveRequestFactory().getEntitySetRequest(builder.build());
-
- final ODataRetrieveResponse<ClientEntitySet> res = req.execute();
- assertEquals(200, res.getStatusCode());
- assertFalse(res.getBody().getEntities().isEmpty());
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/ServiceDocumentTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/ServiceDocumentTestITCase.java
deleted file mode 100644
index 13f7628..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/ServiceDocumentTestITCase.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.fit.v4;
-
-import static org.junit.Assert.assertEquals;
-
-import java.net.URI;
-
-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.domain.ClientServiceDocument;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class ServiceDocumentTestITCase extends AbstractTestITCase {
-
- private void retrieveServiceDocument(final ODataFormat format) {
- final ODataServiceDocumentRequest req =
- client.getRetrieveRequestFactory().getServiceDocumentRequest(testStaticServiceRootURL);
- req.setFormat(format);
-
- final ODataRetrieveResponse<ClientServiceDocument> res = req.execute();
- assertEquals(200, res.getStatusCode());
-
- final ClientServiceDocument serviceDocument = res.getBody();
- assertEquals(12, serviceDocument.getEntitySets().size());
- assertEquals(6, serviceDocument.getSingletons().size());
- assertEquals(6, serviceDocument.getFunctionImports().size());
-
- 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 retrieveServiceDocumentAsXML() {
- retrieveServiceDocument(ODataFormat.XML);
- }
-
- @Test
- public void retrieveServiceDocumentAsJSON() {
- retrieveServiceDocument(ODataFormat.JSON);
- }
-}
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java
deleted file mode 100644
index 14d9f1f..0000000
--- a/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java
+++ /dev/null
@@ -1,135 +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.fit.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.net.URI;
-
-import org.apache.olingo.client.api.ODataClient;
-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.ODataEntityUpdateResponse;
-import org.apache.olingo.client.api.domain.ClientAnnotation;
-import org.apache.olingo.client.api.domain.ClientSingleton;
-import org.apache.olingo.client.api.domain.ClientValuable;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class SingletonTestITCase extends AbstractTestITCase {
-
- private void read(final ODataClient client, final ODataFormat format) throws EdmPrimitiveTypeException {
- final URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Company");
- final ODataEntityRequest<ClientSingleton> singleton =
- client.getRetrieveRequestFactory().getSingletonRequest(builder.build());
- singleton.setFormat(format);
- final ClientSingleton company = singleton.execute().getBody();
- assertNotNull(company);
-
- assertEquals(0, company.getProperty("CompanyID").getPrimitiveValue().toCastValue(Integer.class), 0);
- // cast to workaround JDK 6 bug, fixed in JDK 7
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory",
- ((ClientValuable) company.getProperty("CompanyCategory")).getValue().getTypeName());
- assertTrue(company.getProperty("CompanyCategory").hasEnumValue());
- }
-
- @Test
- public void readFromAtom() throws EdmPrimitiveTypeException {
- read(client, ODataFormat.ATOM);
- }
-
- @Test
- public void readFromJSON() throws EdmPrimitiveTypeException {
- read(edmClient, ODataFormat.JSON);
- }
-
- @Test
- public void readfromJSONFull() throws EdmPrimitiveTypeException {
- read(client, ODataFormat.JSON_FULL_METADATA);
- }
-
- private void readWithAnnotations(final ODataClient client, final ODataFormat format)
- throws EdmPrimitiveTypeException {
-
- final URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Boss");
- final ODataEntityRequest<ClientSingleton> singleton =
- client.getRetrieveRequestFactory().getSingletonRequest(builder.build());
- singleton.setFormat(format);
- singleton.setPrefer(client.newPreferences().includeAnnotations("*"));
- final ClientSingleton boss = singleton.execute().getBody();
- assertNotNull(boss);
-
- assertFalse(boss.getAnnotations().isEmpty());
- final ClientAnnotation isBoss = boss.getAnnotations().get(0);
- assertTrue(isBoss.getPrimitiveValue().toCastValue(Boolean.class));
- }
-
- @Test
- public void readWithAnnotationsFromAtom() throws EdmPrimitiveTypeException {
- readWithAnnotations(client, ODataFormat.ATOM);
- }
-
- @Test
- public void readWithAnnotationsFromJSON() throws EdmPrimitiveTypeException {
- readWithAnnotations(edmClient, ODataFormat.JSON);
- }
-
- @Test
- public void readWithAnnotationsFromJSONFull() throws EdmPrimitiveTypeException {
- readWithAnnotations(client, ODataFormat.JSON_FULL_METADATA);
- }
-
- private void update(final ODataFormat format) throws EdmPrimitiveTypeException {
- final ClientSingleton changes = getClient().getObjectFactory().newSingleton(
- new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Company"));
- changes.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Revenue",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt64(132520L)));
-
- final URI uri = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Company").build();
- final ODataEntityUpdateRequest<ClientSingleton> req = getClient().getCUDRequestFactory().
- getSingletonUpdateRequest(uri, UpdateType.PATCH, changes);
- req.setFormat(format);
-
- final ODataEntityUpdateResponse<ClientSingleton> res = req.execute();
- assertEquals(204, res.getStatusCode());
-
- final ClientSingleton updated =
- getClient().getRetrieveRequestFactory().getSingletonRequest(uri).execute().getBody();
- assertNotNull(updated);
- assertEquals(132520, updated.getProperty("Revenue").getPrimitiveValue().toCastValue(Integer.class), 0);
- }
-
- @Test
- public void atomUpdate() throws EdmPrimitiveTypeException {
- update(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonUpdate() throws EdmPrimitiveTypeException {
- update(ODataFormat.JSON);
- }
-
-}
diff --git a/fit/src/test/resources/basicBatchPost.batch b/fit/src/test/resources/basicBatchPost.batch
new file mode 100644
index 0000000..ad5f617
--- /dev/null
+++ b/fit/src/test/resources/basicBatchPost.batch
@@ -0,0 +1,33 @@
+--batch_8194-cf13-1f56
+Content-Type: application/http
+Content-Transfer-Encoding: binary
+
+GET ESAllPrim(32767) HTTP/1.1
+Accept: application/json
+
+
+--batch_8194-cf13-1f56
+Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd
+
+--changeset_f980-1cb6-94dd
+Content-Type: application/http
+Content-Transfer-Encoding: binary
+Content-ID: changeRequest1
+
+PUT ESAllPrim(32767) HTTP/1.1
+Accept: application/json
+Content-Type: application/json
+
+{"PropertyString":"MODIFIED"}
+
+--changeset_f980-1cb6-94dd--
+
+--batch_8194-cf13-1f56
+Content-Type: application/http
+Content-Transfer-Encoding: binary
+
+GET ESAllPrim(32767)/PropertyString HTTP/1.1
+Accept: application/json
+
+
+--batch_8194-cf13-1f56--
diff --git a/lib/client-api/pom.xml b/lib/client-api/pom.xml
index 4bc7b79..74f2f06 100644
--- a/lib/client-api/pom.xml
+++ b/lib/client-api/pom.xml
@@ -41,6 +41,10 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
@@ -55,6 +59,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
+ <version>${maven.bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/Configuration.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/Configuration.java
index a027800..f9ef1cc 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/Configuration.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/Configuration.java
@@ -23,7 +23,6 @@
import org.apache.olingo.client.api.http.HttpClientFactory;
import org.apache.olingo.client.api.http.HttpUriRequestFactory;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
/**
* Configuration wrapper.
@@ -49,16 +48,15 @@
* JSON_FULL_METADATA format will be used as default.
*
* @return configured OData format for AtomPub if specified; JSON_FULL_METADATA format otherwise.
- * @see ODataFormat#JSON_FULL_METADATA
*/
- ODataFormat getDefaultPubFormat();
+ ContentType getDefaultPubFormat();
/**
* Sets the default OData format for AtomPub exchanges.
*
* @param format default format.
*/
- void setDefaultPubFormat(ODataFormat format);
+ void setDefaultPubFormat(ContentType format);
/**
* Gets the configured OData format. This value depends on what is returned from <tt>getDefaultPubFormat()</tt>.
@@ -66,23 +64,22 @@
* @return configured OData format
* @see #getDefaultPubFormat()
*/
- ODataFormat getDefaultFormat();
+ ContentType getDefaultFormat();
/**
* Gets the configured OData value format. If this configuration parameter doesn't exist the TEXT format will be used
* as default.
*
* @return configured OData value format if specified; TEXT_PLAIN format otherwise.
- * @see ODataFormat#TEXT_PLAIN
*/
- ODataFormat getDefaultValueFormat();
+ ContentType getDefaultValueFormat();
/**
* Sets the default OData value format.
*
* @param format default format.
*/
- void setDefaultValueFormat(ODataFormat format);
+ void setDefaultValueFormat(ContentType format);
/**
* Gets the configured OData media format. If this configuration parameter doesn't exist the APPLICATION_OCTET_STREAM
@@ -90,14 +87,14 @@
*
* @return configured OData media format if specified; APPLICATION_OCTET_STREAM format otherwise.
*/
- ODataFormat getDefaultMediaFormat();
+ ContentType getDefaultMediaFormat();
/**
* Sets the default OData media format.
*
* @param format default format.
*/
- void setDefaultMediaFormat(ODataFormat format);
+ void setDefaultMediaFormat(ContentType format);
/**
* Gets the HttpClient factory to be used for executing requests.
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataBatchConstants.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataBatchConstants.java
index df0c7fe..a7e5be2 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataBatchConstants.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataBatchConstants.java
@@ -21,31 +21,30 @@
/**
* Constant values related to the OData protocol.
*/
-public class ODataBatchConstants {
+public interface ODataBatchConstants {
/**
* Batch item content type.
*/
- public static final String ITEM_CONTENT_TYPE = "application/http";
+ String ITEM_CONTENT_TYPE = "application/http";
/**
* Boundary key.
*/
- public static final String BOUNDARY = "boundary";
+ String BOUNDARY = "boundary";
/**
* Item content type.
*/
- public static String ITEM_CONTENT_TYPE_LINE = "Content-Type: application/http";
+ String ITEM_CONTENT_TYPE_LINE = "Content-Type: application/http";
/**
* Item transfer encoding.
*/
- public static String ITEM_TRANSFER_ENCODING_LINE = "Content-Transfer-Encoding: binary";
+ String ITEM_TRANSFER_ENCODING_LINE = "Content-Transfer-Encoding: binary";
/**
* Content id header name.
*/
- public static String CHANGESET_CONTENT_ID_NAME = "Content-ID";
-
+ String CHANGESET_CONTENT_ID_NAME = "Content-ID";
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java
index 214ab98..842dcf6 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClient.java
@@ -25,17 +25,18 @@
import org.apache.olingo.client.api.communication.request.cud.CUDRequestFactory;
import org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory;
import org.apache.olingo.client.api.communication.request.retrieve.RetrieveRequestFactory;
+import org.apache.olingo.client.api.domain.ClientObjectFactory;
import org.apache.olingo.client.api.serialization.ClientODataDeserializer;
import org.apache.olingo.client.api.serialization.ODataBinder;
import org.apache.olingo.client.api.serialization.ODataReader;
+import org.apache.olingo.client.api.serialization.ODataSerializer;
import org.apache.olingo.client.api.serialization.ODataWriter;
import org.apache.olingo.client.api.uri.FilterFactory;
import org.apache.olingo.client.api.uri.SearchFactory;
import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.api.domain.ClientObjectFactory;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataSerializer;
+import org.apache.olingo.commons.api.format.ContentType;
+
public interface ODataClient {
@@ -47,13 +48,13 @@
ODataPreferences newPreferences();
- ODataSerializer getSerializer(ODataFormat format);
+ ODataSerializer getSerializer(ContentType contentType);
ODataWriter getWriter();
InvokeRequestFactory getInvokeRequestFactory();
- ClientODataDeserializer getDeserializer(ODataFormat format);
+ ClientODataDeserializer getDeserializer(ContentType contentType);
ODataReader getReader();
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClientBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClientBuilder.java
index bd3cbde..2b7279a 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClientBuilder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/ODataClientBuilder.java
@@ -18,12 +18,13 @@
*/
package org.apache.olingo.client.api;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.format.ODataFormat;
-
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.format.ContentType;
+
/**
* <p>
* Builder to create an ODataClient for the API client library.
@@ -99,6 +100,9 @@
}
}
+ /** Empty private constructor for static helper class */
+ private ODataClientBuilder() {}
+
/**
* Create an new ODataClient based on via system property ODATA_CLIENT_IMPL_SYS_PROPERTY
* class name or if not net the default ODATA_CLIENT_IMPL_CLASS set class.
@@ -142,7 +146,7 @@
loadClass(EdmEnabledODataClient.class, clientImplClassName,
new Class[] { String.class, Edm.class, String.class },
new Object[] { serviceRoot, edm, metadataETag });
- instance.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
+ instance.getConfiguration().setDefaultPubFormat(ContentType.JSON);
return instance;
}
@@ -161,15 +165,19 @@
Constructor<?> ctor = clazz.getConstructor(ctorParameterClasses);
return typeOfClass.cast(ctor.newInstance(ctorParameters));
} catch (ClassNotFoundException e) {
- throw new RuntimeException("Requested class '" + className + "' could not be loaded.", e);
+ throw wrapException(className, e);
} catch (InstantiationException e) {
- throw new RuntimeException("Requested class '" + className + "' could not be loaded.", e);
+ throw wrapException(className, e);
} catch (IllegalAccessException e) {
- throw new RuntimeException("Requested class '" + className + "' could not be loaded.", e);
+ throw wrapException(className, e);
} catch (NoSuchMethodException e) {
- throw new RuntimeException("Requested class '" + className + "' could not be loaded.", e);
+ throw wrapException(className, e);
} catch (InvocationTargetException e) {
- throw new RuntimeException("Requested class '" + className + "' could not be loaded.", e);
+ throw wrapException(className, e);
}
}
+
+ private static ODataRuntimeException wrapException(String className, Exception e) {
+ return new ODataRuntimeException("Requested class '" + className + "' could not be loaded.", e);
+ }
}
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 64faf35..eaedc88 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,10 +18,10 @@
*/
package org.apache.olingo.client.api.communication;
-import org.apache.commons.lang3.StringUtils;
import org.apache.http.StatusLine;
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.commons.api.ODataError;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataError;
/**
* Represents a client error in OData.
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataServerErrorException.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataServerErrorException.java
index a3d2185..932e3cb 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataServerErrorException.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataServerErrorException.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.api.communication;
import org.apache.http.StatusLine;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
/**
* Represents a server error in OData.
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
deleted file mode 100644
index 646a8e8..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/HeaderName.java
+++ /dev/null
@@ -1,194 +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.api.communication.header;
-
-
-/**
- * Major OData request/response header names.
- */
-public enum HeaderName {
-
- /**
- * The OData protocol uses the Accept request-header field, as specified in [RFC2616].
- */
- accept("Accept"),
- /**
- * As specified in [RFC2616], the client MAY specify the set of accepted character sets with the Accept-Charset
- * header.
- */
- acceptCharset("Accept-Charset"),
- /**
- * As specified in [RFC2616], the client MAY specify the set of accepted natural languages with the Accept-Language
- * header.
- */
- acceptLanguage("Accept-Language"),
- /**
- * The Content-Type header is used as specified in [RFC2616].
- * <br/>
- * OData request/response supports the following types:
- * <ul>
- * <li>application/atom+xml</li>
- * <li>application/atom+xml;type=entry</li>
- * <li>application/atom+xml;type=feed</li>
- * <li>application/json; odata.metadata=full</li>
- * <li>application/json; odata.metadata=minimal</li>
- * <li>application/json; odata.metadata=none</li>
- * <li>application/json</li>
- * <li>application/xml</li>
- * <li>text/plain</li>
- * <li>text/xml</li>
- * <li>octet/stream</li>
- * <li>multipart/mixed</li>
- * </ul>
- */
- contentType("Content-Type"),
-
- /**
- * 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"),
- /**
- * 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"),
- /**
- * 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"),
- /**
- * 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"),
- /**
- * 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"),
- /**
- * 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"),
-
- /**
- * 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"),
- /**
- * 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.
- */
- prefer("Prefer"),
- /**
- * 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"),
-
- /**
- * 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"),
- /**
- * A service must include a
- * <code>Retry-After</code> header in a
- * <code>202 Accepted</code>.
- */
- retryAfter("Retry-After"),
-
- /**
- * This header is a custom HTTP request header.
- * <br/>
- * It is possible to instruct network intermediaries (proxies, firewalls, and so on) inspecting traffic at the
- * application protocol layer (for example, HTTP) to block requests that contain certain HTTP verbs. In practice, GET
- * and POST verbs are rarely blocked (traditional web pages rely heavily on these HTTP methods), while, for a variety
- * of reasons (such as security vulnerabilities in prior protocols), other HTTP methods (PUT, DELETE, and so on) are
- * at times blocked by intermediaries. Additionally, some existing HTTP libraries do not allow creation of requests
- * using verbs other than GET or POST. Therefore, an alternative way of specifying request types which use verbs other
- * than GET and POST is needed to ensure that this document works well in a wide range of environments.
- * <br/>
- * To address this need, the X-HTTP-Method header can be added to a POST request that signals that the server MUST
- * process the request not as a POST, but as if the HTTP verb specified as the value of the header was used as the
- * method on the HTTP request's request line, as specified in [RFC2616] section 5.1. This technique is often referred
- * to as "verb tunneling".
- * <br/>
- * This header is only valid when on POST requests.
- */
- xHttpMethod("X-HTTP-METHOD"),
-
- //TODO: Delete
- dataServiceUrlConventions("DataServiceUrlConventions");
-
- private final String headerName;
-
- private HeaderName(final String headerName) {
- this.headerName = headerName;
- }
-
- @Override
- public String toString() {
- return headerName;
- }
-}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/ODataHeaders.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/ODataHeaders.java
index 484d9a6..fb515d2 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/ODataHeaders.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/header/ODataHeaders.java
@@ -36,16 +36,6 @@
* @param name name of the header to be retrieved.
* @return header value.
*/
- String getHeader(final HeaderName name);
-
- /**
- * Gets the value of the header identified by the given name.
- * <br/>
- * Please note that header name is case-insensitive.
- *
- * @param name name of the header to be retrieved.
- * @return header value.
- */
String getHeader(final String name);
/**
@@ -67,15 +57,6 @@
ODataHeaders setHeader(String name, String value);
/**
- * Add the specified header.
- *
- * @param name header key.
- * @param value header value.
- * @return the current updated header instance.
- */
- ODataHeaders setHeader(HeaderName name, String value);
-
- /**
* Removes the header identified by the given name.
* <br/>
* Please note that header name is case-insensitive.
@@ -83,8 +64,6 @@
* @param name name of the header to be retrieved.
* @return header name (if found).
*/
- String removeHeader(HeaderName name);
-
String removeHeader(String name);
}
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
index e3e4a22..45d8ddc 100644
--- 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
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.api.communication.header;
+import org.apache.olingo.commons.api.format.PreferenceName;
/**
* Values of the Prefer header.
@@ -27,26 +28,28 @@
/**
* <code>Prefer</code> header, return content.
*
- * @see HeaderName#prefer
+ * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER
*/
public String returnContent() {
- return PreferenceNames.returnContent.toString();
+ return PreferenceName.RETURN.getName();
}
/**
* <code>Prefer</code> header, return no content.
*
- * @see HeaderName#prefer
+ * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER
*/
public String returnNoContent() {
- return PreferenceNames.returnNoContent.toString();
+ return PreferenceName.RETURN_NO_CONTENT.getName();
}
/**
- * @see HeaderName#dataServiceUrlConventions
+ * Gets the value of the non-standard preference that the URL should follow the convention
+ * that keys are formatted as separate segments.
+ * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER
*/
public String keyAsSegment() {
- return PreferenceNames.keyAsSegment.toString();
+ return PreferenceName.KEY_AS_SEGMENT.getName();
}
/**
@@ -63,11 +66,11 @@
* <br/><br/>
* Supported by OData version 4.0 only.
*
- * @see HeaderName#prefer
+ * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER
* @return preference.
*/
public String allowEntityReferences() {
- return PreferenceNames.allowEntityReferences.toString();
+ return PreferenceName.ALLOW_ENTITY_REFERENCES.getName();
}
/**
@@ -126,11 +129,11 @@
* <br/><br/>
* Supported by OData version 4.0 only.
*
- * @see HeaderName#prefer
+ * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER
* @return preference.
*/
public String callback(final String url) {
- return PreferenceNames.callback.toString() + ";url=\"" + url + "\"";
+ return PreferenceName.CALLBACK.getName() + ";url=\"" + url + "\"";
}
/**
@@ -147,11 +150,11 @@
* <br/><br/>
* Supported by OData version 4.0 only.
*
- * @see HeaderName#prefer
+ * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER
* @return preference.
*/
public String continueOnError() {
- return PreferenceNames.continueOnError.toString();
+ return PreferenceName.CONTINUE_ON_ERROR.getName();
}
/**
@@ -194,11 +197,11 @@
* <br/><br/>
* Supported by OData version 4.0 only.
*
- * @see HeaderName#prefer
+ * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER
* @return preference.
*/
public String includeAnnotations(final String value) {
- return PreferenceNames.includeAnnotations.toString() + "=" + value;
+ return PreferenceName.INCLUDE_ANNOTATIONS.getName() + "=" + value;
}
/**
@@ -227,11 +230,11 @@
* <br/><br/>
* Supported by OData version 4.0 only.
*
- * @see HeaderName#prefer
+ * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER
* @return preference.
*/
public String maxPageSize(final int size) {
- return PreferenceNames.maxPageSize.toString() + "=" + size;
+ return PreferenceName.MAX_PAGE_SIZE.getName() + "=" + size;
}
/**
@@ -252,11 +255,11 @@
* <br/><br/>
* Supported by OData version 4.0 only.
*
- * @see HeaderName#prefer
+ * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER
* @return preference.
*/
public String trackChanges() {
- return PreferenceNames.trackChanges.toString();
+ return PreferenceName.TRACK_CHANGES.getName();
}
/**
@@ -287,11 +290,11 @@
* <br/><br/>
* Supported by OData version 4.0 only.
*
- * @see HeaderName#prefer
+ * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER
* @return preference.
*/
public String respondAsync() {
- return PreferenceNames.respondAsync.toString();
+ return PreferenceName.RESPOND_ASYNC.getName();
}
/**
@@ -307,11 +310,11 @@
* <br/><br/>
* Supported by OData version 4.0 only.
*
- * @see HeaderName#prefer
+ * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER
* @return preference.
*/
public String wait(final int value) {
- return PreferenceNames.wait.toString() + "=" + value;
+ return PreferenceName.WAIT.getName() + "=" + value;
}
/**
@@ -337,11 +340,11 @@
* <br/><br/>
* Supported by OData version 4.0 only.
*
- * @see HeaderName#prefer
+ * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER
* @return preference.
*/
public String returnMinimal() {
- return PreferenceNames.odataReturn.toString() + "=minimal";
+ return PreferenceName.RETURN.getName() + "=minimal";
}
/**
@@ -367,37 +370,10 @@
* <br/><br/>
* Supported by OData version 4.0 only.
*
- * @see HeaderName#prefer
+ * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER
* @return preference.
*/
public String returnRepresentation() {
- return PreferenceNames.odataReturn.toString() + "=representation";
- }
-
- private static enum PreferenceNames {
-
- returnContent("return-content"),
- returnNoContent("return-no-content"),
- keyAsSegment("KeyAsSegment"),
- allowEntityReferences("odata.allow-entityreferences"),
- callback("odata.callback"),
- continueOnError("odata.continue-on-error"),
- includeAnnotations("odata.include-annotations"),
- maxPageSize("odata.maxpagesize"),
- trackChanges("odata.track-changes"),
- respondAsync("respond-async"),
- wait("wait"),
- odataReturn("return");
-
- private final String preferenceName;
-
- private PreferenceNames(final String preferenceName) {
- this.preferenceName = preferenceName;
- }
-
- @Override
- public String toString() {
- return preferenceName;
- }
+ return PreferenceName.RETURN.getName() + "=representation";
}
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBasicRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBasicRequest.java
index 6bcb3b8..c977a0b 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBasicRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataBasicRequest.java
@@ -21,7 +21,7 @@
import java.util.concurrent.Future;
import org.apache.olingo.client.api.communication.response.ODataResponse;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
/**
* Basic OData request.
@@ -45,9 +45,9 @@
Future<T> asyncExecute();
/**
- * Override configured request format.
+ * Override configured request Content-Type.
*
- * @param format request format.
+ * @param contentType request Content-Type.
*/
- void setFormat(ODataFormat format);
+ void setFormat(ContentType contentType);
}
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 55831b7..ffc70b7 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
@@ -22,7 +22,6 @@
import java.net.URI;
import java.util.Collection;
-import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.commons.api.http.HttpMethod;
/**
@@ -75,7 +74,7 @@
*
* @param value header value.
* @return current object
- * @see org.apache.olingo.client.api.communication.header.HeaderName#accept
+ * @see org.apache.olingo.commons.api.http.HttpHeader#ACCEPT
*/
ODataRequest setAccept(final String value);
@@ -83,7 +82,7 @@
* Gets <tt>Accept</tt> OData request header.
*
* @return header value.
- * @see org.apache.olingo.client.api.communication.header.HeaderName#accept
+ * @see org.apache.olingo.commons.api.http.HttpHeader#ACCEPT
*/
String getAccept();
@@ -92,7 +91,7 @@
*
* @param value header value.
* @return current object
- * @see org.apache.olingo.client.api.communication.header.HeaderName#ifMatch
+ * @see org.apache.olingo.commons.api.http.HttpHeader#IF_MATCH
*/
ODataRequest setIfMatch(final String value);
@@ -100,7 +99,7 @@
* Gets <tt>If-Match</tt> OData request header.
*
* @return header value.
- * @see org.apache.olingo.client.api.communication.header.HeaderName#ifMatch
+ * @see org.apache.olingo.commons.api.http.HttpHeader#IF_MATCH
*/
String getIfMatch();
@@ -109,7 +108,7 @@
*
* @param value header value.
* @return current object
- * @see org.apache.olingo.client.api.communication.header.HeaderName#ifNoneMatch
+ * @see org.apache.olingo.commons.api.http.HttpHeader#IF_NONE_MATCH
*/
ODataRequest setIfNoneMatch(final String value);
@@ -117,7 +116,7 @@
* Gets <tt>If-None-Match</tt> OData request header.
*
* @return header value.
- * @see org.apache.olingo.client.api.communication.header.HeaderName#ifNoneMatch
+ * @see org.apache.olingo.commons.api.http.HttpHeader#IF_NONE_MATCH
*/
String getIfNoneMatch();
@@ -126,7 +125,7 @@
*
* @param value header value.
* @return current object
- * @see org.apache.olingo.client.api.communication.header.HeaderName#prefer
+ * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER
*/
ODataRequest setPrefer(final String value);
@@ -134,7 +133,7 @@
* Gets <tt>Prefer</tt> OData request header.
*
* @return header value.
- * @see org.apache.olingo.client.api.communication.header.HeaderName#prefer
+ * @see org.apache.olingo.commons.api.http.HttpHeader#PREFER
*/
String getPrefer();
@@ -143,7 +142,7 @@
*
* @param value header value.
* @return current object
- * @see org.apache.olingo.client.api.communication.header.HeaderName#contentType
+ * @see org.apache.olingo.commons.api.http.HttpHeader#CONTENT_TYPE
*/
ODataRequest setContentType(final String value);
@@ -151,7 +150,7 @@
* Gets <tt>contentType</tt> OData request header.
*
* @return header value.
- * @see org.apache.olingo.client.api.communication.header.HeaderName#contentType
+ * @see org.apache.olingo.commons.api.http.HttpHeader#CONTENT_TYPE
*/
String getContentType();
@@ -160,7 +159,7 @@
*
* @param value header value.
* @return current object
- * @see org.apache.olingo.client.api.communication.header.HeaderName#xHttpMethod
+ * @see org.apache.olingo.commons.api.http.HttpHeader#X_HTTP_METHOD
*/
ODataRequest setXHTTPMethod(final String value);
@@ -174,16 +173,6 @@
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.
*
* @return full request header.
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/EdmEnabledInvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/EdmEnabledInvokeRequestFactory.java
index 5293f7d..72ace12 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/EdmEnabledInvokeRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/EdmEnabledInvokeRequestFactory.java
@@ -30,63 +30,63 @@
/**
* Gets an invoke request instance for the function import with the given name and no parameters.
*
- * @param <RES> OData domain object result, derived from return type defined in the function import
+ * @param <T> OData domain object result, derived from return type defined in the function import
* @param functionImportName operation to be invoked
* @return new {@link ODataInvokeRequest} instance.
*/
- <RES extends ClientInvokeResult> ODataInvokeRequest<RES> getFunctionImportInvokeRequest(
+ <T extends ClientInvokeResult> ODataInvokeRequest<T> getFunctionImportInvokeRequest(
String functionImportName);
/**
* Gets an invoke request instance for the function import with the given name and matching parameter names.
*
- * @param <RES> OData domain object result, derived from return type defined in the function import
+ * @param <T> OData domain object result, derived from return type defined in the function import
* @param functionImportName operation to be invoked
* @param parameters parameters to pass to operation import invocation
* @return new {@link ODataInvokeRequest} instance.
*/
- <RES extends ClientInvokeResult> ODataInvokeRequest<RES> getFunctionImportInvokeRequest(
+ <T extends ClientInvokeResult> ODataInvokeRequest<T> getFunctionImportInvokeRequest(
String functionImportName, Map<String, ClientValue> parameters);
/**
* Gets an invoke request instance for the action import with the given name.
*
- * @param <RES> OData domain object result, derived from return type defined in the action import
+ * @param <T> OData domain object result, derived from return type defined in the action import
* @param actionImportName operation to be invoked
* @return new {@link ODataInvokeRequest} instance.
*/
- <RES extends ClientInvokeResult> ODataInvokeRequest<RES> getActionImportInvokeRequest(
+ <T extends ClientInvokeResult> ODataInvokeRequest<T> getActionImportInvokeRequest(
String actionImportName);
/**
* Gets an invoke request instance for the action import with the given name.
*
- * @param <RES> OData domain object result, derived from return type defined in the action import
+ * @param <T> OData domain object result, derived from return type defined in the action import
* @param actionImportName operation to be invoked
* @param parameters parameters to pass to operation import invocation
* @return new {@link ODataInvokeRequest} instance.
*/
- <RES extends ClientInvokeResult> ODataInvokeRequest<RES> getActionImportInvokeRequest(
+ <T extends ClientInvokeResult> ODataInvokeRequest<T> getActionImportInvokeRequest(
String actionImportName, Map<String, ClientValue> parameters);
/**
* Gets an invoke request instance for the function bound to given URI (no parameters).
*
- * @param <RES> OData domain object result
+ * @param <T> OData domain object result
* @param bindingParameterURI binding parameter URI
* @param functionName operation to be invoked
* @param bindingParameterTypeName binding parameter type full qualified name
* @param isBindingParameterCollection whether binding parameter is collection
* @return new {@link ODataInvokeRequest} instance.
*/
- <RES extends ClientInvokeResult> ODataInvokeRequest<RES> getBoundFunctionInvokeRequest(
+ <T extends ClientInvokeResult> ODataInvokeRequest<T> getBoundFunctionInvokeRequest(
URI bindingParameterURI, FullQualifiedName functionName, FullQualifiedName bindingParameterTypeName,
Boolean isBindingParameterCollection);
/**
* Gets an invoke request instance for the function bound to given URI (with parameters).
*
- * @param <RES> OData domain object result
+ * @param <T> OData domain object result
* @param bindingParameterURI binding parameter URI
* @param functionName operation to be invoked
* @param bindingParameterTypeName binding parameter type full qualified name
@@ -94,28 +94,28 @@
* @param parameters parameters to pass to function invocation
* @return new {@link ODataInvokeRequest} instance.
*/
- <RES extends ClientInvokeResult> ODataInvokeRequest<RES> getBoundFunctionInvokeRequest(
+ <T extends ClientInvokeResult> ODataInvokeRequest<T> getBoundFunctionInvokeRequest(
URI bindingParameterURI, FullQualifiedName functionName, FullQualifiedName bindingParameterTypeName,
Boolean isBindingParameterCollection, Map<String, ClientValue> parameters);
/**
* Gets an invoke request instance for the action bound to given URI (no parameters).
*
- * @param <RES> OData domain object result
+ * @param <T> OData domain object result
* @param bindingParameterURI binding parameter URI
* @param actionName operation to be invoked
* @param bindingParameterTypeName binding parameter type full qualified name
* @param isBindingParameterCollection whether binding parameter is collection
* @return new {@link ODataInvokeRequest} instance.
*/
- <RES extends ClientInvokeResult> ODataInvokeRequest<RES> getBoundActionInvokeRequest(
+ <T extends ClientInvokeResult> ODataInvokeRequest<T> getBoundActionInvokeRequest(
URI bindingParameterURI, FullQualifiedName actionName, FullQualifiedName bindingParameterTypeName,
Boolean isBindingParameterCollection);
/**
* Gets an invoke request instance for the action bound to given URI (with parameters).
*
- * @param <RES> OData domain object result
+ * @param <T> OData domain object result
* @param bindingParameterURI binding parameter URI
* @param actionName operation to be invoked
* @param bindingParameterTypeName binding parameter type full qualified name
@@ -123,7 +123,7 @@
* @param parameters parameters to pass to function invocation
* @return new {@link ODataInvokeRequest} instance.
*/
- <RES extends ClientInvokeResult> ODataInvokeRequest<RES> getBoundActionInvokeRequest(
+ <T extends ClientInvokeResult> ODataInvokeRequest<T> getBoundActionInvokeRequest(
URI bindingParameterURI, FullQualifiedName actionName, FullQualifiedName bindingParameterTypeName,
Boolean isBindingParameterCollection, Map<String, ClientValue> parameters);
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/InvokeRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/InvokeRequestFactory.java
index 7a3f301..21388ea 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/InvokeRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/invoke/InvokeRequestFactory.java
@@ -36,57 +36,57 @@
* This method is mainly meant for internal usage, but defined for generic calls from proxy; normally, one of other
* methods should be used instead.
*
- * @param <RES> OData domain object result
+ * @param <T> OData domain object result
* @param method HTTP invocation method
* @param uri invocation URI
* @param resultRef reference Class for result
* @param parameters parameters to pass to function invocation
* @return new {@link ODataInvokeRequest} instance.
*/
- <RES extends ClientInvokeResult> ODataInvokeRequest<RES> getInvokeRequest(
- HttpMethod method, URI uri, Class<RES> resultRef, Map<String, ClientValue> parameters);
+ <T extends ClientInvokeResult> ODataInvokeRequest<T> getInvokeRequest(
+ HttpMethod method, URI uri, Class<T> resultRef, Map<String, ClientValue> parameters);
/**
* Gets an invoke request instance for the function bound to given URI (no parameters).
*
- * @param <RES> OData domain object result
+ * @param <T> OData domain object result
* @param uri invocation URI
* @param resultRef reference Class for result
* @return new {@link ODataInvokeRequest} instance.
*/
- <RES extends ClientInvokeResult> ODataInvokeRequest<RES> getFunctionInvokeRequest(URI uri, Class<RES> resultRef);
+ <T extends ClientInvokeResult> ODataInvokeRequest<T> getFunctionInvokeRequest(URI uri, Class<T> resultRef);
/**
* Gets an invoke request instance for the function bound to given URI (with parameters).
*
- * @param <RES> OData domain object result
+ * @param <T> OData domain object result
* @param uri invocation URI
* @param resultRef reference Class for result
* @param parameters parameters to pass to function invocation
* @return new {@link ODataInvokeRequest} instance.
*/
- <RES extends ClientInvokeResult> ODataInvokeRequest<RES> getFunctionInvokeRequest(
- URI uri, Class<RES> resultRef, Map<String, ClientValue> parameters);
+ <T extends ClientInvokeResult> ODataInvokeRequest<T> getFunctionInvokeRequest(
+ URI uri, Class<T> resultRef, Map<String, ClientValue> parameters);
/**
* Gets an invoke request instance for the action bound to given URI (no parameters).
*
- * @param <RES> OData domain object result
+ * @param <T> OData domain object result
* @param uri invocation URI
* @param resultRef reference Class for result
* @return new {@link ODataInvokeRequest} instance.
*/
- <RES extends ClientInvokeResult> ODataInvokeRequest<RES> getActionInvokeRequest(URI uri, Class<RES> resultRef);
+ <T extends ClientInvokeResult> ODataInvokeRequest<T> getActionInvokeRequest(URI uri, Class<T> resultRef);
/**
* Gets an invoke request instance for the action bound to given URI (with parameters).
*
- * @param <RES> OData domain object result
+ * @param <T> OData domain object result
* @param uri invocation URI
* @param resultRef reference Class for result
* @param parameters parameters to pass to action invocation
* @return new {@link ODataInvokeRequest} instance.
*/
- <RES extends ClientInvokeResult> ODataInvokeRequest<RES> getActionInvokeRequest(
- URI uri, Class<RES> resultRef, Map<String, ClientValue> parameters);
+ <T extends ClientInvokeResult> ODataInvokeRequest<T> getActionInvokeRequest(
+ URI uri, Class<T> resultRef, Map<String, ClientValue> parameters);
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataStreamedEntityRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataStreamedEntityRequest.java
index a34e41c..0221285 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataStreamedEntityRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/streamed/ODataStreamedEntityRequest.java
@@ -21,7 +21,7 @@
import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
import org.apache.olingo.client.api.communication.response.ODataResponse;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
/**
* Abstract class representing a request concerning a streamed entity.
@@ -38,13 +38,12 @@
* @return the configured format (or default if not specified).
* @see org.apache.olingo.client.api.Configuration#getDefaultPubFormat()
*/
- ODataFormat getFormat();
+ ContentType getFormat();
/**
* Override configured request format.
*
* @param format request format.
- * @see ODataFormat
*/
- void setFormat(final ODataFormat format);
+ void setFormat(final ContentType contentType);
}
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 f2e0765..2bbee88 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
@@ -23,7 +23,6 @@
import java.util.Map;
import org.apache.http.HttpResponse;
-import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchLineIterator;
/**
@@ -47,14 +46,6 @@
Collection<String> getHeader(final String name);
/**
- * Gets header value of the given header.
- *
- * @param name header to be retrieved.
- * @return response header value.
- */
- Collection<String> getHeader(final HeaderName name);
-
- /**
* Gets 'ETag' header value.
*
* @return ETag header value, if provided
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 47cbf67..5b6ed0d 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
@@ -18,15 +18,13 @@
*/
package org.apache.olingo.client.api.data;
-import org.apache.olingo.client.api.domain.ClientServiceDocument;
-
import java.net.URI;
import java.util.List;
/**
* REST resource for an <tt>ODataServiceDocument</tt>.
*
- * @see ClientServiceDocument
+ * @see org.apache.olingo.client.api.domain.ClientServiceDocument
*/
public interface ServiceDocument {
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractClientPayload.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractClientPayload.java
index 994bea4..471e53c 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractClientPayload.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractClientPayload.java
@@ -47,4 +47,39 @@
public void setContextURL(final URI contextURL) {
this.contextURL = contextURL;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((contextURL == null) ? 0 : contextURL.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof AbstractClientPayload)) {
+ return false;
+ }
+ AbstractClientPayload other = (AbstractClientPayload) obj;
+ if (contextURL == null) {
+ if (other.contextURL != null) {
+ return false;
+ }
+ } else if (!contextURL.equals(other.contextURL)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "AbstractClientPayload [contextURL=" + contextURL + "super[" + super.toString() + "]]";
+ }
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractClientValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractClientValue.java
index dca1904..16d54cc 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractClientValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/AbstractClientValue.java
@@ -18,11 +18,6 @@
*/
package org.apache.olingo.client.api.domain;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
/**
* Abstract representation of an OData entity property value.
*/
@@ -103,18 +98,40 @@
return isCollection() ? (ClientCollectionValue<OV>) this : null;
}
+
+
@Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof AbstractClientValue)) {
+ return false;
+ }
+ AbstractClientValue other = (AbstractClientValue) obj;
+ if (typeName == null) {
+ if (other.typeName != null) {
+ return false;
+ }
+ } else if (!typeName.equals(other.typeName)) {
+ return false;
+ }
+ return true;
}
@Override
public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((typeName == null) ? 0 : typeName.hashCode());
+ return result;
}
@Override
public String toString() {
- return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ return "AbstractClientValue [typeName=" + typeName + "]";
}
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientCollectionValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientCollectionValue.java
index 8a0078e..d5c6c9f 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientCollectionValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientCollectionValue.java
@@ -23,16 +23,16 @@
/**
* OData collection property value.
*
- * @param <OV> The actual ODataValue interface.
+ * @param <T> The actual ODataValue interface.
*/
-public interface ClientCollectionValue<OV extends ClientValue> extends ClientValue, Iterable<OV> {
+public interface ClientCollectionValue<T extends ClientValue> extends ClientValue, Iterable<T> {
/**
* Adds a value to the collection.
*
* @param value value to be added.
*/
- ClientCollectionValue<OV> add(ClientValue value);
+ ClientCollectionValue<T> add(ClientValue value);
/**
* Checks if collection is empty.
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientEntitySetIterator.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientEntitySetIterator.java
index accfce6..64247c2 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientEntitySetIterator.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientEntitySetIterator.java
@@ -30,11 +30,11 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.format.ContentType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,9 +44,9 @@
* <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
+ * @param <T> concrete ODataEntitySet implementation
*/
-public class ClientEntitySetIterator<ES extends ClientEntitySet, E extends ClientEntity>
+public class ClientEntitySetIterator<T extends ClientEntitySet, E extends ClientEntity>
implements Iterator<E> {
/**
@@ -60,9 +60,9 @@
private final InputStream stream;
- private final ODataFormat format;
+ private final ContentType contentType;
- private ES entitySet;
+ private T entitySet;
private final ByteArrayOutputStream osEntitySet;
@@ -75,17 +75,18 @@
*
* @param odataClient client instance getting this request
* @param stream source stream.
- * @param format OData format.
+ * @param contentType OData format.
*/
public ClientEntitySetIterator(final ODataClient odataClient, final InputStream stream,
- final ODataFormat format) {
+ final ContentType contentType) {
this.odataClient = odataClient;
this.stream = stream;
- this.format = format;
+ this.contentType = contentType;
this.osEntitySet = new ByteArrayOutputStream();
-
- if (format == ODataFormat.ATOM) {
+
+ if(contentType.isCompatible(ContentType.APPLICATION_ATOM_SVC)
+ || contentType.isCompatible(ContentType.APPLICATION_ATOM_XML)) {
namespaces = getAllElementAttributes(stream, "feed", osEntitySet);
} else {
namespaces = null;
@@ -103,14 +104,12 @@
}
}
- /**
- * {@inheritDoc }
- */
- @Override
@SuppressWarnings("unchecked")
+ @Override
public boolean hasNext() {
if (available && cached == null) {
- if (format == ODataFormat.ATOM) {
+ if (contentType.isCompatible(ContentType.APPLICATION_ATOM_SVC)
+ || contentType.isCompatible(ContentType.APPLICATION_ATOM_XML)) {
cached = nextAtomEntityFromEntitySet(stream, osEntitySet, namespaces);
} else {
cached = nextJSONEntityFromEntitySet(stream, osEntitySet);
@@ -119,8 +118,8 @@
if (cached == null) {
available = false;
try {
- entitySet = (ES) odataClient.getReader().
- readEntitySet(new ByteArrayInputStream(osEntitySet.toByteArray()), format);
+ entitySet = (T) odataClient.getReader().
+ readEntitySet(new ByteArrayInputStream(osEntitySet.toByteArray()), contentType);
} catch (final ODataDeserializerException e) {
available = false;
}
@@ -131,9 +130,6 @@
return available;
}
- /**
- * {@inheritDoc }
- */
@Override
public E next() {
if (hasNext()) {
@@ -211,7 +207,7 @@
}
if (c >= 0) {
- jsonEntity = odataClient.getDeserializer(ODataFormat.JSON).toEntity(
+ jsonEntity = odataClient.getDeserializer(ContentType.JSON).toEntity(
new ByteArrayInputStream(entity.toByteArray()));
}
} else {
@@ -240,7 +236,7 @@
entity.write(">".getBytes(Constants.UTF8));
if (consume(input, "</entry>", entity, true) >= 0) {
- atomEntity = odataClient.getDeserializer(ODataFormat.ATOM).
+ atomEntity = odataClient.getDeserializer(ContentType.APPLICATION_ATOM_XML).
toEntity(new ByteArrayInputStream(entity.toByteArray()));
}
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientInlineEntity.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientInlineEntity.java
index b5ff829..e24a19c 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientInlineEntity.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientInlineEntity.java
@@ -65,4 +65,39 @@
public ClientEntity getEntity() {
return entity;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((entity == null) ? 0 : entity.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof ClientInlineEntity)) {
+ return false;
+ }
+ ClientInlineEntity other = (ClientInlineEntity) obj;
+ if (entity == null) {
+ if (other.entity != null) {
+ return false;
+ }
+ } else if (!entity.equals(other.entity)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "ClientInlineEntity [entity=" + entity + "super[" + super.toString() + "]]";
+ }
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientInlineEntitySet.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientInlineEntitySet.java
index 28c4ee6..dbb5f67 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientInlineEntitySet.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientInlineEntitySet.java
@@ -36,7 +36,7 @@
* @param entitySet entity set.
*/
public ClientInlineEntitySet(final URI uri, final ClientLinkType type,
- final String title, final ClientEntitySet entitySet) {
+ final String title, final ClientEntitySet entitySet) {
super(uri, type, title);
this.entitySet = entitySet;
@@ -52,7 +52,7 @@
* @param entitySet entity set.
*/
public ClientInlineEntitySet(final URI baseURI, final String href,
- final ClientLinkType type, final String title, final ClientEntitySet entitySet) {
+ final ClientLinkType type, final String title, final ClientEntitySet entitySet) {
super(baseURI, href, type, title);
this.entitySet = entitySet;
@@ -66,4 +66,40 @@
public ClientEntitySet getEntitySet() {
return entitySet;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((entitySet == null) ? 0 : entitySet.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof ClientInlineEntitySet)) {
+ return false;
+ }
+ ClientInlineEntitySet other = (ClientInlineEntitySet) obj;
+ if (entitySet == null) {
+ if (other.entitySet != null) {
+ return false;
+ }
+ } else if (!entitySet.equals(other.entitySet)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "ClientInlineEntitySet [entitySet=" + entitySet + "super[" + super.toString() + "]]";
+ }
+
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientItem.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientItem.java
index 32dcdce..d60c8b8 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientItem.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientItem.java
@@ -20,24 +20,12 @@
import java.net.URI;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* Abstract representation of OData entities and links.
*/
public abstract class ClientItem {
/**
- * Logger.
- */
- protected static final Logger LOG = LoggerFactory.getLogger(ClientItem.class);
-
- /**
* OData entity name/type.
*/
private final String name;
@@ -45,7 +33,7 @@
/**
* OData item self link.
*/
- protected URI link;
+ private URI link;
/**
* Constructor.
@@ -79,18 +67,48 @@
this.link = link;
}
+
+
@Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof ClientItem)) {
+ return false;
+ }
+ ClientItem other = (ClientItem) obj;
+ if (link == null) {
+ if (other.link != null) {
+ return false;
+ }
+ } else if (!link.equals(other.link)) {
+ return false;
+ }
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
}
@Override
public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((link == null) ? 0 : link.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
}
@Override
public String toString() {
- return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ return "ClientItem [name=" + name + ", link=" + link + "]";
}
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientLink.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientLink.java
index d4d6d23..5307165 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientLink.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientLink.java
@@ -31,11 +31,11 @@
public static class Builder {
- protected URI uri;
+ private URI uri;
- protected ClientLinkType type;
+ private ClientLinkType type;
- protected String title;
+ private String title;
public Builder setURI(final URI uri) {
this.uri = uri;
@@ -88,17 +88,17 @@
/**
* Link type.
*/
- protected final ClientLinkType type;
+ private final ClientLinkType type;
/**
* Link rel.
*/
- protected final String rel;
+ private final String rel;
/**
* ETag for media edit links.
*/
- protected String mediaETag;
+ private String mediaETag;
private final List<ClientAnnotation> annotations = new ArrayList<ClientAnnotation>();
@@ -112,8 +112,8 @@
public ClientLink(final URI uri, final ClientLinkType type, final String title) {
super(title);
- link = uri;
this.type = type;
+ setLink(uri);
switch (this.type) {
case ASSOCIATION:
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientPrimitiveValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientPrimitiveValue.java
index 350efdb..cd3339c 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientPrimitiveValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientPrimitiveValue.java
@@ -23,6 +23,7 @@
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmType;
+import java.math.BigDecimal;
import java.util.UUID;
public interface ClientPrimitiveValue extends ClientValue {
@@ -54,6 +55,10 @@
ClientPrimitiveValue buildGuid(UUID value);
ClientPrimitiveValue buildBinary(byte[] value);
+
+ ClientPrimitiveValue buildDecimal(BigDecimal value);
+
+ ClientPrimitiveValue buildDuration(BigDecimal value);
}
EdmPrimitiveTypeKind getTypeKind();
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientValue.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientValue.java
index de778c5..85bce73 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientValue.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ClientValue.java
@@ -55,10 +55,10 @@
/**
* Casts to collection value.
*
- * @param <OV> The actual ODataValue interface.
+ * @param <T> The actual ODataValue interface.
* @return collection value.
*/
- <OV extends ClientValue> ClientCollectionValue<OV> asCollection();
+ <T extends ClientValue> ClientCollectionValue<T> asCollection();
/**
* Casts to complex value.
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/http/HttpClientException.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/http/HttpClientException.java
index 12e432b..81159cb 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/http/HttpClientException.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/http/HttpClientException.java
@@ -31,7 +31,7 @@
/**
* Constructs a new client-side runtime exception with the specified cause and a detail message of
- * {@code (cause==null ? null : cause.toString())} (which typically contains the class and detail message of
+ * {@code (cause==null ? null : cause.getName())} (which typically contains the class and detail message of
* {@code cause}). This constructor is useful for runtime exceptions that are little more than wrappers for other
* throwables.
*
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ClientODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ClientODataDeserializer.java
index 56c2e13..8317c22 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ClientODataDeserializer.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ClientODataDeserializer.java
@@ -24,8 +24,6 @@
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.commons.api.data.Delta;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.serialization.ODataDeserializer;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
public interface ClientODataDeserializer extends ODataDeserializer {
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataDeserializer.java
new file mode 100644
index 0000000..1e01a06
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataDeserializer.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.serialization;
+
+import java.io.InputStream;
+
+import org.apache.olingo.commons.api.ex.ODataError;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ResWrap;
+
+/**
+ * Interface for de-serialization.
+ */
+public interface ODataDeserializer {
+
+ /**
+ * Gets an entity set object from the given InputStream.
+ *
+ * @param input stream to be de-serialized.
+ * @return {@link EntityCollection} instance.
+ */
+ ResWrap<EntityCollection> toEntitySet(InputStream input) throws ODataDeserializerException;
+
+ /**
+ * Gets an entity object from the given InputStream.
+ *
+ * @param input stream to be de-serialized.
+ * @return {@link Entity} instance.
+ */
+ ResWrap<Entity> toEntity(InputStream input) throws ODataDeserializerException;
+
+ /**
+ * Gets a property object from the given InputStream.
+ *
+ * @param input stream to be de-serialized.
+ * @return Property instance.
+ */
+ ResWrap<Property> toProperty(InputStream input) throws ODataDeserializerException;
+
+ /**
+ * Gets the ODataError object represented by the given InputStream.
+ *
+ * @param input stream to be parsed and de-serialized.
+ * @return parsed ODataError object represented by the given InputStream
+ */
+ ODataError toError(InputStream input) throws ODataDeserializerException;
+}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataDeserializerException.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataDeserializerException.java
new file mode 100644
index 0000000..b24915c
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataDeserializerException.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.serialization;
+
+import org.apache.olingo.commons.api.ex.ODataException;
+
+public class ODataDeserializerException extends ODataException {
+
+ private static final long serialVersionUID = -3236099963180859670L;
+
+ public ODataDeserializerException(final String msg) {
+ super(msg);
+ }
+
+ public ODataDeserializerException(final Throwable cause) {
+ super(cause);
+ }
+
+ public ODataDeserializerException(final String msg, final Throwable cause) {
+ super(msg, cause);
+ }
+}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataReader.java
index 7e4aa96..20de874 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataReader.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataReader.java
@@ -21,16 +21,16 @@
import java.io.InputStream;
import java.util.Map;
-import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.commons.api.ODataError;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.api.domain.ClientServiceDocument;
+import org.apache.olingo.commons.api.ex.ODataError;
+import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.format.ContentType;
+
/**
* OData reader.
@@ -61,51 +61,52 @@
* Parses an OData service document.
*
* @param input stream to de-serialize.
- * @param format de-serialize as XML or JSON
+ * @param contentType de-serialize as XML or JSON
* @return List of URIs.
* @throws ODataDeserializerException
*/
- ClientServiceDocument readServiceDocument(InputStream input, ODataFormat format) throws ODataDeserializerException;
+ ClientServiceDocument readServiceDocument(InputStream input, ContentType contentType)
+ throws ODataDeserializerException;
/**
* De-Serializes a stream into an OData entity set.
*
* @param input stream to de-serialize.
- * @param format de-serialize format
+ * @param contentType de-serialize format
* @return de-serialized entity set.
* @throws ODataDeserializerException
*/
- ClientEntitySet readEntitySet(InputStream input, ODataFormat format) throws ODataDeserializerException;
+ ClientEntitySet readEntitySet(InputStream input, ContentType contentType) throws ODataDeserializerException;
/**
* Parses a stream taking care to de-serializes the first OData entity found.
*
* @param input stream to de-serialize.
- * @param format de-serialize format
+ * @param contentType de-serialize format
* @return entity de-serialized.
* @throws ODataDeserializerException
*/
- ClientEntity readEntity(InputStream input, ODataFormat format) throws ODataDeserializerException;
+ ClientEntity readEntity(InputStream input, ContentType contentType) throws ODataDeserializerException;
/**
* Parses a stream taking care to de-serialize the first OData entity property found.
*
* @param input stream to de-serialize.
- * @param format de-serialize as XML or JSON
+ * @param contentType de-serialize as XML or JSON
* @return OData entity property de-serialized.
* @throws ODataDeserializerException
*/
- ClientProperty readProperty(InputStream input, ODataFormat format) throws ODataDeserializerException;
+ ClientProperty readProperty(InputStream input, ContentType contentType) throws ODataDeserializerException;
/**
* Parses a stream into an OData error.
*
* @param inputStream stream to de-serialize.
- * @param format format
+ * @param contentType format
* @return OData error.
* @throws ODataDeserializerException
*/
- ODataError readError(InputStream inputStream, ODataFormat format) throws ODataDeserializerException;
+ ODataError readError(InputStream inputStream, ContentType contentType) throws ODataDeserializerException;
/**
* Parses a stream into the object type specified by the given reference.
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataSerializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataSerializer.java
new file mode 100644
index 0000000..6d81981
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataSerializer.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.serialization;
+
+import java.io.Writer;
+
+import org.apache.olingo.commons.api.data.ResWrap;
+
+/**
+ * Interface for serialization.
+ */
+public interface ODataSerializer {
+
+ public <T> void write(final Writer writer, final T obj) throws ODataSerializerException;
+
+ public <T> void write(final Writer writer, final ResWrap<T> container) throws ODataSerializerException;
+}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataSerializerException.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataSerializerException.java
new file mode 100644
index 0000000..e11d68b
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataSerializerException.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.serialization;
+
+import org.apache.olingo.commons.api.ex.ODataException;
+
+public class ODataSerializerException extends ODataException {
+
+ private static final long serialVersionUID = -3236099963180859670L;
+
+ public ODataSerializerException(final String msg) {
+ super(msg);
+ }
+
+ public ODataSerializerException(final Throwable cause) {
+ super(cause);
+ }
+
+ public ODataSerializerException(final String msg, final Throwable cause) {
+ super(msg, cause);
+ }
+}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataWriter.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataWriter.java
index 5287c94..1a6d65a 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataWriter.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataWriter.java
@@ -22,12 +22,11 @@
import java.net.URI;
import java.util.Collection;
-import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.api.domain.ClientLink;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataSerializerException;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.format.ContentType;
/**
* OData writer.
@@ -42,54 +41,54 @@
* Writes a collection of OData entities.
*
* @param entities entities to be serialized.
- * @param format serialization format.
+ * @param contentType serialization format.
* @return stream of serialized objects.
* @throws ODataSerializerException
*/
- InputStream writeEntities(Collection<ClientEntity> entities, ODataFormat format)
+ InputStream writeEntities(Collection<ClientEntity> entities, ContentType contentType)
throws ODataSerializerException;
/**
* Serializes a single OData entity.
*
* @param entity entity to be serialized.
- * @param format serialization format.
+ * @param contentType serialization format.
* @return stream of serialized object.
* @throws ODataSerializerException
*/
- InputStream writeEntity(ClientEntity entity, ODataFormat format)
+ InputStream writeEntity(ClientEntity entity, ContentType format)
throws ODataSerializerException;
/**
* Writes a single OData entity property.
*
* @param property entity property to be serialized.
- * @param format serialization format.
+ * @param contentType serialization format.
* @return stream of serialized object.
* @throws ODataSerializerException
*/
- InputStream writeProperty(ClientProperty property, ODataFormat format)
+ InputStream writeProperty(ClientProperty property, ContentType format)
throws ODataSerializerException;
/**
* Writes an OData link.
*
* @param link link to be serialized.
- * @param format serialization format.
+ * @param contentType serialization format.
* @return stream of serialized object.
* @throws ODataSerializerException
*/
- InputStream writeLink(ClientLink link, ODataFormat format)
+ InputStream writeLink(ClientLink link, ContentType format)
throws ODataSerializerException;
/**
* Writes a entity reference
*
* @param reference reference to be serialized
- * @param format serialization format
+ * @param contentType serialization format
* @return stream of serialized objects
* @throws ODataSerializerException
*/
- InputStream writeReference(ResWrap<URI> reference, ODataFormat format)
+ InputStream writeReference(ResWrap<URI> reference, ContentType format)
throws ODataSerializerException;
}
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/FilterArgFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/FilterArgFactory.java
index f03a78c..9a768b6 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/FilterArgFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/FilterArgFactory.java
@@ -21,7 +21,7 @@
public interface FilterArgFactory {
- FilterArg _null();
+ FilterArg nullValue();
FilterArg add(FilterArg first, FilterArg second);
diff --git a/lib/client-core/pom.xml b/lib/client-core/pom.xml
index 4e6068c..ce9fc28 100644
--- a/lib/client-core/pom.xml
+++ b/lib/client-core/pom.xml
@@ -80,6 +80,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
+ <version>${maven.bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/ConfigurationImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/ConfigurationImpl.java
index cd17ad0..14c59d6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/ConfigurationImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/ConfigurationImpl.java
@@ -29,7 +29,6 @@
import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
import org.apache.olingo.client.core.http.DefaultHttpUriRequestFactory;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
public class ConfigurationImpl implements Configuration {
@@ -96,39 +95,39 @@
}
@Override
- public ODataFormat getDefaultPubFormat() {
- return (ODataFormat) getProperty(DEFAULT_PUB_FORMAT, ODataFormat.JSON_FULL_METADATA);
+ public ContentType getDefaultPubFormat() {
+ return (ContentType) getProperty(DEFAULT_PUB_FORMAT, ContentType.JSON_FULL_METADATA);
}
@Override
- public void setDefaultPubFormat(final ODataFormat format) {
- setProperty(DEFAULT_PUB_FORMAT, format);
+ public void setDefaultPubFormat(final ContentType contentType) {
+ setProperty(DEFAULT_PUB_FORMAT, contentType);
}
@Override
- public ODataFormat getDefaultFormat() {
- final ODataFormat format = getDefaultPubFormat();
- return format == ODataFormat.ATOM ? ODataFormat.XML : format;
+ public ContentType getDefaultFormat() {
+ final ContentType contenType = getDefaultPubFormat();
+ return contenType == ContentType.APPLICATION_ATOM_XML ? ContentType.APPLICATION_XML : contenType;
}
@Override
- public ODataFormat getDefaultValueFormat() {
- return (ODataFormat) getProperty(DEFAULT_VALUE_FORMAT, ODataFormat.TEXT_PLAIN);
+ public ContentType getDefaultValueFormat() {
+ return (ContentType) getProperty(DEFAULT_VALUE_FORMAT, ContentType.TEXT_PLAIN);
}
@Override
- public void setDefaultValueFormat(final ODataFormat format) {
- setProperty(DEFAULT_VALUE_FORMAT, format);
+ public void setDefaultValueFormat(final ContentType contentType) {
+ setProperty(DEFAULT_VALUE_FORMAT, contentType);
}
@Override
- public ODataFormat getDefaultMediaFormat() {
- return (ODataFormat) getProperty(DEFAULT_VALUE_FORMAT, ODataFormat.APPLICATION_OCTET_STREAM);
+ public ContentType getDefaultMediaFormat() {
+ return (ContentType) getProperty(DEFAULT_VALUE_FORMAT, ContentType.APPLICATION_OCTET_STREAM);
}
@Override
- public void setDefaultMediaFormat(final ODataFormat format) {
- setProperty(DEFAULT_MEDIA_FORMAT, format);
+ public void setDefaultMediaFormat(final ContentType contentType) {
+ setProperty(DEFAULT_MEDIA_FORMAT, contentType);
}
@Override
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java
index b9f18a8..c9f4617 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientFactory.java
@@ -21,7 +21,7 @@
import org.apache.olingo.client.api.EdmEnabledODataClient;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
public final class ODataClientFactory {
@@ -30,18 +30,27 @@
}
public static EdmEnabledODataClient getEdmEnabledClient(final String serviceRoot) {
- return getEdmEnabledClient(serviceRoot, null, null);
+ return getEdmEnabledClient(serviceRoot, null, null, ContentType.JSON);
+ }
+
+ public static EdmEnabledODataClient getEdmEnabledClient(final String serviceRoot, ContentType contentType) {
+ return getEdmEnabledClient(serviceRoot, null, null, contentType);
}
public static EdmEnabledODataClient getEdmEnabledClient(
final String serviceRoot, final Edm edm, final String metadataETag) {
-
- final EdmEnabledODataClient instance =
- new EdmEnabledODataClientImpl(serviceRoot, edm, metadataETag);
- instance.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
- return instance;
+ return getEdmEnabledClient(serviceRoot, edm, metadataETag, ContentType.JSON);
}
+
+ public static EdmEnabledODataClient getEdmEnabledClient(
+ final String serviceRoot, final Edm edm, final String metadataETag, ContentType contentType) {
+
+ final EdmEnabledODataClient instance =
+ new EdmEnabledODataClientImpl(serviceRoot, edm, metadataETag);
+ instance.getConfiguration().setDefaultPubFormat(contentType);
+ return instance;
+ }
private ODataClientFactory() {
// empty constructory for static utility class
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientImpl.java
index a934e3e..811b63f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/ODataClientImpl.java
@@ -20,7 +20,6 @@
import org.apache.olingo.client.api.Configuration;
import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.communication.header.HeaderName;
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.AsyncRequestFactory;
@@ -28,9 +27,11 @@
import org.apache.olingo.client.api.communication.request.cud.CUDRequestFactory;
import org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory;
import org.apache.olingo.client.api.communication.request.retrieve.RetrieveRequestFactory;
+import org.apache.olingo.client.api.domain.ClientObjectFactory;
import org.apache.olingo.client.api.serialization.ClientODataDeserializer;
import org.apache.olingo.client.api.serialization.ODataBinder;
import org.apache.olingo.client.api.serialization.ODataReader;
+import org.apache.olingo.client.api.serialization.ODataSerializer;
import org.apache.olingo.client.api.serialization.ODataWriter;
import org.apache.olingo.client.api.uri.FilterFactory;
import org.apache.olingo.client.api.uri.SearchFactory;
@@ -41,19 +42,18 @@
import org.apache.olingo.client.core.communication.request.cud.CUDRequestFactoryImpl;
import org.apache.olingo.client.core.communication.request.invoke.InvokeRequestFactoryImpl;
import org.apache.olingo.client.core.communication.request.retrieve.RetrieveRequestFactoryImpl;
+import org.apache.olingo.client.core.domain.ClientObjectFactoryImpl;
+import org.apache.olingo.client.core.serialization.AtomSerializer;
import org.apache.olingo.client.core.serialization.ClientODataDeserializerImpl;
+import org.apache.olingo.client.core.serialization.JsonSerializer;
import org.apache.olingo.client.core.serialization.ODataBinderImpl;
import org.apache.olingo.client.core.serialization.ODataReaderImpl;
import org.apache.olingo.client.core.serialization.ODataWriterImpl;
import org.apache.olingo.client.core.uri.FilterFactoryImpl;
import org.apache.olingo.client.core.uri.URIBuilderImpl;
-import org.apache.olingo.client.api.domain.ClientObjectFactory;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataSerializer;
-import org.apache.olingo.client.core.domain.ClientObjectFactoryImpl;
-import org.apache.olingo.commons.core.serialization.AtomSerializer;
-import org.apache.olingo.commons.core.serialization.JsonSerializer;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.format.ContentType;
public class ODataClientImpl implements ODataClient {
@@ -95,7 +95,7 @@
public ODataWriter getWriter() {
return writer;
}
-
+
@Override
public ODataServiceVersion getServiceVersion() {
return ODataServiceVersion.V40;
@@ -104,8 +104,8 @@
@Override
public ODataHeaders newVersionHeaders() {
final ODataHeadersImpl odataHeaders = new ODataHeadersImpl();
- odataHeaders.setHeader(HeaderName.odataMaxVersion, ODataServiceVersion.V40.toString());
- odataHeaders.setHeader(HeaderName.odataVersion, ODataServiceVersion.V40.toString());
+ odataHeaders.setHeader(HttpHeader.ODATA_MAX_VERSION, ODataServiceVersion.V40.toString());
+ odataHeaders.setHeader(HttpHeader.ODATA_VERSION, ODataServiceVersion.V40.toString());
return odataHeaders;
}
@@ -113,7 +113,7 @@
public URIBuilder newURIBuilder(final String serviceRoot) {
return new URIBuilderImpl(getConfiguration(), serviceRoot);
}
-
+
@Override
public FilterFactory getFilterFactory() {
return filterFactory;
@@ -125,15 +125,16 @@
}
@Override
- public ClientODataDeserializer getDeserializer(final ODataFormat format) {
- return new ClientODataDeserializerImpl(false, format);
+ public ClientODataDeserializer getDeserializer(final ContentType contentType) {
+ return new ClientODataDeserializerImpl(false, contentType);
}
@Override
- public ODataSerializer getSerializer(final ODataFormat format) {
- return format == ODataFormat.ATOM || format == ODataFormat.XML ?
- new AtomSerializer() :
- new JsonSerializer(false, format);
+ public ODataSerializer getSerializer(final ContentType contentType) {
+ return contentType.isCompatible(ContentType.APPLICATION_ATOM_SVC)
+ || contentType.isCompatible(ContentType.APPLICATION_ATOM_XML)
+ || contentType.isCompatible(ContentType.APPLICATION_XML) ?
+ new AtomSerializer() : new JsonSerializer(false, contentType);
}
@Override
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.java
index 2008149..d83b8fb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataErrorResponseChecker.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.
*/
@@ -24,10 +24,11 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.ODataServerErrorException;
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.commons.api.ODataError;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.ex.ODataError;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,29 +44,29 @@
}
public static ODataRuntimeException checkResponse(
- final ODataClient odataClient, final StatusLine statusLine, final InputStream entity,
- final String accept) {
+ final ODataClient odataClient, final StatusLine statusLine, final InputStream entity,
+ final String accept) {
ODataRuntimeException result = null;
if (entity == null) {
result = new ODataClientErrorException(statusLine);
} else {
- final ODataFormat format = accept.contains("xml") ? ODataFormat.XML : ODataFormat.JSON;
+ final ContentType contentType = accept.contains("xml") ? ContentType.APPLICATION_ATOM_XML : ContentType.JSON;
ODataError error;
try {
- error = odataClient.getReader().readError(entity, format);
+ error = odataClient.getReader().readError(entity, contentType);
} catch (final RuntimeException e) {
LOG.warn("Error deserializing error response", e);
error = getGenericError(
- statusLine.getStatusCode(),
- statusLine.getReasonPhrase());
+ statusLine.getStatusCode(),
+ statusLine.getReasonPhrase());
} catch (final ODataDeserializerException e) {
LOG.warn("Error deserializing error response", e);
error = getGenericError(
- statusLine.getStatusCode(),
- statusLine.getReasonPhrase());
+ statusLine.getStatusCode(),
+ statusLine.getReasonPhrase());
}
if (statusLine.getStatusCode() >= 500) {
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataHeadersImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataHeadersImpl.java
index 5a30624..9f79fbb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataHeadersImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/header/ODataHeadersImpl.java
@@ -22,7 +22,6 @@
import java.util.Map;
import java.util.TreeMap;
-import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.header.ODataHeaders;
public class ODataHeadersImpl implements ODataHeaders {
@@ -39,27 +38,11 @@
}
@Override
- public ODataHeaders setHeader(final HeaderName name, final String value) {
- headers.put(name.toString(), value);
- return this;
- }
-
- @Override
- public String getHeader(final HeaderName name) {
- return headers.get(name.toString());
- }
-
- @Override
public String getHeader(final String name) {
return headers.get(name);
}
@Override
- public String removeHeader(final HeaderName name) {
- return headers.remove(name.toString());
- }
-
- @Override
public String removeHeader(final String name) {
return headers.remove(name);
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java
index c5c313c..7a53468 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataBasicRequest.java
@@ -32,7 +32,7 @@
import org.apache.olingo.client.api.communication.request.ODataStreamer;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
import org.apache.olingo.client.api.communication.response.ODataResponse;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpMethod;
/**
@@ -55,9 +55,9 @@
}
@Override
- public void setFormat(final ODataFormat format) {
- if (format != null) {
- final String formatString = format.getContentType().toContentTypeString();
+ public void setFormat(final ContentType contentType) {
+ if (contentType != null) {
+ final String formatString = contentType.toContentTypeString();
setAccept(formatString);
setContentType(formatString);
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java
index bdfd118..6666eba 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java
@@ -34,14 +34,14 @@
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.DecompressingHttpClient;
import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.header.ODataHeaders;
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.response.ODataResponse;
import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpMethod;
/**
@@ -102,7 +102,7 @@
this.request = odataClient.getConfiguration().getHttpUriRequestFactory().create(this.method, uri);
}
- public abstract ODataFormat getDefaultFormat();
+ public abstract ContentType getDefaultFormat();
@Override
public URI getURI() {
@@ -128,37 +128,37 @@
@Override
public ODataRequest setAccept(final String value) {
- odataHeaders.setHeader(HeaderName.accept, value);
+ odataHeaders.setHeader(HttpHeader.ACCEPT, value);
return this;
}
@Override
public ODataRequest setIfMatch(final String value) {
- odataHeaders.setHeader(HeaderName.ifMatch, value);
+ odataHeaders.setHeader(HttpHeader.IF_MATCH, value);
return this;
}
@Override
public ODataRequest setIfNoneMatch(final String value) {
- odataHeaders.setHeader(HeaderName.ifNoneMatch, value);
+ odataHeaders.setHeader(HttpHeader.IF_NONE_MATCH, value);
return this;
}
@Override
public ODataRequest setPrefer(final String value) {
- odataHeaders.setHeader(HeaderName.prefer, value);
+ odataHeaders.setHeader(HttpHeader.PREFER, value);
return this;
}
@Override
public ODataRequest setXHTTPMethod(final String value) {
- odataHeaders.setHeader(HeaderName.xHttpMethod, value);
+ odataHeaders.setHeader(HttpHeader.X_HTTP_METHOD, value);
return this;
}
@Override
public ODataRequest setContentType(final String value) {
- odataHeaders.setHeader(HeaderName.contentType, value);
+ odataHeaders.setHeader(HttpHeader.CONTENT_TYPE, value);
return this;
}
@@ -169,40 +169,34 @@
}
@Override
- public ODataRequest addCustomHeader(final HeaderName name, final String value) {
- odataHeaders.setHeader(name, value);
- return this;
- }
-
- @Override
public String getAccept() {
- final String acceptHead = odataHeaders.getHeader(HeaderName.accept);
- return StringUtils.isBlank(acceptHead)
- ? getDefaultFormat().getContentType().toContentTypeString()
- : acceptHead;
+ final String acceptHead = odataHeaders.getHeader(HttpHeader.ACCEPT);
+ return StringUtils.isBlank(acceptHead) ?
+ getDefaultFormat().toContentTypeString() :
+ acceptHead;
}
@Override
public String getIfMatch() {
- return odataHeaders.getHeader(HeaderName.ifMatch);
+ return odataHeaders.getHeader(HttpHeader.IF_MATCH);
}
@Override
public String getIfNoneMatch() {
- return odataHeaders.getHeader(HeaderName.ifNoneMatch);
+ return odataHeaders.getHeader(HttpHeader.IF_NONE_MATCH);
}
@Override
public String getPrefer() {
- return odataHeaders.getHeader(HeaderName.prefer);
+ return odataHeaders.getHeader(HttpHeader.PREFER);
}
@Override
public String getContentType() {
- final String contentTypeHead = odataHeaders.getHeader(HeaderName.contentType);
- return StringUtils.isBlank(contentTypeHead)
- ? getDefaultFormat().getContentType().toContentTypeString()
- : contentTypeHead;
+ final String contentTypeHead = odataHeaders.getHeader(HttpHeader.CONTENT_TYPE);
+ return StringUtils.isBlank(contentTypeHead) ?
+ getDefaultFormat().toContentTypeString() :
+ contentTypeHead;
}
@Override
@@ -231,10 +225,10 @@
baos.write(ODataStreamer.CRLF);
// Set Content-Type and Accept headers with default values, if not yet set
- if (StringUtils.isBlank(odataHeaders.getHeader(HeaderName.contentType))) {
+ if (StringUtils.isBlank(odataHeaders.getHeader(HttpHeader.CONTENT_TYPE))) {
setContentType(getContentType());
}
- if (StringUtils.isBlank(odataHeaders.getHeader(HeaderName.accept))) {
+ if (StringUtils.isBlank(odataHeaders.getHeader(HttpHeader.ACCEPT))) {
setAccept(getAccept());
}
@@ -277,18 +271,16 @@
checkRequest(odataClient, request);
// Set Content-Type and Accept headers with default values, if not yet set
- if (StringUtils.isBlank(odataHeaders.getHeader(HeaderName.contentType))) {
+ if (StringUtils.isBlank(odataHeaders.getHeader(HttpHeader.CONTENT_TYPE))) {
setContentType(getContentType());
}
- if (StringUtils.isBlank(odataHeaders.getHeader(HeaderName.accept))) {
+ if (StringUtils.isBlank(odataHeaders.getHeader(HttpHeader.ACCEPT))) {
setAccept(getAccept());
}
// Add header for KeyAsSegment management
if (odataClient.getConfiguration().isKeyAsSegment()) {
- addCustomHeader(
- HeaderName.dataServiceUrlConventions.toString(),
- odataClient.newPreferences().keyAsSegment());
+ addCustomHeader("DataServiceUrlConventions", odataClient.newPreferences().keyAsSegment());
}
// Add all available headers
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractRequest.java
index 9c004e2..b273a71 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractRequest.java
@@ -22,7 +22,7 @@
import org.apache.olingo.client.api.EdmEnabledODataClient;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.core.communication.header.ODataErrorResponseChecker;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AsyncBatchRequestWrapperImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AsyncBatchRequestWrapperImpl.java
index d64ea3f..d4821b5 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AsyncBatchRequestWrapperImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AsyncBatchRequestWrapperImpl.java
@@ -23,7 +23,6 @@
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.header.ODataPreferences;
import org.apache.olingo.client.api.communication.request.AsyncBatchRequestWrapper;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
@@ -32,6 +31,7 @@
import org.apache.olingo.client.api.communication.request.batch.ODataChangeset;
import org.apache.olingo.client.api.communication.response.AsyncResponseWrapper;
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
+import org.apache.olingo.commons.api.http.HttpHeader;
public class AsyncBatchRequestWrapperImpl extends AsyncRequestWrapperImpl<ODataBatchResponse>
implements AsyncBatchRequestWrapper {
@@ -91,19 +91,19 @@
}
private void retrieveMonitorDetails(final ODataBatchResponse res) {
- Collection<String> headers = res.getHeader(HeaderName.location.toString());
+ Collection<String> headers = res.getHeader(HttpHeader.LOCATION);
if (headers == null || headers.isEmpty()) {
throw new AsyncRequestException("Invalid async request response. Monitor URL not found");
} else {
this.location = URI.create(headers.iterator().next());
}
- headers = res.getHeader(HeaderName.retryAfter.toString());
+ headers = res.getHeader(HttpHeader.RETRY_AFTER);
if (headers != null && !headers.isEmpty()) {
this.retryAfter = Integer.parseInt(headers.iterator().next());
}
- headers = res.getHeader(HeaderName.preferenceApplied.toString());
+ headers = res.getHeader(HttpHeader.PREFERENCE_APPLIED);
if (headers != null && !headers.isEmpty()) {
for (String header : headers) {
if (header.equalsIgnoreCase(new ODataPreferences().respondAsync())) {
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AsyncRequestWrapperImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AsyncRequestWrapperImpl.java
index dd8456f..20a645c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AsyncRequestWrapperImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AsyncRequestWrapperImpl.java
@@ -27,12 +27,13 @@
import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.entity.InputStreamEntity;
import org.apache.http.impl.client.DecompressingHttpClient;
import org.apache.http.util.EntityUtils;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
-import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.header.ODataPreferences;
import org.apache.olingo.client.api.communication.request.AsyncRequestWrapper;
import org.apache.olingo.client.api.communication.request.ODataRequest;
@@ -41,7 +42,9 @@
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataResponse;
import org.apache.olingo.client.api.http.HttpClientException;
+import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
public class AsyncRequestWrapperImpl<R extends ODataResponse> extends AbstractRequest
implements AsyncRequestWrapper<R> {
@@ -75,7 +78,7 @@
this.odataRequest.setAccept(this.odataRequest.getAccept());
this.odataRequest.setContentType(this.odataRequest.getContentType());
- extendHeader(HeaderName.prefer.toString(), new ODataPreferences().respondAsync());
+ extendHeader(HttpHeader.PREFER, new ODataPreferences().respondAsync());
this.odataClient = odataClient;
final HttpMethod method = odataRequest.getMethod();
@@ -90,18 +93,25 @@
this.httpClient = _httpClient;
this.request = odataClient.getConfiguration().getHttpUriRequestFactory().create(method, this.uri);
+
+ if(request instanceof HttpEntityEnclosingRequestBase) {
+ if(odataRequest instanceof AbstractODataBasicRequest) {
+ AbstractODataBasicRequest<?> br = (AbstractODataBasicRequest<?>) odataRequest;
+ HttpEntityEnclosingRequestBase httpRequest = ((HttpEntityEnclosingRequestBase) request);
+ httpRequest.setEntity(new InputStreamEntity(br.getPayload(), -1));
+ }
+ }
}
@Override
public final AsyncRequestWrapper<R> wait(final int waitInSeconds) {
- extendHeader(HeaderName.prefer.toString(), new ODataPreferences().wait(waitInSeconds));
+ extendHeader(HttpHeader.PREFER, new ODataPreferences().wait(waitInSeconds));
return this;
}
@Override
public final AsyncRequestWrapper<R> callback(URI url) {
- extendHeader(HeaderName.prefer.toString(),
- new ODataPreferences().callback(url.toASCIIString()));
+ extendHeader(HttpHeader.PREFER, new ODataPreferences().callback(url.toASCIIString()));
return this;
}
@@ -184,9 +194,9 @@
for (int i = 0; response == null && i < MAX_RETRY; i++) {
res = checkMonitor(location);
- if (res.getStatusLine().getStatusCode() == 202) {
+ if (res.getStatusLine().getStatusCode() == HttpStatusCode.ACCEPTED.getStatusCode()) {
- final Header[] headers = res.getHeaders(HeaderName.retryAfter.toString());
+ final Header[] headers = res.getHeaders(HttpHeader.RETRY_AFTER);
if (ArrayUtils.isNotEmpty(headers)) {
this.retryAfter = Integer.parseInt(headers[0].getValue());
}
@@ -211,27 +221,18 @@
return response;
}
- /**
- * {@inheritDoc}
- */
@Override
public ODataDeleteResponse delete() {
final ODataDeleteRequest deleteRequest = odataClient.getCUDRequestFactory().getDeleteRequest(location);
return deleteRequest.execute();
}
- /**
- * {@inheritDoc}
- */
@Override
public AsyncResponseWrapper<ODataDeleteResponse> asyncDelete() {
return odataClient.getAsyncRequestFactory().<ODataDeleteResponse>getAsyncRequestWrapper(
odataClient.getCUDRequestFactory().getDeleteRequest(location)).execute();
}
- /**
- * {@inheritDoc}
- */
@Override
public AsyncResponseWrapper<R> forceNextMonitorCheck(final URI uri) {
this.location = uri;
@@ -255,7 +256,7 @@
}
private void retrieveMonitorDetails(final HttpResponse res) {
- Header[] headers = res.getHeaders(HeaderName.location.toString());
+ Header[] headers = res.getHeaders(HttpHeader.LOCATION);
if (ArrayUtils.isNotEmpty(headers)) {
this.location = URI.create(headers[0].getValue());
} else {
@@ -263,12 +264,12 @@
"Invalid async request response. Monitor URL '" + headers[0].getValue() + "'");
}
- headers = res.getHeaders(HeaderName.retryAfter.toString());
+ headers = res.getHeaders(HttpHeader.RETRY_AFTER);
if (ArrayUtils.isNotEmpty(headers)) {
this.retryAfter = Integer.parseInt(headers[0].getValue());
}
- headers = res.getHeaders(HeaderName.preferenceApplied.toString());
+ headers = res.getHeaders(HttpHeader.PREFERENCE_APPLIED);
if (ArrayUtils.isNotEmpty(headers)) {
for (Header header : headers) {
if (header.getValue().equalsIgnoreCase(new ODataPreferences().respondAsync())) {
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchRequestImpl.java
index 8893c5e..3b9e621 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchRequestImpl.java
@@ -26,7 +26,6 @@
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.header.ODataPreferences;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.batch.BatchManager;
@@ -68,7 +67,7 @@
@Override
protected HttpResponse doExecute() {
if (odataClient.getConfiguration().isContinueOnError()) {
- addCustomHeader(HeaderName.prefer, new ODataPreferences().continueOnError());
+ setPrefer(new ODataPreferences().continueOnError());
}
return super.doExecute();
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchUtilities.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchUtilities.java
index f746849..bca612f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchUtilities.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataBatchUtilities.java
@@ -34,11 +34,11 @@
import org.apache.commons.io.LineIterator;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.ODataBatchConstants;
-import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.request.ODataStreamer;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchLineIterator;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,12 +48,11 @@
public class ODataBatchUtilities {
public static enum BatchItemType {
-
NONE,
CHANGESET,
RETRIEVE
-
}
+
/**
* Logger.
*/
@@ -300,8 +299,9 @@
final BatchItemType nextItemType;
- final String contentType = headers.containsKey(HeaderName.contentType.toString())
- ? headers.get(HeaderName.contentType.toString()).toString() : StringUtils.EMPTY;
+ final String contentType = headers.containsKey(HttpHeader.CONTENT_TYPE) ?
+ headers.get(HttpHeader.CONTENT_TYPE).toString() :
+ StringUtils.EMPTY;
if (contentType.contains(ContentType.MULTIPART_MIXED.toContentTypeString())) {
nextItemType = BatchItemType.CHANGESET;
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataChangesetImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataChangesetImpl.java
index ce6155a..51a55ab 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataChangesetImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/ODataChangesetImpl.java
@@ -20,12 +20,12 @@
import java.util.UUID;
-import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest;
import org.apache.olingo.client.api.communication.request.batch.ODataChangeset;
import org.apache.olingo.client.core.communication.request.AbstractODataRequest;
import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
/**
@@ -99,7 +99,7 @@
}
if (!hasStreamedSomething) {
- stream((HeaderName.contentType.toString() + ": "
+ stream((HttpHeader.CONTENT_TYPE + ": "
+ ContentType.MULTIPART_MIXED + ";boundary=" + boundary).getBytes());
newLine();
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java
index 35f5118..245c9b5 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataDeleteRequestImpl.java
@@ -28,7 +28,7 @@
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpMethod;
/**
@@ -42,7 +42,7 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultPubFormat();
}
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 b2aba3d..0ae8377 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,16 +28,16 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
+import org.apache.olingo.client.api.domain.ClientEntity;
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.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
+import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.apache.olingo.commons.api.serialization.ODataSerializerException;
/**
* This class implements an OData create request.
@@ -66,14 +66,14 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultPubFormat();
}
@Override
protected InputStream getPayload() {
try {
- return odataClient.getWriter().writeEntity(entity, ODataFormat.fromString(getContentType()));
+ return odataClient.getWriter().writeEntity(entity, ContentType.parse(getContentType()));
} catch (final ODataSerializerException e) {
throw new IllegalArgumentException(e);
}
@@ -112,7 +112,7 @@
public E getBody() {
if (resEntity == null) {
try {
- final ResWrap<Entity> resource = odataClient.getDeserializer(ODataFormat.fromString(getAccept())).
+ final ResWrap<Entity> resource = odataClient.getDeserializer(ContentType.parse(getAccept())).
toEntity(getRawResponse());
resEntity = (E) odataClient.getBinder().getODataEntity(resource);
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 195eaeb..8a40e33 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
@@ -29,16 +29,16 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
+import org.apache.olingo.client.api.domain.ClientEntity;
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.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
+import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.apache.olingo.commons.api.serialization.ODataSerializerException;
/**
* This class implements an OData update request.
@@ -70,14 +70,14 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultPubFormat();
}
@Override
protected InputStream getPayload() {
try {
- return odataClient.getWriter().writeEntity(changes, ODataFormat.fromString(getContentType()));
+ return odataClient.getWriter().writeEntity(changes, ContentType.parse(getContentType()));
} catch (final ODataSerializerException e) {
throw new IllegalArgumentException(e);
}
@@ -122,7 +122,7 @@
public E getBody() {
if (entity == null) {
try {
- final ResWrap<Entity> resource = odataClient.getDeserializer(ODataFormat.fromString(getAccept())).
+ final ResWrap<Entity> resource = odataClient.getDeserializer(ContentType.parse(getAccept())).
toEntity(getRawResponse());
entity = (E) odataClient.getBinder().getODataEntity(resource);
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 a88652f..038feeb 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,16 +28,16 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateResponse;
+import org.apache.olingo.client.api.domain.ClientProperty;
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.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
+import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.apache.olingo.commons.api.serialization.ODataSerializerException;
/**
* This class implements an OData update entity property request.
@@ -67,7 +67,7 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultFormat();
}
@@ -86,7 +86,7 @@
@Override
protected InputStream getPayload() {
try {
- return odataClient.getWriter().writeProperty(property, ODataFormat.fromString(getContentType()));
+ return odataClient.getWriter().writeProperty(property, ContentType.parse(getContentType()));
} catch (final ODataSerializerException e) {
throw new IllegalArgumentException(e);
}
@@ -109,7 +109,7 @@
public ClientProperty getBody() {
if (resProperty == null) {
try {
- final ResWrap<Property> resource = odataClient.getDeserializer(ODataFormat.fromString(getAccept())).
+ final ResWrap<Property> resource = odataClient.getDeserializer(ContentType.parse(getAccept())).
toProperty(getRawResponse());
resProperty = odataClient.getBinder().getODataProperty(resource);
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataReferenceAddingRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataReferenceAddingRequestImpl.java
index 477a91a..640b5cf 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataReferenceAddingRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataReferenceAddingRequestImpl.java
@@ -28,14 +28,14 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.cud.ODataReferenceAddingRequest;
import org.apache.olingo.client.api.communication.response.ODataReferenceAddingResponse;
+import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.client.api.serialization.ODataWriter;
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.data.ResWrap;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.commons.api.serialization.ODataSerializerException;
/**
* See {@link ODataReferenceAddingRequest}
@@ -54,7 +54,7 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultPubFormat();
}
@@ -68,7 +68,7 @@
} else {
ODataWriter writer = odataClient.getWriter();
try {
- return writer.writeReference(reference, ODataFormat.fromString(getContentType()));
+ return writer.writeReference(reference, ContentType.parse(getContentType()));
} catch (ODataSerializerException e) {
LOG.warn("Error serializing reference {}", reference);
throw new IllegalArgumentException(e);
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 93f4b59..407a199 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
@@ -28,13 +28,13 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataValueUpdateResponse;
+import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
import org.apache.olingo.client.api.http.HttpClientException;
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.client.api.domain.ClientPrimitiveValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpMethod;
/**
@@ -65,7 +65,7 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultValueFormat();
}
@@ -105,11 +105,11 @@
@Override
public ClientPrimitiveValue getBody() {
if (resValue == null) {
- final ODataFormat format = ODataFormat.fromString(getAccept());
-
+ final ContentType contentType = ContentType.parse(getAccept());
+
try {
resValue = odataClient.getObjectFactory().newPrimitiveValueBuilder().
- setType(format == ODataFormat.TEXT_PLAIN
+ setType(contentType.isCompatible(ContentType.TEXT_PLAIN)
? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setValue(getRawResponse()).
build();
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java
index 5bd259c..8bd3363 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java
@@ -31,10 +31,12 @@
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.olingo.client.api.ODataClient;
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.ClientNoContent;
+import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
import org.apache.olingo.client.api.communication.response.ODataInvokeResponse;
import org.apache.olingo.client.api.http.HttpClientException;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
+import org.apache.olingo.client.api.serialization.ODataSerializerException;
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;
@@ -43,10 +45,8 @@
import org.apache.olingo.client.api.domain.ClientInvokeResult;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.api.domain.ClientValue;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.apache.olingo.commons.api.serialization.ODataSerializerException;
/**
* This class implements an OData invoke operation request.
@@ -91,23 +91,25 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultPubFormat();
}
- private String getActualFormat(final ODataFormat format) {
- return ((ClientProperty.class.isAssignableFrom(reference) && format == ODataFormat.ATOM)
- ? ODataFormat.XML : format).getContentType().toContentTypeString();
+ private String getActualFormat(final ContentType contentType) {
+ return (ClientProperty.class.isAssignableFrom(reference)
+ && (contentType.isCompatible(ContentType.APPLICATION_ATOM_SVC)
+ || contentType.isCompatible(ContentType.APPLICATION_ATOM_XML)) ?
+ ContentType.APPLICATION_XML : contentType).toContentTypeString();
}
@Override
- public void setFormat(final ODataFormat format) {
- final String _format = getActualFormat(format);
- setAccept(_format);
- setContentType(_format);
+ public void setFormat(final ContentType contentType) {
+ final String _contentType = getActualFormat(contentType);
+ setAccept(_contentType);
+ setContentType(_contentType);
}
- protected abstract ODataFormat getPOSTParameterFormat();
+ protected abstract ContentType getPOSTParameterFormat();
@Override
protected InputStream getPayload() {
@@ -197,13 +199,13 @@
final InputStream responseStream = this.payload == null ? res.getEntity().getContent() : this.payload;
if (ClientEntitySet.class.isAssignableFrom(reference)) {
invokeResult = reference.cast(odataClient.getReader().readEntitySet(responseStream,
- ODataFormat.fromString(getContentType())));
+ ContentType.parse(getContentType())));
} else if (ClientEntity.class.isAssignableFrom(reference)) {
invokeResult = reference.cast(odataClient.getReader().readEntity(responseStream,
- ODataFormat.fromString(getContentType())));
+ ContentType.parse(getContentType())));
} else if (ClientProperty.class.isAssignableFrom(reference)) {
invokeResult = reference.cast(odataClient.getReader().readProperty(responseStream,
- ODataFormat.fromString(getContentType())));
+ ContentType.parse(getContentType())));
}
}
} catch (IOException e) {
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 5e8736e..6d6cc01 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
@@ -22,12 +22,12 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.domain.ClientInvokeResult;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpMethod;
public class ODataInvokeRequestImpl<T extends ClientInvokeResult> extends AbstractODataInvokeRequest<T> {
- private ODataFormat format;
+ private ContentType contentType;
public ODataInvokeRequestImpl(final ODataClient odataClient, final Class<T> reference,
final HttpMethod method, final URI uri) {
@@ -36,13 +36,13 @@
}
@Override
- public void setFormat(final ODataFormat format) {
- super.setFormat(format);
- this.format = format;
+ public void setFormat(final ContentType contentType) {
+ super.setFormat(contentType);
+ this.contentType = contentType;
}
@Override
- protected ODataFormat getPOSTParameterFormat() {
- return format == null ? getDefaultFormat() : format;
+ protected ContentType getPOSTParameterFormat() {
+ return contentType == null ? getDefaultFormat() : contentType;
}
}
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
index 3cdd349..201a662 100644
--- 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
@@ -23,7 +23,6 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.ODataRequest;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
public abstract class AbstractMetadataRequestImpl<V> extends AbstractODataRetrieveRequest<V> {
@@ -34,8 +33,8 @@
}
@Override
- public ODataFormat getDefaultFormat() {
- return ODataFormat.XML;
+ public ContentType getDefaultFormat() {
+ return ContentType.APPLICATION_XML;
}
@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
index ee5e2e7..e3eef12 100644
--- 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
@@ -23,7 +23,6 @@
import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
@@ -112,11 +111,6 @@
return xmlMetadataResponse.getHeader(name);
}
- @Override
- public Collection<String> getHeader(final HeaderName name) {
- return xmlMetadataResponse.getHeader(name);
- }
-
public XMLMetadata getXMLMetadata() {
if (metadata == null) {
try {
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataDeltaRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataDeltaRequestImpl.java
index 601e4ba..1cd6970 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataDeltaRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataDeltaRequestImpl.java
@@ -26,12 +26,12 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataDeltaRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ClientDelta;
import org.apache.olingo.client.api.http.HttpClientException;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.data.Delta;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.client.api.domain.ClientDelta;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.format.ContentType;
public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest<ClientDelta>
implements ODataDeltaRequest {
@@ -41,7 +41,7 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultPubFormat();
}
@@ -65,7 +65,7 @@
public ClientDelta getBody() {
if (delta == null) {
try {
- final ResWrap<Delta> resource = odataClient.getDeserializer(ODataFormat.fromString(getContentType())).
+ final ResWrap<Delta> resource = odataClient.getDeserializer(ContentType.parse(getContentType())).
toDelta(res.getEntity().getContent());
delta = odataClient.getBinder().getODataDelta(resource);
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 57acf2a..dec56b0 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
@@ -25,11 +25,11 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
/**
* This class implements an OData retrieve query request returning a single entity.
@@ -48,7 +48,7 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultPubFormat();
}
@@ -75,7 +75,7 @@
public E getBody() {
if (entity == null) {
try {
- final ResWrap<Entity> resource = odataClient.getDeserializer(ODataFormat.fromString(getContentType())).
+ final ResWrap<Entity> resource = odataClient.getDeserializer(ContentType.parse(getContentType())).
toEntity(getRawResponse());
entity = (E) odataClient.getBinder().getODataEntity(resource);
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 dcb31e9..db390a0 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,10 +25,10 @@
import org.apache.olingo.client.api.ODataClient;
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.ClientEntitySetIterator;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.client.api.domain.ClientEntitySetIterator;
+import org.apache.olingo.commons.api.format.ContentType;
/**
* This class implements an OData EntitySet query request.
@@ -50,7 +50,7 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultPubFormat();
}
@@ -75,7 +75,7 @@
public ClientEntitySetIterator<ES, E> getBody() {
if (entitySetIterator == null) {
entitySetIterator = new ClientEntitySetIterator<ES, E>(
- odataClient, getRawResponse(), ODataFormat.fromString(getContentType()));
+ odataClient, getRawResponse(), ContentType.parse(getContentType()));
}
return entitySetIterator;
}
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 620a88d..a49dd32 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
@@ -25,11 +25,11 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
/**
* This class implements an OData EntitySet query request.
@@ -52,7 +52,7 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultPubFormat();
}
@@ -79,7 +79,7 @@
if (entitySet == null) {
try {
final ResWrap<EntityCollection> resource =
- odataClient.getDeserializer(ODataFormat.fromString(getContentType())).
+ odataClient.getDeserializer(ContentType.parse(getContentType())).
toEntitySet(getRawResponse());
entitySet = (ES) odataClient.getBinder().getODataEntitySet(resource);
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java
index 7c7c34c..3f32f1b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMediaRequestImpl.java
@@ -28,7 +28,7 @@
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
/**
* This class implements an OData media query request.
@@ -44,12 +44,12 @@
ODataMediaRequestImpl(final ODataClient odataClient, final URI query) {
super(odataClient, query);
- setAccept(ODataFormat.APPLICATION_OCTET_STREAM.toString());
- setContentType(ODataFormat.APPLICATION_OCTET_STREAM.toString());
+ setAccept(ContentType.APPLICATION_OCTET_STREAM.toString());
+ setContentType(ContentType.APPLICATION_OCTET_STREAM.toString());
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultMediaFormat();
}
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 36e9d0c..5c9dfed 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
@@ -26,12 +26,12 @@
import org.apache.olingo.client.api.ODataClient;
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.domain.ClientProperty;
import org.apache.olingo.client.api.http.HttpClientException;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.format.ContentType;
/**
* This class implements an OData entity property query request.
@@ -50,7 +50,7 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultFormat();
}
@@ -75,7 +75,7 @@
public T getBody() {
if (property == null) {
try {
- final ResWrap<Property> resource = odataClient.getDeserializer(ODataFormat.fromString(getContentType()))
+ final ResWrap<Property> resource = odataClient.getDeserializer(ContentType.parse(getContentType()))
.toProperty(res.getEntity().getContent());
property = (T) odataClient.getBinder().getODataProperty(resource);
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 4c22c31..79c3e14 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
@@ -28,12 +28,12 @@
import org.apache.olingo.client.api.ODataClient;
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.serialization.ODataDeserializerException;
import org.apache.olingo.client.core.communication.request.AbstractODataRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
/**
* This class implements a generic OData request.
@@ -51,7 +51,7 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultPubFormat();
}
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 363ba87..d0b6b1f 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
@@ -26,10 +26,10 @@
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.ResWrap;
import org.apache.olingo.client.api.domain.ClientServiceDocument;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
/**
* This class implements an OData service document request.
@@ -48,7 +48,7 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultFormat();
}
@@ -76,7 +76,7 @@
if (serviceDocument == null) {
try {
final ResWrap<ServiceDocument> resource = odataClient.
- getDeserializer(ODataFormat.fromString(getContentType())).toServiceDocument(getRawResponse());
+ getDeserializer(ContentType.parse(getContentType())).toServiceDocument(getRawResponse());
serviceDocument = odataClient.getBinder().getODataServiceDocument(resource.getPayload());
} catch (final ODataDeserializerException e) {
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 9bbce7c..e2161d4 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
@@ -26,10 +26,10 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
+import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
/**
* This class implements an OData entity property value query request.
@@ -48,7 +48,7 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultValueFormat();
}
@@ -74,11 +74,11 @@
@Override
public ClientPrimitiveValue getBody() {
if (value == null) {
- final ODataFormat format = ODataFormat.fromString(getContentType());
+ final ContentType contentType = ContentType.parse(getContentType());
try {
value = odataClient.getObjectFactory().newPrimitiveValueBuilder().
- setType(format == ODataFormat.TEXT_PLAIN
+ setType(contentType.isCompatible(ContentType.TEXT_PLAIN)
? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setValue(IOUtils.toString(getRawResponse())).build();
} catch (Exception e) {
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java
index 2e432c8..b5248d4 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java
@@ -34,7 +34,7 @@
import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
import org.apache.olingo.commons.api.edm.provider.CsdlAnnotations;
import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpStatusCode;
public class XMLMetadataRequestImpl
@@ -170,7 +170,7 @@
public XMLMetadata getBody() {
if (metadata == null) {
try {
- metadata = odataClient.getDeserializer(ODataFormat.XML).toMetadata(getRawResponse());
+ metadata = odataClient.getDeserializer(ContentType.APPLICATION_XML).toMetadata(getRawResponse());
} finally {
this.close();
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
index c257803..99f1170 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedEntityRequest.java
@@ -24,7 +24,7 @@
import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
import org.apache.olingo.client.api.communication.request.streamed.ODataStreamedEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataResponse;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpMethod;
/**
@@ -37,7 +37,7 @@
extends AbstractODataStreamedRequest<V, T>
implements ODataStreamedEntityRequest<V, T> {
- private ODataFormat format;
+ private ContentType contentType;
/**
* Constructor.
@@ -50,17 +50,17 @@
final URI uri) {
super(odataClient, method, uri);
- setAccept(getFormat().getContentType().toContentTypeString());
+ setAccept(getFormat().toContentTypeString());
}
@Override
- public final ODataFormat getFormat() {
- return format == null ? odataClient.getConfiguration().getDefaultPubFormat() : format;
+ public final ContentType getFormat() {
+ return contentType == null ? odataClient.getConfiguration().getDefaultPubFormat() : contentType;
}
@Override
- public final void setFormat(final ODataFormat format) {
- this.format = format;
- setAccept(format.getContentType().toContentTypeString());
+ public final void setFormat(final ContentType contentType) {
+ this.contentType = contentType;
+ setAccept(contentType.toContentTypeString());
}
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
index e01e508..734762f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/AbstractODataStreamedRequest.java
@@ -39,7 +39,6 @@
import org.apache.olingo.client.core.communication.request.Wrapper;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpMethod;
/**
@@ -78,7 +77,7 @@
}
@Override
- public ODataFormat getDefaultFormat() {
+ public ContentType getDefaultFormat() {
return odataClient.getConfiguration().getDefaultMediaFormat();
}
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 175258b..1443f88 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
@@ -33,8 +33,8 @@
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
/**
* This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory.
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 d38533e..8c02eca 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
@@ -33,8 +33,8 @@
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
/**
* This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory.
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 210ae7c..58923cd 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
@@ -35,7 +35,6 @@
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.request.ODataStreamer;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchLineIterator;
import org.apache.olingo.client.api.communication.response.ODataResponse;
@@ -44,7 +43,8 @@
import org.apache.olingo.client.core.communication.request.batch.ODataBatchLineIteratorImpl;
import org.apache.olingo.client.core.communication.request.batch.ODataBatchUtilities;
import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
+import org.apache.olingo.commons.api.http.HttpHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -112,76 +112,46 @@
}
}
- /**
- * {@inheritDoc}
- */
@Override
public Collection<String> getHeaderNames() {
return headers.keySet();
}
- /**
- * {@inheritDoc}
- */
@Override
public Collection<String> getHeader(final String name) {
return headers.get(name);
}
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<String> getHeader(final HeaderName name) {
- return headers.get(name.toString());
- }
-
- /**
- * {@inheritDoc}
- */
@Override
public String getETag() {
- final Collection<String> etag = getHeader(HeaderName.etag);
- return etag == null || etag.isEmpty()
- ? null
- : etag.iterator().next();
+ final Collection<String> etag = getHeader(HttpHeader.ETAG);
+ return etag == null || etag.isEmpty() ? null : etag.iterator().next();
}
- /**
- * {@inheritDoc}
- */
@Override
public String getContentType() {
- final Collection<String> contentTypes = getHeader(HeaderName.contentType);
- return contentTypes == null || contentTypes.isEmpty()
- ? null
- : contentTypes.iterator().next();
+ final Collection<String> contentTypes = getHeader(HttpHeader.CONTENT_TYPE);
+ return contentTypes == null || contentTypes.isEmpty() ? null : contentTypes.iterator().next();
}
- /**
- * {@inheritDoc}
- */
@Override
public int getStatusCode() {
return statusCode;
}
- /**
- * {@inheritDoc}
- */
@Override
public String getStatusMessage() {
return statusMessage;
}
- /**
- * {@inheritDoc}
- */
@Override
public final ODataResponse initFromHttpResponse(final HttpResponse res) {
try {
this.payload = res.getEntity() == null ? null : res.getEntity().getContent();
- } catch (Exception e) {
+ } catch (final IllegalStateException e) {
+ LOG.error("Error retrieving payload", e);
+ throw new ODataRuntimeException(e);
+ } catch (final IOException e) {
LOG.error("Error retrieving payload", e);
throw new ODataRuntimeException(e);
}
@@ -205,9 +175,6 @@
return this;
}
- /**
- * {@inheritDoc}
- */
@Override
public ODataResponse initFromBatch(
final Map.Entry<Integer, String> responseLine,
@@ -229,9 +196,6 @@
return this;
}
- /**
- * {@inheritDoc}
- */
@Override
public ODataResponse initFromEnclosedPart(final InputStream part) {
try {
@@ -275,9 +239,6 @@
}
}
- /**
- * {@inheritDoc }
- */
@Override
public void close() {
odataClient.getConfiguration().getHttpClientFactory().close(httpClient);
@@ -287,9 +248,6 @@
}
}
- /**
- * {@inheritDoc}
- */
@Override
public InputStream getRawResponse() {
if (HttpStatus.SC_NO_CONTENT == getStatusCode()) {
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/batch/ODataBatchResponseManager.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/batch/ODataBatchResponseManager.java
index f7fbef0..8404076 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/batch/ODataBatchResponseManager.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/batch/ODataBatchResponseManager.java
@@ -26,7 +26,6 @@
import java.util.NoSuchElementException;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchLineIterator;
import org.apache.olingo.client.api.communication.request.batch.ODataBatchResponseItem;
import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
@@ -34,6 +33,7 @@
import org.apache.olingo.client.core.communication.request.batch.ODataBatchUtilities;
import org.apache.olingo.client.core.communication.request.batch.ODataChangesetResponseItem;
import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.http.HttpHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -96,7 +96,7 @@
// search for boundary
batchBoundary = ODataBatchUtilities.getBoundaryFromHeader(
- res.getHeader(HeaderName.contentType));
+ res.getHeader(HttpHeader.CONTENT_TYPE));
LOG.debug("Retrieved batch response bondary '{}'", batchBoundary);
} catch (IOException e) {
LOG.error("Error parsing batch response", e);
@@ -104,17 +104,11 @@
}
}
- /**
- * {@inheritDoc }
- */
@Override
public boolean hasNext() {
return (current == null || continueOnError || !current.isBreaking()) && expectedItemsIterator.hasNext();
}
- /**
- * {@inheritDoc }
- */
@Override
public ODataBatchResponseItem next() {
if (current != null) {
@@ -138,7 +132,7 @@
current.initFromBatch(
batchLineIterator,
- ODataBatchUtilities.getBoundaryFromHeader(nextItemHeaders.get(HeaderName.contentType.toString())));
+ ODataBatchUtilities.getBoundaryFromHeader(nextItemHeaders.get(HttpHeader.CONTENT_TYPE)));
break;
case RETRIEVE:
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 e5bd7bd..9a95459 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,10 +25,10 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
+import org.apache.olingo.client.core.serialization.JsonDeserializer;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.apache.olingo.commons.core.serialization.JsonDeserializer;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ServiceDocumentImpl.java
index ec10e9d..4bf6a09 100755
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ServiceDocumentImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ServiceDocumentImpl.java
@@ -22,15 +22,11 @@
import java.util.ArrayList;
import java.util.List;
-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.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
import org.apache.olingo.commons.api.Constants;
-public class ServiceDocumentImpl implements ServiceDocument {
+public final class ServiceDocumentImpl implements ServiceDocument {
private String title;
@@ -125,17 +121,56 @@
}
@Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ ServiceDocumentImpl that = (ServiceDocumentImpl) o;
+
+ if (title != null ? !title.equals(that.title) : that.title != null) {
+ return false;
+ }
+ if (entitySets != null ? !entitySets.equals(that.entitySets) : that.entitySets != null) {
+ return false;
+ }
+ if (functionImports != null ? !functionImports.equals(that.functionImports) : that.functionImports != null) {
+ return false;
+ }
+ if (singletons != null ? !singletons.equals(that.singletons) : that.singletons != null) {
+ return false;
+ }
+ if (relatedServiceDocuments != null ?
+ !relatedServiceDocuments.equals(that.relatedServiceDocuments) : that.relatedServiceDocuments != null) {
+ return false;
+ }
+ return !(metadata != null ? !metadata.equals(that.metadata) : that.metadata != null);
+
}
@Override
public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
+ int result = title != null ? title.hashCode() : 0;
+ result = 31 * result + (entitySets != null ? entitySets.hashCode() : 0);
+ result = 31 * result + (functionImports != null ? functionImports.hashCode() : 0);
+ result = 31 * result + (singletons != null ? singletons.hashCode() : 0);
+ result = 31 * result + (relatedServiceDocuments != null ? relatedServiceDocuments.hashCode() : 0);
+ result = 31 * result + (metadata != null ? metadata.hashCode() : 0);
+ return result;
}
@Override
public String toString() {
- return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ return "ServiceDocumentImpl{" +
+ "title='" + title + '\'' +
+ ", entitySets=" + entitySets +
+ ", functionImports=" + functionImports +
+ ", singletons=" + singletons +
+ ", relatedServiceDocuments=" + relatedServiceDocuments +
+ ", metadata='" + metadata + '\'' +
+ '}';
}
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ServiceDocumentItemImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ServiceDocumentItemImpl.java
index 3bcdaa7..fe6b59b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ServiceDocumentItemImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ServiceDocumentItemImpl.java
@@ -18,13 +18,9 @@
*/
package org.apache.olingo.client.core.data;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
-public class ServiceDocumentItemImpl implements ServiceDocumentItem {
+public final class ServiceDocumentItemImpl implements ServiceDocumentItem {
private String name;
@@ -49,17 +45,35 @@
}
@Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ ServiceDocumentItemImpl that = (ServiceDocumentItemImpl) o;
+
+ if (name != null ? !name.equals(that.name) : that.name != null) {
+ return false;
+ }
+ return !(url != null ? !url.equals(that.url) : that.url != null);
+
}
@Override
public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
+ int result = name != null ? name.hashCode() : 0;
+ result = 31 * result + (url != null ? url.hashCode() : 0);
+ return result;
}
@Override
public String toString() {
- return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ return "ServiceDocumentItemImpl{" +
+ "name='" + name + '\'' +
+ ", url='" + url + '\'' +
+ '}';
}
}
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 0b37722..2e9064c 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
@@ -23,10 +23,10 @@
import java.net.URI;
import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
+import org.apache.olingo.client.core.serialization.JsonDeserializer;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.apache.olingo.commons.core.serialization.JsonDeserializer;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/AbstractClientEntitySet.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/AbstractClientEntitySet.java
index d6b81d9..b57960a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/AbstractClientEntitySet.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/AbstractClientEntitySet.java
@@ -68,4 +68,47 @@
public void setCount(final int count) {
this.count = count;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((count == null) ? 0 : count.hashCode());
+ result = prime * result + ((next == null) ? 0 : next.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof AbstractClientEntitySet)) {
+ return false;
+ }
+ AbstractClientEntitySet other = (AbstractClientEntitySet) obj;
+ if (count == null) {
+ if (other.count != null) {
+ return false;
+ }
+ } else if (!count.equals(other.count)) {
+ return false;
+ }
+ if (next == null) {
+ if (other.next != null) {
+ return false;
+ }
+ } else if (!next.equals(other.next)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "AbstractClientEntitySet [next=" + next + ", count=" + count + "super[" + super.toString() + "]]";
+ }
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientCollectionValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientCollectionValueImpl.java
index 3698060..c83fceb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientCollectionValueImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientCollectionValueImpl.java
@@ -120,5 +120,38 @@
return values.isEmpty();
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((values == null) ? 0 : values.hashCode());
+ return result;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof ClientCollectionValueImpl)) {
+ return false;
+ }
+ ClientCollectionValueImpl<?> other = (ClientCollectionValueImpl<?>) obj;
+ if (values == null) {
+ if (other.values != null) {
+ return false;
+ }
+ } else if (!values.equals(other.values)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "ClientCollectionValueImpl [values=" + values + "super[" + super.toString() + "]]";
+ }
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientComplexValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientComplexValueImpl.java
index d7550b6..9cd083e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientComplexValueImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientComplexValueImpl.java
@@ -201,4 +201,64 @@
public int size() {
return fields.size();
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((annotations == null) ? 0 : annotations.hashCode());
+ result = prime * result + ((associationLinks == null) ? 0 : associationLinks.hashCode());
+ result = prime * result + ((fields == null) ? 0 : fields.hashCode());
+ result = prime * result + ((navigationLinks == null) ? 0 : navigationLinks.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof ClientComplexValueImpl)) {
+ return false;
+ }
+ ClientComplexValueImpl other = (ClientComplexValueImpl) obj;
+ if (annotations == null) {
+ if (other.annotations != null) {
+ return false;
+ }
+ } else if (!annotations.equals(other.annotations)) {
+ return false;
+ }
+ if (associationLinks == null) {
+ if (other.associationLinks != null) {
+ return false;
+ }
+ } else if (!associationLinks.equals(other.associationLinks)) {
+ return false;
+ }
+ if (fields == null) {
+ if (other.fields != null) {
+ return false;
+ }
+ } else if (!fields.equals(other.fields)) {
+ return false;
+ }
+ if (navigationLinks == null) {
+ if (other.navigationLinks != null) {
+ return false;
+ }
+ } else if (!navigationLinks.equals(other.navigationLinks)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "ClientComplexValueImpl [navigationLinks=" + navigationLinks + ", associationLinks=" + associationLinks
+ + ", annotations=" + annotations + ", fields=" + fields + "super[" + super.toString() + "]]";
+ }
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeletedEntityImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeletedEntityImpl.java
index e2d954b..e1cf69f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeletedEntityImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeletedEntityImpl.java
@@ -51,4 +51,43 @@
this.reason = reason;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((reason == null) ? 0 : reason.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof ClientDeletedEntityImpl)) {
+ return false;
+ }
+ ClientDeletedEntityImpl other = (ClientDeletedEntityImpl) obj;
+ if (id == null) {
+ if (other.id != null) {
+ return false;
+ }
+ } else if (!id.equals(other.id)) {
+ return false;
+ }
+ if (reason != other.reason) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "ClientDeletedEntityImpl [id=" + id + ", reason=" + reason + "super[" + super.toString() + "]]";
+ }
+
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaImpl.java
index 02af157..30f3356 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaImpl.java
@@ -57,4 +57,55 @@
return deletedLinks;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((addedLinks == null) ? 0 : addedLinks.hashCode());
+ result = prime * result + ((deletedEntities == null) ? 0 : deletedEntities.hashCode());
+ result = prime * result + ((deletedLinks == null) ? 0 : deletedLinks.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof ClientDeltaImpl)) {
+ return false;
+ }
+ ClientDeltaImpl other = (ClientDeltaImpl) obj;
+ if (addedLinks == null) {
+ if (other.addedLinks != null) {
+ return false;
+ }
+ } else if (!addedLinks.equals(other.addedLinks)) {
+ return false;
+ }
+ if (deletedEntities == null) {
+ if (other.deletedEntities != null) {
+ return false;
+ }
+ } else if (!deletedEntities.equals(other.deletedEntities)) {
+ return false;
+ }
+ if (deletedLinks == null) {
+ if (other.deletedLinks != null) {
+ return false;
+ }
+ } else if (!deletedLinks.equals(other.deletedLinks)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "ClientDeltaImpl [deletedEntities=" + deletedEntities + ", addedLinks=" + addedLinks + ", deletedLinks="
+ + deletedLinks + "super[" + super.toString() + "]]";
+ }
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaLinkImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaLinkImpl.java
index 29a1572..0d8fd52 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaLinkImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientDeltaLinkImpl.java
@@ -75,4 +75,64 @@
return annotations;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((annotations == null) ? 0 : annotations.hashCode());
+ result = prime * result + ((relationship == null) ? 0 : relationship.hashCode());
+ result = prime * result + ((source == null) ? 0 : source.hashCode());
+ result = prime * result + ((target == null) ? 0 : target.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof ClientDeltaLinkImpl)) {
+ return false;
+ }
+ ClientDeltaLinkImpl other = (ClientDeltaLinkImpl) obj;
+ if (annotations == null) {
+ if (other.annotations != null) {
+ return false;
+ }
+ } else if (!annotations.equals(other.annotations)) {
+ return false;
+ }
+ if (relationship == null) {
+ if (other.relationship != null) {
+ return false;
+ }
+ } else if (!relationship.equals(other.relationship)) {
+ return false;
+ }
+ if (source == null) {
+ if (other.source != null) {
+ return false;
+ }
+ } else if (!source.equals(other.source)) {
+ return false;
+ }
+ if (target == null) {
+ if (other.target != null) {
+ return false;
+ }
+ } else if (!target.equals(other.target)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "ClientDeltaLinkImpl [source=" + source + ", relationship=" + relationship + ", target=" + target
+ + ", annotations=" + annotations + "super[" + super.toString() + "]]";
+ }
+
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntityImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntityImpl.java
index 1c0d31b..4426e03 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntityImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntityImpl.java
@@ -295,4 +295,143 @@
public List<ClientAnnotation> getAnnotations() {
return annotations;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((annotations == null) ? 0 : annotations.hashCode());
+ result = prime * result + ((associationLinks == null) ? 0 : associationLinks.hashCode());
+ result = prime * result + ((eTag == null) ? 0 : eTag.hashCode());
+ result = prime * result + ((editLink == null) ? 0 : editLink.hashCode());
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((mediaContentSource == null) ? 0 : mediaContentSource.hashCode());
+ result = prime * result + ((mediaContentType == null) ? 0 : mediaContentType.hashCode());
+ result = prime * result + ((mediaETag == null) ? 0 : mediaETag.hashCode());
+ result = prime * result + ((mediaEditLinks == null) ? 0 : mediaEditLinks.hashCode());
+ result = prime * result + (mediaEntity ? 1231 : 1237);
+ result = prime * result + ((navigationLinks == null) ? 0 : navigationLinks.hashCode());
+ result = prime * result + ((operations == null) ? 0 : operations.hashCode());
+ result = prime * result + ((properties == null) ? 0 : properties.hashCode());
+ result = prime * result + ((typeName == null) ? 0 : typeName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof ClientEntityImpl)) {
+ return false;
+ }
+ ClientEntityImpl other = (ClientEntityImpl) obj;
+ if (annotations == null) {
+ if (other.annotations != null) {
+ return false;
+ }
+ } else if (!annotations.equals(other.annotations)) {
+ return false;
+ }
+ if (associationLinks == null) {
+ if (other.associationLinks != null) {
+ return false;
+ }
+ } else if (!associationLinks.equals(other.associationLinks)) {
+ return false;
+ }
+ if (eTag == null) {
+ if (other.eTag != null) {
+ return false;
+ }
+ } else if (!eTag.equals(other.eTag)) {
+ return false;
+ }
+ if (editLink == null) {
+ if (other.editLink != null) {
+ return false;
+ }
+ } else if (!editLink.equals(other.editLink)) {
+ return false;
+ }
+ if (id == null) {
+ if (other.id != null) {
+ return false;
+ }
+ } else if (!id.equals(other.id)) {
+ return false;
+ }
+ if (mediaContentSource == null) {
+ if (other.mediaContentSource != null) {
+ return false;
+ }
+ } else if (!mediaContentSource.equals(other.mediaContentSource)) {
+ return false;
+ }
+ if (mediaContentType == null) {
+ if (other.mediaContentType != null) {
+ return false;
+ }
+ } else if (!mediaContentType.equals(other.mediaContentType)) {
+ return false;
+ }
+ if (mediaETag == null) {
+ if (other.mediaETag != null) {
+ return false;
+ }
+ } else if (!mediaETag.equals(other.mediaETag)) {
+ return false;
+ }
+ if (mediaEditLinks == null) {
+ if (other.mediaEditLinks != null) {
+ return false;
+ }
+ } else if (!mediaEditLinks.equals(other.mediaEditLinks)) {
+ return false;
+ }
+ if (mediaEntity != other.mediaEntity) {
+ return false;
+ }
+ if (navigationLinks == null) {
+ if (other.navigationLinks != null) {
+ return false;
+ }
+ } else if (!navigationLinks.equals(other.navigationLinks)) {
+ return false;
+ }
+ if (operations == null) {
+ if (other.operations != null) {
+ return false;
+ }
+ } else if (!operations.equals(other.operations)) {
+ return false;
+ }
+ if (properties == null) {
+ if (other.properties != null) {
+ return false;
+ }
+ } else if (!properties.equals(other.properties)) {
+ return false;
+ }
+ if (typeName == null) {
+ if (other.typeName != null) {
+ return false;
+ }
+ } else if (!typeName.equals(other.typeName)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "ClientEntityImpl [id=" + id + ", eTag=" + eTag + ", mediaEntity=" + mediaEntity + ", mediaContentType="
+ + mediaContentType + ", mediaContentSource=" + mediaContentSource + ", mediaETag=" + mediaETag + ", editLink="
+ + editLink + ", properties=" + properties + ", annotations=" + annotations + ", typeName=" + typeName
+ + ", navigationLinks=" + navigationLinks + ", associationLinks=" + associationLinks + ", mediaEditLinks="
+ + mediaEditLinks + ", operations=" + operations + "super[" + super.toString() + "]]";
+ }
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntitySetImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntitySetImpl.java
index 7d7e646..29ede4c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntitySetImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEntitySetImpl.java
@@ -62,4 +62,55 @@
return annotations;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((annotations == null) ? 0 : annotations.hashCode());
+ result = prime * result + ((deltaLink == null) ? 0 : deltaLink.hashCode());
+ result = prime * result + ((entities == null) ? 0 : entities.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof ClientEntitySetImpl)) {
+ return false;
+ }
+ ClientEntitySetImpl other = (ClientEntitySetImpl) obj;
+ if (annotations == null) {
+ if (other.annotations != null) {
+ return false;
+ }
+ } else if (!annotations.equals(other.annotations)) {
+ return false;
+ }
+ if (deltaLink == null) {
+ if (other.deltaLink != null) {
+ return false;
+ }
+ } else if (!deltaLink.equals(other.deltaLink)) {
+ return false;
+ }
+ if (entities == null) {
+ if (other.entities != null) {
+ return false;
+ }
+ } else if (!entities.equals(other.entities)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "ClientEntitySetImpl [deltaLink=" + deltaLink + ", entities=" + entities + ", annotations=" + annotations
+ + "super[" + super.toString() + "]]";
+ }
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEnumValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEnumValueImpl.java
index 84559c7..6cec564 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEnumValueImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientEnumValueImpl.java
@@ -56,4 +56,33 @@
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((value == null) ? 0 : value.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof ClientEnumValueImpl)) {
+ return false;
+ }
+ ClientEnumValueImpl other = (ClientEnumValueImpl) obj;
+ if (value == null) {
+ if (other.value != null) {
+ return false;
+ }
+ } else if (!value.equals(other.value)) {
+ return false;
+ }
+ return true;
+ }
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPrimitiveValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPrimitiveValueImpl.java
index f8f85d5..cdfe623 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPrimitiveValueImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPrimitiveValueImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.domain;
+import java.math.BigDecimal;
import java.util.UUID;
import org.apache.olingo.commons.api.Constants;
@@ -133,6 +134,16 @@
return setType(EdmPrimitiveTypeKind.Binary).setValue(value).build();
}
+ @Override
+ public ClientPrimitiveValue buildDecimal(BigDecimal value) {
+ return setType(EdmPrimitiveTypeKind.Decimal).setValue(value).build();
+ }
+
+ @Override
+ public ClientPrimitiveValue buildDuration(BigDecimal value) {
+ return setType(EdmPrimitiveTypeKind.Duration).setValue(value).build();
+ }
+
}
/**
@@ -219,4 +230,46 @@
return false;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ result = prime * result + ((typeKind == null) ? 0 : typeKind.hashCode());
+ result = prime * result + ((value == null) ? 0 : value.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof ClientPrimitiveValueImpl)) {
+ return false;
+ }
+ ClientPrimitiveValueImpl other = (ClientPrimitiveValueImpl) obj;
+ if (type == null) {
+ if (other.type != null) {
+ return false;
+ }
+ } else if (!type.equals(other.type)) {
+ return false;
+ }
+ if (typeKind != other.typeKind) {
+ return false;
+ }
+ if (value == null) {
+ if (other.value != null) {
+ return false;
+ }
+ } else if (!value.equals(other.value)) {
+ return false;
+ }
+ return true;
+ }
+
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPropertyImpl.java
index ac1ad1d..f78c506 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPropertyImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientPropertyImpl.java
@@ -18,11 +18,6 @@
*/
package org.apache.olingo.client.core.domain;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.olingo.client.api.domain.ClientAnnotatable;
import org.apache.olingo.client.api.domain.ClientAnnotation;
import org.apache.olingo.client.api.domain.ClientCollectionValue;
@@ -33,8 +28,10 @@
import org.apache.olingo.client.api.domain.ClientValuable;
import org.apache.olingo.client.api.domain.ClientValue;
-public class ClientPropertyImpl implements ClientProperty, ClientAnnotatable, ClientValuable {
+import java.util.ArrayList;
+import java.util.List;
+public final class ClientPropertyImpl implements ClientProperty, ClientAnnotatable, ClientValuable {
private final List<ClientAnnotation> annotations = new ArrayList<ClientAnnotation>();
private final String name;
@@ -118,13 +115,57 @@
}
@Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof ClientPropertyImpl)) {
+ return false;
+ }
+ ClientPropertyImpl other = (ClientPropertyImpl) obj;
+ if (annotations == null) {
+ if (other.annotations != null) {
+ return false;
+ }
+ } else if (!annotations.equals(other.annotations)) {
+ return false;
+ }
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ if (valuable == null) {
+ if (other.valuable != null) {
+ return false;
+ }
+ } else if (!valuable.equals(other.valuable)) {
+ return false;
+ }
+ if (value == null) {
+ if (other.value != null) {
+ return false;
+ }
+ } else if (!value.equals(other.value)) {
+ return false;
+ }
+ return true;
}
@Override
public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((annotations == null) ? 0 : annotations.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((valuable == null) ? 0 : valuable.hashCode());
+ result = prime * result + ((value == null) ? 0 : value.hashCode());
+ return result;
}
@Override
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientValuableImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientValuableImpl.java
index ecae20d..4a032ce 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientValuableImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ClientValuableImpl.java
@@ -18,10 +18,6 @@
*/
package org.apache.olingo.client.core.domain;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.olingo.client.api.domain.ClientCollectionValue;
import org.apache.olingo.client.api.domain.ClientComplexValue;
import org.apache.olingo.client.api.domain.ClientEnumValue;
@@ -29,7 +25,7 @@
import org.apache.olingo.client.api.domain.ClientValuable;
import org.apache.olingo.client.api.domain.ClientValue;
-public class ClientValuableImpl implements ClientValuable {
+public final class ClientValuableImpl implements ClientValuable {
private final ClientValue value;
@@ -94,18 +90,29 @@
}
@Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ ClientValuableImpl that = (ClientValuableImpl) o;
+
+ return !(value != null ? !value.equals(that.value) : that.value != null);
+
}
@Override
public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
+ return value != null ? value.hashCode() : 0;
}
@Override
public String toString() {
- return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ return "ClientValuableImpl{" +
+ "value=" + value +
+ '}';
}
-
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java
index 28536ba..3c805e7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java
@@ -22,7 +22,7 @@
import java.util.List;
import java.util.Map;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
import org.apache.olingo.commons.api.edm.provider.CsdlAction;
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AbstractAtomDealer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AbstractAtomDealer.java
new file mode 100644
index 0000000..30fb582
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AbstractAtomDealer.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.serialization;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+
+abstract class AbstractAtomDealer {
+
+ protected static final String TYPE_TEXT = "text";
+
+ protected final String namespaceMetadata;
+ protected final String namespaceData;
+ protected final String namespaceAtom;
+
+ protected final QName etagQName;
+ protected final QName metadataEtagQName;
+ protected final QName inlineQName;
+ protected final QName actionQName;
+ protected final QName propertiesQName;
+ protected final QName typeQName;
+ protected final QName nullQName;
+ protected final QName elementQName;
+ protected final QName countQName;
+ protected final QName uriQName;
+ protected final QName nextQName;
+ protected final QName annotationQName;
+ protected final QName contextQName;
+ protected final QName entryRefQName;
+ protected final QName propertyValueQName;
+ protected final QName deletedEntryQName;
+ protected final QName reasonQName;
+ protected final QName linkQName;
+ protected final QName deletedLinkQName;
+ protected final QName errorCodeQName;
+ protected final QName errorMessageQName;
+ protected final QName errorTargetQName;
+
+ public AbstractAtomDealer() {
+ namespaceMetadata = Constants.NS_METADATA;
+ namespaceData = Constants.NS_DATASERVICES;
+ namespaceAtom = Constants.NS_ATOM;
+
+ etagQName = new QName(namespaceMetadata, Constants.ATOM_ATTR_ETAG);
+ metadataEtagQName = new QName(namespaceMetadata, Constants.ATOM_ATTR_METADATAETAG);
+ inlineQName = new QName(namespaceMetadata, Constants.ATOM_ELEM_INLINE);
+ actionQName = new QName(namespaceMetadata, Constants.ATOM_ELEM_ACTION);
+ propertiesQName = new QName(namespaceMetadata, Constants.PROPERTIES);
+ typeQName = new QName(namespaceMetadata, Constants.ATTR_TYPE);
+ nullQName = new QName(namespaceMetadata, Constants.ATTR_NULL);
+ elementQName = new QName(namespaceMetadata, Constants.ELEM_ELEMENT);
+ countQName = new QName(namespaceMetadata, Constants.ATOM_ELEM_COUNT);
+ uriQName = new QName(namespaceData, Constants.ELEM_URI);
+ nextQName = new QName(namespaceData, Constants.NEXT_LINK_REL);
+ annotationQName = new QName(namespaceMetadata, Constants.ANNOTATION);
+ contextQName = new QName(namespaceMetadata, Constants.CONTEXT);
+ entryRefQName = new QName(namespaceMetadata, Constants.ATOM_ELEM_ENTRY_REF);
+ propertyValueQName = new QName(namespaceMetadata, Constants.VALUE);
+
+ deletedEntryQName = new QName(Constants.NS_ATOM_TOMBSTONE, Constants.ATOM_ELEM_DELETED_ENTRY);
+ reasonQName = new QName(namespaceMetadata, Constants.ELEM_REASON);
+ linkQName = new QName(namespaceMetadata, Constants.ATOM_ELEM_LINK);
+ deletedLinkQName = new QName(namespaceMetadata, Constants.ELEM_DELETED_LINK);
+
+ errorCodeQName = new QName(namespaceMetadata, Constants.ERROR_CODE);
+ errorMessageQName = new QName(namespaceMetadata, Constants.ERROR_MESSAGE);
+ errorTargetQName = new QName(namespaceMetadata, Constants.ERROR_TARGET);
+ }
+
+ protected void namespaces(final XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeNamespace(StringUtils.EMPTY, Constants.NS_ATOM);
+ writer.writeNamespace(XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI);
+ writer.writeNamespace(Constants.PREFIX_METADATA, Constants.NS_METADATA);
+ writer.writeNamespace(Constants.PREFIX_DATASERVICES, Constants.NS_DATASERVICES);
+ writer.writeNamespace(Constants.PREFIX_GML, Constants.NS_GML);
+ writer.writeNamespace(Constants.PREFIX_GEORSS, Constants.NS_GEORSS);
+ }
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomDeserializer.java
new file mode 100644
index 0000000..d48e1b9
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomDeserializer.java
@@ -0,0 +1,878 @@
+/*
+ * 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.serialization;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.serialization.ODataDeserializer;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.ex.ODataError;
+import org.apache.olingo.commons.api.data.PropertyType;
+import org.apache.olingo.commons.api.data.AbstractODataObject;
+import org.apache.olingo.commons.api.data.Annotation;
+import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.DeletedEntity;
+import org.apache.olingo.commons.api.data.DeletedEntity.Reason;
+import org.apache.olingo.commons.api.data.Delta;
+import org.apache.olingo.commons.api.data.DeltaLink;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Operation;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.data.Valuable;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+
+import com.fasterxml.aalto.stax.InputFactoryImpl;
+
+public class AtomDeserializer extends AbstractAtomDealer implements ODataDeserializer {
+
+ protected static final XMLInputFactory FACTORY = new InputFactoryImpl();
+
+ private final AtomGeoValueDeserializer geoDeserializer;
+
+ protected XMLEventReader getReader(final InputStream input) throws XMLStreamException {
+ return FACTORY.createXMLEventReader(input);
+ }
+
+ public AtomDeserializer() {
+ geoDeserializer = new AtomGeoValueDeserializer();
+ }
+
+ private Object fromPrimitive(final XMLEventReader reader, final StartElement start,
+ final EdmTypeInfo typeInfo) throws XMLStreamException, EdmPrimitiveTypeException {
+
+ Object value = null;
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement() && typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
+ final EdmPrimitiveTypeKind geoType =
+ EdmPrimitiveTypeKind.valueOfFQN(typeInfo.getFullQualifiedName().toString());
+ value = geoDeserializer.deserialize(reader, event.asStartElement(), geoType);
+ }
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()
+ && (typeInfo == null || !typeInfo.getPrimitiveTypeKind().isGeospatial())) {
+ final String stringValue = event.asCharacters().getData();
+ if (typeInfo == null) {
+ value = stringValue;
+ } else {
+ final EdmPrimitiveType primitiveType = (EdmPrimitiveType) typeInfo.getType();
+ final Class<?> returnType = primitiveType.getDefaultType().isAssignableFrom(Calendar.class)
+ ? Timestamp.class : primitiveType.getDefaultType();
+ value = ((EdmPrimitiveType) typeInfo.getType()).valueOfString(stringValue, true, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, true,
+ returnType);
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return value;
+ }
+
+ private Object fromComplexOrEnum(final XMLEventReader reader, final StartElement start)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+
+ Object value = null;
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ if (value == null) {
+ value = new ComplexValue();
+ }
+
+ if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
+ final Link link = new Link();
+ final Attribute rel = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REL));
+ if (rel != null) {
+ link.setRel(rel.getValue());
+ }
+ final Attribute title = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TITLE));
+ if (title != null) {
+ link.setTitle(title.getValue());
+ }
+ final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
+ if (href != null) {
+ link.setHref(href.getValue());
+ }
+ final Attribute type = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TYPE));
+ if (type != null) {
+ link.setType(type.getValue());
+ }
+
+ if (link.getRel().startsWith(Constants.NS_NAVIGATION_LINK_REL)) {
+
+ ((ComplexValue) value).getNavigationLinks().add(link);
+ inline(reader, event.asStartElement(), link);
+ } else if (link.getRel().startsWith(Constants.NS_ASSOCIATION_LINK_REL)) {
+
+ ((Valuable) value).asComplex().getAssociationLinks().add(link);
+ }
+ } else {
+ ((ComplexValue) value).getValue().add(property(reader, event.asStartElement()));
+ }
+ }
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ value = event.asCharacters().getData();
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return value;
+ }
+
+ private void fromCollection(final Valuable valuable, final XMLEventReader reader, final StartElement start,
+ final EdmTypeInfo typeInfo) throws XMLStreamException, EdmPrimitiveTypeException {
+
+ List<Object> values = new ArrayList<Object>();
+ ValueType valueType = ValueType.COLLECTION_PRIMITIVE;
+
+ final EdmTypeInfo type = typeInfo == null ? null :
+ new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ switch (guessPropertyType(reader, typeInfo)) {
+ case COMPLEX:
+ final Object complexValue = fromComplexOrEnum(reader, event.asStartElement());
+ valueType = ValueType.COLLECTION_COMPLEX;
+ values.add(complexValue);
+ break;
+
+ case ENUM:
+ valueType = ValueType.COLLECTION_ENUM;
+ values.add(fromComplexOrEnum(reader, event.asStartElement()));
+ break;
+
+ case PRIMITIVE:
+ final Object value = fromPrimitive(reader, event.asStartElement(), type);
+ valueType = value instanceof Geospatial ?
+ ValueType.COLLECTION_GEOSPATIAL : ValueType.COLLECTION_PRIMITIVE;
+ values.add(value);
+ break;
+
+ default:
+ // do not add null or empty values
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+ valuable.setValue(valueType, values);
+ }
+
+ private PropertyType guessPropertyType(final XMLEventReader reader, final EdmTypeInfo typeInfo)
+ throws XMLStreamException {
+
+ XMLEvent child = null;
+ while (reader.hasNext() && child == null) {
+ final XMLEvent event = reader.peek();
+ if (event.isCharacters() && event.asCharacters().isWhiteSpace()) {
+ reader.nextEvent();
+ } else {
+ child = event;
+ }
+ }
+
+ final PropertyType type;
+ if (child == null) {
+ type = typeInfo == null || typeInfo.isPrimitiveType() ? PropertyType.PRIMITIVE : PropertyType.ENUM;
+ } else {
+ if (child.isStartElement()) {
+ if (Constants.NS_GML.equals(child.asStartElement().getName().getNamespaceURI())) {
+ type = PropertyType.PRIMITIVE;
+ } else if (elementQName.equals(child.asStartElement().getName())) {
+ type = PropertyType.COLLECTION;
+ } else {
+ type = PropertyType.COMPLEX;
+ }
+ } else if (child.isCharacters()) {
+ type = typeInfo == null || typeInfo.isPrimitiveType()
+ ? PropertyType.PRIMITIVE
+ : PropertyType.ENUM;
+ } else {
+ type = PropertyType.EMPTY;
+ }
+ }
+
+ return type;
+ }
+
+ private Property property(final XMLEventReader reader, final StartElement start)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+
+ final Property property = new Property();
+
+ if (propertyValueQName.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());
+ }
+
+ valuable(property, reader, start);
+
+ return property;
+ }
+
+ private void valuable(final Valuable valuable, final XMLEventReader reader, final StartElement start)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+
+ final Attribute nullAttr = start.getAttributeByName(nullQName);
+
+ final Attribute typeAttr = start.getAttributeByName(typeQName);
+ final String typeAttrValue = typeAttr == null ? null : typeAttr.getValue();
+
+ final EdmTypeInfo typeInfo = StringUtils.isBlank(typeAttrValue) ? null :
+ new EdmTypeInfo.Builder().setTypeExpression(typeAttrValue).build();
+
+ if (typeInfo != null) {
+ valuable.setType(typeInfo.internal());
+ }
+
+ final PropertyType propType = typeInfo == null ? guessPropertyType(reader, typeInfo) :
+ typeInfo.isCollection() ? PropertyType.COLLECTION :
+ typeInfo.isPrimitiveType() ? PropertyType.PRIMITIVE : PropertyType.COMPLEX;
+
+ if (nullAttr == null) {
+ switch (propType) {
+ case COLLECTION:
+ fromCollection(valuable, reader, start, typeInfo);
+ break;
+
+ case COMPLEX:
+ final Object complexValue = fromComplexOrEnum(reader, start);
+ valuable.setValue(complexValue instanceof ComplexValue ? ValueType.COMPLEX : ValueType.ENUM,
+ complexValue);
+ break;
+
+ case PRIMITIVE:
+ // No type specified? Defaults to Edm.String
+ if (typeInfo == null) {
+ valuable.setType(EdmPrimitiveTypeKind.String.getFullQualifiedName().toString());
+ }
+ final Object value = fromPrimitive(reader, start, typeInfo);
+ valuable.setValue(value instanceof Geospatial ? ValueType.GEOSPATIAL : ValueType.PRIMITIVE, value);
+ break;
+
+ case EMPTY:
+ default:
+ valuable.setValue(ValueType.PRIMITIVE, StringUtils.EMPTY);
+ }
+ } else {
+ valuable.setValue(propType == PropertyType.PRIMITIVE ? ValueType.PRIMITIVE :
+ propType == PropertyType.ENUM ? ValueType.ENUM :
+ propType == PropertyType.COMPLEX ? ValueType.COMPLEX :
+ propType == PropertyType.COLLECTION ? ValueType.COLLECTION_PRIMITIVE : ValueType.PRIMITIVE,
+ null);
+ }
+ }
+
+ @Override
+ public ResWrap<Property> toProperty(final InputStream input) throws ODataDeserializerException {
+ try {
+ final XMLEventReader reader = getReader(input);
+ final StartElement start = skipBeforeFirstStartElement(reader);
+ return getContainer(start, property(reader, start));
+ } catch (XMLStreamException e) {
+ throw new ODataDeserializerException(e);
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new ODataDeserializerException(e);
+ }
+ }
+
+ private StartElement skipBeforeFirstStartElement(final XMLEventReader reader) throws XMLStreamException {
+ StartElement startEvent = null;
+ while (reader.hasNext() && startEvent == null) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.isStartElement()) {
+ startEvent = event.asStartElement();
+ }
+ }
+ if (startEvent == null) {
+ throw new IllegalArgumentException("Cannot find any XML start element");
+ }
+
+ return startEvent;
+ }
+
+ private void common(final XMLEventReader reader, final StartElement start,
+ final AbstractODataObject object, final String key) throws XMLStreamException {
+
+ boolean foundEndElement = false;
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ try {
+ object.setCommonProperty(key, event.asCharacters().getData());
+ } catch (ParseException e) {
+ throw new XMLStreamException("While parsing Atom entry or feed common elements", e);
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+ }
+
+ private void inline(final XMLEventReader reader, final StartElement start, final Link link)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+
+ boolean foundEndElement = false;
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ if (inlineQName.equals(event.asStartElement().getName())) {
+ StartElement inline = getStartElement(reader);
+ if (inline != null) {
+ if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(inline.getName())) {
+ link.setInlineEntity(entity(reader, inline));
+ }
+ if (Constants.QNAME_ATOM_ELEM_FEED.equals(inline.getName())) {
+ link.setInlineEntitySet(entitySet(reader, inline));
+ }
+ }
+ } else if (annotationQName.equals(event.asStartElement().getName())) {
+ link.getAnnotations().add(annotation(reader, event.asStartElement()));
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+ }
+
+ private StartElement getStartElement(final XMLEventReader reader) throws XMLStreamException {
+ while (reader.hasNext()) {
+ final XMLEvent innerEvent = reader.peek();
+ if (innerEvent.isCharacters() && innerEvent.asCharacters().isWhiteSpace()) {
+ reader.nextEvent();
+ } else if (innerEvent.isStartElement()) {
+ return innerEvent.asStartElement();
+ } else if (innerEvent.isEndElement() && inlineQName.equals(innerEvent.asEndElement().getName())) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public ResWrap<Delta> delta(final InputStream input)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ final XMLEventReader reader = getReader(input);
+ final StartElement start = skipBeforeFirstStartElement(reader);
+ return getContainer(start, delta(reader, start));
+ }
+
+ private Delta delta(final XMLEventReader reader, final StartElement start)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ if (!Constants.QNAME_ATOM_ELEM_FEED.equals(start.getName())) {
+ return null;
+ }
+ final Delta delta = new Delta();
+ final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
+ if (xmlBase != null) {
+ delta.setBaseURI(URI.create(xmlBase.getValue()));
+ }
+
+ boolean foundEndFeed = false;
+ while (reader.hasNext() && !foundEndFeed) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.isStartElement()) {
+ if (countQName.equals(event.asStartElement().getName())) {
+ count(reader, event.asStartElement(), delta);
+ } else if (Constants.QNAME_ATOM_ELEM_ID.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), delta, "id");
+ } else if (Constants.QNAME_ATOM_ELEM_TITLE.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), delta, "title");
+ } else if (Constants.QNAME_ATOM_ELEM_SUMMARY.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), delta, "summary");
+ } else if (Constants.QNAME_ATOM_ELEM_UPDATED.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), delta, "updated");
+ } else if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
+ final Attribute rel = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REL));
+ if (rel != null) {
+ if (Constants.NEXT_LINK_REL.equals(rel.getValue())) {
+ final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
+ if (href != null) {
+ delta.setNext(URI.create(href.getValue()));
+ }
+ }
+ if (Constants.NS_DELTA_LINK_REL.equals(rel.getValue())) {
+ final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
+ if (href != null) {
+ delta.setDeltaLink(URI.create(href.getValue()));
+ }
+ }
+ }
+ } else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(event.asStartElement().getName())) {
+ delta.getEntities().add(entity(reader, event.asStartElement()));
+ } else if (deletedEntryQName.equals(event.asStartElement().getName())) {
+ final DeletedEntity deletedEntity = new DeletedEntity();
+
+ final Attribute ref = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REF));
+ if (ref != null) {
+ deletedEntity.setId(URI.create(ref.getValue()));
+ }
+ final Attribute reason = event.asStartElement().getAttributeByName(reasonQName);
+ if (reason != null) {
+ deletedEntity.setReason(Reason.valueOf(reason.getValue()));
+ }
+
+ delta.getDeletedEntities().add(deletedEntity);
+ } else if (linkQName.equals(event.asStartElement().getName())
+ || deletedLinkQName.equals(event.asStartElement().getName())) {
+
+ final DeltaLink link = new DeltaLink();
+
+ final Attribute source = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_SOURCE));
+ if (source != null) {
+ link.setSource(URI.create(source.getValue()));
+ }
+ final Attribute relationship =
+ event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_RELATIONSHIP));
+ if (relationship != null) {
+ link.setRelationship(relationship.getValue());
+ }
+ final Attribute target = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TARGET));
+ if (target != null) {
+ link.setTarget(URI.create(target.getValue()));
+ }
+
+ if (linkQName.equals(event.asStartElement().getName())) {
+ delta.getAddedLinks().add(link);
+ } else {
+ delta.getDeletedLinks().add(link);
+ }
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndFeed = true;
+ }
+ }
+
+ return delta;
+ }
+
+ private void properties(final XMLEventReader reader, final StartElement start, final Entity entity)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+
+ final Map<String, List<Annotation>> annotations = new HashMap<String, List<Annotation>>();
+
+ boolean foundEndProperties = false;
+ while (reader.hasNext() && !foundEndProperties) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ if (annotationQName.equals(event.asStartElement().getName())) {
+ final String target = event.asStartElement().
+ getAttributeByName(QName.valueOf(Constants.ATTR_TARGET)).getValue();
+ if (!annotations.containsKey(target)) {
+ annotations.put(target, new ArrayList<Annotation>());
+ }
+ annotations.get(target).add(annotation(reader, event.asStartElement()));
+ } else {
+ entity.getProperties().add(property(reader, event.asStartElement()));
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperties = true;
+ }
+ }
+
+ for (Property property : entity.getProperties()) {
+ if (annotations.containsKey(property.getName())) {
+ property.getAnnotations().addAll(annotations.get(property.getName()));
+ }
+ }
+ }
+
+ private Annotation annotation(final XMLEventReader reader, final StartElement start)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+
+ final Annotation annotation = new Annotation();
+
+ annotation.setTerm(start.getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_TERM)).getValue());
+ valuable(annotation, reader, start);
+
+ return annotation;
+ }
+
+ private Entity entityRef(final StartElement start) throws XMLStreamException {
+ final Entity entity = new Entity();
+
+ final Attribute entityRefId = start.getAttributeByName(Constants.QNAME_ATOM_ATTR_ID);
+ if (entityRefId != null) {
+ entity.setId(URI.create(entityRefId.getValue()));
+ }
+
+ return entity;
+ }
+
+ private Entity entity(final XMLEventReader reader, final StartElement start)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ final Entity entity;
+ if (entryRefQName.equals(start.getName())) {
+ entity = entityRef(start);
+ } else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(start.getName())) {
+ entity = new Entity();
+ final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
+ if (xmlBase != null) {
+ entity.setBaseURI(URI.create(xmlBase.getValue()));
+ }
+
+ final Attribute etag = start.getAttributeByName(etagQName);
+ if (etag != null) {
+ entity.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(), entity, "id");
+ } else if (Constants.QNAME_ATOM_ELEM_TITLE.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entity, "title");
+ } else if (Constants.QNAME_ATOM_ELEM_SUMMARY.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entity, "summary");
+ } else if (Constants.QNAME_ATOM_ELEM_UPDATED.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entity, "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) {
+ entity.setType(new EdmTypeInfo.Builder().setTypeExpression(term.getValue()).build().internal());
+ }
+ } else if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
+ final Link link = new Link();
+ 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())) {
+ entity.setSelfLink(link);
+ } else if (Constants.EDIT_LINK_REL.equals(link.getRel())) {
+ entity.setEditLink(link);
+ } else if (Constants.EDITMEDIA_LINK_REL.equals(link.getRel())) {
+ final Attribute mediaETag = event.asStartElement().getAttributeByName(etagQName);
+ if (mediaETag != null) {
+ entity.setMediaETag(mediaETag.getValue());
+ }
+ } else if (link.getRel().startsWith(Constants.NS_NAVIGATION_LINK_REL)) {
+ entity.getNavigationLinks().add(link);
+ inline(reader, event.asStartElement(), link);
+ } else if (link.getRel().startsWith(Constants.NS_ASSOCIATION_LINK_REL)) {
+ entity.getAssociationLinks().add(link);
+ } else if (link.getRel().startsWith(Constants.NS_MEDIA_EDIT_LINK_REL)) {
+
+ final Attribute metag = event.asStartElement().getAttributeByName(etagQName);
+ if (metag != null) {
+ link.setMediaETag(metag.getValue());
+ }
+ entity.getMediaEditLinks().add(link);
+ }
+ } else if (actionQName.equals(event.asStartElement().getName())) {
+ final Operation operation = new Operation();
+ 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()));
+ }
+
+ entity.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.toContentTypeString().equals(type.getValue())) {
+ properties(reader, skipBeforeFirstStartElement(reader), entity);
+ } else {
+ entity.setMediaContentType(type.getValue());
+ final Attribute src = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_SRC));
+ if (src != null) {
+ entity.setMediaContentSource(URI.create(src.getValue()));
+ }
+ }
+ } else if (propertiesQName.equals(event.asStartElement().getName())) {
+ properties(reader, event.asStartElement(), entity);
+ } else if (annotationQName.equals(event.asStartElement().getName())) {
+ entity.getAnnotations().add(annotation(reader, event.asStartElement()));
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndEntry = true;
+ }
+ }
+ } else {
+ entity = null;
+ }
+
+ return entity;
+ }
+
+ @Override
+ public ResWrap<Entity> toEntity(final InputStream input) throws ODataDeserializerException {
+ try {
+ final XMLEventReader reader = getReader(input);
+ final StartElement start = skipBeforeFirstStartElement(reader);
+ final Entity entity = entity(reader, start);
+ if (entity == null) {
+ throw new ODataDeserializerException("No entity found!");
+ } else {
+ return getContainer(start, entity);
+ }
+ } catch (XMLStreamException e) {
+ throw new ODataDeserializerException(e);
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new ODataDeserializerException(e);
+ }
+ }
+
+ private void count(final XMLEventReader reader, final StartElement start, final EntityCollection entitySet)
+ throws XMLStreamException {
+
+ boolean foundEndElement = false;
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ entitySet.setCount(Integer.valueOf(event.asCharacters().getData()));
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+ }
+
+ private EntityCollection entitySet(final XMLEventReader reader, final StartElement start)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ if (!Constants.QNAME_ATOM_ELEM_FEED.equals(start.getName())) {
+ return null;
+ }
+ final EntityCollection entitySet = new EntityCollection();
+ final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
+ if (xmlBase != null) {
+ entitySet.setBaseURI(URI.create(xmlBase.getValue()));
+ }
+
+ boolean foundEndFeed = false;
+ while (reader.hasNext() && !foundEndFeed) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.isStartElement()) {
+ if (countQName.equals(event.asStartElement().getName())) {
+ count(reader, event.asStartElement(), entitySet);
+ } else if (Constants.QNAME_ATOM_ELEM_ID.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entitySet, "id");
+ } else if (Constants.QNAME_ATOM_ELEM_TITLE.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entitySet, "title");
+ } else if (Constants.QNAME_ATOM_ELEM_SUMMARY.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entitySet, "summary");
+ } else if (Constants.QNAME_ATOM_ELEM_UPDATED.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entitySet, "updated");
+ } else if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
+ final Attribute rel = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REL));
+ if (rel != null) {
+ if (Constants.NEXT_LINK_REL.equals(rel.getValue())) {
+ final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
+ if (href != null) {
+ entitySet.setNext(URI.create(href.getValue()));
+ }
+ }
+ if (Constants.NS_DELTA_LINK_REL.equals(rel.getValue())) {
+ final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
+ if (href != null) {
+ entitySet.setDeltaLink(URI.create(href.getValue()));
+ }
+ }
+ }
+ } else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(event.asStartElement().getName())) {
+ entitySet.getEntities().add(entity(reader, event.asStartElement()));
+ } else if (entryRefQName.equals(event.asStartElement().getName())) {
+ entitySet.getEntities().add(entityRef(event.asStartElement()));
+ } else if (annotationQName.equals(event.asStartElement().getName())) {
+ entitySet.getAnnotations().add(annotation(reader, event.asStartElement()));
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndFeed = true;
+ }
+ }
+
+ return entitySet;
+ }
+
+ @Override
+ public ResWrap<EntityCollection> toEntitySet(final InputStream input) throws ODataDeserializerException {
+ try {
+ final XMLEventReader reader = getReader(input);
+ final StartElement start = skipBeforeFirstStartElement(reader);
+ return getContainer(start, entitySet(reader, start));
+ } catch (XMLStreamException e) {
+ throw new ODataDeserializerException(e);
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new ODataDeserializerException(e);
+ }
+ }
+
+ private ODataError error(final XMLEventReader reader, final StartElement start) throws XMLStreamException {
+ final ODataError error = new ODataError();
+
+ 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;
+ }
+
+ @Override
+ public ODataError toError(final InputStream input) throws ODataDeserializerException {
+ try {
+ final XMLEventReader reader = getReader(input);
+ final StartElement start = skipBeforeFirstStartElement(reader);
+ return error(reader, start);
+ } catch (XMLStreamException e) {
+ throw new ODataDeserializerException(e);
+ }
+ }
+
+ private <T> ResWrap<T> getContainer(final StartElement start, final T object) {
+ final Attribute context = start.getAttributeByName(contextQName);
+ final Attribute metadataETag = start.getAttributeByName(metadataEtagQName);
+
+ return new ResWrap<T>(
+ context == null ? null : URI.create(context.getValue()),
+ metadataETag == null ? null : metadataETag.getValue(),
+ object);
+ }
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomGeoValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomGeoValueDeserializer.java
new file mode 100644
index 0000000..38add8d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomGeoValueDeserializer.java
@@ -0,0 +1,269 @@
+/*
+ * 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.serialization;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.GeoUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+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.geo.SRID;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
+
+class AtomGeoValueDeserializer {
+
+ private List<Point> points(final XMLEventReader reader, final StartElement start,
+ final EdmPrimitiveTypeKind type, final SRID srid) throws XMLStreamException {
+
+ final List<Point> result = new ArrayList<Point>();
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ final String[] pointInfo = event.asCharacters().getData().split(" ");
+
+ 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));
+ point.setY(EdmDouble.getInstance().valueOfString(pointInfo[1], null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
+ } catch (EdmPrimitiveTypeException e) {
+ throw new XMLStreamException("While deserializing point coordinates as double", e);
+ }
+ result.add(point);
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ // handles bad input, e.g. things like <gml:pos/>
+ if (result.isEmpty()) {
+ result.add(new Point(GeoUtils.getDimension(type), srid));
+ }
+
+ return result;
+ }
+
+ private MultiPoint multipoint(final XMLEventReader reader, final StartElement start,
+ final EdmPrimitiveTypeKind type, final SRID srid) throws XMLStreamException {
+
+ List<Point> points = Collections.<Point> emptyList();
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_POINTMEMBERS)) {
+ points = points(reader, event.asStartElement(), type, null);
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return new MultiPoint(GeoUtils.getDimension(type), srid, points);
+ }
+
+ private LineString lineString(final XMLEventReader reader, final StartElement start,
+ final EdmPrimitiveTypeKind type, final SRID srid) throws XMLStreamException {
+
+ 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 SRID srid) throws XMLStreamException {
+
+ List<Point> extPoints = null;
+ List<Point> intPoints = null;
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ if (event.asStartElement().getName().equals(Constants.QNAME_POLYGON_EXTERIOR)) {
+ extPoints = points(reader, event.asStartElement(), type, null);
+ }
+ if (event.asStartElement().getName().equals(Constants.QNAME_POLYGON_INTERIOR)) {
+ intPoints = points(reader, event.asStartElement(), type, null);
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return new Polygon(GeoUtils.getDimension(type), srid, intPoints, extPoints);
+ }
+
+ private MultiLineString multiLineString(final XMLEventReader reader, final StartElement start,
+ final EdmPrimitiveTypeKind type, final SRID srid) throws XMLStreamException {
+
+ final List<LineString> lineStrings = new ArrayList<LineString>();
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_LINESTRING)) {
+ lineStrings.add(lineString(reader, event.asStartElement(), type, null));
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return new MultiLineString(GeoUtils.getDimension(type), srid, lineStrings);
+ }
+
+ private MultiPolygon multiPolygon(final XMLEventReader reader, final StartElement start,
+ final EdmPrimitiveTypeKind type, final SRID srid) throws XMLStreamException {
+
+ final List<Polygon> polygons = new ArrayList<Polygon>();
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_POLYGON)) {
+ polygons.add(polygon(reader, event.asStartElement(), type, null));
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+
+ return new MultiPolygon(GeoUtils.getDimension(type), srid, polygons);
+ }
+
+ private GeospatialCollection collection(final XMLEventReader reader, final StartElement start,
+ final EdmPrimitiveTypeKind type, final SRID srid) throws XMLStreamException {
+
+ final List<Geospatial> geospatials = new ArrayList<Geospatial>();
+
+ boolean foundEndCollection = false;
+ while (reader.hasNext() && !foundEndCollection) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_GEOMEMBERS)) {
+ boolean foundEndMembers = false;
+ while (reader.hasNext() && !foundEndMembers) {
+ final XMLEvent subevent = reader.nextEvent();
+
+ if (subevent.isStartElement()) {
+ geospatials.add(deserialize(reader, subevent.asStartElement(),
+ GeoUtils.getType(GeoUtils.getDimension(type), subevent.asStartElement().getName().getLocalPart())));
+ }
+
+ if (subevent.isEndElement() && Constants.QNAME_GEOMEMBERS.equals(subevent.asEndElement().getName())) {
+ foundEndMembers = true;
+ }
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndCollection = true;
+ }
+ }
+
+ return new GeospatialCollection(GeoUtils.getDimension(type), srid, geospatials);
+ }
+
+ public Geospatial deserialize(final XMLEventReader reader, final StartElement start,
+ final EdmPrimitiveTypeKind type) throws XMLStreamException {
+
+ SRID srid = null;
+ final Attribute srsName = start.getAttributeByName(Constants.QNAME_ATTR_SRSNAME);
+ if (srsName != null) {
+ srid = SRID.valueOf(StringUtils.substringAfterLast(srsName.getValue(), "/"));
+ }
+
+ Geospatial value;
+
+ switch (type) {
+ case GeographyPoint:
+ case GeometryPoint:
+ value = points(reader, start, type, srid).get(0);
+ break;
+
+ case GeographyMultiPoint:
+ case GeometryMultiPoint:
+ value = multipoint(reader, start, type, srid);
+ break;
+
+ case GeographyLineString:
+ case GeometryLineString:
+ value = lineString(reader, start, type, srid);
+ break;
+
+ case GeographyMultiLineString:
+ case GeometryMultiLineString:
+ value = multiLineString(reader, start, type, srid);
+ break;
+
+ case GeographyPolygon:
+ case GeometryPolygon:
+ value = polygon(reader, start, type, srid);
+ break;
+
+ case GeographyMultiPolygon:
+ case GeometryMultiPolygon:
+ value = multiPolygon(reader, start, type, srid);
+ break;
+
+ case GeographyCollection:
+ case GeometryCollection:
+ value = collection(reader, start, type, srid);
+ break;
+
+ default:
+ value = null;
+ }
+
+ return value;
+ }
+
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomGeoValueSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomGeoValueSerializer.java
new file mode 100644
index 0000000..1030597
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomGeoValueSerializer.java
@@ -0,0 +1,223 @@
+/*
+ * 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.serialization;
+
+import java.util.Collections;
+import java.util.Iterator;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.olingo.commons.api.Constants;
+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.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.core.edm.primitivetype.EdmDouble;
+
+class AtomGeoValueSerializer {
+
+ private void points(final XMLStreamWriter writer, final Iterator<Point> itor, final boolean wrap)
+ throws XMLStreamException {
+
+ while (itor.hasNext()) {
+ final Point point = itor.next();
+
+ if (wrap) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POINT, Constants.NS_GML);
+ }
+
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POS, Constants.NS_GML);
+ try {
+ writer.writeCharacters(EdmDouble.getInstance().valueToString(point.getX(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ + " "
+ + EdmDouble.getInstance().valueToString(point.getY(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
+ } catch (EdmPrimitiveTypeException e) {
+ throw new XMLStreamException("While serializing point coordinates as double", e);
+ }
+ writer.writeEndElement();
+
+ if (wrap) {
+ writer.writeEndElement();
+ }
+ }
+ }
+
+ private void lineStrings(final XMLStreamWriter writer, final Iterator<LineString> itor, final boolean wrap)
+ throws XMLStreamException {
+
+ while (itor.hasNext()) {
+ final LineString lineString = itor.next();
+
+ if (wrap) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_LINESTRING, Constants.NS_GML);
+ }
+
+ points(writer, lineString.iterator(), false);
+
+ if (wrap) {
+ writer.writeEndElement();
+ }
+ }
+ }
+
+ private void polygons(final XMLStreamWriter writer, final Iterator<Polygon> itor, final boolean wrap)
+ throws XMLStreamException {
+
+ while (itor.hasNext()) {
+ final Polygon polygon = itor.next();
+
+ if (wrap) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON, Constants.NS_GML);
+ }
+
+ if (!polygon.getExterior().isEmpty()) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_EXTERIOR, Constants.NS_GML);
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_LINEARRING, Constants.NS_GML);
+
+ points(writer, polygon.getExterior().iterator(), false);
+
+ writer.writeEndElement();
+ writer.writeEndElement();
+ }
+ if (!polygon.getInterior().isEmpty()) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_INTERIOR, Constants.NS_GML);
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_LINEARRING, Constants.NS_GML);
+
+ points(writer, polygon.getInterior().iterator(), false);
+
+ writer.writeEndElement();
+ writer.writeEndElement();
+ }
+
+ if (wrap) {
+ writer.writeEndElement();
+ }
+ }
+ }
+
+ private void writeSrsName(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException {
+ if (value.getSrid() != null && value.getSrid().isNotDefault()) {
+ writer.writeAttribute(Constants.PREFIX_GML, Constants.NS_GML, Constants.ATTR_SRSNAME,
+ Constants.SRS_URLPREFIX + value.getSrid().toString());
+ }
+ }
+
+ public void serialize(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException {
+ switch (value.getEdmPrimitiveTypeKind()) {
+ case GeographyPoint:
+ case GeometryPoint:
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POINT, Constants.NS_GML);
+ writeSrsName(writer, value);
+
+ points(writer, Collections.singleton((Point) value).iterator(), false);
+
+ writer.writeEndElement();
+ break;
+
+ case GeometryMultiPoint:
+ case GeographyMultiPoint:
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_MULTIPOINT, Constants.NS_GML);
+ writeSrsName(writer, value);
+
+ if (!((MultiPoint) value).isEmpty()) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POINTMEMBERS, Constants.NS_GML);
+ points(writer, ((MultiPoint) value).iterator(), true);
+ writer.writeEndElement();
+ }
+
+ writer.writeEndElement();
+ break;
+
+ case GeometryLineString:
+ case GeographyLineString:
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_LINESTRING, Constants.NS_GML);
+ writeSrsName(writer, value);
+
+ lineStrings(writer, Collections.singleton((LineString) value).iterator(), false);
+
+ writer.writeEndElement();
+ break;
+
+ case GeometryMultiLineString:
+ case GeographyMultiLineString:
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_MULTILINESTRING, Constants.NS_GML);
+ writeSrsName(writer, value);
+
+ if (!((MultiLineString) value).isEmpty()) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_LINESTRINGMEMBERS, Constants.NS_GML);
+ lineStrings(writer, ((MultiLineString) value).iterator(), true);
+ writer.writeEndElement();
+ }
+
+ writer.writeEndElement();
+ break;
+
+ case GeographyPolygon:
+ case GeometryPolygon:
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON, Constants.NS_GML);
+ writeSrsName(writer, value);
+
+ polygons(writer, Collections.singleton(((Polygon) value)).iterator(), false);
+
+ writer.writeEndElement();
+ break;
+
+ case GeographyMultiPolygon:
+ case GeometryMultiPolygon:
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_MULTIPOLYGON, Constants.NS_GML);
+ writeSrsName(writer, value);
+
+ if (!((MultiPolygon) value).isEmpty()) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_SURFACEMEMBERS, Constants.NS_GML);
+ polygons(writer, ((MultiPolygon) value).iterator(), true);
+ writer.writeEndElement();
+ }
+
+ writer.writeEndElement();
+ break;
+
+ case GeographyCollection:
+ case GeometryCollection:
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_GEOCOLLECTION, Constants.NS_GML);
+ writeSrsName(writer, value);
+
+ if (!((GeospatialCollection) value).isEmpty()) {
+ writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_GEOMEMBERS, Constants.NS_GML);
+ for (Geospatial geospatial : ((GeospatialCollection) value)) {
+ serialize(writer, geospatial);
+ }
+ writer.writeEndElement();
+ }
+
+ writer.writeEndElement();
+ break;
+
+ default:
+ }
+ }
+
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomSerializer.java
new file mode 100644
index 0000000..0f6555a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/AtomSerializer.java
@@ -0,0 +1,682 @@
+/*
+ * 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.serialization;
+
+import java.io.Writer;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.XMLConstants;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.serialization.ODataSerializer;
+import org.apache.olingo.client.api.serialization.ODataSerializerException;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
+import org.apache.olingo.commons.api.data.AbstractODataObject;
+import org.apache.olingo.commons.api.data.Annotation;
+import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Operation;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+import com.fasterxml.aalto.stax.OutputFactoryImpl;
+
+public class AtomSerializer extends AbstractAtomDealer implements ODataSerializer {
+
+ private static final XMLOutputFactory FACTORY = new OutputFactoryImpl();
+
+ private final AtomGeoValueSerializer geoSerializer;
+
+ private final boolean serverMode;
+
+ public AtomSerializer() {
+ this(false);
+ }
+
+ public AtomSerializer(final boolean serverMode) {
+ geoSerializer = new AtomGeoValueSerializer();
+ this.serverMode = serverMode;
+ }
+
+ private void collection(final XMLStreamWriter writer,
+ final ValueType valueType, final EdmPrimitiveTypeKind kind, final List<?> value)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ for (Object item : value) {
+ writer.writeStartElement(Constants.PREFIX_METADATA, Constants.ELEM_ELEMENT, namespaceMetadata);
+ value(writer, valueType, kind, item);
+ writer.writeEndElement();
+ }
+ }
+
+ private void value(final XMLStreamWriter writer,
+ final ValueType valueType, final EdmPrimitiveTypeKind kind, final Object value)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ if (value == null || (valueType == ValueType.COMPLEX && ((ComplexValue)value).getValue().isEmpty())) {
+ writer.writeAttribute(Constants.PREFIX_METADATA, namespaceMetadata,
+ Constants.ATTR_NULL, Boolean.TRUE.toString());
+ return;
+ }
+ switch (valueType) {
+ case PRIMITIVE:
+ writer.writeCharacters(kind == null ? value.toString() :
+ EdmPrimitiveTypeFactory.getInstance(kind) // TODO: add facets
+ .valueToString(value, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
+ break;
+ case ENUM:
+ writer.writeCharacters(value.toString());
+ break;
+ case GEOSPATIAL:
+ geoSerializer.serialize(writer, (Geospatial) value);
+ break;
+ case COLLECTION_PRIMITIVE:
+ case COLLECTION_GEOSPATIAL:
+ case COLLECTION_ENUM:
+ case COLLECTION_COMPLEX:
+ collection(writer, valueType.getBaseType(), kind, (List<?>) value);
+ break;
+ case COMPLEX:
+ for (Property property : ((ComplexValue) value).getValue()) {
+ property(writer, property, false);
+ }
+ break;
+ case ENTITY:
+ case COLLECTION_ENTITY:
+ throw new ODataRuntimeException("Entities cannot appear in this payload");
+ }
+ }
+
+ public void property(final XMLStreamWriter writer, final Property property, final boolean standalone)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+
+ if (standalone) {
+ writer.writeStartElement(Constants.PREFIX_METADATA, Constants.VALUE, namespaceData);
+ namespaces(writer);
+ } else {
+ writer.writeStartElement(Constants.PREFIX_DATASERVICES, property.getName(), namespaceData);
+ }
+
+ EdmTypeInfo typeInfo = null;
+ if (StringUtils.isNotBlank(property.getType())) {
+ typeInfo = new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
+ if (!EdmPrimitiveTypeKind.String.getFullQualifiedName().toString().equals(typeInfo.internal())) {
+ writer.writeAttribute(Constants.PREFIX_METADATA, namespaceMetadata,
+ Constants.ATTR_TYPE, typeInfo.external());
+ }
+ }
+
+ value(writer, property.getValueType(), typeInfo == null ? null : typeInfo.getPrimitiveTypeKind(),
+ property.getValue());
+ if (!property.isNull() && property.isComplex() && !property.isCollection()) {
+ links(writer, property.asComplex().getAssociationLinks());
+ if (serverMode) {
+ links(writer, property.asComplex().getNavigationLinks());
+ } else {
+ writeNavigationLinks(writer, property.asComplex().getNavigationLinks());
+ }
+ }
+
+ writer.writeEndElement();
+
+ for (Annotation annotation : property.getAnnotations()) {
+ annotation(writer, annotation, property.getName());
+ }
+ }
+
+ private void property(final XMLStreamWriter writer, final Property property)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ property(writer, property, true);
+ }
+
+ private void startDocument(final XMLStreamWriter writer, final String rootElement) throws XMLStreamException {
+ writer.writeStartDocument();
+ writer.setDefaultNamespace(Constants.NS_ATOM);
+ writer.writeStartElement(rootElement);
+
+ namespaces(writer);
+ }
+
+ private void property(final Writer outWriter, final Property property)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
+
+ writer.writeStartDocument();
+
+ property(writer, property);
+
+ writer.writeEndDocument();
+ writer.flush();
+ }
+
+ private boolean isEntitySetNavigation(final Link link) {
+ return Constants.ENTITY_SET_NAVIGATION_LINK_TYPE.equals(link.getType());
+ }
+
+ private void writeNavigationLinks(final XMLStreamWriter writer, final List<Link> links)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ final Map<String, List<String>> entitySetLinks = new HashMap<String, List<String>>();
+
+ for (Link link : links) {
+
+ if (link.getInlineEntity() != null || link.getInlineEntitySet() != null) {
+ writeLink(writer, link, new ExtraContent() {
+ @Override
+ public void write(XMLStreamWriter writer, Link link) throws XMLStreamException, EdmPrimitiveTypeException {
+ writer.writeStartElement(Constants.PREFIX_METADATA, Constants.ATOM_ELEM_INLINE, namespaceMetadata);
+ if (link.getInlineEntity() != null) {
+ writer.writeStartElement(namespaceAtom, Constants.ATOM_ELEM_ENTRY);
+ entity(writer, link.getInlineEntity());
+ writer.writeEndElement();
+ }
+ if (link.getInlineEntitySet() != null) {
+ writer.writeStartElement(namespaceAtom, Constants.ATOM_ELEM_FEED);
+ entitySet(writer, link.getInlineEntitySet());
+ writer.writeEndElement();
+ }
+ writer.writeEndElement(); // inline
+ }
+ });
+
+ } else if (link.getBindingLink() != null) {
+ writeLink(writer, link, new ExtraContent() {
+ @Override
+ public void write(XMLStreamWriter writer, Link link) throws XMLStreamException, EdmPrimitiveTypeException {
+ writer.writeAttribute(Constants.ATTR_HREF, link.getBindingLink());
+ }
+ });
+ } else if (link.getBindingLinks() != null && !link.getBindingLinks().isEmpty()) {
+ writeLink(writer, link, new ExtraContent() {
+ @Override
+ public void write(XMLStreamWriter writer, Link link) throws XMLStreamException, EdmPrimitiveTypeException {
+ writer.writeStartElement(Constants.PREFIX_METADATA, Constants.ATOM_ELEM_INLINE, namespaceMetadata);
+ writer.writeStartElement(namespaceAtom, Constants.ATOM_ELEM_FEED);
+ for (String binding:link.getBindingLinks()) {
+ Entity entity = new Entity();
+ entity.setId(URI.create(binding));
+ inlineEntityRef(writer, entity);
+ }
+ writer.writeEndElement(); //feed
+ writer.writeEndElement(); //inline
+ }
+ });
+ } else {
+ if (isEntitySetNavigation(link)) {
+ final List<String> uris;
+ if (entitySetLinks.containsKey(link.getTitle())) {
+ uris = entitySetLinks.get(link.getTitle());
+ } else {
+ uris = new ArrayList<String>();
+ entitySetLinks.put(link.getTitle(), uris);
+ }
+ if (StringUtils.isNotBlank(link.getHref())) {
+ uris.add(link.getHref());
+ }
+ } else {
+ writeLink(writer, link, new ExtraContent() {
+ @Override
+ public void write(XMLStreamWriter writer, Link link)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ }
+ });
+ }
+ }
+ }
+ for (String title : entitySetLinks.keySet()) {
+ final List<String>entitySetLink = entitySetLinks.get(title);
+ if (!entitySetLink.isEmpty()) {
+ Link link = new Link();
+ link.setTitle(title);
+ link.setType(Constants.ENTITY_SET_NAVIGATION_LINK_TYPE);
+ link.setRel(Constants.NS_NAVIGATION_LINK_REL+title);
+
+ writeLink(writer, link, new ExtraContent() {
+ @Override
+ public void write(XMLStreamWriter writer, Link link) throws XMLStreamException, EdmPrimitiveTypeException {
+ writer.writeStartElement(Constants.PREFIX_METADATA, Constants.ATOM_ELEM_INLINE, namespaceMetadata);
+ writer.writeStartElement(namespaceAtom, Constants.ATOM_ELEM_FEED);
+ for (String binding:entitySetLink) {
+ Entity entity = new Entity();
+ entity.setId(URI.create(binding));
+ inlineEntityRef(writer, entity);
+ }
+ writer.writeEndElement();
+ writer.writeEndElement();
+ }
+ });
+ }
+ }
+ }
+
+ private void links(final XMLStreamWriter writer, final List<Link> links)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ for (Link link : links) {
+ writeLink(writer, link, new ExtraContent() {
+ @Override
+ public void write(XMLStreamWriter writer, Link link)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ }
+ });
+ }
+ }
+
+ interface ExtraContent {
+ void write(final XMLStreamWriter writer, final Link link)
+ throws XMLStreamException, EdmPrimitiveTypeException;
+ }
+
+ private void writeLink(final XMLStreamWriter writer, final Link link, final ExtraContent content)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ writer.writeStartElement(Constants.ATOM_ELEM_LINK);
+
+ if (StringUtils.isNotBlank(link.getRel())) {
+ writer.writeAttribute(Constants.ATTR_REL, link.getRel());
+ }
+ if (StringUtils.isNotBlank(link.getTitle())) {
+ writer.writeAttribute(Constants.ATTR_TITLE, link.getTitle());
+ }
+ if (StringUtils.isNotBlank(link.getHref())) {
+ writer.writeAttribute(Constants.ATTR_HREF, link.getHref());
+ }
+ if (StringUtils.isNotBlank(link.getType())) {
+ writer.writeAttribute(Constants.ATTR_TYPE, link.getType());
+ }
+
+ content.write(writer, link);
+
+ for (Annotation annotation : link.getAnnotations()) {
+ annotation(writer, annotation, null);
+ }
+ writer.writeEndElement();
+ }
+
+ 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);
+ writer.writeCharacters(object.getTitle());
+ writer.writeEndElement();
+ }
+ }
+
+ private void properties(final XMLStreamWriter writer, final List<Property> properties)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ for (Property property : properties) {
+ property(writer, property, false);
+ }
+ }
+
+ private void annotation(final XMLStreamWriter writer, final Annotation annotation, final String target)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+
+ writer.writeStartElement(Constants.PREFIX_METADATA, Constants.ANNOTATION, namespaceMetadata);
+
+ writer.writeAttribute(Constants.ATOM_ATTR_TERM, annotation.getTerm());
+
+ if (target != null) {
+ writer.writeAttribute(Constants.ATTR_TARGET, target);
+ }
+
+ EdmTypeInfo typeInfo = null;
+ if (StringUtils.isNotBlank(annotation.getType())) {
+ typeInfo = new EdmTypeInfo.Builder().setTypeExpression(annotation.getType()).build();
+ if (!EdmPrimitiveTypeKind.String.getFullQualifiedName().toString().equals(typeInfo.internal())) {
+ writer.writeAttribute(Constants.PREFIX_METADATA, namespaceMetadata,
+ Constants.ATTR_TYPE, typeInfo.external());
+ }
+ }
+
+ value(writer, annotation.getValueType(), typeInfo == null ? null : typeInfo.getPrimitiveTypeKind(),
+ annotation.getValue());
+
+ writer.writeEndElement();
+ }
+
+ private void entity(final XMLStreamWriter writer, final Entity entity)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ if (entity.getBaseURI() != null) {
+ writer.writeAttribute(XMLConstants.XML_NS_URI, Constants.ATTR_XML_BASE, entity.getBaseURI().toASCIIString());
+ }
+
+ if (serverMode && StringUtils.isNotBlank(entity.getETag())) {
+ writer.writeAttribute(namespaceMetadata, Constants.ATOM_ATTR_ETAG, entity.getETag());
+ }
+
+ if (entity.getId() != null) {
+ writer.writeStartElement(Constants.ATOM_ELEM_ID);
+ writer.writeCharacters(entity.getId().toASCIIString());
+ writer.writeEndElement();
+ }
+
+ writer.writeStartElement(Constants.ATOM_ELEM_CATEGORY);
+ writer.writeAttribute(Constants.ATOM_ATTR_SCHEME, Constants.NS_SCHEME);
+ if (StringUtils.isNotBlank(entity.getType())) {
+ writer.writeAttribute(Constants.ATOM_ATTR_TERM,
+ new EdmTypeInfo.Builder().setTypeExpression(entity.getType()).build().external());
+ }
+ writer.writeEndElement();
+
+ common(writer, entity);
+
+ if (serverMode) {
+ if (entity.getEditLink() != null) {
+ links(writer, Collections.singletonList(entity.getEditLink()));
+ }
+
+ if (entity.getSelfLink() != null) {
+ links(writer, Collections.singletonList(entity.getSelfLink()));
+ }
+ }
+
+ links(writer, entity.getAssociationLinks());
+ if (serverMode) {
+ links(writer, entity.getNavigationLinks());
+ } else {
+ writeNavigationLinks(writer, entity.getNavigationLinks());
+ writeNavigationLinks(writer, entity.getNavigationBindings());
+ }
+ links(writer, entity.getMediaEditLinks());
+
+ if (serverMode) {
+ for (Operation operation : entity.getOperations()) {
+ writer.writeStartElement(namespaceMetadata, Constants.ATOM_ELEM_ACTION);
+ writer.writeAttribute(Constants.ATTR_METADATA, operation.getMetadataAnchor());
+ writer.writeAttribute(Constants.ATTR_TITLE, operation.getTitle());
+ writer.writeAttribute(Constants.ATTR_TARGET, operation.getTarget().toASCIIString());
+ writer.writeEndElement();
+ }
+ }
+
+ writer.writeStartElement(Constants.ATOM_ELEM_CONTENT);
+ if (entity.isMediaEntity()) {
+ if (StringUtils.isNotBlank(entity.getMediaContentType())) {
+ writer.writeAttribute(Constants.ATTR_TYPE, entity.getMediaContentType());
+ }
+ if (entity.getMediaContentSource() != null) {
+ writer.writeAttribute(Constants.ATOM_ATTR_SRC, entity.getMediaContentSource().toASCIIString());
+ }
+ writer.writeEndElement();
+
+ writer.writeStartElement(namespaceMetadata, Constants.PROPERTIES);
+ properties(writer, entity.getProperties());
+ } else {
+ writer.writeAttribute(Constants.ATTR_TYPE, ContentType.APPLICATION_XML.toContentTypeString());
+ writer.writeStartElement(namespaceMetadata, Constants.PROPERTIES);
+ properties(writer, entity.getProperties());
+ writer.writeEndElement();
+ }
+ writer.writeEndElement();
+
+ for (Annotation annotation : entity.getAnnotations()) {
+ annotation(writer, annotation, null);
+ }
+ }
+
+ private void inlineEntityRef(final XMLStreamWriter writer, final Entity entity) throws XMLStreamException {
+ writer.writeStartElement(namespaceMetadata, Constants.ATOM_ELEM_ENTRY_REF);
+ writer.writeAttribute(Constants.ATOM_ATTR_ID, entity.getId().toASCIIString());
+ writer.writeEndElement();
+ }
+
+ private void entityRef(final XMLStreamWriter writer, final Entity entity) throws XMLStreamException {
+ writer.writeStartElement(Constants.ATOM_ELEM_ENTRY_REF);
+ writer.writeDefaultNamespace(namespaceMetadata);
+ writer.writeAttribute(Constants.ATOM_ATTR_ID, entity.getId().toASCIIString());
+ writer.writeEndElement();
+ }
+
+ private void entityRef(final XMLStreamWriter writer, final ResWrap<Entity> container) throws XMLStreamException {
+ writer.writeStartElement(Constants.ATOM_ELEM_ENTRY_REF);
+ writer.writeDefaultNamespace(namespaceMetadata);
+ addContextInfo(writer, container);
+ writer.writeAttribute(Constants.ATOM_ATTR_ID, container.getPayload().getId().toASCIIString());
+ }
+
+ private void entity(final Writer outWriter, final Entity entity)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
+
+ if (entity.getType() == null && entity.getProperties().isEmpty()) {
+ writer.writeStartDocument();
+ writer.setDefaultNamespace(namespaceMetadata);
+ entityRef(writer, entity);
+ } else {
+ startDocument(writer, Constants.ATOM_ELEM_ENTRY);
+ entity(writer, entity);
+ }
+ writer.writeEndDocument();
+ writer.flush();
+ }
+
+ private void entity(final Writer outWriter, final ResWrap<Entity> container)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ final Entity entity = container.getPayload();
+
+ final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
+
+ if (entity.getType() == null && entity.getProperties().isEmpty()) {
+ writer.writeStartDocument();
+ writer.setDefaultNamespace(namespaceMetadata);
+
+ entityRef(writer, container);
+ } else {
+ startDocument(writer, Constants.ATOM_ELEM_ENTRY);
+
+ addContextInfo(writer, container);
+
+ entity(writer, entity);
+ }
+
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.flush();
+ }
+
+ private void entitySet(final XMLStreamWriter writer, final EntityCollection entitySet)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ if (entitySet.getBaseURI() != null) {
+ writer.writeAttribute(XMLConstants.XML_NS_URI, Constants.ATTR_XML_BASE, entitySet.getBaseURI().toASCIIString());
+ }
+
+ if (entitySet.getCount() != null) {
+ writer.writeStartElement(namespaceMetadata, Constants.ATOM_ELEM_COUNT);
+ writer.writeCharacters(Integer.toString(entitySet.getCount()));
+ writer.writeEndElement();
+ }
+
+ if (entitySet.getId() != null) {
+ writer.writeStartElement(Constants.ATOM_ELEM_ID);
+ writer.writeCharacters(entitySet.getId().toASCIIString());
+ writer.writeEndElement();
+ }
+
+ common(writer, entitySet);
+
+ for (Entity entity : entitySet.getEntities()) {
+ if (entity.getType() == null && entity.getProperties().isEmpty()) {
+ entityRef(writer, entity);
+ } else {
+ writer.writeStartElement(Constants.ATOM_ELEM_ENTRY);
+ entity(writer, entity);
+ writer.writeEndElement();
+ }
+ }
+
+ if (serverMode) {
+ if (entitySet.getNext() != null) {
+ final Link next = new Link();
+ next.setRel(Constants.NEXT_LINK_REL);
+ next.setHref(entitySet.getNext().toASCIIString());
+
+ links(writer, Collections.<Link> singletonList(next));
+ }
+ if (entitySet.getDeltaLink() != null) {
+ final Link next = new Link();
+ next.setRel(Constants.NS_DELTA_LINK_REL);
+ next.setHref(entitySet.getDeltaLink().toASCIIString());
+
+ links(writer, Collections.<Link> singletonList(next));
+ }
+ }
+ }
+
+ private void entitySet(final Writer outWriter, final EntityCollection entitySet)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
+
+ startDocument(writer, Constants.ATOM_ELEM_FEED);
+
+ entitySet(writer, entitySet);
+
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.flush();
+ }
+
+ private void entitySet(final Writer outWriter, final ResWrap<EntityCollection> entitySet)
+ throws XMLStreamException, EdmPrimitiveTypeException {
+ final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
+
+ startDocument(writer, Constants.ATOM_ELEM_FEED);
+
+ addContextInfo(writer, entitySet);
+
+ entitySet(writer, entitySet.getPayload());
+
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.flush();
+ }
+
+ private void link(final Writer outWriter, final Link link) throws XMLStreamException {
+ final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
+
+ writer.writeStartDocument();
+
+ writer.writeStartElement(Constants.ELEM_LINKS);
+ writer.writeDefaultNamespace(namespaceData);
+
+ writer.writeStartElement(Constants.ELEM_URI);
+ writer.writeCharacters(link.getHref());
+ writer.writeEndElement();
+
+ writer.writeEndElement();
+
+ writer.writeEndDocument();
+ writer.flush();
+ }
+
+ @Override
+ public <T> void write(final Writer writer, final T obj) throws ODataSerializerException {
+ try {
+ if (obj instanceof EntityCollection) {
+ entitySet(writer, (EntityCollection) obj);
+ } else if (obj instanceof Entity) {
+ entity(writer, (Entity) obj);
+ } else if (obj instanceof Property) {
+ property(writer, (Property) obj);
+ } else if (obj instanceof Link) {
+ link(writer, (Link) obj);
+ }
+ } catch (final XMLStreamException e) {
+ throw new ODataSerializerException(e);
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new ODataSerializerException(e);
+ }
+ }
+
+ private void reference(final Writer outWriter, final ResWrap<URI> container) throws XMLStreamException {
+ final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
+
+ writer.writeStartDocument();
+
+ writer.writeStartElement(Constants.ATTR_METADATA, Constants.ATTR_REF, Constants.NS_METADATA);
+ writer.writeNamespace(Constants.ATTR_METADATA, Constants.NS_METADATA);
+ writer.writeAttribute(Constants.ATTR_METADATA, Constants.NS_METADATA, Constants.CONTEXT,
+ container.getContextURL().toASCIIString());
+ writer.writeAttribute(Constants.ATOM_ATTR_ID, container.getPayload().toASCIIString());
+ writer.writeEndElement();
+
+ writer.writeEndDocument();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> void write(final Writer writer, final ResWrap<T> container) throws ODataSerializerException {
+ final T obj = container == null ? null : container.getPayload();
+
+ try {
+ if (obj instanceof EntityCollection) {
+ this.entitySet(writer, (ResWrap<EntityCollection>) container);
+ } else if (obj instanceof Entity) {
+ entity(writer, (ResWrap<Entity>) container);
+ } else if (obj instanceof Property) {
+ property(writer, (Property) obj);
+ } else if (obj instanceof Link) {
+ link(writer, (Link) obj);
+ } else if (obj instanceof URI) {
+ reference(writer, (ResWrap<URI>) container);
+ }
+ } catch (final XMLStreamException e) {
+ throw new ODataSerializerException(e);
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new ODataSerializerException(e);
+ }
+ }
+
+ private <T> void addContextInfo(
+ final XMLStreamWriter writer, final ResWrap<T> container) throws XMLStreamException {
+
+ if (container.getContextURL() != null) {
+ final ContextURL contextURL = ContextURLParser.parse(container.getContextURL());
+ final URI base = contextURL.getServiceRoot();
+ if (container.getPayload() instanceof EntityCollection) {
+ ((EntityCollection) container.getPayload()).setBaseURI(base);
+ }
+ if (container.getPayload() instanceof Entity) {
+ ((Entity) container.getPayload()).setBaseURI(base);
+ }
+
+ writer.writeAttribute(namespaceMetadata, Constants.CONTEXT,
+ container.getContextURL().toASCIIString());
+ }
+
+ if (StringUtils.isNotBlank(container.getMetadataETag())) {
+ writer.writeAttribute(namespaceMetadata, Constants.ATOM_ATTR_METADATAETAG,
+ container.getMetadataETag());
+ }
+ }
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java
index 92bd57b..d84863c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java
@@ -26,24 +26,20 @@
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.client.api.serialization.ClientODataDeserializer;
+import org.apache.olingo.client.api.serialization.ODataDeserializer;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer;
import org.apache.olingo.client.core.data.XMLServiceDocumentDeserializer;
-import org.apache.olingo.client.core.edm.xml.ClientCsdlEdmx;
import org.apache.olingo.client.core.edm.ClientCsdlXMLMetadata;
+import org.apache.olingo.client.core.edm.xml.ClientCsdlEdmx;
+import org.apache.olingo.commons.api.ex.ODataError;
import org.apache.olingo.commons.api.data.Delta;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.ODataError;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataDeserializer;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.apache.olingo.commons.core.serialization.AtomDeserializer;
-import org.apache.olingo.commons.core.serialization.JsonDeltaDeserializer;
-import org.apache.olingo.commons.core.serialization.JsonDeserializer;
-
+import org.apache.olingo.commons.api.format.ContentType;
import com.fasterxml.aalto.stax.InputFactoryImpl;
import com.fasterxml.aalto.stax.OutputFactoryImpl;
import com.fasterxml.jackson.core.JsonParser;
@@ -58,12 +54,13 @@
public class ClientODataDeserializerImpl implements ClientODataDeserializer {
private final ODataDeserializer deserializer;
+ private final ContentType contentType;
- private final ODataFormat format;
-
- public ClientODataDeserializerImpl(final boolean serverMode, final ODataFormat format) {
- this.format = format;
- if (format == ODataFormat.XML || format == ODataFormat.ATOM) {
+ public ClientODataDeserializerImpl(final boolean serverMode, final ContentType contentType) {
+ this.contentType = contentType;
+ if (contentType.isCompatible(ContentType.APPLICATION_ATOM_SVC)
+ || contentType.isCompatible(ContentType.APPLICATION_ATOM_XML)
+ || contentType.isCompatible(ContentType.APPLICATION_XML)) {
deserializer = new AtomDeserializer();
} else {
deserializer = new JsonDeserializer(serverMode);
@@ -122,7 +119,7 @@
@Override
public ResWrap<ServiceDocument> toServiceDocument(final InputStream input) throws ODataDeserializerException {
- return format == ODataFormat.XML ?
+ return contentType.isCompatible(ContentType.APPLICATION_XML) ?
new XMLServiceDocumentDeserializer(false).toServiceDocument(input) :
new JSONServiceDocumentDeserializer(false).toServiceDocument(input);
}
@@ -130,10 +127,11 @@
@Override
public ResWrap<Delta> toDelta(final InputStream input) throws ODataDeserializerException {
try {
- return format == ODataFormat.ATOM ?
+ return contentType.isCompatible(ContentType.APPLICATION_ATOM_SVC)
+ || contentType.isCompatible(ContentType.APPLICATION_ATOM_XML) ?
new AtomDeserializer().delta(input) :
new JsonDeltaDeserializer(false).toDelta(input);
- } catch (XMLStreamException e) {
+ } catch (final XMLStreamException e) {
throw new ODataDeserializerException(e);
} catch (final EdmPrimitiveTypeException e) {
throw new ODataDeserializerException(e);
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ContextURLParser.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ContextURLParser.java
new file mode 100644
index 0000000..873ca4c
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ContextURLParser.java
@@ -0,0 +1,118 @@
+/*
+ * 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.serialization;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.ContextURL.Suffix;
+
+public class ContextURLParser {
+
+ public static ContextURL parse(final URI contextURL) {
+ if (contextURL == null) {
+ return null;
+ }
+
+ final ContextURL.Builder contextUrl = ContextURL.with();
+
+ String contextURLasString = contextURL.toASCIIString();
+
+ boolean isEntity = false;
+ if (contextURLasString.endsWith("/$entity") || contextURLasString.endsWith("/@Element")) {
+ isEntity = true;
+ contextUrl.suffix(Suffix.ENTITY);
+ contextURLasString = contextURLasString.replace("/$entity", StringUtils.EMPTY).
+ replace("/@Element", StringUtils.EMPTY);
+ } else if (contextURLasString.endsWith("/$ref")) {
+ contextUrl.suffix(Suffix.REFERENCE);
+ contextURLasString = contextURLasString.replace("/$ref", StringUtils.EMPTY);
+ } else if (contextURLasString.endsWith("/$delta")) {
+ contextUrl.suffix(Suffix.DELTA);
+ contextURLasString = contextURLasString.replace("/$delta", StringUtils.EMPTY);
+ } else if (contextURLasString.endsWith("/$deletedEntity")) {
+ contextUrl.suffix(Suffix.DELTA_DELETED_ENTITY);
+ contextURLasString = contextURLasString.replace("/$deletedEntity", StringUtils.EMPTY);
+ } else if (contextURLasString.endsWith("/$link")) {
+ contextUrl.suffix(Suffix.DELTA_LINK);
+ contextURLasString = contextURLasString.replace("/$link", StringUtils.EMPTY);
+ } else if (contextURLasString.endsWith("/$deletedLink")) {
+ contextUrl.suffix(Suffix.DELTA_DELETED_LINK);
+ contextURLasString = contextURLasString.replace("/$deletedLink", StringUtils.EMPTY);
+ }
+
+ contextUrl.serviceRoot(URI.create(StringUtils.substringBefore(contextURLasString, Constants.METADATA)));
+
+ final String rest = StringUtils.substringAfter(contextURLasString, Constants.METADATA + "#");
+
+ String firstToken;
+ String entitySetOrSingletonOrType;
+ if (rest.startsWith("Collection(")) {
+ firstToken = rest.substring(0, rest.indexOf(')') + 1);
+ entitySetOrSingletonOrType = firstToken;
+ } else {
+ final int openParIdx = rest.indexOf('(');
+ if (openParIdx == -1) {
+ firstToken = StringUtils.substringBeforeLast(rest, "/");
+
+ entitySetOrSingletonOrType = firstToken;
+ } else {
+ firstToken = isEntity ? rest : StringUtils.substringBeforeLast(rest, ")") + ")";
+
+ final List<String> parts = new ArrayList<String>();
+ for (String split : firstToken.split("\\)/")) {
+ parts.add(split.replaceAll("\\(.*", ""));
+ }
+ entitySetOrSingletonOrType = StringUtils.join(parts, '/');
+ final int commaIdx = firstToken.indexOf(',');
+ if (commaIdx != -1) {
+ contextUrl.selectList(firstToken.substring(openParIdx + 1, firstToken.length() - 1));
+ }
+ }
+ }
+ contextUrl.entitySetOrSingletonOrType(entitySetOrSingletonOrType);
+
+ final int slashIdx = entitySetOrSingletonOrType.lastIndexOf('/');
+ if (slashIdx != -1 && entitySetOrSingletonOrType.substring(slashIdx + 1).indexOf('.') != -1) {
+ contextUrl.entitySetOrSingletonOrType(entitySetOrSingletonOrType.substring(0, slashIdx));
+ contextUrl.derivedEntity(entitySetOrSingletonOrType.substring(slashIdx + 1));
+ }
+
+ if (!firstToken.equals(rest)) {
+ final String[] pathElems = StringUtils.substringAfter(rest, "/").split("/");
+ if (pathElems.length > 0 && pathElems[0].length() > 0) {
+ if (pathElems[0].indexOf('.') == -1) {
+ contextUrl.navOrPropertyPath(pathElems[0]);
+ } else {
+ contextUrl.derivedEntity(pathElems[0]);
+ }
+
+ if (pathElems.length > 1) {
+ contextUrl.navOrPropertyPath(pathElems[1]);
+ }
+ }
+ }
+
+ return contextUrl.build();
+ }
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonDeltaDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonDeltaDeserializer.java
new file mode 100644
index 0000000..c9b962a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonDeltaDeserializer.java
@@ -0,0 +1,100 @@
+/*
+ * 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.serialization;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.DeletedEntity;
+import org.apache.olingo.commons.api.data.Delta;
+import org.apache.olingo.commons.api.data.DeltaLink;
+import org.apache.olingo.commons.api.data.ResWrap;
+
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+public class JsonDeltaDeserializer extends JsonDeserializer {
+
+ public JsonDeltaDeserializer(final boolean serverMode) {
+ super(serverMode);
+ }
+
+ protected ResWrap<Delta> doDeserialize(final JsonParser parser) throws IOException {
+
+ final ObjectNode tree = parser.getCodec().readTree(parser);
+
+ final Delta delta = new Delta();
+
+ final URI contextURL = tree.hasNonNull(Constants.JSON_CONTEXT) ?
+ URI.create(tree.get(Constants.JSON_CONTEXT).textValue()) : null;
+ if (contextURL != null) {
+ delta.setBaseURI(URI.create(StringUtils.substringBefore(contextURL.toASCIIString(), Constants.METADATA)));
+ }
+
+ if (tree.hasNonNull(Constants.JSON_COUNT)) {
+ delta.setCount(tree.get(Constants.JSON_COUNT).asInt());
+ }
+ if (tree.hasNonNull(Constants.JSON_NEXT_LINK)) {
+ delta.setNext(URI.create(tree.get(Constants.JSON_NEXT_LINK).textValue()));
+ }
+ if (tree.hasNonNull(Constants.JSON_DELTA_LINK)) {
+ delta.setDeltaLink(URI.create(tree.get(Constants.JSON_DELTA_LINK).textValue()));
+ }
+
+ if (tree.hasNonNull(Constants.VALUE)) {
+ JsonEntityDeserializer entityDeserializer = new JsonEntityDeserializer(serverMode);
+ for (JsonNode jsonNode : tree.get(Constants.VALUE)) {
+ final ObjectNode item = (ObjectNode) jsonNode;
+ final ContextURL itemContextURL = item.hasNonNull(Constants.JSON_CONTEXT) ?
+ ContextURLParser.parse(URI.create(item.get(Constants.JSON_CONTEXT).textValue())) : null;
+ item.remove(Constants.JSON_CONTEXT);
+
+ if (itemContextURL == null || itemContextURL.isEntity()) {
+ delta.getEntities().add(
+ entityDeserializer.doDeserialize(item.traverse(parser.getCodec())).getPayload());
+ } else if (itemContextURL.isDeltaDeletedEntity()) {
+ delta.getDeletedEntities().add(parser.getCodec().treeToValue(item, DeletedEntity.class));
+ } else if (itemContextURL.isDeltaLink()) {
+ delta.getAddedLinks().add(parser.getCodec().treeToValue(item, DeltaLink.class));
+ } else if (itemContextURL.isDeltaDeletedLink()) {
+ delta.getDeletedLinks().add(parser.getCodec().treeToValue(item, DeltaLink.class));
+ }
+ }
+ }
+
+ return new ResWrap<Delta>(contextURL, null, delta);
+ }
+
+ public ResWrap<Delta> toDelta(final InputStream input) throws ODataDeserializerException {
+ try {
+ JsonParser parser = new JsonFactory(new ObjectMapper()).createParser(input);
+ return doDeserialize(parser);
+ } catch (final IOException e) {
+ throw new ODataDeserializerException(e);
+ }
+ }
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonDeserializer.java
new file mode 100644
index 0000000..4dfd729
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonDeserializer.java
@@ -0,0 +1,421 @@
+/*
+ * 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.serialization;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.AbstractMap.SimpleEntry;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.serialization.ODataDeserializer;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.ex.ODataError;
+import org.apache.olingo.commons.api.data.PropertyType;
+import org.apache.olingo.commons.api.data.Annotatable;
+import org.apache.olingo.commons.api.data.Annotation;
+import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Linked;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.data.Valuable;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.ObjectCodec;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+public class JsonDeserializer implements ODataDeserializer {
+
+ protected final Pattern CUSTOM_ANNOTATION = Pattern.compile("(.+)@(.+)\\.(.+)");
+
+ protected final boolean serverMode;
+
+ private JsonGeoValueDeserializer geoDeserializer;
+
+ private JsonParser parser;
+
+ public JsonDeserializer(final boolean serverMode) {
+ this.serverMode = serverMode;
+ }
+
+ private JsonGeoValueDeserializer getGeoDeserializer() {
+ if (geoDeserializer == null) {
+ geoDeserializer = new JsonGeoValueDeserializer();
+ }
+ return geoDeserializer;
+ }
+
+ protected String getJSONAnnotation(final String string) {
+ return StringUtils.prependIfMissing(string, "@");
+ }
+
+ protected String getTitle(final Map.Entry<String, JsonNode> entry) {
+ return entry.getKey().substring(0, entry.getKey().indexOf('@'));
+ }
+
+ protected String setInline(final String name, final String suffix, final JsonNode tree,
+ final ObjectCodec codec, final Link link) throws IOException {
+
+ final String entityNamePrefix = name.substring(0, name.indexOf(suffix));
+ if (tree.has(entityNamePrefix)) {
+ final JsonNode inline = tree.path(entityNamePrefix);
+ JsonEntityDeserializer entityDeserializer = new JsonEntityDeserializer(serverMode);
+
+ if (inline instanceof ObjectNode) {
+ link.setType(Constants.ENTITY_NAVIGATION_LINK_TYPE);
+ link.setInlineEntity(entityDeserializer.doDeserialize(inline.traverse(codec)).getPayload());
+
+ } else if (inline instanceof ArrayNode) {
+ link.setType(Constants.ENTITY_SET_NAVIGATION_LINK_TYPE);
+
+ final EntityCollection entitySet = new EntityCollection();
+ for (final Iterator<JsonNode> entries = inline.elements(); entries.hasNext();) {
+ entitySet.getEntities().add(entityDeserializer.doDeserialize(entries.next().traverse(codec)).getPayload());
+ }
+
+ link.setInlineEntitySet(entitySet);
+ }
+ }
+ return entityNamePrefix;
+ }
+
+ protected void links(final Map.Entry<String, JsonNode> field, final Linked linked, final Set<String> toRemove,
+ final JsonNode tree, final ObjectCodec codec) throws IOException {
+ if (serverMode) {
+ serverLinks(field, linked, toRemove, tree, codec);
+ } else {
+ clientLinks(field, linked, toRemove, tree, codec);
+ }
+ }
+
+ private void clientLinks(final Map.Entry<String, JsonNode> field, final Linked linked, final Set<String> toRemove,
+ final JsonNode tree, final ObjectCodec codec) throws IOException {
+
+ if (field.getKey().endsWith(Constants.JSON_NAVIGATION_LINK)) {
+ final Link link = new Link();
+ link.setTitle(getTitle(field));
+ link.setRel(Constants.NS_NAVIGATION_LINK_REL + getTitle(field));
+
+ if (field.getValue().isValueNode()) {
+ link.setHref(field.getValue().textValue());
+ link.setType(Constants.ENTITY_NAVIGATION_LINK_TYPE);
+ }
+
+ linked.getNavigationLinks().add(link);
+
+ toRemove.add(field.getKey());
+ toRemove.add(setInline(field.getKey(), Constants.JSON_NAVIGATION_LINK, tree, codec, link));
+ } else if (field.getKey().endsWith(Constants.JSON_ASSOCIATION_LINK)) {
+ final Link link = new Link();
+ link.setTitle(getTitle(field));
+ link.setRel(Constants.NS_ASSOCIATION_LINK_REL + getTitle(field));
+ link.setHref(field.getValue().textValue());
+ link.setType(Constants.ASSOCIATION_LINK_TYPE);
+ linked.getAssociationLinks().add(link);
+
+ toRemove.add(field.getKey());
+ }
+ }
+
+ private void serverLinks(final Map.Entry<String, JsonNode> field, final Linked linked, final Set<String> toRemove,
+ final JsonNode tree, final ObjectCodec codec) throws IOException {
+
+ if (field.getKey().endsWith(Constants.JSON_BIND_LINK_SUFFIX)
+ || field.getKey().endsWith(Constants.JSON_NAVIGATION_LINK)) {
+
+ if (field.getValue().isValueNode()) {
+ final String suffix = field.getKey().replaceAll("^.*@", "@");
+
+ final Link link = new Link();
+ link.setTitle(getTitle(field));
+ link.setRel(Constants.NS_NAVIGATION_LINK_REL + getTitle(field));
+ link.setHref(field.getValue().textValue());
+ link.setType(Constants.ENTITY_NAVIGATION_LINK_TYPE);
+ linked.getNavigationLinks().add(link);
+
+ toRemove.add(setInline(field.getKey(), suffix, tree, codec, link));
+ } else if (field.getValue().isArray()) {
+ for (final Iterator<JsonNode> itor = field.getValue().elements(); itor.hasNext();) {
+ final JsonNode node = itor.next();
+
+ final Link link = new Link();
+ link.setTitle(getTitle(field));
+ link.setRel(Constants.NS_NAVIGATION_LINK_REL + getTitle(field));
+ link.setHref(node.asText());
+ link.setType(Constants.ENTITY_SET_NAVIGATION_LINK_TYPE);
+ linked.getNavigationLinks().add(link);
+ toRemove.add(setInline(field.getKey(), Constants.JSON_BIND_LINK_SUFFIX, tree, codec, link));
+ }
+ }
+ toRemove.add(field.getKey());
+ }
+ }
+
+ private Map.Entry<PropertyType, EdmTypeInfo> guessPropertyType(final JsonNode node) {
+ PropertyType type;
+ String typeExpression = null;
+
+ if (node.isValueNode() || node.isNull()) {
+ type = PropertyType.PRIMITIVE;
+ typeExpression = guessPrimitiveTypeKind(node).getFullQualifiedName().toString();
+ } else if (node.isArray()) {
+ type = PropertyType.COLLECTION;
+ if (node.has(0) && node.get(0).isValueNode()) {
+ typeExpression = "Collection(" + guessPrimitiveTypeKind(node.get(0)) + ')';
+ }
+ } else if (node.isObject()) {
+ if (node.has(Constants.ATTR_TYPE)) {
+ type = PropertyType.PRIMITIVE;
+ typeExpression = "Edm.Geography" + node.get(Constants.ATTR_TYPE).asText();
+ } else {
+ type = PropertyType.COMPLEX;
+ }
+ } else {
+ type = PropertyType.EMPTY;
+ }
+
+ final EdmTypeInfo typeInfo = typeExpression == null ? null :
+ new EdmTypeInfo.Builder().setTypeExpression(typeExpression).build();
+ return new SimpleEntry<PropertyType, EdmTypeInfo>(type, typeInfo);
+ }
+
+ private EdmPrimitiveTypeKind guessPrimitiveTypeKind(final JsonNode node) {
+ return node.isShort() ? EdmPrimitiveTypeKind.Int16 :
+ node.isInt() ? EdmPrimitiveTypeKind.Int32 :
+ node.isLong() ? EdmPrimitiveTypeKind.Int64 :
+ node.isBoolean() ? EdmPrimitiveTypeKind.Boolean :
+ node.isFloat() ? EdmPrimitiveTypeKind.Single :
+ node.isDouble() ? EdmPrimitiveTypeKind.Double :
+ node.isBigDecimal() ? EdmPrimitiveTypeKind.Decimal :
+ EdmPrimitiveTypeKind.String;
+ }
+
+ protected void populate(final Annotatable annotatable, final List<Property> properties,
+ final ObjectNode tree, final ObjectCodec codec)
+ throws IOException, EdmPrimitiveTypeException {
+
+ String type = null;
+ Annotation annotation = null;
+ for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
+ final Map.Entry<String, JsonNode> field = itor.next();
+ final Matcher customAnnotation = CUSTOM_ANNOTATION.matcher(field.getKey());
+
+ if (field.getKey().charAt(0) == '@') {
+ final Annotation entityAnnot = new Annotation();
+ entityAnnot.setTerm(field.getKey().substring(1));
+
+ value(entityAnnot, field.getValue(), codec);
+ if (annotatable != null) {
+ annotatable.getAnnotations().add(entityAnnot);
+ }
+ } else if (type == null && field.getKey().endsWith(getJSONAnnotation(Constants.JSON_TYPE))) {
+ type = field.getValue().asText();
+ } else if (annotation == null && customAnnotation.matches() && !"odata".equals(customAnnotation.group(2))) {
+ annotation = new Annotation();
+ annotation.setTerm(customAnnotation.group(2) + "." + customAnnotation.group(3));
+ value(annotation, field.getValue(), codec);
+ } else {
+ final Property property = new Property();
+ property.setName(field.getKey());
+ property.setType(type == null
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(type).build().internal());
+ type = null;
+
+ value(property, field.getValue(), codec);
+ properties.add(property);
+
+ if (annotation != null) {
+ property.getAnnotations().add(annotation);
+ annotation = null;
+ }
+ }
+ }
+ }
+
+ private Object fromPrimitive(final JsonNode node, final EdmTypeInfo typeInfo) throws EdmPrimitiveTypeException {
+ return node.isNull() ? null
+ : typeInfo == null ? node.asText()
+ : typeInfo.getPrimitiveTypeKind().isGeospatial()
+ ? getGeoDeserializer().deserialize(node, typeInfo)
+ : ((EdmPrimitiveType) typeInfo.getType())
+ .valueOfString(node.asText(), true, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, true,
+ ((EdmPrimitiveType) typeInfo.getType()).getDefaultType());
+ }
+
+ private Object fromComplex(final ObjectNode node, final ObjectCodec codec)
+ throws IOException, EdmPrimitiveTypeException {
+
+ final ComplexValue complexValue = new ComplexValue();
+ final Set<String> toRemove = new HashSet<String>();
+ for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
+ final Map.Entry<String, JsonNode> field = itor.next();
+
+ links(field, complexValue, toRemove, node, codec);
+ }
+ node.remove(toRemove);
+
+ populate(complexValue, complexValue.getValue(), node, codec);
+ return complexValue;
+ }
+
+ private void fromCollection(final Valuable valuable, final Iterator<JsonNode> nodeItor, final EdmTypeInfo typeInfo,
+ final ObjectCodec codec) throws IOException, EdmPrimitiveTypeException {
+
+ final List<Object> values = new ArrayList<Object>();
+ ValueType valueType = ValueType.COLLECTION_PRIMITIVE;
+
+ final EdmTypeInfo type = typeInfo == null ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
+
+ while (nodeItor.hasNext()) {
+ final JsonNode child = nodeItor.next();
+
+ if (child.isValueNode()) {
+ if (typeInfo == null || typeInfo.isPrimitiveType()) {
+ final Object value = fromPrimitive(child, type);
+ valueType = value instanceof Geospatial ? ValueType.COLLECTION_GEOSPATIAL : ValueType.COLLECTION_PRIMITIVE;
+ values.add(value);
+ } else {
+ valueType = ValueType.COLLECTION_ENUM;
+ values.add(child.asText());
+ }
+ } else if (child.isContainerNode()) {
+ if (child.has(Constants.JSON_TYPE)) {
+ ((ObjectNode) child).remove(Constants.JSON_TYPE);
+ }
+ final Object value = fromComplex((ObjectNode) child, codec);
+ valueType = ValueType.COLLECTION_COMPLEX;
+ values.add(value);
+ }
+ }
+ valuable.setValue(valueType, values);
+ }
+
+ protected void value(final Valuable valuable, final JsonNode node, final ObjectCodec codec)
+ throws IOException, EdmPrimitiveTypeException {
+
+ EdmTypeInfo typeInfo = StringUtils.isBlank(valuable.getType()) ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(valuable.getType()).build();
+
+ final Map.Entry<PropertyType, EdmTypeInfo> guessed = guessPropertyType(node);
+ if (typeInfo == null) {
+ typeInfo = guessed.getValue();
+ }
+
+ final PropertyType propType = typeInfo == null ? guessed.getKey()
+ : typeInfo.isCollection() ? PropertyType.COLLECTION
+ : typeInfo.isPrimitiveType() ? PropertyType.PRIMITIVE
+ : node.isValueNode() ? PropertyType.ENUM : PropertyType.COMPLEX;
+
+ switch (propType) {
+ case COLLECTION:
+ fromCollection(valuable, node.elements(), typeInfo, codec);
+ break;
+
+ case COMPLEX:
+ if (node.has(Constants.JSON_TYPE)) {
+ valuable.setType(node.get(Constants.JSON_TYPE).asText());
+ ((ObjectNode) node).remove(Constants.JSON_TYPE);
+ }
+ final Object value = fromComplex((ObjectNode) node, codec);
+ valuable.setValue(ValueType.COMPLEX, value);
+ break;
+
+ case ENUM:
+ valuable.setValue(ValueType.ENUM, node.asText());
+ break;
+
+ case PRIMITIVE:
+ if (valuable.getType() == null && typeInfo != null) {
+ valuable.setType(typeInfo.getFullQualifiedName().toString());
+ }
+ final Object primitiveValue = fromPrimitive(node, typeInfo);
+ valuable.setValue(primitiveValue instanceof Geospatial ? ValueType.GEOSPATIAL : ValueType.PRIMITIVE,
+ primitiveValue);
+ break;
+
+ case EMPTY:
+ default:
+ valuable.setValue(ValueType.PRIMITIVE, StringUtils.EMPTY);
+ }
+ }
+
+ @Override
+ public ResWrap<EntityCollection> toEntitySet(final InputStream input) throws ODataDeserializerException {
+ try {
+ parser = new JsonFactory(new ObjectMapper()).createParser(input);
+ return new JsonEntitySetDeserializer(serverMode).doDeserialize(parser);
+ } catch (final IOException e) {
+ throw new ODataDeserializerException(e);
+ }
+ }
+
+ @Override
+ public ResWrap<Entity> toEntity(final InputStream input) throws ODataDeserializerException {
+ try {
+ parser = new JsonFactory(new ObjectMapper()).createParser(input);
+ return new JsonEntityDeserializer(serverMode).doDeserialize(parser);
+ } catch (final IOException e) {
+ throw new ODataDeserializerException(e);
+ }
+ }
+
+ @Override
+ public ResWrap<Property> toProperty(final InputStream input) throws ODataDeserializerException {
+ try {
+ parser = new JsonFactory(new ObjectMapper()).createParser(input);
+ return new JsonPropertyDeserializer(serverMode).doDeserialize(parser);
+ } catch (final IOException e) {
+ throw new ODataDeserializerException(e);
+ }
+ }
+
+ @Override
+ public ODataError toError(final InputStream input) throws ODataDeserializerException {
+ try {
+ parser = new JsonFactory(new ObjectMapper()).createParser(input);
+ return new JsonODataErrorDeserializer(serverMode).doDeserialize(parser);
+ } catch (final IOException e) {
+ throw new ODataDeserializerException(e);
+ }
+ }
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonEntityDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonEntityDeserializer.java
new file mode 100644
index 0000000..258c028
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonEntityDeserializer.java
@@ -0,0 +1,229 @@
+/*
+ * 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.serialization;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Annotation;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Operation;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+/**
+ * Reads JSON string into an entity.
+ * <br/>
+ * If metadata information is available, the corresponding entity fields and content will be populated.
+ */
+public class JsonEntityDeserializer extends JsonDeserializer {
+
+ public JsonEntityDeserializer(final boolean serverMode) {
+ super(serverMode);
+ }
+
+ protected ResWrap<Entity> doDeserialize(final JsonParser parser) throws IOException {
+
+ final ObjectNode tree = parser.getCodec().readTree(parser);
+
+ if (tree.has(Constants.VALUE) && tree.get(Constants.VALUE).isArray()) {
+ throw new JsonParseException("Expected OData Entity, found EntitySet", parser.getCurrentLocation());
+ }
+
+ final Entity entity = new Entity();
+
+ final URI contextURL;
+ 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 (contextURL != null) {
+ entity.setBaseURI(URI.create(StringUtils.substringBefore(contextURL.toASCIIString(), Constants.METADATA)));
+ }
+
+ final String metadataETag;
+ 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_ETAG)) {
+ entity.setETag(tree.get(Constants.JSON_ETAG).textValue());
+ tree.remove(Constants.JSON_ETAG);
+ }
+
+ if (tree.hasNonNull(Constants.JSON_TYPE)) {
+ entity.setType(new EdmTypeInfo.Builder().setTypeExpression(tree.get(Constants.JSON_TYPE).textValue()).build()
+ .internal());
+ tree.remove(Constants.JSON_TYPE);
+ }
+
+ if (tree.hasNonNull(Constants.JSON_ID)) {
+ entity.setId(URI.create(tree.get(Constants.JSON_ID).textValue()));
+ tree.remove(Constants.JSON_ID);
+ }
+
+ if (tree.hasNonNull(Constants.JSON_READ_LINK)) {
+ final Link link = new Link();
+ link.setRel(Constants.SELF_LINK_REL);
+ link.setHref(tree.get(Constants.JSON_READ_LINK).textValue());
+ entity.setSelfLink(link);
+
+ tree.remove(Constants.JSON_READ_LINK);
+ }
+
+ if (tree.hasNonNull(Constants.JSON_EDIT_LINK)) {
+ final Link link = new Link();
+ if (serverMode) {
+ link.setRel(Constants.EDIT_LINK_REL);
+ }
+ link.setHref(tree.get(Constants.JSON_EDIT_LINK).textValue());
+ entity.setEditLink(link);
+
+ tree.remove(Constants.JSON_EDIT_LINK);
+ }
+
+ if (tree.hasNonNull(Constants.JSON_MEDIA_READ_LINK)) {
+ entity.setMediaContentSource(URI.create(tree.get(Constants.JSON_MEDIA_READ_LINK).textValue()));
+ tree.remove(Constants.JSON_MEDIA_READ_LINK);
+ }
+ if (tree.hasNonNull(Constants.JSON_MEDIA_EDIT_LINK)) {
+ entity.setMediaContentSource(URI.create(tree.get(Constants.JSON_MEDIA_EDIT_LINK).textValue()));
+ tree.remove(Constants.JSON_MEDIA_EDIT_LINK);
+ }
+ if (tree.hasNonNull(Constants.JSON_MEDIA_CONTENT_TYPE)) {
+ entity.setMediaContentType(tree.get(Constants.JSON_MEDIA_CONTENT_TYPE).textValue());
+ tree.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
+ }
+ if (tree.hasNonNull(Constants.JSON_MEDIA_ETAG)) {
+ entity.setMediaETag(tree.get(Constants.JSON_MEDIA_ETAG).textValue());
+ tree.remove(Constants.JSON_MEDIA_ETAG);
+ }
+
+ final Set<String> toRemove = new HashSet<String>();
+
+ final Map<String, List<Annotation>> annotations = new HashMap<String, List<Annotation>>();
+ for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
+ final Map.Entry<String, JsonNode> field = itor.next();
+ final Matcher customAnnotation = CUSTOM_ANNOTATION.matcher(field.getKey());
+
+ links(field, entity, toRemove, tree, parser.getCodec());
+ if (field.getKey().endsWith(getJSONAnnotation(Constants.JSON_MEDIA_EDIT_LINK))) {
+ final Link link = new Link();
+ link.setTitle(getTitle(field));
+ link.setRel(Constants.NS_MEDIA_EDIT_LINK_REL + getTitle(field));
+ link.setHref(field.getValue().textValue());
+ link.setType(Constants.MEDIA_EDIT_LINK_TYPE);
+ entity.getMediaEditLinks().add(link);
+
+ if (tree.has(link.getTitle() + getJSONAnnotation(Constants.JSON_MEDIA_ETAG))) {
+ link.setMediaETag(tree.get(link.getTitle() + getJSONAnnotation(Constants.JSON_MEDIA_ETAG)).asText());
+ toRemove.add(link.getTitle() + getJSONAnnotation(Constants.JSON_MEDIA_ETAG));
+ }
+
+ toRemove.add(field.getKey());
+ toRemove.add(setInline(field.getKey(), getJSONAnnotation(Constants.JSON_MEDIA_EDIT_LINK), tree, parser
+ .getCodec(), link));
+ } else if (field.getKey().endsWith(getJSONAnnotation(Constants.JSON_MEDIA_CONTENT_TYPE))) {
+ final String linkTitle = getTitle(field);
+ for (Link link : entity.getMediaEditLinks()) {
+ if (linkTitle.equals(link.getTitle())) {
+ link.setType(field.getValue().asText());
+ }
+ }
+ toRemove.add(field.getKey());
+ } else if (field.getKey().charAt(0) == '#') {
+ final Operation operation = new Operation();
+ operation.setMetadataAnchor(field.getKey());
+
+ final ObjectNode opNode = (ObjectNode) tree.get(field.getKey());
+ operation.setTitle(opNode.get(Constants.ATTR_TITLE).asText());
+ operation.setTarget(URI.create(opNode.get(Constants.ATTR_TARGET).asText()));
+
+ entity.getOperations().add(operation);
+
+ toRemove.add(field.getKey());
+ } else if (customAnnotation.matches() && !"odata".equals(customAnnotation.group(2))) {
+ final Annotation annotation = new Annotation();
+ annotation.setTerm(customAnnotation.group(2) + "." + customAnnotation.group(3));
+ try {
+ value(annotation, field.getValue(), parser.getCodec());
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new IOException(e);
+ }
+
+ if (!annotations.containsKey(customAnnotation.group(1))) {
+ annotations.put(customAnnotation.group(1), new ArrayList<Annotation>());
+ }
+ annotations.get(customAnnotation.group(1)).add(annotation);
+ }
+ }
+
+ for (Link link : entity.getNavigationLinks()) {
+ if (annotations.containsKey(link.getTitle())) {
+ link.getAnnotations().addAll(annotations.get(link.getTitle()));
+ for (Annotation annotation : annotations.get(link.getTitle())) {
+ toRemove.add(link.getTitle() + "@" + annotation.getTerm());
+ }
+ }
+ }
+ for (Link link : entity.getMediaEditLinks()) {
+ if (annotations.containsKey(link.getTitle())) {
+ link.getAnnotations().addAll(annotations.get(link.getTitle()));
+ for (Annotation annotation : annotations.get(link.getTitle())) {
+ toRemove.add(link.getTitle() + "@" + annotation.getTerm());
+ }
+ }
+ }
+
+ tree.remove(toRemove);
+
+ try {
+ populate(entity, entity.getProperties(), tree, parser.getCodec());
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new IOException(e);
+ }
+
+ return new ResWrap<Entity>(contextURL, metadataETag, entity);
+ }
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonEntitySerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonEntitySerializer.java
new file mode 100644
index 0000000..75c7feb
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonEntitySerializer.java
@@ -0,0 +1,131 @@
+/*
+ * 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.serialization;
+
+import java.io.IOException;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Annotation;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Operation;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+
+/**
+ * Writes out JSON string from an entity.
+ */
+public class JsonEntitySerializer extends JsonSerializer {
+
+ public JsonEntitySerializer(final boolean serverMode, final ContentType contentType) {
+ super(serverMode, contentType);
+ }
+
+ protected void doSerialize(final Entity entity, final JsonGenerator jgen)
+ throws IOException, EdmPrimitiveTypeException {
+
+ doContainerSerialize(new ResWrap<Entity>(null, null, entity), jgen);
+ }
+
+ protected void doContainerSerialize(final ResWrap<Entity> container, final JsonGenerator jgen)
+ throws IOException, EdmPrimitiveTypeException {
+
+ final Entity entity = container.getPayload();
+
+ jgen.writeStartObject();
+
+ if (serverMode) {
+ if (container.getContextURL() != null) {
+ jgen.writeStringField(Constants.JSON_CONTEXT, container.getContextURL().toASCIIString());
+ }
+ if (StringUtils.isNotBlank(container.getMetadataETag())) {
+ jgen.writeStringField(Constants.JSON_METADATA_ETAG, container.getMetadataETag());
+ }
+
+ if (StringUtils.isNotBlank(entity.getETag())) {
+ jgen.writeStringField(Constants.JSON_ETAG, entity.getETag());
+ }
+ }
+
+ if (StringUtils.isNotBlank(entity.getType()) && !isODataMetadataNone(contentType)) {
+ jgen.writeStringField(Constants.JSON_TYPE,
+ new EdmTypeInfo.Builder().setTypeExpression(entity.getType()).build().external());
+ }
+
+ if (entity.getId() != null && !isODataMetadataNone(contentType)) {
+ jgen.writeStringField(Constants.JSON_ID, entity.getId().toASCIIString());
+ }
+
+ for (Annotation annotation : entity.getAnnotations()) {
+ valuable(jgen, annotation, "@" + annotation.getTerm());
+ }
+
+ for (Property property : entity.getProperties()) {
+ valuable(jgen, property, property.getName());
+ }
+
+ if (serverMode && entity.getEditLink() != null && StringUtils.isNotBlank(entity.getEditLink().getHref())) {
+ jgen.writeStringField(Constants.JSON_EDIT_LINK,
+ entity.getEditLink().getHref());
+
+ if (entity.isMediaEntity()) {
+ jgen.writeStringField(Constants.JSON_MEDIA_READ_LINK,
+ entity.getEditLink().getHref() + "/$value");
+ }
+ }
+
+ if (!isODataMetadataNone(contentType)) {
+ links(entity, jgen);
+ }
+
+ for (Link link : entity.getMediaEditLinks()) {
+ if (link.getTitle() == null) {
+ jgen.writeStringField(Constants.JSON_MEDIA_EDIT_LINK, link.getHref());
+ }
+
+ if (link.getInlineEntity() != null) {
+ jgen.writeObjectField(link.getTitle(), link.getInlineEntity());
+ }
+ if (link.getInlineEntitySet() != null) {
+ jgen.writeArrayFieldStart(link.getTitle());
+ for (Entity subEntry : link.getInlineEntitySet().getEntities()) {
+ jgen.writeObject(subEntry);
+ }
+ jgen.writeEndArray();
+ }
+ }
+
+ if (serverMode) {
+ for (Operation operation : entity.getOperations()) {
+ jgen.writeObjectFieldStart("#" + StringUtils.substringAfterLast(operation.getMetadataAnchor(), "#"));
+ jgen.writeStringField(Constants.ATTR_TITLE, operation.getTitle());
+ jgen.writeStringField(Constants.ATTR_TARGET, operation.getTarget().toASCIIString());
+ jgen.writeEndObject();
+ }
+ }
+
+ jgen.writeEndObject();
+ }
+}
\ No newline at end of file
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonEntitySetDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonEntitySetDeserializer.java
new file mode 100644
index 0000000..2fb7b25
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonEntitySetDeserializer.java
@@ -0,0 +1,120 @@
+/*
+ * 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.serialization;
+
+import java.io.IOException;
+import java.net.URI;
+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.Annotation;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+/**
+ * Reads JSON string into an entity set.
+ * <br/>
+ * If metadata information is available, the corresponding entity fields and content will be populated.
+ */
+public class JsonEntitySetDeserializer extends JsonDeserializer {
+
+ public JsonEntitySetDeserializer(final boolean serverMode) {
+ super(serverMode);
+ }
+
+ protected ResWrap<EntityCollection> doDeserialize(final JsonParser parser) throws IOException {
+
+ final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
+
+ if (!tree.has(Constants.VALUE)) {
+ return null;
+ }
+
+ final EntityCollection entitySet = new EntityCollection();
+
+ URI contextURL;
+ 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 (contextURL != null) {
+ entitySet.setBaseURI(URI.create(StringUtils.substringBefore(contextURL.toASCIIString(), Constants.METADATA)));
+ }
+
+ final String metadataETag;
+ 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_COUNT)) {
+ entitySet.setCount(tree.get(Constants.JSON_COUNT).asInt());
+ tree.remove(Constants.JSON_COUNT);
+ }
+ if (tree.hasNonNull(Constants.JSON_NEXT_LINK)) {
+ entitySet.setNext(URI.create(tree.get(Constants.JSON_NEXT_LINK).textValue()));
+ tree.remove(Constants.JSON_NEXT_LINK);
+ }
+ if (tree.hasNonNull(Constants.JSON_DELTA_LINK)) {
+ entitySet.setDeltaLink(URI.create(tree.get(Constants.JSON_DELTA_LINK).textValue()));
+ tree.remove(Constants.JSON_DELTA_LINK);
+ }
+
+ if (tree.hasNonNull(Constants.VALUE)) {
+ final JsonEntityDeserializer entityDeserializer = new JsonEntityDeserializer(serverMode);
+ for (JsonNode jsonNode : tree.get(Constants.VALUE)) {
+ entitySet.getEntities().add(
+ entityDeserializer.doDeserialize(jsonNode.traverse(parser.getCodec())).getPayload());
+ }
+ tree.remove(Constants.VALUE);
+ }
+
+ // any remaining entry is supposed to be an annotation or is ignored
+ for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
+ final Map.Entry<String, JsonNode> field = itor.next();
+ if (field.getKey().charAt(0) == '@') {
+ final Annotation annotation = new Annotation();
+ annotation.setTerm(field.getKey().substring(1));
+
+ try {
+ value(annotation, field.getValue(), parser.getCodec());
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new IOException(e);
+ }
+ entitySet.getAnnotations().add(annotation);
+ }
+ }
+
+ return new ResWrap<EntityCollection>(contextURL, metadataETag, entitySet);
+ }
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonEntitySetSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonEntitySetSerializer.java
new file mode 100644
index 0000000..edb92d2
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonEntitySetSerializer.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.client.core.serialization;
+
+import java.io.IOException;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Annotation;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.format.ContentType;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+
+public class JsonEntitySetSerializer extends JsonSerializer {
+
+ public JsonEntitySetSerializer(final boolean serverMode, final ContentType contentType) {
+ super(serverMode, contentType);
+ }
+
+ protected void doSerialize(final EntityCollection entitySet, final JsonGenerator jgen)
+ throws IOException, EdmPrimitiveTypeException {
+ doContainerSerialize(new ResWrap<EntityCollection>(null, null, entitySet), jgen);
+ }
+
+ protected void doContainerSerialize(final ResWrap<EntityCollection> container, final JsonGenerator jgen)
+ throws IOException, EdmPrimitiveTypeException {
+
+ final EntityCollection entitySet = container.getPayload();
+
+ jgen.writeStartObject();
+
+ if (serverMode) {
+ if (container.getContextURL() != null) {
+ jgen.writeStringField(Constants.JSON_CONTEXT, container.getContextURL().toASCIIString());
+ }
+
+ if (StringUtils.isNotBlank(container.getMetadataETag())) {
+ jgen.writeStringField(
+ Constants.JSON_METADATA_ETAG,
+ container.getMetadataETag());
+ }
+ }
+
+ if (entitySet.getId() != null) {
+ jgen.writeStringField(Constants.JSON_ID, entitySet.getId().toASCIIString());
+ }
+ jgen.writeNumberField(Constants.JSON_COUNT,
+ entitySet.getCount() == null ? entitySet.getEntities().size() : entitySet.getCount());
+ if (serverMode) {
+ if (entitySet.getNext() != null) {
+ jgen.writeStringField(Constants.JSON_NEXT_LINK,
+ entitySet.getNext().toASCIIString());
+ }
+ if (entitySet.getDeltaLink() != null) {
+ jgen.writeStringField(Constants.JSON_DELTA_LINK,
+ entitySet.getDeltaLink().toASCIIString());
+ }
+ }
+
+ for (Annotation annotation : entitySet.getAnnotations()) {
+ valuable(jgen, annotation, "@" + annotation.getTerm());
+ }
+
+ jgen.writeArrayFieldStart(Constants.VALUE);
+ final JsonEntitySerializer entitySerializer = new JsonEntitySerializer(serverMode, contentType);
+ for (Entity entity : entitySet.getEntities()) {
+ entitySerializer.doSerialize(entity, jgen);
+ }
+ jgen.writeEndArray();
+
+ jgen.writeEndObject();
+ }
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonGeoValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonGeoValueDeserializer.java
new file mode 100644
index 0000000..75aab4a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonGeoValueDeserializer.java
@@ -0,0 +1,262 @@
+/*
+ * 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.serialization;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.GeoUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+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.geo.SRID;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+class JsonGeoValueDeserializer {
+
+ private Point point(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final SRID srid) {
+ Point point = null;
+
+ if (itor.hasNext()) {
+ 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));
+ point.setY(EdmDouble.getInstance().valueOfString(itor.next().asText(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException("While deserializing point coordinates as double", e);
+ }
+ }
+
+ return point;
+ }
+
+ private MultiPoint multipoint(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final SRID srid) {
+ final MultiPoint multiPoint;
+
+ if (itor.hasNext()) {
+ final List<Point> points = new ArrayList<Point>();
+ while (itor.hasNext()) {
+ final Iterator<JsonNode> mpItor = itor.next().elements();
+ points.add(point(mpItor, type, srid));
+ }
+ multiPoint = new MultiPoint(GeoUtils.getDimension(type), srid, points);
+ } else {
+ multiPoint = new MultiPoint(GeoUtils.getDimension(type), srid, Collections.<Point> emptyList());
+ }
+
+ return multiPoint;
+ }
+
+ private LineString lineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final SRID srid) {
+ final LineString lineString;
+
+ if (itor.hasNext()) {
+ final List<Point> points = new ArrayList<Point>();
+ while (itor.hasNext()) {
+ final Iterator<JsonNode> mpItor = itor.next().elements();
+ points.add(point(mpItor, type, srid));
+ }
+ lineString = new LineString(GeoUtils.getDimension(type), srid, points);
+ } else {
+ lineString = new LineString(GeoUtils.getDimension(type), srid, Collections.<Point> emptyList());
+ }
+
+ return lineString;
+ }
+
+ private MultiLineString multiLineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
+ final SRID srid) {
+
+ final MultiLineString multiLineString;
+
+ if (itor.hasNext()) {
+ final List<LineString> lineStrings = new ArrayList<LineString>();
+ while (itor.hasNext()) {
+ final Iterator<JsonNode> mlsItor = itor.next().elements();
+ lineStrings.add(lineString(mlsItor, type, srid));
+ }
+ multiLineString = new MultiLineString(GeoUtils.getDimension(type), srid, lineStrings);
+ } else {
+ multiLineString = new MultiLineString(GeoUtils.getDimension(type), srid, Collections.<LineString> emptyList());
+ }
+
+ return multiLineString;
+ }
+
+ private Polygon polygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final SRID srid) {
+ List<Point> extPoints = null;
+ if (itor.hasNext()) {
+ final Iterator<JsonNode> extItor = itor.next().elements();
+ if (extItor.hasNext()) {
+ extPoints = new ArrayList<Point>();
+ while (extItor.hasNext()) {
+ final Iterator<JsonNode> mpItor = extItor.next().elements();
+ extPoints.add(point(mpItor, type, srid));
+ }
+ }
+ }
+
+ List<Point> intPoints = null;
+ if (itor.hasNext()) {
+ final Iterator<JsonNode> intItor = itor.next().elements();
+ if (intItor.hasNext()) {
+ intPoints = new ArrayList<Point>();
+ while (intItor.hasNext()) {
+ final Iterator<JsonNode> mpItor = intItor.next().elements();
+ intPoints.add(point(mpItor, type, srid));
+ }
+ }
+ }
+
+ return new Polygon(GeoUtils.getDimension(type), srid, intPoints, extPoints);
+ }
+
+ private MultiPolygon multiPolygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final SRID srid) {
+ final MultiPolygon multiPolygon;
+
+ if (itor.hasNext()) {
+ final List<Polygon> polygons = new ArrayList<Polygon>();
+ while (itor.hasNext()) {
+ final Iterator<JsonNode> mpItor = itor.next().elements();
+ polygons.add(polygon(mpItor, type, srid));
+ }
+ multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), srid, polygons);
+ } else {
+ multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), srid, Collections.<Polygon> emptyList());
+ }
+
+ return multiPolygon;
+ }
+
+ private GeospatialCollection collection(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
+ final SRID srid) {
+
+ final GeospatialCollection collection;
+
+ if (itor.hasNext()) {
+ final List<Geospatial> geospatials = new ArrayList<Geospatial>();
+
+ while (itor.hasNext()) {
+ final JsonNode geo = itor.next();
+ final String collItemType = geo.get(Constants.ATTR_TYPE).asText();
+ final String callAsType;
+ if (EdmPrimitiveTypeKind.GeographyCollection.name().equals(collItemType)
+ || EdmPrimitiveTypeKind.GeometryCollection.name().equals(collItemType)) {
+
+ callAsType = collItemType;
+ } else {
+ callAsType = (type == EdmPrimitiveTypeKind.GeographyCollection ? "Geography" : "Geometry")
+ + collItemType;
+ }
+
+ geospatials.add(deserialize(geo, new EdmTypeInfo.Builder().setTypeExpression(callAsType).build()));
+ }
+
+ collection = new GeospatialCollection(GeoUtils.getDimension(type), srid, geospatials);
+ } else {
+ collection = new GeospatialCollection(GeoUtils.getDimension(type), srid, Collections.<Geospatial> emptyList());
+ }
+
+ return collection;
+ }
+
+ public Geospatial deserialize(final JsonNode node, final EdmTypeInfo typeInfo) {
+ final EdmPrimitiveTypeKind actualType;
+ if ((typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geography
+ || typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geometry)
+ && node.has(Constants.ATTR_TYPE)) {
+
+ String nodeType = node.get(Constants.ATTR_TYPE).asText();
+ if (nodeType.startsWith("Geo")) {
+ final int yIdx = nodeType.indexOf('y');
+ nodeType = nodeType.substring(yIdx + 1);
+ }
+ actualType = EdmPrimitiveTypeKind.valueOfFQN(typeInfo.getFullQualifiedName().toString() + nodeType);
+ } else {
+ actualType = typeInfo.getPrimitiveTypeKind();
+ }
+
+ final Iterator<JsonNode> cooItor = node.has(Constants.JSON_COORDINATES)
+ ? node.get(Constants.JSON_COORDINATES).elements()
+ : Collections.<JsonNode> emptyList().iterator();
+
+ SRID srid = null;
+ if (node.has(Constants.JSON_CRS)) {
+ srid = SRID.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, srid);
+ break;
+
+ case GeographyMultiPoint:
+ case GeometryMultiPoint:
+ value = multipoint(cooItor, actualType, srid);
+ break;
+
+ case GeographyLineString:
+ case GeometryLineString:
+ value = lineString(cooItor, actualType, srid);
+ break;
+
+ case GeographyMultiLineString:
+ case GeometryMultiLineString:
+ value = multiLineString(cooItor, actualType, srid);
+ break;
+
+ case GeographyPolygon:
+ case GeometryPolygon:
+ value = polygon(cooItor, actualType, srid);
+ break;
+
+ case GeographyMultiPolygon:
+ case GeometryMultiPolygon:
+ value = multiPolygon(cooItor, actualType, srid);
+ break;
+
+ case GeographyCollection:
+ case GeometryCollection:
+ value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), actualType, srid);
+ break;
+
+ default:
+ }
+
+ return value;
+ }
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonGeoValueSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonGeoValueSerializer.java
new file mode 100644
index 0000000..12ac4f5
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonGeoValueSerializer.java
@@ -0,0 +1,184 @@
+/*
+ * 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.serialization;
+
+import java.io.IOException;
+
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.ComposedGeospatial;
+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.geo.SRID;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+
+class JsonGeoValueSerializer {
+
+ private void srid(final JsonGenerator jgen, final SRID 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:" + srid.toString());
+ jgen.writeEndObject();
+ jgen.writeEndObject();
+ }
+
+ private void point(final JsonGenerator jgen, final Point point) throws IOException {
+ try {
+ jgen.writeNumber(EdmDouble.getInstance().valueToString(point.getX(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
+ jgen.writeNumber(EdmDouble.getInstance().valueToString(point.getY(), null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException("While serializing point coordinates as double", e);
+ }
+ }
+
+ private void multipoint(final JsonGenerator jgen, final MultiPoint multiPoint) throws IOException {
+ for (Point point : multiPoint) {
+ jgen.writeStartArray();
+ point(jgen, point);
+ jgen.writeEndArray();
+ }
+ }
+
+ private void lineString(final JsonGenerator jgen, final ComposedGeospatial<Point> lineString) throws IOException {
+ for (Point point : lineString) {
+ jgen.writeStartArray();
+ point(jgen, point);
+ jgen.writeEndArray();
+ }
+ }
+
+ private void multiLineString(final JsonGenerator jgen, final MultiLineString multiLineString) throws IOException {
+ for (LineString lineString : multiLineString) {
+ jgen.writeStartArray();
+ lineString(jgen, lineString);
+ jgen.writeEndArray();
+ }
+ }
+
+ private void polygon(final JsonGenerator jgen, final Polygon polygon) throws IOException {
+ if (!polygon.getExterior().isEmpty()) {
+ jgen.writeStartArray();
+ lineString(jgen, polygon.getExterior());
+ jgen.writeEndArray();
+ }
+ if (!polygon.getInterior().isEmpty()) {
+ jgen.writeStartArray();
+ lineString(jgen, polygon.getInterior());
+ jgen.writeEndArray();
+ }
+ }
+
+ private void multiPolygon(final JsonGenerator jgen, final MultiPolygon multiPolygon) throws IOException {
+ for (Polygon polygon : multiPolygon) {
+ jgen.writeStartArray();
+ polygon(jgen, polygon);
+ jgen.writeEndArray();
+ }
+ }
+
+ private void collection(final JsonGenerator jgen, final GeospatialCollection collection) throws IOException {
+ jgen.writeArrayFieldStart(Constants.JSON_GEOMETRIES);
+ for (Geospatial geospatial : collection) {
+ jgen.writeStartObject();
+ serialize(jgen, geospatial);
+ jgen.writeEndObject();
+ }
+ jgen.writeEndArray();
+ }
+
+ public void serialize(final JsonGenerator jgen, final Geospatial value) throws IOException {
+ if (value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeographyCollection)
+ || value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeometryCollection)) {
+
+ jgen.writeStringField(Constants.ATTR_TYPE, EdmPrimitiveTypeKind.GeometryCollection.name());
+ } else {
+ final int yIdx = value.getEdmPrimitiveTypeKind().name().indexOf('y');
+ final String itemType = value.getEdmPrimitiveTypeKind().name().substring(yIdx + 1);
+ jgen.writeStringField(Constants.ATTR_TYPE, itemType);
+ }
+
+ switch (value.getEdmPrimitiveTypeKind()) {
+ case GeographyPoint:
+ case GeometryPoint:
+ jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
+ point(jgen, (Point) value);
+ jgen.writeEndArray();
+ break;
+
+ case GeographyMultiPoint:
+ case GeometryMultiPoint:
+ jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
+ multipoint(jgen, (MultiPoint) value);
+ jgen.writeEndArray();
+ break;
+
+ case GeographyLineString:
+ case GeometryLineString:
+ jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
+ lineString(jgen, (LineString) value);
+ jgen.writeEndArray();
+ break;
+
+ case GeographyMultiLineString:
+ case GeometryMultiLineString:
+ jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
+ multiLineString(jgen, (MultiLineString) value);
+ jgen.writeEndArray();
+ break;
+
+ case GeographyPolygon:
+ case GeometryPolygon:
+ jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
+ polygon(jgen, (Polygon) value);
+ jgen.writeEndArray();
+ break;
+
+ case GeographyMultiPolygon:
+ case GeometryMultiPolygon:
+ jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
+ multiPolygon(jgen, (MultiPolygon) value);
+ jgen.writeEndArray();
+ break;
+
+ case GeographyCollection:
+ case GeometryCollection:
+ collection(jgen, (GeospatialCollection) value);
+ break;
+
+ default:
+ }
+
+ if (value.getSrid() != null && value.getSrid().isNotDefault()) {
+ srid(jgen, value.getSrid());
+ }
+ }
+
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonODataErrorDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonODataErrorDeserializer.java
new file mode 100644
index 0000000..65a473e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonODataErrorDeserializer.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.client.core.serialization;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.ex.ODataError;
+import org.apache.olingo.commons.api.ex.ODataErrorDetail;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+public class JsonODataErrorDeserializer extends JsonDeserializer {
+
+ public JsonODataErrorDeserializer(final boolean serverMode) {
+ super(serverMode);
+ }
+
+ protected ODataError doDeserialize(final JsonParser parser) throws IOException {
+
+ final ODataError error = new ODataError();
+
+ final ObjectNode tree = parser.getCodec().readTree(parser);
+ if (tree.has(Constants.JSON_ERROR)) {
+ final JsonNode errorNode = tree.get(Constants.JSON_ERROR);
+
+ 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());
+ }
+ if (errorNode.hasNonNull(Constants.ERROR_DETAILS)) {
+ List<ODataErrorDetail> details = new ArrayList<ODataErrorDetail>();
+ JsonODataErrorDetailDeserializer detailDeserializer = new JsonODataErrorDetailDeserializer(serverMode);
+ for (JsonNode jsonNode : errorNode.get(Constants.ERROR_DETAILS)) {
+ details.add(detailDeserializer.doDeserialize(jsonNode.traverse(parser.getCodec()))
+ .getPayload());
+ }
+
+ error.setDetails(details);
+ }
+ if (errorNode.hasNonNull(Constants.ERROR_INNERERROR)) {
+ HashMap<String, String> innerErrorMap = new HashMap<String, String>();
+ final JsonNode innerError = errorNode.get(Constants.ERROR_INNERERROR);
+ for (final Iterator<String> itor = innerError.fieldNames(); itor.hasNext();) {
+ final String keyTmp = itor.next();
+ final String val = innerError.get(keyTmp).toString();
+ innerErrorMap.put(keyTmp, val);
+ }
+ error.setInnerError(innerErrorMap);
+ }
+ }
+
+ return error;
+ }
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonODataErrorDetailDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonODataErrorDetailDeserializer.java
new file mode 100644
index 0000000..7457d82
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonODataErrorDetailDeserializer.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.client.core.serialization;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.ex.ODataErrorDetail;
+import org.apache.olingo.commons.api.data.ResWrap;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.JsonNode;
+
+public class JsonODataErrorDetailDeserializer extends JsonDeserializer {
+
+ public JsonODataErrorDetailDeserializer(final boolean serverMode) {
+ super(serverMode);
+ }
+
+ protected ResWrap<ODataErrorDetail> doDeserialize(final JsonParser parser) throws IOException {
+
+ final ODataErrorDetail error = new ODataErrorDetail();
+ final JsonNode errorNode = parser.getCodec().readTree(parser);
+ 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 ResWrap<ODataErrorDetail>((URI) null, null, error);
+ }
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonPropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonPropertyDeserializer.java
new file mode 100644
index 0000000..3a59650
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonPropertyDeserializer.java
@@ -0,0 +1,114 @@
+/*
+ * 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.serialization;
+
+import java.io.IOException;
+import java.net.URI;
+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.Annotation;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+/**
+ * Parse JSON string into <tt>Property</tt>.
+ */
+public class JsonPropertyDeserializer extends JsonDeserializer {
+
+ public JsonPropertyDeserializer(final boolean serverMode) {
+ super(serverMode);
+ }
+
+ protected ResWrap<Property> doDeserialize(final JsonParser parser) throws IOException {
+
+ final ObjectNode tree = parser.getCodec().readTree(parser);
+
+ final String metadataETag;
+ final URI contextURL;
+ final Property property = new Property();
+
+ 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(new EdmTypeInfo.Builder().
+ setTypeExpression(StringUtils.substringAfterLast(contextURL.toASCIIString(), "#")).build().internal());
+ tree.remove(Constants.JSON_METADATA);
+ } else {
+ contextURL = null;
+ }
+
+ if (tree.has(Constants.JSON_TYPE)) {
+ property.setType(new EdmTypeInfo.Builder().setTypeExpression(tree.get(Constants.JSON_TYPE).textValue()).build()
+ .internal());
+ tree.remove(Constants.JSON_TYPE);
+ }
+
+ if (tree.has(Constants.JSON_NULL) && tree.get(Constants.JSON_NULL).asBoolean()) {
+ property.setValue(ValueType.PRIMITIVE, null);
+ tree.remove(Constants.JSON_NULL);
+ }
+
+ if (property.getValue() == null) {
+ try {
+ value(property, tree.has(Constants.VALUE) ? tree.get(Constants.VALUE) : tree, parser.getCodec());
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new IOException(e);
+ }
+ tree.remove(Constants.VALUE);
+ }
+
+ // any remaining entry is supposed to be an annotation or is ignored
+ for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
+ final Map.Entry<String, JsonNode> field = itor.next();
+ if (field.getKey().charAt(0) == '@') {
+ final Annotation annotation = new Annotation();
+ annotation.setTerm(field.getKey().substring(1));
+
+ try {
+ value(annotation, field.getValue(), parser.getCodec());
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new IOException(e);
+ }
+ property.getAnnotations().add(annotation);
+ }
+ }
+
+ return new ResWrap<Property>(contextURL, metadataETag, property);
+ }
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonPropertySerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonPropertySerializer.java
new file mode 100644
index 0000000..9911d49
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonPropertySerializer.java
@@ -0,0 +1,94 @@
+/*
+ * 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.serialization;
+
+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.Annotation;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+
+/**
+ * Writes out JSON string from <tt>PropertyImpl</tt>.
+ */
+public class JsonPropertySerializer extends JsonSerializer {
+
+ public JsonPropertySerializer(final boolean serverMode, final ContentType contentType) {
+ super(serverMode, contentType);
+ }
+
+ protected void doSerialize(final Property property, final JsonGenerator jgen)
+ throws IOException, EdmPrimitiveTypeException {
+ doContainerSerialize(new ResWrap<Property>((URI) null, null, property), jgen);
+ }
+
+ protected void doContainerSerialize(final ResWrap<Property> container, final JsonGenerator jgen)
+ throws IOException, EdmPrimitiveTypeException {
+
+ final Property property = container.getPayload();
+
+ jgen.writeStartObject();
+
+ if (serverMode && container.getContextURL() != null) {
+ jgen.writeStringField(Constants.JSON_CONTEXT, container.getContextURL().toASCIIString());
+ }
+
+ if (StringUtils.isNotBlank(property.getType())) {
+ jgen.writeStringField(Constants.JSON_TYPE,
+ new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build().external());
+ }
+
+ for (Annotation annotation : property.getAnnotations()) {
+ valuable(jgen, annotation, "@" + annotation.getTerm());
+ }
+
+ if (property.isNull()) {
+ jgen.writeBooleanField(Constants.JSON_NULL, true);
+ } else if (property.isGeospatial() || property.isCollection()) {
+ valuable(jgen, property, Constants.VALUE);
+ } else if (property.isPrimitive()) {
+ final EdmTypeInfo typeInfo = property.getType() == null
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
+
+ jgen.writeFieldName(Constants.VALUE);
+ primitiveValue(jgen, typeInfo, property.asPrimitive());
+ } else if (property.isEnum()) {
+ jgen.writeStringField(Constants.VALUE, property.asEnum().toString());
+ } else if (property.isComplex()) {
+ for (Property cproperty : property.asComplex().getValue()) {
+ valuable(jgen, cproperty, cproperty.getName());
+ }
+ } else if (property.isComplex()) {
+ for (Property cproperty : property.asComplex().getValue()) {
+ valuable(jgen, cproperty, cproperty.getName());
+ }
+ }
+
+ jgen.writeEndObject();
+ }
+}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonSerializer.java
new file mode 100755
index 0000000..d095793
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/JsonSerializer.java
@@ -0,0 +1,387 @@
+/*
+ * 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.serialization;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.serialization.ODataSerializer;
+import org.apache.olingo.client.api.serialization.ODataSerializerException;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Annotatable;
+import org.apache.olingo.commons.api.data.Annotation;
+import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Linked;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.data.Valuable;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonGenerator;
+
+public class JsonSerializer implements ODataSerializer {
+
+ private static final EdmPrimitiveTypeKind[] NUMBER_TYPES = {
+ EdmPrimitiveTypeKind.Byte, EdmPrimitiveTypeKind.SByte,
+ EdmPrimitiveTypeKind.Single, EdmPrimitiveTypeKind.Double,
+ EdmPrimitiveTypeKind.Int16, EdmPrimitiveTypeKind.Int32, EdmPrimitiveTypeKind.Int64,
+ EdmPrimitiveTypeKind.Decimal
+ };
+
+ private final JsonGeoValueSerializer geoSerializer = new JsonGeoValueSerializer();
+
+ protected boolean serverMode;
+ protected final boolean isIEEE754Compatible;
+ protected ContentType contentType;
+
+ public JsonSerializer(final boolean serverMode, final ContentType contentType) {
+ this.serverMode = serverMode;
+ this.contentType = contentType;
+ this.isIEEE754Compatible = isIEEE754Compatible();
+ }
+
+ @Override
+ public <T> void write(final Writer writer, final T obj) throws ODataSerializerException {
+ try {
+ final JsonGenerator json = new JsonFactory().createGenerator(writer);
+ if (obj instanceof EntityCollection) {
+ new JsonEntitySetSerializer(serverMode, contentType).doSerialize((EntityCollection) obj, json);
+ } else if (obj instanceof Entity) {
+ new JsonEntitySerializer(serverMode, contentType).doSerialize((Entity) obj, json);
+ } else if (obj instanceof Property) {
+ new JsonPropertySerializer(serverMode, contentType).doSerialize((Property) obj, json);
+ } else if (obj instanceof Link) {
+ link((Link) obj, json);
+ }
+ json.flush();
+ } catch (final IOException e) {
+ throw new ODataSerializerException(e);
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new ODataSerializerException(e);
+ }
+ }
+
+ private void reference(final ResWrap<URI> container, final JsonGenerator json) throws IOException {
+ json.writeStartObject();
+
+ json.writeStringField(Constants.JSON_CONTEXT, container.getContextURL().toASCIIString());
+ json.writeStringField(Constants.JSON_ID, container.getPayload().toASCIIString());
+
+ json.writeEndObject();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> void write(final Writer writer, final ResWrap<T> container) throws ODataSerializerException {
+ final T obj = container == null ? null : container.getPayload();
+ try {
+ final JsonGenerator json = new JsonFactory().createGenerator(writer);
+ if (obj instanceof EntityCollection) {
+ new JsonEntitySetSerializer(serverMode, contentType).doContainerSerialize(
+ (ResWrap<EntityCollection>) container, json);
+ } else if (obj instanceof Entity) {
+ new JsonEntitySerializer(serverMode, contentType).doContainerSerialize((ResWrap<Entity>) container, json);
+ } else if (obj instanceof Property) {
+ new JsonPropertySerializer(serverMode, contentType).doContainerSerialize((ResWrap<Property>) container, json);
+ } else if (obj instanceof Link) {
+ link((Link) obj, json);
+ } else if (obj instanceof URI) {
+ reference((ResWrap<URI>) container, json);
+ }
+ json.flush();
+ } catch (final IOException e) {
+ throw new ODataSerializerException(e);
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new ODataSerializerException(e);
+ }
+ }
+
+ protected void link(final Link link, final JsonGenerator jgen) throws IOException {
+ jgen.writeStartObject();
+ jgen.writeStringField(Constants.JSON_URL, link.getHref());
+ jgen.writeEndObject();
+ }
+
+ protected void links(final Linked linked, final JsonGenerator jgen)
+ throws IOException, EdmPrimitiveTypeException {
+
+ if (serverMode) {
+ serverLinks(linked, jgen);
+ } else {
+ clientLinks(linked, jgen);
+ }
+ }
+
+ protected void clientLinks(final Linked linked, final JsonGenerator jgen)
+ throws IOException, EdmPrimitiveTypeException {
+
+ final Map<String, List<String>> entitySetLinks = new HashMap<String, List<String>>();
+ for (Link link : linked.getNavigationLinks()) {
+ for (Annotation annotation : link.getAnnotations()) {
+ valuable(jgen, annotation, link.getTitle() + "@" + annotation.getTerm());
+ }
+
+ if (isEntitySetNavigation(link)) {
+ final List<String> uris;
+ if (entitySetLinks.containsKey(link.getTitle())) {
+ uris = entitySetLinks.get(link.getTitle());
+ } else {
+ uris = new ArrayList<String>();
+ entitySetLinks.put(link.getTitle(), uris);
+ }
+ if (StringUtils.isNotBlank(link.getHref())) {
+ uris.add(link.getHref());
+ }
+ } else {
+ if (StringUtils.isNotBlank(link.getHref())) {
+ jgen.writeStringField(link.getTitle() + Constants.JSON_BIND_LINK_SUFFIX, link.getHref());
+ }
+ }
+
+ if (link.getInlineEntity() != null) {
+ jgen.writeFieldName(link.getTitle());
+ new JsonEntitySerializer(serverMode, contentType).doSerialize(link.getInlineEntity(), jgen);
+ } else if (link.getInlineEntitySet() != null) {
+ jgen.writeArrayFieldStart(link.getTitle());
+ final JsonEntitySerializer entitySerializer = new JsonEntitySerializer(serverMode, contentType);
+ for (Entity subEntry : link.getInlineEntitySet().getEntities()) {
+ entitySerializer.doSerialize(subEntry, jgen);
+ }
+ jgen.writeEndArray();
+ }
+ }
+ for (Map.Entry<String, List<String>> entitySetLink : entitySetLinks.entrySet()) {
+ if (!entitySetLink.getValue().isEmpty()) {
+ jgen.writeArrayFieldStart(entitySetLink.getKey() + Constants.JSON_BIND_LINK_SUFFIX);
+ for (String uri : entitySetLink.getValue()) {
+ jgen.writeString(uri);
+ }
+ jgen.writeEndArray();
+ }
+ }
+ }
+
+ private boolean isEntitySetNavigation(final Link link) {
+ return Constants.ENTITY_SET_NAVIGATION_LINK_TYPE.equals(link.getType());
+ }
+
+ protected void serverLinks(final Linked linked, final JsonGenerator jgen)
+ throws IOException, EdmPrimitiveTypeException {
+ if (linked instanceof Entity) {
+ for (Link link : ((Entity) linked).getMediaEditLinks()) {
+ if (StringUtils.isNotBlank(link.getHref())) {
+ jgen.writeStringField(
+ link.getTitle() + StringUtils.prependIfMissing(Constants.JSON_MEDIA_EDIT_LINK, "@"),
+ link.getHref());
+ }
+ }
+ }
+
+ for (Link link : linked.getAssociationLinks()) {
+ if (StringUtils.isNotBlank(link.getHref())) {
+ jgen.writeStringField(
+ link.getTitle() + Constants.JSON_ASSOCIATION_LINK,
+ link.getHref());
+ }
+ }
+
+ for (Link link : linked.getNavigationLinks()) {
+ for (Annotation annotation : link.getAnnotations()) {
+ valuable(jgen, annotation, link.getTitle() + "@" + annotation.getTerm());
+ }
+
+ if (StringUtils.isNotBlank(link.getHref())) {
+ jgen.writeStringField(
+ link.getTitle() + Constants.JSON_NAVIGATION_LINK,
+ link.getHref());
+ }
+
+ if (link.getInlineEntity() != null) {
+ jgen.writeFieldName(link.getTitle());
+ new JsonEntitySerializer(serverMode, contentType).doSerialize(link.getInlineEntity(), jgen);
+ } else if (link.getInlineEntitySet() != null) {
+ jgen.writeArrayFieldStart(link.getTitle());
+ JsonEntitySerializer entitySerializer = new JsonEntitySerializer(serverMode, contentType);
+ for (Entity subEntry : link.getInlineEntitySet().getEntities()) {
+ entitySerializer.doSerialize(subEntry, jgen);
+ }
+ jgen.writeEndArray();
+ }
+ }
+ }
+
+ private void collection(final JsonGenerator jgen, final EdmTypeInfo typeInfo,
+ final ValueType valueType, final List<?> value)
+ throws IOException, EdmPrimitiveTypeException {
+
+ jgen.writeStartArray();
+
+ for (Object item : value) {
+ final EdmTypeInfo itemTypeInfo = typeInfo == null
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
+ switch (valueType) {
+ case COLLECTION_PRIMITIVE:
+ primitiveValue(jgen, itemTypeInfo, item);
+ break;
+
+ case COLLECTION_GEOSPATIAL:
+ jgen.writeStartObject();
+ geoSerializer.serialize(jgen, (Geospatial) item);
+ jgen.writeEndObject();
+ break;
+
+ case COLLECTION_ENUM:
+ jgen.writeString(item.toString());
+ break;
+
+ case COLLECTION_COMPLEX:
+ final ComplexValue complexItem2 = (ComplexValue) item;
+ complexValue(jgen, itemTypeInfo, complexItem2.getValue(), complexItem2);
+ break;
+
+ default:
+ }
+ }
+
+ jgen.writeEndArray();
+ }
+
+ protected void primitiveValue(final JsonGenerator jgen, final EdmTypeInfo typeInfo, final Object value)
+ throws IOException, EdmPrimitiveTypeException {
+
+ final EdmPrimitiveTypeKind kind = typeInfo == null ? null : typeInfo.getPrimitiveTypeKind();
+ final boolean isNumber = kind == null ? value instanceof Number : ArrayUtils.contains(NUMBER_TYPES, kind);
+ final boolean isBoolean = kind == null ? value instanceof Boolean : kind == EdmPrimitiveTypeKind.Boolean;
+
+ if (value == null) {
+ jgen.writeNull();
+ } else if (isBoolean) {
+ jgen.writeBoolean((Boolean) value);
+ } else {
+ String serialized = kind == null
+ ? value.toString()
+ // TODO: add facets
+ : EdmPrimitiveTypeFactory.getInstance(kind).
+ valueToString(value, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null);
+
+ if(isIEEE754Compatible && (kind == EdmPrimitiveTypeKind.Int64 || kind == EdmPrimitiveTypeKind.Decimal)) {
+ jgen.writeString(serialized);
+ } else if(isNumber) {
+ jgen.writeNumber(serialized);
+ } else {
+ jgen.writeString(serialized);
+ }
+ }
+ }
+
+ private void complexValue(final JsonGenerator jgen, final EdmTypeInfo typeInfo,
+ final List<Property> value, final Linked linked)
+ throws IOException, EdmPrimitiveTypeException {
+ jgen.writeStartObject();
+
+ if (typeInfo != null && !isODataMetadataNone(contentType)) {
+ jgen.writeStringField(Constants.JSON_TYPE, typeInfo.external());
+ }
+
+ for (Property property : value) {
+ valuable(jgen, property, property.getName());
+ }
+ if (linked != null) {
+ links(linked, jgen);
+ }
+
+ jgen.writeEndObject();
+ }
+
+ private void value(final JsonGenerator jgen, final String type, final Valuable value)
+ throws IOException, EdmPrimitiveTypeException {
+ final EdmTypeInfo typeInfo = type == null ? null : new EdmTypeInfo.Builder().setTypeExpression(type).build();
+
+ if (value.isNull()) {
+ jgen.writeNull();
+ } else if (value.isCollection()) {
+ collection(jgen, typeInfo, value.getValueType(), value.asCollection());
+ } else if (value.isPrimitive()) {
+ primitiveValue(jgen, typeInfo, value.asPrimitive());
+ } else if (value.isEnum()) {
+ jgen.writeString(value.asEnum().toString());
+ } else if (value.isGeospatial()) {
+ jgen.writeStartObject();
+ geoSerializer.serialize(jgen, value.asGeospatial());
+ jgen.writeEndObject();
+ } else if (value.isComplex()) {
+ complexValue(jgen, typeInfo, value.asComplex().getValue(), value.asComplex());
+ }
+ }
+
+ protected void valuable(final JsonGenerator jgen, final Valuable valuable, final String name)
+ throws IOException, EdmPrimitiveTypeException {
+
+ if (!Constants.VALUE.equals(name) && !(valuable instanceof Annotation)
+ && !(valuable.isComplex() && !valuable.isCollection())) {
+
+ String type = valuable.getType();
+ if ((!valuable.isCollection() &&
+ StringUtils.isBlank(type) &&
+ valuable.isPrimitive()) || valuable.isNull()) {
+ type = EdmPrimitiveTypeKind.String.getFullQualifiedName().toString();
+ }
+ if (StringUtils.isNotBlank(type) && !isODataMetadataNone(contentType)) {
+ jgen.writeFieldName(
+ name + StringUtils.prependIfMissing(Constants.JSON_TYPE, "@"));
+ jgen.writeString(new EdmTypeInfo.Builder().setTypeExpression(type).build().external());
+ }
+ }
+
+ for (Annotation annotation : ((Annotatable) valuable).getAnnotations()) {
+ valuable(jgen, annotation, name + "@" + annotation.getTerm());
+ }
+
+ jgen.writeFieldName(name);
+ value(jgen, valuable.getType(), valuable);
+ }
+
+ private boolean isIEEE754Compatible() {
+ final String parameter = contentType.getParameters().get(ContentType.PARAMETER_IEEE754_COMPATIBLE);
+ return parameter == null ? false : "true".equals(parameter.toLowerCase());
+ }
+
+ protected boolean isODataMetadataNone(final ContentType contentType) {
+ return contentType.isCompatible(ContentType.APPLICATION_JSON)
+ && ContentType.VALUE_ODATA_METADATA_NONE.equals(contentType.getParameter(ContentType.PARAMETER_ODATA_METADATA));
+ }
+}
\ No newline at end of file
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java
index adecc20..da799d4 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java
@@ -30,25 +30,6 @@
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
-import org.apache.olingo.client.api.serialization.ODataBinder;
-import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Annotatable;
-import org.apache.olingo.commons.api.data.Annotation;
-import org.apache.olingo.commons.api.data.ComplexValue;
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.DeletedEntity;
-import org.apache.olingo.commons.api.data.Delta;
-import org.apache.olingo.commons.api.data.DeltaLink;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Linked;
-import org.apache.olingo.commons.api.data.Operation;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.data.Valuable;
-import org.apache.olingo.commons.api.data.ValueType;
import org.apache.olingo.client.api.domain.ClientAnnotatable;
import org.apache.olingo.client.api.domain.ClientAnnotation;
import org.apache.olingo.client.api.domain.ClientCollectionValue;
@@ -68,6 +49,30 @@
import org.apache.olingo.client.api.domain.ClientServiceDocument;
import org.apache.olingo.client.api.domain.ClientValuable;
import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.client.api.serialization.ODataBinder;
+import org.apache.olingo.client.api.serialization.ODataSerializerException;
+import org.apache.olingo.client.core.domain.ClientAnnotationImpl;
+import org.apache.olingo.client.core.domain.ClientDeletedEntityImpl;
+import org.apache.olingo.client.core.domain.ClientDeltaLinkImpl;
+import org.apache.olingo.client.core.domain.ClientPropertyImpl;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Annotatable;
+import org.apache.olingo.commons.api.data.Annotation;
+import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.DeletedEntity;
+import org.apache.olingo.commons.api.data.Delta;
+import org.apache.olingo.commons.api.data.DeltaLink;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Linked;
+import org.apache.olingo.commons.api.data.Operation;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.data.Valuable;
+import org.apache.olingo.commons.api.data.ValueType;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmBindingTarget;
import org.apache.olingo.commons.api.edm.EdmComplexType;
@@ -86,15 +91,9 @@
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataSerializerException;
-import org.apache.olingo.client.core.domain.ClientAnnotationImpl;
-import org.apache.olingo.client.core.domain.ClientDeletedEntityImpl;
-import org.apache.olingo.client.core.domain.ClientDeltaLinkImpl;
-import org.apache.olingo.client.core.domain.ClientPropertyImpl;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-import org.apache.olingo.commons.core.serialization.ContextURLParser;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -392,7 +391,7 @@
if (LOG.isDebugEnabled()) {
final StringWriter writer = new StringWriter();
try {
- client.getSerializer(ODataFormat.JSON).write(writer, resource.getPayload());
+ client.getSerializer(ContentType.JSON).write(writer, resource.getPayload());
} catch (final ODataSerializerException e) {
LOG.debug("EntitySet -> ODataEntitySet:\n{}", writer.toString());
}
@@ -457,7 +456,7 @@
odataLinked.addLink(createODataInlineEntity(inlineEntity,
URIUtils.getURI(base, href), title, metadataETag));
} else {
- odataLinked.addLink(createODataInlineEntitySet(inlineEntitySet,
+ odataLinked.addLink(createODataInlineEntitySet(inlineEntitySet, href == null?null:
URIUtils.getURI(base, href), title, metadataETag));
}
}
@@ -589,7 +588,7 @@
if (LOG.isDebugEnabled()) {
final StringWriter writer = new StringWriter();
try {
- client.getSerializer(ODataFormat.JSON).write(writer, resource.getPayload());
+ client.getSerializer(ContentType.JSON).write(writer, resource.getPayload());
} catch (final ODataSerializerException e) {
LOG.debug("EntityResource -> ODataEntity:\n{}", writer.toString());
}
@@ -714,6 +713,9 @@
} else {
if (propertyType == null || propertyType.equals(EdmPrimitiveTypeKind.String.getFullQualifiedName().toString())) {
typeInfo = new EdmTypeInfo.Builder().setTypeExpression(typeName.toString()).build();
+ } else if(isPrimiteveType(typeName)) {
+ // Inheritance is not allowed for primitve types, so we use the type given by the EDM
+ typeInfo = new EdmTypeInfo.Builder().setTypeExpression(typeName.toString()).build();
} else {
typeInfo = new EdmTypeInfo.Builder().setTypeExpression(propertyType).build();
}
@@ -721,6 +723,14 @@
return typeInfo;
}
+ private boolean isPrimiteveType(final FullQualifiedName typeName) {
+ try {
+ return EdmPrimitiveTypeKind.valueOfFQN(typeName) != null;
+ } catch (IllegalArgumentException e) {
+ return false;
+ }
+ }
+
protected ClientProperty getODataProperty(final EdmType type, final Property resource) {
final EdmTypeInfo typeInfo = buildTypeInfo(type == null ? null : type.getFullQualifiedName(), resource.getType());
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
index 6c97cdb..1367454 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
@@ -25,25 +25,25 @@
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.client.api.domain.ClientEntitySetIterator;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientServiceDocument;
+import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.client.api.serialization.ODataReader;
import org.apache.olingo.client.core.edm.ClientCsdlEdmProvider;
+import org.apache.olingo.commons.api.ex.ODataError;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.commons.api.ODataError;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.domain.ClientServiceDocument;
-import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -63,7 +63,7 @@
@Override
public Edm readMetadata(final InputStream input) {
- return readMetadata(client.getDeserializer(ODataFormat.XML).toMetadata(input).getSchemaByNsOrAlias());
+ return readMetadata(client.getDeserializer(ContentType.APPLICATION_XML).toMetadata(input).getSchemaByNsOrAlias());
}
@Override
@@ -73,16 +73,16 @@
}
@Override
- public ClientServiceDocument readServiceDocument(final InputStream input, final ODataFormat format)
+ public ClientServiceDocument readServiceDocument(final InputStream input, final ContentType contentType)
throws ODataDeserializerException {
return client.getBinder().getODataServiceDocument(
- client.getDeserializer(format).toServiceDocument(input).getPayload());
+ client.getDeserializer(contentType).toServiceDocument(input).getPayload());
}
@Override
- public ODataError readError(final InputStream inputStream, final ODataFormat format)
+ public ODataError readError(final InputStream inputStream, final ContentType contentType)
throws ODataDeserializerException {
- return client.getDeserializer(format).toError(inputStream);
+ return client.getDeserializer(contentType).toError(inputStream);
}
@Override
@@ -96,22 +96,22 @@
(URI) null,
null,
reference.cast(new ClientEntitySetIterator<ClientEntitySet, ClientEntity>(
- client, src, ODataFormat.fromString(format))));
+ client, src, ContentType.parse(format))));
} else if (ClientEntitySet.class.isAssignableFrom(reference)) {
- final ResWrap<EntityCollection> resource = client.getDeserializer(ODataFormat.fromString(format))
+ final ResWrap<EntityCollection> resource = client.getDeserializer(ContentType.parse(format))
.toEntitySet(src);
res = new ResWrap<T>(
resource.getContextURL(),
resource.getMetadataETag(),
reference.cast(client.getBinder().getODataEntitySet(resource)));
} else if (ClientEntity.class.isAssignableFrom(reference)) {
- final ResWrap<Entity> container = client.getDeserializer(ODataFormat.fromString(format)).toEntity(src);
+ final ResWrap<Entity> container = client.getDeserializer(ContentType.parse(format)).toEntity(src);
res = new ResWrap<T>(
container.getContextURL(),
container.getMetadataETag(),
reference.cast(client.getBinder().getODataEntity(container)));
} else if (ClientProperty.class.isAssignableFrom(reference)) {
- final ResWrap<Property> container = client.getDeserializer(ODataFormat.fromString(format)).toProperty(src);
+ final ResWrap<Property> container = client.getDeserializer(ContentType.parse(format)).toProperty(src);
res = new ResWrap<T>(
container.getContextURL(),
container.getMetadataETag(),
@@ -121,7 +121,7 @@
(URI) null,
null,
reference.cast(client.getObjectFactory().newPrimitiveValueBuilder().
- setType(ODataFormat.fromString(format) == ODataFormat.TEXT_PLAIN
+ setType(ContentType.parse(format).equals(ContentType.TEXT_PLAIN)
? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setValue(IOUtils.toString(src)) // TODO: set correct value
.build()));
@@ -132,7 +132,7 @@
reference.cast(readMetadata(src)));
} else if (ClientServiceDocument.class.isAssignableFrom(reference)) {
final ResWrap<ServiceDocument> resource =
- client.getDeserializer(ODataFormat.fromString(format)).toServiceDocument(src);
+ client.getDeserializer(ContentType.parse(format)).toServiceDocument(src);
res = new ResWrap<T>(
resource.getContextURL(),
resource.getMetadataETag(),
@@ -141,7 +141,7 @@
res = new ResWrap<T>(
(URI) null,
null,
- reference.cast(readError(src, ODataFormat.fromString(format))));
+ reference.cast(readError(src, ContentType.parse(format))));
} else {
throw new IllegalArgumentException("Invalid reference type " + reference);
}
@@ -158,20 +158,20 @@
}
@Override
- public ClientEntitySet readEntitySet(final InputStream input, final ODataFormat format)
+ public ClientEntitySet readEntitySet(final InputStream input, final ContentType contentType)
throws ODataDeserializerException {
- return client.getBinder().getODataEntitySet(client.getDeserializer(format).toEntitySet(input));
+ return client.getBinder().getODataEntitySet(client.getDeserializer(contentType).toEntitySet(input));
}
@Override
- public ClientEntity readEntity(final InputStream input, final ODataFormat format)
+ public ClientEntity readEntity(final InputStream input, final ContentType contentType)
throws ODataDeserializerException {
- return client.getBinder().getODataEntity(client.getDeserializer(format).toEntity(input));
+ return client.getBinder().getODataEntity(client.getDeserializer(contentType).toEntity(input));
}
@Override
- public ClientProperty readProperty(final InputStream input, final ODataFormat format)
+ public ClientProperty readProperty(final InputStream input, final ContentType contentType)
throws ODataDeserializerException {
- return client.getBinder().getODataProperty(client.getDeserializer(format).toProperty(input));
+ return client.getBinder().getODataProperty(client.getDeserializer(contentType).toProperty(input));
}
}
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java
index c891f1e..88a433f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java
@@ -29,14 +29,14 @@
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.serialization.ODataWriter;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientLink;
import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataSerializerException;
+import org.apache.olingo.client.api.serialization.ODataWriter;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.client.api.serialization.ODataSerializerException;
public class ODataWriterImpl implements ODataWriter {
@@ -47,7 +47,7 @@
}
@Override
- public InputStream writeEntities(final Collection<ClientEntity> entities, final ODataFormat format)
+ public InputStream writeEntities(final Collection<ClientEntity> entities, final ContentType contentType)
throws ODataSerializerException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
OutputStreamWriter writer;
@@ -58,7 +58,7 @@
}
try {
for (ClientEntity entity : entities) {
- client.getSerializer(format).write(writer, client.getBinder().getEntity(entity));
+ client.getSerializer(contentType).write(writer, client.getBinder().getEntity(entity));
}
return new ByteArrayInputStream(output.toByteArray());
@@ -68,13 +68,13 @@
}
@Override
- public InputStream writeEntity(final ClientEntity entity, final ODataFormat format)
+ public InputStream writeEntity(final ClientEntity entity, final ContentType contentType)
throws ODataSerializerException {
- return writeEntities(Collections.<ClientEntity>singleton(entity), format);
+ return writeEntities(Collections.<ClientEntity>singleton(entity), contentType);
}
@Override
- public InputStream writeProperty(final ClientProperty property, final ODataFormat format)
+ public InputStream writeProperty(final ClientProperty property, final ContentType contentType)
throws ODataSerializerException {
final ByteArrayOutputStream output = new ByteArrayOutputStream();
OutputStreamWriter writer;
@@ -84,7 +84,7 @@
writer = null;
}
try {
- client.getSerializer(format).write(writer, client.getBinder().getProperty(property));
+ client.getSerializer(contentType).write(writer, client.getBinder().getProperty(property));
return new ByteArrayInputStream(output.toByteArray());
} finally {
@@ -93,7 +93,7 @@
}
@Override
- public InputStream writeLink(final ClientLink link, final ODataFormat format) throws ODataSerializerException {
+ public InputStream writeLink(final ClientLink link, final ContentType contentType) throws ODataSerializerException {
final ByteArrayOutputStream output = new ByteArrayOutputStream();
OutputStreamWriter writer;
try {
@@ -102,7 +102,7 @@
writer = null;
}
try {
- client.getSerializer(format).write(writer, client.getBinder().getLink(link));
+ client.getSerializer(contentType).write(writer, client.getBinder().getLink(link));
return new ByteArrayInputStream(output.toByteArray());
} finally {
@@ -111,7 +111,7 @@
}
@Override
- public InputStream writeReference(ResWrap<URI> reference, ODataFormat format) throws ODataSerializerException {
+ public InputStream writeReference(ResWrap<URI> reference, ContentType contenType) throws ODataSerializerException {
final ByteArrayOutputStream output = new ByteArrayOutputStream();
OutputStreamWriter writer;
@@ -122,7 +122,7 @@
}
try {
- client.getSerializer(format).write(writer, reference);
+ client.getSerializer(contenType).write(writer, reference);
return new ByteArrayInputStream(output.toByteArray());
} finally {
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterArgFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterArgFactoryImpl.java
index 02e9c63..d6996b2 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterArgFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterArgFactoryImpl.java
@@ -25,7 +25,7 @@
public class FilterArgFactoryImpl implements FilterArgFactory {
@Override
- public FilterArg _null() {
+ public FilterArg nullValue() {
return new FilterConst("null");
}
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 60c8074..9d52f5c 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
@@ -262,7 +262,7 @@
: obj.toString();
}
} catch (Exception e) {
- LOG.warn("While escaping '{}', using toString()", obj, e);
+ LOG.warn("While escaping '{}', using getName()", obj, e);
if (obj == null) {
value = "null";
} else {
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 c0a346a..bc116a8 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
@@ -19,7 +19,7 @@
package org.apache.olingo.client.core;
import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.custommonkey.xmlunit.XMLUnit;
import org.junit.BeforeClass;
@@ -43,7 +43,9 @@
v4Client = ODataClientFactory.getClient();
}
- protected String getSuffix(final ODataFormat format) {
- return format == ODataFormat.ATOM || format == ODataFormat.XML ? "xml" : "json";
+ protected String getSuffix(final ContentType contentType) {
+ return contentType.isCompatible(ContentType.APPLICATION_ATOM_SVC)
+ || contentType.isCompatible(ContentType.APPLICATION_ATOM_XML)
+ || contentType.isCompatible(ContentType.APPLICATION_XML) ? "xml": "json";
}
}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AtomTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AtomTest.java
new file mode 100644
index 0000000..9d5346b
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AtomTest.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringWriter;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.custommonkey.xmlunit.Diff;
+
+public class AtomTest extends JSONTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ @Override
+ protected ContentType getODataPubFormat() {
+ return ContentType.APPLICATION_ATOM_XML;
+ }
+
+ @Override
+ protected ContentType getODataFormat() {
+ return ContentType.APPLICATION_XML;
+ }
+
+ private String cleanup(final String input) throws Exception {
+ final TransformerFactory factory = TransformerFactory.newInstance();
+ final Source xslt = new StreamSource(getClass().getResourceAsStream("atom_cleanup.xsl"));
+ final Transformer transformer = factory.newTransformer(xslt);
+
+ final StringWriter result = new StringWriter();
+ transformer.transform(new StreamSource(new ByteArrayInputStream(input.getBytes())), new StreamResult(result));
+ return result.toString();
+ }
+
+ @Override
+ protected void assertSimilar(final String filename, final String actual) throws Exception {
+ final Diff diff = new Diff(cleanup(IOUtils.toString(getClass().getResourceAsStream(filename))), actual);
+ diff.overrideElementQualifier(new AtomLinksQualifier());
+ assertTrue(diff.similar());
+ }
+
+ @Override
+ public void additionalEntities() throws Exception {
+ // no test
+ }
+
+ @Override
+ public void issueOLINGO390() throws Exception {
+ // no test
+ }
+
+}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/EntitySetTest.java
new file mode 100644
index 0000000..70f92cb
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/EntitySetTest.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.client.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
+import org.junit.Test;
+
+public class EntitySetTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ private void read(final ContentType contentType) throws IOException, ODataDeserializerException {
+ final InputStream input = getClass().getResourceAsStream("Customers." + getSuffix(contentType));
+ final ClientEntitySet entitySet = getClient().getBinder().getODataEntitySet(
+ getClient().getDeserializer(contentType).toEntitySet(input));
+ assertNotNull(entitySet);
+
+ assertEquals(2, entitySet.getEntities().size());
+ assertNull(entitySet.getNext());
+
+ final ClientEntitySet written =
+ getClient().getBinder().getODataEntitySet(new ResWrap<EntityCollection>((URI) null, null,
+ getClient().getBinder().getEntitySet(entitySet)));
+ assertEquals(entitySet, written);
+ }
+
+ @Test
+ public void fromAtom() throws Exception {
+ read(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void fromJSON() throws Exception {
+ read(ContentType.JSON);
+ }
+
+ private void ref(final ContentType contentType) throws ODataDeserializerException {
+ final InputStream input = getClass().getResourceAsStream("collectionOfEntityReferences." + getSuffix(contentType));
+ final ClientEntitySet entitySet = getClient().getBinder().getODataEntitySet(
+ getClient().getDeserializer(contentType).toEntitySet(input));
+ assertNotNull(entitySet);
+
+ for (ClientEntity entity : entitySet.getEntities()) {
+ assertNotNull(entity.getId());
+ }
+ entitySet.setCount(entitySet.getEntities().size());
+
+ final ClientEntitySet written =
+ getClient().getBinder().getODataEntitySet(new ResWrap<EntityCollection>((URI) null, null,
+ getClient().getBinder().getEntitySet(entitySet)));
+ assertEquals(entitySet, written);
+ }
+
+ @Test
+ public void atomRef() throws Exception {
+ ref(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonRef() throws Exception {
+ ref(ContentType.JSON);
+ }
+}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/EntityTest.java
new file mode 100644
index 0000000..77a9c39
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/EntityTest.java
@@ -0,0 +1,390 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.util.Iterator;
+
+import org.apache.olingo.client.api.EdmEnabledODataClient;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.domain.ClientAnnotation;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
+import org.apache.olingo.client.api.domain.ClientLink;
+import org.apache.olingo.client.api.domain.ClientLinkType;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientValuable;
+import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.client.core.EdmEnabledODataClientImpl;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class EntityTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ private EdmEnabledODataClient getEdmEnabledClient() {
+ return new EdmEnabledODataClientImpl(null, null, null) {
+
+ private Edm edm;
+
+ @Override
+ public Edm getEdm(final String metadataETag) {
+ return getCachedEdm();
+ }
+
+ @Override
+ public Edm getCachedEdm() {
+ if (edm == null) {
+ edm = getReader().readMetadata(getClass().getResourceAsStream("staticservice-metadata.xml"));
+ }
+ return edm;
+ }
+
+ };
+ }
+
+ private void singleton(final ContentType contentType) throws Exception {
+ final InputStream input = getClass().getResourceAsStream("VipCustomer." + getSuffix(contentType));
+ final ClientEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer(contentType).toEntity(input));
+ assertNotNull(entity);
+
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
+
+ final ClientProperty birthday = entity.getProperty("Birthday");
+ assertTrue(birthday.hasPrimitiveValue());
+ assertEquals(EdmDateTimeOffset.getInstance(), birthday.getPrimitiveValue().getType());
+
+ final ClientProperty timeBetweenLastTwoOrders = entity.getProperty("TimeBetweenLastTwoOrders");
+ assertTrue(timeBetweenLastTwoOrders.hasPrimitiveValue());
+ assertEquals(EdmDuration.getInstance(), timeBetweenLastTwoOrders.getPrimitiveValue().getType());
+
+ int checked = 0;
+ for (ClientLink link : entity.getNavigationLinks()) {
+ if ("Parent".equals(link.getName())) {
+ checked++;
+ assertEquals(ClientLinkType.ENTITY_NAVIGATION, link.getType());
+ }
+ if ("Orders".equals(link.getName())) {
+ checked++;
+ if (contentType.isCompatible(ContentType.APPLICATION_ATOM_SVC)
+ || contentType.isCompatible(ContentType.APPLICATION_ATOM_XML)) {
+ assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, link.getType());
+ }
+ }
+ if ("Company".equals(link.getName())) {
+ checked++;
+ assertEquals(ClientLinkType.ENTITY_NAVIGATION, link.getType());
+ }
+ }
+ assertEquals(3, checked);
+
+ assertEquals(2, entity.getOperations().size());
+ assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
+ entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.ResetAddress").getMetadataAnchor());
+ assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
+ entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress").getMetadataAnchor());
+
+ // operations won't get serialized
+ entity.getOperations().clear();
+ final ClientEntity written = getClient().getBinder().getODataEntity(
+ new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
+ assertEquals(entity, written);
+ input.close();
+ }
+
+ @Test
+ public void atomSingleton() throws Exception {
+ singleton(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonSingleton() throws Exception {
+ singleton(ContentType.JSON_FULL_METADATA);
+ }
+
+ private void withEnums(final ContentType contentType) throws Exception {
+ final InputStream input = getClass().getResourceAsStream("Products_5." + getSuffix(contentType));
+ final ClientEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer(contentType).toEntity(input));
+ assertNotNull(entity);
+
+ final ClientProperty skinColor = entity.getProperty("SkinColor");
+ assertTrue(skinColor.hasEnumValue());
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", skinColor.getEnumValue().getTypeName());
+ assertEquals("Red", skinColor.getEnumValue().getValue());
+
+ final ClientProperty coverColors = entity.getProperty("CoverColors");
+ assertTrue(coverColors.hasCollectionValue());
+ for (final Iterator<ClientValue> itor = coverColors.getCollectionValue().iterator(); itor.hasNext();) {
+ final ClientValue item = itor.next();
+ assertTrue(item.isEnum());
+ }
+
+ // operations won't get serialized
+ entity.getOperations().clear();
+ final ClientEntity written = getClient().getBinder().getODataEntity(
+ new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
+ assertEquals(entity, written);
+ input.close();
+ }
+
+ @Test
+ public void atomWithEnums() throws Exception {
+ withEnums(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonWithEnums() throws Exception {
+ withEnums(ContentType.JSON_FULL_METADATA);
+ }
+
+ private void withInlineEntitySet(final ContentType contentType) throws Exception {
+ final InputStream input = getClass().getResourceAsStream(
+ "Accounts_101_expand_MyPaymentInstruments." + getSuffix(contentType));
+ final ClientEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer(contentType).toEntity(input));
+ assertNotNull(entity);
+
+ final ClientLink instruments = entity.getNavigationLink("MyPaymentInstruments");
+ assertNotNull(instruments);
+ assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, instruments.getType());
+
+ final ClientInlineEntitySet inline = instruments.asInlineEntitySet();
+ assertNotNull(inline);
+ assertEquals(3, inline.getEntitySet().getEntities().size());
+
+ // count shouldn't be serialized
+ inline.getEntitySet().setCount(3);
+ // operations won't get serialized
+ entity.getOperations().clear();
+ final ClientEntity written = getClient().getBinder().getODataEntity(
+ new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
+ assertEquals(entity, written);
+ input.close();
+ }
+
+ @Test
+ public void atomWithInlineEntitySet() throws Exception {
+ withInlineEntitySet(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonWithInlineEntitySet() throws Exception {
+ withInlineEntitySet(ContentType.JSON_FULL_METADATA);
+ }
+
+ private void mediaEntity(final ContentType contentType) throws Exception {
+ final InputStream input = getClass().getResourceAsStream(
+ "Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7." + getSuffix(contentType));
+ final ClientEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer(contentType).toEntity(input));
+ assertNotNull(entity);
+
+ assertTrue(entity.isMediaEntity());
+ assertNotNull(entity.getMediaContentSource());
+ assertEquals("\"8zOOKKvgOtptr4gt8IrnapX3jds=\"", entity.getMediaETag());
+
+ final ClientEntity written = getClient().getBinder().getODataEntity(
+ new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
+ assertEquals(entity, written);
+ input.close();
+ }
+
+ @Test
+ public void atomMediaEntity() throws Exception {
+ mediaEntity(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonMediaEntity() throws Exception {
+ mediaEntity(ContentType.JSON_FULL_METADATA);
+ }
+
+ private void withStream(final ContentType contentType) throws Exception {
+ final InputStream input = getClass().getResourceAsStream("PersonDetails_1." + getSuffix(contentType));
+ final ClientEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer(contentType).toEntity(input));
+ assertNotNull(entity);
+
+ assertFalse(entity.isMediaEntity());
+
+ final ClientLink editMedia = entity.getMediaEditLink("Photo");
+ assertNotNull(editMedia);
+
+ final ClientEntity written = getClient().getBinder().getODataEntity(
+ new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
+ assertEquals(entity, written);
+ input.close();
+ }
+
+ @Test
+ public void atomWithStream() throws Exception {
+ withStream(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonWithStream() throws Exception {
+ withStream(ContentType.JSON_FULL_METADATA);
+ }
+
+ private void ref(final ContentType contentType) throws Exception {
+ final InputStream input = getClass().getResourceAsStream("entityReference." + getSuffix(contentType));
+ final ClientEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer(contentType).toEntity(input));
+ assertNotNull(entity);
+
+ assertNotNull(entity.getId());
+
+ final ClientEntity written = getClient().getBinder().getODataEntity(
+ new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
+ assertEquals(entity, written);
+ input.close();
+ }
+
+ @Test
+ public void atomRef() throws Exception {
+ ref(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonRef() throws Exception {
+ ref(ContentType.JSON);
+ }
+
+ private void complexNavigationProperties(final ContentType contentType) throws Exception {
+ final InputStream input = getClass().getResourceAsStream("entity.withcomplexnavigation." + getSuffix(contentType));
+ final ClientEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer(contentType).toEntity(input));
+ assertNotNull(entity);
+
+ final ClientComplexValue addressValue = entity.getProperty("Address").getComplexValue();
+ assertNotNull(addressValue);
+ assertNotNull(addressValue.getNavigationLink("Country"));
+
+ // ETag is not serialized
+ entity.setETag(null);
+ final ClientEntity written = getClient().getBinder().getODataEntity(
+ new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
+ assertEquals(entity, written);
+ input.close();
+ }
+
+ @Test
+ public void atomComplexNavigationProperties() throws Exception {
+ complexNavigationProperties(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void jsonComplexNavigationProperties() throws Exception {
+ complexNavigationProperties(ContentType.JSON);
+ }
+
+ private void annotated(final ContentType contentType) throws EdmPrimitiveTypeException, Exception {
+ final InputStream input = getClass().getResourceAsStream("annotated." + getSuffix(contentType));
+ final ClientEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer(contentType).toEntity(input));
+ assertNotNull(entity);
+
+ assertFalse(entity.getAnnotations().isEmpty());
+
+ ClientAnnotation annotation = entity.getAnnotations().get(0);
+ assertEquals("com.contoso.display.highlight", annotation.getTerm());
+ assertEquals(true, annotation.getPrimitiveValue().toCastValue(Boolean.class));
+
+ annotation = entity.getAnnotations().get(1);
+ assertEquals("com.contoso.PersonalInfo.PhoneNumbers", annotation.getTerm());
+ assertTrue(annotation.hasCollectionValue());
+
+ annotation = entity.getProperty("LastName").getAnnotations().get(0);
+ assertEquals("com.contoso.display.style", annotation.getTerm());
+ assertTrue(annotation.hasComplexValue());
+
+ final ClientLink orders = entity.getNavigationLink("Orders");
+ assertFalse(orders.getAnnotations().isEmpty());
+
+ annotation = orders.getAnnotations().get(0);
+ assertEquals("com.contoso.display.style", annotation.getTerm());
+ assertEquals("com.contoso.display.styleType", annotation.getValue().getTypeName());
+ assertTrue(annotation.hasComplexValue());
+ assertEquals(2,
+ annotation.getValue().asComplex().get("order").getPrimitiveValue().toCastValue(Integer.class), 0);
+
+ final ClientEntity written = getClient().getBinder().getODataEntity(
+ new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
+ assertEquals(entity, written);
+ input.close();
+ }
+
+ @Test
+ @Ignore
+ public void atomAnnotated() throws Exception {
+ annotated(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ @Ignore
+ public void jsonAnnotated() throws Exception {
+ annotated(ContentType.JSON);
+ }
+
+ private void derived(final ODataClient client, final ContentType contentType) throws Exception {
+ final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(contentType));
+ final ClientEntity entity = client.getBinder().getODataEntity(client.getDeserializer(contentType).toEntity(input));
+ assertNotNull(entity);
+
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress",
+ ((ClientValuable) entity.getProperty("HomeAddress")).getValue().getTypeName());
+ input.close();
+ }
+
+ @Test
+ public void derivedFromAtom() throws Exception {
+ derived(getClient(), ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void derivedFromJSON() throws Exception {
+ derived(getEdmEnabledClient(), ContentType.JSON);
+ }
+
+ @Test
+ public void derivedFromFullJSON() throws Exception {
+ derived(getClient(), ContentType.JSON_FULL_METADATA);
+ }
+}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/ErrorTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/ErrorTest.java
new file mode 100644
index 0000000..8ced6a3
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
+import org.apache.olingo.commons.api.ex.ODataError;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+public class ErrorTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ private ODataError error(final String name, final ContentType contentType) throws ODataDeserializerException {
+ final ODataError error = getClient().getDeserializer(contentType).toError(
+ getClass().getResourceAsStream(name + "." + getSuffix(contentType)));
+ assertNotNull(error);
+ return error;
+ }
+
+ private void simple(final ContentType contentType) throws ODataDeserializerException {
+ final ODataError error = error("error", contentType);
+ assertEquals("501", error.getCode());
+ assertEquals("Unsupported functionality", error.getMessage());
+ assertEquals("query", error.getTarget());
+ }
+
+ @Test
+ public void jsonSimple() throws Exception {
+ simple(ContentType.JSON);
+ }
+
+ @Test
+ public void atomSimple() throws Exception {
+ simple(ContentType.APPLICATION_ATOM_XML);
+ }
+
+}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/JSONTest.java
new file mode 100644
index 0000000..11a99ed
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/JSONTest.java
@@ -0,0 +1,257 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.domain.ClientCollectionValue;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Delta;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+public class JSONTest extends AbstractTest {
+
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ protected ContentType getODataPubFormat() {
+ return ContentType.JSON;
+ }
+
+ protected ContentType getODataFormat() {
+ return ContentType.JSON;
+ }
+
+ private void cleanup(final ObjectNode node) {
+ if (node.has(Constants.JSON_CONTEXT)) {
+ node.remove(Constants.JSON_CONTEXT);
+ }
+ if (node.has(Constants.JSON_ETAG)) {
+ node.remove(Constants.JSON_ETAG);
+ }
+ if (node.has(Constants.JSON_TYPE)) {
+ node.remove(Constants.JSON_TYPE);
+ }
+ if (node.has(Constants.JSON_EDIT_LINK)) {
+ node.remove(Constants.JSON_EDIT_LINK);
+ }
+ if (node.has(Constants.JSON_READ_LINK)) {
+ node.remove(Constants.JSON_READ_LINK);
+ }
+ if (node.has(Constants.JSON_MEDIA_EDIT_LINK)) {
+ node.remove(Constants.JSON_MEDIA_EDIT_LINK);
+ }
+ if (node.has(Constants.JSON_MEDIA_READ_LINK)) {
+ node.remove(Constants.JSON_MEDIA_READ_LINK);
+ }
+ if (node.has(Constants.JSON_MEDIA_CONTENT_TYPE)) {
+ node.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
+ }
+ if (node.has(Constants.JSON_COUNT)) {
+ node.remove(Constants.JSON_COUNT);
+ }
+ final List<String> toRemove = new ArrayList<String>();
+ for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
+ final Map.Entry<String, JsonNode> field = itor.next();
+
+ final String key = field.getKey();
+ if (key.charAt(0) == '#'
+ || key.endsWith(Constants.JSON_TYPE)
+ || key.endsWith(Constants.JSON_MEDIA_EDIT_LINK)
+ || key.endsWith(Constants.JSON_MEDIA_CONTENT_TYPE)
+ || key.endsWith(Constants.JSON_ASSOCIATION_LINK)
+ || key.endsWith(Constants.JSON_MEDIA_ETAG)) {
+
+ toRemove.add(key);
+ } else if (field.getValue().isObject()) {
+ cleanup((ObjectNode) field.getValue());
+ } else if (field.getValue().isArray()) {
+ for (final Iterator<JsonNode> arrayItems = field.getValue().elements(); arrayItems.hasNext();) {
+ final JsonNode arrayItem = arrayItems.next();
+ if (arrayItem.isObject()) {
+ cleanup((ObjectNode) arrayItem);
+ }
+ }
+ }
+ }
+ node.remove(toRemove);
+ }
+
+ protected void assertSimilar(final String filename, final String actual) throws Exception {
+ final JsonNode expected = OBJECT_MAPPER.readTree(IOUtils.toString(getClass().getResourceAsStream(filename)).
+ replace(Constants.JSON_NAVIGATION_LINK, Constants.JSON_BIND_LINK_SUFFIX));
+ cleanup((ObjectNode) expected);
+ final ObjectNode actualNode = (ObjectNode) OBJECT_MAPPER.readTree(new ByteArrayInputStream(actual.getBytes()));
+ cleanup(actualNode);
+ assertEquals(expected, actualNode);
+ }
+
+ protected void entitySet(final String filename, final ContentType contentType) throws Exception {
+ final StringWriter writer = new StringWriter();
+ getClient().getSerializer(contentType).write(writer, getClient().getDeserializer(contentType).toEntitySet(
+ getClass().getResourceAsStream(filename + "." + getSuffix(contentType))).getPayload());
+
+ assertSimilar(filename + "." + getSuffix(contentType), writer.toString());
+ }
+
+ @Test
+ public void entitySets() throws Exception {
+ entitySet("Customers", getODataPubFormat());
+ entitySet("collectionOfEntityReferences", getODataPubFormat());
+ }
+
+ protected void entity(final String filename, final ContentType contentType) throws Exception {
+ final StringWriter writer = new StringWriter();
+ getClient().getSerializer(contentType).write(writer, getClient().getDeserializer(contentType).toEntity(
+ getClass().getResourceAsStream(filename + "." + getSuffix(contentType))).getPayload());
+ System.out.println(writer.toString());
+ assertSimilar(filename + "." + getSuffix(contentType), writer.toString());
+ }
+
+ @Test
+ public void additionalEntities() throws Exception {
+ entity("entity.minimal", getODataPubFormat());
+ entity("entity.primitive", getODataPubFormat());
+ entity("entity.complex", getODataPubFormat());
+ entity("entity.collection.primitive", getODataPubFormat());
+ entity("entity.collection.complex", getODataPubFormat());
+ }
+
+ @Test
+ public void entities() throws Exception {
+ entity("Products_5", getODataPubFormat());
+ entity("VipCustomer", getODataPubFormat());
+ entity("Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7", getODataPubFormat());
+ entity("entityReference", getODataPubFormat());
+ entity("entity.withcomplexnavigation", getODataPubFormat());
+ entity("annotated", getODataPubFormat());
+ }
+
+ protected void property(final String filename, final ContentType contentType) throws Exception {
+ final StringWriter writer = new StringWriter();
+ getClient().getSerializer(contentType).write(writer, getClient().getDeserializer(contentType).
+ toProperty(getClass().getResourceAsStream(filename + "." + getSuffix(contentType))).getPayload());
+
+ assertSimilar(filename + "." + getSuffix(contentType), writer.toString());
+ }
+
+ @Test
+ public void properties() throws Exception {
+ property("Products_5_SkinColor", getODataFormat());
+ property("Products_5_CoverColors", getODataFormat());
+ property("Employees_3_HomeAddress", getODataFormat());
+ property("Employees_3_HomeAddress", getODataFormat());
+ }
+
+ @Test
+ public void crossjoin() throws Exception {
+ assertNotNull(getClient().getDeserializer(ContentType.JSON_FULL_METADATA).toEntitySet(
+ getClass().getResourceAsStream("crossjoin.json")));
+ }
+
+ protected void delta(final String filename, final ContentType contentType) throws Exception {
+ final Delta delta = getClient().getDeserializer(contentType).toDelta(
+ getClass().getResourceAsStream(filename + "." + getSuffix(contentType))).getPayload();
+ assertNotNull(delta);
+ assertNotNull(delta.getDeltaLink());
+ assertEquals(5, delta.getCount(), 0);
+
+ assertEquals(1, delta.getDeletedEntities().size());
+ assertTrue(delta.getDeletedEntities().get(0).getId().toASCIIString().endsWith("Customers('ANTON')"));
+
+ assertEquals(1, delta.getAddedLinks().size());
+ assertTrue(delta.getAddedLinks().get(0).getSource().toASCIIString().endsWith("Customers('BOTTM')"));
+ assertEquals("Orders", delta.getAddedLinks().get(0).getRelationship());
+
+ assertEquals(1, delta.getDeletedLinks().size());
+ assertTrue(delta.getDeletedLinks().get(0).getSource().toASCIIString().endsWith("Customers('ALFKI')"));
+ assertEquals("Orders", delta.getDeletedLinks().get(0).getRelationship());
+
+ assertEquals(2, delta.getEntities().size());
+ Property property = delta.getEntities().get(0).getProperty("ContactName");
+ assertNotNull(property);
+ assertTrue(property.isPrimitive());
+ property = delta.getEntities().get(1).getProperty("ShippingAddress");
+ assertNotNull(property);
+ assertTrue(property.isComplex());
+ }
+
+ @Test
+ public void deltas() throws Exception {
+ delta("delta", getODataPubFormat());
+ }
+
+ @Test
+ public void issueOLINGO390() throws Exception {
+ final ClientEntity message = getClient().getObjectFactory().
+ newEntity(new FullQualifiedName("Microsoft.Exchange.Services.OData.Model.Message"));
+
+ final ClientComplexValue toRecipient = getClient().getObjectFactory().
+ newComplexValue("Microsoft.Exchange.Services.OData.Model.Recipient");
+ toRecipient.add(getClient().getObjectFactory().newPrimitiveProperty("Name",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("challen_olingo_client")));
+ toRecipient.add(getClient().getObjectFactory().newPrimitiveProperty("Address",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("challenh@microsoft.com")));
+ final ClientCollectionValue<ClientValue> toRecipients = getClient().getObjectFactory().
+ newCollectionValue("Microsoft.Exchange.Services.OData.Model.Recipient");
+ toRecipients.add(toRecipient);
+ message.getProperties().add(getClient().getObjectFactory().newCollectionProperty("ToRecipients", toRecipients));
+
+ final ClientComplexValue body =
+ getClient().getObjectFactory().newComplexValue("Microsoft.Exchange.Services.OData.Model.ItemBody");
+ body.add(getClient().getObjectFactory().newPrimitiveProperty("Content",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ buildString("this is a simple email body content")));
+ body.add(getClient().getObjectFactory().newEnumProperty("ContentType",
+ getClient().getObjectFactory().newEnumValue("Microsoft.Exchange.Services.OData.Model.BodyType", "text")));
+ message.getProperties().add(getClient().getObjectFactory().newComplexProperty("Body", body));
+
+ final String actual = IOUtils.toString(getClient().getWriter().writeEntity(message, ContentType.JSON));
+ final JsonNode expected =
+ OBJECT_MAPPER.readTree(IOUtils.toString(getClass().getResourceAsStream("olingo390.json")).
+ replace(Constants.JSON_NAVIGATION_LINK, Constants.JSON_BIND_LINK_SUFFIX));
+ final ObjectNode actualNode = (ObjectNode) OBJECT_MAPPER.readTree(new ByteArrayInputStream(actual.getBytes()));
+ assertEquals(expected, actualNode);
+ }
+}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java
new file mode 100644
index 0000000..2ee68d7
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java
@@ -0,0 +1,412 @@
+/*
+ * 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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.util.List;
+
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmAnnotations;
+import org.apache.olingo.commons.api.edm.EdmAnnotationsTarget;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmFunction;
+import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.annotation.EdmUrlRef;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotations;
+import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
+import org.apache.olingo.commons.api.edm.provider.CsdlFunction;
+import org.apache.olingo.commons.api.edm.provider.CsdlFunctionImport;
+import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
+import org.apache.olingo.commons.api.edm.provider.CsdlSingleton;
+import org.apache.olingo.commons.api.edm.provider.CsdlTerm;
+import org.apache.olingo.commons.api.edm.provider.annotation.Apply;
+import org.apache.olingo.commons.api.edm.provider.annotation.Collection;
+import org.apache.olingo.commons.api.edm.provider.annotation.ConstantAnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.Path;
+import org.apache.olingo.commons.api.edm.provider.annotation.TwoParamsOpDynamicAnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.UrlRef;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDecimal;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmInt32;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+import org.junit.Test;
+
+public class MetadataTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ @Test
+ public void parse() {
+ final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("metadata.xml"));
+ assertNotNull(edm);
+
+ // 1. Enum
+ final EdmEnumType responseEnumType = edm.getEnumType(
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "ResponseType"));
+ assertNotNull(responseEnumType);
+ assertEquals(6, responseEnumType.getMemberNames().size());
+ assertEquals("3", responseEnumType.getMember("Accepted").getValue());
+ assertEquals(EdmTypeKind.ENUM, responseEnumType.getKind());
+
+ // 2. Complex
+ final EdmComplexType responseStatus = edm.getComplexType(
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "ResponseStatus"));
+ assertNotNull(responseStatus);
+ assertTrue(responseStatus.getNavigationPropertyNames().isEmpty());
+ assertEquals("Recipient", responseStatus.getBaseType().getName());
+ assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.DateTimeOffset),
+ responseStatus.getProperty("Time").getType());
+
+ // 3. Entity
+ final EdmEntityType user = edm.getEntityType(
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "User"));
+ assertNotNull(user);
+ assertFalse(user.getPropertyNames().isEmpty());
+ assertFalse(user.getNavigationPropertyNames().isEmpty());
+
+ final EdmEntityType entity = edm.getEntityType(
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Entity"));
+ assertEquals(entity, user.getBaseType());
+ assertFalse(entity.getPropertyNames().isEmpty());
+ assertTrue(entity.getNavigationPropertyNames().isEmpty());
+
+ final EdmEntityType folder = edm.getEntityType(
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Folder"));
+ assertEquals(folder, user.getNavigationProperty("Inbox").getType());
+
+ // 4. Action
+ final EdmAction move = edm.getBoundAction(
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Move"),
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Folder"),
+ false);
+ assertNotNull(move);
+ assertTrue(move.isBound());
+ assertEquals(2, move.getParameterNames().size());
+ assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String),
+ move.getParameter("DestinationId").getType());
+
+ // 5. EntityContainer
+ final EdmEntityContainer container = edm.getEntityContainer(
+ new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "EntityContainer"));
+ assertNotNull(container);
+ final EdmEntitySet users = container.getEntitySet("Users");
+ assertNotNull(users);
+ assertEquals(edm.getEntityType(new FullQualifiedName(container.getNamespace(), "User")),
+ users.getEntityType());
+ assertEquals(container.getEntitySet("Folders"), users.getRelatedBindingTarget("Folders"));
+ }
+
+ @Test
+ public void demo() {
+ final XMLMetadata metadata = getClient().getDeserializer(ContentType.APPLICATION_XML).
+ toMetadata(getClass().getResourceAsStream("demo-metadata.xml"));
+ assertNotNull(metadata);
+
+ assertFalse(metadata.getSchema(0).getAnnotationGroups().isEmpty());
+ final CsdlAnnotations annots = metadata.getSchema(0).getAnnotationGroup("ODataDemo.DemoService/Suppliers");
+ assertNotNull(annots);
+ assertFalse(annots.getAnnotations().isEmpty());
+ assertEquals(ConstantAnnotationExpression.Type.String,
+ annots.getAnnotation("Org.OData.Publication.V1.PrivacyPolicyUrl").getExpression().asConstant().getType());
+ assertEquals("http://www.odata.org/",
+ annots.getAnnotation("Org.OData.Publication.V1.PrivacyPolicyUrl").getExpression().asConstant().getValue());
+
+ // Now let's test some edm:Annotations
+ final Edm edm = getClient().getReader().
+ readMetadata(getClass().getResourceAsStream("demo-metadata.xml"));
+ assertNotNull(edm);
+
+ final EdmSchema schema = edm.getSchema("ODataDemo");
+ assertNotNull(schema);
+ assertTrue(schema.getAnnotations().isEmpty());
+ assertFalse(schema.getAnnotationGroups().isEmpty());
+
+ final EdmAnnotations annotationGroup = schema.getAnnotationGroups().get(2);
+ assertNotNull(annotationGroup);
+ final EdmAnnotationsTarget annotationsTarget = annotationGroup.getTarget();
+ assertNotNull(annotationsTarget);
+ assertTrue(EdmAnnotationsTarget.TargetType.Property == annotationsTarget.getAnnotationsTargetType());
+ assertEquals(new FullQualifiedName("ODataDemo.Product"), annotationsTarget.getAnnotationsTargetFQN());
+ assertEquals("Name", annotationsTarget.getAnnotationsTargetPath());
+
+ final EdmAnnotation annotation = annotationGroup.getAnnotations().get(0);
+ assertNotNull(annotation);
+ assertTrue(annotation.getExpression().isConstant());
+ assertEquals("Edm.String", annotation.getExpression().asConstant().getValue().getType());
+
+ assertEquals(10, schema.getAnnotationGroups().get(3).getAnnotations().size());
+ }
+
+ @Test
+ public void multipleSchemas() {
+ final XMLMetadata metadata = getClient().getDeserializer(ContentType.APPLICATION_XML).
+ toMetadata(getClass().getResourceAsStream("northwind-metadata.xml"));
+ assertNotNull(metadata);
+
+ final CsdlSchema first = metadata.getSchema("NorthwindModel");
+ assertNotNull(first);
+
+ final CsdlSchema second = metadata.getSchema("ODataWebExperimental.Northwind.Model");
+ assertNotNull(second);
+
+ final CsdlEntityContainer entityContainer = second.getEntityContainer();
+ assertNotNull(entityContainer);
+ assertEquals("NorthwindEntities", entityContainer.getName());
+ }
+
+ /**
+ * Tests Example 85 from CSDL specification.
+ */
+ @Test
+ public void fromdoc1() {
+ final XMLMetadata metadata = getClient().getDeserializer(ContentType.APPLICATION_XML).
+ toMetadata(getClass().getResourceAsStream("fromdoc1-metadata.xml"));
+ assertNotNull(metadata);
+
+ assertFalse(metadata.getReferences().isEmpty());
+ assertEquals("Org.OData.Measures.V1", metadata.getReferences().get(1).getIncludes().get(0).getNamespace());
+
+ final CsdlEntityType product = metadata.getSchema(0).getEntityType("Product");
+ assertTrue(product.hasStream());
+ assertEquals("UoM.ISOCurrency", product.getProperty("Price").getAnnotations().get(0).getTerm());
+ assertEquals("Products", product.getNavigationProperty("Supplier").getPartner());
+
+ final CsdlEntityType category = metadata.getSchema(0).getEntityType("Category");
+ assertNotNull(category);
+
+ final CsdlComplexType address = metadata.getSchema(0).getComplexType("Address");
+ assertFalse(address.getNavigationProperty("Country").getReferentialConstraints().isEmpty());
+ assertEquals("Name",
+ address.getNavigationProperty("Country").getReferentialConstraints().get(0).getReferencedProperty());
+
+ final CsdlFunction productsByRating = metadata.getSchema(0).getFunctions("ProductsByRating").get(0);
+ assertNotNull(productsByRating.getParameter("Rating"));
+ assertEquals("Edm.Int32", productsByRating.getParameter("Rating").getType());
+ assertEquals("ODataDemo.Product", productsByRating.getReturnType().getType());
+ assertTrue(productsByRating.getReturnType().isCollection());
+
+ final CsdlSingleton contoso = metadata.getSchema(0).getEntityContainer().getSingleton("Contoso");
+ assertNotNull(contoso);
+ assertFalse(contoso.getNavigationPropertyBindings().isEmpty());
+ assertEquals("Products", contoso.getNavigationPropertyBindings().get(0).getPath());
+
+ final CsdlFunctionImport functionImport = metadata.getSchema(0).getEntityContainer().
+ getFunctionImport("ProductsByRating");
+ assertNotNull(functionImport);
+ assertEquals(metadata.getSchema(0).getNamespace() + "." + productsByRating.getName(),
+ functionImport.getFunction());
+
+ // Now let's go high-level
+ final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("fromdoc1-metadata.xml"));
+ assertNotNull(edm);
+
+ List<EdmSchema> schemaList = edm.getSchemas();
+ assertNotNull(schemaList);
+ assertEquals(1, schemaList.size());
+ EdmSchema schema = schemaList.get(0);
+
+ EdmEntityContainer demoService = schema.getEntityContainer();
+ assertNotNull(demoService);
+ for (EdmFunction function : schema.getFunctions()) {
+ final EdmFunctionImport fi = demoService.getFunctionImport(function.getName());
+ assertNotNull(fi);
+ assertEquals(demoService.getEntitySet("Products"), fi.getReturnedEntitySet());
+
+ final EdmFunction edmFunction =
+ edm.getUnboundFunction(
+ new FullQualifiedName(metadata.getSchema(0).getNamespace(), "ProductsByRating"), function
+ .getParameterNames());
+ assertNotNull(edmFunction);
+ assertEquals(edmFunction.getName(), fi.getUnboundFunction(function.getParameterNames()).getName());
+ assertEquals(edmFunction.getNamespace(), fi.getUnboundFunction(function.getParameterNames()).getNamespace());
+ assertEquals(edmFunction.getParameterNames(), fi.getUnboundFunction(function.getParameterNames())
+ .getParameterNames());
+ assertEquals(edmFunction.getReturnType().getType().getName(),
+ fi.getUnboundFunction(function.getParameterNames()).getReturnType().getType().getName());
+ assertEquals(edmFunction.getReturnType().getType().getNamespace(),
+ fi.getUnboundFunction(function.getParameterNames()).getReturnType().getType().getNamespace());
+ }
+
+ final EdmTypeDefinition weight = edm.getTypeDefinition(new FullQualifiedName("ODataDemo", "Weight"));
+ assertNotNull(weight);
+ assertEquals(EdmInt32.getInstance(), weight.getUnderlyingType());
+ assertFalse(weight.getAnnotations().isEmpty());
+ assertEquals("Kilograms", weight.getAnnotations().get(0).getExpression().asConstant().getValueAsString());
+ }
+
+ /**
+ * Tests Example 86 from CSDL specification.
+ */
+ @Test
+ public void fromdoc2() {
+ final XMLMetadata metadata = getClient().getDeserializer(ContentType.APPLICATION_XML)
+ .toMetadata(getClass().getResourceAsStream("fromdoc2-metadata.xml"));
+ assertNotNull(metadata);
+
+ // Check displayName
+ final CsdlAnnotation displayName = metadata.getSchema(0).getAnnotationGroup("ODataDemo.Supplier").
+ getAnnotation("Vocabulary1.DisplayName");
+ assertNotNull(displayName);
+ assertTrue(displayName.getExpression().isDynamic());
+
+ assertTrue(displayName.getExpression().asDynamic().isApply());
+ final Apply apply = displayName.getExpression().asDynamic().asApply();
+ assertEquals(Constants.CANONICAL_FUNCTION_CONCAT, apply.getFunction());
+ assertEquals(3, apply.getParameters().size());
+
+ Path path = (Path) apply.getParameters().get(0);
+ assertEquals("Name", path.getValue());
+
+ ConstantAnnotationExpression expression =
+ (ConstantAnnotationExpression) apply.getParameters().get(1);
+ assertEquals(" in ", expression.getValue());
+ assertEquals(ConstantAnnotationExpression.Type.String, expression.getType());
+
+ Path thirdArg = (Path) apply.getParameters().get(2);
+ assertEquals("Address/CountryName", thirdArg.getValue());
+
+ // Check Tags
+ final CsdlAnnotation tags = metadata.getSchema(0).getAnnotationGroup("ODataDemo.Product").
+ getAnnotation("Vocabulary1.Tags");
+ assertNotNull(tags);
+ assertTrue(tags.getExpression().isDynamic());
+
+ assertTrue(tags.getExpression().asDynamic().isCollection());
+ final Collection collection = tags.getExpression().asDynamic().asCollection();
+ assertEquals(1, collection.getItems().size());
+ assertEquals(ConstantAnnotationExpression.Type.String, collection.getItems().get(0).asConstant().getType());
+ assertEquals("MasterData", collection.getItems().get(0).asConstant().getValue());
+ }
+
+ /**
+ * Various annotation examples taken from CSDL specification.
+ */
+ @Test
+ public void fromdoc3() {
+ final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("fromdoc3-metadata.xml"));
+ assertNotNull(edm);
+
+ final EdmAnnotations group = edm.getSchema("Annotations").getAnnotationGroups().get(0);
+ assertNotNull(group);
+
+ final EdmAnnotation time1 = group.getAnnotations().get(0);
+ assertEquals("Edm.TimeOfDay", time1.getExpression().asConstant().getValue().getType());
+
+ final EdmAnnotation time2 = group.getAnnotations().get(1);
+ assertEquals("Edm.TimeOfDay", time2.getExpression().asConstant().getValue().getType());
+ }
+
+ /**
+ * Various annotation examples taken from CSDL specification.
+ */
+ @Test
+ public void fromdoc4() {
+ final XMLMetadata metadata = getClient().getDeserializer(ContentType.APPLICATION_XML).
+ toMetadata(getClass().getResourceAsStream("fromdoc4-metadata.xml"));
+ assertNotNull(metadata);
+
+ final CsdlAnnotations group = metadata.getSchema(0).getAnnotationGroups().get(0);
+ assertNotNull(group);
+
+ CsdlAnnotation annotation = group.getAnnotations().get(0);
+ assertTrue(annotation.getExpression().isDynamic());
+ assertTrue(annotation.getExpression().asDynamic().isCast());
+ assertEquals("Edm.Decimal", annotation.getExpression().asDynamic().asCast().getType());
+
+ annotation = group.getAnnotation("And");
+ assertTrue(annotation.getExpression().isDynamic());
+ assertTrue(annotation.getExpression().asDynamic().isTwoParamsOp());
+ assertEquals(TwoParamsOpDynamicAnnotationExpression.Type.And,
+ annotation.getExpression().asDynamic().asTwoParamsOp().getType());
+ assertTrue(annotation.getExpression().asDynamic().asTwoParamsOp().getLeftExpression().isPath());
+
+ annotation = group.getAnnotation("Vocab.Supplier");
+ assertNotNull(annotation);
+ assertTrue(annotation.getExpression().isDynamic());
+ assertTrue(annotation.getExpression().asDynamic().isUrlRef());
+ final UrlRef urlRef = annotation.getExpression().asDynamic().asUrlRef();
+ assertTrue(urlRef.getValue().isDynamic());
+ assertTrue(urlRef.getValue().asDynamic().isApply());
+
+ // Now let's go high-level
+ final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("fromdoc4-metadata.xml"));
+ assertNotNull(edm);
+
+ final EdmAnnotations edmGroup = edm.getSchemas().get(0).getAnnotationGroups().get(0);
+ assertNotNull(edmGroup);
+
+ EdmAnnotation edmAnnotation = edmGroup.getAnnotations().get(0);
+ assertTrue(edmAnnotation.getExpression().isDynamic());
+ assertTrue(edmAnnotation.getExpression().asDynamic().isCast());
+ assertEquals(EdmDecimal.getInstance(), edmAnnotation.getExpression().asDynamic().asCast().getType());
+
+ edmAnnotation = edmGroup.getAnnotations().get(1);
+ assertTrue(edmAnnotation.getExpression().isDynamic());
+ assertTrue(edmAnnotation.getExpression().asDynamic().isAnd());
+ assertTrue(edmAnnotation.getExpression().asDynamic().asAnd().getLeftExpression().isPath());
+
+ edmAnnotation = edmGroup.getAnnotations().get(edmGroup.getAnnotations().size() - 2);
+ assertNotNull(edmAnnotation);
+ assertTrue(edmAnnotation.getExpression().isDynamic());
+ assertTrue(edmAnnotation.getExpression().asDynamic().isUrlRef());
+ final EdmUrlRef edmUrlRef = edmAnnotation.getExpression().asDynamic().asUrlRef();
+ assertTrue(edmUrlRef.getValue().isDynamic());
+ assertTrue(edmUrlRef.getValue().asDynamic().isApply());
+ }
+
+ @Test
+ public void metadataWithCapabilities() throws Exception {
+ InputStream input = getClass().getResourceAsStream("Metadata-With-Capabilities.xml");
+ final XMLMetadata metadata = getClient().getDeserializer(ContentType.APPLICATION_XML).
+ toMetadata(input);
+
+ CsdlSchema schema = metadata.getSchema("Capabilities");
+ assertNotNull(schema);
+ assertEquals(23, schema.getTerms().size());
+
+ final CsdlTerm deleteRestrictions = schema.getTerm("DeleteRestrictions");
+ assertNotNull(deleteRestrictions);
+ assertEquals("Capabilities.DeleteRestrictionsType", deleteRestrictions.getType());
+ }
+}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/PrimitiveValueTest.java
new file mode 100644
index 0000000..f46f272
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/PrimitiveValueTest.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;
+
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.junit.Test;
+
+import java.util.Calendar;
+
+import static org.junit.Assert.assertEquals;
+
+public class PrimitiveValueTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ @Test
+ public void timeOfDay() throws EdmPrimitiveTypeException {
+ final Calendar expected = Calendar.getInstance();
+ expected.clear();
+ expected.set(2013, 0, 10, 21, 45, 17);
+
+ final ClientValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.TimeOfDay).setValue(expected).build();
+ assertEquals(EdmPrimitiveTypeKind.TimeOfDay, value.asPrimitive().getTypeKind());
+
+ final Calendar actual = value.asPrimitive().toCastValue(Calendar.class);
+ assertEquals(expected.get(Calendar.HOUR), actual.get(Calendar.HOUR));
+ assertEquals(expected.get(Calendar.MINUTE), actual.get(Calendar.MINUTE));
+ assertEquals(expected.get(Calendar.SECOND), actual.get(Calendar.SECOND));
+
+ assertEquals("21:45:17", value.asPrimitive().toString());
+ }
+
+ @Test
+ public void Date() throws EdmPrimitiveTypeException {
+ final Calendar expected = Calendar.getInstance();
+ expected.clear();
+ expected.set(2013, 0, 10);
+
+ final ClientValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Date).setValue(expected).build();
+ assertEquals(EdmPrimitiveTypeKind.Date, value.asPrimitive().getTypeKind());
+
+ final Calendar actual = value.asPrimitive().toCastValue(Calendar.class);
+ assertEquals(expected.get(Calendar.YEAR), actual.get(Calendar.YEAR));
+ assertEquals(expected.get(Calendar.MONTH), actual.get(Calendar.MONTH));
+ assertEquals(expected.get(Calendar.DATE), actual.get(Calendar.DATE));
+
+ assertEquals("2013-01-10", value.asPrimitive().toString());
+ }
+}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/PropertyTest.java
new file mode 100644
index 0000000..a545dc2
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.util.Iterator;
+
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.domain.ClientCollectionValue;
+import org.apache.olingo.client.api.domain.ClientComplexValue;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
+import org.apache.olingo.client.api.serialization.ODataSerializerException;
+import org.junit.Test;
+
+public class PropertyTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ private void _enum(final ContentType contentType) throws ODataDeserializerException, ODataSerializerException {
+ final InputStream input = getClass().getResourceAsStream("Products_5_SkinColor." + getSuffix(contentType));
+ final ClientProperty property = getClient().getReader().readProperty(input, contentType);
+ assertNotNull(property);
+ assertTrue(property.hasEnumValue());
+
+ final ClientProperty written = getClient().getReader().readProperty(
+ getClient().getWriter().writeProperty(property, contentType), contentType);
+ // This is needed because type information gets lost with serialization
+ if (contentType.isCompatible(ContentType.APPLICATION_XML)) {
+ final ClientProperty comparable = getClient().getObjectFactory().newEnumProperty(property.getName(),
+ getClient().getObjectFactory().
+ newEnumValue(property.getEnumValue().getTypeName(), written.getEnumValue().getValue()));
+
+ assertEquals(property, comparable);
+ }
+ }
+
+ @Test
+ public void xmlEnum() throws Exception {
+ _enum(ContentType.APPLICATION_XML);
+ }
+
+ @Test
+ public void jsonEnum() throws Exception {
+ _enum(ContentType.JSON);
+ }
+
+ private void complex(final ContentType contentType) throws ODataDeserializerException, ODataSerializerException {
+ final InputStream input = getClass().getResourceAsStream("Employees_3_HomeAddress." + getSuffix(contentType));
+ final ClientProperty property = getClient().getReader().readProperty(input, contentType);
+ assertNotNull(property);
+ assertTrue(property.hasComplexValue());
+ assertEquals(3, property.getComplexValue().size());
+
+ final ClientProperty written = getClient().getReader().readProperty(
+ getClient().getWriter().writeProperty(property, contentType), contentType);
+ // This is needed because type information gets lost with JSON serialization
+ final ClientComplexValue typedValue = getClient().getObjectFactory().
+ newComplexValue(property.getComplexValue().getTypeName());
+ for (final Iterator<ClientProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
+ final ClientProperty prop = itor.next();
+ typedValue.add(prop);
+ }
+ final ClientProperty comparable = getClient().getObjectFactory().
+ newComplexProperty(property.getName(), typedValue);
+
+ assertEquals(property, comparable);
+ }
+
+ @Test
+ public void xmlComplex() throws Exception {
+ complex(ContentType.APPLICATION_XML);
+ }
+
+ @Test
+ public void jsonComplex() throws Exception {
+ complex(ContentType.JSON);
+ }
+
+ private void collection(final ContentType contentType) throws ODataDeserializerException, ODataSerializerException {
+ final InputStream input = getClass().getResourceAsStream("Products_5_CoverColors." + getSuffix(contentType));
+ final ClientProperty property = getClient().getReader().readProperty(input, contentType);
+ assertNotNull(property);
+ assertTrue(property.hasCollectionValue());
+ assertEquals(3, property.getCollectionValue().size());
+
+ final ClientProperty written = getClient().getReader().readProperty(
+ getClient().getWriter().writeProperty(property, contentType), contentType);
+ // This is needed because type information gets lost with JSON serialization
+ if(contentType.isCompatible(ContentType.APPLICATION_XML)) {
+ final ClientCollectionValue<ClientValue> typedValue = getClient().getObjectFactory().
+ newCollectionValue(property.getCollectionValue().getTypeName());
+ for (final Iterator<ClientValue> itor = written.getCollectionValue().iterator(); itor.hasNext();) {
+ final ClientValue value = itor.next();
+ typedValue.add(value);
+ }
+ final ClientProperty comparable = getClient().getObjectFactory().
+ newCollectionProperty(property.getName(), typedValue);
+
+ assertEquals(property, comparable);
+ }
+ }
+
+ @Test
+ public void xmlCollection() throws Exception {
+ collection(ContentType.APPLICATION_XML);
+ }
+
+ @Test
+ public void jsonCollection() throws Exception {
+ collection(ContentType.JSON);
+ }
+}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/ServiceDocumentTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/ServiceDocumentTest.java
new file mode 100644
index 0000000..5b7c246
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/ServiceDocumentTest.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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URI;
+
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.domain.ClientServiceDocument;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.client.api.serialization.ODataDeserializerException;
+import org.junit.Test;
+
+public class ServiceDocumentTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ private String getFileExtension(final ContentType contentType) {
+ return contentType.isCompatible(ContentType.APPLICATION_XML) ? "xml" : "json";
+ }
+
+ private ClientServiceDocument parse(final ContentType contentType) throws ODataDeserializerException {
+ ResWrap<ServiceDocument> service = getClient().getDeserializer(contentType).toServiceDocument(
+ getClass().getResourceAsStream("serviceDocument." + getFileExtension(contentType)));
+
+ assertEquals(URI.create("http://host/service/$metadata"), service.getContextURL());
+ assertEquals("W/\"MjAxMy0wNS0xM1QxNDo1NFo=\"", service.getMetadataETag());
+
+ final ClientServiceDocument serviceDocument = getClient().getBinder().getODataServiceDocument(service.getPayload());
+ assertNotNull(serviceDocument);
+
+ assertTrue(serviceDocument.getEntitySetNames().contains("Order Details"));
+ assertEquals(URI.create("http://host/service/TopProducts"),
+ serviceDocument.getFunctionImportURI("TopProducts"));
+ assertEquals(URI.create("http://host/HR/"),
+ serviceDocument.getRelatedServiceDocumentsURIs().iterator().next());
+
+ return serviceDocument;
+ }
+
+ @Test
+ public void json() throws Exception {
+ parse(ContentType.JSON);
+ }
+
+ @Test
+ public void xml() throws Exception {
+ parse(ContentType.APPLICATION_XML);
+ }
+}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/serialization/AtomDeserializerTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/serialization/AtomDeserializerTest.java
new file mode 100644
index 0000000..0b793f8
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/serialization/AtomDeserializerTest.java
@@ -0,0 +1,329 @@
+/*
+ * 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.serialization;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import org.apache.olingo.client.core.serialization.AtomDeserializer;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.junit.Test;
+
+public class AtomDeserializerTest {
+
+ @Test
+ public void emptyInlineEntityOlingo540() throws Exception {
+ final String content = "" +
+ "<entry xmlns=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
+ + "xmlns:georss=\"http://www.georss.org/georss\" xmlns:gml=\"http://www.opengis.net/gml\" "
+ + "xml:base=\"http://services.odata.org/V3/OData/OData.svc/\">\r\n" +
+ " <id>http://services.odata.org/V3/OData/OData.svc/Products(3)</id>\r\n" +
+ " <category term=\"ODataDemo.Product\" "
+ + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" +
+ " \r\n" +
+ " <link rel=\"edit\" title=\"Product\" href=\"Products\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Categories\" "
+ + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Supplier\" "
+ + "type=\"application/atom+xml;type=entry\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" +
+ " <metadata:inline>\r\n" +
+ " </metadata:inline>\r\n" +
+ " </link>\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/related/ProductDetail\""
+ + " type=\"application/atom+xml;type=entry\" title=\"ProductDetail\" "
+ + "href=\"Products(3)/ProductDetail\" />\r\n" +
+ " <title type=\"text\">Havina Cola</title>\r\n" +
+ " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" +
+ " <updated>2015-01-26T08:57:02Z</updated>\r\n" +
+ " <author>\r\n" +
+ " <name />\r\n" +
+ " </author>\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Categories\" "
+ + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Supplier\" "
+ + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/ProductDetail\""
+ + " type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" +
+ " <content type=\"application/xml\">\r\n" +
+ " <metadata:properties>\r\n" +
+ " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" +
+ " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" +
+ " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" +
+ " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" +
+ " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" +
+ " </metadata:properties>\r\n" +
+ " </content>\r\n" +
+ " </entry>";
+
+ final AtomDeserializer deserializer = new AtomDeserializer();
+ final InputStream in = new ByteArrayInputStream(content.getBytes("UTF-8"));
+ final ResWrap<Entity> entity = deserializer.toEntity(in);
+
+ assertNotNull(entity);
+ assertNull(entity.getPayload().getNavigationLink("Supplier").getInlineEntitySet());
+ }
+
+ @Test
+ public void filledInlineEntity() throws Exception {
+ final String content = "" +
+ "<entry xmlns=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
+ + "xmlns:georss=\"http://www.georss.org/georss\" "
+ + "xmlns:gml=\"http://www.opengis.net/gml\" "
+ + "xml:base=\"http://services.odata.org/V4/OData/OData.svc/\">\r\n" +
+ " <id>http://services.odata.org/V4/OData/OData.svc/Products(3)</id>\r\n" +
+ " <category term=\"#ODataDemo.Product\" "
+ + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" +
+ " \r\n" +
+ " <link rel=\"edit\" title=\"Product\" href=\"Products\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Categories\" "
+ + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Supplier\" "
+ + "type=\"application/atom+xml;type=entry\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" +
+ " <metadata:inline>\r\n" +
+ " <entry>\r\n" +
+ " <id>http://services.odata.org/V4/OData/OData.svc/Suppliers(0)</id>\r\n" +
+ " <category term=\"ODataDemo.Supplier\" "
+ + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" +
+ " <link rel=\"edit\" title=\"Supplier\" href=\"Suppliers(0)\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Products\" "
+ + "type=\"application/atom+xml;type=feed\" title=\"Products\" href=\"Suppliers(0)/Products\" />\r\n" +
+ " <title type=\"text\">Exotic Liquids</title>\r\n" +
+ " <updated>2015-01-26T08:57:02Z</updated>\r\n" +
+ " <author>\r\n" +
+ " <name />\r\n" +
+ " </author>\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Products\" "
+ + "type=\"application/xml\" title=\"Products\" href=\"Suppliers(0)/$links/Products\" />\r\n" +
+ " <content type=\"application/xml\">\r\n" +
+ " <metadata:properties>\r\n" +
+ " <data:ID metadata:type=\"Edm.Int32\">0</data:ID>\r\n" +
+ " <data:Name>Exotic Liquids</data:Name>\r\n" +
+ " <data:Address metadata:type=\"ODataDemo.Address\">\r\n" +
+ " <data:Street>NE 228th</data:Street>\r\n" +
+ " <data:City>Sammamish</data:City>\r\n" +
+ " <data:State>WA</data:State>\r\n" +
+ " <data:ZipCode>98074</data:ZipCode>\r\n" +
+ " <data:Country>USA</data:Country>\r\n" +
+ " </data:Address>\r\n" +
+ " <data:Location metadata:type=\"Edm.GeographyPoint\">\r\n" +
+ " <gml:Point gml:srsName=\"http://www.opengis.net/def/crs/EPSG/0/4326\">\r\n" +
+ " <gml:pos>47.6316604614258 -122.03547668457</gml:pos>\r\n" +
+ " </gml:Point>\r\n" +
+ " </data:Location>\r\n" +
+ " <data:Concurrency metadata:type=\"Edm.Int32\">0</data:Concurrency>\r\n" +
+ " </metadata:properties>\r\n" +
+ " </content>\r\n" +
+ " </entry>" +
+ " </metadata:inline>\r\n" +
+ " </link>\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/related/ProductDetail\" "
+ + "type=\"application/atom+xml;type=entry\" "
+ + "title=\"ProductDetail\" href=\"Products(3)/ProductDetail\" />\r\n" +
+ " <title type=\"text\">Havina Cola</title>\r\n" +
+ " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" +
+ " <updated>2015-01-26T08:57:02Z</updated>\r\n" +
+ " <author>\r\n" +
+ " <name />\r\n" +
+ " </author>\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Categories\" "
+ + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Supplier\" "
+ + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/ProductDetail\" "
+ + "type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" +
+ " <content type=\"application/xml\">\r\n" +
+ " <metadata:properties>\r\n" +
+ " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" +
+ " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" +
+ " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" +
+ " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" +
+ " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" +
+ " </metadata:properties>\r\n" +
+ " </content>\r\n" +
+ " </entry>";
+ final AtomDeserializer deserializer = new AtomDeserializer();
+ final InputStream in = new ByteArrayInputStream(content.getBytes("UTF-8"));
+ final ResWrap<Entity> entity = deserializer.toEntity(in);
+
+ assertNotNull(entity);
+ final Entity inlineEntity = entity.getPayload().getNavigationLink("Supplier").getInlineEntity();
+ assertNotNull(inlineEntity);
+
+ assertEquals(new Integer(0), inlineEntity.getProperty("ID").getValue());
+ assertEquals("Exotic Liquids", inlineEntity.getProperty("Name").getValue());
+ }
+
+ @Test
+ public void emptyInlineEntityCollection() throws Exception {
+ final String content = "" +
+ "<entry xmlns=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
+ + "xmlns:georss=\"http://www.georss.org/georss\" xmlns:gml=\"http://www.opengis.net/gml\" "
+ + "xml:base=\"http://services.odata.org/V3/OData/OData.svc/\">\r\n" +
+ " <id>http://services.odata.org/V3/OData/OData.svc/Products(3)</id>\r\n" +
+ " <category term=\"ODataDemo.Product\" "
+ + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" +
+ " \r\n" +
+ " <link rel=\"edit\" title=\"Product\" href=\"Products(3)\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Categories\" "
+ + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Supplier\" "
+ + "type=\"application/atom+xml;type=feed\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" +
+ " <metadata:inline>\r\n" +
+ " <feed>\r\n" +
+ " </feed>\r\n" +
+ " </metadata:inline>\r\n" +
+ " </link>\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/related/ProductDetail\" "
+ + "type=\"application/atom+xml;type=entry\" "
+ + "title=\"ProductDetail\" href=\"Products(3)/ProductDetail\" />\r\n" +
+ " <title type=\"text\">Havina Cola</title>\r\n" +
+ " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" +
+ " <updated>2015-01-26T08:57:02Z</updated>\r\n" +
+ " <author>\r\n" +
+ " <name />\r\n" +
+ " </author>\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Categories\" "
+ + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Supplier\" "
+ + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/ProductDetail\" "
+ + "type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" +
+ " <content type=\"application/xml\">\r\n" +
+ " <metadata:properties>\r\n" +
+ " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" +
+ " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" +
+ " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" +
+ " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" +
+ " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" +
+ " </metadata:properties>\r\n" +
+ " </content>\r\n" +
+ " </entry>";
+ final AtomDeserializer deserializer = new AtomDeserializer();
+ final InputStream in = new ByteArrayInputStream(content.getBytes("UTF-8"));
+ final ResWrap<Entity> entity = deserializer.toEntity(in);
+
+ assertNotNull(entity);
+ final EntityCollection inlineEntitySet = entity.getPayload().getNavigationLink("Supplier").getInlineEntitySet();
+ assertNotNull(inlineEntitySet);
+ assertEquals(0, inlineEntitySet.getEntities().size());
+ }
+
+ @Test
+ public void filledInlineEntityCollection() throws Exception {
+ final String content = "" +
+ "<entry xmlns=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
+ + "xmlns:georss=\"http://www.georss.org/georss\" xmlns:gml=\"http://www.opengis.net/gml\" "
+ + "xml:base=\"http://services.odata.org/V3/OData/OData.svc/\">\r\n" +
+ " <id>http://services.odata.org/V3/OData/OData.svc/Products(3)</id>\r\n" +
+ " <category term=\"ODataDemo.Product\" "
+ + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" +
+ " \r\n" +
+ " <link rel=\"edit\" title=\"Product\" href=\"Products(3)\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Categories\" "
+ + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Supplier\" "
+ + "type=\"application/atom+xml;type=feed\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" +
+ " <metadata:inline>\r\n" +
+ " <feed>\r\n" +
+ " <entry>\r\n" +
+ " <id>http://services.odata.org/V3/OData/OData.svc/Suppliers(0)</id>\r\n" +
+ " <category term=\"ODataDemo.Supplier\" "
+ + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" +
+ " <link rel=\"edit\" title=\"Supplier\" href=\"Suppliers(0)\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Products\" "
+ + "type=\"application/atom+xml;type=feed\" title=\"Products\" href=\"Suppliers(0)/Products\" />\r\n" +
+ " <title type=\"text\">Exotic Liquids</title>\r\n" +
+ " <updated>2015-01-26T08:57:02Z</updated>\r\n" +
+ " <author>\r\n" +
+ " <name />\r\n" +
+ " </author>\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Products\" "
+ + "type=\"application/xml\" title=\"Products\" href=\"Suppliers(0)/$links/Products\" />\r\n" +
+ " <content type=\"application/xml\">\r\n" +
+ " <metadata:properties>\r\n" +
+ " <data:ID metadata:type=\"Edm.Int32\">0</data:ID>\r\n" +
+ " <data:Name>Exotic Liquids</data:Name>\r\n" +
+ " <data:Address metadata:type=\"ODataDemo.Address\">\r\n" +
+ " <data:Street>NE 228th</data:Street>\r\n" +
+ " <data:City>Sammamish</data:City>\r\n" +
+ " <data:State>WA</data:State>\r\n" +
+ " <data:ZipCode>98074</data:ZipCode>\r\n" +
+ " <data:Country>USA</data:Country>\r\n" +
+ " </data:Address>\r\n" +
+ " <data:Location metadata:type=\"Edm.GeographyPoint\">\r\n" +
+ " <gml:Point gml:srsName=\"http://www.opengis.net/def/crs/EPSG/0/4326\">\r\n" +
+ " <gml:pos>47.6316604614258 -122.03547668457</gml:pos>\r\n" +
+ " </gml:Point>\r\n" +
+ " </data:Location>\r\n" +
+ " <data:Concurrency metadata:type=\"Edm.Int32\">0</data:Concurrency>\r\n" +
+ " </metadata:properties>\r\n" +
+ " </content>\r\n" +
+ " </entry>\r\n" +
+ " </feed>\r\n" +
+ " </metadata:inline>\r\n" +
+ " </link>\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/related/ProductDetail\" "
+ + "type=\"application/atom+xml;type=entry\" "
+ + "title=\"ProductDetail\" href=\"Products(3)/ProductDetail\" />\r\n" +
+ " <title type=\"text\">Havina Cola</title>\r\n" +
+ " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" +
+ " <updated>2015-01-26T08:57:02Z</updated>\r\n" +
+ " <author>\r\n" +
+ " <name />\r\n" +
+ " </author>\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Categories\" "
+ + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Supplier\" "
+ + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" +
+ " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/ProductDetail\" "
+ + "type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" +
+ " <content type=\"application/xml\">\r\n" +
+ " <metadata:properties>\r\n" +
+ " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" +
+ " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" +
+ " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" +
+ " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" +
+ " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" +
+ " </metadata:properties>\r\n" +
+ " </content>\r\n" +
+ " </entry>";
+ final AtomDeserializer deserializer = new AtomDeserializer();
+ final InputStream in = new ByteArrayInputStream(content.getBytes("UTF-8"));
+ final ResWrap<Entity> entity = deserializer.toEntity(in);
+
+ assertNotNull(entity);
+ final EntityCollection inlineEntitySet = entity.getPayload().getNavigationLink("Supplier").getInlineEntitySet();
+ assertNotNull(inlineEntitySet);
+ assertEquals(1, inlineEntitySet.getEntities().size());
+ }
+}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/serialization/ContextURLParserTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/serialization/ContextURLParserTest.java
new file mode 100644
index 0000000..009b100
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/serialization/ContextURLParserTest.java
@@ -0,0 +1,256 @@
+/*
+ * 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.serialization;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URI;
+
+import org.apache.olingo.client.core.serialization.ContextURLParser;
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.junit.Test;
+
+public class ContextURLParserTest {
+
+ @Test
+ public void collectionOfEntities() {
+ ContextURL contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Customers"));
+
+ assertEquals(URI.create("http://host/service/"), contextURL.getServiceRoot());
+ assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+ assertNull(contextURL.getDerivedEntity());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+
+ contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Orders(4711)/Items"));
+
+ assertEquals("Orders", contextURL.getEntitySetOrSingletonOrType());
+ assertNull(contextURL.getDerivedEntity());
+ assertNull(contextURL.getSelectList());
+ assertEquals("Items", contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+
+ contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Me/Folders('Inbox')/Messages"));
+
+ assertEquals("Me/Folders", contextURL.getEntitySetOrSingletonOrType());
+ assertEquals("Messages", contextURL.getNavOrPropertyPath());
+ }
+
+ @Test
+ public void entity() {
+ ContextURL contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Customers/$entity"));
+
+ assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+ assertNull(contextURL.getDerivedEntity());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertTrue(contextURL.isEntity());
+
+ contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Orders(4711)/Items/$entity"));
+
+ assertEquals("Orders/Items", contextURL.getEntitySetOrSingletonOrType());
+ assertNull(contextURL.getDerivedEntity());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertTrue(contextURL.isEntity());
+
+ contextURL = ContextURLParser.parse(
+ URI.create("http://host/service/$metadata#Users('user')/Messages('message')/Attachments/$entity"));
+
+ assertEquals("Users/Messages/Attachments", contextURL.getEntitySetOrSingletonOrType());
+ assertNull(contextURL.getDerivedEntity());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertTrue(contextURL.isEntity());
+
+ // v3
+ contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Products/@Element"));
+
+ assertEquals("Products", contextURL.getEntitySetOrSingletonOrType());
+ assertNull(contextURL.getDerivedEntity());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertTrue(contextURL.isEntity());
+ }
+
+ @Test
+ public void singleton() {
+ ContextURL contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Contoso"));
+
+ assertEquals("Contoso", contextURL.getEntitySetOrSingletonOrType());
+ assertNull(contextURL.getDerivedEntity());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+ }
+
+ @Test
+ public void collectionOfDerivedEntities() {
+ final ContextURL contextURL = ContextURLParser.parse(
+ URI.create("http://host/service/$metadata#Customers/Model.VipCustomer"));
+
+ assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+ assertEquals("Model.VipCustomer", contextURL.getDerivedEntity());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+ }
+
+ @Test
+ public void derivedEntity() {
+ final ContextURL contextURL = ContextURLParser.parse(
+ URI.create("http://host/service/$metadata#Customers/Model.VipCustomer/$entity"));
+
+ assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+ assertEquals("Model.VipCustomer", contextURL.getDerivedEntity());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertTrue(contextURL.isEntity());
+ }
+
+ @Test
+ public void collectionOfProjectedEntities() {
+ final ContextURL contextURL = ContextURLParser.parse(
+ URI.create("http://host/service/$metadata#Customers(Address,Orders)"));
+
+ assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+ assertNull(contextURL.getDerivedEntity());
+ assertEquals("Address,Orders", contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+ }
+
+ @Test
+ public void projectedEntity() {
+ ContextURL contextURL = ContextURLParser.parse(
+ URI.create("http://host/service/$metadata#Customers(Name,Rating)/$entity"));
+
+ assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+ assertNull(contextURL.getDerivedEntity());
+ assertEquals("Name,Rating", contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertTrue(contextURL.isEntity());
+
+ contextURL = ContextURLParser.parse(
+ URI.create("http://host/service/$metadata#Customers(Name,Address/Country)"));
+
+ assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+ assertNull(contextURL.getDerivedEntity());
+ assertEquals("Name,Address/Country", contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+ }
+
+ @Test
+ public void collectionOfProjectedExpandedEntities() {
+ final ContextURL contextURL = ContextURLParser.parse(
+ URI.create("http://host/service/$metadata#Employees/"
+ + "Sales.Manager(DirectReports,DirectReports+(FirstName,LastName))"));
+
+ assertEquals("Employees", contextURL.getEntitySetOrSingletonOrType());
+ assertEquals("Sales.Manager", contextURL.getDerivedEntity());
+ assertEquals("DirectReports,DirectReports+(FirstName,LastName)", contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+ }
+
+ @Test
+ public void propertyValue() {
+ final ContextURL contextURL = ContextURLParser.parse(
+ URI.create("http://host/service/$metadata#Customers(1)/Addresses"));
+
+ assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
+ assertNull(contextURL.getDerivedEntity());
+ assertNull(contextURL.getSelectList());
+ assertEquals("Addresses", contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+ }
+
+ @Test
+ public void CollectionOfComplexOrPrimitiveTypes() {
+ final ContextURL contextURL = ContextURLParser.parse(
+ URI.create("http://host/service/$metadata#Collection(Edm.String)"));
+
+ assertEquals("Collection(Edm.String)", contextURL.getEntitySetOrSingletonOrType());
+ assertNull(contextURL.getDerivedEntity());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+ }
+
+ @Test
+ public void complexOrPrimitiveType() {
+ ContextURL contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Edm.String"));
+
+ assertEquals("Edm.String", contextURL.getEntitySetOrSingletonOrType());
+ assertNull(contextURL.getDerivedEntity());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+
+ contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#ODataDemo.Address"));
+
+ assertEquals("ODataDemo.Address", contextURL.getEntitySetOrSingletonOrType());
+ assertNull(contextURL.getDerivedEntity());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+ }
+
+ @Test
+ public void reference() {
+ ContextURL contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Customers/$ref"));
+ assertTrue(contextURL.isReference());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+ assertFalse(contextURL.isDelta());
+ }
+
+ @Test
+ public void delta() {
+ ContextURL contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Customers/$delta"));
+ assertTrue(contextURL.isDelta());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+
+ contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Customers/$deletedLink"));
+ assertTrue(contextURL.isDeltaDeletedLink());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+
+ contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Customers/$link"));
+ assertTrue(contextURL.isDeltaLink());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+
+ contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Customers/$deletedEntity"));
+ assertTrue(contextURL.isDeltaDeletedEntity());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+ }
+}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/FilterFactoryTest.java
new file mode 100644
index 0000000..1d26f81
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/FilterFactoryTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.Calendar;
+import java.util.TimeZone;
+
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.uri.FilterArgFactory;
+import org.apache.olingo.client.api.uri.FilterFactory;
+import org.apache.olingo.client.api.uri.URIFilter;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.CsdlEnumType;
+import org.apache.olingo.commons.core.edm.EdmEnumTypeImpl;
+import org.junit.Test;
+
+public class FilterFactoryTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ private FilterFactory getFilterFactory() {
+ return getClient().getFilterFactory();
+ }
+
+ private FilterArgFactory getFilterArgFactory() {
+ return getFilterFactory().getArgFactory();
+ }
+
+ @Test
+ public void has() {
+ final EdmEnumType pattern =
+ new EdmEnumTypeImpl(null, new FullQualifiedName("Sales", "Pattern"), new CsdlEnumType());
+ final URIFilter filter = getFilterFactory().has(getFilterArgFactory().property("style"), pattern, "Yellow");
+
+ assertEquals("(style has Sales.Pattern'Yellow')", filter.build());
+ }
+
+ @Test
+ public void contains() {
+ final URIFilter filter = getFilterFactory().match(getFilterArgFactory().contains(
+ getFilterArgFactory().property("CompanyName"), getFilterArgFactory().literal("Alfreds")));
+
+ assertEquals("contains(CompanyName,'Alfreds')", filter.build());
+ }
+
+ @Test
+ public void maxdatetime() {
+ final URIFilter filter = getFilterFactory().eq(
+ getFilterArgFactory().property("EndTime"),
+ getFilterArgFactory().maxdatetime());
+
+ assertEquals("(EndTime eq maxdatetime())", filter.build());
+ }
+
+ @Test
+ public void any() {
+ final URIFilter filter = getFilterFactory().match(
+ getFilterArgFactory().any(getFilterArgFactory().property("Items"),
+ getFilterFactory().gt("d:d/Quantity", 100)));
+
+ assertEquals("Items/any(d:d/Quantity gt 100)", filter.build());
+ }
+
+ @Test
+ public void issueOLINGO357() throws UnsupportedEncodingException {
+ final Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT-8"));
+ calendar.clear();
+ calendar.set(2011, 2, 8, 14, 21, 12);
+
+ final URIFilter filter = getFilterFactory().ge("OrderDate", calendar);
+ assertEquals("(OrderDate ge " + URLEncoder.encode("2011-03-08T14:21:12-08:00", Constants.UTF8) + ")",
+ filter.build());
+ }
+
+}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIBuilderTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIBuilderTest.java
new file mode 100644
index 0000000..6f8a363
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIBuilderTest.java
@@ -0,0 +1,244 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.uri;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.uri.QueryOption;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.client.core.uri.ParameterAlias;
+import org.junit.Test;
+
+public class URIBuilderTest extends AbstractTest {
+
+ private static final String SERVICE_ROOT = "http://host/service";
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ @Test
+ public void metadata() throws URISyntaxException {
+ final URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendMetadataSegment().build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/$metadata").build(), uri);
+ }
+
+ @Test
+ public void entity() throws URISyntaxException {
+ final URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("AnEntitySet").
+ appendKeySegment(11).build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/AnEntitySet(11)").build(), uri);
+
+ final Map<String, Object> multiKey = new LinkedHashMap<String, Object>();
+ multiKey.put("OrderId", -10);
+ multiKey.put("ProductId", -10);
+ URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("OrderLine").appendKeySegment(multiKey).
+ appendPropertySegment("Quantity").appendValueSegment();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/OrderLine(OrderId=-10,ProductId=-10)/Quantity/$value").build(), uriBuilder.build());
+
+ uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Customer").appendKeySegment(-10).
+ select("CustomerId", "Name", "Orders").expand("Orders");
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customer(-10)").
+ addParameter("$select", "CustomerId,Name,Orders").addParameter("$expand", "Orders").build(),
+ uriBuilder.build());
+
+ uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Customer").appendKeySegment(-10).appendNavigationSegment("Orders").appendRefSegment();
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customer(-10)/Orders/$ref").build(),
+ uriBuilder.build());
+ }
+
+ @Test
+ public void expandWithOptions() throws URISyntaxException {
+ final URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").appendKeySegment(5).
+ expandWithOptions("ProductDetails", new LinkedHashMap<QueryOption, Object>() {
+ private static final long serialVersionUID = 3109256773218160485L;
+
+ {
+ put(QueryOption.EXPAND, "ProductInfo");
+ put(QueryOption.SELECT, "Price");
+ }
+ }).expand("Orders", "Customers").build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products(5)").
+ addParameter("$expand", "ProductDetails($expand=ProductInfo;$select=Price),Orders,Customers").build(), uri);
+ }
+
+ public void expandWithLevels() throws URISyntaxException {
+ final URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").appendKeySegment(1).
+ expandWithOptions("Customer", Collections.<QueryOption, Object> singletonMap(QueryOption.LEVELS, 4)).
+ build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products(1)").
+ addParameter("$expand", "Customer($levels=4)").build(), uri);
+ }
+
+ @Test
+ public void count() throws URISyntaxException {
+ URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count().build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products/$count").build(), uri);
+
+ uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count(true).build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products").
+ addParameter("$count", "true").build(), uri);
+ }
+
+ @Test
+ public void filter() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("AnEntitySet").
+ filter(getClient().getFilterFactory().lt("VIN", 16));
+
+ assertEquals("http://host/service/AnEntitySet?%24filter=%28VIN%20lt%2016%29", uriBuilder.build().toASCIIString());
+
+// assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/AnEntitySet").
+// addParameter("$filter", "(VIN lt 16)").build(),
+// uriBuilder.build());
+ }
+
+ @Test
+ public void filterWithParameter() throws URISyntaxException {
+ // http://host/service.svc/Employees?$filter=Region eq @p1&@p1='WA'
+ final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Employees").
+ filter(getClient().getFilterFactory().eq("Region", new ParameterAlias("p1"))).
+ addParameterAlias("p1", "'WA'");
+
+ assertEquals("http://host/service/Employees?%24filter=%28Region%20eq%20%40p1%29&%40p1='WA'", uriBuilder.build()
+ .toASCIIString());
+
+// assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Employees").
+// addParameter("$filter", "(Region eq @p1)").addParameter("@p1", "'WA'").build(),
+// uriBuilder.build());
+ }
+
+ @Test
+ public void expandMoreThenOnce() throws URISyntaxException {
+ URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").appendKeySegment(5).
+ expand("Orders", "Customers").expand("Info").build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products(5)").
+ addParameter("$expand", "Orders,Customers,Info").build(), uri);
+ }
+
+ @Test
+ public void selectMoreThenOnce() throws URISyntaxException {
+ URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Customers").appendKeySegment(5).
+ select("Name", "Surname").expand("Info").select("Gender").build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customers(5)").
+ addParameter("$select", "Name,Surname,Gender").addParameter("$expand", "Info").build(), uri);
+ }
+
+ @Test
+ public void singleton() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+ appendSingletonSegment("BestProductEverCreated");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/BestProductEverCreated").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void entityId() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+ appendEntityIdSegment("Products(0)");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/$entity").addParameter("$id", "Products(0)").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void boundAction() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Categories").appendKeySegment(1).
+ appendNavigationSegment("Products").appendNavigationSegment("Model").
+ appendActionCallSegment("AllOrders");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Categories(1)/Products/Model.AllOrders").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void ref() throws URISyntaxException {
+ URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Categories").appendKeySegment(1).
+ appendNavigationSegment("Products").appendRefSegment();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Categories(1)/Products/$ref").build(), uriBuilder.build());
+
+ uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Categories").appendKeySegment(1).
+ appendNavigationSegment("Products").appendRefSegment().id("../../Products(0)");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Categories(1)/Products/$ref").addParameter("$id", "../../Products(0)").build(),
+ uriBuilder.build());
+ }
+
+ @Test
+ public void derived() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Customers").appendDerivedEntityTypeSegment("Model.VipCustomer").appendKeySegment(1);
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Customers/Model.VipCustomer(1)").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void crossjoin() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+ appendCrossjoinSegment("Products", "Sales");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/$crossjoin(Products,Sales)").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void all() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).appendAllSegment();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/$all").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void search() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Products").search("blue OR green");
+
+ assertEquals(new URI("http://host/service/Products?%24search=blue%20OR%20green"), uriBuilder.build());
+ }
+}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
deleted file mode 100644
index eff892e..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.uri.v4;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.Calendar;
-import java.util.TimeZone;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.uri.FilterArgFactory;
-import org.apache.olingo.client.api.uri.FilterFactory;
-import org.apache.olingo.client.api.uri.URIFilter;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.CsdlEnumType;
-import org.apache.olingo.commons.core.edm.EdmEnumTypeImpl;
-import org.junit.Test;
-
-public class FilterFactoryTest extends AbstractTest {
-
- @Override
- protected ODataClient getClient() {
- return v4Client;
- }
-
- private FilterFactory getFilterFactory() {
- return getClient().getFilterFactory();
- }
-
- private FilterArgFactory getFilterArgFactory() {
- return getFilterFactory().getArgFactory();
- }
-
- @Test
- public void has() {
- final EdmEnumType pattern =
- new EdmEnumTypeImpl(null, new FullQualifiedName("Sales", "Pattern"), new CsdlEnumType());
- final URIFilter filter = getFilterFactory().has(getFilterArgFactory().property("style"), pattern, "Yellow");
-
- assertEquals("(style has Sales.Pattern'Yellow')", filter.build());
- }
-
- @Test
- public void contains() {
- final URIFilter filter = getFilterFactory().match(getFilterArgFactory().contains(
- getFilterArgFactory().property("CompanyName"), getFilterArgFactory().literal("Alfreds")));
-
- assertEquals("contains(CompanyName,'Alfreds')", filter.build());
- }
-
- @Test
- public void maxdatetime() {
- final URIFilter filter = getFilterFactory().eq(
- getFilterArgFactory().property("EndTime"),
- getFilterArgFactory().maxdatetime());
-
- assertEquals("(EndTime eq maxdatetime())", filter.build());
- }
-
- @Test
- public void any() {
- final URIFilter filter = getFilterFactory().match(
- getFilterArgFactory().any(getFilterArgFactory().property("Items"),
- getFilterFactory().gt("d:d/Quantity", 100)));
-
- assertEquals("Items/any(d:d/Quantity gt 100)", filter.build());
- }
-
- @Test
- public void issueOLINGO357() throws UnsupportedEncodingException {
- final Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT-8"));
- calendar.clear();
- calendar.set(2011, 2, 8, 14, 21, 12);
-
- final URIFilter filter = getFilterFactory().ge("OrderDate", calendar);
- assertEquals("(OrderDate ge " + URLEncoder.encode("2011-03-08T14:21:12-08:00", Constants.UTF8) + ")",
- filter.build());
- }
-
-}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java
deleted file mode 100644
index 14fa566..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.uri.v4;
-
-import static org.junit.Assert.assertEquals;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.uri.QueryOption;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.core.AbstractTest;
-import org.junit.Test;
-
-public class URIBuilderTest extends AbstractTest {
-
- private static final String SERVICE_ROOT = "http://host/service";
-
- @Override
- protected ODataClient getClient() {
- return v4Client;
- }
-
- @Test
- public void expandWithOptions() throws URISyntaxException {
- final URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").appendKeySegment(5).
- expandWithOptions("ProductDetails", new LinkedHashMap<QueryOption, Object>() {
- private static final long serialVersionUID = 3109256773218160485L;
-
- {
- put(QueryOption.EXPAND, "ProductInfo");
- put(QueryOption.SELECT, "Price");
- }
- }).expand("Orders", "Customers").build();
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products(5)").
- addParameter("$expand", "ProductDetails($expand=ProductInfo;$select=Price),Orders,Customers").build(), uri);
- }
-
- public void expandWithLevels() throws URISyntaxException {
- final URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").appendKeySegment(1).
- expandWithOptions("Customer", Collections.<QueryOption, Object> singletonMap(QueryOption.LEVELS, 4)).
- build();
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products(1)").
- addParameter("$expand", "Customer($levels=4)").build(), uri);
- }
-
- @Test
- public void count() throws URISyntaxException {
- URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count().build();
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products/$count").build(), uri);
-
- uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count(true).build();
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products").
- addParameter("$count", "true").build(), uri);
- }
-
- @Test
- public void singleton() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
- appendSingletonSegment("BestProductEverCreated");
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/BestProductEverCreated").build(), uriBuilder.build());
- }
-
- @Test
- public void entityId() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
- appendEntityIdSegment("Products(0)");
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/$entity").addParameter("$id", "Products(0)").build(), uriBuilder.build());
- }
-
- @Test
- public void boundAction() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
- appendEntitySetSegment("Categories").appendKeySegment(1).
- appendNavigationSegment("Products").appendNavigationSegment("Model").
- appendActionCallSegment("AllOrders");
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/Categories(1)/Products/Model.AllOrders").build(), uriBuilder.build());
- }
-
- @Test
- public void ref() throws URISyntaxException {
- URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
- appendEntitySetSegment("Categories").appendKeySegment(1).
- appendNavigationSegment("Products").appendRefSegment();
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/Categories(1)/Products/$ref").build(), uriBuilder.build());
-
- uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
- appendEntitySetSegment("Categories").appendKeySegment(1).
- appendNavigationSegment("Products").appendRefSegment().id("../../Products(0)");
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/Categories(1)/Products/$ref").addParameter("$id", "../../Products(0)").build(),
- uriBuilder.build());
- }
-
- @Test
- public void derived() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
- appendEntitySetSegment("Customers").appendDerivedEntityTypeSegment("Model.VipCustomer").appendKeySegment(1);
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/Customers/Model.VipCustomer(1)").build(), uriBuilder.build());
- }
-
- @Test
- public void crossjoin() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
- appendCrossjoinSegment("Products", "Sales");
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/$crossjoin(Products,Sales)").build(), uriBuilder.build());
- }
-
- @Test
- public void all() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).appendAllSegment();
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/$all").build(), uriBuilder.build());
- }
-
- @Test
- public void search() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
- appendEntitySetSegment("Products").search("blue OR green");
-
- assertEquals(new URI("http://host/service/Products?%24search=blue%20OR%20green"), uriBuilder.build());
- }
-}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java
deleted file mode 100644
index 3d445d8..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.v4;
-
-import static org.junit.Assert.assertTrue;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.core.AtomLinksQualifier;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.custommonkey.xmlunit.Diff;
-
-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 java.io.ByteArrayInputStream;
-import java.io.StringWriter;
-
-public class AtomTest extends JSONTest {
-
- @Override
- protected ODataClient getClient() {
- return v4Client;
- }
-
- @Override
- protected ODataFormat getODataPubFormat() {
- return ODataFormat.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();
- }
-
- @Override
- protected void assertSimilar(final String filename, final String actual) throws Exception {
- final Diff diff = new Diff(cleanup(IOUtils.toString(getClass().getResourceAsStream(filename))), actual);
- diff.overrideElementQualifier(new AtomLinksQualifier());
- assertTrue(diff.similar());
- }
-
- @Override
- public void additionalEntities() throws Exception {
- // no test
- }
-
- @Override
- public void issueOLINGO390() throws Exception {
- // no test
- }
-
-}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
deleted file mode 100644
index 5395472..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.v4;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-public class EntitySetTest extends AbstractTest {
-
- @Override
- protected ODataClient getClient() {
- return v4Client;
- }
-
- private void read(final ODataFormat format) throws IOException, ODataDeserializerException {
- final InputStream input = getClass().getResourceAsStream("Customers." + getSuffix(format));
- final ClientEntitySet entitySet = getClient().getBinder().getODataEntitySet(
- getClient().getDeserializer(format).toEntitySet(input));
- assertNotNull(entitySet);
-
- assertEquals(2, entitySet.getEntities().size());
- assertNull(entitySet.getNext());
-
- final ClientEntitySet written =
- getClient().getBinder().getODataEntitySet(new ResWrap<EntityCollection>((URI) null, null,
- getClient().getBinder().getEntitySet(entitySet)));
- assertEquals(entitySet, written);
- }
-
- @Test
- public void fromAtom() throws Exception {
- read(ODataFormat.ATOM);
- }
-
- @Test
- public void fromJSON() throws Exception {
- read(ODataFormat.JSON);
- }
-
- private void ref(final ODataFormat format) throws ODataDeserializerException {
- final InputStream input = getClass().getResourceAsStream("collectionOfEntityReferences." + getSuffix(format));
- final ClientEntitySet entitySet = getClient().getBinder().getODataEntitySet(
- getClient().getDeserializer(format).toEntitySet(input));
- assertNotNull(entitySet);
-
- for (ClientEntity entity : entitySet.getEntities()) {
- assertNotNull(entity.getId());
- }
- entitySet.setCount(entitySet.getEntities().size());
-
- final ClientEntitySet written =
- getClient().getBinder().getODataEntitySet(new ResWrap<EntityCollection>((URI) null, null,
- getClient().getBinder().getEntitySet(entitySet)));
- assertEquals(entitySet, written);
- }
-
- @Test
- public void atomRef() throws Exception {
- ref(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonRef() throws Exception {
- ref(ODataFormat.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
deleted file mode 100644
index 7373da6..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Iterator;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.EdmEnabledODataClientImpl;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.client.api.domain.ClientAnnotation;
-import org.apache.olingo.client.api.domain.ClientComplexValue;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
-import org.apache.olingo.client.api.domain.ClientLink;
-import org.apache.olingo.client.api.domain.ClientLinkType;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.domain.ClientValuable;
-import org.apache.olingo.client.api.domain.ClientValue;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class EntityTest extends AbstractTest {
-
- @Override
- protected ODataClient getClient() {
- return v4Client;
- }
-
- private EdmEnabledODataClient getEdmEnabledClient() {
- return new EdmEnabledODataClientImpl(null, null, null) {
-
- private Edm edm;
-
- @Override
- public Edm getEdm(final String metadataETag) {
- return getCachedEdm();
- }
-
- @Override
- public Edm getCachedEdm() {
- if (edm == null) {
- edm = getReader().readMetadata(getClass().getResourceAsStream("staticservice-metadata.xml"));
- }
- return edm;
- }
-
- };
- }
-
- private void singleton(final ODataFormat format) throws Exception {
- final InputStream input = getClass().getResourceAsStream("VipCustomer." + getSuffix(format));
- final ClientEntity entity = getClient().getBinder().getODataEntity(
- getClient().getDeserializer(format).toEntity(input));
- assertNotNull(entity);
-
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
-
- final ClientProperty birthday = entity.getProperty("Birthday");
- assertTrue(birthday.hasPrimitiveValue());
- assertEquals(EdmDateTimeOffset.getInstance(), birthday.getPrimitiveValue().getType());
-
- final ClientProperty timeBetweenLastTwoOrders = entity.getProperty("TimeBetweenLastTwoOrders");
- assertTrue(timeBetweenLastTwoOrders.hasPrimitiveValue());
- assertEquals(EdmDuration.getInstance(), timeBetweenLastTwoOrders.getPrimitiveValue().getType());
-
- int checked = 0;
- for (ClientLink link : entity.getNavigationLinks()) {
- if ("Parent".equals(link.getName())) {
- checked++;
- assertEquals(ClientLinkType.ENTITY_NAVIGATION, link.getType());
- }
- if ("Orders".equals(link.getName())) {
- checked++;
- if (format == ODataFormat.ATOM) {
- assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, link.getType());
- }
- }
- if ("Company".equals(link.getName())) {
- checked++;
- assertEquals(ClientLinkType.ENTITY_NAVIGATION, link.getType());
- }
- }
- assertEquals(3, checked);
-
- assertEquals(2, entity.getOperations().size());
- assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
- entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.ResetAddress").getMetadataAnchor());
- assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
- entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress").getMetadataAnchor());
-
- // operations won't get serialized
- entity.getOperations().clear();
- final ClientEntity written = getClient().getBinder().getODataEntity(
- new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
- assertEquals(entity, written);
- input.close();
- }
-
- @Test
- public void atomSingleton() throws Exception {
- singleton(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonSingleton() throws Exception {
- singleton(ODataFormat.JSON_FULL_METADATA);
- }
-
- private void withEnums(final ODataFormat format) throws Exception {
- final InputStream input = getClass().getResourceAsStream("Products_5." + getSuffix(format));
- final ClientEntity entity = getClient().getBinder().getODataEntity(
- getClient().getDeserializer(format).toEntity(input));
- assertNotNull(entity);
-
- final ClientProperty skinColor = entity.getProperty("SkinColor");
- assertTrue(skinColor.hasEnumValue());
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", skinColor.getEnumValue().getTypeName());
- assertEquals("Red", skinColor.getEnumValue().getValue());
-
- final ClientProperty coverColors = entity.getProperty("CoverColors");
- assertTrue(coverColors.hasCollectionValue());
- for (final Iterator<ClientValue> itor = coverColors.getCollectionValue().iterator(); itor.hasNext();) {
- final ClientValue item = itor.next();
- assertTrue(item.isEnum());
- }
-
- // operations won't get serialized
- entity.getOperations().clear();
- final ClientEntity written = getClient().getBinder().getODataEntity(
- new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
- assertEquals(entity, written);
- input.close();
- }
-
- @Test
- public void atomWithEnums() throws Exception {
- withEnums(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonWithEnums() throws Exception {
- withEnums(ODataFormat.JSON_FULL_METADATA);
- }
-
- private void withInlineEntitySet(final ODataFormat format) throws Exception {
- final InputStream input = getClass().getResourceAsStream(
- "Accounts_101_expand_MyPaymentInstruments." + getSuffix(format));
- final ClientEntity entity = getClient().getBinder().getODataEntity(
- getClient().getDeserializer(format).toEntity(input));
- assertNotNull(entity);
-
- final ClientLink instruments = entity.getNavigationLink("MyPaymentInstruments");
- assertNotNull(instruments);
- assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, instruments.getType());
-
- final ClientInlineEntitySet inline = instruments.asInlineEntitySet();
- assertNotNull(inline);
- assertEquals(3, inline.getEntitySet().getEntities().size());
-
- // count shouldn't be serialized
- inline.getEntitySet().setCount(3);
- // operations won't get serialized
- entity.getOperations().clear();
- final ClientEntity written = getClient().getBinder().getODataEntity(
- new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
- assertEquals(entity, written);
- input.close();
- }
-
- @Test
- public void atomWithInlineEntitySet() throws Exception {
- withInlineEntitySet(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonWithInlineEntitySet() throws Exception {
- withInlineEntitySet(ODataFormat.JSON_FULL_METADATA);
- }
-
- private void mediaEntity(final ODataFormat format) throws Exception {
- final InputStream input = getClass().getResourceAsStream(
- "Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7." + getSuffix(format));
- final ClientEntity entity = getClient().getBinder().getODataEntity(
- getClient().getDeserializer(format).toEntity(input));
- assertNotNull(entity);
-
- assertTrue(entity.isMediaEntity());
- assertNotNull(entity.getMediaContentSource());
- assertEquals("\"8zOOKKvgOtptr4gt8IrnapX3jds=\"", entity.getMediaETag());
-
- final ClientEntity written = getClient().getBinder().getODataEntity(
- new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
- assertEquals(entity, written);
- input.close();
- }
-
- @Test
- public void atomMediaEntity() throws Exception {
- mediaEntity(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonMediaEntity() throws Exception {
- mediaEntity(ODataFormat.JSON_FULL_METADATA);
- }
-
- private void withStream(final ODataFormat format) throws Exception {
- final InputStream input = getClass().getResourceAsStream("PersonDetails_1." + getSuffix(format));
- final ClientEntity entity = getClient().getBinder().getODataEntity(
- getClient().getDeserializer(format).toEntity(input));
- assertNotNull(entity);
-
- assertFalse(entity.isMediaEntity());
-
- final ClientLink editMedia = entity.getMediaEditLink("Photo");
- assertNotNull(editMedia);
-
- final ClientEntity written = getClient().getBinder().getODataEntity(
- new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
- assertEquals(entity, written);
- input.close();
- }
-
- @Test
- public void atomWithStream() throws Exception {
- withStream(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonWithStream() throws Exception {
- withStream(ODataFormat.JSON_FULL_METADATA);
- }
-
- private void ref(final ODataFormat format) throws Exception {
- final InputStream input = getClass().getResourceAsStream("entityReference." + getSuffix(format));
- final ClientEntity entity = getClient().getBinder().getODataEntity(
- getClient().getDeserializer(format).toEntity(input));
- assertNotNull(entity);
-
- assertNotNull(entity.getId());
-
- final ClientEntity written = getClient().getBinder().getODataEntity(
- new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
- assertEquals(entity, written);
- input.close();
- }
-
- @Test
- public void atomRef() throws Exception {
- ref(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonRef() throws Exception {
- ref(ODataFormat.JSON);
- }
-
- private void complexNavigationProperties(final ODataFormat format) throws Exception {
- final InputStream input = getClass().getResourceAsStream("entity.withcomplexnavigation." + getSuffix(format));
- final ClientEntity entity = getClient().getBinder().getODataEntity(
- getClient().getDeserializer(format).toEntity(input));
- assertNotNull(entity);
-
- final ClientComplexValue addressValue = entity.getProperty("Address").getComplexValue();
- assertNotNull(addressValue);
- assertNotNull(addressValue.getNavigationLink("Country"));
-
- // ETag is not serialized
- entity.setETag(null);
- final ClientEntity written = getClient().getBinder().getODataEntity(
- new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
- assertEquals(entity, written);
- input.close();
- }
-
- @Test
- public void atomComplexNavigationProperties() throws Exception {
- complexNavigationProperties(ODataFormat.ATOM);
- }
-
- @Test
- public void jsonComplexNavigationProperties() throws Exception {
- complexNavigationProperties(ODataFormat.JSON);
- }
-
- private void annotated(final ODataFormat format) throws EdmPrimitiveTypeException, Exception {
- final InputStream input = getClass().getResourceAsStream("annotated." + getSuffix(format));
- final ClientEntity entity = getClient().getBinder().getODataEntity(
- getClient().getDeserializer(format).toEntity(input));
- assertNotNull(entity);
-
- assertFalse(entity.getAnnotations().isEmpty());
-
- ClientAnnotation annotation = entity.getAnnotations().get(0);
- assertEquals("com.contoso.display.highlight", annotation.getTerm());
- assertEquals(true, annotation.getPrimitiveValue().toCastValue(Boolean.class));
-
- annotation = entity.getAnnotations().get(1);
- assertEquals("com.contoso.PersonalInfo.PhoneNumbers", annotation.getTerm());
- assertTrue(annotation.hasCollectionValue());
-
- annotation = entity.getProperty("LastName").getAnnotations().get(0);
- assertEquals("com.contoso.display.style", annotation.getTerm());
- assertTrue(annotation.hasComplexValue());
-
- final ClientLink orders = entity.getNavigationLink("Orders");
- assertFalse(orders.getAnnotations().isEmpty());
-
- annotation = orders.getAnnotations().get(0);
- assertEquals("com.contoso.display.style", annotation.getTerm());
- assertEquals("com.contoso.display.styleType", annotation.getValue().getTypeName());
- assertTrue(annotation.hasComplexValue());
- assertEquals(2,
- annotation.getValue().asComplex().get("order").getPrimitiveValue().toCastValue(Integer.class), 0);
-
- final ClientEntity written = getClient().getBinder().getODataEntity(
- new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
- assertEquals(entity, written);
- input.close();
- }
-
- @Test
- @Ignore
- public void atomAnnotated() throws Exception {
- annotated(ODataFormat.ATOM);
- }
-
- @Test
- @Ignore
- public void jsonAnnotated() throws Exception {
- annotated(ODataFormat.JSON);
- }
-
- private void derived(final ODataClient client, final ODataFormat format) throws Exception {
- final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(format));
- final ClientEntity entity = client.getBinder().getODataEntity(client.getDeserializer(format).toEntity(input));
- assertNotNull(entity);
-
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
- assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress",
- ((ClientValuable) entity.getProperty("HomeAddress")).getValue().getTypeName());
- input.close();
- }
-
- @Test
- public void derivedFromAtom() throws Exception {
- derived(getClient(), ODataFormat.ATOM);
- }
-
- @Test
- public void derivedFromJSON() throws Exception {
- derived(getEdmEnabledClient(), ODataFormat.JSON);
- }
-
- @Test
- public void derivedFromFullJSON() throws Exception {
- derived(getClient(), ODataFormat.JSON_FULL_METADATA);
- }
-}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
deleted file mode 100644
index 057c0de..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.v4;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.ODataError;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-public class ErrorTest extends AbstractTest {
-
- @Override
- protected ODataClient getClient() {
- return v4Client;
- }
-
- private ODataError error(final String name, final ODataFormat format) throws ODataDeserializerException {
- final ODataError error = getClient().getDeserializer(format).toError(
- getClass().getResourceAsStream(name + "." + getSuffix(format)));
- assertNotNull(error);
- return error;
- }
-
- private void simple(final ODataFormat format) throws ODataDeserializerException {
- final ODataError error = error("error", format);
- assertEquals("501", error.getCode());
- assertEquals("Unsupported functionality", error.getMessage());
- assertEquals("query", error.getTarget());
- }
-
- @Test
- public void jsonSimple() throws Exception {
- simple(ODataFormat.JSON);
- }
-
- @Test
- public void atomSimple() throws Exception {
- simple(ODataFormat.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
deleted file mode 100644
index 83c495c..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Delta;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.client.api.domain.ClientCollectionValue;
-import org.apache.olingo.client.api.domain.ClientComplexValue;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientValue;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class JSONTest extends AbstractTest {
-
- private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
-
- @Override
- protected ODataClient getClient() {
- return v4Client;
- }
-
- protected ODataFormat getODataPubFormat() {
- return ODataFormat.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(Constants.JSON_ETAG)) {
- node.remove(Constants.JSON_ETAG);
- }
- if (node.has(Constants.JSON_TYPE)) {
- node.remove(Constants.JSON_TYPE);
- }
- if (node.has(Constants.JSON_EDIT_LINK)) {
- node.remove(Constants.JSON_EDIT_LINK);
- }
- if (node.has(Constants.JSON_READ_LINK)) {
- node.remove(Constants.JSON_READ_LINK);
- }
- if (node.has(Constants.JSON_MEDIA_EDIT_LINK)) {
- node.remove(Constants.JSON_MEDIA_EDIT_LINK);
- }
- if (node.has(Constants.JSON_MEDIA_READ_LINK)) {
- node.remove(Constants.JSON_MEDIA_READ_LINK);
- }
- if (node.has(Constants.JSON_MEDIA_CONTENT_TYPE)) {
- node.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
- }
- if (node.has(Constants.JSON_COUNT)) {
- node.remove(Constants.JSON_COUNT);
- }
- final List<String> toRemove = new ArrayList<String>();
- for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
- final Map.Entry<String, JsonNode> field = itor.next();
-
- final String key = field.getKey();
- if (key.charAt(0) == '#'
- || key.endsWith(Constants.JSON_TYPE)
- || key.endsWith(Constants.JSON_MEDIA_EDIT_LINK)
- || key.endsWith(Constants.JSON_MEDIA_CONTENT_TYPE)
- || key.endsWith(Constants.JSON_ASSOCIATION_LINK)
- || key.endsWith(Constants.JSON_MEDIA_ETAG)) {
-
- toRemove.add(key);
- } else if (field.getValue().isObject()) {
- cleanup((ObjectNode) field.getValue());
- } else if (field.getValue().isArray()) {
- for (final Iterator<JsonNode> arrayItems = field.getValue().elements(); arrayItems.hasNext();) {
- final JsonNode arrayItem = arrayItems.next();
- if (arrayItem.isObject()) {
- cleanup((ObjectNode) arrayItem);
- }
- }
- }
- }
- node.remove(toRemove);
- }
-
- protected void assertSimilar(final String filename, final String actual) throws Exception {
- final JsonNode expected = OBJECT_MAPPER.readTree(IOUtils.toString(getClass().getResourceAsStream(filename)).
- replace(Constants.JSON_NAVIGATION_LINK, Constants.JSON_BIND_LINK_SUFFIX));
- cleanup((ObjectNode) expected);
- final ObjectNode actualNode = (ObjectNode) OBJECT_MAPPER.readTree(new ByteArrayInputStream(actual.getBytes()));
- cleanup(actualNode);
- assertEquals(expected, actualNode);
- }
-
- protected void entitySet(final String filename, final ODataFormat format) throws Exception {
- final StringWriter writer = new StringWriter();
- getClient().getSerializer(format).write(writer, getClient().getDeserializer(format).toEntitySet(
- getClass().getResourceAsStream(filename + "." + getSuffix(format))).getPayload());
-
- assertSimilar(filename + "." + getSuffix(format), writer.toString());
- }
-
- @Test
- public void entitySets() throws Exception {
- entitySet("Customers", getODataPubFormat());
- entitySet("collectionOfEntityReferences", getODataPubFormat());
- }
-
- protected void entity(final String filename, final ODataFormat format) throws Exception {
- final StringWriter writer = new StringWriter();
- getClient().getSerializer(format).write(writer, getClient().getDeserializer(format).toEntity(
- getClass().getResourceAsStream(filename + "." + getSuffix(format))).getPayload());
-
- assertSimilar(filename + "." + getSuffix(format), writer.toString());
- }
-
- @Test
- public void additionalEntities() throws Exception {
- entity("entity.minimal", getODataPubFormat());
- entity("entity.primitive", getODataPubFormat());
- entity("entity.complex", getODataPubFormat());
- entity("entity.collection.primitive", getODataPubFormat());
- entity("entity.collection.complex", getODataPubFormat());
- }
-
- @Test
- public void entities() throws Exception {
- entity("Products_5", getODataPubFormat());
- entity("VipCustomer", getODataPubFormat());
- entity("Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7", getODataPubFormat());
- entity("entityReference", getODataPubFormat());
- entity("entity.withcomplexnavigation", getODataPubFormat());
- entity("annotated", getODataPubFormat());
- }
-
- protected void property(final String filename, final ODataFormat format) throws Exception {
- final StringWriter writer = new StringWriter();
- getClient().getSerializer(format).write(writer, getClient().getDeserializer(format).
- toProperty(getClass().getResourceAsStream(filename + "." + getSuffix(format))).getPayload());
-
- 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());
- }
-
- @Test
- public void crossjoin() throws Exception {
- assertNotNull(getClient().getDeserializer(ODataFormat.JSON_FULL_METADATA).toEntitySet(
- getClass().getResourceAsStream("crossjoin.json")));
- }
-
- protected void delta(final String filename, final ODataFormat format) throws Exception {
- final Delta delta = getClient().getDeserializer(format).toDelta(
- getClass().getResourceAsStream(filename + "." + getSuffix(format))).getPayload();
- assertNotNull(delta);
- assertNotNull(delta.getDeltaLink());
- assertEquals(5, delta.getCount(), 0);
-
- assertEquals(1, delta.getDeletedEntities().size());
- assertTrue(delta.getDeletedEntities().get(0).getId().toASCIIString().endsWith("Customers('ANTON')"));
-
- assertEquals(1, delta.getAddedLinks().size());
- assertTrue(delta.getAddedLinks().get(0).getSource().toASCIIString().endsWith("Customers('BOTTM')"));
- assertEquals("Orders", delta.getAddedLinks().get(0).getRelationship());
-
- assertEquals(1, delta.getDeletedLinks().size());
- assertTrue(delta.getDeletedLinks().get(0).getSource().toASCIIString().endsWith("Customers('ALFKI')"));
- assertEquals("Orders", delta.getDeletedLinks().get(0).getRelationship());
-
- assertEquals(2, delta.getEntities().size());
- Property property = delta.getEntities().get(0).getProperty("ContactName");
- assertNotNull(property);
- assertTrue(property.isPrimitive());
- property = delta.getEntities().get(1).getProperty("ShippingAddress");
- assertNotNull(property);
- assertTrue(property.isComplex());
- }
-
- @Test
- public void deltas() throws Exception {
- delta("delta", getODataPubFormat());
- }
-
- @Test
- public void issueOLINGO390() throws Exception {
- final ClientEntity message = getClient().getObjectFactory().
- newEntity(new FullQualifiedName("Microsoft.Exchange.Services.OData.Model.Message"));
-
- final ClientComplexValue toRecipient = getClient().getObjectFactory().
- newComplexValue("Microsoft.Exchange.Services.OData.Model.Recipient");
- toRecipient.add(getClient().getObjectFactory().newPrimitiveProperty("Name",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("challen_olingo_client")));
- toRecipient.add(getClient().getObjectFactory().newPrimitiveProperty("Address",
- getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("challenh@microsoft.com")));
- final ClientCollectionValue<ClientValue> toRecipients = getClient().getObjectFactory().
- newCollectionValue("Microsoft.Exchange.Services.OData.Model.Recipient");
- toRecipients.add(toRecipient);
- message.getProperties().add(getClient().getObjectFactory().newCollectionProperty("ToRecipients", toRecipients));
-
- final ClientComplexValue body =
- getClient().getObjectFactory().newComplexValue("Microsoft.Exchange.Services.OData.Model.ItemBody");
- body.add(getClient().getObjectFactory().newPrimitiveProperty("Content",
- getClient().getObjectFactory().newPrimitiveValueBuilder().
- buildString("this is a simple email body content")));
- body.add(getClient().getObjectFactory().newEnumProperty("ContentType",
- getClient().getObjectFactory().newEnumValue("Microsoft.Exchange.Services.OData.Model.BodyType", "text")));
- message.getProperties().add(getClient().getObjectFactory().newComplexProperty("Body", body));
-
- final String actual = IOUtils.toString(getClient().getWriter().writeEntity(message, ODataFormat.JSON));
- final JsonNode expected =
- OBJECT_MAPPER.readTree(IOUtils.toString(getClass().getResourceAsStream("olingo390.json")).
- replace(Constants.JSON_NAVIGATION_LINK, Constants.JSON_BIND_LINK_SUFFIX));
- final ObjectNode actualNode = (ObjectNode) OBJECT_MAPPER.readTree(new ByteArrayInputStream(actual.getBytes()));
- assertEquals(expected, actualNode);
- }
-}
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
deleted file mode 100644
index 562a255..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-import java.util.List;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmAnnotations;
-import org.apache.olingo.commons.api.edm.EdmAnnotationsTarget;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmSchema;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.annotation.EdmUrlRef;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
-import org.apache.olingo.commons.api.edm.provider.CsdlAnnotations;
-import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
-import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
-import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
-import org.apache.olingo.commons.api.edm.provider.CsdlFunction;
-import org.apache.olingo.commons.api.edm.provider.CsdlFunctionImport;
-import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
-import org.apache.olingo.commons.api.edm.provider.CsdlSingleton;
-import org.apache.olingo.commons.api.edm.provider.CsdlTerm;
-import org.apache.olingo.commons.api.edm.provider.annotation.Apply;
-import org.apache.olingo.commons.api.edm.provider.annotation.Collection;
-import org.apache.olingo.commons.api.edm.provider.annotation.ConstantAnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.Path;
-import org.apache.olingo.commons.api.edm.provider.annotation.TwoParamsOpDynamicAnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.UrlRef;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDecimal;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmInt32;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.junit.Test;
-
-public class MetadataTest extends AbstractTest {
-
- @Override
- protected ODataClient getClient() {
- return v4Client;
- }
-
- @Test
- public void parse() {
- final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("metadata.xml"));
- assertNotNull(edm);
-
- // 1. Enum
- final EdmEnumType responseEnumType = edm.getEnumType(
- new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "ResponseType"));
- assertNotNull(responseEnumType);
- assertEquals(6, responseEnumType.getMemberNames().size());
- assertEquals("3", responseEnumType.getMember("Accepted").getValue());
- assertEquals(EdmTypeKind.ENUM, responseEnumType.getKind());
-
- // 2. Complex
- final EdmComplexType responseStatus = edm.getComplexType(
- new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "ResponseStatus"));
- assertNotNull(responseStatus);
- assertTrue(responseStatus.getNavigationPropertyNames().isEmpty());
- assertEquals("Recipient", responseStatus.getBaseType().getName());
- assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.DateTimeOffset),
- responseStatus.getProperty("Time").getType());
-
- // 3. Entity
- final EdmEntityType user = edm.getEntityType(
- new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "User"));
- assertNotNull(user);
- assertFalse(user.getPropertyNames().isEmpty());
- assertFalse(user.getNavigationPropertyNames().isEmpty());
-
- final EdmEntityType entity = edm.getEntityType(
- new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Entity"));
- assertEquals(entity, user.getBaseType());
- assertFalse(entity.getPropertyNames().isEmpty());
- assertTrue(entity.getNavigationPropertyNames().isEmpty());
-
- final EdmEntityType folder = edm.getEntityType(
- new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Folder"));
- assertEquals(folder, user.getNavigationProperty("Inbox").getType());
-
- // 4. Action
- final EdmAction move = edm.getBoundAction(
- new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Move"),
- new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Folder"),
- false);
- assertNotNull(move);
- assertTrue(move.isBound());
- assertEquals(2, move.getParameterNames().size());
- assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String),
- move.getParameter("DestinationId").getType());
-
- // 5. EntityContainer
- final EdmEntityContainer container = edm.getEntityContainer(
- new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "EntityContainer"));
- assertNotNull(container);
- final EdmEntitySet users = container.getEntitySet("Users");
- assertNotNull(users);
- assertEquals(edm.getEntityType(new FullQualifiedName(container.getNamespace(), "User")),
- users.getEntityType());
- assertEquals(container.getEntitySet("Folders"), users.getRelatedBindingTarget("Folders"));
- }
-
- @Test
- public void demo() {
- final XMLMetadata metadata = getClient().getDeserializer(ODataFormat.XML).
- toMetadata(getClass().getResourceAsStream("demo-metadata.xml"));
- assertNotNull(metadata);
-
- assertFalse(metadata.getSchema(0).getAnnotationGroups().isEmpty());
- final CsdlAnnotations annots = metadata.getSchema(0).getAnnotationGroup("ODataDemo.DemoService/Suppliers");
- assertNotNull(annots);
- assertFalse(annots.getAnnotations().isEmpty());
- assertEquals(ConstantAnnotationExpression.Type.String,
- annots.getAnnotation("Org.OData.Publication.V1.PrivacyPolicyUrl").getExpression().asConstant().getType());
- assertEquals("http://www.odata.org/",
- annots.getAnnotation("Org.OData.Publication.V1.PrivacyPolicyUrl").getExpression().asConstant().getValue());
-
- // Now let's test some edm:Annotations
- final Edm edm = getClient().getReader().
- readMetadata(getClass().getResourceAsStream("demo-metadata.xml"));
- assertNotNull(edm);
-
- final EdmSchema schema = edm.getSchema("ODataDemo");
- assertNotNull(schema);
- assertTrue(schema.getAnnotations().isEmpty());
- assertFalse(schema.getAnnotationGroups().isEmpty());
-
- final EdmAnnotations annotationGroup = schema.getAnnotationGroups().get(2);
- assertNotNull(annotationGroup);
- final EdmAnnotationsTarget annotationsTarget = annotationGroup.getTarget();
- assertNotNull(annotationsTarget);
- assertTrue(EdmAnnotationsTarget.TargetType.Property == annotationsTarget.getAnnotationsTargetType());
- assertEquals(new FullQualifiedName("ODataDemo.Product"), annotationsTarget.getAnnotationsTargetFQN());
- assertEquals("Name", annotationsTarget.getAnnotationsTargetPath());
-
- final EdmAnnotation annotation = annotationGroup.getAnnotations().get(0);
- assertNotNull(annotation);
- assertTrue(annotation.getExpression().isConstant());
- assertEquals("Edm.String", annotation.getExpression().asConstant().getValue().getType());
-
- assertEquals(10, schema.getAnnotationGroups().get(3).getAnnotations().size());
- }
-
- @Test
- public void multipleSchemas() {
- final XMLMetadata metadata = getClient().getDeserializer(ODataFormat.XML).
- toMetadata(getClass().getResourceAsStream("northwind-metadata.xml"));
- assertNotNull(metadata);
-
- final CsdlSchema first = metadata.getSchema("NorthwindModel");
- assertNotNull(first);
-
- final CsdlSchema second = metadata.getSchema("ODataWebExperimental.Northwind.Model");
- assertNotNull(second);
-
- final CsdlEntityContainer entityContainer = second.getEntityContainer();
- assertNotNull(entityContainer);
- assertEquals("NorthwindEntities", entityContainer.getName());
- }
-
- /**
- * Tests Example 85 from CSDL specification.
- */
- @Test
- public void fromdoc1() {
- final XMLMetadata metadata = getClient().getDeserializer(ODataFormat.XML).
- toMetadata(getClass().getResourceAsStream("fromdoc1-metadata.xml"));
- assertNotNull(metadata);
-
- assertFalse(metadata.getReferences().isEmpty());
- assertEquals("Org.OData.Measures.V1", metadata.getReferences().get(1).getIncludes().get(0).getNamespace());
-
- final CsdlEntityType product = metadata.getSchema(0).getEntityType("Product");
- assertTrue(product.hasStream());
- assertEquals("UoM.ISOCurrency", product.getProperty("Price").getAnnotations().get(0).getTerm());
- assertEquals("Products", product.getNavigationProperty("Supplier").getPartner());
-
- final CsdlEntityType category = metadata.getSchema(0).getEntityType("Category");
- assertNotNull(category);
-
- final CsdlComplexType address = metadata.getSchema(0).getComplexType("Address");
- assertFalse(address.getNavigationProperty("Country").getReferentialConstraints().isEmpty());
- assertEquals("Name",
- address.getNavigationProperty("Country").getReferentialConstraints().get(0).getReferencedProperty());
-
- final CsdlFunction productsByRating = metadata.getSchema(0).getFunctions("ProductsByRating").get(0);
- assertNotNull(productsByRating.getParameter("Rating"));
- assertEquals("Edm.Int32", productsByRating.getParameter("Rating").getType());
- assertEquals("ODataDemo.Product", productsByRating.getReturnType().getType());
- assertTrue(productsByRating.getReturnType().isCollection());
-
- final CsdlSingleton contoso = metadata.getSchema(0).getEntityContainer().getSingleton("Contoso");
- assertNotNull(contoso);
- assertFalse(contoso.getNavigationPropertyBindings().isEmpty());
- assertEquals("Products", contoso.getNavigationPropertyBindings().get(0).getPath());
-
- final CsdlFunctionImport functionImport = metadata.getSchema(0).getEntityContainer().
- getFunctionImport("ProductsByRating");
- assertNotNull(functionImport);
- assertEquals(metadata.getSchema(0).getNamespace() + "." + productsByRating.getName(),
- functionImport.getFunction());
-
- // Now let's go high-level
- final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("fromdoc1-metadata.xml"));
- assertNotNull(edm);
-
- List<EdmSchema> schemaList = edm.getSchemas();
- assertNotNull(schemaList);
- assertEquals(1, schemaList.size());
- EdmSchema schema = schemaList.get(0);
-
- EdmEntityContainer demoService = schema.getEntityContainer();
- assertNotNull(demoService);
- for (EdmFunction function : schema.getFunctions()) {
- final EdmFunctionImport fi = demoService.getFunctionImport(function.getName());
- assertNotNull(fi);
- assertEquals(demoService.getEntitySet("Products"), fi.getReturnedEntitySet());
-
- final EdmFunction edmFunction =
- edm.getUnboundFunction(
- new FullQualifiedName(metadata.getSchema(0).getNamespace(), "ProductsByRating"), function
- .getParameterNames());
- assertNotNull(edmFunction);
- assertEquals(edmFunction.getName(), fi.getUnboundFunction(function.getParameterNames()).getName());
- assertEquals(edmFunction.getNamespace(), fi.getUnboundFunction(function.getParameterNames()).getNamespace());
- assertEquals(edmFunction.getParameterNames(), fi.getUnboundFunction(function.getParameterNames())
- .getParameterNames());
- assertEquals(edmFunction.getReturnType().getType().getName(),
- fi.getUnboundFunction(function.getParameterNames()).getReturnType().getType().getName());
- assertEquals(edmFunction.getReturnType().getType().getNamespace(),
- fi.getUnboundFunction(function.getParameterNames()).getReturnType().getType().getNamespace());
- }
-
- final EdmTypeDefinition weight = edm.getTypeDefinition(new FullQualifiedName("ODataDemo", "Weight"));
- assertNotNull(weight);
- assertEquals(EdmInt32.getInstance(), weight.getUnderlyingType());
- assertFalse(weight.getAnnotations().isEmpty());
- assertEquals("Kilograms", weight.getAnnotations().get(0).getExpression().asConstant().getValueAsString());
- }
-
- /**
- * Tests Example 86 from CSDL specification.
- */
- @Test
- public void fromdoc2() {
- final XMLMetadata metadata = getClient().getDeserializer(ODataFormat.XML)
- .toMetadata(getClass().getResourceAsStream("fromdoc2-metadata.xml"));
- assertNotNull(metadata);
-
- // Check displayName
- final CsdlAnnotation displayName = metadata.getSchema(0).getAnnotationGroup("ODataDemo.Supplier").
- getAnnotation("Vocabulary1.DisplayName");
- assertNotNull(displayName);
- assertTrue(displayName.getExpression().isDynamic());
-
- assertTrue(displayName.getExpression().asDynamic().isApply());
- final Apply apply = displayName.getExpression().asDynamic().asApply();
- assertEquals(Constants.CANONICAL_FUNCTION_CONCAT, apply.getFunction());
- assertEquals(3, apply.getParameters().size());
-
- Path path = (Path) apply.getParameters().get(0);
- assertEquals("Name", path.getValue());
-
- ConstantAnnotationExpression expression =
- (ConstantAnnotationExpression) apply.getParameters().get(1);
- assertEquals(" in ", expression.getValue());
- assertEquals(ConstantAnnotationExpression.Type.String, expression.getType());
-
- Path thirdArg = (Path) apply.getParameters().get(2);
- assertEquals("Address/CountryName", thirdArg.getValue());
-
- // Check Tags
- final CsdlAnnotation tags = metadata.getSchema(0).getAnnotationGroup("ODataDemo.Product").
- getAnnotation("Vocabulary1.Tags");
- assertNotNull(tags);
- assertTrue(tags.getExpression().isDynamic());
-
- assertTrue(tags.getExpression().asDynamic().isCollection());
- final Collection collection = tags.getExpression().asDynamic().asCollection();
- assertEquals(1, collection.getItems().size());
- assertEquals(ConstantAnnotationExpression.Type.String, collection.getItems().get(0).asConstant().getType());
- assertEquals("MasterData", collection.getItems().get(0).asConstant().getValue());
- }
-
- /**
- * Various annotation examples taken from CSDL specification.
- */
- @Test
- public void fromdoc3() {
- final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("fromdoc3-metadata.xml"));
- assertNotNull(edm);
-
- final EdmAnnotations group = edm.getSchema("Annotations").getAnnotationGroups().get(0);
- assertNotNull(group);
-
- final EdmAnnotation time1 = group.getAnnotations().get(0);
- assertEquals("Edm.TimeOfDay", time1.getExpression().asConstant().getValue().getType());
-
- final EdmAnnotation time2 = group.getAnnotations().get(1);
- assertEquals("Edm.TimeOfDay", time2.getExpression().asConstant().getValue().getType());
- }
-
- /**
- * Various annotation examples taken from CSDL specification.
- */
- @Test
- public void fromdoc4() {
- final XMLMetadata metadata = getClient().getDeserializer(ODataFormat.XML).
- toMetadata(getClass().getResourceAsStream("fromdoc4-metadata.xml"));
- assertNotNull(metadata);
-
- final CsdlAnnotations group = metadata.getSchema(0).getAnnotationGroups().get(0);
- assertNotNull(group);
-
- CsdlAnnotation annotation = group.getAnnotations().get(0);
- assertTrue(annotation.getExpression().isDynamic());
- assertTrue(annotation.getExpression().asDynamic().isCast());
- assertEquals("Edm.Decimal", annotation.getExpression().asDynamic().asCast().getType());
-
- annotation = group.getAnnotation("And");
- assertTrue(annotation.getExpression().isDynamic());
- assertTrue(annotation.getExpression().asDynamic().isTwoParamsOp());
- assertEquals(TwoParamsOpDynamicAnnotationExpression.Type.And,
- annotation.getExpression().asDynamic().asTwoParamsOp().getType());
- assertTrue(annotation.getExpression().asDynamic().asTwoParamsOp().getLeftExpression().isPath());
-
- annotation = group.getAnnotation("Vocab.Supplier");
- assertNotNull(annotation);
- assertTrue(annotation.getExpression().isDynamic());
- assertTrue(annotation.getExpression().asDynamic().isUrlRef());
- final UrlRef urlRef = annotation.getExpression().asDynamic().asUrlRef();
- assertTrue(urlRef.getValue().isDynamic());
- assertTrue(urlRef.getValue().asDynamic().isApply());
-
- // Now let's go high-level
- final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("fromdoc4-metadata.xml"));
- assertNotNull(edm);
-
- final EdmAnnotations edmGroup = edm.getSchemas().get(0).getAnnotationGroups().get(0);
- assertNotNull(edmGroup);
-
- EdmAnnotation edmAnnotation = edmGroup.getAnnotations().get(0);
- assertTrue(edmAnnotation.getExpression().isDynamic());
- assertTrue(edmAnnotation.getExpression().asDynamic().isCast());
- assertEquals(EdmDecimal.getInstance(), edmAnnotation.getExpression().asDynamic().asCast().getType());
-
- edmAnnotation = edmGroup.getAnnotations().get(1);
- assertTrue(edmAnnotation.getExpression().isDynamic());
- assertTrue(edmAnnotation.getExpression().asDynamic().isAnd());
- assertTrue(edmAnnotation.getExpression().asDynamic().asAnd().getLeftExpression().isPath());
-
- edmAnnotation = edmGroup.getAnnotations().get(edmGroup.getAnnotations().size() - 2);
- assertNotNull(edmAnnotation);
- assertTrue(edmAnnotation.getExpression().isDynamic());
- assertTrue(edmAnnotation.getExpression().asDynamic().isUrlRef());
- final EdmUrlRef edmUrlRef = edmAnnotation.getExpression().asDynamic().asUrlRef();
- assertTrue(edmUrlRef.getValue().isDynamic());
- assertTrue(edmUrlRef.getValue().asDynamic().isApply());
- }
-
- @Test
- public void metadataWithCapabilities() throws Exception {
- InputStream input = getClass().getResourceAsStream("Metadata-With-Capabilities.xml");
- final XMLMetadata metadata = getClient().getDeserializer(ODataFormat.XML).
- toMetadata(input);
-
- CsdlSchema schema = metadata.getSchema("Capabilities");
- assertNotNull(schema);
- assertEquals(23, schema.getTerms().size());
-
- final CsdlTerm deleteRestrictions = schema.getTerm("DeleteRestrictions");
- assertNotNull(deleteRestrictions);
- assertEquals("Capabilities.DeleteRestrictionsType", deleteRestrictions.getType());
- }
-}
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
deleted file mode 100644
index d22bb6f..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.v4;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.api.domain.ClientValue;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.junit.Test;
-
-import java.util.Calendar;
-
-import static org.junit.Assert.assertEquals;
-
-public class PrimitiveValueTest extends AbstractTest {
-
- @Override
- protected ODataClient getClient() {
- return v4Client;
- }
-
- @Test
- public void timeOfDay() throws EdmPrimitiveTypeException {
- final Calendar expected = Calendar.getInstance();
- expected.clear();
- expected.set(2013, 0, 10, 21, 45, 17);
-
- final ClientValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.TimeOfDay).setValue(expected).build();
- assertEquals(EdmPrimitiveTypeKind.TimeOfDay, value.asPrimitive().getTypeKind());
-
- final Calendar actual = value.asPrimitive().toCastValue(Calendar.class);
- assertEquals(expected.get(Calendar.HOUR), actual.get(Calendar.HOUR));
- assertEquals(expected.get(Calendar.MINUTE), actual.get(Calendar.MINUTE));
- assertEquals(expected.get(Calendar.SECOND), actual.get(Calendar.SECOND));
-
- assertEquals("21:45:17", value.asPrimitive().toString());
- }
-
- @Test
- public void Date() throws EdmPrimitiveTypeException {
- final Calendar expected = Calendar.getInstance();
- expected.clear();
- expected.set(2013, 0, 10);
-
- final ClientValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Date).setValue(expected).build();
- assertEquals(EdmPrimitiveTypeKind.Date, value.asPrimitive().getTypeKind());
-
- final Calendar actual = value.asPrimitive().toCastValue(Calendar.class);
- assertEquals(expected.get(Calendar.YEAR), actual.get(Calendar.YEAR));
- assertEquals(expected.get(Calendar.MONTH), actual.get(Calendar.MONTH));
- assertEquals(expected.get(Calendar.DATE), actual.get(Calendar.DATE));
-
- assertEquals("2013-01-10", value.asPrimitive().toString());
- }
-}
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
deleted file mode 100644
index 46e0d22..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.v4;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.api.domain.ClientCollectionValue;
-import org.apache.olingo.client.api.domain.ClientComplexValue;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.domain.ClientValue;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.apache.olingo.commons.api.serialization.ODataSerializerException;
-import org.junit.Test;
-
-import java.io.InputStream;
-import java.util.Iterator;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class PropertyTest extends AbstractTest {
-
- @Override
- protected ODataClient getClient() {
- return v4Client;
- }
-
- private void _enum(final ODataFormat format) throws ODataDeserializerException, ODataSerializerException {
- final InputStream input = getClass().getResourceAsStream("Products_5_SkinColor." + getSuffix(format));
- final ClientProperty property = getClient().getReader().readProperty(input, format);
- assertNotNull(property);
- assertTrue(property.hasEnumValue());
-
- final ClientProperty 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 ClientProperty comparable = getClient().getObjectFactory().newEnumProperty(property.getName(),
- getClient().getObjectFactory().
- newEnumValue(property.getEnumValue().getTypeName(), written.getEnumValue().getValue()));
-
- assertEquals(property, comparable);
- }
- }
-
- @Test
- public void xmlEnum() throws Exception {
- _enum(ODataFormat.XML);
- }
-
- @Test
- public void jsonEnum() throws Exception {
- _enum(ODataFormat.JSON);
- }
-
- private void complex(final ODataFormat format) throws ODataDeserializerException, ODataSerializerException {
- final InputStream input = getClass().getResourceAsStream("Employees_3_HomeAddress." + getSuffix(format));
- final ClientProperty property = getClient().getReader().readProperty(input, format);
- assertNotNull(property);
- assertTrue(property.hasComplexValue());
- assertEquals(3, property.getComplexValue().size());
-
- final ClientProperty written = getClient().getReader().readProperty(
- getClient().getWriter().writeProperty(property, format), format);
- // This is needed because type information gets lost with JSON serialization
- final ClientComplexValue typedValue = getClient().getObjectFactory().
- newComplexValue(property.getComplexValue().getTypeName());
- for (final Iterator<ClientProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
- final ClientProperty prop = itor.next();
- typedValue.add(prop);
- }
- final ClientProperty comparable = getClient().getObjectFactory().
- newComplexProperty(property.getName(), typedValue);
-
- assertEquals(property, comparable);
- }
-
- @Test
- public void xmlComplex() throws Exception {
- complex(ODataFormat.XML);
- }
-
- @Test
- public void jsonComplex() throws Exception {
- complex(ODataFormat.JSON);
- }
-
- private void collection(final ODataFormat format) throws ODataDeserializerException, ODataSerializerException {
- final InputStream input = getClass().getResourceAsStream("Products_5_CoverColors." + getSuffix(format));
- final ClientProperty property = getClient().getReader().readProperty(input, format);
- assertNotNull(property);
- assertTrue(property.hasCollectionValue());
- assertEquals(3, property.getCollectionValue().size());
-
- final ClientProperty 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 ClientCollectionValue<ClientValue> typedValue = getClient().getObjectFactory().
- newCollectionValue(property.getCollectionValue().getTypeName());
- for (final Iterator<ClientValue> itor = written.getCollectionValue().iterator(); itor.hasNext();) {
- final ClientValue value = itor.next();
- typedValue.add(value);
- }
- final ClientProperty comparable = getClient().getObjectFactory().
- newCollectionProperty(property.getName(), typedValue);
-
- assertEquals(property, comparable);
- }
- }
-
- @Test
- public void xmlCollection() throws Exception {
- collection(ODataFormat.XML);
- }
-
- @Test
- public void jsonCollection() throws Exception {
- 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
deleted file mode 100644
index 1a2de09..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.v4;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.client.api.domain.ClientServiceDocument;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.junit.Test;
-
-import java.net.URI;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class ServiceDocumentTest extends AbstractTest {
-
- @Override
- protected ODataClient getClient() {
- return v4Client;
- }
-
- private String getFileExtension(final ODataFormat format) {
- return format == ODataFormat.XML ? "xml" : "json";
- }
-
- private ClientServiceDocument parse(final ODataFormat format) throws ODataDeserializerException {
- ResWrap<ServiceDocument> service = getClient().getDeserializer(format).toServiceDocument(
- getClass().getResourceAsStream("serviceDocument." + getFileExtension(format)));
-
- assertEquals(URI.create("http://host/service/$metadata"), service.getContextURL());
- assertEquals("W/\"MjAxMy0wNS0xM1QxNDo1NFo=\"", service.getMetadataETag());
-
- final ClientServiceDocument serviceDocument = getClient().getBinder().getODataServiceDocument(service.getPayload());
- assertNotNull(serviceDocument);
-
- assertTrue(serviceDocument.getEntitySetNames().contains("Order Details"));
- assertEquals(URI.create("http://host/service/TopProducts"),
- serviceDocument.getFunctionImportURI("TopProducts"));
- assertEquals(URI.create("http://host/HR/"),
- serviceDocument.getRelatedServiceDocumentsURIs().iterator().next());
-
- return serviceDocument;
- }
-
- @Test
- public void json() throws Exception {
- parse(ODataFormat.JSON);
- }
-
- @Test
- public void xml() throws Exception {
- parse(ODataFormat.XML);
- }
-}
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/Accounts_101_expand_MyPaymentInstruments.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/Accounts_101_expand_MyPaymentInstruments.json
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/Accounts_101_expand_MyPaymentInstruments.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/Accounts_101_expand_MyPaymentInstruments.xml
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/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customer.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/Customer.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customer.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/Customer.json
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customer.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/Customer.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customer.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/Customer.xml
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/Customers.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/Customers.json
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/Customers.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/Customers.xml
new file mode 100644
index 0000000..a0adedd
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/Customers.xml
@@ -0,0 +1,111 @@
+<?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">
+ <m:inline><feed><m:ref id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders"/></feed></m:inline></link>
+ <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">
+ <m:inline><feed><m:ref id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Orders"/></feed></m:inline>
+ </link>
+ <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/Employees_3_HomeAddress.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/Employees_3_HomeAddress.json
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/Employees_3_HomeAddress.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/Employees_3_HomeAddress.xml
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Metadata-With-Capabilities.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/Metadata-With-Capabilities.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Metadata-With-Capabilities.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/Metadata-With-Capabilities.xml
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/PersonDetails_1.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/PersonDetails_1.json
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/PersonDetails_1.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/PersonDetails_1.xml
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/Products_5.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/Products_5.json
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/Products_5.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/Products_5.xml
new file mode 100644
index 0000000..409799e
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/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"><m:inline><feed><ref xmlns="http://docs.oasis-open.org/odata/ns/metadata" id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details"/></feed></m:inline></link>
+ <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/Products_5_CoverColors.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/Products_5_CoverColors.json
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/Products_5_CoverColors.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/Products_5_CoverColors.xml
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/Products_5_SkinColor.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/Products_5_SkinColor.json
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/Products_5_SkinColor.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/Products_5_SkinColor.xml
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/VipCustomer.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/VipCustomer.json
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/VipCustomer.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/VipCustomer.xml
new file mode 100644
index 0000000..cc5c04d
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/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"><m:inline><feed><ref xmlns="http://docs.oasis-open.org/odata/ns/metadata" id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Orders"/></feed></m:inline></link>
+ <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/annotated.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/annotated.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/annotated.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/annotated.json
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/annotated.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/annotated.xml
new file mode 100644
index 0000000..a3b06a9
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/annotated.xml
@@ -0,0 +1,78 @@
+<?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/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">
+ <m:inline><feed><m:ref id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders"/></feed></m:inline>
+ <m:annotation term="com.contoso.display.style" m:type="#com.contoso.display.styleType">
+ <d:order m:type="Int32">2</d:order>
+ </m:annotation>
+ </link>
+ <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>
+ <m:annotation term="com.contoso.display.style" target="LastName" m:type="#com.contoso.display.styleType">
+ <d:title m:type="Boolean">true</d:title>
+ <d:order m:type="Int32">1</d:order>
+ </m:annotation>
+ <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>
+ <m:annotation term="com.contoso.display.highlight" m:type="Boolean">true</m:annotation>
+ <m:annotation term="com.contoso.PersonalInfo.PhoneNumbers" m:type="#Collection(String)">
+ <m:element>(203)555-1718</m:element>
+ <m:element>(203)555-1719</m:element>
+ </m:annotation>
+</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/atom_cleanup.xsl
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/atom_cleanup.xsl
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/atom_cleanup.xsl
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/collectionOfEntityReferences.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/collectionOfEntityReferences.json
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/collectionOfEntityReferences.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/collectionOfEntityReferences.xml
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/crossjoin.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/crossjoin.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/crossjoin.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/crossjoin.json
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/delta.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/delta.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/delta.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/delta.json
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/delta.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/delta.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/delta.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/delta.xml
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/demo-metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/demo-metadata.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/demo-metadata.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/demo-metadata.xml
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.complex.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.collection.complex.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.complex.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.collection.complex.json
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.primitive.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.collection.primitive.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.primitive.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.collection.primitive.json
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/entity.complex.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.complex.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.complex.json
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/entity.minimal.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.minimal.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.minimal.json
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/entity.primitive.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.primitive.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.primitive.json
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.withcomplexnavigation.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.withcomplexnavigation.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.withcomplexnavigation.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.withcomplexnavigation.json
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.withcomplexnavigation.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.withcomplexnavigation.xml
new file mode 100644
index 0000000..94cb766
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/entity.withcomplexnavigation.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<entry xmlns="http://www.w3.org/2005/Atom"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xml:base="http://host/service/"
+ m:context="$metadata#Customers/$entity"
+ m:metadata-etag="W/"MjAxMy0wNS0xM1QxNDo1NFo="">
+ <id>http://host/service/$metadata#Customers('ALFKI')</id>
+ <title/>
+ <summary/>
+ <updated>2012-03-30T07:11:05Z</updated>
+ <author>
+ <name/>
+ </author>
+ <link rel="edit" title="Customer" href="Customers('ALFKI')"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Orders"
+ type="application/atom+xml;type=feed"
+ title="Orders">
+ <m:inline><feed><m:ref id="Customers('ALFKI')/Orders"/></feed></m:inline> </link>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Supplier"
+ type="application/atom+xml;type=entry"
+ title="Supplier" href="Customers('ALFKI')/Supplier"/>
+ <category term="#ODataDemo.Customer"
+ scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
+ <content type="application/xml">
+ <m:properties>
+ <d:ID>ALFKI</d:ID>
+ <d:CompanyName>Alfreds Futterkiste</d:CompanyName>
+ <d:ContactName>Maria Anders</d:ContactName>
+ <d:ContactTitle>Sales Representative</d:ContactTitle>
+ <d:Phone>030-0074321</d:Phone>
+ <d:Fax>030-0076545</d:Fax>
+ <d:Address>
+ <d:Street>Obere Str. 57</d:Street>
+ <d:City>Berlin</d:City>
+ <d:Region m:null="true"/>
+ <d:PostalCode>D-12209</d:PostalCode>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Country"
+ type="application/atom+xml;type=entry"
+ title="Country"
+ href="Customers('ALFKI')/Address/Country"/>
+ </d:Address>
+ </m:properties>
+ </content>
+</entry>
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/entityReference.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/entityReference.json
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/entityReference.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/entityReference.xml
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/error.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/error.json
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/error.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/error.xml
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/fromdoc1-metadata.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc1-metadata.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/fromdoc1-metadata.xml
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc2-metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/fromdoc2-metadata.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc2-metadata.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/fromdoc2-metadata.xml
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc3-metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/fromdoc3-metadata.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc3-metadata.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/fromdoc3-metadata.xml
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc4-metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/fromdoc4-metadata.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc4-metadata.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/fromdoc4-metadata.xml
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/metadata.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/metadata.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/metadata.xml
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/minimalEntity.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/minimalEntity.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/minimalEntity.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/minimalEntity.json
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/northwind-metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/northwind-metadata.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/northwind-metadata.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/northwind-metadata.xml
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/olingo390.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/olingo390.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/olingo390.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/olingo390.json
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/serviceDocument.json
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/serviceDocument.json
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/serviceDocument.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/serviceDocument.xml
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/staticservice-metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/staticservice-metadata.xml
similarity index 100%
rename from lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/staticservice-metadata.xml
rename to lib/client-core/src/test/resources/org/apache/olingo/client/core/staticservice-metadata.xml
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_GeogLine.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_GeogLine.json
deleted file mode 100644
index c3150e1..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_GeogLine.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Edm.GeographyLineString","odata.type":"Edm.GeographyLineString","value":{"type":"LineString","coordinates":[[40.5,40.5],[30.5,30.5],[20.5,40.5],[10.5,30.5]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}}}
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_GeogLine.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_GeogLine.xml
deleted file mode 100644
index 55b8dcc..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_GeogLine.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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.
-
--->
-<d:GeogLine 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="Edm.GeographyLineString"><gml:LineString gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gml:pos>40.5 40.5</gml:pos><gml:pos>30.5 30.5</gml:pos><gml:pos>20.5 40.5</gml:pos><gml:pos>10.5 30.5</gml:pos></gml:LineString></d:GeogLine>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_GeogPoint.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_GeogPoint.json
deleted file mode 100644
index 7d53958..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_GeogPoint.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Edm.GeographyPoint","odata.type":"Edm.GeographyPoint","value":{"type":"Point","coordinates":[52.8606,173.334],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}}}
\ No newline at end of file
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_GeogPoint.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_GeogPoint.xml
deleted file mode 100644
index d758ec1..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_GeogPoint.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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.
-
--->
-<d:GeogPoint 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="Edm.GeographyPoint"><gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gml:pos>52.8606 173.334</gml:pos></gml:Point></d:GeogPoint>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_Geom.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_Geom.json
deleted file mode 100644
index 8e18317..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_Geom.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Edm.GeometryLineString","value":{"type":"LineString","coordinates":[[1.0,1.0],[3.0,3.0],[2.0,4.0],[2.0,0.0]],"crs":{"type":"name","properties":{"name":"EPSG:0"}}}}
\ No newline at end of file
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_Geom.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_Geom.xml
deleted file mode 100644
index 50c16a2..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-10_Geom.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.
-
--->
-<d:Geom 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="Edm.GeometryLineString">
- <gml:LineString gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:pos>1.0 1.0</gml:pos>
- <gml:pos>3.0 3.0</gml:pos>
- <gml:pos>2.0 4.0</gml:pos>
- <gml:pos>2.0 0.0</gml:pos>
- </gml:LineString>
-</d:Geom>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-3_GeomMultiPolygon.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-3_GeomMultiPolygon.json
deleted file mode 100644
index 09a2291..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-3_GeomMultiPolygon.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Edm.GeometryMultiPolygon","value":{"type":"MultiPolygon","coordinates":[[[[40.0,40.0],[20.0,45.0],[45.0,30.0],[40.0,40.0]]],[[[20.0,35.0],[45.0,20.0],[30.0,5.0],[10.0,10.0],[10.0,30.0],[20.0,35.0]],[[30.0,20.0],[20.0,25.0],[20.0,15.0],[30.0,20.0]]]],"crs":{"type":"name","properties":{"name":"EPSG:0"}}}}
\ No newline at end of file
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-3_GeomMultiPolygon.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-3_GeomMultiPolygon.xml
deleted file mode 100644
index f9e00cf..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-3_GeomMultiPolygon.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?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.0 (the
- "License"); you may not use this 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.
-
--->
-<d:GeomMultiPolygon 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="Edm.GeometryMultiPolygon">
- <gml:MultiSurface gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:surfaceMembers>
- <gml:Polygon>
- <gml:exterior>
- <gml:LinearRing>
- <gml:pos>40.0 40.0</gml:pos>
- <gml:pos>20.0 45.0</gml:pos>
- <gml:pos>45.0 30.0</gml:pos>
- <gml:pos>40.0 40.0</gml:pos>
- </gml:LinearRing>
- </gml:exterior>
- </gml:Polygon>
- <gml:Polygon>
- <gml:exterior>
- <gml:LinearRing>
- <gml:pos>20.0 35.0</gml:pos>
- <gml:pos>45.0 20.0</gml:pos>
- <gml:pos>30.0 5.0</gml:pos>
- <gml:pos>10.0 10.0</gml:pos>
- <gml:pos>10.0 30.0</gml:pos>
- <gml:pos>20.0 35.0</gml:pos>
- </gml:LinearRing>
- </gml:exterior>
- <gml:interior>
- <gml:LinearRing>
- <gml:pos>30.0 20.0</gml:pos>
- <gml:pos>20.0 25.0</gml:pos>
- <gml:pos>20.0 15.0</gml:pos>
- <gml:pos>30.0 20.0</gml:pos>
- </gml:LinearRing>
- </gml:interior>
- </gml:Polygon>
- </gml:surfaceMembers>
- </gml:MultiSurface>
-</d:GeomMultiPolygon>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5.json
deleted file mode 100644
index a5bbb8f..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#AllGeoTypesSet/@Element","odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialTypes","odata.id":"http://192.168.0.160:8080/DefaultService.svc/AllGeoTypesSet(-5)","odata.editLink":"AllGeoTypesSet(-5)","Id":-5,"Geog@odata.type":"Edm.Geography","Geog":{"type":"GeometryCollection","geometries":[],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}},"GeogPoint":null,"GeogLine@odata.type":"Edm.GeographyLineString","GeogLine":{"type":"LineString","coordinates":[[10.5,10.5],[20.5,20.5],[10.5,40.5]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}},"GeogPolygon@odata.type":"Edm.GeographyPolygon","GeogPolygon":{"type":"Polygon","coordinates":[[[15.0,5.0],[40.0,10.0],[10.0,20.0],[5.0,10.0],[15.0,5.0]]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}},"GeogCollection@odata.type":"Edm.GeographyCollection","GeogCollection":{"type":"GeometryCollection","geometries":[{"type":"GeometryCollection","geometries":[]},{"type":"GeometryCollection","geometries":[{"type":"Point","coordinates":[1.0,2.0]}]}],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}},"GeogMultiPoint@odata.type":"Edm.GeographyMultiPoint","GeogMultiPoint":{"type":"MultiPoint","coordinates":[[-122.7,47.38]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}},"GeogMultiLine@odata.type":"Edm.GeographyMultiLineString","GeogMultiLine":{"type":"MultiLineString","coordinates":[],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}},"GeogMultiPolygon@odata.type":"Edm.GeographyMultiPolygon","GeogMultiPolygon":{"type":"MultiPolygon","coordinates":[[[[40.0,40.0],[20.0,45.0],[45.0,30.0],[40.0,40.0]]],[[[20.0,35.0],[45.0,20.0],[30.0,5.0],[10.0,10.0],[10.0,30.0],[20.0,35.0]],[[30.0,20.0],[20.0,25.0],[20.0,15.0],[30.0,20.0]]]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}},"Geom@odata.type":"Edm.Geometry","Geom":{"type":"Polygon","coordinates":[],"crs":{"type":"name","properties":{"name":"EPSG:0"}}},"GeomPoint@odata.type":"Edm.GeometryPoint","GeomPoint":{"type":"Point","coordinates":[4513675.2944411123,6032903.5882574534],"crs":{"type":"name","properties":{"name":"EPSG:0"}}},"GeomLine@odata.type":"Edm.GeometryLineString","GeomLine":{"type":"LineString","coordinates":[[1.0,1.0],[3.0,3.0],[2.0,4.0],[2.0,0.0]],"crs":{"type":"name","properties":{"name":"EPSG:0"}}},"GeomPolygon@odata.type":"Edm.GeometryPolygon","GeomPolygon":{"type":"Polygon","coordinates":[],"crs":{"type":"name","properties":{"name":"EPSG:0"}}},"GeomCollection@odata.type":"Edm.GeometryCollection","GeomCollection":{"type":"GeometryCollection","geometries":[{"type":"GeometryCollection","geometries":[]},{"type":"GeometryCollection","geometries":[{"type":"Point","coordinates":[1.0,2.0]}]}],"crs":{"type":"name","properties":{"name":"EPSG:0"}}},"GeomMultiPoint@odata.type":"Edm.GeometryMultiPoint","GeomMultiPoint":{"type":"MultiPoint","coordinates":[],"crs":{"type":"name","properties":{"name":"EPSG:0"}}},"GeomMultiLine@odata.type":"Edm.GeometryMultiLineString","GeomMultiLine":{"type":"MultiLineString","coordinates":[[[10.0,10.0],[20.0,20.0],[10.0,40.0]],[[40.0,40.0],[30.0,30.0],[40.0,20.0],[30.0,10.0]]],"crs":{"type":"name","properties":{"name":"EPSG:0"}}},"GeomMultiPolygon":null}
\ No newline at end of file
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5.xml
deleted file mode 100644
index 738dcbf..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5.xml
+++ /dev/null
@@ -1,181 +0,0 @@
-<?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://192.168.0.160:8080/DefaultService.svc/"
- xmlns="http://www.w3.org/2005/Atom"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
- <id>http://192.168.0.160:8080/DefaultService.svc/AllGeoTypesSet(-5)</id>
- <category term="Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialTypes"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
- <link rel="edit" title="AllSpatialTypes" href="AllGeoTypesSet(-5)"/>
- <title/>
- <updated>2013-09-11T07:48:06Z</updated>
- <author>
- <name/>
- </author>
- <content type="application/xml">
- <m:properties>
- <d:Id m:type="Edm.Int32">-5</d:Id>
- <d:Geog m:type="Edm.GeographyCollection">
- <gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326"/>
- </d:Geog>
- <d:GeogPoint m:null="true"/>
- <d:GeogLine m:type="Edm.GeographyLineString">
- <gml:LineString gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:pos>10.5 10.5</gml:pos>
- <gml:pos>20.5 20.5</gml:pos>
- <gml:pos>40.5 10.5</gml:pos>
- </gml:LineString>
- </d:GeogLine>
- <d:GeogPolygon m:type="Edm.GeographyPolygon">
- <gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:exterior>
- <gml:LinearRing>
- <gml:pos>5.0 15.0</gml:pos>
- <gml:pos>10.0 40.0</gml:pos>
- <gml:pos>20.0 10.0</gml:pos>
- <gml:pos>10.0 5.0</gml:pos>
- <gml:pos>5.0 15.0</gml:pos>
- </gml:LinearRing>
- </gml:exterior>
- </gml:Polygon>
- </d:GeogPolygon>
- <d:GeogCollection m:type="Edm.GeographyCollection">
- <gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:geometryMembers>
- <gml:MultiGeometry/>
- <gml:MultiGeometry>
- <gml:geometryMembers>
- <gml:Point>
- <gml:pos>2.0 1.0</gml:pos>
- </gml:Point>
- </gml:geometryMembers>
- </gml:MultiGeometry>
- </gml:geometryMembers>
- </gml:MultiGeometry>
- </d:GeogCollection>
- <d:GeogMultiPoint m:type="Edm.GeographyMultiPoint">
- <gml:MultiPoint gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:pointMembers>
- <gml:Point>
- <gml:pos>47.38 -122.7</gml:pos>
- </gml:Point>
- </gml:pointMembers>
- </gml:MultiPoint>
- </d:GeogMultiPoint>
- <d:GeogMultiLine m:type="Edm.GeographyMultiLineString">
- <gml:MultiCurve gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326"/>
- </d:GeogMultiLine>
- <d:GeogMultiPolygon m:type="Edm.GeographyMultiPolygon">
- <gml:MultiSurface gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:surfaceMembers>
- <gml:Polygon>
- <gml:exterior>
- <gml:LinearRing>
- <gml:pos>40.0 40.0</gml:pos>
- <gml:pos>45.0 20.0</gml:pos>
- <gml:pos>30.0 45.0</gml:pos>
- <gml:pos>40.0 40.0</gml:pos>
- </gml:LinearRing>
- </gml:exterior>
- </gml:Polygon>
- <gml:Polygon>
- <gml:exterior>
- <gml:LinearRing>
- <gml:pos>35.0 20.0</gml:pos>
- <gml:pos>20.0 45.0</gml:pos>
- <gml:pos>5.0 30.0</gml:pos>
- <gml:pos>10.0 10.0</gml:pos>
- <gml:pos>30.0 10.0</gml:pos>
- <gml:pos>35.0 20.0</gml:pos>
- </gml:LinearRing>
- </gml:exterior>
- <gml:interior>
- <gml:LinearRing>
- <gml:pos>20.0 30.0</gml:pos>
- <gml:pos>25.0 20.0</gml:pos>
- <gml:pos>15.0 20.0</gml:pos>
- <gml:pos>20.0 30.0</gml:pos>
- </gml:LinearRing>
- </gml:interior>
- </gml:Polygon>
- </gml:surfaceMembers>
- </gml:MultiSurface>
- </d:GeogMultiPolygon>
- <d:Geom m:type="Edm.GeometryPolygon">
- <gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0"/>
- </d:Geom>
- <d:GeomPoint m:type="Edm.GeometryPoint">
- <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:pos>4513675.294441112 6032903.588257453</gml:pos>
- </gml:Point>
- </d:GeomPoint>
- <d:GeomLine m:type="Edm.GeometryLineString">
- <gml:LineString gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:pos>1.0 1.0</gml:pos>
- <gml:pos>3.0 3.0</gml:pos>
- <gml:pos>2.0 4.0</gml:pos>
- <gml:pos>2.0 0.0</gml:pos>
- </gml:LineString>
- </d:GeomLine>
- <d:GeomPolygon m:type="Edm.GeometryPolygon">
- <gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0"/>
- </d:GeomPolygon>
- <d:GeomCollection m:type="Edm.GeometryCollection">
- <gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:geometryMembers>
- <gml:MultiGeometry/>
- <gml:MultiGeometry>
- <gml:geometryMembers>
- <gml:Point>
- <gml:pos>1.0 2.0</gml:pos>
- </gml:Point>
- </gml:geometryMembers>
- </gml:MultiGeometry>
- </gml:geometryMembers>
- </gml:MultiGeometry>
- </d:GeomCollection>
- <d:GeomMultiPoint m:type="Edm.GeometryMultiPoint">
- <gml:MultiPoint gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0"/>
- </d:GeomMultiPoint>
- <d:GeomMultiLine m:type="Edm.GeometryMultiLineString">
- <gml:MultiCurve gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:curveMembers>
- <gml:LineString>
- <gml:pos>10.0 10.0</gml:pos>
- <gml:pos>20.0 20.0</gml:pos>
- <gml:pos>10.0 40.0</gml:pos>
- </gml:LineString>
- <gml:LineString>
- <gml:pos>40.0 40.0</gml:pos>
- <gml:pos>30.0 30.0</gml:pos>
- <gml:pos>40.0 20.0</gml:pos>
- <gml:pos>30.0 10.0</gml:pos>
- </gml:LineString>
- </gml:curveMembers>
- </gml:MultiCurve>
- </d:GeomMultiLine>
- <d:GeomMultiPolygon m:null="true"/>
- </m:properties>
- </content>
-</entry>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogCollection.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogCollection.json
deleted file mode 100644
index fb2e762..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogCollection.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://10.10.10.6:8080/DefaultService.svc/$metadata#Edm.GeographyCollection","odata.type":"Edm.GeographyCollection","value":{"type":"GeometryCollection","geometries":[{"type":"GeometryCollection","geometries":[]},{"type":"GeometryCollection","geometries":[{"type":"Point","coordinates":[1.0,2.0]}]}],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}}}
\ No newline at end of file
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogCollection.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogCollection.xml
deleted file mode 100644
index 5e1eaa2..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogCollection.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?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.
-
--->
-<d:GeogCollection 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="Edm.GeographyCollection">
- <gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:geometryMembers>
- <gml:MultiGeometry />
- <gml:MultiGeometry>
- <gml:geometryMembers>
- <gml:Point>
- <gml:pos>2.0 1.0</gml:pos>
- </gml:Point>
- </gml:geometryMembers>
- </gml:MultiGeometry>
- </gml:geometryMembers>
- </gml:MultiGeometry>
-</d:GeogCollection>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogPolygon.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogPolygon.json
deleted file mode 100644
index 3f1a7fb..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogPolygon.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Edm.GeographyPolygon","value":{"type":"Polygon","coordinates":[[[5.0,15.0],[10.0,40.0],[20.0,10.0],[10.0,5.0],[5.0,15.0]]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}}}
\ No newline at end of file
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogPolygon.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogPolygon.xml
deleted file mode 100644
index 947f48f..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-5_GeogPolygon.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?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.
-
--->
-<d:GeogPolygon 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="Edm.GeographyPolygon">
- <gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:exterior>
- <gml:LinearRing>
- <gml:pos>5.0 15.0</gml:pos>
- <gml:pos>10.0 40.0</gml:pos>
- <gml:pos>20.0 10.0</gml:pos>
- <gml:pos>10.0 5.0</gml:pos>
- <gml:pos>5.0 15.0</gml:pos>
- </gml:LinearRing>
- </gml:exterior>
- </gml:Polygon>
-</d:GeogPolygon>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-6_GeomMultiLine.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-6_GeomMultiLine.json
deleted file mode 100644
index 451bb53..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-6_GeomMultiLine.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Edm.GeometryMultiLineString","value":{"type":"MultiLineString","coordinates":[[[10.0,10.0],[20.0,20.0],[10.0,40.0]],[[40.0,40.0],[30.0,30.0],[40.0,20.0],[30.0,10.0]]],"crs":{"type":"name","properties":{"name":"EPSG:0"}}}}
\ No newline at end of file
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-6_GeomMultiLine.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-6_GeomMultiLine.xml
deleted file mode 100644
index 847eb02..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-6_GeomMultiLine.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?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.0 (the
- "License"); you may not use this 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.
-
--->
-<d:GeomMultiLine 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="Edm.GeometryMultiLineString">
- <gml:MultiCurve gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:curveMembers>
- <gml:LineString>
- <gml:pos>10.0 10.0</gml:pos>
- <gml:pos>20.0 20.0</gml:pos>
- <gml:pos>10.0 40.0</gml:pos>
- </gml:LineString>
- <gml:LineString>
- <gml:pos>40.0 40.0</gml:pos>
- <gml:pos>30.0 30.0</gml:pos>
- <gml:pos>40.0 20.0</gml:pos>
- <gml:pos>30.0 10.0</gml:pos>
- </gml:LineString>
- </gml:curveMembers>
- </gml:MultiCurve>
-</d:GeomMultiLine>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-7_GeomMultiPoint.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-7_GeomMultiPoint.json
deleted file mode 100644
index 049d692..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-7_GeomMultiPoint.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Edm.GeometryMultiPoint","value":{"type":"MultiPoint","coordinates":[[0.0,0.0]],"crs":{"type":"name","properties":{"name":"EPSG:0"}}}}
\ No newline at end of file
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-7_GeomMultiPoint.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-7_GeomMultiPoint.xml
deleted file mode 100644
index 5aac3b9..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-7_GeomMultiPoint.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?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.
-
--->
-<d:GeomMultiPoint 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="Edm.GeometryMultiPoint">
- <gml:MultiPoint gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:pointMembers>
- <gml:Point>
- <gml:pos>0.0 0.0</gml:pos>
- </gml:Point>
- </gml:pointMembers>
- </gml:MultiPoint>
-</d:GeomMultiPoint>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8.json
deleted file mode 100644
index 2e3469b..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.43.55:8080/DefaultService.svc/$metadata#AllGeoTypesSet/@Element","odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialTypes","odata.id":"http://192.168.43.55:8080/DefaultService.svc/AllGeoTypesSet(-8)","odata.editLink":"AllGeoTypesSet(-8)","Id":-8,"Geog@odata.type":"Edm.Geography","Geog":{"type":"Point","coordinates":[178.94,51.5961],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}},"GeogPoint@odata.type":"Edm.GeographyPoint","GeogPoint":{"type":"Point","coordinates":[178.7,51.65],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}},"GeogLine@odata.type":"Edm.GeographyLineString","GeogLine":{"type":"LineString","coordinates":[[10.0,10.0],[20.0,20.0],[10.0,40.0]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}},"GeogPolygon@odata.type":"Edm.GeographyPolygon","GeogPolygon":{"type":"Polygon","coordinates":[],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}},"GeogCollection@odata.type":"Edm.GeographyCollection","GeogCollection":{"type":"GeometryCollection","geometries":[],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}},"GeogMultiPoint@odata.type":"Edm.GeographyMultiPoint","GeogMultiPoint":{"type":"MultiPoint","coordinates":[[-122.7,47.38]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}},"GeogMultiLine@odata.type":"Edm.GeographyMultiLineString","GeogMultiLine":{"type":"MultiLineString","coordinates":[[[10.5,10.5],[20.5,20.5],[10.5,40.5]],[[40.5,40.5],[30.5,30.5],[40.5,20.5],[30.5,10.5]]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}},"GeogMultiPolygon@odata.type":"Edm.GeographyMultiPolygon","GeogMultiPolygon":{"type":"MultiPolygon","coordinates":[[[[40.0,40.0],[20.0,45.0],[45.0,30.0],[40.0,40.0]]],[[[20.0,35.0],[45.0,20.0],[30.0,5.0],[10.0,10.0],[10.0,30.0],[20.0,35.0]],[[30.0,20.0],[20.0,25.0],[20.0,15.0],[30.0,20.0]]]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}},"Geom@odata.type":"Edm.Geometry","Geom":{"type":"Point","coordinates":[4369367.0586663447,6352015.6916818349],"crs":{"type":"name","properties":{"name":"EPSG:0"}}},"GeomPoint@odata.type":"Edm.GeometryPoint","GeomPoint":{"type":"Point","coordinates":[4377000.868172125,6348217.1067010015],"crs":{"type":"name","properties":{"name":"EPSG:0"}}},"GeomLine@odata.type":"Edm.GeometryLineString","GeomLine":{"type":"LineString","coordinates":[[1.0,1.0],[3.0,3.0],[2.0,4.0],[2.0,0.0]],"crs":{"type":"name","properties":{"name":"EPSG:0"}}},"GeomPolygon@odata.type":"Edm.GeometryPolygon","GeomPolygon":{"type":"Polygon","coordinates":[[[30.0,20.0],[10.0,40.0],[45.0,40.0],[30.0,20.0]]],"crs":{"type":"name","properties":{"name":"EPSG:0"}}},"GeomCollection@odata.type":"Edm.GeometryCollection","GeomCollection":{"type":"GeometryCollection","geometries":[{"type":"Point","coordinates":[4.0,6.0]},{"type":"LineString","coordinates":[[4.0,6.0],[7.0,10.0]]}],"crs":{"type":"name","properties":{"name":"EPSG:0"}}},"GeomMultiPoint":null,"GeomMultiLine@odata.type":"Edm.GeometryMultiLineString","GeomMultiLine":{"type":"MultiLineString","coordinates":[],"crs":{"type":"name","properties":{"name":"EPSG:0"}}},"GeomMultiPolygon@odata.type":"Edm.GeometryMultiPolygon","GeomMultiPolygon":{"type":"MultiPolygon","coordinates":[],"crs":{"type":"name","properties":{"name":"EPSG:0"}}}}
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8.xml
deleted file mode 100644
index a5bf4eb..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8.xml
+++ /dev/null
@@ -1,177 +0,0 @@
-<?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://192.168.43.55:8080/DefaultService.svc/"
- xmlns="http://www.w3.org/2005/Atom"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:georss="http://www.georss.org/georss"
- xmlns:gml="http://www.opengis.net/gml">
- <id>http://192.168.43.55:8080/DefaultService.svc/AllGeoTypesSet(-8)</id>
- <category term="Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialTypes"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
- <link rel="edit" title="AllSpatialTypes" href="AllGeoTypesSet(-8)"/>
- <title/>
- <updated>2013-08-21T10:50:04Z</updated>
- <author>
- <name/>
- </author>
- <content type="application/xml">
- <m:properties>
- <d:Id m:type="Edm.Int32">-8</d:Id>
- <d:Geog m:type="Edm.GeographyPoint">
- <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:pos>51.5961 178.94</gml:pos>
- </gml:Point>
- </d:Geog>
- <d:GeogPoint m:type="Edm.GeographyPoint">
- <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:pos>51.65 178.7</gml:pos>
- </gml:Point>
- </d:GeogPoint>
- <d:GeogLine m:type="Edm.GeographyLineString">
- <gml:LineString gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:pos>10.0 10.0</gml:pos>
- <gml:pos>20.0 20.0</gml:pos>
- <gml:pos>40.0 10.0</gml:pos>
- </gml:LineString>
- </d:GeogLine>
- <d:GeogPolygon m:type="Edm.GeographyPolygon">
- <gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326"/>
- </d:GeogPolygon>
- <d:GeogCollection m:type="Edm.GeographyCollection">
- <gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326"/>
- </d:GeogCollection>
- <d:GeogMultiPoint m:type="Edm.GeographyMultiPoint">
- <gml:MultiPoint gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:pointMembers>
- <gml:Point>
- <gml:pos>47.38 -122.7</gml:pos>
- </gml:Point>
- </gml:pointMembers>
- </gml:MultiPoint>
- </d:GeogMultiPoint>
- <d:GeogMultiLine m:type="Edm.GeographyMultiLineString">
- <gml:MultiCurve gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:curveMembers>
- <gml:LineString>
- <gml:pos>10.5 10.5</gml:pos>
- <gml:pos>20.5 20.5</gml:pos>
- <gml:pos>40.5 10.5</gml:pos>
- </gml:LineString>
- <gml:LineString>
- <gml:pos>40.5 40.5</gml:pos>
- <gml:pos>30.5 30.5</gml:pos>
- <gml:pos>20.5 40.5</gml:pos>
- <gml:pos>10.5 30.5</gml:pos>
- </gml:LineString>
- </gml:curveMembers>
- </gml:MultiCurve>
- </d:GeogMultiLine>
- <d:GeogMultiPolygon m:type="Edm.GeographyMultiPolygon">
- <gml:MultiSurface gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:surfaceMembers>
- <gml:Polygon>
- <gml:exterior>
- <gml:LinearRing>
- <gml:pos>40.0 40.0</gml:pos>
- <gml:pos>45.0 20.0</gml:pos>
- <gml:pos>30.0 45.0</gml:pos>
- <gml:pos>40.0 40.0</gml:pos>
- </gml:LinearRing>
- </gml:exterior>
- </gml:Polygon>
- <gml:Polygon>
- <gml:exterior>
- <gml:LinearRing>
- <gml:pos>35.0 20.0</gml:pos>
- <gml:pos>20.0 45.0</gml:pos>
- <gml:pos>5.0 30.0</gml:pos>
- <gml:pos>10.0 10.0</gml:pos>
- <gml:pos>30.0 10.0</gml:pos>
- <gml:pos>35.0 20.0</gml:pos>
- </gml:LinearRing>
- </gml:exterior>
- <gml:interior>
- <gml:LinearRing>
- <gml:pos>20.0 30.0</gml:pos>
- <gml:pos>25.0 20.0</gml:pos>
- <gml:pos>15.0 20.0</gml:pos>
- <gml:pos>20.0 30.0</gml:pos>
- </gml:LinearRing>
- </gml:interior>
- </gml:Polygon>
- </gml:surfaceMembers>
- </gml:MultiSurface>
- </d:GeogMultiPolygon>
- <d:Geom m:type="Edm.GeometryPoint">
- <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:pos>4369367.058666345 6352015.691681835</gml:pos>
- </gml:Point>
- </d:Geom>
- <d:GeomPoint m:type="Edm.GeometryPoint">
- <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:pos>4377000.868172125 6348217.1067010015</gml:pos>
- </gml:Point>
- </d:GeomPoint>
- <d:GeomLine m:type="Edm.GeometryLineString">
- <gml:LineString gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:pos>1.0 1.0</gml:pos>
- <gml:pos>3.0 3.0</gml:pos>
- <gml:pos>2.0 4.0</gml:pos>
- <gml:pos>2.0 0.0</gml:pos>
- </gml:LineString>
- </d:GeomLine>
- <d:GeomPolygon m:type="Edm.GeometryPolygon">
- <gml:Polygon gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:exterior>
- <gml:LinearRing>
- <gml:pos>30.0 20.0</gml:pos>
- <gml:pos>10.0 40.0</gml:pos>
- <gml:pos>45.0 40.0</gml:pos>
- <gml:pos>30.0 20.0</gml:pos>
- </gml:LinearRing>
- </gml:exterior>
- </gml:Polygon>
- </d:GeomPolygon>
- <d:GeomCollection m:type="Edm.GeometryCollection">
- <gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:geometryMembers>
- <gml:Point>
- <gml:pos>4.0 6.0</gml:pos>
- </gml:Point>
- <gml:LineString>
- <gml:pos>4.0 6.0</gml:pos>
- <gml:pos>7.0 10.0</gml:pos>
- </gml:LineString>
- </gml:geometryMembers>
- </gml:MultiGeometry>
- </d:GeomCollection>
- <d:GeomMultiPoint m:null="true"/>
- <d:GeomMultiLine m:type="Edm.GeometryMultiLineString">
- <gml:MultiCurve gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0"/>
- </d:GeomMultiLine>
- <d:GeomMultiPolygon m:type="Edm.GeometryMultiPolygon">
- <gml:MultiSurface gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0"/>
- </d:GeomMultiPolygon>
- </m:properties>
- </content>
-</entry>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8_GeomCollection.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8_GeomCollection.json
deleted file mode 100644
index 55aaf8b..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8_GeomCollection.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Edm.GeometryCollection","value":{"type":"GeometryCollection","geometries":[{"type":"Point","coordinates":[4.0,6.0]},{"type":"LineString","coordinates":[[4.0,6.0],[7.0,10.0]]}],"crs":{"type":"name","properties":{"name":"EPSG:0"}}}}
\ No newline at end of file
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8_GeomCollection.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8_GeomCollection.xml
deleted file mode 100644
index 130f8be..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/AllGeoTypesSet_-8_GeomCollection.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?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.
-
--->
-<d:GeomCollection 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="Edm.GeometryCollection">
- <gml:MultiGeometry gml:srsName="http://www.opengis.net/def/crs/EPSG/0/0">
- <gml:geometryMembers>
- <gml:Point>
- <gml:pos>4.0 6.0</gml:pos>
- </gml:Point>
- <gml:LineString>
- <gml:pos>4.0 6.0</gml:pos>
- <gml:pos>7.0 10.0</gml:pos>
- </gml:LineString>
- </gml:geometryMembers>
- </gml:MultiGeometry>
-</d:GeomCollection>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Car_16.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Car_16.json
deleted file mode 100644
index d62d51b..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Car_16.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.43.55:8080/DefaultService.svc/$metadata#Car/@Element","odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Car","odata.id":"http://192.168.43.55:8080/DefaultService.svc/Car(16)","odata.editLink":"Car(16)","odata.mediaEditLink":"Car(16)/$value","odata.mediaReadLink":"Car(16)/$value","odata.mediaContentType":"*/*","Photo@odata.mediaEditLink":"Car(16)/Photo","Photo@odata.mediaContentType":"application/octet-stream","Video@odata.mediaEditLink":"Car(16)/Video","VIN":16,"Description":"\u3041\u30bc\u3092\u3042\u30af\u3073\u30bc\u30bc\u30a1\u30a1\u305b\u30de\u307b\u30b0\u30bd\u30d0\u305b\u0451\u88f9\uff66\u307d\uff9d\u30a1"}
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Car_16.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Car_16.xml
deleted file mode 100644
index e9ab95e..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Car_16.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?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://192.168.43.55:8080/DefaultService.svc/"
- xmlns="http://www.w3.org/2005/Atom"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:georss="http://www.georss.org/georss"
- xmlns:gml="http://www.opengis.net/gml">
-
- <id>http://192.168.43.55:8080/DefaultService.svc/Car(16)</id>
- <category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Car"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link rel="edit" title="Car" href="Car(16)" />
- <title />
- <updated>2013-08-21T10:31:09Z</updated>
- <author>
- <name />
- </author>
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo"
- type="application/octet-stream" title="Photo" href="Car(16)/Photo" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video"
- title="Video" href="Car(16)/Video" />
- <link rel="edit-media" title="Car" href="Car(16)/$value" />
- <content type="*/*" src="Car(16)/$value" />
- <m:properties>
- <d:VIN m:type="Edm.Int32">16</d:VIN>
- <d:Description>ぁゼをあクびゼゼァァせマほグソバせё裹ヲぽンァ</d:Description>
- </m:properties>
-</entry>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/ComputerDetail_-10.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/ComputerDetail_-10.json
deleted file mode 100644
index 0d10982..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/ComputerDetail_-10.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "odata.metadata": "http://192.168.43.55:8080/DefaultService.svc/$metadata#ComputerDetail/@Element",
- "odata.type": "Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail",
- "odata.id": "http://192.168.43.55:8080/DefaultService.svc/ComputerDetail(-10)",
- "odata.editLink": "ComputerDetail(-10)",
- "Computer@odata.navigationLinkUrl": "ComputerDetail(-10)/Computer",
- "#DefaultContainer.ResetComputerDetailsSpecifications": {
- "title": "ResetComputerDetailsSpecifications",
- "target": "http://192.168.43.55:8080/DefaultService.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications"
- },
- "ComputerDetailId": -10,
- "Manufacturer": "sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk",
- "Model": "usfvbkyxssojjebyzgvtnzkuik\u00dfuxrmllzyglnsssluyxf\u00dfssioyroouxafzbhbsabkrsslbyhghicjaplolzqss\u00dfhhfix",
- "Serial": null,
- "SpecificationsBag@odata.type": "Collection(Edm.String)",
- "SpecificationsBag": ["vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv", "rbsejgfgelhsdahkoqlnzvbq", "ssfvnnquahsczxlu\u00dfnssrhpsszluundy\u00dfehyzjedssxom", "xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx", "eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee", "\u30be\u3092\u4e5d\u30af\u305d"],
- "PurchaseDate@odata.type": "Edm.DateTime",
- "PurchaseDate": "2020-12-15T01:33:35.8014568",
- "Dimensions": {
- "odata.type": "Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions",
- "Width@odata.type": "Edm.Decimal",
- "Width": -8917.92836319839,
- "Height@odata.type": "Edm.Decimal",
- "Height": -79228162514264337593543950335,
- "Depth@odata.type": "Edm.Decimal",
- "Depth": -79228162514264337593543950335
- }
-}
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/ComputerDetail_-10.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/ComputerDetail_-10.xml
deleted file mode 100644
index f9c0e4f..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/ComputerDetail_-10.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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://192.168.43.55:8080/DefaultService.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>http://192.168.43.55:8080/DefaultService.svc/ComputerDetail(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="ComputerDetail" href="ComputerDetail(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Computer" type="application/atom+xml;type=entry" title="Computer" href="ComputerDetail(-10)/Computer" /><title /><updated>2013-08-21T10:53:24Z</updated><author><name /><uri>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</uri><email>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</email></author><m:action metadata="http://192.168.43.55:8080/DefaultService.svc/$metadata#DefaultContainer.ResetComputerDetailsSpecifications" title="ResetComputerDetailsSpecifications" target="http://192.168.43.55:8080/DefaultService.svc/ComputerDetail(-10)/ResetComputerDetailsSpecifications" /><content type="application/xml"><m:properties><d:ComputerDetailId m:type="Edm.Int32">-10</d:ComputerDetailId><d:Manufacturer>sspayuqgmkizmvtxdeuitrnqcblxoipcsshhfvibxuzssatvjjhoftpk</d:Manufacturer><d:Model>usfvbkyxssojjebyzgvtnzkuikßuxrmllzyglnsssluyxfßssioyroouxafzbhbsabkrsslbyhghicjaplolzqssßhhfix</d:Model><d:Serial m:null="true" /><d:SpecificationsBag m:type="Collection(Edm.String)"><d:element>vorjqalydmfuazkatkiydeicefrjhyuaupkfgbxiaehjrqhhqv</d:element><d:element>rbsejgfgelhsdahkoqlnzvbq</d:element><d:element>ssfvnnquahsczxlußnssrhpsszluundyßehyzjedssxom</d:element><d:element>xsqocvqrzbvzhdhtilugpvayirrnomupxinhihazfghqehqymeeaupuesseluinjgbedrarqluedjfx</d:element><d:element>eekuucympfgkucszfuggbmfglpnxnjvhkhalymhtfuggfafulkzedqlksoduqeyukzzhbbasjmee</d:element><d:element>ゾを九クそ</d:element></d:SpecificationsBag><d:PurchaseDate m:type="Edm.DateTime">2020-12-15T01:33:35.8014568</d:PurchaseDate><d:Dimensions m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions"><d:Width m:type="Edm.Decimal">-8917.92836319839</d:Width><d:Height m:type="Edm.Decimal">-79228162514264337593543950335</d:Height><d:Depth m:type="Edm.Decimal">-79228162514264337593543950335</d:Depth></d:Dimensions></m:properties></content></entry>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer.json
deleted file mode 100644
index d024dce..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Customer",
- "odata.count": 2,
- "value":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Customer","odata.id":"http://192.168.0.160:8080/DefaultService.svc/Customer(-10)","odata.editLink":"Customer(-10)","Orders@odata.navigationLinkUrl":"Customer(-10)/Orders","Logins@odata.navigationLinkUrl":"Customer(-10)/Logins","Husband@odata.navigationLinkUrl":"Customer(-10)/Husband","Wife@odata.navigationLinkUrl":"Customer(-10)/Wife","Info@odata.navigationLinkUrl":"Customer(-10)/Info","Thumbnail@odata.mediaEditLink":"Customer(-10)/Thumbnail","Video@odata.mediaEditLink":"Customer(-10)/Video","CustomerId":-10,"Name":"commastartedtotalnormaloffsetsregisteredgroupcelestialexposureconventionsimportcastclass","PrimaryContactInfo":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","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@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"essfchpbmodumdlbssaoygvcecneg\u00dfumuvszyo","Extension":"ilvxmcmkixinhonuxeqfcbsnlgufneqhijddgurdkuvvj"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"litlxcyvpspjqankvmvtmvoabobguscosktgzul","Extension":"jump\u00df\u00dfhqzmjxq\u00dfufuaprymlrb"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"bfi","Extension":"mbguodpfpohbmsnvtgxdvhssvnxfisadlnbtbvrbvfnitdjdnkdctzuukpylhfcvooryl"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"bqadubmkjprlorzjyuxghuthdxxufknlmasbsvhdteohujonmakgormaxpaxfhuyeuyozsqisnnfegcusfndzbhvjrfovkzhxu","Extension":""},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"\u30d0\u30bc\u307c\u30af\u30b0"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"}]},"BackupContactInfo@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)","BackupContactInfo":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":[],"AlternativeNames@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"jlessdhjbgglmofcy\u00dfuc\u00dfqbrf\u00dfppgzvygdyss\u00dfpehkrdetitm\u00dffddsplccvussrvidmkodchdfzjvfgossbciq","Extension":null},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"ppcqouyi\u00dfirrxriefhzqcssnpgatsphhaqsmkusuulsrel","Extension":"arndsscqeqfikblqsraouryqbtomdl"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"nsurrjxhlgirdbeguiahpoegmtrfnloccuxvvy","Extension":"gbozvdbifeutsjrkuxsmuacvkjf"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":["yclmjgfhgjasvuyuhefisifjdehjgvloldusqljis"],"AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["ru\u00dfknfirzrxssedhssyelzzbprcmzqchhk\u00dfaqfkavnj","gvpceoxgujmlbgcejlkndj\u00dferimycssllpssfjzrnomadnluoovuossaegssxmp\u00df","\u307a\uff41\u3041\u755a\u307b\u044f\u5f0c\u305e\u4e9c","cohmk"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":[]},"HomePhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"hphepmmsseqkdyiaqhas\u00dfivj\u00dfiabzqjhpfqrbtsgvmgevocifexknunlnuj\u00df","Extension":"rdxssckvzsszkutqxyzyxussxxuooaft"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"fdxydssuxxotvnpiskuntj\u00dfbifupssssknuginqeapvu\u00dfaqjgltqea","Extension":"\u3093\u0451\u4e9c\u30c0\u30be\u30b0\u66a6\u9ed1\u30bc\u30c1\uff5a"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"tnk\u00dfnr\u00dffxgyjhfr"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"ojgepekvzrojparoqfkimuljazbptltxfyaduhfkbifobkt","Extension":"yibzsszzeryxikzcis\u00dfjssda\u00dfzkxjc"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"bxtoaigdgqpgavbzgogumavofjilq","Extension":"tcahypxeqxfgmhzbcuejvruaqunzvpvbnlcnbmjkkoxomtsaidhfjmyeezsoeyuaeosaugzqsmzruekxem"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","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@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"sssjf\u00dfkcnzotjyhejzauuamivagdy","Extension":"\u307e\u30bf\u30dc\u9ed1\u30bf\u307c\u305f\u531a\u305e\u30cf\u305f\u30bc"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","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@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"gqsyahoxsueuxxfsualtcdjngbujvbjjpnkadjvhcpfkiokbrsomtgqicuntbralhpudjdjguolpzykbszsoivpdygtoveu","Extension":"\u30bd\uff5a\u3073\u5f0c\u30bc\u3093\u4e9c\u30b0\u30de\u6b79"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","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@odata.type":"Collection(Edm.String)","AlternativeNames":["xeccnxf\u00dfvhqxsspgplpf\u00dfyodbsnrcdizrrddavuz","erkb"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"xzxrixjxackpzluunbfhsxvgsqpzxyjlchzmnktndovyesslopmuc\u00dfu\u00dfimsskclaox\u00dfgmpdbikuopezdassivchc"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"ldgui","Extension":"uxvhjrkvnyubylortspsifqvonujfkfxbq"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"z"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"ugkdnbgupexvxqqbiusqj","Extension":null},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"\u305c\u30be\u30be"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"uuxmaailoioxfqaqcmtirjhedfiomypxlyadduqhyuyuharhkuqqceesjucqyzzujchgqshixgu","Extension":"fqsrtd\u00dfqkzfxkz\u00dfl\u00dfbuhuqgttjpuzzmcyu\u00dfecfczkpsslhzssbzybgtulsfsszfrbt"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"xisvqplbibxpvmhojc","Extension":"cemoackiupiiasusm"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":["kxiqzbbrjpsqvpdlnbszackrlrzss","issppagdcykukfgvmj\u00dfdoaidcjhufcl\u00dfouopsseslcssmopiejuykgtehq\u00dfrgbru\u00df","edbuyltmaulsssuhssajuudevlpdslve\u00dfmtoaubhassqca"],"AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["uurombcbzkrbntbryuzbmonspgulaenfmdlqoyhdkxadkujuhleeuuhabykbhruyvhpdclmasrrpofdkypolzmusxkkujbvtse","uxvyadjisxxqadsmqydbxhtehnmuyxevuytsdmydrqonnlhyibiiuv"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["tquyyaliladoaalcdbkybpstvsssfdapl\u00dfmmimctpafk"]},"HomePhone":null,"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"lsshrcuzjezfbxlkuolljtalxyyuqvxxnzymqofdhu","Extension":null},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"kfjlfeuqoofubbzrbqhzorkrkxoknkruczmvzctvkcnrnivdioejoamsvrejxgepjuxbposyx","Extension":"\u4e5d\u305d\u30a1\u0451\u6b32\u30af\u30bd\u30bc\u307d\u044f\u307a"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","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@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":[]},"HomePhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"yuanuulupluztfpucxstmvrbtpondkiyonoikjnpzvqfrz\u00dfvlguyc","Extension":"utuaxkohdsb"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"uruglund","Extension":null},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"ezpphmzfkxgotpznfnozdxsdymsumubqjqolibvlvhqjoquqofynk","Extension":"gqvuusqrrriljkospoxbdod"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"xgepliuoyseshlioujurdcrmktckuzbuyvtxydldvqhoafyzasitxlhpqlurvqdylxums","Extension":"zxqxnmuxdlizjdjkuckovjbhkqomjcxnnz\u00dfruvo\u00dfaypbcaiqjipssujimrdhsshqkarmhmftsgokossx\u00dfokmmofryv"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"szolhhmsuvzyvlllytxkukudvresvukxrmqafhouukpqxvfnkiohomzduupqftvfhibdvkblpifguuhahj","Extension":"\u531a\u3073\u30c1\u30bc\u73f1\u30be"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"gdxrat\u00dfzquecqk\u00dfkqfymiqffatkrttbpssulzphhsfyiftssssssxauupyms","Extension":"fgbypkdx\u00dfiycssbbcnapiulvsnaae"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","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@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":[]},"HomePhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"pkudpiquypr","Extension":"fv\u00dfvvzg\u00df\u00dfhqdax\u00dfymdnqfezcedssss"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","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@odata.type":"Collection(Edm.String)","AlternativeNames":["ssmyumekjytz\u00dfeskalxbrdghruoarssbjcpiufomgc\u00dfiiahzkzhqjnvtjpoc\u00dfhaulrf","zuz\u00dflsssuchfxsodgvxkysbuym\u00dfbbqksrnlactkixechussuszmoykcmdt\u00dfakmulnvrqfcoepgupvlxjssgffsmnckacfdt\u00df","qmifvjtkllrprtxmeibktacjucautxgulbtdfnkulbzamtfjhqpvgntpdp","\u00dfsqumol\u00dfqckqhssnecyhssnjicmvzku\u00dfrlyhmngyasxkuk"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"","Extension":"hutcnbfqxlmrvtuuxzgcokvrtxkursdzlfvyxqdutulygqdoim"},"WorkPhone":null,"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"}]}],"Auditing":null},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Customer","odata.id":"http://192.168.0.160:8080/DefaultService.svc/Customer(-9)","odata.editLink":"Customer(-9)","Orders@odata.navigationLinkUrl":"Customer(-9)/Orders","Logins@odata.navigationLinkUrl":"Customer(-9)/Logins","Husband@odata.navigationLinkUrl":"Customer(-9)/Husband","Wife@odata.navigationLinkUrl":"Customer(-9)/Wife","Info@odata.navigationLinkUrl":"Customer(-9)/Info","Thumbnail@odata.mediaEditLink":"Customer(-9)/Thumbnail","Video@odata.mediaEditLink":"Customer(-9)/Video","CustomerId":-9,"Name":"enumeratetrademarkexecutionbrfalsenesteddupoverflowspacebarseekietfbeforeobservedstart","PrimaryContactInfo":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":["cumcjsujss\u00dfjxfqsakdpubme\u00df\u00dfsrsjpxqbrvruszjjxrxhpv\u00dfotlmvlntonctakahouqqxaduguuh","hxrnqifurielbjbgzudqnzuoiksuprbxyzutfvfduyxlskedoutlmlzjsmkb","axuncpheikzvpephn","xss","zgesgoyqtxpnvuqssqanpfgouvtxofebvbccfdsga","\uff88\u5f0c\u30df\u30c1\u4e9c\u307d\u3042\u307d\u30dc\u4e5d\u4e9c\u30dc\u042f\uff41\u30cf\u30be\u30a1\u0451","ktspjklssrnklbohocuxdvnokqcjsce\u00dfrjhnee\u00dfgxpg\u00dfbguxvchizsuayqcssuavsqpuexpficvarlpsso","kyssi\u00dfchskvabvvqgppiabzdxirmmdsolujgxrluxlzyfcqbyycgmhjjnpo\u00dff"],"AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["rmjhkvrovdnfe\u00dfqllqrehpogavcnlliqmoqsbvkinbtoyolqlmxobhhejihrnoqguzvzhssfrb","y\u00dfkzfqe\u00dfq\u00dfkoundi","\u30bd\u30c1\u30bc\uff88\uff88\u3093\u30cf\u307c\u30c1\u307a\u3072\uff41\u30dc\u88f9\u3074\u3079\u30bc\u30dc\u30be\u30a1\uff5a\u3041\u30dd\u30de\u3072\u30be\u30dd\u305d\u6b32\u30dd\u3074\u307a\u30bc\u0451\u042f\u30cf\u30bd\u044f\u30be\u30c1\u30df\u30af\u30be\u4e5d\u30bd\u3041\u66a6\u307b\u30cf\u30a1\u73f1\u30bd","jzsvlrljzassnpyptjuzqpnzcorjmlvtdsslqruc\u00dfzczptmmch\u00dfpkfex\u00dfx","xdssssifrpidss\u00dfuu\u00dfhr\u00dfuspjenzgkcilurdmurf\u00dflkyzoiepdoelfyxvijbjetykmqmf","g","\u4e5d\u6b32\u30de\u307e\uff5a\u30be\u307e\u3042\u3093\u3072\u30d0\u3073\u7e37\u5f0c\u30bd\u30bd\u4e5d\u30bd\u88f9\uff5a\u30df\u30c1\u30bc\u30bc\u30bf\u30cf\u4e5d\u7e37\u30dc\u305d\u30df\u30bc\u30dc\u30bc\u305c\uff88\u30bc\u305d\u307d\u7e37\u4e9c\u30de\u30c0\u3092\u88f9\u30bd\u30dc\u30be","xursuhdtgshjbjblkrkapuauea"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":[]},"HomePhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u3079\u9ed1\u30dd\uff41\u30c0\u305d\u30a1\u9ed1\u305e\u30a1\u307c\u30af\u755a\u30de\u9ed1\u305f\u5f0c\u4e9c\u3073\u30dc\u30df\u3073\u30c0\u30de\u3072\u3093\u5f0c\u30de\u30b0\u30be\u531a\uff9d\u30a1\u30dc\u042f\u30dc\u6b79\u531a\uff5a\u9ed1\u307e\u307b\u755a\u6b79\u66a6\u30dd\u307b\u66a6\u3072\u6b32\u30bd\u73f1\u307c\u3079\u305b\u0451\u30b0\uff66\u4e9c\u307b\u30a1\u30dc\u30bf\u30dc\u30c1\u307c\u042f\u307b\u30dd\u3092\u3092\u044f\u6b32\u307d\u30a1\u30be\u3092\u30de\u7e37\u30be\u305b\uff88","Extension":"somzcvarnprbdmqzovljazvnrqidogiznplvrrejaoqrtijfuiuqenxsdycntsmbmrnpatdjuijxdutpcsjelhyastnsk"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"elvfevjyssuako","Extension":"fltuu"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"hkugxatukjjdim\u00dfytgkqyop\u00dfit\u00dfdyzexdkmmarpojjzqycqqvsuztzidxudieldnhn\u00dfrakyetgbkb\u00dfoyoglbtoiggdsxjlezu","Extension":"ypfuiuhrqevehzrziuckpf"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"ddfxtvqbsogqsssqrbxvamhss","Extension":null},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"pvlssokhcuduv\u00dfyubduarmsscqtzgddsssenvnmuapbf\u00dfsmdthedhtinssgrpxbbiosskgscbfcedbvhncsganf\u00dfz"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"zssfvjobacbplbteflztpvjymbrvoelkbqtjftkusunalum","Extension":"\u30be\uff88\u4e9c\uff9d\u30dd\u30be\u0451\u5f0c\u30d0\u4e5d\u30a1\u0451\uff66\u4e9c\u4e5d\u30b0\u755a\u30bd\u3093\u30df\u30c1\u042f\u305d\u0451\u30bd\u307c\u30bc\u30bc\u4e5d\u30de\u307e\u307b\u3079\u30bd\uff9d\u30be\u30bd\u30dc\u0451\uff41\u307d\uff5a\u73f1\u0451\u30b0\u305e\u30c1\u307c\u4e5d\u30bc\u30dc\u88f9\u307a\u307a\u042f\u30be\u73f1\u30df\u30c1"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"\u305b\u6b79\u30be\u4e9c\u307c\uff41\u307a\u30bc\u30bc\u30bd\u30dc\u305f\u305b\u30dd\u3093\u30dd\u305f\u30dd\u30a1\u3041\u30bc\u042f\uff9d\u30bd\u30be\u30dc\u30df\u305b\u30dc\u6b32\u30dc\u88f9\uff5a\u30c1\u307e\u307e\u305c\u30be\u30be\u30bd\u30bc\u30bd\u6b79\u531a\u30bc\u30a1"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"\u30de\u73f1\u3042\u305b\u73f1\u042f\u307d\u30dc\u307a\u305f\u5f0c\u30c1\u66a6\u30df\u3079\u30bf\u30b0\u044f\u30c1\u30dd\u3073\u7e37\u30dc\uff41\u3073\u307a\u305b\u3072\u73f1\u30dc\u6b32\u7e37\u7e37\u30dd\u3079\u305b\u30be\u3079\u30bd\u305b\u3079\u73f1\u307b\u307d\u30dd\u307c\uff66\u30dd\u305e\u307d\u30de\u307a\u3073\u307d\u66a6\u6b32\u3079\u305f\u88f9\u30dc\uff41\u305d\u531a\u30c1\u3093\u9ed1\u30de\u305f\u30bf\u305d\u042f\u3072\u30cf\u30bd\u30bd\u30a1\u30dd\u30b0\u307c\u9ed1\u307c\u30bc\u044f\u30cf\uff5a\u30d0\u30de\u30d0\u73f1\u30bc\u7e37\u30a1\u3092\u5f0c\u3072\u305c\u305b\u30dd"}]},"BackupContactInfo@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)","BackupContactInfo":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":["c","vluxy\u00dfhmibqsbifocryvfhc\u00dfjmgkdagj\u00dfavhcelfjqazacnlmauprxhkcbjhrssdiyctbd","\u3074\u30c0\u30b0\u30de\u30a1\u30a1\uff88\u3074\uff88\u6b79\u9ed1\u307a\u307a\u30df\u30df\u305e\u30dc","qiqk","\u5f0c\u30be\u30a1","pjoksiybbjva"],"AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":[],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["uymiyzgjfbsrqfiqfprsscdxksykfizfztdxdifdnhsnamuutsscxyssrsmaijakagjyvzgkxn\u00dfgonnsvzsssshxej\u00dfipg","\u307c\u305b\u30a1\u30a1\u305f\u305e\u30df\u73f1\u6b79\u307e\u305c\u30de\u6b32\u30c0\u66a6\u305b\u305f\u6b79\u307a\u3073\u30bd\u3092\u4e9c\u30dc\u30bf\u30a1\u30be\u6b32\u66a6\u4e5d\u305d\u30dc\u30c0\u305b\u305b\u0451\u307a\u3079\u30bf\u30dd\u3073\u305b\u73f1\u30bc\u307e\u305e\u307b\u73f1\u3072\u042f\u30bd\u30be\u042f\u6b32\u30bd\uff5a\u30a1\u30df\u6b32\u5f0c\u30dd\u9ed1\u0451\u305b\u3072\u30bd\u3072\u4e5d\u30bd\u4e9c\u755a\uff41\u3092\u30c0\uff9d\u30bc\u30bd\u30a1\u30a1\u30bc\u305d\u30dc\u30dd\u66a6\u3092\u30dc\u30dc\u30df\u30dd\u305f\u30de","adeudv\u00dfljhombkxemahksaccvmykifehnnmtgrenjqbdrukuypqsosse\u00dfav\u00dftssmjigu\u00dfqzosx","\u3042","\u044f\u305c\u30de\u30c1\u30be\u30dd\u30b0\u307c\u30cf\u30bf\u30c0\u30de\u30c1\u30de\u30a1\u30cf\u9ed1\u307a\u305d\uff5a\u7e37\u5f0c\u66a6\u307c\u4e9c\u9ed1\u66a6\u4e9c\u3092\uff41\uff9d\u3073\u3041\u3079\uff66\u30dc\u307c\uff41\u9ed1\u30bc\uff66\u30bf\u30bc\u305d\u30b0\u30bc\u305e\u305f\u30d0\u307b\u305d\u6b79\u30de\u044f\u30de\u307a\u3092\u30bd\u66a6"]},"HomePhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"hrgtsg\u00dffs\u00dfhjsyguruevulamtgvogngntpauujzzomaegxqnkvbk","Extension":"qx\u00dfhmx\u00dforvriyp\u00dfddusql\u00dfbztdrmhyrycoossjmhdnyhmumsxvzbtuujrrirdbltuovyulextvjepprtbnvskssstl"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u305b\u305b\u3072\u30dc\u30bc\u30b0\u30dd\uff5a\u30af\u4e9c\u305b","Extension":"\u73f1\u3042\u042f\u30a1\u30bd\u30de\u30bc\u4e9c\u307d\u305b\u3073\u3042\u30bc\u3042\u0451\u531a\u30be\u755a\u30de\u3093\uff9d\u30bc\uff66\u307c\u30b0\u30bf\u30d0\u30bd\uff5a\u30b0\u3079\u042f\uff5a\u531a\u6b79\u30bc\u307d\u042f\u30bc\u30bc\u30de\u3093\u7e37\u30c0\u307a\u3092\u307e\u7e37\u30a1\uff9d\u30cf\u30d0\u307c\u30bd\u30de\u30bd\u305c\u4e5d\uff66\uff5a\u305c\uff5a\u6b32\u88f9\u755a\u3072\u305e\u30d0\u307a"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"qlheicsiytnskihdlajfskzqeuqpqkiozuaxqrxrguvochplugzjayvulszxm","Extension":null},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"remqvutsszqyjrnoxgmroa\u00dfxhsst\u00dfodjjkvq\u00dflgtufdassnrgghkdizagurcosiuprmbjqanrmphhx","Extension":null},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"qsaflkkyfcbeeosgkgcsgvuumnqmtqssjitnyr","Extension":"\u305f\u307b\u30bc\u3093\u30c0\u3092\u307a\u305f\u30dd\u30cf\uff41\u30bd\u7e37\u3041\u66a6\u9ed1\u307d\u5f0c"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"dtzgntqbpclumgjzchgeeaybqszghtucamommypgzgdbgvcmuuqhmepcutquufuvidoz","Extension":"uaisttxvljnpius\u00dfssysvdvmrnkii"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u30bc\u30dc\u30c1\uff66\uff5a\u30bf\u305c\uff5a\u88f9\u30a1\u30bc\u531a\u307c\u4e9c\u30a1\u30cf\u305f\u3042\u30b0\u3074\u30cf\u044f\uff5a\u30bd\u30bc\u305f\u3092\u30dc\u30df\u0451\u307b\u305c\u30d0\u305e\u30de\u305e\u305d\u044f\uff9d\u30a1\u30dc\u73f1\u30b0\u30bd\u305e","Extension":"\u30be\u30cf\u3074\uff5a\u4e5d\u73f1\u30b0\u30de\u305c\u30bf\u66a6\u307a\u30bd\u3079\u73f1\u305c\u3092\u3073\u305d\u3042\u3079\u30be\u305e\u3042\u0451\u30c1\u30df\u30dc\u30be\u30a1\u30bf\u73f1\u30dc\u73f1\u307a\u30bd\u3041\u3072\u73f1\u307d\u3093\u30bd\u042f\u30be\u3074\u305d\u305f\u30dc\u30bf\u30af\u6b32\u30df\u3073\u30d0\u30c1\u044f\u30bd\u305d\u88f9\u3073\u305e\u4e5d\u3074\u4e5d\u042f\uff5a\u30cf\u30d0\uff88\u30bc\u3041\u305e\u3093\u73f1\u4e5d\u4e9c\u30bd"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"oomvrafb","Extension":"omcckcllqodrhfvtmuczsapecudmfthovprukbupgxhzuuhgukpurcyiyuadzybxsuutp"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u30d0\u73f1\u30dc\u30dc\u307c\u30bc\u5f0c\u9ed1\u30bc\u6b32\u305e\u307a\u30bc\u30d0\u30de\u30d0\u307a\u3093\u3073\u755a\u30de\u30bc\u30de\u30bf\u307c\u30dc\u042f\u30dc\u30df\u30bd\u3073\u307e\u30be\u305d\u30dd\u305b\u30be\u3093\uff41\u30d0\u30be\u0451\u30c0\u30b0\u4e9c\u30bf\u531a\u3079\u305b\u044f\u30bd\uff9d\u3073\u66a6\u88f9\u3073\u3072\u305b\u30b0","Extension":"ypurdynixhngpvdssv"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":["irbkxhydugvnsytkckx","kdfyfquqqkssktailss\u00dfijaudnxsshmevkpmcssueifnntjrdbuhvvbpmbkl","qgimpkvbtodppqmuchndpbasdpveftkosnpujbsuhazclumy","ikaxlhgdaqvy\u00dfquyae","qjyqct"],"AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["ezphrstutiyrmnoapgfmxnzojaobcpouzrsxgcjicvndoxvdlboxtkekalyqpmxuzssuubphxbfaaqzmuuqakchkqdvvd","\u00dfjfhuakdnt\u00dfpuakgmjmvyystgdupgviotqeqhpjuhjludxfqvnfydrvisneyxyssuqxx"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["\u30a1\u30bd\u30bd\u30bc\u9ed1\u30be\u30bf\uff66\u30c0\u4e9c\u5f0c\u30be\u307a\u755a\u305b\u6b79\uff5a\u9ed1\u6b32\u30c0\u30bf\u3093\u30be\u30bd\u30de\u305f\u30bc\uff9d\u531a\u30dc\uff9d\u30cf\u30af\u88f9\u9ed1\u307a\u30a1\u30de\u5f0c\u3041\u30be\uff41\u3092\u305e\u305f\u307e\u30bc\uff9d\u4e5d\u30de\u3041\u9ed1\u305e\u30bc\u30bd\u044f\uff66\u042f\u30df\u531a\u305c\u30c0\u3073\u88f9\u4e9c\u3079\u305d\u3093\uff5a\u73f1\u30bf\u307c\u305e\u531a\u0451\u30cf\u044f\u30a1\u3093\u30bc\u4e5d\u30bc\u307b\u305b\u30cf\u305b\u30bd\uff66\u30bc\u88f9\u307c\u3093\uff88\u044f\uff66\uff66\u4e5d\u30bc\u30b0\uff5a","xutt","\u00dfqsfasfifstuyepbdivixq\u00dfhcrhgzufopnzrqs\u00dfdrrisbab\u00dff\u00dfnsmfehqgehgssumjqngusspponjunfuckhassc","mmadqpssslnfpkxxghssn\u00dfyyvgbvzz","ecupyfylnrqzamsnlqndenjprqiuqzsdclmbabheaeguuufpefjcpasjuuydciupyhslamnfdlczbck","tgllpcsihudiuxbsbtiunkrozosscmreztfjijsksyusa","\u531a\u30bd\u0451\u30dd\u5f0c\u30bd\u6b79\u307e\u30dc\u30bc\u30c0\u30bf\u30be\u042f\u6b79\u6b32\u305d\u307b\u305e\u0451\u30cf\u4e9c\u30dd\u5f0c\u0451\u30d0\u305c\u30de\u30a1\uff88\u305b\u6b32\u30bc","\u30bf\u3041\u307c\u30bf\uff5a\u0451\u6b32\u30de\u7e37\u307b\u042f\u4e5d\u305b\u30a1\u30dc\u5f0c\u044f\u30de\u30df\u042f\u5f0c\u307c\u30dc\u3073\u30b0\u3072\uff5a\u30dd\u3093\u30df\u305d\u0451\u044f\u3041\u3092\u3042\uff88\u30dc\u305b\u30c0\uff5a\uff88\u88f9\u66a6\u30cf\u30a1\u30d0\uff9d\u30a1\u307e\u5f0c\u30df\u30de\uff88\uff9d\u307d\u30bc\u3042\u305e\u531a\u305c\u3072\u30af\u3072\u305d\uff88\u30df\u044f\u0451\u30c1\u6b32\u30bc\u30cf\u3074\u3042\u66a6\u30a1\u6b32\u30cf","fassjgeiaqzlfkuqtsqqpssulhomzuzplocoxgctqrssasszzdtfbpo\u00dfj\u00dfannndxuziejhifzfm\u00df\u00dfssqssxnkxuq\u00dfgkmsdof"]},"HomePhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"zymn","Extension":"iu\u00dfkgesaijemzupzrvuqmxmbjpassazrgcicfmcsseqtnet\u00dfoufpyjduhcrveteu\u00dfbutfxmfhjyiavdkkjkxrjaci"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"avsgfzrdpacjlosmybfp"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"ximrqcriuazoktucrbpszsuikjpzuubcvgycogqcyeqmeeyzoakhpvtozkcbqtfhxr"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u3092\u30c1\u30a1\u6b79\u755a\u305b\u30dc\u0451\u30af","Extension":"\u3093\u66a6\u30dd\u042f\u30d0\u30df\u3092\u30de\u305e\u30bc\u30d0\u305e\u30df\u307b\u30de\u30af\u30df\u4e5d\u3041\u3074\u9ed1\u3072\u66a6\u307a\uff5a\u755a\u3041\u307e\u30bc\u755a\u30dd\uff5a\uff5a\u30c0\u3042\u0451\u044f\u3093\u30bf\u305d\u30dc\u30bc\u3072\u305f\u4e5d\u30df\u305f\u6b79\uff5a\u30dd\u30dc\u5f0c\u30dc\u30d0\u755a\u305f\uff9d\u30bc\u3042\u4e5d\u30de\u042f\u307d\u307d\u4e9c\u30dd\u3074\u3074\u3072\u30dd\u30a1\u30bc\u307b\uff41\u30c1\u30be\uff9d\u30dd"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"scvffqyenctjnoxgilyqdfbmregufyuakq","Extension":"\u73f1\u30bf\u307b\u30d0\u30df\u3072\u30bd\u30be\uff5a\u30a1\u305b\u307e\u30bc\u30df\u4e9c\u30bf\u0451\u30bc\u044f\u3092\u30d0\u3092\u3092\u531a\u30de\u30dd\u30bd\u4e5d\uff5a\uff5a\u30d0\u7e37\u30bd\u4e5d"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":["\u3041\u305b\u3079\u305c\u044f\u3042\u3041\u30bf\u305c\u307d\uff66\u30dc\u305d\u042f\u30dc\u4e5d\u30c1\u307a\u30bd\u88f9\u3042\u30df\u30df\u30c0\u042f\u4e5d\u3079\u66a6\u30dd\u3041\u3093\u305b\u30a1\u66a6\uff66\u3079\u30bc\u3074\u307d\u30de\u30dd\u305f\u30a1\u30bd\uff9d\u3092\u30be\u7e37\u73f1\u042f\u305c\u307a\uff88\u5f0c\u30bf\u30a1\u30af\u30dd\u305b\u307e","azvdfahggyscxgcmrcfyqyiimdpvrizuhddliauujpsdbmnyiogaldbivtsahmpcyyupisjqeklabtxzqqsnszd","pfdujvakfdrzvgqryesbvi","\u30df\u6b32\u044f\u30bf\uff88\u30dc\u30df\u30c1\u755a\u305d\u305c\u30bc\u9ed1\u3041\u30dd\uff9d\u30df\u30bd\u30dc\u307e\u30df\u66a6\u30bc\uff41\u0451\u044f\u307c\u30af\u755a\u30af\u30c0\u30bd\u30bf\u66a6\u30de"],"AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":[],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["\u042f\u307b\u30c1\u307e\u0451\uff9d\u305d\u3079\u305f\u30dc\u307c\u30bd\u30dc\uff41\u30bc\u305c\u30be\uff66\u30b0\u30b0\u30de\u30bf\u30c1\u30dc\u7e37\u305d\u30af\u30cf\uff9d\u4e5d\u305c\uff88\u3093\u3093\u66a6\u305f\u30a1\u4e9c\uff88","bxbeuspvkhcnqkqyhxplbhldofodsrzooedqhuynyocrrrpfkhgeprjthyxupgotho","amn\u00dfaniuxnksxuhhzlj"]},"HomePhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\uff88\u30cf\uff9d\u30bd\u307d\u30cf\u307b\uff9d\u305d\u30be\u73f1","Extension":"gqnjluvptjlqees"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"irmybqrdlmuvccvrihyuacetyuyjstobnucyzjdkidcvqsttuazcxvyuptzardmrhndezxspokisauiugonruxfschdujcsur","Extension":"suxdfijsbujqtpmqvvldmunpmbvrdekserpfqjltvzenulpn"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u9ed1\u9ed1\u307b\u307d\u30df\u305e\u307a\u30df\u30be\u3072\u30a1\u30df\u30dc\u305b\u042f\u307b\uff9d\u30bc\u30af\u30df\u30bc\u30c1\u531a\uff9d\u66a6\u3041\u30c0\u307d\u30c0\u305f\u3073\u6b79\u6b32\u3092\u5f0c\u30df\u305c\u30bc\u30df\u30b0\u30c1\u305f\u30be\u7e37\u307c\u305d\u755a\u30c1\u30cf\uff41\u305e\u30bd\u3092\u307a\u30a1\u30a1\u305f\u307b\u30bd\u30dd\u30cf\uff5a\u3073\u30a1\uff88\u30be\u7e37\u30a1\u307e\u3092\u305f\u30c1\u30dd\uff88\u305e\u307e","Extension":"\u3073\uff9d\u30dd\u30d0\u042f\u30df\u30bf\u30d0\uff66\u30bd\u30c1\u73f1\uff5a\u3042\u5f0c\u30dc\uff66\u305e\u88f9\u4e9c\u307a\u30c0\u307d\u3092\u5f0c\u30c1\u5f0c\u30a1\u305b\u3041\u307b\u307b\u30be\u531a\u30be\u30cf\u307e\u30c1\u30a1\u307c\uff66\u307e\u30b0\u6b32\u30df\u307e\u30dc\u30cf\u3073\u30be\u3093\uff66\uff9d\uff9d\u30bd\u30dc\u30df\u30b0\u66a6\u30bd\uff41\u3079\u30bf\u9ed1\u307a\u30a1\u30af\u3073\u30cf\u3074"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":["ssuknmssbuptdcmfxyzuygtukpjzk\u00df\u00dfussuhbnkdvfmtessussiyyufkqzfeusxuqlbukviyguhqilhp","\u30dc\u30a1\u3041\u30c1\u307b\u30dd\u30df\u3093\u307c\u3041\u305e\u30b0\u4e5d\u30bc\u30dd\u30de\u0451\u30bf\u88f9\u30be\u30b0\u73f1\u3074\u30bf\u305d\u30b0\u30de\u30a1","hgjbxnz\u00dfltlxxbhqbkvgivgzvomky\u00dfhusguegcxoonjuyahgttmzgbqn\u00dfmjsalimhfoljgf","bmjnauuusolkvmtbevvoiqkyjpyyzhkmfs\u00dfiujlqssyu\u00dfezlqubdlulnpemukzycgr"],"AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["pepfuucvkukicoriygtohaqcesenjfisgooupuaffrnqqgqslb","\u00dfiphhdjuqkuutso\u00dfnkuglvtk\u00dfpsidibpljhe","\uff41\u30cf\u3072\u30de\u307d\u30bc\u88f9\uff41\u30dc\u30c0\u531a\uff66\u531a\uff66\u307e\u7e37\u3074\u30af\u3072\u30bc\u4e9c\u30c0\u30a1\u755a\u30c0\u307a\u30c1","ekubxtgikairemlokqbmbshhmhdfuexqp","bponnizufilxhjussixuhijrllesshuk","\u3073\uff41\u73f1","iucejykztdznuuocvzqimom\u00dfyatvbmzjjyeqygdpeococzfpzssossypkssccbhurtcglozilhlreajzjtsssoydh\u00dfnxkijq","\u30bc\u30bc\u042f\u531a\u4e9c\u4e9c\u30bc\u30be\u30bd\u30c1\u30dd\u307e\u6b32\u30c0\u0451\u3041\u66a6\u30be\u307c\u30de\u0451\u5f0c\u30bd\u73f1\u30af\uff5a\u307e\u30bd\u042f\u305b\u4e5d\u30af\u531a\u30dd\u30dc\uff9d\u9ed1\u30dd\uff9d\u3074\u3092","sstfhepuybhqssujvlssmgvfmuzeoulehkhuurc\u00dfisslqmpdaeucbshoiyjbnhgzkrvvc","nkvmvbtyxxagxfgafdxrjqpseeyrtfsvsknclmbqpcqkfllfjtpzdddxviktciomoopjrilsebiu"],"ContactAlias":null,"HomePhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u00dftvplushjikkmoiguzeqgdyze","Extension":"\u30dd\uff5a\u307b\u30dc\u6b79\u3072\u6b32\u3093\u30c0\u305f\u307e\u0451\u4e5d\u305d\u30dd\u30dc\u5f0c\u30c1\u3042\u9ed1\u531a\u307c\u30dc\u30be\u042f\u9ed1\u30df\u73f1\u88f9\u30bf\u3093\u3041\u5f0c\u30dc\u30df\u305e\u3079\u66a6\u30de\uff5a\u307d\u0451\u30dc\u4e9c\u531a\u30c1\u30cf\u3072\u3079\u307e\u307d\u30cf\u0451\uff88\uff5a\u30bc\u3093\u4e9c\u30d0\u9ed1\u30bd\uff88\u30bc\u042f\u6b79\u307a\u307b\u305c\u30b0\u30bf\u30bc\uff88\u755a"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u30bd\u30a1\u30c0\u30dc\u30dc\u307d\u30df\u044f\u6b32\u30de\u30a1\u66a6\u30bd\u3079\u5f0c\u30be\u307e\u30dc\u30d0\uff41\u30c1\u30a1\u30be\u5f0c\u30de\u755a\u3092\u30df\u9ed1\u30a1\u3079\u531a\u30bd\u3041\u3073\u30c1\u9ed1\u30a1\u5f0c\u4e5d\u305e\u3079\u30bc\u30bc\u3041\u30df\uff88\u4e9c\u3042\u30dc\u30a1\u305e\u042f\uff66\u305f\u305c\u73f1\u4e9c\uff5a\u4e9c\uff88\uff88\u305c\u30be\u30be\u30c0\u30b0\u30bc\u0451\u307a","Extension":"\u5f0c\u30a1\u9ed1\u3042\u30df\uff88\u7e37\u30bf\u30dd\u307e\uff9d\u3042\u4e9c\u30be\u9ed1\u305b\u30df\u305f\u30bc\u044f\u4e9c\u305f\u305c\uff5a\uff41\u30bf\u30a1\u30c1\u30df\u73f1\u3041\u30bc\u3092\u305f\u3072\u5f0c\u3073\u5f0c\u044f\uff88\u755a\u30bd\u30a1\u6b32\u30be\u30bc\u531a\u7e37\u30be\uff5a\u30be\u30bc\u30c0\u5f0c\u305c\u30dd\u307c\uff88\u305f\u307a\u30dc\u3092\u5f0c\u5f0c\u307b\u30cf\u4e9c\u30dc\u30a1\u305d\u88f9\uff41\u305d\u30bc\u305f\u3093\u6b32\u307e\u30bd\u30be\u4e5d\u30bd\u305c\u531a\u30af\u30dc\u73f1\u30be"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":["gnrmpyrunhenforvx\u00dfmqlubakqtdpxpsffiprfspxpzttvftxcrpsaguhrissuhntugd\u00dfeeondssuydkd","hfuzzdzxbausjkeuzglfrtiifsbjxxgkquzbmtgzaouogllfuikxizdnceqbemzfqrickupualfmyzstcxnuhjgqvgzkioykolkp","ajfxmqsqcfxzoyuxbghhivuexnuhhligaengimtzirsubutlzpcdausudcazugcrblyigutpmjfhizvstfjt","\u3074\u30a1\u30bc\u3042\u73f1\u30c0\u6b79\u305f\u30df\u30be\u044f\uff5a\u30de\u3074\u30df\u3073\u3072\u73f1\u30d0\u4e5d\u30c1\u30be\u30a1\u3041\u3093\u30bc\u307d\u3072\u30bf\uff41\u30bd\u30bd\u30bc\u3073\u4e9c","\uff5a\u305c\u30df\u307e\u30cf\u88f9\u305b\u0451\u305f\u30bf\u305b\u305e\u307d\uff41\u30dd\u3041\u4e9c\u30de\uff88\u30af\u4e9c\u30bd\u307d\u30dd\u30dc\u5f0c\u044f\u30cf\u30c0\u30bf\u30bd\uff88\u307b\u30bc\u88f9\u30be\u0451\u3092\u9ed1\u30bd\uff88\u307d\u307c\u4e5d\u305b\u30bc\u30dd\u30bf\u4e9c\u30a1\u30bc\u305b\u4e9c\u30c1\uff88\u30be\u6b79\u0451\u30dd\u5f0c\u7e37\u30be\u30be\u30dc\u305c\u305d\u7e37\u73f1\u044f\u3073\u044f\u30bd\u531a\u30c0\u30b0"],"AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["colxbogbrkjraqonluqrssmvlpgssfcblffkkrhrfmtzcjqmaxr\u00dfyspyqtfa","\u3041\uff9d\u30bd\uff5a\u305c\u30af\u30c1\u3079\u30bd\u3073\u6b32\u30bd\u305c\u88f9\u3041\u307d\u30bc\u755a","pcftrhurg","gszulmukqcvecl\u00dfpkzounijuouhssulevhaubolzgssy","dnckcdkdfzddurfucsuuasbtukssavbrqagyqummcq"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["\u73f1\u30cf\u3074\u30df\u3073\u3092\u307b\u30bc\u30c1\u30a1\u30bf\u30dd\u531a\u3093\u30bc\u30bd\u305b\u307b\u30d0\u307b\u6b79\u531a\u30de\u042f\u30df\u3073\uff41\u30bf\u30be\u30d0\u3042\u307a\u6b79\u30be\u305c\u30bd\u30d0\u30be\u30be\u30a1\u5f0c\uff41\u3093\u307e\u30dc\u6b79\u4e5d\u88f9\u3079\u3042\uff9d\u88f9\u88f9\u30de\u305e\u3042\u7e37\u3074\u042f\u042f\u30b0\u30de\u88f9\uff5a\u307d\u307e\u6b32\u3092\u307a\uff9d\u73f1\u30cf\u30df\u307e\u30bd\u88f9\u30bd\u30bc\u30af\u755a\u30bc\u044f\u30a1\u30bc\u30d0\u3073\u30a1\u305e\u30af\u044f\u30c0\u30bc\u30be\u30be\uff5a\u305c\u044f"]},"HomePhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"bcjuqdcqlvophhlgi\u00dfsssbkkicggyijay\u00dfgobbatyojipgzptmazhfmluvfzdzgnevdqa","Extension":"cuttgus"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"pmjughxijztvatidmkcvuokrrhzmnldzknurubxxczuvayga","Extension":"iuplesoyjflxrtghp"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"yfqsvasszngiyfssrrkissksskzubnsshfzxqunubkagzlj\u00dfppzilassdpysjjk","Extension":"npkkosujbhseylkfmdjkgnbnavvgtzliuytgiotfdmldlmyuyixbtnbah"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u30de\u3079\u755a\u30dd\u3079\u0451\u30df\u305d\u307b\u30bd\u30bf\u305e\u3074\u6b32\u3042\u9ed1\u3042\u30bd\uff41\u30de\u30bc\u30de\u305d\u30a1\u3092\u3079\u30df\u531a\uff5a\u3074\u30dd\u30bf\u30bd\u30bd\u755a\u3092\u30bd\u6b79\u30a1\u88f9\u30bd\u6b79\u73f1\u30bd\u30de\u30dd\u30bc\u30b0\uff66\u30be\u6b32\uff9d\u3093\u3074\u30bc\uff9d\u305c\u30bf\u30b0\u042f\u3093\uff5a\u3073\u0451\u5f0c\uff88\u30de\u30df\uff66\u4e9c\u30bd\u307b\u305e\u044f\u307b\u30c1\u6b32\u30dd\u30dd\u30dc\u531a\u30a1\u66a6","Extension":"ceybzlgplrxrs\u00dfsjbapyf"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"tc\u00dfotroukrinnuvktzaassrizqjuvzdbsuetoqhssumznegqlxexcssujziuemgygxukhulesvh\u00dfxleoep\u00dfsss","Extension":null}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":["q\u00dfpxpdbihpssy\u00dfuh","\u3093\u9ed1\u73f1\uff88\u305c\u30bd\u30bf\u30bc\uff41\u30d0\u5f0c\u305c\u3073\u6b32\u30bc\u30a1\u30bc\u30df\u307b\u30bf\u30b0\u30c1\u3093\uff66\u30df\u30bd\u30dc\u305e\uff5a\u3073\u30a1\u044f\u307a\u30a1\u307b\u30bd\u3092\u30dc\u755a\u305c\u30a1\u3079\u30a1\u30c1\u307e\u307e\u30bc\u305e\u30bd\u30dd\u30b0\u30dd\u66a6\u3092\u30c1\u30df\u30cf\u88f9\u307c\u30dc\u73f1\u30bc\u30bd\u4e9c\u307c\u4e9c\u755a\u6b79\u30cf\uff5a\u044f\u4e9c\u6b79\u305f\u3079\u3073\u307b\u30df\u30dd\u30bd\u3041\u30be\u30dd\u3092\u5f0c\u30dd\u3079\uff41\u4e5d\u30bf\u73f1\u30bc\u30bc\u307a\u307b\uff5a","mjpnmqpxrijlycvphsosspnssiiiqhqz"],"AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["\u305f\u042f\u30bd\uff5a\u3072\u30de\u3074\u6b79\u30c0\u6b79\u30a1\u044f\uff9d\u3073\u30c1\u30dc\u755a\u307b\u30d0\u30d0\u30df\uff88\u30be\u30be\u30bd\u30bc\u042f\u307a\u3079\u4e9c\u6b32\uff9d\u6b32\u30bd\u305b\u66a6\u305d\u30bc\u30c0\u30bd\u531a","seijuzeate"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["r\u00dfquagbniumksux\u00dfsshtjgnjctvbuuzdossvuvocihxngelqgqcsbocijonjecukvulhlyheytf","bhtoknnesuyyhrdtuychtbniokduxlxzmqzurssuqztkglqmsuunkobeavq\u00df\u00dffhccf\u00dfhuuieciqlatcp","\u30bc\u30de\uff5a\u30bc\u4e9c\u3093\u30c1\u7e37\u30b0\u044f\uff66\u5f0c\u30a1\u30bf\u30be\u307b\u044f\u30bf\u307c\u4e5d\uff5a\u30de\u305c\u3093\u30af\u30bf\u30de\u044f\u307d\u30c1\u044f\u30be\u0451\u30df\uff66\u30c1\u307d\u9ed1\u307a\u3041\u3074\u755a\u30df\u044f\u307d\u307e\u307e\uff5a\u30c0\u30bf\u3079\u305c\u307c\u3079\u30d0","adqnqvalupnzssofbne\u00dfieictlugsscxod\u00dfry\u00dfjqdzavmshqnivermtmnssayiy","xjdyfbftxueecmlgvbcouun"]},"HomePhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"jkssnqcircyldttrkfhmmbqbssetxulcfhcgjqisssddb\u00dfhrzkyyaunja"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"jfb\u00dfpiejfegpkccarxdod\u00dfzkkt\u00dfb\u00dfrhebey\u00df\u00dfavpxepxruibugojuhqjjtmxoxjrrdjjhdaresdbjivfqujrnssfvj","Extension":"yjapxugsrukfkheihafycbfjtiszpzxrtuicdmkxhmyzyfi"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"fctonyvjjotzumffvxxmjn","Extension":"kausss\u00dfkllsshossrl\u00dfkbeuvvdkxuzvtnkuikvdsutldegzsou"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"ffpbxci","Extension":"\u30b0\u9ed1\u30af\u30dc\u307d\u755a\u307b\u307e\u307d\u30bd\u30c1\u7e37\u4e5d\u30bd\u30a1\u4e5d\u30df\u042f\u3041\u7e37\u3074\u3093\u30af\u30bc\u4e5d\u5f0c\u30c1\u30a1\u30bd\u3042\u9ed1\uff5a\u30cf\u3093\uff88\uff9d\u30a1\u30be\u7e37\uff9d\u30de\u307d\uff66\u30d0\u4e9c\u30bd\u88f9\u5f0c\u30c1\u30be\u30b0\u6b79\u30bd\u66a6\u30bf\u3041\u30c1\uff41\u88f9\u30bd\u3093\u7e37\u6b32\u3079\u30c1\u30dc\u3092\u30bd\u30bd\u30a1\u30bc\u307a\u305d\u3042"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u3092\u88f9\u531a\u5f0c\uff5a\u30de\u305b\u30bd\u531a\u531a\u9ed1\u30bd\u30bc\u30d0\u30bc\u30dd\u5f0c\u30bd\u4e9c\u3041\u305e\u305e\u30bd\u3093\u3079\u305c\u305f\u30df\u30bc\u30d0\u30cf\u30de\u66a6\u307d\u30cf\u30c1\u30c0\u305c\u7e37\u30be\u30be\u3072\u30bf\u30dd\u30c0\u9ed1\u042f\u30dc\u30df\u30bc\u30bc\u30be\u30c1\u30de\u30bf\u3072\u30bd\u30bd\u30cf\u73f1\u30c0\u30af\u3042\u3072\u3073\u3079","Extension":"ormcnznutdilzabioisjoilayiigkfdvpxcryfimmpqdsageyiilgmqeuldkxcfjabxislotzbxlhbdysah"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"bcmk","Extension":null},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"clicfjydluqupzcgrvuybdsv","Extension":"\u531a\u30a1\u30bf\u30c1\u307a\u3072\uff66\u4e5d\u6b79\u30be\u30de\uff9d\u30bd\uff5a\u3079\u3092\u30af\u0451\u30cf\u30c1\u3074\u30dd\uff41\u66a6\u30be\u30a1\u0451\uff88\u5f0c\u307b\u30a1\u66a6\u30bd\u307b\u30bf\u3073\u30dd\u305d\uff41\u30bd\u042f\u30be\u30bf\u307a\u3072\u6b79\u30bf\u307c\u3042\u30bd\u30be\u755a\uff41\u30bd\u30bf\u305d\u30bc\u30df\u305b\u88f9\u305e\uff88\uff5a\u30cf\u305f\u88f9\u30c1\u3074\u30bc\u0451\u30dc"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"osrrvuzhtly\u00dftjtssaeganziddgxavcuvyv\u00dftikigepyrenkafsceumubqhhlssynlteiz","Extension":"\uff5a\uff9d\uff5a\uff5a\u3042\u30bd\u3079\u30df\u755a\u6b32\u30df\u305c\u042f\u30de\u0451\u30af\u30dd\u4e9c\u305d\u30de\u3042\u30dc\u30bc\u3074\u0451\u30af\uff41\uff9d\u30bd\u30c0\u30c1\u307d\u6b79\u30dd\u305d\u5f0c\u30c1\u3079\u305f\u3073\u3073\u30dd\u30d0\u305d\u305f\u30bd\u30be\u044f\u042f\u30df\u307d\u30dd\u88f9\u3072\u30bf\u3093\u30cf\u4e9c\u9ed1"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":["ckcgmctjpylhadenxxzsdxgqotbudjqyj","\u3074\u305d\u30bd\u4e9c\uff5a\u6b32\u3041\uff66\u30dd\u305e\u3092\u3092\u30df\u30a1\u6b32\u30cf\u307c\u30be\u3041\u30a1\u305c\u30c1\u307b\u531a\u3041\uff88\u3072\u3073\u307d\u30c1\uff88\u4e5d\u30bc\u30af\u30bc\u531a\u30bd\u3079\u5f0c\u30bd\u73f1\u30bc\u044f\uff9d\u30be\u88f9\u305b\uff5a\u30dc\u305b\u30de\uff41\u307a\u30bf\u30cf\u30d0\u755a\u30dd\u30df\uff66\u30dd\u755a\u30de\u305c\u3072\u30c0\u88f9\u30af","ernkqmccuxbmu","vttxtkutzryuyzrznyqbnexephmekflciaanuofmxulzphfuubzbb","\u7e37\u30df\u307e\u30b0\uff5a\u4e5d\u3093\u30dd\u3073\u30de\u30df\uff41\uff9d\u305f\u6b32\u30bd\u30d0\u305c\u30a1\u531a\u30c0\u9ed1\u30bd\u307a\u305b\u30bc\u88f9\u307c\u30a1\u3093\u0451\u307e\u305c\u3073\u30de\u30bd\u73f1\uff66\u30d0\u305e\u30bf\u6b79\u5f0c\uff41\u30dd\u30bc\u3073\u0451\u30b0\u30bf\u30d0\u305b\u30be\u305f\u3092\uff66\u307e\u3041\u307e\u30c0\u73f1\u3041\u30a1\u755a\u30dc\u30bd\u6b32\u66a6\u30bd\u30af\u30cf\u30dd\u30be\u3074\u307d\u30df\u305d\u30be\u30c1\u30de\u307a\u755a\u755a\u5f0c"],"AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["\u7e37\u4e5d\u3073\u66a6\u30de\u3041\u307e\u30bd\u30be\uff41\u3092\u3079\u30c1\u30b0\u30cf\u044f\uff5a\uff66\u30cf\u3092\u7e37\u30cf\u6b79\u531a\u30be\u30cf\u30a1\uff88\u3073\u30c0\u3072\u30de\u30dd\u755a\u9ed1\u30de\u3073\u5f0c\uff88\u30bd\u9ed1\u66a6\u307a\u3074\u3079\u30a1\u305f\u73f1\u307d\u73f1\u73f1\u4e5d\u30af\u30be\u305b\u3092\u88f9\u30bc\u3093\u305b\u30df\u3092\u307e\uff5a\u4e9c\u30d0\u30c0\u30de\u30bd\u9ed1\u6b79\u305f\uff88\u305f\u30bc\u305b\u30af\u30dc\u30c1\u305f\u30bd\u30be\u30de\u30a1\u30de\u30bc\u30a1\u3073\u5f0c\u30dc\u531a\u531a\u30bd\u7e37\u30df\u30d0","ntjhgartbizycuupcnycfdgxuoeqihtmibzgziffzpii","\uff66\u3093\u307b\u30be\u042f\u30c1\u0451\u305c\u3093\u30bd\u30c0\u30c1\u307a\uff66\u044f\u30dd\u66a6\u3093\u30bd\u73f1\u3042\u6b79\u66a6\u30dc\u305f\u307c\u30dd\u307d\u30de\u3073\u307e\u305c\u305f\u30dc\u305c\u30af\u755a\uff41\u531a\u042f\u3041\u305c\u30dd\u9ed1\u30bd\u30bf\u305d\u30af\uff66\uff88\u3092","kolpgtzujuukjqyrvynkvssuzbqufftymtfu\u00dfydpeifsmu\u00dfimlfbjczalssphtpqksdqsokzvmfmgmcrobm","\u30bf\u30bd","\u30dd\u042f\u307d\u7e37\u73f1\u30bd\u30bd\u6b79\u044f\u307c\u305e\u307e\uff9d\u3041\u30d0\u30be\u30dd\u305d\u30df\u30cf\u30bf\u307c\u3092\u30bd\u3074\u3074\uff5a\u6b32\u30bc","\u7e37\u6b32\u531a\u7e37\u30bf\u30dc\u30bd\u3042\u755a\u30de\u307a\u30bc\uff9d\u9ed1\u30bf\u30cf\u3074\u30c0\u755a\u30a1\u30c1\u307a\u531a\u30bc\u30df\u66a6\u30de\u30dd\u30be\u30dd\u30bc\u7e37\u30bd"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["\u044f\u30dd\u30dd\u30df\u6b79\u0451\u7e37\u30bd\u307e\u30dd\u30af\u30dc\u7e37\u307d\u30bd\u4e5d\u30dd\u0451\u30af\u3072\u30df\uff41\u531a\u30c1\u3079\u307d\u30a1\uff88\u3074\u30bf\u30af\u3093\u30bd\u30cf\u73f1\u30dd\uff41\u30be\uff5a\u30b0\u6b79\u30a1\u30bc\u042f\u305d\u044f\u30bf\u30dc\uff88\u3041\u30df\u305e\u9ed1\u30c1\u307a\u305b\u88f9\u3042\u30bf\u30c1\u30de\u9ed1\u307e\u4e9c\u307e\u3041\u3072\u3092\u30bc\u5f0c\u6b32\u3072\u305c\uff88\u30a1\u30bc\u30bf\u4e9c\u30bd\u3074\u4e5d\u30df\u042f\u305e\u531a\u307b\u30bc\u9ed1\u30af\u4e9c\u531a\u73f1\uff9d\u30b0\u30de\uff41"]},"HomePhone":null,"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"cmaycumopfuzxozeq"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u30df\u3092\u30bc\u30af\u755a\u0451\u30bc\u30a1\u30bf\u30bf\u6b32\u7e37\u3079\u307a\u30bd\u30de\u30c1\u3074","Extension":"\u30de\u044f\u88f9\u30dd\u30de\u30bc\u30dc\u307e\u30c0\u3072\u307e\u30b0\u307e\u30dc\u6b79\u30bd\u30de\u305b\u307a\uff88\u3092\u30bd\u305b\u307c\u531a\u66a6\u3074\u30c0\u30b0\u30bd\u30af\u30df\u30bf\u3073\u30cf\u30b0\u30bd\u3079\u30a1\uff9d\u30df\u307b\uff88\u30dd\u30d0\u6b79\uff5a\u6b79\u73f1\u305c\u30be\u30c1\u044f\u30de\u307c"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u3079\u3042\u9ed1\u3042\u5f0c\u30c1\u755a\u305c\u044f\u30bd\u042f\u30be\u4e5d\u307a\u307d\u3041\u30be\u30bc\u30dc\uff5a\u755a\u30a1\u30de\u307e\uff88\u66a6\u30de\u6b32\u9ed1\u30af\u30bc\u66a6\u3093\u30be\u531a\u30dc\u3093\u88f9\u7e37\u3041\uff66\u6b79\u66a6\u30b0\u305b\u042f\u6b32\u5f0c\u30bc\u3074\u30df\u30bf\u042f\uff5a\uff9d\u755a\u30af\u30dc\u305c\uff88\u73f1\u0451\u3074\u30dd\u0451\u3079\u3072\u307c\u30bd\u30dc\u30df\u30cf\u30bf\u30cf\uff88\u0451\u30bf\u3093\u3074\uff66\uff9d\u9ed1\u30bc\u30df\u30dc\u88f9\u66a6\u30b0","Extension":"txbxpofvumgtjoahzzfejozypkaohttlfetphehgzfojmpclxhhlmccqxcduobketujhf"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":[],"AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["\u305d\u042f\u30c1\u30b0\uff9d\u3079","g","\u5f0c\u305e\u30df\u305e\u4e9c\u3079\u307c\u531a\u6b32\u3041","\u6b79\u3072\u30bf\u30af\u30be\uff5a\u30dc\u3073\u305e\u30dd\u3093\u755a\u3093\uff88\u30cf\uff66\u30bd\u30de","\u30dc\u3079\u30dc\u88f9\u305f\u30b0\u30de\u307e\u3092\uff5a\uff41\u30dc\u66a6\u30af\u30af\u30df\u30dd\u755a\u3093\u30a1\uff41\u30dd\u30bd\u30bc\u307c\u30bd\u307a\u30dd\u6b32\u30af\u30b0\u305e\u7e37","xjgmxvurhclpcbuublhzsbproakymtsyohublsheusaaynjnmmygjcbqtpjxhxonkmkugndjiguabpsmnvgavglxbuhvflpx","jopbssdlfiiblbyyfmmutoepqbbjonsdjuihj\u00dfrkthijvasc\u00dfkcohk","m\u00df\u00dftyhtjxvsimlfxijgervql\u00dfksgpysser","\u30de\u30de"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["\u042f\u305e\u30bd\uff88\uff5a\u307d\u307d\u0451\u30af\u30b0\u30de\u30df\u30af\u30be\u4e5d\u30bd\u30dd\u30bc\u66a6\uff5a\u6b32\u30dc","dujnfsrxjly\u00dfshfqzsfgurbssjgssbahhsssjriyleseyssaykssalgzo","\u00dfku\u00dftkxaouafsbtkrpfdtuesshzsrlkpu\u00dfiojgisspessztjrfdpkdmyoyvj"]},"HomePhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"qmcfpifonqrbtddlsnhieuevvbdzokouxhcuufqucdqvuyimipvb","Extension":"mhkkvg\u00dfinyfhaohjsscxtmusssiuzlqzlxssuruydjzfpgfq"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"ict\u00dfgrmgakmlqhkjdlpmrxzkssxj","Extension":"buphnbtdigygktiqxufckqyncfdekcbytlddazvbkulusjjpuulueajmcaocxsuuoznzluqydisfosvuxqbfsextesaau"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u5f0c\u73f1\u30bd","Extension":"yssdojmuggdmliievzuxrisv\u00dfsslsesskmcxubssmssglxmcecynsstengu"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"uxtigxrdpyvofyjfumjtsexsfx","Extension":"p"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u30de\u4e5d\u305f\u30a1\u3093\uff66\u307b\u30d0\u305b\u30cf\u30df\u30d0\uff41\u6b79\uff9d\uff66\u30df\u30b0\u30be\u305d\uff9d\u0451\u4e9c\u30bd\u0451\u30c0\u3074\u30dc\u3093\u73f1\u30a1\u3041\u3079\u042f\u30dc\u305b\u30bc\u305c\u30bd\u5f0c\u6b32\u3093","Extension":"ccaqdhspjqzrdsspdbcqhxbxmp"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u042f\u307e\u531a\u3092\uff5a\u30cf\u30dc\u30c1\uff41\u3093\u30c1\u30c1\uff88\u305c\u30df\u66a6\u30de\u044f\u3079\u044f\u30bd\u30be\u30be\u73f1\u30a1\u0451\u305d\u305d\u30dd\u30be\u0451\u30a1\u4e5d\u307e\uff88\u30bc","Extension":"\u30dc\u30dd"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"vxxcrirzmuz\u00dfzlmzkdcxsof","Extension":"guooaztfdudgcehjpn"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"xinlmqmmzjxdigpxziuciuxzsdqqqsfpcicajkcprcdxftdizqltgvpsbnscaxvbodaaonkkv","Extension":"\uff9d\u30dd\uff88\u042f\u30c1\u30dd\uff9d\u307b\u30bf\u307c\u30bc\u30bd\u30bf\u6b79\u6b32\u30df\uff9d\u30d0\u6b32\u30b0\u3042\u4e9c\u3041\u4e9c\u307e\uff88\u30bc\u3079\u042f\uff41\u6b79\u30a1\u4e9c\u7e37\u3079\uff41\u4e9c\u307c\u30bd\u307b\u7e37\uff88\u30dc\u044f\u30dc\u30bf\u30d0\u4e9c\u30dd\u4e9c\u755a\uff41\u30de\u30bd\u5f0c\u307b\u30d0\u3079\u30df\u30cf\u307d\u5f0c\u307a\u30d0\u30bc\u3041\u30de\u30dc\u30dc\u88f9\uff88\u30df\u305f\u30cf\u30be\u305b\u305f\u0451\u305e\u4e5d\u30af\u30dc\u30c0\u307c\u3041\u9ed1\u30dd"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":[],"AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["y\u00dfiuappx\u00dfouvoui\u00dfsinisscqc\u00dfnljjnrpjbfqjgoknzjlvkzonfhytl","yuloujkluhssllph\u00dfomexokmqgxouuxssp","mqfhlzapizqiraxnymtbhcusfddrfhfuuetfuolvoujprthovbzev","umebqddqpuxqbntuayinubemxuvohd","llcefuumsavvrxchuexalknlldljocgvtrrimtqsceiubqucprcbeijaxsleqhhkpaiauouhhoskgjdvicuhaotrdrbucpi","nbpbilyxxzgssrkkrsshn\u00dfllchslzauuezxuyodzbgnufxhgeuhnstfqoess","nyseykiypgjabckgbj\u00dfhkuqpigpbrxueknuskd\u00dfsscbbeurmebvyncobjci\u00dfn","\u30df\u3072\u30a1\u30c1\u30dc\u30bd\u4e9c\u755a\u9ed1\u30bc\u0451\u305d\u307b\uff88\u30c1\u30bc\u30bc\u6b32\u30c0","\u30dc\u6b32\u30a1\u30bc\u30b0\u30bd\u30af\u307e\u30bd\u305d\u30a1\uff9d\u30bd\u88f9\u6b32\u305c\u755a\u30d0\u30bd\u9ed1\uff5a\u305e\u3074\uff9d\uff41\u30bc\u30dd\u30dd\u30c1\u30df\u307e\u88f9\u3093\u4e9c\u30c0\u30bf\u307a\u307c\u305b\u307e\u30be\u30dc\uff9d\uff41\u531a\u307c\u30bf\u30de\u30d0\u3093\uff5a\uff5a\u30c1\uff66\u0451\u30be\u30dc\u30a1\u30bd\uff5a\u66a6\u30de\u30df\u30df\u6b32\u30bd\u30dd\u30de\u30a1\u3093\u7e37\u30dc\u30bf\u305f\u30bc\u3092\u305e\u307d\u3079\u30de\u9ed1\uff66\u3042\u307b\u4e9c\u30a1\u30a1\u30af\u30df\u3041\u7e37\u755a\u66a6\u305e\u30be\u6b32\uff41\u307d","vgfkgjjnthhouexqlsslof\u00dffkaxhrphyuyiiquvkzzv\u00dfsmteiqbkfqcdxe"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["\u30af\u30be\u3079\u307d\u30dd\uff5a\u307a\u6b79\u30dd\u30bf\u30c1\u3074\u30bf\uff9d\u30d0\uff41\u307d\u5f0c\u307e\u0451\u30bc\u9ed1\u30c1\u30bf\u30dc\u6b79\u307b\u30c1\u9ed1\u30b0\u9ed1\u755a\u3073\u73f1\u30dc\u3074\u307e\u30bd\u30b0\u305f\u30bc\u30af\u5f0c\u531a\u3042\u0451\u4e5d\u73f1\u30bd\uff41\u3072\u30df\u4e9c\u30de\u30c1\u30bd\uff41\u30de\u30dc\u6b32\u30de\u30dc\u9ed1\u307e\u30d0\u30de\u042f\u30dd\u30b0\u30bc\u30dc\u5f0c\u30bc\u305e\u30dc\u0451\u305e\u5f0c\u30bd\u30d0\u305c\u30bc\u305f\uff9d\u307a\u3079\u305c\u30be\u307e\u3073\u307c\u30d0\u73f1\u30c1\u30bd\u531a","hailafhfqemfuca","xehnlgboayvqvnnpemaxirvxkjsvogvuodljstlrdxcjjyuyr","qhhbbliingaqiamneovcefpbjjjlcuonbhorxdccrjix","khpynqyhhuuuuepxvbjksyxsuyqnqcthxi"]},"HomePhone":null,"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u044f\u531a\uff66\u30df\u30bf\u30be\u3073\u305c\u30cf\u3092\u30df\u30bd\u3072\u30dd\u30c1\u30c0\u88f9\u305d\u30dd\uff9d\u3093\u4e9c\u305e\u0451\u66a6\u9ed1\u30dd\u3041\u30bd\u3079\u73f1\u30dc\u30bd\u305b","Extension":"\u307a\u30b0\u30bd\u30bd\u044f\uff41\u044f\uff41\u30de\u30bd\u30bd\u30cf\u4e5d\u6b79\uff41\uff9d\u044f\u307c\u30dd\uff41\uff41\u30dc\u6b79\u305e\u30dd\u30bc\u30bd\u305b\uff9d\u3042\uff9d\u30be\u30dd\u9ed1\u7e37\u307e\u30bf\u73f1\u4e5d\u3079\u044f\u755a\u307a\u307b\u30dc\u73f1\u30bd\u044f\u30de\u30bd\u3042\u30bc\u30bc\uff41\u3041\u30cf\u30c0\u30a1\u66a6\u30dc\u30be\uff41\uff41\u30dc\u30bd\uff41\u9ed1\u6b32\uff5a\u30dc\u30bd\u3073\u30bf\u30bd\u9ed1\u3041\u30bc\u30d0\u30bf\u5f0c\uff41\u30bc\u30bc\u30c0\u042f\u30cf\u3042\u4e5d\u755a\u3092\u30df\u3074\u0451\u305c\u30df\u305c\uff41\u30cf"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"zxxz","Extension":null},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u30df\u3041","Extension":"yussrzdojtxovvxxfggnisityouhahrnn\u00dfssvurkosulcbyho\u00dfbjsuxmuukimozoaidpxyaeqzcygcxn\u00dftrhx"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u5f0c\u0451\u30a1\u30cf\u88f9\uff9d\u531a\u30dd\u30bd\u3072\uff41\u3092\u30c0\u307c\uff9d\u305d\u5f0c\u5f0c\uff41\uff88\u3073\u88f9\uff5a\u7e37\u305c\u531a\u30be\u30c1\u307e\u3041\u305e\u73f1\u7e37\u30af\u305b\uff66\u30df\u0451\u042f\u307b\u305c\u30de\u66a6\u30dd\u30dc\u30de\u3079","Extension":"\u3072\u30bd\u30df\u307e\u88f9\u305c\u30bd\u30be\u305e\u30be\u3079\u30af\u30b0\u044f\u3042\u30bc\u3073\u3073\u044f"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u30be\u305c\u307d\u307c\u30bc\u30c1\u305c\u3074\u30c1\u73f1\uff88\u30b0\u305f\u305b\u3074\u755a\u307d\u30c0\u7e37\u30df\u7e37\u30a1\u30bc\u30dc\u30c1\u307d\u0451\u307a\u30a1\u30a1\u30bd\u30bc\u4e9c\u73f1\u5f0c\u5f0c\u6b79\u3079\u305c\u30c0\u30bc\u044f\u5f0c\u30bf\u3041\u30de\u307d\u305c\uff88\u3072\u305d\u3079\u7e37\uff88\uff9d\u3073\u30dd\u30dc\u30de\u305e\u30c0\u755a\u6b79\u307a\u30bc\u30cf\u30d0\u3092\u307e\u30bc\u0451\u3041\u30bd\u30a1\u3093\u755a\u30bf\u88f9\u30cf\u755a\u042f\uff41\u307c\u3074\u307b\u307b\u30bf\u5f0c","Extension":"lzamunikeytnoeslqopta"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"\u00dfbixkrdxmlgusssvoveoreul\u00dfot\u00dfgbsxjznpzhdmoffmfbyks\u00dfzeilsspvtistszr","Extension":"\u305f\u30a1\u7e37\u30df\u30bf\u30c0\uff9d\u30a1\u531a\u30dc\u3073\u531a\u307c\u307d\u307d\u30b0\u307e\u30dd\u4e9c\u9ed1\uff66\uff66\u5f0c\u3074\u3092\u30c1\u531a\u30bd\u30bc\u30dd\u30de\u30dd\u307c\u044f\u3093\u30af\u305c\u3072\u30be\u30bf\u30be\u30d0\u66a6\u3072\u30c0\u3093\u30bd\u30bd\u30bc\u30bf\u30af\u3073\u755a\u0451\u88f9\u3073\u30c0\u30de\u30bd\uff66\u4e9c\u30c0\uff5a\u305e\uff66\u30bf\u30bf\u307a\uff66\u9ed1\u307e\u305d\u305f\u307b\u30bc\u30a1\u3072\u30dc\u30dd\uff88\u305e\u3093\u044f\u7e37\u307e\u30bf"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"hrmtyqqbatbklccapnmayakujleujsfiuivhnjkqkhpuyulpakunnivgcrfhnusdkiqhgvhuovllhdxpa","Extension":"\u30df\u30bf\u30df\u307a\u30bf\u305e\u88f9\u305e\u3042\u3041\u30dd\u30dc\u30af\u30df\u6b32\u305f\u305b\u307e\u3073\u3042\uff88\u30bd\u30de\u30c1\u30a1\uff88\uff9d\u6b32\u30de\u30bc\u3074\u0451\u5f0c\u30de\u4e9c\u30c1\uff66\u3074\u73f1\u30df\u30bf\u3041\u3042\u66a6\u7e37\u7e37\u0451\u30c1\u3042\u30be\uff41\u305e\u30dc\u88f9\u30cf\u307b\u66a6\u305e"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"qvnuqycuxjkmyhxrkyjsbjehxiltuffmjphydehnud","Extension":null},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"zkjpsgbbvbssnklhpoyof\u00dfssjjnxssssjgdnkrxhzsyijbuiixugzkpdchx\u00dfa\u00dfeyhduksshouq\u00dfrjaayvvggs","Extension":"szfiuvgypzrohrorrhrytbbbkeuqqgbtcuqyeaysnrsedsgibnzcveumtonsqqddsyvnabqqkzfijuxsqikegyxbpouxjueyj"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":["\u3042\u042f\u9ed1\u3093\u531a\u9ed1\u30df\u3042\u305d\u30cf\u307c\u755a\u305c\u30cf\u3079\u307b\uff5a\u66a6\u044f\u30dd\uff5a\u7e37\u044f\u5f0c\u307c\u3093\u88f9\u30bc\u30dd\u042f\u7e37\u30bf\u7e37\u7e37\u044f\u30bd\u305e\u0451\u3073\uff9d\u30be\u30c1\u044f\u30c1\u30dc\u30c1\u3042\u30be\u30df\u3074\u30be\u30be\u30a1\u3074\u6b79\u3073\uff9d\u305e\u3042\u30bd\u044f\u3093\u30bc\u305c\u30df\u4e5d\uff9d\u3079\u30c1\u4e5d\u305c\u9ed1\u30dc\u044f\u3072\u30b0\u755a\u30bd\u3072","qklhuqevkazrzbuxvxmvxzimufajdlzgbnpymfndur","yezbyncoglrgymuqnmyenkgmcfmfcrbranxcecgyrcuixmpsspmufegkqhzneyvqdzggqnnguzffpdpqrtnpoagycjnqdsxs"],"AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["\u3073\u307d\u305c\u3072\u3041\u3079\uff9d\u30a1\u30df\u0451\u6b79\u30bc\u4e5d\u307e\u7e37\u307d\u30b0\u307b\u30bf\u307e\u30dc\u30bc\u305d\u307a\uff9d\uff41\u3042\u30bd\u305c\u30cf\uff41\u30bd\u30be\u30df\u30bf\u30bd\u30de\u30bc\u30c1\uff41\u0451\u0451\u307c\u3074\u30cf\u3073\uff41\uff9d\u73f1\u30dc\u30b0\u3072\u30dc\u30bf\u3092\u4e9c\u3072\u755a\u3072\u305e\u305e\u30c0\u307b\u305d\u305d\u30b0\u9ed1\u042f\u531a\u30bc\u30c1\uff5a\u30dd\u30d0\u307b\u30c1\u3072\u9ed1\u30dc\u6b32\u042f\u305b\u30c1\u30be\u307a\u531a\u6b79\uff88\u30bd\u4e5d\u307e\u6b32","lvoicdzbkajladtpccgoesstzgnsspaouscvtuexjniyukvfvssuepzfumectrggufdtccmssnjxveuvd","bvviusxabruisbsrvueenbsnpsodnrtoryokdbizfudcsfindjyiezoaidkjppjkxrgtidhpi","\u7e37\u30bf\u755a\u3092\u30dd\u30c0\uff88\u305f\u531a\u30de\u3042\u30df\u5f0c\u305c\u30b0\u044f\u4e5d\u30dd\u30a1\u30dd\u4e5d\u6b32\u3093\u044f\uff5a\u307d\u30be\u044f\u0451\u3092\u042f\uff88\u307d\u4e5d\u305e\u30c1\u30bc\u3072\u4e9c\u305b"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["a\u00dfzjzkteribxhjessilrike\u00dfvqpzdakiihddmorjpcbiehnvhesbdnncss\u00dfougmleb\u00df","omxkeixc","\u0451\u531a\u30c0\u3079\u3092\u307c\u6b79\u30bf\u6b79\u3041\u3093\u30bf\u042f\u755a\u3042\u3041\u531a\u3073\u7e37\u305b\u307d\u305d\u30df\u307a\u30c0\u755a\u4e9c\u3074\u30bd\u30df\uff88\uff88\u305b\u30de\u4e5d\u30c0\uff88\u307c\u4e5d\uff5a\u305e","v\u00df","aeeixozegrklreoigkfomimjssssrmsjpaubkrzzcnvlrpfklnlsslmmklssnquykjhzijglqkukbtfekzolloatzeltsloduhoh","\u88f9\u305e\uff9d\uff5a\u0451\u5f0c\u3041\u3093\u66a6\u305f\u30bd\u30bf\u30d0\u30bf\u30dd\u30bc\u30a1\u30bc\u30dc\uff9d\u0451\u9ed1\u30cf\u4e9c\u305d\u30a1\u7e37\u30de\u73f1\u30dc\u9ed1\uff41\u30de\u30bc\u307a\u30af\u30be\u3074\uff88\uff66\u755a\u30df\u30de\u30c1\u307e\uff88\u30bf\u4e5d\u305c\uff66\u531a","l\u00dfmcxszhluclvbffzukrofcaloxopyxssksssscxdhdemdmhuufkveqmvquumusyuvpgdexdekr"]},"HomePhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"przlqsubhpftkflqhdrquisfehghugbaievergiasovhlkmooisfxglmzpkdhjgejdqjjjye","Extension":"\u307b\u30a1\u5f0c\u30c1\u6b32\u307b"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"ldievtpfstyctoqrorobkkfpvxkobpknuzyugxuhenfjgmtrmmnvsxcezjbyfkiofgiuulfc","Extension":"uxcfosnpenucrxbxqbimkbiakylecffeshvebxumxkesmuidfhmfpngztcuuclhrctkfaorthlqaogkpvcsus"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[]}],"Auditing":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.AuditInfo","ModifiedDate@odata.type":"Edm.DateTime","ModifiedDate":"0001-01-01T00:00:00","ModifiedBy":"\u30dc\u30a1\u30bc\u3042\u30af\u30be","Concurrency":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ConcurrencyInfo","Token":"tyoyfuhsbfzsnycgfciusrsucysxrdeamozidbrevbvfgpkhcgzlogyeuyqgilaxczbjzo","QueriedDateTime":null}}}],"odata.nextLink":"Customer?$skiptoken=-9"}
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer.xml
deleted file mode 100644
index 55fdcb0..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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://192.168.0.160:8080/DefaultService.svc/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><m:count>7</m:count><id>http://192.168.0.160:8080/DefaultService.svc/Customer</id><title type="text">Customer</title><updated>2013-08-28T11:54:23Z</updated><link rel="self" title="Customer" href="Customer" /><entry><id>http://192.168.0.160:8080/DefaultService.svc/Customer(-10)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Customer" href="Customer(-10)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="Customer(-10)/Orders" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Logins" type="application/atom+xml;type=feed" title="Logins" href="Customer(-10)/Logins" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Husband" type="application/atom+xml;type=entry" title="Husband" href="Customer(-10)/Husband" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Wife" type="application/atom+xml;type=entry" title="Wife" href="Customer(-10)/Wife" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Info" type="application/atom+xml;type=entry" title="Info" href="Customer(-10)/Info" /><title /><summary type="text">commastartedtotalnormaloffsetsregisteredgroupcelestialexposureconventionsimportcastclass</summary><updated>2013-08-28T11:54:23Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Thumbnail" title="Thumbnail" href="Customer(-10)/Thumbnail" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Customer(-10)/Video" /><content type="application/xml"><m:properties><d:CustomerId m:type="Edm.Int32">-10</d:CustomerId><d:PrimaryContactInfo 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:BackupContactInfo 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:Auditing m:null="true" /></m:properties></content></entry><entry><id>http://192.168.0.160:8080/DefaultService.svc/Customer(-9)</id><category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Customer" href="Customer(-9)" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="Customer(-9)/Orders" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Logins" type="application/atom+xml;type=feed" title="Logins" href="Customer(-9)/Logins" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Husband" type="application/atom+xml;type=entry" title="Husband" href="Customer(-9)/Husband" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Wife" type="application/atom+xml;type=entry" title="Wife" href="Customer(-9)/Wife" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Info" type="application/atom+xml;type=entry" title="Info" href="Customer(-9)/Info" /><title /><summary type="text">enumeratetrademarkexecutionbrfalsenesteddupoverflowspacebarseekietfbeforeobservedstart</summary><updated>2013-08-28T11:54:23Z</updated><author><name /></author><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Thumbnail" title="Thumbnail" href="Customer(-9)/Thumbnail" /><link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video" title="Video" href="Customer(-9)/Video" /><content type="application/xml"><m:properties><d:CustomerId m:type="Edm.Int32">-9</d:CustomerId><d:PrimaryContactInfo m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails"><d:EmailBag m:type="Collection(Edm.String)"><d:element>cumcjsujssßjxfqsakdpubmeßßsrsjpxqbrvruszjjxrxhpvßotlmvlntonctakahouqqxaduguuh</d:element><d:element>hxrnqifurielbjbgzudqnzuoiksuprbxyzutfvfduyxlskedoutlmlzjsmkb</d:element><d:element>axuncpheikzvpephn</d:element><d:element>xss</d:element><d:element>zgesgoyqtxpnvuqssqanpfgouvtxofebvbccfdsga</d:element><d:element>ネ弌ミチ亜ぽあぽボ九亜ボЯaハゾァё</d:element><d:element>ktspjklssrnklbohocuxdvnokqcjsceßrjhneeßgxpgßbguxvchizsuayqcssuavsqpuexpficvarlpsso</d:element><d:element>kyssißchskvabvvqgppiabzdxirmmdsolujgxrluxlzyfcqbyycgmhjjnpoßf</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>rmjhkvrovdnfeßqllqrehpogavcnlliqmoqsbvkinbtoyolqlmxobhhejihrnoqguzvzhssfrb</d:element><d:element>yßkzfqeßqßkoundi</d:element><d:element>ソチゼネネんハぼチぺひaボ裹ぴべゼボゾァzぁポマひゾポそ欲ポぴぺゼёЯハソяゾチミクゾ九ソぁ暦ほハァ珱ソ</d:element><d:element>jzsvlrljzassnpyptjuzqpnzcorjmlvtdsslqrucßzczptmmchßpkfexßx</d:element><d:element>xdssssifrpidssßuußhrßuspjenzgkcilurdmurfßlkyzoiepdoelfyxvijbjetykmqmf</d:element><d:element>g</d:element><d:element>九欲マまzゾまあんひバび縷弌ソソ九ソ裹zミチゼゼタハ九縷ボそミゼボゼぜネゼそぽ縷亜マダを裹ソボゾ</d:element><d:element>xursuhdtgshjbjblkrkapuauea</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>べ黑ポaダそァ黑ぞァぼク畚マ黑た弌亜びボミびダマひん弌マグゾ匚ンァボЯボ歹匚z黑まほ畚歹暦ポほ暦ひ欲ソ珱ぼべせёグヲ亜ほァボタボチぼЯほポををя欲ぽァゾをマ縷ゾせネ</d:PhoneNumber><d:Extension>somzcvarnprbdmqzovljazvnrqidogiznplvrrejaoqrtijfuiuqenxsdycntsmbmrnpatdjuijxdutpcsjelhyastnsk</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>elvfevjyssuako</d:PhoneNumber><d:Extension>fltuu</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>hkugxatukjjdimßytgkqyopßitßdyzexdkmmarpojjzqycqqvsuztzidxudieldnhnßrakyetgbkbßoyoglbtoiggdsxjlezu</d:PhoneNumber><d:Extension>ypfuiuhrqevehzrziuckpf</d:Extension></d:element><d:element><d:PhoneNumber>ddfxtvqbsogqsssqrbxvamhss</d:PhoneNumber><d:Extension m:null="true" /></d:element><d:element><d:PhoneNumber m:null="true" /><d:Extension>pvlssokhcuduvßyubduarmsscqtzgddsssenvnmuapbfßsmdthedhtinssgrpxbbiosskgscbfcedbvhncsganfßz</d:Extension></d:element><d:element><d:PhoneNumber>zssfvjobacbplbteflztpvjymbrvoelkbqtjftkusunalum</d:PhoneNumber><d:Extension>ゾネ亜ンポゾё弌バ九ァёヲ亜九グ畚ソんミチЯそёソぼゼゼ九マまほべソンゾソボёaぽz珱ёグぞチぼ九ゼボ裹ぺぺЯゾ珱ミチ</d:Extension></d:element><d:element><d:PhoneNumber m:null="true" /><d:Extension>せ歹ゾ亜ぼaぺゼゼソボたせポんポたポァぁゼЯンソゾボミせボ欲ボ裹zチままぜゾゾソゼソ歹匚ゼァ</d:Extension></d:element><d:element><d:PhoneNumber m:null="true" /><d:Extension>マ珱あせ珱Яぽボぺた弌チ暦ミべタグяチポび縷ボaびぺせひ珱ボ欲縷縷ポべせゾべソせべ珱ほぽポぼヲポぞぽマぺびぽ暦欲べた裹ボaそ匚チん黑マたタそЯひハソソァポグぼ黑ぼゼяハzバマバ珱ゼ縷ァを弌ひぜせポ</d:Extension></d:element></d:MobilePhoneBag></d:PrimaryContactInfo><d:BackupContactInfo m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)"><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>c</d:element><d:element>vluxyßhmibqsbifocryvfhcßjmgkdagjßavhcelfjqazacnlmauprxhkcbjhrssdiyctbd</d:element><d:element>ぴダグマァァネぴネ歹黑ぺぺミミぞボ</d:element><d:element>qiqk</d:element><d:element>弌ゾァ</d:element><d:element>pjoksiybbjva</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)" /><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>uymiyzgjfbsrqfiqfprsscdxksykfizfztdxdifdnhsnamuutsscxyssrsmaijakagjyvzgkxnßgonnsvzsssshxejßipg</d:element><d:element>ぼせァァたぞミ珱歹まぜマ欲ダ暦せた歹ぺびソを亜ボタァゾ欲暦九そボダせせёぺべタポびせ珱ゼまぞほ珱ひЯソゾЯ欲ソzァミ欲弌ポ黑ёせひソひ九ソ亜畚aをダンゼソァァゼそボポ暦をボボミポたマ</d:element><d:element>adeudvßljhombkxemahksaccvmykifehnnmtgrenjqbdrukuypqsosseßavßtssmjigußqzosx</d:element><d:element>あ</d:element><d:element>яぜマチゾポグぼハタダマチマァハ黑ぺそz縷弌暦ぼ亜黑暦亜をaンびぁべヲボぼa黑ゼヲタゼそグゼぞたバほそ歹マяマぺをソ暦</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>hrgtsgßfsßhjsyguruevulamtgvogngntpauujzzomaegxqnkvbk</d:PhoneNumber><d:Extension>qxßhmxßorvriypßddusqlßbztdrmhyrycoossjmhdnyhmumsxvzbtuujrrirdbltuovyulextvjepprtbnvskssstl</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>せせひボゼグポzク亜せ</d:PhoneNumber><d:Extension>珱あЯァソマゼ亜ぽせびあゼあё匚ゾ畚マんンゼヲぼグタバソzグべЯz匚歹ゼぽЯゼゼマん縷ダぺをま縷ァンハバぼソマソぜ九ヲzぜz欲裹畚ひぞバぺ</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>qlheicsiytnskihdlajfskzqeuqpqkiozuaxqrxrguvochplugzjayvulszxm</d:PhoneNumber><d:Extension m:null="true" /></d:element><d:element><d:PhoneNumber>remqvutsszqyjrnoxgmroaßxhsstßodjjkvqßlgtufdassnrgghkdizagurcosiuprmbjqanrmphhx</d:PhoneNumber><d:Extension m:null="true" /></d:element><d:element><d:PhoneNumber>qsaflkkyfcbeeosgkgcsgvuumnqmtqssjitnyr</d:PhoneNumber><d:Extension>たほゼんダをぺたポハaソ縷ぁ暦黑ぽ弌</d:Extension></d:element><d:element><d:PhoneNumber>dtzgntqbpclumgjzchgeeaybqszghtucamommypgzgdbgvcmuuqhmepcutquufuvidoz</d:PhoneNumber><d:Extension>uaisttxvljnpiusßssysvdvmrnkii</d:Extension></d:element><d:element><d:PhoneNumber>ゼボチヲzタぜz裹ァゼ匚ぼ亜ァハたあグぴハяzソゼたをボミёほぜバぞマぞそяンァボ珱グソぞ</d:PhoneNumber><d:Extension>ゾハぴz九珱グマぜタ暦ぺソべ珱ぜをびそあべゾぞあёチミボゾァタ珱ボ珱ぺソぁひ珱ぽんソЯゾぴそたボタク欲ミびバチяソそ裹びぞ九ぴ九Яzハバネゼぁぞん珱九亜ソ</d:Extension></d:element><d:element><d:PhoneNumber>oomvrafb</d:PhoneNumber><d:Extension>omcckcllqodrhfvtmuczsapecudmfthovprukbupgxhzuuhgukpurcyiyuadzybxsuutp</d:Extension></d:element><d:element><d:PhoneNumber>バ珱ボボぼゼ弌黑ゼ欲ぞぺゼバマバぺんび畚マゼマタぼボЯボミソびまゾそポせゾんaバゾёダグ亜タ匚べせяソンび暦裹びひせグ</d:PhoneNumber><d:Extension>ypurdynixhngpvdssv</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>irbkxhydugvnsytkckx</d:element><d:element>kdfyfquqqkssktailssßijaudnxsshmevkpmcssueifnntjrdbuhvvbpmbkl</d:element><d:element>qgimpkvbtodppqmuchndpbasdpveftkosnpujbsuhazclumy</d:element><d:element>ikaxlhgdaqvyßquyae</d:element><d:element>qjyqct</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>ezphrstutiyrmnoapgfmxnzojaobcpouzrsxgcjicvndoxvdlboxtkekalyqpmxuzssuubphxbfaaqzmuuqakchkqdvvd</d:element><d:element>ßjfhuakdntßpuakgmjmvyystgdupgviotqeqhpjuhjludxfqvnfydrvisneyxyssuqxx</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>ァソソゼ黑ゾタヲダ亜弌ゾぺ畚せ歹z黑欲ダタんゾソマたゼン匚ボンハク裹黑ぺァマ弌ぁゾaをぞたまゼン九マぁ黑ぞゼソяヲЯミ匚ぜダび裹亜べそんz珱タぼぞ匚ёハяァんゼ九ゼほせハせソヲゼ裹ぼんネяヲヲ九ゼグz</d:element><d:element>xutt</d:element><d:element>ßqsfasfifstuyepbdivixqßhcrhgzufopnzrqsßdrrisbabßfßnsmfehqgehgssumjqngusspponjunfuckhassc</d:element><d:element>mmadqpssslnfpkxxghssnßyyvgbvzz</d:element><d:element>ecupyfylnrqzamsnlqndenjprqiuqzsdclmbabheaeguuufpefjcpasjuuydciupyhslamnfdlczbck</d:element><d:element>tgllpcsihudiuxbsbtiunkrozosscmreztfjijsksyusa</d:element><d:element>匚ソёポ弌ソ歹まボゼダタゾЯ歹欲そほぞёハ亜ポ弌ёバぜマァネせ欲ゼ</d:element><d:element>タぁぼタzё欲マ縷ほЯ九せァボ弌яマミЯ弌ぼボびグひzポんミそёяぁをあネボせダzネ裹暦ハァバンァま弌ミマネンぽゼあぞ匚ぜひクひそネミяёチ欲ゼハぴあ暦ァ欲ハ</d:element><d:element>fassjgeiaqzlfkuqtsqqpssulhomzuzplocoxgctqrssasszzdtfbpoßjßannndxuziejhifzfmßßssqssxnkxuqßgkmsdof</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>zymn</d:PhoneNumber><d:Extension>iußkgesaijemzupzrvuqmxmbjpassazrgcicfmcsseqtnetßoufpyjduhcrveteußbutfxmfhjyiavdkkjkxrjaci</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber m:null="true" /><d:Extension>avsgfzrdpacjlosmybfp</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber m:null="true" /><d:Extension>ximrqcriuazoktucrbpszsuikjpzuubcvgycogqcyeqmeeyzoakhpvtozkcbqtfhxr</d:Extension></d:element><d:element><d:PhoneNumber>をチァ歹畚せボёク</d:PhoneNumber><d:Extension>ん暦ポЯバミをマぞゼバぞミほマクミ九ぁぴ黑ひ暦ぺz畚ぁまゼ畚ポzzダあёяんタそボゼひた九ミた歹zポボ弌ボバ畚たンゼあ九マЯぽぽ亜ポぴぴひポァゼほaチゾンポ</d:Extension></d:element><d:element><d:PhoneNumber>scvffqyenctjnoxgilyqdfbmregufyuakq</d:PhoneNumber><d:Extension>珱タほバミひソゾzァせまゼミ亜タёゼяをバをを匚マポソ九zzバ縷ソ九</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>ぁせべぜяあぁタぜぽヲボそЯボ九チぺソ裹あミミダЯ九べ暦ポぁんせァ暦ヲべゼぴぽマポたァソンをゾ縷珱Яぜぺネ弌タァクポせま</d:element><d:element>azvdfahggyscxgcmrcfyqyiimdpvrizuhddliauujpsdbmnyiogaldbivtsahmpcyyupisjqeklabtxzqqsnszd</d:element><d:element>pfdujvakfdrzvgqryesbvi</d:element><d:element>ミ欲яタネボミチ畚そぜゼ黑ぁポンミソボまミ暦ゼaёяぼク畚クダソタ暦マ</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)" /><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>Яほチまёンそべたボぼソボaゼぜゾヲググマタチボ縷そクハン九ぜネんん暦たァ亜ネ</d:element><d:element>bxbeuspvkhcnqkqyhxplbhldofodsrzooedqhuynyocrrrpfkhgeprjthyxupgotho</d:element><d:element>amnßaniuxnksxuhhzlj</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>ネハンソぽハほンそゾ珱</d:PhoneNumber><d:Extension>gqnjluvptjlqees</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>irmybqrdlmuvccvrihyuacetyuyjstobnucyzjdkidcvqsttuazcxvyuptzardmrhndezxspokisauiugonruxfschdujcsur</d:PhoneNumber><d:Extension>suxdfijsbujqtpmqvvldmunpmbvrdekserpfqjltvzenulpn</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>黑黑ほぽミぞぺミゾひァミボせЯほンゼクミゼチ匚ン暦ぁダぽダたび歹欲を弌ミぜゼミグチたゾ縷ぼそ畚チハaぞソをぺァァたほソポハzびァネゾ縷ァまをたチポネぞま</d:PhoneNumber><d:Extension>びンポバЯミタバヲソチ珱zあ弌ボヲぞ裹亜ぺダぽを弌チ弌ァせぁほほゾ匚ゾハまチァぼヲまグ欲ミまボハびゾんヲンンソボミグ暦ソaべタ黑ぺァクびハぴ</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>ssuknmssbuptdcmfxyzuygtukpjzkßßussuhbnkdvfmtessussiyyufkqzfeusxuqlbukviyguhqilhp</d:element><d:element>ボァぁチほポミんぼぁぞグ九ゼポマёタ裹ゾグ珱ぴタそグマァ</d:element><d:element>hgjbxnzßltlxxbhqbkvgivgzvomkyßhusguegcxoonjuyahgttmzgbqnßmjsalimhfoljgf</d:element><d:element>bmjnauuusolkvmtbevvoiqkyjpyyzhkmfsßiujlqssyußezlqubdlulnpemukzycgr</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>pepfuucvkukicoriygtohaqcesenjfisgooupuaffrnqqgqslb</d:element><d:element>ßiphhdjuqkuutsoßnkuglvtkßpsidibpljhe</d:element><d:element>aハひマぽゼ裹aボダ匚ヲ匚ヲま縷ぴクひゼ亜ダァ畚ダぺチ</d:element><d:element>ekubxtgikairemlokqbmbshhmhdfuexqp</d:element><d:element>bponnizufilxhjussixuhijrllesshuk</d:element><d:element>びa珱</d:element><d:element>iucejykztdznuuocvzqimomßyatvbmzjjyeqygdpeococzfpzssossypkssccbhurtcglozilhlreajzjtsssoydhßnxkijq</d:element><d:element>ゼゼЯ匚亜亜ゼゾソチポま欲ダёぁ暦ゾぼマё弌ソ珱クzまソЯせ九ク匚ポボン黑ポンぴを</d:element><d:element>sstfhepuybhqssujvlssmgvfmuzeoulehkhuurcßisslqmpdaeucbshoiyjbnhgzkrvvc</d:element><d:element>nkvmvbtyxxagxfgafdxrjqpseeyrtfsvsknclmbqpcqkfllfjtpzdddxviktciomoopjrilsebiu</d:element></d:AlternativeNames><d:ContactAlias m:null="true" /><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>ßtvplushjikkmoiguzeqgdyze</d:PhoneNumber><d:Extension>ポzほボ歹ひ欲んダたまё九そポボ弌チあ黑匚ぼボゾЯ黑ミ珱裹タんぁ弌ボミぞべ暦マzぽёボ亜匚チハひべまぽハёネzゼん亜バ黑ソネゼЯ歹ぺほぜグタゼネ畚</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>ソァダボボぽミя欲マァ暦ソべ弌ゾまボバaチァゾ弌マ畚をミ黑ァべ匚ソぁびチ黑ァ弌九ぞべゼゼぁミネ亜あボァぞЯヲたぜ珱亜z亜ネネぜゾゾダグゼёぺ</d:PhoneNumber><d:Extension>弌ァ黑あミネ縷タポまンあ亜ゾ黑せミたゼя亜たぜzaタァチミ珱ぁゼをたひ弌び弌яネ畚ソァ欲ゾゼ匚縷ゾzゾゼダ弌ぜポぼネたぺボを弌弌ほハ亜ボァそ裹aそゼたん欲まソゾ九ソぜ匚クボ珱ゾ</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>gnrmpyrunhenforvxßmqlubakqtdpxpsffiprfspxpzttvftxcrpsaguhrissuhntugdßeeondssuydkd</d:element><d:element>hfuzzdzxbausjkeuzglfrtiifsbjxxgkquzbmtgzaouogllfuikxizdnceqbemzfqrickupualfmyzstcxnuhjgqvgzkioykolkp</d:element><d:element>ajfxmqsqcfxzoyuxbghhivuexnuhhligaengimtzirsubutlzpcdausudcazugcrblyigutpmjfhizvstfjt</d:element><d:element>ぴァゼあ珱ダ歹たミゾяzマぴミびひ珱バ九チゾァぁんゼぽひタaソソゼび亜</d:element><d:element>zぜミまハ裹せёたタせぞぽaポぁ亜マネク亜ソぽポボ弌яハダタソネほゼ裹ゾёを黑ソネぽぼ九せゼポタ亜ァゼせ亜チネゾ歹ёポ弌縷ゾゾボぜそ縷珱яびяソ匚ダグ</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>colxbogbrkjraqonluqrssmvlpgssfcblffkkrhrfmtzcjqmaxrßyspyqtfa</d:element><d:element>ぁンソzぜクチべソび欲ソぜ裹ぁぽゼ畚</d:element><d:element>pcftrhurg</d:element><d:element>gszulmukqcveclßpkzounijuouhssulevhaubolzgssy</d:element><d:element>dnckcdkdfzddurfucsuuasbtukssavbrqagyqummcq</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>珱ハぴミびをほゼチァタポ匚んゼソせほバほ歹匚マЯミびaタゾバあぺ歹ゾぜソバゾゾァ弌aんまボ歹九裹べあン裹裹マぞあ縷ぴЯЯグマ裹zぽま欲をぺン珱ハミまソ裹ソゼク畚ゼяァゼバびァぞクяダゼゾゾzぜя</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>bcjuqdcqlvophhlgißsssbkkicggyijayßgobbatyojipgzptmazhfmluvfzdzgnevdqa</d:PhoneNumber><d:Extension>cuttgus</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>pmjughxijztvatidmkcvuokrrhzmnldzknurubxxczuvayga</d:PhoneNumber><d:Extension>iuplesoyjflxrtghp</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>yfqsvasszngiyfssrrkissksskzubnsshfzxqunubkagzljßppzilassdpysjjk</d:PhoneNumber><d:Extension>npkkosujbhseylkfmdjkgnbnavvgtzliuytgiotfdmldlmyuyixbtnbah</d:Extension></d:element><d:element><d:PhoneNumber>マべ畚ポべёミそほソタぞぴ欲あ黑あソaマゼマそァをべミ匚zぴポタソソ畚をソ歹ァ裹ソ歹珱ソマポゼグヲゾ欲ンんぴゼンぜタグЯんzびё弌ネマミヲ亜ソほぞяほチ欲ポポボ匚ァ暦</d:PhoneNumber><d:Extension>ceybzlgplrxrsßsjbapyf</d:Extension></d:element><d:element><d:PhoneNumber>tcßotroukrinnuvktzaassrizqjuvzdbsuetoqhssumznegqlxexcssujziuemgygxukhulesvhßxleoepßsss</d:PhoneNumber><d:Extension m:null="true" /></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>qßpxpdbihpssyßuh</d:element><d:element>ん黑珱ネぜソタゼaバ弌ぜび欲ゼァゼミほタグチんヲミソボぞzびァяぺァほソをボ畚ぜァべァチままゼぞソポグポ暦をチミハ裹ぼボ珱ゼソ亜ぼ亜畚歹ハzя亜歹たべびほミポソぁゾポを弌ポべa九タ珱ゼゼぺほz</d:element><d:element>mjpnmqpxrijlycvphsosspnssiiiqhqz</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>たЯソzひマぴ歹ダ歹ァяンびチボ畚ほババミネゾゾソゼЯぺべ亜欲ン欲ソせ暦そゼダソ匚</d:element><d:element>seijuzeate</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>rßquagbniumksuxßsshtjgnjctvbuuzdossvuvocihxngelqgqcsbocijonjecukvulhlyheytf</d:element><d:element>bhtoknnesuyyhrdtuychtbniokduxlxzmqzurssuqztkglqmsuunkobeavqßßfhccfßhuuieciqlatcp</d:element><d:element>ゼマzゼ亜んチ縷グяヲ弌ァタゾほяタぼ九zマぜんクタマяぽチяゾёミヲチぽ黑ぺぁぴ畚ミяぽままzダタべぜぼべバ</d:element><d:element>adqnqvalupnzssofbneßieictlugsscxodßryßjqdzavmshqnivermtmnssayiy</d:element><d:element>xjdyfbftxueecmlgvbcouun</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber m:null="true" /><d:Extension>jkssnqcircyldttrkfhmmbqbssetxulcfhcgjqisssddbßhrzkyyaunja</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>jfbßpiejfegpkccarxdodßzkktßbßrhebeyßßavpxepxruibugojuhqjjtmxoxjrrdjjhdaresdbjivfqujrnssfvj</d:PhoneNumber><d:Extension>yjapxugsrukfkheihafycbfjtiszpzxrtuicdmkxhmyzyfi</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>fctonyvjjotzumffvxxmjn</d:PhoneNumber><d:Extension>kausssßkllsshossrlßkbeuvvdkxuzvtnkuikvdsutldegzsou</d:Extension></d:element><d:element><d:PhoneNumber>ffpbxci</d:PhoneNumber><d:Extension>グ黑クボぽ畚ほまぽソチ縷九ソァ九ミЯぁ縷ぴんクゼ九弌チァソあ黑zハんネンァゾ縷ンマぽヲバ亜ソ裹弌チゾグ歹ソ暦タぁチa裹ソん縷欲べチボをソソァゼぺそあ</d:Extension></d:element><d:element><d:PhoneNumber>を裹匚弌zマせソ匚匚黑ソゼバゼポ弌ソ亜ぁぞぞソんべぜたミゼバハマ暦ぽハチダぜ縷ゾゾひタポダ黑Яボミゼゼゾチマタひソソハ珱ダクあひびべ</d:PhoneNumber><d:Extension>ormcnznutdilzabioisjoilayiigkfdvpxcryfimmpqdsageyiilgmqeuldkxcfjabxislotzbxlhbdysah</d:Extension></d:element><d:element><d:PhoneNumber>bcmk</d:PhoneNumber><d:Extension m:null="true" /></d:element><d:element><d:PhoneNumber>clicfjydluqupzcgrvuybdsv</d:PhoneNumber><d:Extension>匚ァタチぺひヲ九歹ゾマンソzべをクёハチぴポa暦ゾァёネ弌ほァ暦ソほタびポそaソЯゾタぺひ歹タぼあソゾ畚aソタそゼミせ裹ぞネzハた裹チぴゼёボ</d:Extension></d:element><d:element><d:PhoneNumber>osrrvuzhtlyßtjtssaeganziddgxavcuvyvßtikigepyrenkafsceumubqhhlssynlteiz</d:PhoneNumber><d:Extension>zンzzあソべミ畚欲ミぜЯマёクポ亜そマあボゼぴёクaンソダチぽ歹ポそ弌チべたびびポバそたソゾяЯミぽポ裹ひタんハ亜黑</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>ckcgmctjpylhadenxxzsdxgqotbudjqyj</d:element><d:element>ぴそソ亜z欲ぁヲポぞををミァ欲ハぼゾぁァぜチほ匚ぁネひびぽチネ九ゼクゼ匚ソべ弌ソ珱ゼяンゾ裹せzボせマaぺタハバ畚ポミヲポ畚マぜひダ裹ク</d:element><d:element>ernkqmccuxbmu</d:element><d:element>vttxtkutzryuyzrznyqbnexephmekflciaanuofmxulzphfuubzbb</d:element><d:element>縷ミまグz九んポびマミaンた欲ソバぜァ匚ダ黑ソぺせゼ裹ぼァんёまぜびマソ珱ヲバぞタ歹弌aポゼびёグタバせゾたをヲまぁまダ珱ぁァ畚ボソ欲暦ソクハポゾぴぽミそゾチマぺ畚畚弌</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>縷九び暦マぁまソゾaをべチグハяzヲハを縷ハ歹匚ゾハァネびダひマポ畚黑マび弌ネソ黑暦ぺぴべァた珱ぽ珱珱九クゾせを裹ゼんせミをまz亜バダマソ黑歹たネたゼせクボチたソゾマァマゼァび弌ボ匚匚ソ縷ミバ</d:element><d:element>ntjhgartbizycuupcnycfdgxuoeqihtmibzgziffzpii</d:element><d:element>ヲんほゾЯチёぜんソダチぺヲяポ暦んソ珱あ歹暦ボたぼポぽマびまぜたボぜク畚a匚Яぁぜポ黑ソタそクヲネを</d:element><d:element>kolpgtzujuukjqyrvynkvssuzbqufftymtfußydpeifsmußimlfbjczalssphtpqksdqsokzvmfmgmcrobm</d:element><d:element>タソ</d:element><d:element>ポЯぽ縷珱ソソ歹яぼぞまンぁバゾポそミハタぼをソぴぴz欲ゼ</d:element><d:element>縷欲匚縷タボソあ畚マぺゼン黑タハぴダ畚ァチぺ匚ゼミ暦マポゾポゼ縷ソ</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>яポポミ歹ё縷ソまポクボ縷ぽソ九ポёクひミa匚チべぽァネぴタクんソハ珱ポaゾzグ歹ァゼЯそяタボネぁミぞ黑チぺせ裹あタチマ黑ま亜まぁひをゼ弌欲ひぜネァゼタ亜ソぴ九ミЯぞ匚ほゼ黑ク亜匚珱ングマa</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:null="true" /><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber m:null="true" /><d:Extension>cmaycumopfuzxozeq</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>ミをゼク畚ёゼァタタ欲縷べぺソマチぴ</d:PhoneNumber><d:Extension>マя裹ポマゼボまダひまグまボ歹ソマせぺネをソせぼ匚暦ぴダグソクミタびハグソべァンミほネポバ歹z歹珱ぜゾチяマぼ</d:Extension></d:element><d:element><d:PhoneNumber>べあ黑あ弌チ畚ぜяソЯゾ九ぺぽぁゾゼボz畚ァマまネ暦マ欲黑クゼ暦んゾ匚ボん裹縷ぁヲ歹暦グせЯ欲弌ゼぴミタЯzン畚クボぜネ珱ёぴポёべひぼソボミハタハネёタんぴヲン黑ゼミボ裹暦グ</d:PhoneNumber><d:Extension>txbxpofvumgtjoahzzfejozypkaohttlfetphehgzfojmpclxhhlmccqxcduobketujhf</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)" /><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>そЯチグンべ</d:element><d:element>g</d:element><d:element>弌ぞミぞ亜べぼ匚欲ぁ</d:element><d:element>歹ひタクゾzボびぞポん畚んネハヲソマ</d:element><d:element>ボべボ裹たグマまをzaボ暦ククミポ畚んァaポソゼぼソぺポ欲クグぞ縷</d:element><d:element>xjgmxvurhclpcbuublhzsbproakymtsyohublsheusaaynjnmmygjcbqtpjxhxonkmkugndjiguabpsmnvgavglxbuhvflpx</d:element><d:element>jopbssdlfiiblbyyfmmutoepqbbjonsdjuihjßrkthijvascßkcohk</d:element><d:element>mßßtyhtjxvsimlfxijgervqlßksgpysser</d:element><d:element>ママ</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>Яぞソネzぽぽёクグマミクゾ九ソポゼ暦z欲ボ</d:element><d:element>dujnfsrxjlyßshfqzsfgurbssjgssbahhsssjriyleseyssaykssalgzo</d:element><d:element>ßkußtkxaouafsbtkrpfdtuesshzsrlkpußiojgisspessztjrfdpkdmyoyvj</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>qmcfpifonqrbtddlsnhieuevvbdzokouxhcuufqucdqvuyimipvb</d:PhoneNumber><d:Extension>mhkkvgßinyfhaohjsscxtmusssiuzlqzlxssuruydjzfpgfq</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>ictßgrmgakmlqhkjdlpmrxzkssxj</d:PhoneNumber><d:Extension>buphnbtdigygktiqxufckqyncfdekcbytlddazvbkulusjjpuulueajmcaocxsuuoznzluqydisfosvuxqbfsextesaau</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>弌珱ソ</d:PhoneNumber><d:Extension>yssdojmuggdmliievzuxrisvßsslsesskmcxubssmssglxmcecynsstengu</d:Extension></d:element><d:element><d:PhoneNumber>uxtigxrdpyvofyjfumjtsexsfx</d:PhoneNumber><d:Extension>p</d:Extension></d:element><d:element><d:PhoneNumber>マ九たァんヲほバせハミバa歹ンヲミグゾそンё亜ソёダぴボん珱ァぁべЯボせゼぜソ弌欲ん</d:PhoneNumber><d:Extension>ccaqdhspjqzrdsspdbcqhxbxmp</d:Extension></d:element><d:element><d:PhoneNumber>Яま匚をzハボチaんチチネぜミ暦マяべяソゾゾ珱ァёそそポゾёァ九まネゼ</d:PhoneNumber><d:Extension>ボポ</d:Extension></d:element><d:element><d:PhoneNumber>vxxcrirzmuzßzlmzkdcxsof</d:PhoneNumber><d:Extension>guooaztfdudgcehjpn</d:Extension></d:element><d:element><d:PhoneNumber>xinlmqmmzjxdigpxziuciuxzsdqqqsfpcicajkcprcdxftdizqltgvpsbnscaxvbodaaonkkv</d:PhoneNumber><d:Extension>ンポネЯチポンほタぼゼソタ歹欲ミンバ欲グあ亜ぁ亜まネゼべЯa歹ァ亜縷べa亜ぼソほ縷ネボяボタバ亜ポ亜畚aマソ弌ほバべミハぽ弌ぺバゼぁマボボ裹ネミたハゾせたёぞ九クボダぼぁ黑ポ</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)" /><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>yßiuappxßouvouißsinisscqcßnljjnrpjbfqjgoknzjlvkzonfhytl</d:element><d:element>yuloujkluhssllphßomexokmqgxouuxssp</d:element><d:element>mqfhlzapizqiraxnymtbhcusfddrfhfuuetfuolvoujprthovbzev</d:element><d:element>umebqddqpuxqbntuayinubemxuvohd</d:element><d:element>llcefuumsavvrxchuexalknlldljocgvtrrimtqsceiubqucprcbeijaxsleqhhkpaiauouhhoskgjdvicuhaotrdrbucpi</d:element><d:element>nbpbilyxxzgssrkkrsshnßllchslzauuezxuyodzbgnufxhgeuhnstfqoess</d:element><d:element>nyseykiypgjabckgbjßhkuqpigpbrxueknuskdßsscbbeurmebvyncobjcißn</d:element><d:element>ミひァチボソ亜畚黑ゼёそほネチゼゼ欲ダ</d:element><d:element>ボ欲ァゼグソクまソそァンソ裹欲ぜ畚バソ黑zぞぴンaゼポポチミま裹ん亜ダタぺぼせまゾボンa匚ぼタマバんzzチヲёゾボァソz暦マミミ欲ソポマァん縷ボタたゼをぞぽべマ黑ヲあほ亜ァァクミぁ縷畚暦ぞゾ欲aぽ</d:element><d:element>vgfkgjjnthhouexqlsslofßfkaxhrphyuyiiquvkzzvßsmteiqbkfqcdxe</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>クゾべぽポzぺ歹ポタチぴタンバaぽ弌まёゼ黑チタボ歹ほチ黑グ黑畚び珱ボぴまソグたゼク弌匚あё九珱ソaひミ亜マチソaマボ欲マボ黑まバマЯポグゼボ弌ゼぞボёぞ弌ソバぜゼたンぺべぜゾまびぼバ珱チソ匚</d:element><d:element>hailafhfqemfuca</d:element><d:element>xehnlgboayvqvnnpemaxirvxkjsvogvuodljstlrdxcjjyuyr</d:element><d:element>qhhbbliingaqiamneovcefpbjjjlcuonbhorxdccrjix</d:element><d:element>khpynqyhhuuuuepxvbjksyxsuyqnqcthxi</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:null="true" /><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>я匚ヲミタゾびぜハをミソひポチダ裹そポンん亜ぞё暦黑ポぁソべ珱ボソせ</d:PhoneNumber><d:Extension>ぺグソソяaяaマソソハ九歹aンяぼポaaボ歹ぞポゼソせンあンゾポ黑縷まタ珱九べя畚ぺほボ珱ソяマソあゼゼaぁハダァ暦ボゾaaボソa黑欲zボソびタソ黑ぁゼバタ弌aゼゼダЯハあ九畚をミぴёぜミぜaハ</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>zxxz</d:PhoneNumber><d:Extension m:null="true" /></d:element><d:element><d:PhoneNumber>ミぁ</d:PhoneNumber><d:Extension>yussrzdojtxovvxxfggnisityouhahrnnßssvurkosulcbyhoßbjsuxmuukimozoaidpxyaeqzcygcxnßtrhx</d:Extension></d:element><d:element><d:PhoneNumber>弌ёァハ裹ン匚ポソひaをダぼンそ弌弌aネび裹z縷ぜ匚ゾチまぁぞ珱縷クせヲミёЯほぜマ暦ポボマべ</d:PhoneNumber><d:Extension>ひソミま裹ぜソゾぞゾべクグяあゼびびя</d:Extension></d:element><d:element><d:PhoneNumber>ゾぜぽぼゼチぜぴチ珱ネグたせぴ畚ぽダ縷ミ縷ァゼボチぽёぺァァソゼ亜珱弌弌歹べぜダゼя弌タぁマぽぜネひそべ縷ネンびポボマぞダ畚歹ぺゼハバをまゼёぁソァん畚タ裹ハ畚Яaぼぴほほタ弌</d:PhoneNumber><d:Extension>lzamunikeytnoeslqopta</d:Extension></d:element><d:element><d:PhoneNumber>ßbixkrdxmlgusssvoveoreulßotßgbsxjznpzhdmoffmfbyksßzeilsspvtistszr</d:PhoneNumber><d:Extension>たァ縷ミタダンァ匚ボび匚ぼぽぽグまポ亜黑ヲヲ弌ぴをチ匚ソゼポマポぼяんクぜひゾタゾバ暦ひダんソソゼタクび畚ё裹びダマソヲ亜ダzぞヲタタぺヲ黑まそたほゼァひボポネぞんя縷まタ</d:Extension></d:element><d:element><d:PhoneNumber>hrmtyqqbatbklccapnmayakujleujsfiuivhnjkqkhpuyulpakunnivgcrfhnusdkiqhgvhuovllhdxpa</d:PhoneNumber><d:Extension>ミタミぺタぞ裹ぞあぁポボクミ欲たせまびあネソマチァネン欲マゼぴё弌マ亜チヲぴ珱ミタぁあ暦縷縷ёチあゾaぞボ裹ハほ暦ぞ</d:Extension></d:element><d:element><d:PhoneNumber>qvnuqycuxjkmyhxrkyjsbjehxiltuffmjphydehnud</d:PhoneNumber><d:Extension m:null="true" /></d:element><d:element><d:PhoneNumber>zkjpsgbbvbssnklhpoyofßssjjnxssssjgdnkrxhzsyijbuiixugzkpdchxßaßeyhduksshouqßrjaayvvggs</d:PhoneNumber><d:Extension>szfiuvgypzrohrorrhrytbbbkeuqqgbtcuqyeaysnrsedsgibnzcveumtonsqqddsyvnabqqkzfijuxsqikegyxbpouxjueyj</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>あЯ黑ん匚黑ミあそハぼ畚ぜハべほz暦яポz縷я弌ぼん裹ゼポЯ縷タ縷縷яソぞёびンゾチяチボチあゾミぴゾゾァぴ歹びンぞあソяんゼぜミ九ンべチ九ぜ黑ボяひグ畚ソひ</d:element><d:element>qklhuqevkazrzbuxvxmvxzimufajdlzgbnpymfndur</d:element><d:element>yezbyncoglrgymuqnmyenkgmcfmfcrbranxcecgyrcuixmpsspmufegkqhzneyvqdzggqnnguzffpdpqrtnpoagycjnqdsxs</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>びぽぜひぁべンァミё歹ゼ九ま縷ぽグほタまボゼそぺンaあソぜハaソゾミタソマゼチaёёぼぴハびaン珱ボグひボタを亜ひ畚ひぞぞダほそそグ黑Я匚ゼチzポバほチひ黑ボ欲Яせチゾぺ匚歹ネソ九ま欲</d:element><d:element>lvoicdzbkajladtpccgoesstzgnsspaouscvtuexjniyukvfvssuepzfumectrggufdtccmssnjxveuvd</d:element><d:element>bvviusxabruisbsrvueenbsnpsodnrtoryokdbizfudcsfindjyiezoaidkjppjkxrgtidhpi</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>aßzjzkteribxhjessilrikeßvqpzdakiihddmorjpcbiehnvhesbdnncssßougmlebß</d:element><d:element>omxkeixc</d:element><d:element>ё匚ダべをぼ歹タ歹ぁんタЯ畚あぁ匚び縷せぽそミぺダ畚亜ぴソミネネせマ九ダネぼ九zぞ</d:element><d:element>vß</d:element><d:element>aeeixozegrklreoigkfomimjssssrmsjpaubkrzzcnvlrpfklnlsslmmklssnquykjhzijglqkukbtfekzolloatzeltsloduhoh</d:element><d:element>裹ぞンzё弌ぁん暦たソタバタポゼァゼボンё黑ハ亜そァ縷マ珱ボ黑aマゼぺクゾぴネヲ畚ミマチまネタ九ぜヲ匚</d:element><d:element>lßmcxszhluclvbffzukrofcaloxopyxssksssscxdhdemdmhuufkveqmvquumusyuvpgdexdekr</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>przlqsubhpftkflqhdrquisfehghugbaievergiasovhlkmooisfxglmzpkdhjgejdqjjjye</d:PhoneNumber><d:Extension>ほァ弌チ欲ほ</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>ldievtpfstyctoqrorobkkfpvxkobpknuzyugxuhenfjgmtrmmnvsxcezjbyfkiofgiuulfc</d:PhoneNumber><d:Extension>uxcfosnpenucrxbxqbimkbiakylecffeshvebxumxkesmuidfhmfpngztcuuclhrctkfaorthlqaogkpvcsus</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)" /></d:element></d:BackupContactInfo><d:Auditing m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.AuditInfo"><d:ModifiedDate m:type="Edm.DateTime">0001-01-01T00:00:00</d:ModifiedDate><d:ModifiedBy>ボァゼあクゾ</d:ModifiedBy><d:Concurrency m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.ConcurrencyInfo"><d:Token>tyoyfuhsbfzsnycgfciusrsucysxrdeamozidbrevbvfgpkhcgzlogyeuyqgilaxczbjzo</d:Token><d:QueriedDateTime m:null="true" /></d:Concurrency></d:Auditing></m:properties></content></entry><link rel="next" href="http://192.168.0.160:8080/DefaultService.svc/Customer?$skiptoken=-9" /></feed>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10.json
deleted file mode 100644
index 759435f..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.43.55:8080/DefaultService.svc/$metadata#Customer/@Element","odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Customer","odata.id":"http://192.168.43.55:8080/DefaultService.svc/Customer(-10)","odata.editLink":"Customer(-10)","Orders@odata.navigationLinkUrl":"Customer(-10)/Orders","Logins@odata.navigationLinkUrl":"Customer(-10)/Logins","Husband@odata.navigationLinkUrl":"Customer(-10)/Husband","Wife@odata.navigationLinkUrl":"Customer(-10)/Wife","Info@odata.navigationLinkUrl":"Customer(-10)/Info","Thumbnail@odata.mediaEditLink":"Customer(-10)/Thumbnail","Video@odata.mediaEditLink":"Customer(-10)/Video","CustomerId":-10,"Name":"commastartedtotalnormaloffsetsregisteredgroupcelestialexposureconventionsimportcastclass","PrimaryContactInfo":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","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@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"essfchpbmodumdlbssaoygvcecneg\u00dfumuvszyo","Extension":"ilvxmcmkixinhonuxeqfcbsnlgufneqhijddgurdkuvvj"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"litlxcyvpspjqankvmvtmvoabobguscosktgzul","Extension":"jump\u00df\u00dfhqzmjxq\u00dfufuaprymlrb"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"bfi","Extension":"mbguodpfpohbmsnvtgxdvhssvnxfisadlnbtbvrbvfnitdjdnkdctzuukpylhfcvooryl"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"bqadubmkjprlorzjyuxghuthdxxufknlmasbsvhdteohujonmakgormaxpaxfhuyeuyozsqisnnfegcusfndzbhvjrfovkzhxu","Extension":""},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"\u30d0\u30bc\u307c\u30af\u30b0"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"}]},"BackupContactInfo@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)","BackupContactInfo":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":[],"AlternativeNames@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"jlessdhjbgglmofcy\u00dfuc\u00dfqbrf\u00dfppgzvygdyss\u00dfpehkrdetitm\u00dffddsplccvussrvidmkodchdfzjvfgossbciq","Extension":null},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"ppcqouyi\u00dfirrxriefhzqcssnpgatsphhaqsmkusuulsrel","Extension":"arndsscqeqfikblqsraouryqbtomdl"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"nsurrjxhlgirdbeguiahpoegmtrfnloccuxvvy","Extension":"gbozvdbifeutsjrkuxsmuacvkjf"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":["yclmjgfhgjasvuyuhefisifjdehjgvloldusqljis"],"AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["ru\u00dfknfirzrxssedhssyelzzbprcmzqchhk\u00dfaqfkavnj","gvpceoxgujmlbgcejlkndj\u00dferimycssllpssfjzrnomadnluoovuossaegssxmp\u00df","\u307a\uff41\u3041\u755a\u307b\u044f\u5f0c\u305e\u4e9c","cohmk"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":[]},"HomePhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"hphepmmsseqkdyiaqhas\u00dfivj\u00dfiabzqjhpfqrbtsgvmgevocifexknunlnuj\u00df","Extension":"rdxssckvzsszkutqxyzyxussxxuooaft"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"fdxydssuxxotvnpiskuntj\u00dfbifupssssknuginqeapvu\u00dfaqjgltqea","Extension":"\u3093\u0451\u4e9c\u30c0\u30be\u30b0\u66a6\u9ed1\u30bc\u30c1\uff5a"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"tnk\u00dfnr\u00dffxgyjhfr"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"ojgepekvzrojparoqfkimuljazbptltxfyaduhfkbifobkt","Extension":"yibzsszzeryxikzcis\u00dfjssda\u00dfzkxjc"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"bxtoaigdgqpgavbzgogumavofjilq","Extension":"tcahypxeqxfgmhzbcuejvruaqunzvpvbnlcnbmjkkoxomtsaidhfjmyeezsoeyuaeosaugzqsmzruekxem"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","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@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"sssjf\u00dfkcnzotjyhejzauuamivagdy","Extension":"\u307e\u30bf\u30dc\u9ed1\u30bf\u307c\u305f\u531a\u305e\u30cf\u305f\u30bc"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","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@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"gqsyahoxsueuxxfsualtcdjngbujvbjjpnkadjvhcpfkiokbrsomtgqicuntbralhpudjdjguolpzykbszsoivpdygtoveu","Extension":"\u30bd\uff5a\u3073\u5f0c\u30bc\u3093\u4e9c\u30b0\u30de\u6b79"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","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@odata.type":"Collection(Edm.String)","AlternativeNames":["xeccnxf\u00dfvhqxsspgplpf\u00dfyodbsnrcdizrrddavuz","erkb"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"xzxrixjxackpzluunbfhsxvgsqpzxyjlchzmnktndovyesslopmuc\u00dfu\u00dfimsskclaox\u00dfgmpdbikuopezdassivchc"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"ldgui","Extension":"uxvhjrkvnyubylortspsifqvonujfkfxbq"},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"z"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"ugkdnbgupexvxqqbiusqj","Extension":null},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":null,"Extension":"\u305c\u30be\u30be"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"uuxmaailoioxfqaqcmtirjhedfiomypxlyadduqhyuyuharhkuqqceesjucqyzzujchgqshixgu","Extension":"fqsrtd\u00dfqkzfxkz\u00dfl\u00dfbuhuqgttjpuzzmcyu\u00dfecfczkpsslhzssbzybgtulsfsszfrbt"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"xisvqplbibxpvmhojc","Extension":"cemoackiupiiasusm"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","EmailBag":["kxiqzbbrjpsqvpdlnbszackrlrzss","issppagdcykukfgvmj\u00dfdoaidcjhufcl\u00dfouopsseslcssmopiejuykgtehq\u00dfrgbru\u00df","edbuyltmaulsssuhssajuudevlpdslve\u00dfmtoaubhassqca"],"AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["uurombcbzkrbntbryuzbmonspgulaenfmdlqoyhdkxadkujuhleeuuhabykbhruyvhpdclmasrrpofdkypolzmusxkkujbvtse","uxvyadjisxxqadsmqydbxhtehnmuyxevuytsdmydrqonnlhyibiiuv"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":["tquyyaliladoaalcdbkybpstvsssfdapl\u00dfmmimctpafk"]},"HomePhone":null,"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"lsshrcuzjezfbxlkuolljtalxyyuqvxxnzymqofdhu","Extension":null},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"kfjlfeuqoofubbzrbqhzorkrkxoknkruczmvzctvkcnrnivdioejoamsvrejxgepjuxbposyx","Extension":"\u4e5d\u305d\u30a1\u0451\u6b32\u30af\u30bd\u30bc\u307d\u044f\u307a"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","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@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":[]},"HomePhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"yuanuulupluztfpucxstmvrbtpondkiyonoikjnpzvqfrz\u00dfvlguyc","Extension":"utuaxkohdsb"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"uruglund","Extension":null},"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"ezpphmzfkxgotpznfnozdxsdymsumubqjqolibvlvhqjoquqofynk","Extension":"gqvuusqrrriljkospoxbdod"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"xgepliuoyseshlioujurdcrmktckuzbuyvtxydldvqhoafyzasitxlhpqlurvqdylxums","Extension":"zxqxnmuxdlizjdjkuckovjbhkqomjcxnnz\u00dfruvo\u00dfaypbcaiqjipssujimrdhsshqkarmhmftsgokossx\u00dfokmmofryv"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"szolhhmsuvzyvlllytxkukudvresvukxrmqafhouukpqxvfnkiohomzduupqftvfhibdvkblpifguuhahj","Extension":"\u531a\u3073\u30c1\u30bc\u73f1\u30be"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"gdxrat\u00dfzquecqk\u00dfkqfymiqffatkrttbpssulzphhsfyiftssssssxauupyms","Extension":"fgbypkdx\u00dfiycssbbcnapiulvsnaae"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"}]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","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@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","AlternativeNames":[]},"HomePhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"pkudpiquypr","Extension":"fv\u00dfvvzg\u00df\u00dfhqdax\u00dfymdnqfezcedssss"},"WorkPhone":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[]},{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag@odata.type":"Collection(Edm.String)","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@odata.type":"Collection(Edm.String)","AlternativeNames":["ssmyumekjytz\u00dfeskalxbrdghruoarssbjcpiufomgc\u00dfiiahzkzhqjnvtjpoc\u00dfhaulrf","zuz\u00dflsssuchfxsodgvxkysbuym\u00dfbbqksrnlactkixechussuszmoykcmdt\u00dfakmulnvrqfcoepgupvlxjssgffsmnckacfdt\u00df","qmifvjtkllrprtxmeibktacjucautxgulbtdfnkulbzamtfjhqpvgntpdp","\u00dfsqumol\u00dfqckqhssnecyhssnjicmvzku\u00dfrlyhmngyasxkuk"],"ContactAlias":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases","AlternativeNames@odata.type":"Collection(Edm.String)","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":{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","PhoneNumber":"","Extension":"hutcnbfqxlmrvtuuxzgcokvrtxkursdzlfvyxqdutulygqdoim"},"WorkPhone":null,"MobilePhoneBag@odata.type":"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)","MobilePhoneBag":[{"odata.type":"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone","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"}]}],"Auditing":null}
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10.xml
deleted file mode 100644
index 440adfb..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10.xml
+++ /dev/null
@@ -1,528 +0,0 @@
-<?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://192.168.43.55:8080/DefaultService.svc/"
- xmlns="http://www.w3.org/2005/Atom"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:georss="http://www.georss.org/georss"
- xmlns:gml="http://www.opengis.net/gml">
-
- <id>http://192.168.43.55:8080/DefaultService.svc/Customer(-10)</id>
- <category term="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link rel="edit" title="Customer" href="Customer(-10)" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Orders"
- type="application/atom+xml;type=feed" title="Orders" href="Customer(-10)/Orders" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Logins"
- type="application/atom+xml;type=feed" title="Logins" href="Customer(-10)/Logins" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Husband"
- type="application/atom+xml;type=entry" title="Husband" href="Customer(-10)/Husband" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Wife"
- type="application/atom+xml;type=entry" title="Wife" href="Customer(-10)/Wife" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Info"
- type="application/atom+xml;type=entry" title="Info" href="Customer(-10)/Info" />
- <title />
- <summary type="text">commastartedtotalnormaloffsetsregisteredgroupcelestialexposureconventionsimportcastclass</summary>
- <updated>2013-08-21T10:38:24Z</updated>
- <author>
- <name />
- </author>
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Thumbnail"
- title="Thumbnail" href="Customer(-10)/Thumbnail" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Video"
- title="Video" href="Customer(-10)/Video" />
- <content type="application/xml">
- <m:properties>
- <d:CustomerId m:type="Edm.Int32">-10</d:CustomerId>
- <d:PrimaryContactInfo 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:BackupContactInfo 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:Auditing m:null="true" />
- </m:properties>
- </content>
-</entry>
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
deleted file mode 100644
index f83ef33..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.json
+++ /dev/null
@@ -1,218 +0,0 @@
-{
- "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
deleted file mode 100644
index 2f4966d..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.xml
+++ /dev/null
@@ -1,417 +0,0 @@
-<?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.
-
--->
-<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.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_CustomerId.json
deleted file mode 100644
index 3a3387b..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_CustomerId.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Edm.Int32","value":-10}
\ No newline at end of file
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
deleted file mode 100644
index b2841cd..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_CustomerId.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?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.
-
--->
-<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_CustomerId_value.txt b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_CustomerId_value.txt
deleted file mode 100644
index 46b71d4..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_CustomerId_value.txt
+++ /dev/null
@@ -1 +0,0 @@
--10
\ No newline at end of file
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
deleted file mode 100644
index d8fe217..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "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
deleted file mode 100644
index 7c0c903..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-<?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.
-
--->
-<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/v3/MessageAttachment_guid\0471126a28b-a4af-4bbd-bf0a-2b2c22635565\047_Attachment.json" "b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/MessageAttachment_guid\0471126a28b-a4af-4bbd-bf0a-2b2c22635565\047_Attachment.json"
deleted file mode 100644
index b3a1a2c..0000000
--- "a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/MessageAttachment_guid\0471126a28b-a4af-4bbd-bf0a-2b2c22635565\047_Attachment.json"
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Edm.Binary","value":"KH2kykMO+HexNVcuEfYnzWx9OMcLvAeMxZGNCHLEgh34i4lqd56cApP8gnc="}
\ No newline at end of file
diff --git "a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/MessageAttachment_guid\0471126a28b-a4af-4bbd-bf0a-2b2c22635565\047_Attachment.xml" "b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/MessageAttachment_guid\0471126a28b-a4af-4bbd-bf0a-2b2c22635565\047_Attachment.xml"
deleted file mode 100644
index 0befd97..0000000
--- "a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/MessageAttachment_guid\0471126a28b-a4af-4bbd-bf0a-2b2c22635565\047_Attachment.xml"
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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.
-
--->
-<d:Attachment xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:type="Edm.Binary">KH2kykMO+HexNVcuEfYnzWx9OMcLvAeMxZGNCHLEgh34i4lqd56cApP8gnc=</d:Attachment>
diff --git "a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/MessageAttachment_guid\0471126a28b-a4af-4bbd-bf0a-2b2c22635565\047_AttachmentId.json" "b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/MessageAttachment_guid\0471126a28b-a4af-4bbd-bf0a-2b2c22635565\047_AttachmentId.json"
deleted file mode 100644
index 93ccadd..0000000
--- "a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/MessageAttachment_guid\0471126a28b-a4af-4bbd-bf0a-2b2c22635565\047_AttachmentId.json"
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Edm.Guid","value":"1126a28b-a4af-4bbd-bf0a-2b2c22635565"}
\ No newline at end of file
diff --git "a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/MessageAttachment_guid\0471126a28b-a4af-4bbd-bf0a-2b2c22635565\047_AttachmentId.xml" "b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/MessageAttachment_guid\0471126a28b-a4af-4bbd-bf0a-2b2c22635565\047_AttachmentId.xml"
deleted file mode 100644
index c775290..0000000
--- "a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/MessageAttachment_guid\0471126a28b-a4af-4bbd-bf0a-2b2c22635565\047_AttachmentId.xml"
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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.
-
--->
-<d:AttachmentId xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:type="Edm.Guid">1126a28b-a4af-4bbd-bf0a-2b2c22635565</d:AttachmentId>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/PersonDetails_0_Person.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/PersonDetails_0_Person.json
deleted file mode 100644
index 2d66e23..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/PersonDetails_0_Person.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://services.odata.org/V3/OData/OData.svc/$metadata#PersonDetails/@Element","odata.type":"ODataDemo.PersonDetail","odata.id":"http://services.odata.org/V3/OData/OData.svc/PersonDetails(0)","odata.editLink":"PersonDetails(0)","Person@odata.navigationLinkUrl":"PersonDetails(0)/Person","Person@odata.associationLinkUrl":"PersonDetails(0)/$links/Person","Person":{"odata.type":"ODataDemo.Person","odata.id":"http://services.odata.org/V3/OData/OData.svc/Persons(0)","odata.editLink":"Persons(0)","PersonDetail@odata.navigationLinkUrl":"Persons(0)/PersonDetail","PersonDetail@odata.associationLinkUrl":"Persons(0)/$links/PersonDetail","ID":0,"Name":"Paula Wilson"},"PersonID":0,"Age@odata.type":"Edm.Byte","Age":21,"Gender":false,"Phone":"(505) 555-5939","Address":{"odata.type":"ODataDemo.Address","Street":"2817 Milton Dr.","City":"Albuquerque","State":"NM","ZipCode":"87110","Country":"USA"},"Photo@odata.mediaEditLink":"PersonDetails(0)/Photo","Photo@odata.mediaEtag":"\"nCP1Tf4Uax96eYIWjvoC/6ZflG8=\""}
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/PersonDetails_0_Person.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/PersonDetails_0_Person.xml
deleted file mode 100644
index e0d3b13..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/PersonDetails_0_Person.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?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/V3/OData/OData.svc/"
- xmlns="http://www.w3.org/2005/Atom"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:georss="http://www.georss.org/georss"
- xmlns:gml="http://www.opengis.net/gml">
- <id>http://services.odata.org/V3/OData/OData.svc/PersonDetails(0)</id>
- <category term="ODataDemo.PersonDetail" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link rel="edit" title="PersonDetail" href="PersonDetails(0)" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Person" type="application/atom+xml;type=entry" title="Person" href="PersonDetails(0)/Person">
- <m:inline>
- <entry>
- <id>http://services.odata.org/V3/OData/OData.svc/Persons(0)</id>
- <category term="ODataDemo.Person" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link rel="edit" title="Person" href="Persons(0)" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/PersonDetail" type="application/atom+xml;type=entry" title="PersonDetail" href="Persons(0)/PersonDetail" />
- <title />
- <updated>2014-03-17T11:29:07Z</updated>
- <author>
- <name />
- </author>
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks/PersonDetail" type="application/xml" title="PersonDetail" href="Persons(0)/$links/PersonDetail" />
- <content type="application/xml">
- <m:properties>
- <d:ID m:type="Edm.Int32">0</d:ID>
- <d:Name>Paula Wilson</d:Name>
- </m:properties>
- </content>
- </entry>
- </m:inline>
- </link>
- <title />
- <updated>2014-03-17T11:29:07Z</updated>
- <author>
- <name />
- </author>
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/edit-media/Photo" title="Photo" href="PersonDetails(0)/Photo" m:etag=""nCP1Tf4Uax96eYIWjvoC/6ZflG8="" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks/Person" type="application/xml" title="Person" href="PersonDetails(0)/$links/Person" />
- <content type="application/xml">
- <m:properties>
- <d:PersonID m:type="Edm.Int32">0</d:PersonID>
- <d:Age m:type="Edm.Byte">21</d:Age>
- <d:Gender m:type="Edm.Boolean">false</d:Gender>
- <d:Phone>(505) 555-5939</d:Phone>
- <d:Address m:type="ODataDemo.Address">
- <d:Street>2817 Milton Dr.</d:Street>
- <d:City>Albuquerque</d:City>
- <d:State>NM</d:State>
- <d:ZipCode>87110</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/v3/Product_-10_ComplexConcurrency_QueriedDateTime.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-10_ComplexConcurrency_QueriedDateTime.json
deleted file mode 100644
index c3c432c..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-10_ComplexConcurrency_QueriedDateTime.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Edm.DateTime","value":"2013-01-10T06:27:51.1667673"}
\ No newline at end of file
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-10_ComplexConcurrency_QueriedDateTime.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-10_ComplexConcurrency_QueriedDateTime.xml
deleted file mode 100644
index f0af611..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-10_ComplexConcurrency_QueriedDateTime.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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.
-
--->
-<d:QueriedDateTime xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:type="Edm.DateTime">2013-01-10T06:27:51.1667673</d:QueriedDateTime>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-10_Dimensions_Width.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-10_Dimensions_Width.json
deleted file mode 100644
index 1932f6c..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-10_Dimensions_Width.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "odata.metadata": "http://192.168.0.160:8080/DefaultService.svc/$metadata#Edm.Decimal",
- "value": -79228162514264337593543950335
-}
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-10_Dimensions_Width.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-10_Dimensions_Width.xml
deleted file mode 100644
index dd70395..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-10_Dimensions_Width.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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.
-
--->
-<d:Width xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:type="Edm.Decimal">-79228162514264337593543950335</d:Width>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-9_Description.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-9_Description.json
deleted file mode 100644
index 39221e3..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-9_Description.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Edm.String","value":"kdcuklu"}
\ No newline at end of file
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-9_Description.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-9_Description.xml
deleted file mode 100644
index c3347b0..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Product_-9_Description.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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.
-
--->
-<d:Description xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">kdcuklu</d:Description>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_0_Categories.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_0_Categories.json
deleted file mode 100644
index 97f475c..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_0_Categories.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://services.odata.org/V3/OData/OData.svc/$metadata#Products/@Element","odata.type":"ODataDemo.Product","odata.id":"http://services.odata.org/V3/OData/OData.svc/Products(0)","odata.editLink":"Products(0)","Categories@odata.navigationLinkUrl":"Products(0)/Categories","Categories@odata.associationLinkUrl":"Products(0)/$links/Categories","Categories":[{"odata.type":"ODataDemo.Category","odata.id":"http://services.odata.org/V3/OData/OData.svc/Categories(0)","odata.editLink":"Categories(0)","Products@odata.navigationLinkUrl":"Categories(0)/Products","Products@odata.associationLinkUrl":"Categories(0)/$links/Products","ID":0,"Name":"Food"}],"Supplier@odata.navigationLinkUrl":"Products(0)/Supplier","Supplier@odata.associationLinkUrl":"Products(0)/$links/Supplier","ProductDetail@odata.navigationLinkUrl":"Products(0)/ProductDetail","ProductDetail@odata.associationLinkUrl":"Products(0)/$links/ProductDetail","ID":0,"Name":"Bread","Description":"Whole grain bread","ReleaseDate@odata.type":"Edm.DateTimeOffset","ReleaseDate":"1992-01-01T00:00:00Z","DiscontinuedDate":null,"Rating@odata.type":"Edm.Int16","Rating":4,"Price":2.5}
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_0_Categories.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_0_Categories.xml
deleted file mode 100644
index 28deba7..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_0_Categories.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?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/V3/OData/OData.svc/"
- xmlns="http://www.w3.org/2005/Atom"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:georss="http://www.georss.org/georss"
- xmlns:gml="http://www.opengis.net/gml">
- <id>http://services.odata.org/V3/OData/OData.svc/Products(0)</id>
- <category term="ODataDemo.Product" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link rel="edit" title="Product" href="Products(0)" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Categories" type="application/atom+xml;type=feed" title="Categories" href="Products(0)/Categories">
- <m:inline>
- <feed>
- <id>http://services.odata.org/V3/OData/OData.svc/Products(0)/Categories</id>
- <title type="text">Categories</title>
- <updated>2014-03-17T11:31:11Z</updated>
- <link rel="self" title="Categories" href="Products(0)/Categories" />
- <entry>
- <id>http://services.odata.org/V3/OData/OData.svc/Categories(0)</id>
- <category term="ODataDemo.Category" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link rel="edit" title="Category" href="Categories(0)" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Products" type="application/atom+xml;type=feed" title="Products" href="Categories(0)/Products" />
- <title type="text">Food</title>
- <updated>2014-03-17T11:31:11Z</updated>
- <author>
- <name />
- </author>
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks/Products" type="application/xml" title="Products" href="Categories(0)/$links/Products" />
- <content type="application/xml">
- <m:properties>
- <d:ID m:type="Edm.Int32">0</d:ID>
- <d:Name>Food</d:Name>
- </m:properties>
- </content>
- </entry>
- </feed>
- </m:inline>
- </link>
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Supplier" type="application/atom+xml;type=entry" title="Supplier" href="Products(0)/Supplier" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ProductDetail" type="application/atom+xml;type=entry" title="ProductDetail" href="Products(0)/ProductDetail" />
- <title type="text">Bread</title>
- <summary type="text">Whole grain bread</summary>
- <updated>2014-03-17T11:31:11Z</updated>
- <author>
- <name />
- </author>
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks/Categories" type="application/xml" title="Categories" href="Products(0)/$links/Categories" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks/Supplier" type="application/xml" title="Supplier" href="Products(0)/$links/Supplier" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks/ProductDetail" type="application/xml" title="ProductDetail" href="Products(0)/$links/ProductDetail" />
- <content type="application/xml">
- <m:properties>
- <d:ID m:type="Edm.Int32">0</d:ID>
- <d:ReleaseDate m:type="Edm.DateTimeOffset">1992-01-01T00:00:00Z</d:ReleaseDate>
- <d:DiscontinuedDate m:null="true" />
- <d:Rating m:type="Edm.Int16">4</d:Rating>
- <d:Price m:type="Edm.Double">2.5</d:Price>
- </m:properties>
- </content>
-</entry>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_1.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_1.json
deleted file mode 100644
index c9895d2..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_1.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://services.odata.org/V3/OData/OData.svc/$metadata#Products/@Element","odata.type":"ODataDemo.Product","odata.id":"http://services.odata.org/V3/OData/OData.svc/Products(1)","odata.editLink":"Products(1)","Categories@odata.navigationLinkUrl":"Products(1)/Categories","Categories@odata.associationLinkUrl":"Products(1)/$links/Categories","Supplier@odata.navigationLinkUrl":"Products(1)/Supplier","Supplier@odata.associationLinkUrl":"Products(1)/$links/Supplier","ProductDetail@odata.navigationLinkUrl":"Products(1)/ProductDetail","ProductDetail@odata.associationLinkUrl":"Products(1)/$links/ProductDetail","ID":1,"Name":"Milk","Description":"Low fat milk","ReleaseDate@odata.type":"Edm.DateTimeOffset","ReleaseDate":"1995-10-01T00:00:00Z","DiscontinuedDate":null,"Rating@odata.type":"Edm.Int16","Rating":3,"Price":3.5}
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_1.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_1.xml
deleted file mode 100644
index c39f7ed..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_1.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?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/V3/OData/OData.svc/"
- xmlns="http://www.w3.org/2005/Atom"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:georss="http://www.georss.org/georss"
- xmlns:gml="http://www.opengis.net/gml">
- <id>http://services.odata.org/V3/OData/OData.svc/Products(1)</id>
- <category term="ODataDemo.Product" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link rel="edit" title="Product" href="Products(1)" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Categories" type="application/atom+xml;type=feed" title="Categories" href="Products(1)/Categories" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Supplier" type="application/atom+xml;type=entry" title="Supplier" href="Products(1)/Supplier" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ProductDetail" type="application/atom+xml;type=entry" title="ProductDetail" href="Products(1)/ProductDetail" />
- <title type="text">Milk</title>
- <summary type="text">Low fat milk</summary>
- <updated>2014-03-18T12:50:29Z</updated>
- <author>
- <name />
- </author>
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks/Categories" type="application/xml" title="Categories" href="Products(1)/$links/Categories" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks/Supplier" type="application/xml" title="Supplier" href="Products(1)/$links/Supplier" />
- <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks/ProductDetail" type="application/xml" title="ProductDetail" href="Products(1)/$links/ProductDetail" />
- <content type="application/xml">
- <m:properties>
- <d:ID m:type="Edm.Int32">1</d:ID>
- <d:ReleaseDate m:type="Edm.DateTimeOffset">1995-10-01T00:00:00Z</d:ReleaseDate>
- <d:DiscontinuedDate m:null="true" />
- <d:Rating m:type="Edm.Int16">3</d:Rating>
- <d:Price m:type="Edm.Double">3.5</d:Price>
- </m:properties>
- </content>
-</entry>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_1_DiscontinuedDate.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_1_DiscontinuedDate.json
deleted file mode 100644
index 83174a5..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_1_DiscontinuedDate.json
+++ /dev/null
@@ -1 +0,0 @@
-{"odata.metadata":"http://services.odata.org/V3/OData/OData.svc/$metadata#Edm.Null","odata.null":true}
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_1_DiscontinuedDate.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_1_DiscontinuedDate.xml
deleted file mode 100644
index a668b36..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Products_1_DiscontinuedDate.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?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.
-
--->
-<d:DiscontinuedDate xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- m:null="true" />
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/atom_cleanup.xsl b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/atom_cleanup.xsl
deleted file mode 100644
index b13222b..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/atom_cleanup.xsl
+++ /dev/null
@@ -1,49 +0,0 @@
-<?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://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- version="1.0">
-
- <xsl:template match="atom:summary"/>
- <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/>
- </title>
- </xsl:if>
- </xsl:template>
- <xsl:template match="atom:link[@rel = 'self' or @rel = 'edit' or @rel = 'edit-media' or @rel = 'next']"/>
-
- <xsl:template match="m:action"/>
-
- <xsl:template match="@*[name() = 'm:etag']"/>
-
- <xsl:template match="node()|@*">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:template>
-</xsl:stylesheet>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.json
deleted file mode 100644
index bb0cb2c..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "odata.error": {
- "code": "",
- "message": {
- "lang": "en-US",
- "value": "The URL representing the root of the service only supports GET requests."
- }
- }
-}
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
deleted file mode 100644
index 9d999ff..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?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">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/v3/metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/metadata.xml
deleted file mode 100644
index 5dbb9fc..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/metadata.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"><edmx:DataServices m:DataServiceVersion="3.0" m:MaxDataServiceVersion="3.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><Schema Namespace="Microsoft.Test.OData.Services.AstoriaDefaultService" xmlns="http://schemas.microsoft.com/ado/2009/11/edm"><EntityType Name="AllSpatialTypes"><Key><PropertyRef Name="Id" /></Key><Property Name="Id" Type="Edm.Int32" Nullable="false" /><Property Name="Geog" Type="Edm.Geography" SRID="Variable" /><Property Name="GeogPoint" Type="Edm.GeographyPoint" SRID="Variable" /><Property Name="GeogLine" Type="Edm.GeographyLineString" SRID="Variable" /><Property Name="GeogPolygon" Type="Edm.GeographyPolygon" SRID="Variable" /><Property Name="GeogCollection" Type="Edm.GeographyCollection" SRID="Variable" /><Property Name="GeogMultiPoint" Type="Edm.GeographyMultiPoint" SRID="Variable" /><Property Name="GeogMultiLine" Type="Edm.GeographyMultiLineString" SRID="Variable" /><Property Name="GeogMultiPolygon" Type="Edm.GeographyMultiPolygon" SRID="Variable" /><Property Name="Geom" Type="Edm.Geometry" SRID="Variable" /><Property Name="GeomPoint" Type="Edm.GeometryPoint" SRID="Variable" /><Property Name="GeomLine" Type="Edm.GeometryLineString" SRID="Variable" /><Property Name="GeomPolygon" Type="Edm.GeometryPolygon" SRID="Variable" /><Property Name="GeomCollection" Type="Edm.GeometryCollection" SRID="Variable" /><Property Name="GeomMultiPoint" Type="Edm.GeometryMultiPoint" SRID="Variable" /><Property Name="GeomMultiLine" Type="Edm.GeometryMultiLineString" SRID="Variable" /><Property Name="GeomMultiPolygon" Type="Edm.GeometryMultiPolygon" SRID="Variable" /></EntityType><EntityType Name="AllSpatialCollectionTypes" Abstract="true"><Key><PropertyRef Name="Id" /></Key><Property Name="Id" Type="Edm.Int32" Nullable="false" /></EntityType><EntityType Name="Customer"><Key><PropertyRef Name="CustomerId" /></Key><Property Name="Thumbnail" Type="Edm.Stream" Nullable="false" /><Property Name="Video" Type="Edm.Stream" Nullable="false" /><Property Name="CustomerId" Type="Edm.Int32" Nullable="false" /><Property Name="Name" Type="Edm.String" m:FC_TargetPath="SyndicationSummary" m:FC_ContentKind="text" m:FC_KeepInContent="false" /><Property Name="PrimaryContactInfo" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails" /><Property Name="BackupContactInfo" Type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)" Nullable="false" /><Property Name="Auditing" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.AuditInfo" /><NavigationProperty Name="Orders" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer_Orders" ToRole="Orders" FromRole="Customer" /><NavigationProperty Name="Logins" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer_Logins" ToRole="Logins" FromRole="Customer" /><NavigationProperty Name="Husband" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer_Husband" ToRole="Husband" FromRole="Customer" /><NavigationProperty Name="Wife" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer_Wife" ToRole="Wife" FromRole="Customer" /><NavigationProperty Name="Info" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer_Info" ToRole="Info" FromRole="Customer" /></EntityType><EntityType Name="Login"><Key><PropertyRef Name="Username" /></Key><Property Name="Username" Type="Edm.String" Nullable="false" /><Property Name="CustomerId" Type="Edm.Int32" Nullable="false" /><NavigationProperty Name="Customer" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Login_Customer" ToRole="Customer" FromRole="Login" /><NavigationProperty Name="LastLogin" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Login_LastLogin" ToRole="LastLogin" FromRole="Login" /><NavigationProperty Name="SentMessages" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Login_SentMessages" ToRole="SentMessages" FromRole="Login" /><NavigationProperty Name="ReceivedMessages" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Login_ReceivedMessages" ToRole="ReceivedMessages" FromRole="Login" /><NavigationProperty Name="Orders" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Login_Orders" ToRole="Orders" FromRole="Login" /></EntityType><EntityType Name="RSAToken"><Key><PropertyRef Name="Serial" /></Key><Property Name="Serial" Type="Edm.String" Nullable="false" /><Property Name="Issued" Type="Edm.DateTime" Nullable="false" /><NavigationProperty Name="Login" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.RSAToken_Login" ToRole="Login" FromRole="RSAToken" /></EntityType><EntityType Name="PageView"><Key><PropertyRef Name="PageViewId" /></Key><Property Name="PageViewId" Type="Edm.Int32" Nullable="false" /><Property Name="Username" Type="Edm.String" /><Property Name="Viewed" Type="Edm.DateTimeOffset" Nullable="false" /><Property Name="TimeSpentOnPage" Type="Edm.Time" Nullable="false" /><Property Name="PageUrl" Type="Edm.String" /><NavigationProperty Name="Login" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.PageView_Login" ToRole="Login" FromRole="PageView" /></EntityType><EntityType Name="LastLogin"><Key><PropertyRef Name="Username" /></Key><Property Name="Username" Type="Edm.String" Nullable="false" /><Property Name="LoggedIn" Type="Edm.DateTime" Nullable="false" /><Property Name="LoggedOut" Type="Edm.DateTime" /><Property Name="Duration" Type="Edm.Time" Nullable="false" /><NavigationProperty Name="Login" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.LastLogin_Login" ToRole="Login" FromRole="LastLogin" /></EntityType><EntityType Name="Message"><Key><PropertyRef Name="FromUsername" /><PropertyRef Name="MessageId" /></Key><Property Name="MessageId" Type="Edm.Int32" Nullable="false" /><Property Name="FromUsername" Type="Edm.String" Nullable="false" /><Property Name="ToUsername" Type="Edm.String" /><Property Name="Sent" Type="Edm.DateTimeOffset" Nullable="false" m:FC_TargetPath="SyndicationPublished" m:FC_ContentKind="text" m:FC_KeepInContent="true" /><Property Name="Subject" Type="Edm.String" m:FC_TargetPath="SyndicationTitle" m:FC_ContentKind="text" m:FC_KeepInContent="true" /><Property Name="Body" Type="Edm.String" /><Property Name="IsRead" Type="Edm.Boolean" Nullable="false" /><NavigationProperty Name="Sender" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Message_Sender" ToRole="Sender" FromRole="Message" /><NavigationProperty Name="Recipient" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Message_Recipient" ToRole="Recipient" FromRole="Message" /><NavigationProperty Name="Attachments" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Message_Attachments" ToRole="Attachments" FromRole="Message" /></EntityType><EntityType Name="MessageAttachment"><Key><PropertyRef Name="AttachmentId" /></Key><Property Name="AttachmentId" Type="Edm.Guid" Nullable="false" /><Property Name="Attachment" Type="Edm.Binary" /></EntityType><EntityType Name="Order"><Key><PropertyRef Name="OrderId" /></Key><Property Name="OrderId" Type="Edm.Int32" Nullable="false" /><Property Name="CustomerId" Type="Edm.Int32" /><Property Name="Concurrency" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.ConcurrencyInfo" /><NavigationProperty Name="Customer" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Order_Customer" ToRole="Customer" FromRole="Order" /><NavigationProperty Name="Login" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Order_Login" ToRole="Login" FromRole="Order" /></EntityType><EntityType Name="OrderLine"><Key><PropertyRef Name="OrderId" /><PropertyRef Name="ProductId" /></Key><Property Name="OrderLineStream" Type="Edm.Stream" Nullable="false" /><Property Name="OrderId" Type="Edm.Int32" Nullable="false" /><Property Name="ProductId" Type="Edm.Int32" Nullable="false" /><Property Name="Quantity" Type="Edm.Int32" Nullable="false" /><Property Name="ConcurrencyToken" Type="Edm.String" ConcurrencyMode="Fixed" /><NavigationProperty Name="Order" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.OrderLine_Order" ToRole="Order" FromRole="OrderLine" /><NavigationProperty Name="Product" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.OrderLine_Product" ToRole="Product" FromRole="OrderLine" /></EntityType><EntityType Name="Product"><Key><PropertyRef Name="ProductId" /></Key><Property Name="Picture" Type="Edm.Stream" Nullable="false" /><Property Name="ProductId" Type="Edm.Int32" Nullable="false" /><Property Name="Description" Type="Edm.String" /><Property Name="Dimensions" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions" /><Property Name="BaseConcurrency" Type="Edm.String" ConcurrencyMode="Fixed" /><Property Name="ComplexConcurrency" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.ConcurrencyInfo" /><Property Name="NestedComplexConcurrency" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.AuditInfo" /><NavigationProperty Name="RelatedProducts" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Product_RelatedProducts" ToRole="RelatedProducts" FromRole="Product" /><NavigationProperty Name="Detail" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Product_Detail" ToRole="Detail" FromRole="Product" /><NavigationProperty Name="Reviews" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Product_Reviews" ToRole="Reviews" FromRole="Product" /><NavigationProperty Name="Photos" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Product_Photos" ToRole="Photos" FromRole="Product" /></EntityType><EntityType Name="ProductDetail"><Key><PropertyRef Name="ProductId" /></Key><Property Name="ProductId" Type="Edm.Int32" Nullable="false" /><Property Name="Details" Type="Edm.String" /><NavigationProperty Name="Product" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.ProductDetail_Product" ToRole="Product" FromRole="ProductDetail" /></EntityType><EntityType Name="ProductReview"><Key><PropertyRef Name="ProductId" /><PropertyRef Name="ReviewId" /><PropertyRef Name="RevisionId" /></Key><Property Name="ProductId" Type="Edm.Int32" Nullable="false" /><Property Name="ReviewId" Type="Edm.Int32" Nullable="false" /><Property Name="RevisionId" Type="Edm.String" Nullable="false" /><Property Name="Review" Type="Edm.String" /><NavigationProperty Name="Product" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.ProductReview_Product" ToRole="Product" FromRole="ProductReview" /></EntityType><EntityType Name="ProductPhoto"><Key><PropertyRef Name="PhotoId" /><PropertyRef Name="ProductId" /></Key><Property Name="ProductId" Type="Edm.Int32" Nullable="false" /><Property Name="PhotoId" Type="Edm.Int32" Nullable="false" /><Property Name="Photo" Type="Edm.Binary" /></EntityType><EntityType Name="CustomerInfo" m:HasStream="true"><Key><PropertyRef Name="CustomerInfoId" /></Key><Property Name="CustomerInfoId" Type="Edm.Int32" Nullable="false" /><Property Name="Information" Type="Edm.String" /></EntityType><EntityType Name="Computer"><Key><PropertyRef Name="ComputerId" /></Key><Property Name="ComputerId" Type="Edm.Int32" Nullable="false" /><Property Name="Name" Type="Edm.String" /><NavigationProperty Name="ComputerDetail" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Computer_ComputerDetail" ToRole="ComputerDetail" FromRole="Computer" /></EntityType><EntityType Name="ComputerDetail"><Key><PropertyRef Name="ComputerDetailId" /></Key><Property Name="ComputerDetailId" Type="Edm.Int32" Nullable="false" /><Property Name="Manufacturer" Type="Edm.String" m:FC_TargetPath="SyndicationAuthorEmail" m:FC_ContentKind="text" m:FC_KeepInContent="true" /><Property Name="Model" Type="Edm.String" m:FC_TargetPath="SyndicationAuthorUri" m:FC_ContentKind="text" m:FC_KeepInContent="true" /><Property Name="Serial" Type="Edm.String" /><Property Name="SpecificationsBag" Type="Collection(Edm.String)" Nullable="false" /><Property Name="PurchaseDate" Type="Edm.DateTime" Nullable="false" /><Property Name="Dimensions" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions" /><NavigationProperty Name="Computer" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail_Computer" ToRole="Computer" FromRole="ComputerDetail" /></EntityType><EntityType Name="Driver"><Key><PropertyRef Name="Name" /></Key><Property Name="Name" Type="Edm.String" Nullable="false" /><Property Name="BirthDate" Type="Edm.DateTime" Nullable="false" /><NavigationProperty Name="License" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Driver_License" ToRole="License" FromRole="Driver" /></EntityType><EntityType Name="License"><Key><PropertyRef Name="Name" /></Key><Property Name="Name" Type="Edm.String" Nullable="false" /><Property Name="LicenseNumber" Type="Edm.String" /><Property Name="LicenseClass" Type="Edm.String" m:FC_TargetPath="SyndicationContributorEmail" m:FC_ContentKind="text" m:FC_KeepInContent="false" /><Property Name="Restrictions" Type="Edm.String" m:FC_TargetPath="SyndicationContributorUri" m:FC_ContentKind="text" m:FC_KeepInContent="false" /><Property Name="ExpirationDate" Type="Edm.DateTime" Nullable="false" /><NavigationProperty Name="Driver" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.License_Driver" ToRole="Driver" FromRole="License" /></EntityType><EntityType Name="MappedEntityType"><Key><PropertyRef Name="Id" /></Key><Property Name="Id" Type="Edm.Int32" Nullable="false" /><Property Name="Href" Type="Edm.String" /><Property Name="Title" Type="Edm.String" /><Property Name="HrefLang" Type="Edm.String" /><Property Name="Type" Type="Edm.String" /><Property Name="Length" Type="Edm.Int32" Nullable="false" /><Property Name="BagOfPrimitiveToLinks" Type="Collection(Edm.String)" Nullable="false" /><Property Name="Logo" Type="Edm.Binary" /><Property Name="BagOfDecimals" Type="Collection(Edm.Decimal)" Nullable="false" /><Property Name="BagOfDoubles" Type="Collection(Edm.Double)" Nullable="false" /><Property Name="BagOfSingles" Type="Collection(Edm.Single)" Nullable="false" /><Property Name="BagOfBytes" Type="Collection(Edm.Byte)" Nullable="false" /><Property Name="BagOfInt16s" Type="Collection(Edm.Int16)" Nullable="false" /><Property Name="BagOfInt32s" Type="Collection(Edm.Int32)" Nullable="false" /><Property Name="BagOfInt64s" Type="Collection(Edm.Int64)" Nullable="false" /><Property Name="BagOfGuids" Type="Collection(Edm.Guid)" Nullable="false" /><Property Name="BagOfDateTime" Type="Collection(Edm.DateTime)" Nullable="false" /><Property Name="BagOfComplexToCategories" Type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ComplexToCategory)" Nullable="false" /><Property Name="ComplexPhone" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone" m:FC_TargetPath="SyndicationRights" m:FC_ContentKind="text" m:FC_SourcePath="PhoneNumber" m:FC_KeepInContent="true" /><Property Name="ComplexContactDetails" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails" m:FC_TargetPath="SyndicationSummary" m:FC_ContentKind="text" m:FC_SourcePath="WorkPhone/Extension" m:FC_KeepInContent="true" /></EntityType><EntityType Name="Car" m:HasStream="true"><Key><PropertyRef Name="VIN" /></Key><Property Name="Photo" Type="Edm.Stream" Nullable="false" /><Property Name="Video" Type="Edm.Stream" Nullable="false" /><Property Name="VIN" Type="Edm.Int32" Nullable="false" /><Property Name="Description" Type="Edm.String" /></EntityType><EntityType Name="Person"><Key><PropertyRef Name="PersonId" /></Key><Property Name="PersonId" Type="Edm.Int32" Nullable="false" /><Property Name="Name" Type="Edm.String" /><NavigationProperty Name="PersonMetadata" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Person_PersonMetadata" ToRole="PersonMetadata" FromRole="Person" /></EntityType><EntityType Name="PersonMetadata"><Key><PropertyRef Name="PersonMetadataId" /></Key><Property Name="PersonMetadataId" Type="Edm.Int32" Nullable="false" /><Property Name="PersonId" Type="Edm.Int32" Nullable="false" /><Property Name="PropertyName" Type="Edm.String" /><Property Name="PropertyValue" Type="Edm.String" /><NavigationProperty Name="Person" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.PersonMetadata_Person" ToRole="Person" FromRole="PersonMetadata" /></EntityType><ComplexType Name="ContactDetails"><Property Name="EmailBag" Type="Collection(Edm.String)" Nullable="false" /><Property Name="AlternativeNames" Type="Collection(Edm.String)" Nullable="false" /><Property Name="ContactAlias" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases" /><Property Name="HomePhone" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone" /><Property Name="WorkPhone" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone" /><Property Name="MobilePhoneBag" Type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)" Nullable="false" /></ComplexType><ComplexType Name="AuditInfo"><Property Name="ModifiedDate" Type="Edm.DateTime" Nullable="false" /><Property Name="ModifiedBy" Type="Edm.String" /><Property Name="Concurrency" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.ConcurrencyInfo" /></ComplexType><ComplexType Name="ConcurrencyInfo"><Property Name="Token" Type="Edm.String" /><Property Name="QueriedDateTime" Type="Edm.DateTime" /></ComplexType><ComplexType Name="Dimensions"><Property Name="Width" Type="Edm.Decimal" Nullable="false" /><Property Name="Height" Type="Edm.Decimal" Nullable="false" /><Property Name="Depth" Type="Edm.Decimal" Nullable="false" /></ComplexType><ComplexType Name="ComplexToCategory"><Property Name="Term" Type="Edm.String" /><Property Name="Scheme" Type="Edm.String" /><Property Name="Label" Type="Edm.String" /></ComplexType><ComplexType Name="Phone"><Property Name="PhoneNumber" Type="Edm.String" /><Property Name="Extension" Type="Edm.String" /></ComplexType><ComplexType Name="Aliases"><Property Name="AlternativeNames" Type="Collection(Edm.String)" Nullable="false" /></ComplexType><EntityType Name="AllSpatialCollectionTypes_Simple" BaseType="Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialCollectionTypes"><Property Name="ManyGeogPoint" Type="Collection(Edm.GeographyPoint)" Nullable="false" SRID="Variable" /><Property Name="ManyGeogLine" Type="Collection(Edm.GeographyLineString)" Nullable="false" SRID="Variable" /><Property Name="ManyGeogPolygon" Type="Collection(Edm.GeographyPolygon)" Nullable="false" SRID="Variable" /><Property Name="ManyGeomPoint" Type="Collection(Edm.GeometryPoint)" Nullable="false" SRID="Variable" /><Property Name="ManyGeomLine" Type="Collection(Edm.GeometryLineString)" Nullable="false" SRID="Variable" /><Property Name="ManyGeomPolygon" Type="Collection(Edm.GeometryPolygon)" Nullable="false" SRID="Variable" /></EntityType><EntityType Name="ProductPageView" BaseType="Microsoft.Test.OData.Services.AstoriaDefaultService.PageView"><Property Name="ProductId" Type="Edm.Int32" Nullable="false" /><Property Name="ConcurrencyToken" Type="Edm.String" ConcurrencyMode="Fixed" /></EntityType><EntityType Name="BackOrderLine" BaseType="Microsoft.Test.OData.Services.AstoriaDefaultService.OrderLine" /><EntityType Name="BackOrderLine2" BaseType="Microsoft.Test.OData.Services.AstoriaDefaultService.BackOrderLine" /><EntityType Name="DiscontinuedProduct" BaseType="Microsoft.Test.OData.Services.AstoriaDefaultService.Product"><Property Name="Discontinued" Type="Edm.DateTime" Nullable="false" /><Property Name="ReplacementProductId" Type="Edm.Int32" /><Property Name="DiscontinuedPhone" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone" /><Property Name="ChildConcurrencyToken" Type="Edm.String" ConcurrencyMode="Fixed" /></EntityType><EntityType Name="Contractor" BaseType="Microsoft.Test.OData.Services.AstoriaDefaultService.Person"><Property Name="ContratorCompanyId" Type="Edm.Int32" Nullable="false" /><Property Name="BillingRate" Type="Edm.Int32" Nullable="false" /><Property Name="TeamContactPersonId" Type="Edm.Int32" Nullable="false" /><Property Name="JobDescription" Type="Edm.String" /></EntityType><EntityType Name="Employee" BaseType="Microsoft.Test.OData.Services.AstoriaDefaultService.Person"><Property Name="ManagersPersonId" Type="Edm.Int32" Nullable="false" /><Property Name="Salary" Type="Edm.Int32" Nullable="false" /><Property Name="Title" Type="Edm.String" /><NavigationProperty Name="Manager" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.Employee_Manager" ToRole="Manager" FromRole="Employee" /></EntityType><EntityType Name="SpecialEmployee" BaseType="Microsoft.Test.OData.Services.AstoriaDefaultService.Employee"><Property Name="CarsVIN" Type="Edm.Int32" Nullable="false" /><Property Name="Bonus" Type="Edm.Int32" Nullable="false" /><Property Name="IsFullyVested" Type="Edm.Boolean" Nullable="false" /><NavigationProperty Name="Car" Relationship="Microsoft.Test.OData.Services.AstoriaDefaultService.SpecialEmployee_Car" ToRole="Car" FromRole="SpecialEmployee" /></EntityType><ComplexType Name="ComplexWithAllPrimitiveTypes"><Property Name="Binary" Type="Edm.Binary" /><Property Name="Boolean" Type="Edm.Boolean" Nullable="false" /><Property Name="Byte" Type="Edm.Byte" Nullable="false" /><Property Name="DateTime" Type="Edm.DateTime" Nullable="false" /><Property Name="Decimal" Type="Edm.Decimal" Nullable="false" /><Property Name="Double" Type="Edm.Double" Nullable="false" /><Property Name="Int16" Type="Edm.Int16" Nullable="false" /><Property Name="Int32" Type="Edm.Int32" Nullable="false" /><Property Name="Int64" Type="Edm.Int64" Nullable="false" /><Property Name="SByte" Type="Edm.SByte" Nullable="false" /><Property Name="String" Type="Edm.String" /><Property Name="Single" Type="Edm.Single" Nullable="false" /><Property Name="GeographyPoint" Type="Edm.GeographyPoint" SRID="Variable" /><Property Name="GeometryPoint" Type="Edm.GeometryPoint" SRID="Variable" /></ComplexType><Association Name="Customer_Orders"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Order" Role="Orders" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer" Role="Customer" Multiplicity="*" /></Association><Association Name="Customer_Logins"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Login" Role="Logins" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer" Role="Customer" Multiplicity="*" /></Association><Association Name="Customer_Husband"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer" Role="Husband" Multiplicity="0..1" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer" Role="Customer" Multiplicity="*" /></Association><Association Name="Customer_Wife"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer" Role="Wife" Multiplicity="0..1" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer" Role="Customer" Multiplicity="*" /></Association><Association Name="Customer_Info"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo" Role="Info" Multiplicity="0..1" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer" Role="Customer" Multiplicity="*" /></Association><Association Name="Login_Customer"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Login" Role="Login" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer" Role="Customer" Multiplicity="0..1" /></Association><Association Name="Login_LastLogin"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Login" Role="Login" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.LastLogin" Role="LastLogin" Multiplicity="0..1" /></Association><Association Name="Login_SentMessages"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Message" Role="SentMessages" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Login" Role="Login" Multiplicity="*" /></Association><Association Name="Login_ReceivedMessages"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Message" Role="ReceivedMessages" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Login" Role="Login" Multiplicity="*" /></Association><Association Name="Login_Orders"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Order" Role="Orders" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Login" Role="Login" Multiplicity="*" /></Association><Association Name="RSAToken_Login"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.RSAToken" Role="RSAToken" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Login" Role="Login" Multiplicity="0..1" /></Association><Association Name="PageView_Login"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.PageView" Role="PageView" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Login" Role="Login" Multiplicity="0..1" /></Association><Association Name="LastLogin_Login"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Login" Role="Login" Multiplicity="0..1" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.LastLogin" Role="LastLogin" Multiplicity="*" /></Association><Association Name="Message_Sender"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Message" Role="Message" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Login" Role="Sender" Multiplicity="0..1" /></Association><Association Name="Message_Recipient"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Message" Role="Message" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Login" Role="Recipient" Multiplicity="0..1" /></Association><Association Name="Message_Attachments"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.MessageAttachment" Role="Attachments" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Message" Role="Message" Multiplicity="*" /></Association><Association Name="Order_Customer"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Order" Role="Order" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer" Role="Customer" Multiplicity="0..1" /></Association><Association Name="Order_Login"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Order" Role="Order" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Login" Role="Login" Multiplicity="0..1" /></Association><Association Name="OrderLine_Order"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.OrderLine" Role="OrderLine" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Order" Role="Order" Multiplicity="0..1" /></Association><Association Name="OrderLine_Product"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Product" Role="Product" Multiplicity="0..1" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.OrderLine" Role="OrderLine" Multiplicity="*" /></Association><Association Name="Product_RelatedProducts"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Product" Role="RelatedProducts" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Product" Role="Product" Multiplicity="*" /></Association><Association Name="Product_Detail"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.ProductDetail" Role="Detail" Multiplicity="0..1" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Product" Role="Product" Multiplicity="*" /></Association><Association Name="Product_Reviews"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.ProductReview" Role="Reviews" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Product" Role="Product" Multiplicity="*" /></Association><Association Name="Product_Photos"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.ProductPhoto" Role="Photos" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Product" Role="Product" Multiplicity="*" /></Association><Association Name="ProductDetail_Product"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.ProductDetail" Role="ProductDetail" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Product" Role="Product" Multiplicity="0..1" /></Association><Association Name="ProductReview_Product"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.ProductReview" Role="ProductReview" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Product" Role="Product" Multiplicity="0..1" /></Association><Association Name="Computer_ComputerDetail"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" Role="ComputerDetail" Multiplicity="0..1" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Computer" Role="Computer" Multiplicity="*" /></Association><Association Name="ComputerDetail_Computer"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" Role="ComputerDetail" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Computer" Role="Computer" Multiplicity="0..1" /></Association><Association Name="Driver_License"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.License" Role="License" Multiplicity="0..1" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Driver" Role="Driver" Multiplicity="*" /></Association><Association Name="License_Driver"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.License" Role="License" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Driver" Role="Driver" Multiplicity="0..1" /></Association><Association Name="Person_PersonMetadata"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.PersonMetadata" Role="PersonMetadata" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Person" Role="Person" Multiplicity="*" /></Association><Association Name="PersonMetadata_Person"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.PersonMetadata" Role="PersonMetadata" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Person" Role="Person" Multiplicity="0..1" /></Association><Association Name="Employee_Manager"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Employee" Role="Manager" Multiplicity="0..1" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Employee" Role="Employee" Multiplicity="*" /></Association><Association Name="SpecialEmployee_Car"><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.SpecialEmployee" Role="SpecialEmployee" Multiplicity="*" /><End Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" Role="Car" Multiplicity="0..1" /></Association><EntityContainer Name="DefaultContainer" m:IsDefaultEntityContainer="true"><EntitySet Name="AllGeoTypesSet" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialTypes" /><EntitySet Name="AllGeoCollectionTypesSet" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialCollectionTypes" /><EntitySet Name="Customer" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer" /><EntitySet Name="Login" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.Login" /><EntitySet Name="RSAToken" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.RSAToken" /><EntitySet Name="PageView" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.PageView" /><EntitySet Name="LastLogin" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.LastLogin" /><EntitySet Name="Message" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.Message" /><EntitySet Name="MessageAttachment" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.MessageAttachment" /><EntitySet Name="Order" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.Order" /><EntitySet Name="OrderLine" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.OrderLine" /><EntitySet Name="Product" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.Product" /><EntitySet Name="ProductDetail" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.ProductDetail" /><EntitySet Name="ProductReview" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.ProductReview" /><EntitySet Name="ProductPhoto" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.ProductPhoto" /><EntitySet Name="CustomerInfo" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo" /><EntitySet Name="Computer" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.Computer" /><EntitySet Name="ComputerDetail" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" /><EntitySet Name="Driver" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.Driver" /><EntitySet Name="License" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.License" /><EntitySet Name="MappedEntityType" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.MappedEntityType" /><EntitySet Name="Car" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.Car" /><EntitySet Name="Person" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.Person" /><EntitySet Name="PersonMetadata" EntityType="Microsoft.Test.OData.Services.AstoriaDefaultService.PersonMetadata" /><FunctionImport Name="GetPrimitiveString" ReturnType="Edm.String" m:HttpMethod="GET" /><FunctionImport Name="GetSpecificCustomer" ReturnType="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Customer)" EntitySet="Customer" m:HttpMethod="GET"><Parameter Name="Name" Type="Edm.String" /></FunctionImport><FunctionImport Name="GetCustomerCount" ReturnType="Edm.Int32" m:HttpMethod="GET" /><FunctionImport Name="GetArgumentPlusOne" ReturnType="Edm.Int32" m:HttpMethod="GET"><Parameter Name="arg1" Type="Edm.Int32" Nullable="false" /></FunctionImport><FunctionImport Name="EntityProjectionReturnsCollectionOfComplexTypes" ReturnType="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)" m:HttpMethod="GET" /><FunctionImport Name="ResetDataSource" m:HttpMethod="POST" /><FunctionImport Name="InStreamErrorGetCustomer" ReturnType="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Customer)" EntitySet="Customer" m:HttpMethod="GET" /><FunctionImport Name="IncreaseSalaries" IsBindable="true" m:IsAlwaysBindable="true"><Parameter Name="employees" Type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Employee)" /><Parameter Name="n" Type="Edm.Int32" Nullable="false" /></FunctionImport><FunctionImport Name="Sack" IsBindable="true" m:IsAlwaysBindable="true"><Parameter Name="employee" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Employee" /></FunctionImport><FunctionImport Name="GetComputer" ReturnType="Microsoft.Test.OData.Services.AstoriaDefaultService.Computer" IsBindable="true" EntitySet="Computer" m:IsAlwaysBindable="true"><Parameter Name="computer" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Computer" /></FunctionImport><FunctionImport Name="ChangeProductDimensions" IsBindable="true" m:IsAlwaysBindable="true"><Parameter Name="product" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Product" /><Parameter Name="dimensions" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions" /></FunctionImport><FunctionImport Name="ResetComputerDetailsSpecifications" IsBindable="true" m:IsAlwaysBindable="true"><Parameter Name="computerDetail" Type="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail" /><Parameter Name="specifications" Type="Collection(Edm.String)" Nullable="false" /><Parameter Name="purchaseTime" Type="Edm.DateTime" Nullable="false" /></FunctionImport><AssociationSet Name="Customer_Orders" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer_Orders"><End Role="Customer" EntitySet="Customer" /><End Role="Orders" EntitySet="Order" /></AssociationSet><AssociationSet Name="Customer_Logins" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer_Logins"><End Role="Customer" EntitySet="Customer" /><End Role="Logins" EntitySet="Login" /></AssociationSet><AssociationSet Name="Customer_Husband" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer_Husband"><End Role="Customer" EntitySet="Customer" /><End Role="Husband" EntitySet="Customer" /></AssociationSet><AssociationSet Name="Customer_Wife" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer_Wife"><End Role="Customer" EntitySet="Customer" /><End Role="Wife" EntitySet="Customer" /></AssociationSet><AssociationSet Name="Customer_Info" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Customer_Info"><End Role="Customer" EntitySet="Customer" /><End Role="Info" EntitySet="CustomerInfo" /></AssociationSet><AssociationSet Name="Login_Customer" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Login_Customer"><End Role="Login" EntitySet="Login" /><End Role="Customer" EntitySet="Customer" /></AssociationSet><AssociationSet Name="Login_LastLogin" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Login_LastLogin"><End Role="Login" EntitySet="Login" /><End Role="LastLogin" EntitySet="LastLogin" /></AssociationSet><AssociationSet Name="Login_SentMessages" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Login_SentMessages"><End Role="Login" EntitySet="Login" /><End Role="SentMessages" EntitySet="Message" /></AssociationSet><AssociationSet Name="Login_ReceivedMessages" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Login_ReceivedMessages"><End Role="Login" EntitySet="Login" /><End Role="ReceivedMessages" EntitySet="Message" /></AssociationSet><AssociationSet Name="Login_Orders" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Login_Orders"><End Role="Login" EntitySet="Login" /><End Role="Orders" EntitySet="Order" /></AssociationSet><AssociationSet Name="RSAToken_Login" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.RSAToken_Login"><End Role="RSAToken" EntitySet="RSAToken" /><End Role="Login" EntitySet="Login" /></AssociationSet><AssociationSet Name="PageView_Login" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.PageView_Login"><End Role="PageView" EntitySet="PageView" /><End Role="Login" EntitySet="Login" /></AssociationSet><AssociationSet Name="LastLogin_Login" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.LastLogin_Login"><End Role="LastLogin" EntitySet="LastLogin" /><End Role="Login" EntitySet="Login" /></AssociationSet><AssociationSet Name="Message_Sender" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Message_Sender"><End Role="Message" EntitySet="Message" /><End Role="Sender" EntitySet="Login" /></AssociationSet><AssociationSet Name="Message_Recipient" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Message_Recipient"><End Role="Message" EntitySet="Message" /><End Role="Recipient" EntitySet="Login" /></AssociationSet><AssociationSet Name="Message_Attachments" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Message_Attachments"><End Role="Message" EntitySet="Message" /><End Role="Attachments" EntitySet="MessageAttachment" /></AssociationSet><AssociationSet Name="Order_Customer" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Order_Customer"><End Role="Order" EntitySet="Order" /><End Role="Customer" EntitySet="Customer" /></AssociationSet><AssociationSet Name="Order_Login" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Order_Login"><End Role="Order" EntitySet="Order" /><End Role="Login" EntitySet="Login" /></AssociationSet><AssociationSet Name="OrderLine_Order" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.OrderLine_Order"><End Role="OrderLine" EntitySet="OrderLine" /><End Role="Order" EntitySet="Order" /></AssociationSet><AssociationSet Name="OrderLine_Product" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.OrderLine_Product"><End Role="OrderLine" EntitySet="OrderLine" /><End Role="Product" EntitySet="Product" /></AssociationSet><AssociationSet Name="Product_RelatedProducts" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Product_RelatedProducts"><End Role="Product" EntitySet="Product" /><End Role="RelatedProducts" EntitySet="Product" /></AssociationSet><AssociationSet Name="Product_Detail" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Product_Detail"><End Role="Product" EntitySet="Product" /><End Role="Detail" EntitySet="ProductDetail" /></AssociationSet><AssociationSet Name="Product_Reviews" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Product_Reviews"><End Role="Product" EntitySet="Product" /><End Role="Reviews" EntitySet="ProductReview" /></AssociationSet><AssociationSet Name="Product_Photos" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Product_Photos"><End Role="Product" EntitySet="Product" /><End Role="Photos" EntitySet="ProductPhoto" /></AssociationSet><AssociationSet Name="ProductDetail_Product" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.ProductDetail_Product"><End Role="ProductDetail" EntitySet="ProductDetail" /><End Role="Product" EntitySet="Product" /></AssociationSet><AssociationSet Name="ProductReview_Product" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.ProductReview_Product"><End Role="ProductReview" EntitySet="ProductReview" /><End Role="Product" EntitySet="Product" /></AssociationSet><AssociationSet Name="Computer_ComputerDetail" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Computer_ComputerDetail"><End Role="Computer" EntitySet="Computer" /><End Role="ComputerDetail" EntitySet="ComputerDetail" /></AssociationSet><AssociationSet Name="ComputerDetail_Computer" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail_Computer"><End Role="ComputerDetail" EntitySet="ComputerDetail" /><End Role="Computer" EntitySet="Computer" /></AssociationSet><AssociationSet Name="Driver_License" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Driver_License"><End Role="Driver" EntitySet="Driver" /><End Role="License" EntitySet="License" /></AssociationSet><AssociationSet Name="License_Driver" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.License_Driver"><End Role="License" EntitySet="License" /><End Role="Driver" EntitySet="Driver" /></AssociationSet><AssociationSet Name="Employee_Manager" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Employee_Manager"><End Role="Employee" EntitySet="Person" /><End Role="Manager" EntitySet="Person" /></AssociationSet><AssociationSet Name="SpecialEmployee_Car" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.SpecialEmployee_Car"><End Role="SpecialEmployee" EntitySet="Person" /><End Role="Car" EntitySet="Car" /></AssociationSet><AssociationSet Name="Person_PersonMetadata" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.Person_PersonMetadata"><End Role="Person" EntitySet="Person" /><End Role="PersonMetadata" EntitySet="PersonMetadata" /></AssociationSet><AssociationSet Name="PersonMetadata_Person" Association="Microsoft.Test.OData.Services.AstoriaDefaultService.PersonMetadata_Person"><End Role="PersonMetadata" EntitySet="PersonMetadata" /><End Role="Person" EntitySet="Person" /></AssociationSet></EntityContainer></Schema></edmx:DataServices></edmx:Edmx>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/northwind-metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/northwind-metadata.xml
deleted file mode 100644
index 0a14f0a..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/northwind-metadata.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"><edmx:DataServices m:DataServiceVersion="1.0" m:MaxDataServiceVersion="3.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><Schema Namespace="NorthwindModel" xmlns="http://schemas.microsoft.com/ado/2008/09/edm"><EntityType Name="Category"><Key><PropertyRef Name="CategoryID" /></Key><Property Name="CategoryID" Type="Edm.Int32" Nullable="false" p6:StoreGeneratedPattern="Identity" xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /><Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="Description" Type="Edm.String" MaxLength="Max" FixedLength="false" Unicode="true" /><Property Name="Picture" Type="Edm.Binary" MaxLength="Max" FixedLength="false" /><NavigationProperty Name="Products" Relationship="NorthwindModel.FK_Products_Categories" ToRole="Products" FromRole="Categories" /></EntityType><EntityType Name="CustomerDemographic"><Key><PropertyRef Name="CustomerTypeID" /></Key><Property Name="CustomerTypeID" Type="Edm.String" Nullable="false" MaxLength="10" FixedLength="true" Unicode="true" /><Property Name="CustomerDesc" Type="Edm.String" MaxLength="Max" FixedLength="false" Unicode="true" /><NavigationProperty Name="Customers" Relationship="NorthwindModel.CustomerCustomerDemo" ToRole="Customers" FromRole="CustomerDemographics" /></EntityType><EntityType Name="Customer"><Key><PropertyRef Name="CustomerID" /></Key><Property Name="CustomerID" Type="Edm.String" Nullable="false" MaxLength="5" FixedLength="true" Unicode="true" /><Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true" /><Property Name="ContactName" Type="Edm.String" MaxLength="30" FixedLength="false" Unicode="true" /><Property Name="ContactTitle" Type="Edm.String" MaxLength="30" FixedLength="false" Unicode="true" /><Property Name="Address" Type="Edm.String" MaxLength="60" FixedLength="false" Unicode="true" /><Property Name="City" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="Region" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="PostalCode" Type="Edm.String" MaxLength="10" FixedLength="false" Unicode="true" /><Property Name="Country" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="Phone" Type="Edm.String" MaxLength="24" FixedLength="false" Unicode="true" /><Property Name="Fax" Type="Edm.String" MaxLength="24" FixedLength="false" Unicode="true" /><NavigationProperty Name="Orders" Relationship="NorthwindModel.FK_Orders_Customers" ToRole="Orders" FromRole="Customers" /><NavigationProperty Name="CustomerDemographics" Relationship="NorthwindModel.CustomerCustomerDemo" ToRole="CustomerDemographics" FromRole="Customers" /></EntityType><EntityType Name="Employee"><Key><PropertyRef Name="EmployeeID" /></Key><Property Name="EmployeeID" Type="Edm.Int32" Nullable="false" p6:StoreGeneratedPattern="Identity" xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /><Property Name="LastName" Type="Edm.String" Nullable="false" MaxLength="20" FixedLength="false" Unicode="true" /><Property Name="FirstName" Type="Edm.String" Nullable="false" MaxLength="10" FixedLength="false" Unicode="true" /><Property Name="Title" Type="Edm.String" MaxLength="30" FixedLength="false" Unicode="true" /><Property Name="TitleOfCourtesy" Type="Edm.String" MaxLength="25" FixedLength="false" Unicode="true" /><Property Name="BirthDate" Type="Edm.DateTime" /><Property Name="HireDate" Type="Edm.DateTime" /><Property Name="Address" Type="Edm.String" MaxLength="60" FixedLength="false" Unicode="true" /><Property Name="City" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="Region" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="PostalCode" Type="Edm.String" MaxLength="10" FixedLength="false" Unicode="true" /><Property Name="Country" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="HomePhone" Type="Edm.String" MaxLength="24" FixedLength="false" Unicode="true" /><Property Name="Extension" Type="Edm.String" MaxLength="4" FixedLength="false" Unicode="true" /><Property Name="Photo" Type="Edm.Binary" MaxLength="Max" FixedLength="false" /><Property Name="Notes" Type="Edm.String" MaxLength="Max" FixedLength="false" Unicode="true" /><Property Name="ReportsTo" Type="Edm.Int32" /><Property Name="PhotoPath" Type="Edm.String" MaxLength="255" FixedLength="false" Unicode="true" /><NavigationProperty Name="Employees1" Relationship="NorthwindModel.FK_Employees_Employees" ToRole="Employees1" FromRole="Employees" /><NavigationProperty Name="Employee1" Relationship="NorthwindModel.FK_Employees_Employees" ToRole="Employees" FromRole="Employees1" /><NavigationProperty Name="Orders" Relationship="NorthwindModel.FK_Orders_Employees" ToRole="Orders" FromRole="Employees" /><NavigationProperty Name="Territories" Relationship="NorthwindModel.EmployeeTerritories" ToRole="Territories" FromRole="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" Relationship="NorthwindModel.FK_Order_Details_Orders" ToRole="Orders" FromRole="Order_Details" /><NavigationProperty Name="Product" Relationship="NorthwindModel.FK_Order_Details_Products" ToRole="Products" FromRole="Order_Details" /></EntityType><EntityType Name="Order"><Key><PropertyRef Name="OrderID" /></Key><Property Name="OrderID" Type="Edm.Int32" Nullable="false" p6:StoreGeneratedPattern="Identity" xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /><Property Name="CustomerID" Type="Edm.String" MaxLength="5" FixedLength="true" Unicode="true" /><Property Name="EmployeeID" Type="Edm.Int32" /><Property Name="OrderDate" Type="Edm.DateTime" /><Property Name="RequiredDate" Type="Edm.DateTime" /><Property Name="ShippedDate" Type="Edm.DateTime" /><Property Name="ShipVia" Type="Edm.Int32" /><Property Name="Freight" Type="Edm.Decimal" Precision="19" Scale="4" /><Property Name="ShipName" Type="Edm.String" MaxLength="40" FixedLength="false" Unicode="true" /><Property Name="ShipAddress" Type="Edm.String" MaxLength="60" FixedLength="false" Unicode="true" /><Property Name="ShipCity" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="ShipRegion" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="ShipPostalCode" Type="Edm.String" MaxLength="10" FixedLength="false" Unicode="true" /><Property Name="ShipCountry" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><NavigationProperty Name="Customer" Relationship="NorthwindModel.FK_Orders_Customers" ToRole="Customers" FromRole="Orders" /><NavigationProperty Name="Employee" Relationship="NorthwindModel.FK_Orders_Employees" ToRole="Employees" FromRole="Orders" /><NavigationProperty Name="Order_Details" Relationship="NorthwindModel.FK_Order_Details_Orders" ToRole="Order_Details" FromRole="Orders" /><NavigationProperty Name="Shipper" Relationship="NorthwindModel.FK_Orders_Shippers" ToRole="Shippers" FromRole="Orders" /></EntityType><EntityType Name="Product"><Key><PropertyRef Name="ProductID" /></Key><Property Name="ProductID" Type="Edm.Int32" Nullable="false" p6:StoreGeneratedPattern="Identity" xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /><Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true" /><Property Name="SupplierID" Type="Edm.Int32" /><Property Name="CategoryID" Type="Edm.Int32" /><Property Name="QuantityPerUnit" Type="Edm.String" MaxLength="20" FixedLength="false" Unicode="true" /><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" Relationship="NorthwindModel.FK_Products_Categories" ToRole="Categories" FromRole="Products" /><NavigationProperty Name="Order_Details" Relationship="NorthwindModel.FK_Order_Details_Products" ToRole="Order_Details" FromRole="Products" /><NavigationProperty Name="Supplier" Relationship="NorthwindModel.FK_Products_Suppliers" ToRole="Suppliers" FromRole="Products" /></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" FixedLength="true" Unicode="true" /><NavigationProperty Name="Territories" Relationship="NorthwindModel.FK_Territories_Region" ToRole="Territories" FromRole="Region" /></EntityType><EntityType Name="Shipper"><Key><PropertyRef Name="ShipperID" /></Key><Property Name="ShipperID" Type="Edm.Int32" Nullable="false" p6:StoreGeneratedPattern="Identity" xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /><Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true" /><Property Name="Phone" Type="Edm.String" MaxLength="24" FixedLength="false" Unicode="true" /><NavigationProperty Name="Orders" Relationship="NorthwindModel.FK_Orders_Shippers" ToRole="Orders" FromRole="Shippers" /></EntityType><EntityType Name="Supplier"><Key><PropertyRef Name="SupplierID" /></Key><Property Name="SupplierID" Type="Edm.Int32" Nullable="false" p6:StoreGeneratedPattern="Identity" xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /><Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true" /><Property Name="ContactName" Type="Edm.String" MaxLength="30" FixedLength="false" Unicode="true" /><Property Name="ContactTitle" Type="Edm.String" MaxLength="30" FixedLength="false" Unicode="true" /><Property Name="Address" Type="Edm.String" MaxLength="60" FixedLength="false" Unicode="true" /><Property Name="City" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="Region" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="PostalCode" Type="Edm.String" MaxLength="10" FixedLength="false" Unicode="true" /><Property Name="Country" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="Phone" Type="Edm.String" MaxLength="24" FixedLength="false" Unicode="true" /><Property Name="Fax" Type="Edm.String" MaxLength="24" FixedLength="false" Unicode="true" /><Property Name="HomePage" Type="Edm.String" MaxLength="Max" FixedLength="false" Unicode="true" /><NavigationProperty Name="Products" Relationship="NorthwindModel.FK_Products_Suppliers" ToRole="Products" FromRole="Suppliers" /></EntityType><EntityType Name="Territory"><Key><PropertyRef Name="TerritoryID" /></Key><Property Name="TerritoryID" Type="Edm.String" Nullable="false" MaxLength="20" FixedLength="false" Unicode="true" /><Property Name="TerritoryDescription" Type="Edm.String" Nullable="false" MaxLength="50" FixedLength="true" Unicode="true" /><Property Name="RegionID" Type="Edm.Int32" Nullable="false" /><NavigationProperty Name="Region" Relationship="NorthwindModel.FK_Territories_Region" ToRole="Region" FromRole="Territories" /><NavigationProperty Name="Employees" Relationship="NorthwindModel.EmployeeTerritories" ToRole="Employees" FromRole="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" FixedLength="false" Unicode="true" /><Property Name="SupplierID" Type="Edm.Int32" /><Property Name="CategoryID" Type="Edm.Int32" /><Property Name="QuantityPerUnit" Type="Edm.String" MaxLength="20" FixedLength="false" Unicode="true" /><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" FixedLength="false" Unicode="true" /></EntityType><EntityType Name="Category_Sales_for_1997"><Key><PropertyRef Name="CategoryName" /></Key><Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" FixedLength="false" Unicode="true" /><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" p6:StoreGeneratedPattern="Identity" xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation" /><Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true" /></EntityType><EntityType Name="Customer_and_Suppliers_by_City"><Key><PropertyRef Name="CompanyName" /><PropertyRef Name="Relationship" /></Key><Property Name="City" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true" /><Property Name="ContactName" Type="Edm.String" MaxLength="30" FixedLength="false" Unicode="true" /><Property Name="Relationship" Type="Edm.String" Nullable="false" MaxLength="9" FixedLength="false" 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" FixedLength="false" Unicode="true" /><Property Name="ShipAddress" Type="Edm.String" MaxLength="60" FixedLength="false" Unicode="true" /><Property Name="ShipCity" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="ShipRegion" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="ShipPostalCode" Type="Edm.String" MaxLength="10" FixedLength="false" Unicode="true" /><Property Name="ShipCountry" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="CustomerID" Type="Edm.String" MaxLength="5" FixedLength="true" Unicode="true" /><Property Name="CustomerName" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true" /><Property Name="Address" Type="Edm.String" MaxLength="60" FixedLength="false" Unicode="true" /><Property Name="City" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="Region" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="PostalCode" Type="Edm.String" MaxLength="10" FixedLength="false" Unicode="true" /><Property Name="Country" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="Salesperson" Type="Edm.String" Nullable="false" MaxLength="31" FixedLength="false" Unicode="true" /><Property Name="OrderID" Type="Edm.Int32" Nullable="false" /><Property Name="OrderDate" Type="Edm.DateTime" /><Property Name="RequiredDate" Type="Edm.DateTime" /><Property Name="ShippedDate" Type="Edm.DateTime" /><Property Name="ShipperName" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true" /><Property Name="ProductID" Type="Edm.Int32" Nullable="false" /><Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true" /><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" FixedLength="false" Unicode="true" /><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" FixedLength="true" Unicode="true" /><Property Name="EmployeeID" Type="Edm.Int32" /><Property Name="OrderDate" Type="Edm.DateTime" /><Property Name="RequiredDate" Type="Edm.DateTime" /><Property Name="ShippedDate" Type="Edm.DateTime" /><Property Name="ShipVia" Type="Edm.Int32" /><Property Name="Freight" Type="Edm.Decimal" Precision="19" Scale="4" /><Property Name="ShipName" Type="Edm.String" MaxLength="40" FixedLength="false" Unicode="true" /><Property Name="ShipAddress" Type="Edm.String" MaxLength="60" FixedLength="false" Unicode="true" /><Property Name="ShipCity" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="ShipRegion" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="ShipPostalCode" Type="Edm.String" MaxLength="10" FixedLength="false" Unicode="true" /><Property Name="ShipCountry" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true" /><Property Name="Address" Type="Edm.String" MaxLength="60" FixedLength="false" Unicode="true" /><Property Name="City" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="Region" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /><Property Name="PostalCode" Type="Edm.String" MaxLength="10" FixedLength="false" Unicode="true" /><Property Name="Country" Type="Edm.String" MaxLength="15" FixedLength="false" Unicode="true" /></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" FixedLength="false" Unicode="true" /><Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true" /><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" FixedLength="false" Unicode="true" /><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" FixedLength="false" Unicode="true" /><Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true" /><Property Name="QuantityPerUnit" Type="Edm.String" MaxLength="20" FixedLength="false" Unicode="true" /><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" FixedLength="false" Unicode="true" /><Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" FixedLength="false" Unicode="true" /><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" FixedLength="false" Unicode="true" /><Property Name="ShippedDate" Type="Edm.DateTime" /></EntityType><EntityType Name="Summary_of_Sales_by_Quarter"><Key><PropertyRef Name="OrderID" /></Key><Property Name="ShippedDate" Type="Edm.DateTime" /><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.DateTime" /><Property Name="OrderID" Type="Edm.Int32" Nullable="false" /><Property Name="Subtotal" Type="Edm.Decimal" Precision="19" Scale="4" /></EntityType><Association Name="FK_Products_Categories"><End Type="NorthwindModel.Category" Role="Categories" Multiplicity="0..1" /><End Type="NorthwindModel.Product" Role="Products" Multiplicity="*" /><ReferentialConstraint><Principal Role="Categories"><PropertyRef Name="CategoryID" /></Principal><Dependent Role="Products"><PropertyRef Name="CategoryID" /></Dependent></ReferentialConstraint></Association><Association Name="CustomerCustomerDemo"><End Type="NorthwindModel.Customer" Role="Customers" Multiplicity="*" /><End Type="NorthwindModel.CustomerDemographic" Role="CustomerDemographics" Multiplicity="*" /></Association><Association Name="FK_Orders_Customers"><End Type="NorthwindModel.Customer" Role="Customers" Multiplicity="0..1" /><End Type="NorthwindModel.Order" Role="Orders" Multiplicity="*" /><ReferentialConstraint><Principal Role="Customers"><PropertyRef Name="CustomerID" /></Principal><Dependent Role="Orders"><PropertyRef Name="CustomerID" /></Dependent></ReferentialConstraint></Association><Association Name="FK_Employees_Employees"><End Type="NorthwindModel.Employee" Role="Employees" Multiplicity="0..1" /><End Type="NorthwindModel.Employee" Role="Employees1" Multiplicity="*" /><ReferentialConstraint><Principal Role="Employees"><PropertyRef Name="EmployeeID" /></Principal><Dependent Role="Employees1"><PropertyRef Name="ReportsTo" /></Dependent></ReferentialConstraint></Association><Association Name="FK_Orders_Employees"><End Type="NorthwindModel.Employee" Role="Employees" Multiplicity="0..1" /><End Type="NorthwindModel.Order" Role="Orders" Multiplicity="*" /><ReferentialConstraint><Principal Role="Employees"><PropertyRef Name="EmployeeID" /></Principal><Dependent Role="Orders"><PropertyRef Name="EmployeeID" /></Dependent></ReferentialConstraint></Association><Association Name="EmployeeTerritories"><End Type="NorthwindModel.Territory" Role="Territories" Multiplicity="*" /><End Type="NorthwindModel.Employee" Role="Employees" Multiplicity="*" /></Association><Association Name="FK_Order_Details_Orders"><End Type="NorthwindModel.Order" Role="Orders" Multiplicity="1" /><End Type="NorthwindModel.Order_Detail" Role="Order_Details" Multiplicity="*" /><ReferentialConstraint><Principal Role="Orders"><PropertyRef Name="OrderID" /></Principal><Dependent Role="Order_Details"><PropertyRef Name="OrderID" /></Dependent></ReferentialConstraint></Association><Association Name="FK_Order_Details_Products"><End Type="NorthwindModel.Product" Role="Products" Multiplicity="1" /><End Type="NorthwindModel.Order_Detail" Role="Order_Details" Multiplicity="*" /><ReferentialConstraint><Principal Role="Products"><PropertyRef Name="ProductID" /></Principal><Dependent Role="Order_Details"><PropertyRef Name="ProductID" /></Dependent></ReferentialConstraint></Association><Association Name="FK_Orders_Shippers"><End Type="NorthwindModel.Shipper" Role="Shippers" Multiplicity="0..1" /><End Type="NorthwindModel.Order" Role="Orders" Multiplicity="*" /><ReferentialConstraint><Principal Role="Shippers"><PropertyRef Name="ShipperID" /></Principal><Dependent Role="Orders"><PropertyRef Name="ShipVia" /></Dependent></ReferentialConstraint></Association><Association Name="FK_Products_Suppliers"><End Type="NorthwindModel.Supplier" Role="Suppliers" Multiplicity="0..1" /><End Type="NorthwindModel.Product" Role="Products" Multiplicity="*" /><ReferentialConstraint><Principal Role="Suppliers"><PropertyRef Name="SupplierID" /></Principal><Dependent Role="Products"><PropertyRef Name="SupplierID" /></Dependent></ReferentialConstraint></Association><Association Name="FK_Territories_Region"><End Type="NorthwindModel.Region" Role="Region" Multiplicity="1" /><End Type="NorthwindModel.Territory" Role="Territories" Multiplicity="*" /><ReferentialConstraint><Principal Role="Region"><PropertyRef Name="RegionID" /></Principal><Dependent Role="Territories"><PropertyRef Name="RegionID" /></Dependent></ReferentialConstraint></Association></Schema><Schema Namespace="ODataWebV3.Northwind.Model" xmlns="http://schemas.microsoft.com/ado/2008/09/edm"><EntityContainer Name="NorthwindEntities" m:IsDefaultEntityContainer="true" p6:LazyLoadingEnabled="true" xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation"><EntitySet Name="Categories" EntityType="NorthwindModel.Category" /><EntitySet Name="CustomerDemographics" EntityType="NorthwindModel.CustomerDemographic" /><EntitySet Name="Customers" EntityType="NorthwindModel.Customer" /><EntitySet Name="Employees" EntityType="NorthwindModel.Employee" /><EntitySet Name="Order_Details" EntityType="NorthwindModel.Order_Detail" /><EntitySet Name="Orders" EntityType="NorthwindModel.Order" /><EntitySet Name="Products" EntityType="NorthwindModel.Product" /><EntitySet Name="Regions" EntityType="NorthwindModel.Region" /><EntitySet Name="Shippers" EntityType="NorthwindModel.Shipper" /><EntitySet Name="Suppliers" EntityType="NorthwindModel.Supplier" /><EntitySet Name="Territories" EntityType="NorthwindModel.Territory" /><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" /><AssociationSet Name="FK_Products_Categories" Association="NorthwindModel.FK_Products_Categories"><End Role="Categories" EntitySet="Categories" /><End Role="Products" EntitySet="Products" /></AssociationSet><AssociationSet Name="CustomerCustomerDemo" Association="NorthwindModel.CustomerCustomerDemo"><End Role="CustomerDemographics" EntitySet="CustomerDemographics" /><End Role="Customers" EntitySet="Customers" /></AssociationSet><AssociationSet Name="FK_Orders_Customers" Association="NorthwindModel.FK_Orders_Customers"><End Role="Customers" EntitySet="Customers" /><End Role="Orders" EntitySet="Orders" /></AssociationSet><AssociationSet Name="FK_Employees_Employees" Association="NorthwindModel.FK_Employees_Employees"><End Role="Employees" EntitySet="Employees" /><End Role="Employees1" EntitySet="Employees" /></AssociationSet><AssociationSet Name="FK_Orders_Employees" Association="NorthwindModel.FK_Orders_Employees"><End Role="Employees" EntitySet="Employees" /><End Role="Orders" EntitySet="Orders" /></AssociationSet><AssociationSet Name="EmployeeTerritories" Association="NorthwindModel.EmployeeTerritories"><End Role="Employees" EntitySet="Employees" /><End Role="Territories" EntitySet="Territories" /></AssociationSet><AssociationSet Name="FK_Order_Details_Orders" Association="NorthwindModel.FK_Order_Details_Orders"><End Role="Order_Details" EntitySet="Order_Details" /><End Role="Orders" EntitySet="Orders" /></AssociationSet><AssociationSet Name="FK_Order_Details_Products" Association="NorthwindModel.FK_Order_Details_Products"><End Role="Order_Details" EntitySet="Order_Details" /><End Role="Products" EntitySet="Products" /></AssociationSet><AssociationSet Name="FK_Orders_Shippers" Association="NorthwindModel.FK_Orders_Shippers"><End Role="Orders" EntitySet="Orders" /><End Role="Shippers" EntitySet="Shippers" /></AssociationSet><AssociationSet Name="FK_Products_Suppliers" Association="NorthwindModel.FK_Products_Suppliers"><End Role="Products" EntitySet="Products" /><End Role="Suppliers" EntitySet="Suppliers" /></AssociationSet><AssociationSet Name="FK_Territories_Region" Association="NorthwindModel.FK_Territories_Region"><End Role="Region" EntitySet="Regions" /><End Role="Territories" EntitySet="Territories" /></AssociationSet></EntityContainer></Schema></edmx:DataServices></edmx:Edmx>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/serviceDocument.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/serviceDocument.json
deleted file mode 100644
index 791f961..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/serviceDocument.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "odata.metadata": "http://services.odata.org/V3/OData/OData.svc/$metadata",
- "value": [
- {
- "name": "Products",
- "url": "Products"
- },
- {
- "name": "ProductDetails",
- "url": "ProductDetails"
- },
- {
- "name": "Categories",
- "url": "Categories"
- },
- {
- "name": "Suppliers",
- "url": "Suppliers"
- },
- {
- "name": "Persons",
- "url": "Persons"
- },
- {
- "name": "PersonDetails",
- "url": "PersonDetails"
- },
- {
- "name": "Advertisements",
- "url": "Advertisements"
- }
- ]
-}
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/serviceDocument.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/serviceDocument.xml
deleted file mode 100644
index 0981814..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/serviceDocument.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?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://services.odata.org/V3/OData/OData.svc/"
- xmlns="http://www.w3.org/2007/app"
- xmlns:atom="http://www.w3.org/2005/Atom">
- <workspace>
- <atom:title>Default</atom:title>
- <collection href="Products">
- <atom:title>Products</atom:title>
- </collection>
- <collection href="ProductDetails">
- <atom:title>ProductDetails</atom:title>
- </collection>
- <collection href="Categories">
- <atom:title>Categories</atom:title>
- </collection>
- <collection href="Suppliers">
- <atom:title>Suppliers</atom:title>
- </collection>
- <collection href="Persons">
- <atom:title>Persons</atom:title>
- </collection>
- <collection href="PersonDetails">
- <atom:title>PersonDetails</atom:title>
- </collection>
- <collection href="Advertisements">
- <atom:title>Advertisements</atom:title>
- </collection>
- </workspace>
-</service>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/stacktrace.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/stacktrace.json
deleted file mode 100644
index 32e8821..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/stacktrace.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "odata.error": {
- "code": "",
- "message": {
- "lang": "en-US",
- "value": "Unsupported media type requested."
- },
- "innererror": {
- "message": "A supported MIME type could not be found that matches the content type of the response. None of the supported type(s) 'application/atom+xml;type=entry, 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' matches the content type 'application/xml; charset=UTF-8'.",
- "type": "Microsoft.Data.OData.ODataContentTypeException",
- "stacktrace": " at Microsoft.Data.OData.MediaTypeUtils.GetFormatFromContentType(String contentTypeName, ODataPayloadKind[] supportedPayloadKinds, MediaTypeResolver mediaTypeResolver, MediaType& mediaType, Encoding& encoding, ODataPayloadKind& selectedPayloadKind)\r\n at Microsoft.Data.OData.MediaTypeUtils.GetFormatFromContentType(String contentTypeHeader, ODataPayloadKind[] supportedPayloadKinds, MediaTypeResolver mediaTypeResolver, MediaType& mediaType, Encoding& encoding, ODataPayloadKind& selectedPayloadKind, String& batchBoundary)\r\n at Microsoft.Data.OData.ODataMessageReader.ProcessContentType(ODataPayloadKind[] payloadKinds)\r\n at Microsoft.Data.OData.ODataMessageReader.ReadFromInput[T](Func`2 readFunc, ODataPayloadKind[] payloadKinds)\r\n at Microsoft.Data.OData.ODataMessageReader.CreateODataEntryReader(IEdmEntitySet entitySet, IEdmEntityType entityType)\r\n at System.Data.Services.Serializers.EntityDeserializer.Read(SegmentInfo segmentInfo)\r\n at System.Data.Services.Serializers.ODataMessageReaderDeserializer.Deserialize(SegmentInfo segmentInfo)"
- }
- }
-}
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/stacktrace.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/stacktrace.xml
deleted file mode 100644
index 51c2b77..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/stacktrace.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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 content type of the response. None of the supported type(s) 'application/atom+xml;type=entry, 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' matches the content type 'text/plain; charset=UTF-8'.</m:message>
- <m:type>Microsoft.Data.OData.ODataContentTypeException</m:type>
- <m:stacktrace> at Microsoft.Data.OData.MediaTypeUtils.GetFormatFromContentType(String contentTypeName, ODataPayloadKind[] supportedPayloadKinds, MediaTypeResolver mediaTypeResolver, MediaType& mediaType, Encoding& encoding, ODataPayloadKind& selectedPayloadKind)
- at Microsoft.Data.OData.MediaTypeUtils.GetFormatFromContentType(String contentTypeHeader, ODataPayloadKind[] supportedPayloadKinds, MediaTypeResolver mediaTypeResolver, MediaType& mediaType, Encoding& encoding, ODataPayloadKind& selectedPayloadKind, String& batchBoundary)
- at Microsoft.Data.OData.ODataMessageReader.ProcessContentType(ODataPayloadKind[] payloadKinds)
- at Microsoft.Data.OData.ODataMessageReader.ReadFromInput[T](Func`2 readFunc, ODataPayloadKind[] payloadKinds)
- at System.Data.Services.Serializers.EntityDeserializer.Read(SegmentInfo segmentInfo)
- at System.Data.Services.Serializers.ODataMessageReaderDeserializer.Deserialize(SegmentInfo segmentInfo)</m:stacktrace>
- </m:innererror>
-</m:error>
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
deleted file mode 100644
index aa416d2..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
+++ /dev/null
@@ -1,106 +0,0 @@
-<?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/Products_5.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.xml
deleted file mode 100644
index 9109f2d..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?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/VipCustomer.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
deleted file mode 100644
index d233ce9..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?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/annotated.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/annotated.xml
deleted file mode 100644
index 851f960..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/annotated.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?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/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">
- <m:annotation term="com.contoso.display.style" m:type="#com.contoso.display.styleType">
- <d:order m:type="Int32">2</d:order>
- </m:annotation>
- </link>
- <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>
- <m:annotation term="com.contoso.display.style" target="LastName" m:type="#com.contoso.display.styleType">
- <d:title m:type="Boolean">true</d:title>
- <d:order m:type="Int32">1</d:order>
- </m:annotation>
- <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>
- <m:annotation term="com.contoso.display.highlight" m:type="Boolean">true</m:annotation>
- <m:annotation term="com.contoso.PersonalInfo.PhoneNumbers" m:type="#Collection(String)">
- <m:element>(203)555-1718</m:element>
- <m:element>(203)555-1719</m:element>
- </m:annotation>
-</entry>
-
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.withcomplexnavigation.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.withcomplexnavigation.xml
deleted file mode 100644
index 1a4e0cc..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.withcomplexnavigation.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
- xmlns:d="http://docs.oasis-open.org/odata/ns/data"
- xml:base="http://host/service/"
- m:context="$metadata#Customers/$entity"
- m:metadata-etag="W/"MjAxMy0wNS0xM1QxNDo1NFo="">
- <id>http://host/service/$metadata#Customers('ALFKI')</id>
- <title/>
- <summary/>
- <updated>2012-03-30T07:11:05Z</updated>
- <author>
- <name/>
- </author>
- <link rel="edit" title="Customer" href="Customers('ALFKI')"/>
- <link rel="http://docs.oasis-open.org/odata/ns/related/Orders"
- type="application/atom+xml;type=feed"
- title="Orders" href="Customers('ALFKI')/Orders"/>
- <link rel="http://docs.oasis-open.org/odata/ns/related/Supplier"
- type="application/atom+xml;type=entry"
- title="Supplier" href="Customers('ALFKI')/Supplier"/>
- <category term="#ODataDemo.Customer"
- scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
- <content type="application/xml">
- <m:properties>
- <d:ID>ALFKI</d:ID>
- <d:CompanyName>Alfreds Futterkiste</d:CompanyName>
- <d:ContactName>Maria Anders</d:ContactName>
- <d:ContactTitle>Sales Representative</d:ContactTitle>
- <d:Phone>030-0074321</d:Phone>
- <d:Fax>030-0076545</d:Fax>
- <d:Address>
- <d:Street>Obere Str. 57</d:Street>
- <d:City>Berlin</d:City>
- <d:Region m:null="true"/>
- <d:PostalCode>D-12209</d:PostalCode>
- <link rel="http://docs.oasis-open.org/odata/ns/related/Country"
- type="application/atom+xml;type=entry"
- title="Country"
- href="Customers('ALFKI')/Address/Country"/>
- </d:Address>
- </m:properties>
- </content>
-</entry>
diff --git a/lib/commons-api/pom.xml b/lib/commons-api/pom.xml
index 55ca40d..47a411a 100644
--- a/lib/commons-api/pom.xml
+++ b/lib/commons-api/pom.xml
@@ -38,28 +38,20 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
+ </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
+ <version>${maven.bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
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 93ff3bc..291e2e5 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
@@ -29,279 +29,279 @@
public interface Constants {
// Other stuff
- public final static String UTF8 = "UTF-8";
+ String UTF8 = "UTF-8";
- public final static String METADATA = "$metadata";
+ String METADATA = "$metadata";
- public final static Integer DEFAULT_PRECISION = 40;
+ Integer DEFAULT_PRECISION = 40;
- public final static Integer DEFAULT_SCALE = 25;
+ Integer DEFAULT_SCALE = 25;
// Common Namespaces
- public final static String NS_BASE = "http://docs.oasis-open.org/odata/ns/";
+ String NS_BASE = "http://docs.oasis-open.org/odata/ns/";
- public final static String NS_DATASERVICES = "http://docs.oasis-open.org/odata/ns/data";
+ String NS_DATASERVICES = "http://docs.oasis-open.org/odata/ns/data";
- public final static String NS_METADATA = "http://docs.oasis-open.org/odata/ns/metadata";
+ String NS_METADATA = "http://docs.oasis-open.org/odata/ns/metadata";
- public final static String NS_SCHEME = "http://docs.oasis-open.org/odata/ns/scheme";
+ String NS_SCHEME = "http://docs.oasis-open.org/odata/ns/scheme";
- public final static String NS_NAVIGATION_LINK_REL = "http://docs.oasis-open.org/odata/ns/related/";
+ String NS_NAVIGATION_LINK_REL = "http://docs.oasis-open.org/odata/ns/related/";
- public final static String NS_ASSOCIATION_LINK_REL = "http://docs.oasis-open.org/odata/ns/relatedlinks/";
+ String NS_ASSOCIATION_LINK_REL = "http://docs.oasis-open.org/odata/ns/relatedlinks/";
- public final static String NS_MEDIA_EDIT_LINK_REL = "http://docs.oasis-open.org/odata/ns/edit-media/";
+ String NS_MEDIA_EDIT_LINK_REL = "http://docs.oasis-open.org/odata/ns/edit-media/";
- public final static String NS_DELTA_LINK_REL = "http://docs.oasis-open.org/odata/ns/delta";
+ String NS_DELTA_LINK_REL = "http://docs.oasis-open.org/odata/ns/delta";
// XML namespaces and prefixes
- public final static String NS_ATOM = "http://www.w3.org/2005/Atom";
+ String NS_ATOM = "http://www.w3.org/2005/Atom";
- public static final String NS_GEORSS = "http://www.georss.org/georss";
+ String NS_GEORSS = "http://www.georss.org/georss";
- public static final String NS_GML = "http://www.opengis.net/gml";
+ String NS_GML = "http://www.opengis.net/gml";
- public static final String NS_ATOM_TOMBSTONE = "http://purl.org/atompub/tombstones/1.0";
+ String NS_ATOM_TOMBSTONE = "http://purl.org/atompub/tombstones/1.0";
- public static final String PREFIX_DATASERVICES = "d";
+ String PREFIX_DATASERVICES = "d";
- public static final String PREFIX_METADATA = "m";
+ String PREFIX_METADATA = "m";
- public static final String PREFIX_GEORSS = "georss";
+ String PREFIX_GEORSS = "georss";
- public static final String PREFIX_GML = "gml";
+ String PREFIX_GML = "gml";
- public final static String SRS_URLPREFIX = "http://www.opengis.net/def/crs/EPSG/0/";
+ String SRS_URLPREFIX = "http://www.opengis.net/def/crs/EPSG/0/";
// Link rel(s)
- public static final String EDIT_LINK_REL = "edit";
+ String EDIT_LINK_REL = "edit";
- public static final String SELF_LINK_REL = "self";
+ String SELF_LINK_REL = "self";
- public static final String EDITMEDIA_LINK_REL = "edit-media";
+ String EDITMEDIA_LINK_REL = "edit-media";
- public static final String NEXT_LINK_REL = "next";
+ String NEXT_LINK_REL = "next";
// XML elements and attributes
- public static final String PROPERTIES = "properties";
+ String PROPERTIES = "properties";
- public static final String ELEM_ELEMENT = "element";
+ String ELEM_ELEMENT = "element";
- public final static String ATTR_TYPE = "type";
+ String ATTR_TYPE = "type";
- public final static String ATTR_NULL = "null";
+ String ATTR_NULL = "null";
- public static final String ATTR_XML_BASE = "base";
+ String ATTR_XML_BASE = "base";
- public static final QName QNAME_ATTR_XML_BASE = new QName(XMLConstants.XML_NS_URI, ATTR_XML_BASE);
+ QName QNAME_ATTR_XML_BASE = new QName(XMLConstants.XML_NS_URI, ATTR_XML_BASE);
- public static final String CONTEXT = "context";
+ String CONTEXT = "context";
- public static final String ATTR_REL = "rel";
+ String ATTR_REL = "rel";
- public static final String ATTR_TITLE = "title";
+ String ATTR_TITLE = "title";
- public static final String ATTR_METADATA = "metadata";
+ String ATTR_METADATA = "metadata";
- public static final String ATTR_HREF = "href";
+ String ATTR_HREF = "href";
- public static final String ATTR_REF = "ref";
+ String ATTR_REF = "ref";
- public static final String ATTR_TARGET = "target";
+ String ATTR_TARGET = "target";
- public static final String ATTR_SRSNAME = "srsName";
+ String ATTR_SRSNAME = "srsName";
- public static final QName QNAME_ATTR_SRSNAME = new QName(NS_GML, ATTR_SRSNAME);
+ QName QNAME_ATTR_SRSNAME = new QName(NS_GML, ATTR_SRSNAME);
- public static final String ELEM_POINT = "Point";
+ String ELEM_POINT = "Point";
- public static final String ELEM_MULTIPOINT = "MultiPoint";
+ String ELEM_MULTIPOINT = "MultiPoint";
- public static final String ELEM_POINTMEMBERS = "pointMembers";
+ String ELEM_POINTMEMBERS = "pointMembers";
- public static final QName QNAME_POINTMEMBERS = new QName(NS_GML, ELEM_POINTMEMBERS);
+ QName QNAME_POINTMEMBERS = new QName(NS_GML, ELEM_POINTMEMBERS);
- public static final String ELEM_LINESTRING = "LineString";
+ String ELEM_LINESTRING = "LineString";
- public static final QName QNAME_LINESTRING = new QName(NS_GML, ELEM_LINESTRING);
+ QName QNAME_LINESTRING = new QName(NS_GML, ELEM_LINESTRING);
- public static final String ELEM_MULTILINESTRING = "MultiCurve";
+ String ELEM_MULTILINESTRING = "MultiCurve";
- public static final String ELEM_LINESTRINGMEMBERS = "curveMembers";
+ String ELEM_LINESTRINGMEMBERS = "curveMembers";
- public static final String ELEM_POLYGON = "Polygon";
+ String ELEM_POLYGON = "Polygon";
- public static final QName QNAME_POLYGON = new QName(NS_GML, ELEM_POLYGON);
+ QName QNAME_POLYGON = new QName(NS_GML, ELEM_POLYGON);
- public static final String ELEM_POLYGON_EXTERIOR = "exterior";
+ String ELEM_POLYGON_EXTERIOR = "exterior";
- public static final QName QNAME_POLYGON_EXTERIOR = new QName(NS_GML, ELEM_POLYGON_EXTERIOR);
+ QName QNAME_POLYGON_EXTERIOR = new QName(NS_GML, ELEM_POLYGON_EXTERIOR);
- public static final String ELEM_POLYGON_INTERIOR = "interior";
+ String ELEM_POLYGON_INTERIOR = "interior";
- public static final QName QNAME_POLYGON_INTERIOR = new QName(NS_GML, ELEM_POLYGON_INTERIOR);
+ QName QNAME_POLYGON_INTERIOR = new QName(NS_GML, ELEM_POLYGON_INTERIOR);
- public static final String ELEM_POLYGON_LINEARRING = "LinearRing";
+ String ELEM_POLYGON_LINEARRING = "LinearRing";
- public static final String ELEM_MULTIPOLYGON = "MultiSurface";
+ String ELEM_MULTIPOLYGON = "MultiSurface";
- public static final String ELEM_SURFACEMEMBERS = "surfaceMembers";
+ String ELEM_SURFACEMEMBERS = "surfaceMembers";
- public static final String ELEM_GEOCOLLECTION = "MultiGeometry";
+ String ELEM_GEOCOLLECTION = "MultiGeometry";
- public static final String ELEM_GEOMEMBERS = "geometryMembers";
+ String ELEM_GEOMEMBERS = "geometryMembers";
- public static final QName QNAME_GEOMEMBERS = new QName(NS_GML, ELEM_GEOMEMBERS);
+ QName QNAME_GEOMEMBERS = new QName(NS_GML, ELEM_GEOMEMBERS);
- public static final String ELEM_POS = "pos";
+ String ELEM_POS = "pos";
- public static final String ELEM_PROPERTY = "property";
+ String ELEM_PROPERTY = "property";
- public static final String ELEM_LINKS = "links";
+ String ELEM_LINKS = "links";
- public static final String ELEM_URI = "uri";
+ String ELEM_URI = "uri";
- public final static String ELEM_REASON = "reason";
+ String ELEM_REASON = "reason";
- public static final String ELEM_DELETED_LINK = "deleted-link";
+ String ELEM_DELETED_LINK = "deleted-link";
- public static final String ATTR_SOURCE = "source";
+ String ATTR_SOURCE = "source";
- public static final String ATTR_RELATIONSHIP = "relationship";
+ String ATTR_RELATIONSHIP = "relationship";
- public static final String ANNOTATION = "annotation";
+ String ANNOTATION = "annotation";
// JSON stuff
- public final static String JSON_METADATA = "odata.metadata";
+ String JSON_METADATA = "odata.metadata";
- public final static String JSON_TYPE = "@odata.type";
+ String JSON_TYPE = "@odata.type";
- public final static String JSON_ID = "@odata.id";
+ String JSON_ID = "@odata.id";
- public final static String JSON_READ_LINK = "@odata.readLink";
+ String JSON_READ_LINK = "@odata.readLink";
- public final static String JSON_EDIT_LINK = "@odata.editLink";
+ String JSON_EDIT_LINK = "@odata.editLink";
- public final static String JSON_CONTEXT = "@odata.context";
+ String JSON_CONTEXT = "@odata.context";
- public final static String JSON_ETAG = "@odata.etag";
+ String JSON_ETAG = "@odata.etag";
- public final static String JSON_MEDIA_ETAG = "@odata.mediaEtag";
+ String JSON_MEDIA_ETAG = "@odata.mediaEtag";
- public final static String JSON_MEDIA_CONTENT_TYPE = "@odata.mediaContentType";
+ String JSON_MEDIA_CONTENT_TYPE = "@odata.mediaContentType";
- public final static String JSON_MEDIA_READ_LINK = "@odata.mediaReadLink";
+ String JSON_MEDIA_READ_LINK = "@odata.mediaReadLink";
- public final static String JSON_MEDIA_EDIT_LINK = "@odata.mediaEditLink";
+ String JSON_MEDIA_EDIT_LINK = "@odata.mediaEditLink";
- public final static String JSON_METADATA_ETAG = "@odata.metadataEtag";
+ String JSON_METADATA_ETAG = "@odata.metadataEtag";
- public final static String JSON_BIND_LINK_SUFFIX = "@odata.bind";
+ String JSON_BIND_LINK_SUFFIX = "@odata.bind";
- public final static String JSON_ASSOCIATION_LINK = "@odata.associationLink";
+ String JSON_ASSOCIATION_LINK = "@odata.associationLink";
- public final static String JSON_NAVIGATION_LINK = "@odata.navigationLink";
+ String JSON_NAVIGATION_LINK = "@odata.navigationLink";
- public final static String JSON_COUNT = "@odata.count";
+ String JSON_COUNT = "@odata.count";
- public final static String JSON_NEXT_LINK = "@odata.nextLink";
+ String JSON_NEXT_LINK = "@odata.nextLink";
- public final static String JSON_DELTA_LINK = "@odata.deltaLink";
+ String JSON_DELTA_LINK = "@odata.deltaLink";
- public final static String JSON_ERROR = "error";
+ String JSON_ERROR = "error";
- public final static String JSON_NULL = "odata.null";
+ String JSON_NULL = "odata.null";
- public final static String VALUE = "value";
+ String VALUE = "value";
- public final static String JSON_URL = "url";
+ String JSON_URL = "url";
- public final static String JSON_COORDINATES = "coordinates";
+ String JSON_COORDINATES = "coordinates";
- public final static String JSON_GEOMETRIES = "geometries";
+ String JSON_GEOMETRIES = "geometries";
- public final static String JSON_CRS = "crs";
+ String JSON_CRS = "crs";
- public final static String JSON_NAME = "name";
+ String JSON_NAME = "name";
// Atom stuff
- public final static String ATOM_ELEM_ENTRY = "entry";
+ String ATOM_ELEM_ENTRY = "entry";
- public static final QName QNAME_ATOM_ELEM_ENTRY = new QName(NS_ATOM, ATOM_ELEM_ENTRY);
+ QName QNAME_ATOM_ELEM_ENTRY = new QName(NS_ATOM, ATOM_ELEM_ENTRY);
- public final static String ATOM_ELEM_ENTRY_REF = "ref";
+ String ATOM_ELEM_ENTRY_REF = "ref";
- public final static String ATOM_ATTR_ID = "id";
+ String ATOM_ATTR_ID = "id";
- public final static QName QNAME_ATOM_ATTR_ID = new QName(ATOM_ATTR_ID);
+ QName QNAME_ATOM_ATTR_ID = new QName(ATOM_ATTR_ID);
- public final static String ATOM_ELEM_FEED = "feed";
+ String ATOM_ELEM_FEED = "feed";
- public static final QName QNAME_ATOM_ELEM_FEED = new QName(NS_ATOM, ATOM_ELEM_FEED);
+ QName QNAME_ATOM_ELEM_FEED = new QName(NS_ATOM, ATOM_ELEM_FEED);
- public final static String ATOM_ELEM_CATEGORY = "category";
+ String ATOM_ELEM_CATEGORY = "category";
- public static final QName QNAME_ATOM_ELEM_CATEGORY = new QName(NS_ATOM, ATOM_ELEM_CATEGORY);
+ QName QNAME_ATOM_ELEM_CATEGORY = new QName(NS_ATOM, ATOM_ELEM_CATEGORY);
- public static final String ATOM_ELEM_COUNT = "count";
+ String ATOM_ELEM_COUNT = "count";
- public final static String ATOM_ELEM_ID = "id";
+ String ATOM_ELEM_ID = "id";
- public static final QName QNAME_ATOM_ELEM_ID = new QName(NS_ATOM, ATOM_ELEM_ID);
+ QName QNAME_ATOM_ELEM_ID = new QName(NS_ATOM, ATOM_ELEM_ID);
- public static final String ATOM_ELEM_TITLE = "title";
+ String ATOM_ELEM_TITLE = "title";
- public static final QName QNAME_ATOM_ELEM_TITLE = new QName(NS_ATOM, ATOM_ELEM_TITLE);
+ QName QNAME_ATOM_ELEM_TITLE = new QName(NS_ATOM, ATOM_ELEM_TITLE);
- public static final String ATOM_ELEM_SUMMARY = "summary";
+ String ATOM_ELEM_SUMMARY = "summary";
- public static final QName QNAME_ATOM_ELEM_SUMMARY = new QName(NS_ATOM, ATOM_ELEM_SUMMARY);
+ QName QNAME_ATOM_ELEM_SUMMARY = new QName(NS_ATOM, ATOM_ELEM_SUMMARY);
- public static final String ATOM_ELEM_UPDATED = "updated";
+ String ATOM_ELEM_UPDATED = "updated";
- public static final QName QNAME_ATOM_ELEM_UPDATED = new QName(NS_ATOM, ATOM_ELEM_UPDATED);
+ QName QNAME_ATOM_ELEM_UPDATED = new QName(NS_ATOM, ATOM_ELEM_UPDATED);
- public final static String ATOM_ELEM_LINK = "link";
+ String ATOM_ELEM_LINK = "link";
- public static final QName QNAME_ATOM_ELEM_LINK = new QName(NS_ATOM, ATOM_ELEM_LINK);
+ QName QNAME_ATOM_ELEM_LINK = new QName(NS_ATOM, ATOM_ELEM_LINK);
- public final static String ATOM_ELEM_CONTENT = "content";
+ String ATOM_ELEM_CONTENT = "content";
- public static final QName QNAME_ATOM_ELEM_CONTENT = new QName(NS_ATOM, ATOM_ELEM_CONTENT);
+ QName QNAME_ATOM_ELEM_CONTENT = new QName(NS_ATOM, ATOM_ELEM_CONTENT);
- public static final String ATOM_ELEM_ACTION = "action";
+ String ATOM_ELEM_ACTION = "action";
- public static final String ATOM_ELEM_INLINE = "inline";
+ String ATOM_ELEM_INLINE = "inline";
- public static final String ATOM_ATTR_TERM = "term";
+ String ATOM_ATTR_TERM = "term";
- public static final String ATOM_ATTR_SCHEME = "scheme";
+ String ATOM_ATTR_SCHEME = "scheme";
- public static final String ATOM_ATTR_SRC = "src";
+ String ATOM_ATTR_SRC = "src";
- public static final String ATOM_ATTR_ETAG = "etag";
+ String ATOM_ATTR_ETAG = "etag";
- public static final String ATOM_ATTR_METADATAETAG = "metadata-etag";
+ String ATOM_ATTR_METADATAETAG = "metadata-etag";
- public static final String ATOM_ELEM_DELETED_ENTRY = "deleted-entry";
+ String ATOM_ELEM_DELETED_ENTRY = "deleted-entry";
// error stuff
- public static final String ERROR_CODE = "code";
+ String ERROR_CODE = "code";
- public static final String ERROR_MESSAGE = "message";
+ String ERROR_MESSAGE = "message";
- public static final String ERROR_TARGET = "target";
+ String ERROR_TARGET = "target";
- public static final String ERROR_DETAILS = "details";
+ String ERROR_DETAILS = "details";
- public static final String ERROR_INNERERROR = "innererror";
+ String ERROR_INNERERROR = "innererror";
// canonical functions to be applied via dynamic annotation <tt>Apply</tt>
- public static final String CANONICAL_FUNCTION_CONCAT = "odata.concat";
+ String CANONICAL_FUNCTION_CONCAT = "odata.concat";
- public static final String CANONICAL_FUNCTION_FILLURITEMPLATE = "odata.fillUriTemplate";
+ String CANONICAL_FUNCTION_FILLURITEMPLATE = "odata.fillUriTemplate";
- public static final String CANONICAL_FUNCTION_URIENCODE = "odata.uriEncode";
+ String CANONICAL_FUNCTION_URIENCODE = "odata.uriEncode";
String MEDIA_EDIT_LINK_TYPE = "*/*";
String ENTITY_NAVIGATION_LINK_TYPE = ContentType.APPLICATION_ATOM_XML_ENTRY.toContentTypeString();
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ODataError.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ODataError.java
deleted file mode 100644
index b51fcc1..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ODataError.java
+++ /dev/null
@@ -1,132 +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;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * OData error.
- */
-public class ODataError {
-
- private String code;
- private String message;
- private String target;
- private List<ODataErrorDetail> details;
- private Map<String, String> innerError;
-
- /**
- * The value for the code name/value pair is a language-independent string. Its value is a service-defined error code.
- * This code serves as a sub-status for the HTTP error code specified in the response. MAY be null.
- * @return the error code as a string
- */
- public String getCode() {
- return code;
- }
-
- /**
- * The value for the code name/value pair is a language-independent string. Its value is a service-defined error code.
- * This code serves as a sub-status for the HTTP error code specified in the response. MAY be null.
- * @param code
- * @return this for method chaining
- */
- public ODataError setCode(final String code) {
- this.code = code;
- return this;
- }
-
- /**
- * The value for the message name/value pair MUST be a human-readable, language-dependent representation of the error.
- * MUST not be null
- * @return the message string
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * The value for the message name/value pair MUST be a human-readable, language-dependent representation of the error.
- * MUST not be null
- * @param message
- * @return this for method chaining
- */
- public ODataError setMessage(final String message) {
- this.message = message;
- return this;
- }
-
- /**
- * The value for the target name/value pair is the target of the particular error (for example, the name of the
- * property in error). MAY be null.
- * @return the target string
- */
- public String getTarget() {
- return target;
- }
-
- /**
- * The value for the target name/value pair is the target of the particular error (for example, the name of the
- * property in error). MAY be null.
- * @param target
- * @return this for method chaining
- */
- public ODataError setTarget(final String target) {
- this.target = target;
- return this;
- }
-
- /**
- * Gets error details.
- *
- * @return ODataErrorDetail list.
- */
- public List<ODataErrorDetail> getDetails() {
- return details;
- }
-
- /**
- * Sets error details.
- *
- * @return this for method chaining.
- */
- public ODataError setDetails(final List<ODataErrorDetail> details) {
- this.details = details;
- return this;
- }
-
- /**
- * Gets server defined key-value pairs for debug environment only.
- *
- * @return a pair representing server defined object. MAY be null.
- */
- public Map<String, String> getInnerError() {
- return innerError;
- }
-
- /**
- * Sets server defined key-value pairs for debug environment only.
- *
- * @return this for method chaining.
- */
- public ODataError setInnerError(final Map<String, String> innerError) {
- this.innerError = innerError;
- return this;
- }
-}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ODataErrorDetail.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ODataErrorDetail.java
deleted file mode 100644
index 10dd1da..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ODataErrorDetail.java
+++ /dev/null
@@ -1,73 +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;
-
-/**
- * OData details, for example <tt>{ "error": {..., "details":[
- * {"code": "301","target": "$search" ,"message": "$search query option not supported"}
- * ],...}}</tt>.
- */
-public class ODataErrorDetail {
-
- private String code;
- private String message;
- private String target;
-
- /**
- * Gets error code.
- *
- * @return error code.
- */
- public String getCode() {
- return code;
- }
-
- public ODataErrorDetail setCode(final String code) {
- this.code = code;
- return this;
- }
-
- /**
- * Gets error message.
- *
- * @return error message.
- */
- public String getMessage() {
- return message;
- }
-
- public ODataErrorDetail setMessage(final String message) {
- this.message = message;
- return this;
- }
-
- /**
- * Gets error target.
- *
- * @return error message.
- */
- public String getTarget() {
- return target;
- }
-
- public ODataErrorDetail setTarget(final String target) {
- this.target = target;
- return this;
- }
-}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ODataException.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ODataException.java
deleted file mode 100644
index dce6111..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ODataException.java
+++ /dev/null
@@ -1,37 +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;
-
-public class ODataException extends Exception {
-
- private static final long serialVersionUID = 3057981437954048107L;
-
- public ODataException(final String msg) {
- super(msg);
- }
-
- public ODataException(final String msg, final Throwable cause) {
- super(msg, cause);
- }
-
- public ODataException(final Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ODataPropertyType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ODataPropertyType.java
deleted file mode 100644
index 4d6d2b1..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ODataPropertyType.java
+++ /dev/null
@@ -1,44 +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;
-
-public enum ODataPropertyType {
-
- /**
- * Primitive (including geospatial).
- */
- PRIMITIVE,
- /**
- * Enum.
- */
- ENUM,
- /**
- * Collection.
- */
- COLLECTION,
- /**
- * Complex.
- */
- COMPLEX,
- /**
- * Empty type (possibly, no type information could be retrieved).
- */
- EMPTY
-
-}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ODataRuntimeException.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ODataRuntimeException.java
deleted file mode 100644
index b8b6964..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ODataRuntimeException.java
+++ /dev/null
@@ -1,37 +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;
-
-public class ODataRuntimeException extends RuntimeException {
-
- private static final long serialVersionUID = 5492375572049190883L;
-
- public ODataRuntimeException(final String msg) {
- super(msg);
- }
-
- public ODataRuntimeException(final String msg, final Exception cause) {
- super(msg, cause);
- }
-
- public ODataRuntimeException(final Exception cause) {
- super(cause);
- }
-
-}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java
index 3c482c7..4ff3a0f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java
@@ -30,7 +30,7 @@
* href="http://docs.oasis-open.org/odata/odata/v4.0/os/part1-protocol/odata-v4.0-os-part1-protocol.html#_Toc372793655">
* protocol specification</a>.
*/
-public class ContextURL {
+public final class ContextURL {
private URI serviceRoot;
@@ -48,6 +48,12 @@
private Suffix suffix;
+ private String odataPath;
+
+ public String getODataPath() {
+ return odataPath;
+ }
+
public enum Suffix {
ENTITY("$entity"), REFERENCE("$ref"),
@@ -55,7 +61,7 @@
private final String representation;
- private Suffix(final String representation) {
+ Suffix(final String representation) {
this.representation = representation;
}
@@ -128,7 +134,12 @@
public static final class Builder {
- private ContextURL contextURL = new ContextURL();
+ private final ContextURL contextURL = new ContextURL();
+
+ public Builder oDataPath(String oDataPath) {
+ contextURL.odataPath = oDataPath;
+ return this;
+ }
public Builder serviceRoot(final URI serviceRoot) {
contextURL.serviceRoot = serviceRoot;
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Parameter.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Parameter.java
index 80e7cf8..c6ee347 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Parameter.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Parameter.java
@@ -20,7 +20,7 @@
public class Parameter extends Valuable {
- String name;
+ private String name;
/**
* @return name of the parameter
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/PropertyType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/PropertyType.java
new file mode 100644
index 0000000..70e9186
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/PropertyType.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.api.data;
+
+/**
+ * Enumeration for all OData property types.
+ */
+public enum PropertyType {
+
+ /**
+ * Primitive (including geospatial).
+ */
+ PRIMITIVE,
+ /**
+ * Enum.
+ */
+ ENUM,
+ /**
+ * Collection.
+ */
+ COLLECTION,
+ /**
+ * Complex.
+ */
+ COMPLEX,
+ /**
+ * Empty type (possibly, no type information could be retrieved).
+ */
+ EMPTY
+}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeException.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeException.java
index 92da8db..fb865cb 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeException.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeException.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.commons.api.edm;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
public class EdmPrimitiveTypeException extends ODataException {
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java
index 1a12156..dcba9ee 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java
@@ -18,6 +18,9 @@
*/
package org.apache.olingo.commons.api.edm;
+/**
+ * Enumeration of all primitive type kinds.
+ */
public enum EdmPrimitiveTypeKind {
Binary,
@@ -72,10 +75,6 @@
return new FullQualifiedName(EdmPrimitiveType.EDM_NAMESPACE, toString());
}
- // public static EdmPrimitiveTypeKind valueOf(final ODataServiceVersion version, final String name) {
- // return valueOf(name);
- // }
-
/**
* Gets <tt>EdmPrimitiveTypeKind</tt> from a full-qualified type name, for the given OData protocol version.
*
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/FullQualifiedName.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/FullQualifiedName.java
index 7b99059..4852294 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/FullQualifiedName.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/FullQualifiedName.java
@@ -20,13 +20,10 @@
import java.io.Serializable;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-
/**
* A full qualified name of any element in the EDM consists of a name and a namespace.
*/
-public class FullQualifiedName implements Serializable {
+public final class FullQualifiedName implements Serializable {
private static final long serialVersionUID = -4063629050858999076L;
@@ -83,13 +80,32 @@
}
@Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ FullQualifiedName that = (FullQualifiedName) o;
+
+ if (namespace != null ? !namespace.equals(that.namespace) : that.namespace != null) {
+ return false;
+ }
+ if (name != null ? !name.equals(that.name) : that.name != null) {
+ return false;
+ }
+ return !(fqn != null ? !fqn.equals(that.fqn) : that.fqn != null);
+
}
@Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
+ public int hashCode() {
+ int result = namespace != null ? namespace.hashCode() : 0;
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ result = 31 * result + (fqn != null ? fqn.hashCode() : 0);
+ return result;
}
@Override
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/SRID.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/SRID.java
index c22f59a..fc54848 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/SRID.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/SRID.java
@@ -18,12 +18,10 @@
*/
package org.apache.olingo.commons.api.edm.geo;
-import java.io.Serializable;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import java.io.Serializable;
+
/**
* A geometry or geography property MAY define a value for the SRID attribute. The value of this attribute identifies
* which spatial reference system is applied to values of the property on type instances.
@@ -34,7 +32,7 @@
* Standards Track Work Product Copyright © OASIS Open 2013. All Rights Reserved. 19 November 2013 Page 22 of 83The
* valid values of the SRID attribute and their meanings are as defined by the European Petroleum Survey Group [EPSG].
*/
-public class SRID implements Serializable {
+public final class SRID implements Serializable {
private static final String VARIABLE = "variable";
@@ -75,11 +73,19 @@
}
private String getValue() {
- return value == null
- ? dimension == Dimension.GEOMETRY
- ? "0"
- : "4326"
- : value.toString();
+ if (value == null) {
+ if (dimension == Dimension.GEOMETRY) {
+ return "0";
+ } else {
+ return "4326";
+ }
+ }
+
+ return value.toString();
+// return value == null ? dimension == Dimension.GEOMETRY
+// ? "0"
+// : "4326"
+// : value.getName();
}
private boolean isVariable() {
@@ -91,13 +97,32 @@
}
@Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ SRID srid = (SRID) o;
+
+ if (dimension != srid.dimension) {
+ return false;
+ }
+ if (value != null ? !value.equals(srid.value) : srid.value != null) {
+ return false;
+ }
+ return !(variable != null ? !variable.equals(srid.variable) : srid.variable != null);
+
}
@Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
+ public int hashCode() {
+ int result = dimension != null ? dimension.hashCode() : 0;
+ result = 31 * result + (value != null ? value.hashCode() : 0);
+ result = 31 * result + (variable != null ? variable.hashCode() : 0);
+ return result;
}
@Override
@@ -106,5 +131,4 @@
? VARIABLE
: getValue();
}
-
}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlAbstractEdmProvider.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlAbstractEdmProvider.java
index cb53478..335836e 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlAbstractEdmProvider.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlAbstractEdmProvider.java
@@ -20,7 +20,7 @@
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
public abstract class CsdlAbstractEdmProvider implements CsdlEdmProvider {
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlAnnotation.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlAnnotation.java
index db4413c..4612ead 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlAnnotation.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlAnnotation.java
@@ -61,10 +61,6 @@
return this;
}
- // public List<Annotation> getAnnotation() {
- // return annotation;
- // }
-
public CsdlAnnotation setAnnotations(final List<CsdlAnnotation> annotation) {
this.annotation = annotation;
return this;
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlEdmProvider.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlEdmProvider.java
index cc92d86..61be99c 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlEdmProvider.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlEdmProvider.java
@@ -20,7 +20,7 @@
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
public interface CsdlEdmProvider {
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlNamed.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlNamed.java
index 4529014..f82edc2 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlNamed.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/CsdlNamed.java
@@ -18,9 +18,8 @@
*/
package org.apache.olingo.commons.api.edm.provider;
-import java.io.Serializable;
-public interface CsdlNamed extends Serializable {
+public interface CsdlNamed {
String getName();
}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/AnnotationExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/AnnotationExpression.java
index 77aeaa7..834ff9e 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/AnnotationExpression.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/AnnotationExpression.java
@@ -18,7 +18,9 @@
*/
package org.apache.olingo.commons.api.edm.provider.annotation;
-public interface AnnotationExpression {
+import java.io.Serializable;
+
+public interface AnnotationExpression extends Serializable {
boolean isConstant();
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ex/ODataError.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ex/ODataError.java
new file mode 100644
index 0000000..4c29e0a
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ex/ODataError.java
@@ -0,0 +1,132 @@
+/*
+ * 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.ex;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * OData error.
+ */
+public class ODataError {
+
+ private String code;
+ private String message;
+ private String target;
+ private List<ODataErrorDetail> details;
+ private Map<String, String> innerError;
+
+ /**
+ * The value for the code name/value pair is a language-independent string. Its value is a service-defined error code.
+ * This code serves as a sub-status for the HTTP error code specified in the response. MAY be null.
+ * @return the error code as a string
+ */
+ public String getCode() {
+ return code;
+ }
+
+ /**
+ * The value for the code name/value pair is a language-independent string. Its value is a service-defined error code.
+ * This code serves as a sub-status for the HTTP error code specified in the response. MAY be null.
+ * @param code
+ * @return this for method chaining
+ */
+ public ODataError setCode(final String code) {
+ this.code = code;
+ return this;
+ }
+
+ /**
+ * The value for the message name/value pair MUST be a human-readable, language-dependent representation of the error.
+ * MUST not be null
+ * @return the message string
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * The value for the message name/value pair MUST be a human-readable, language-dependent representation of the error.
+ * MUST not be null
+ * @param message
+ * @return this for method chaining
+ */
+ public ODataError setMessage(final String message) {
+ this.message = message;
+ return this;
+ }
+
+ /**
+ * The value for the target name/value pair is the target of the particular error (for example, the name of the
+ * property in error). MAY be null.
+ * @return the target string
+ */
+ public String getTarget() {
+ return target;
+ }
+
+ /**
+ * The value for the target name/value pair is the target of the particular error (for example, the name of the
+ * property in error). MAY be null.
+ * @param target
+ * @return this for method chaining
+ */
+ public ODataError setTarget(final String target) {
+ this.target = target;
+ return this;
+ }
+
+ /**
+ * Gets error details.
+ *
+ * @return ODataErrorDetail list.
+ */
+ public List<ODataErrorDetail> getDetails() {
+ return details;
+ }
+
+ /**
+ * Sets error details.
+ *
+ * @return this for method chaining.
+ */
+ public ODataError setDetails(final List<ODataErrorDetail> details) {
+ this.details = details;
+ return this;
+ }
+
+ /**
+ * Gets server defined key-value pairs for debug environment only.
+ *
+ * @return a pair representing server defined object. MAY be null.
+ */
+ public Map<String, String> getInnerError() {
+ return innerError;
+ }
+
+ /**
+ * Sets server defined key-value pairs for debug environment only.
+ *
+ * @return this for method chaining.
+ */
+ public ODataError setInnerError(final Map<String, String> innerError) {
+ this.innerError = innerError;
+ return this;
+ }
+}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ex/ODataErrorDetail.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ex/ODataErrorDetail.java
new file mode 100644
index 0000000..53c4de6
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ex/ODataErrorDetail.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.commons.api.ex;
+
+/**
+ * OData details, for example <tt>{ "error": {..., "details":[
+ * {"code": "301","target": "$search" ,"message": "$search query option not supported"}
+ * ],...}}</tt>.
+ */
+public class ODataErrorDetail {
+
+ private String code;
+ private String message;
+ private String target;
+
+ /**
+ * Gets error code.
+ *
+ * @return error code.
+ */
+ public String getCode() {
+ return code;
+ }
+
+ public ODataErrorDetail setCode(final String code) {
+ this.code = code;
+ return this;
+ }
+
+ /**
+ * Gets error message.
+ *
+ * @return error message.
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ public ODataErrorDetail setMessage(final String message) {
+ this.message = message;
+ return this;
+ }
+
+ /**
+ * Gets error target.
+ *
+ * @return error message.
+ */
+ public String getTarget() {
+ return target;
+ }
+
+ /**
+ * Set the error target.
+ *
+ * @param target the error target
+ * @return this ODataErrorDetail instance (fluent builder)
+ */
+ public ODataErrorDetail setTarget(final String target) {
+ this.target = target;
+ return this;
+ }
+}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ex/ODataException.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ex/ODataException.java
new file mode 100644
index 0000000..2c19181
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ex/ODataException.java
@@ -0,0 +1,37 @@
+/*
+ * 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.ex;
+
+public class ODataException extends Exception {
+
+ private static final long serialVersionUID = 3057981437954048107L;
+
+ public ODataException(final String msg) {
+ super(msg);
+ }
+
+ public ODataException(final String msg, final Throwable cause) {
+ super(msg, cause);
+ }
+
+ public ODataException(final Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ex/ODataRuntimeException.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ex/ODataRuntimeException.java
new file mode 100644
index 0000000..fe9001d
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/ex/ODataRuntimeException.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.api.ex;
+
+/**
+ * Core runtime exception for OData.
+ */
+public class ODataRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = 5492375572049190883L;
+
+ /**
+ * Create with <code>message</code>.
+ *
+ * @param msg message text for exception
+ */
+ public ODataRuntimeException(final String msg) {
+ super(msg);
+ }
+
+ /**
+ * Create with <code>message</code> for and <code>cause</code> of exception.
+ *
+ * @param msg message text for exception
+ * @param cause cause of exception
+ */
+ public ODataRuntimeException(final String msg, final Exception cause) {
+ super(msg, cause);
+ }
+
+ /**
+ * Create with <code>cause</code> of exception.
+ *
+ * @param cause cause of exception
+ */
+ public ODataRuntimeException(final Exception cause) {
+ super(cause);
+ }
+
+}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/AcceptType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/AcceptType.java
index 734e007..bd573af 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/AcceptType.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/AcceptType.java
@@ -22,8 +22,8 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
-import java.util.TreeMap;
/**
* Internally used {@link AcceptType} for OData library.
@@ -43,7 +43,7 @@
*
* Once created an {@link AcceptType} is <b>IMMUTABLE</b>.
*/
-public class AcceptType {
+public final class AcceptType {
private final String type;
private final String subtype;
@@ -54,26 +54,17 @@
final Float quality) {
this.type = type;
this.subtype = subtype;
- this.parameters = createParameterMap();
+ this.parameters = TypeUtil.createParameterMap();
this.parameters.putAll(parameters);
this.quality = quality;
}
- private static TreeMap<String, String> createParameterMap() {
- return new TreeMap<String, String>(new Comparator<String>() {
- @Override
- public int compare(final String o1, final String o2) {
- return o1.compareToIgnoreCase(o2);
- }
- });
- }
-
private AcceptType(final String type) {
if (type == null) {
throw new IllegalArgumentException("Type parameter MUST NOT be null.");
}
List<String> typeSubtype = new ArrayList<String>();
- parameters = createParameterMap();
+ parameters = TypeUtil.createParameterMap();
parse(type, typeSubtype, parameters);
this.type = typeSubtype.get(0);
@@ -121,15 +112,15 @@
}
/**
- * Creates a list of {@link AcceptType} objects based on given input string (<code>format</code>).
- * @param format accept types, comma-separated, as specified for the HTTP header <code>Accept</code>
+ * Creates a list of {@link AcceptType} objects based on given input string.
+ * @param acceptTypes accept types, comma-separated, as specified for the HTTP header <code>Accept</code>
* @return a list of <code>AcceptType</code> objects
* @throws IllegalArgumentException if input string is not parseable
*/
- public static List<AcceptType> create(final String format) {
+ public static List<AcceptType> create(final String acceptTypes) {
List<AcceptType> result = new ArrayList<AcceptType>();
- String[] values = format.split(",");
+ String[] values = acceptTypes.split(",");
for (String value : values) {
result.add(new AcceptType(value.trim()));
}
@@ -158,7 +149,11 @@
}
public Map<String, String> getParameters() {
- return parameters;
+ return Collections.unmodifiableMap(parameters);
+ }
+
+ public String getParameter(final String name) {
+ return parameters.get(name.toLowerCase(Locale.ROOT));
}
public Float getQuality() {
@@ -169,8 +164,8 @@
public String toString() {
StringBuilder result = new StringBuilder();
result.append(type).append('/').append(subtype);
- for (final String key : parameters.keySet()) {
- result.append(';').append(key).append('=').append(parameters.get(key));
+ for (final Map.Entry<String, String> entry : parameters.entrySet()) {
+ result.append(';').append(entry.getKey()).append('=').append(entry.getValue());
}
return result.toString();
@@ -184,7 +179,7 @@
* <li>the subtype must be '*' or equal to the content-type's subtype,</li>
* <li>all parameters must have the same value as in the content-type's parameter map.</li>
* </ul></p>
- * @param contentType
+ * @param contentType content type against which is matched
* @return whether this accept type matches the given content type
*/
public boolean matches(final ContentType contentType) {
@@ -201,10 +196,10 @@
return false;
}
Map<String, String> compareParameters = contentType.getParameters();
- for (final String key : parameters.keySet()) {
- if (compareParameters.containsKey(key) || TypeUtil.PARAMETER_Q.equalsIgnoreCase(key)) {
- if (!parameters.get(key).equalsIgnoreCase(compareParameters.get(key))
- && !TypeUtil.PARAMETER_Q.equalsIgnoreCase(key)) {
+ for (final Map.Entry<String, String> entry : parameters.entrySet()) {
+ if (compareParameters.containsKey(entry.getKey()) || TypeUtil.PARAMETER_Q.equalsIgnoreCase(entry.getKey())) {
+ String compare = compareParameters.get(entry.getKey());
+ if (!entry.getValue().equalsIgnoreCase(compare) && !TypeUtil.PARAMETER_Q.equalsIgnoreCase(entry.getKey())) {
return false;
}
} else {
@@ -215,12 +210,12 @@
}
/**
- * Sort given list of Accept types
+ * Sorts given list of Accept types
* according to their quality-parameter values and their specificity
* as defined in RFC 7231, chapters 3.1.1.1, 5.3.1, and 5.3.2.
* @param toSort list which is sorted and hence re-arranged
*/
- private static void sort(final List<AcceptType> toSort) {
+ private static void sort(List<AcceptType> toSort) {
Collections.sort(toSort,
new Comparator<AcceptType>() {
@Override
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 4e2eb04..394e534 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
@@ -20,13 +20,12 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.TreeMap;
/**
* Internally used {@link ContentType} for OData library.
@@ -50,13 +49,27 @@
private static final String TEXT = "text";
private static final String MULTIPART = "multipart";
- public static final ContentType APPLICATION_XML = new ContentType(APPLICATION, "xml", null);
- public static final ContentType APPLICATION_ATOM_XML = new ContentType(APPLICATION, "atom+xml", null);
- public static final ContentType APPLICATION_ATOM_XML_ENTRY = create(APPLICATION_ATOM_XML, "type=entry");
- public static final ContentType APPLICATION_ATOM_XML_FEED = create(APPLICATION_ATOM_XML, "type=feed");
- public static final ContentType APPLICATION_ATOM_SVC = new ContentType(APPLICATION, "atomsvc+xml", null);
+ public static final String PARAMETER_CHARSET = "charset";
+ public static final String PARAMETER_IEEE754_COMPATIBLE = "IEEE754Compatible";
+ public static final String PARAMETER_ODATA_METADATA = "odata.metadata";
+
+ public static final String VALUE_ODATA_METADATA_NONE = "none";
+ public static final String VALUE_ODATA_METADATA_MINIMAL = "minimal";
+ public static final String VALUE_ODATA_METADATA_FULL = "full";
public static final ContentType APPLICATION_JSON = new ContentType(APPLICATION, "json", null);
+ public static final ContentType JSON = ContentType.create(ContentType.APPLICATION_JSON,
+ PARAMETER_ODATA_METADATA, VALUE_ODATA_METADATA_MINIMAL);
+ public static final ContentType JSON_NO_METADATA = ContentType.create(ContentType.APPLICATION_JSON,
+ PARAMETER_ODATA_METADATA, VALUE_ODATA_METADATA_NONE);
+ public static final ContentType JSON_FULL_METADATA = ContentType.create(ContentType.APPLICATION_JSON,
+ PARAMETER_ODATA_METADATA, VALUE_ODATA_METADATA_FULL);
+
+ public static final ContentType APPLICATION_XML = new ContentType(APPLICATION, "xml", null);
+ public static final ContentType APPLICATION_ATOM_XML = new ContentType(APPLICATION, "atom+xml", null);
+ public static final ContentType APPLICATION_ATOM_XML_ENTRY = create(APPLICATION_ATOM_XML, "type", "entry");
+ public static final ContentType APPLICATION_ATOM_XML_FEED = create(APPLICATION_ATOM_XML, "type", "feed");
+ public static final ContentType APPLICATION_ATOM_SVC = new ContentType(APPLICATION, "atomsvc+xml", null);
public static final ContentType APPLICATION_OCTET_STREAM = new ContentType(APPLICATION, "octet-stream", null);
@@ -70,22 +83,20 @@
public static final ContentType APPLICATION_FORM_URLENCODED =
new ContentType(APPLICATION, "x-www-form-urlencoded", null);
+ public static final ContentType APPLICATION_HTTP = new ContentType(APPLICATION, "http", null);
+
public static final ContentType MULTIPART_MIXED = new ContentType(MULTIPART, "mixed", null);
-
public static final ContentType MULTIPART_FORM_DATA = new ContentType(MULTIPART, "form-data", null);
- public static final String PARAMETER_CHARSET_UTF8 = "charset=utf-8";
-
private final String type;
private final String subtype;
private final Map<String, String> parameters;
/**
* Creates a content type from type, subtype, and parameters.
- *
- * @param type
- * @param subtype
- * @param parameters
+ * @param type type
+ * @param subtype subtype
+ * @param parameters parameters as map from names to values
*/
private ContentType(final String type, final String subtype, final Map<String, String> parameters) {
this.type = validateType(type);
@@ -94,17 +105,12 @@
if (parameters == null) {
this.parameters = Collections.emptyMap();
} else {
- this.parameters = new TreeMap<String, String>(new Comparator<String>() {
- @Override
- public int compare(final String o1, final String o2) {
- return o1.compareToIgnoreCase(o2);
- }
- });
+ this.parameters = TypeUtil.createParameterMap();
this.parameters.putAll(parameters);
}
}
- private String validateType(final String type) {
+ private String validateType(final String type) throws IllegalArgumentException {
if (type == null || type.isEmpty() || "*".equals(type)) {
throw new IllegalArgumentException("Illegal type '" + type + "'.");
}
@@ -115,53 +121,19 @@
}
/**
- * Validates if given <code>format</code> is parseable and can be used as input for {@link #create(String)} method.
- *
- * @param format to be validated string
- * @return <code>true</code> if format is parseable otherwise <code>false</code>
+ * Creates a content type from an existing content type and an additional parameter as key-value pair.
+ * @param contentType an existing content type
+ * @param parameterName the name of the additional parameter
+ * @param parameterValue the value of the additional parameter
+ * @return a new {@link ContentType} object
*/
- public static boolean isParseable(final String format) {
- try {
- return ContentType.create(format) != null;
- } catch (IllegalArgumentException e) {
- return false;
- }
- }
+ public static ContentType create(final ContentType contentType,
+ final String parameterName, final String parameterValue) throws IllegalArgumentException {
+ TypeUtil.validateParameterNameAndValue(parameterName, parameterValue);
- /**
- * Creates a content type from format and key-value pairs for parameters.
- *
- * @param format for example "application/json"
- * @param parameters for example "a=b", "c=d"
- * @return a new <code>ContentType</code> object
- */
- public static ContentType create(final String format, final String... parameters) {
- ContentType ct = parse(format);
-
- for (String p : parameters) {
- final String[] keyvalue = TypeUtil.parseParameter(p);
- ct.parameters.put(keyvalue[0], keyvalue[1]);
- }
-
- return ct;
- }
-
- /**
- * Creates a content type from an existing content type and additional key-value pairs for parameters.
- *
- * @param contentType for example "application/json"
- * @param parameters for example "a=b", "c=d"
- * @return a new <code>ContentType</code> object
- */
- public static ContentType create(final ContentType contentType, final String... parameters) {
- ContentType ct = new ContentType(contentType.type, contentType.subtype, contentType.parameters);
-
- for (String p : parameters) {
- final String[] keyvalue = TypeUtil.parseParameter(p);
- ct.parameters.put(keyvalue[0], keyvalue[1]);
- }
-
- return ct;
+ ContentType type = new ContentType(contentType.type, contentType.subtype, contentType.parameters);
+ type.parameters.put(parameterName.toLowerCase(Locale.ROOT), parameterValue);
+ return type;
}
/**
@@ -169,15 +141,15 @@
* <code>Media Type</code> format as defined in RFC 7231, chapter 3.1.1.1.
*
* @param format a string in format as defined in RFC 7231, chapter 3.1.1.1
- * @return a new <code>ContentType</code> object
+ * @return a new {@link ContentType} object
* @throws IllegalArgumentException if input string is not parseable
*/
- public static ContentType create(final String format) {
+ public static ContentType create(final String format) throws IllegalArgumentException {
if (format == null) {
throw new IllegalArgumentException("Parameter format MUST NOT be NULL.");
}
- final List<String> typeSubtype = new ArrayList<String>();
- final Map<String, String> parameters = new HashMap<String, String>();
+ List<String> typeSubtype = new ArrayList<String>();
+ Map<String, String> parameters = new HashMap<String, String>();
parse(format, typeSubtype, parameters);
return new ContentType(typeSubtype.get(0), typeSubtype.get(1), parameters);
}
@@ -199,7 +171,8 @@
}
}
- private static void parse(final String format, final List<String> typeSubtype, final Map<String, String> parameters) {
+ private static void parse(final String format, List<String> typeSubtype, Map<String, String> parameters)
+ throws IllegalArgumentException {
final String[] typesAndParameters = format.split(TypeUtil.PARAMETER_SEPARATOR, 2);
final String types = typesAndParameters[0];
final String params = (typesAndParameters.length > 1 ? typesAndParameters[1] : null);
@@ -227,22 +200,34 @@
TypeUtil.parseParameters(params, parameters);
}
+ /** Gets the type of this content type. */
public String getType() {
return type;
}
+ /** Gets the subtype of this content type. */
public String getSubtype() {
return subtype;
}
/**
- *
- * @return parameters of this {@link ContentType} as unmodifiable map.
+ * Gets the parameters of this content type.
+ * @return parameters of this {@link ContentType} as unmodifiable map
*/
public Map<String, String> getParameters() {
return Collections.unmodifiableMap(parameters);
}
+ /**
+ * Returns the value of a given parameter.
+ * If the parameter does not exist the method returns null.
+ * @param name the name of the parameter to get (case-insensitive)
+ * @return the value of the parameter or <code>null</code> if the parameter is not present
+ */
+ public String getParameter(final String name) {
+ return parameters.get(name.toLowerCase(Locale.ROOT));
+ }
+
@Override
public int hashCode() {
return 1;
@@ -276,17 +261,15 @@
while (entries.hasNext()) {
final Entry<String, String> e = entries.next();
final Entry<String, String> oe = otherEntries.next();
- if (!areEqual(e.getKey(), oe.getKey())) {
- return false;
- }
- if (!areEqual(e.getValue(), oe.getValue())) {
+ if (!areEqual(e.getKey(), oe.getKey())
+ || !areEqual(e.getValue(), oe.getValue())) {
return false;
}
}
+ return true;
} else {
return false;
}
- return true;
}
/**
@@ -302,7 +285,6 @@
/**
* Checks whether both strings are equal ignoring the case of the strings.
- *
* @param first first string
* @param second second string
* @return <code>true</code> if both strings are equal (ignoring the case), otherwise <code>false</code>
@@ -313,19 +295,17 @@
/**
* Gets {@link ContentType} as string as defined in
- * <a href="http://www.ietf.org/rfc/rfc7231.txt">RFC 7231</a>, chapter 3.1.1.1:
- * Media Type.
- *
- * @return string representation of <code>ContentType</code> object
+ * <a href="http://www.ietf.org/rfc/rfc7231.txt">RFC 7231</a>, chapter 3.1.1.1: Media Type.
+ * @return string representation of {@link ContentType} object
*/
public String toContentTypeString() {
final StringBuilder sb = new StringBuilder();
sb.append(type).append(TypeUtil.TYPE_SUBTYPE_SEPARATOR).append(subtype);
- for (String key : parameters.keySet()) {
- sb.append(TypeUtil.PARAMETER_SEPARATOR).append(key)
- .append(TypeUtil.PARAMETER_KEY_VALUE_SEPARATOR).append(parameters.get(key));
+ for (Entry<String, String> entry : parameters.entrySet()) {
+ sb.append(TypeUtil.PARAMETER_SEPARATOR).append(entry.getKey())
+ .append(TypeUtil.PARAMETER_KEY_VALUE_SEPARATOR).append(entry.getValue());
}
return sb.toString();
}
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
deleted file mode 100644
index 2114942..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
+++ /dev/null
@@ -1,126 +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.format;
-
-/**
- * Available formats to be used in various contexts.
- */
-public enum ODataFormat {
-
- /** JSON format with no metadata. */
- JSON_NO_METADATA(ContentType.create(ContentType.APPLICATION_JSON, "odata.metadata=none")),
- /** JSON format with minimal metadata (default). */
- JSON(ContentType.create(ContentType.APPLICATION_JSON, "odata.metadata=minimal")),
- /** JSON format with full metadata. */
- JSON_FULL_METADATA(ContentType.create(ContentType.APPLICATION_JSON, "odata.metadata=full")),
-
- /** XML format. */
- XML(ContentType.APPLICATION_XML),
- /** Atom format. */
- ATOM(ContentType.APPLICATION_ATOM_XML),
-
- // media formats
- APPLICATION_XML(ContentType.APPLICATION_XML),
- APPLICATION_ATOM_XML(ContentType.APPLICATION_ATOM_XML),
- APPLICATION_XHTML_XML(ContentType.APPLICATION_XHTML_XML),
- APPLICATION_SVG_XML(ContentType.APPLICATION_SVG_XML),
- APPLICATION_JSON(ContentType.APPLICATION_JSON),
- APPLICATION_FORM_URLENCODED(ContentType.APPLICATION_FORM_URLENCODED),
- MULTIPART_FORM_DATA(ContentType.MULTIPART_FORM_DATA),
- APPLICATION_OCTET_STREAM(ContentType.APPLICATION_OCTET_STREAM),
- TEXT_PLAIN(ContentType.TEXT_PLAIN),
- TEXT_XML(ContentType.TEXT_XML),
- TEXT_HTML(ContentType.TEXT_HTML);
-
- private final ContentType contentType;
-
- ODataFormat(final ContentType contentType) {
- this.contentType = contentType;
- }
-
- /**
- * Gets format as {@link ContentType}.
- * @return format as ContentType.
- */
- public ContentType getContentType() {
- return contentType;
- }
-
- @Override
- public String toString() {
- if (contentType == null) {
- throw new UnsupportedOperationException();
- } else {
- return contentType.toContentTypeString();
- }
- }
-
- /**
- * Gets OData format from a content type.
- *
- * @param contentType content type
- * @return OData format.
- */
- public static ODataFormat fromContentType(final ContentType contentType) {
- if (contentType == null) {
- return null;
- }
-
- if (contentType.isCompatible(ContentType.APPLICATION_ATOM_XML)
- || contentType.isCompatible(ContentType.APPLICATION_ATOM_SVC)) {
- return ATOM;
- } else if (contentType.isCompatible(ContentType.APPLICATION_XML)) {
- return XML;
- } else if (contentType.isCompatible(ContentType.APPLICATION_JSON)) {
- String jsonVariant = contentType.getParameters().get("odata.metadata");
- if (jsonVariant != null) {
- if ("none".equals(jsonVariant)) {
- return JSON_NO_METADATA;
- } else if ("minimal".equals(jsonVariant)) {
- return ODataFormat.JSON;
- } else if ("full".equals(jsonVariant)) {
- return ODataFormat.JSON_FULL_METADATA;
- }
- }
- return JSON;
- } else if (contentType.isCompatible(ContentType.APPLICATION_OCTET_STREAM)) {
- return APPLICATION_OCTET_STREAM;
- } else if (contentType.isCompatible(ContentType.TEXT_PLAIN)) {
- return TEXT_PLAIN;
- } else if (contentType.isCompatible(ContentType.APPLICATION_XHTML_XML)) {
- return APPLICATION_XHTML_XML;
- } else if (contentType.isCompatible(ContentType.APPLICATION_SVG_XML)) {
- return APPLICATION_SVG_XML;
- } else if (contentType.isCompatible(ContentType.APPLICATION_FORM_URLENCODED)) {
- return APPLICATION_FORM_URLENCODED;
- } else if (contentType.isCompatible(ContentType.MULTIPART_FORM_DATA)) {
- return MULTIPART_FORM_DATA;
- } else if (contentType.isCompatible(ContentType.TEXT_XML)) {
- return TEXT_XML;
- } else if (contentType.isCompatible(ContentType.TEXT_HTML)) {
- return TEXT_HTML;
- }
-
- throw new IllegalArgumentException("Unsupported content Type: " + contentType);
- }
-
- public static ODataFormat fromString(final String contentType) {
- return contentType == null ? null : fromContentType(ContentType.parse(contentType));
- }
-}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/PreferenceName.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/PreferenceName.java
new file mode 100644
index 0000000..f77e615
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/PreferenceName.java
@@ -0,0 +1,53 @@
+/*
+ * 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.format;
+
+/**
+ * Names of preferences defined in the OData standard.
+ */
+public enum PreferenceName {
+
+ ALLOW_ENTITY_REFERENCES("odata.allow-entityreferences"),
+ CALLBACK("odata.callback"),
+ CONTINUE_ON_ERROR("odata.continue-on-error"),
+ INCLUDE_ANNOTATIONS("odata.include-annotations"),
+ MAX_PAGE_SIZE("odata.maxpagesize"),
+ TRACK_CHANGES("odata.track-changes"),
+ RETURN("return"),
+ RESPOND_ASYNC("respond-async"),
+ WAIT("wait"),
+ RETURN_CONTENT("return-content"),
+ RETURN_NO_CONTENT("return-no-content"),
+ KEY_AS_SEGMENT("KeyAsSegment");
+
+ private final String preferenceName;
+
+ PreferenceName(final String preferenceName) {
+ this.preferenceName = preferenceName;
+ }
+
+ public String getName() {
+ return preferenceName;
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/TypeUtil.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/TypeUtil.java
index 03fd078..5fc7ce1 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/TypeUtil.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/TypeUtil.java
@@ -18,10 +18,15 @@
*/
package org.apache.olingo.commons.api.format;
+import java.util.Comparator;
import java.util.Locale;
import java.util.Map;
+import java.util.TreeMap;
-class TypeUtil {
+/**
+ * Helper class which is only used within this package (<code>AcceptType</code> and <code>ContentType</code> handling).
+ */
+final class TypeUtil {
static final String MEDIA_TYPE_WILDCARD = "*";
static final String PARAMETER_Q = "q";
@@ -32,6 +37,18 @@
static final String TYPE_SUBTYPE_SEPARATOR = "/";
static final String TYPE_SUBTYPE_WILDCARD = "*";
+ private TypeUtil() { /* static helper class */}
+
+ /** Creates a parameter map with predictable order. */
+ static Map<String, String> createParameterMap() {
+ return new TreeMap<String, String>(new Comparator<String>() {
+ @Override
+ public int compare(final String o1, final String o2) {
+ return o1.compareToIgnoreCase(o2);
+ }
+ });
+ }
+
/**
* Valid input are <code>;</code> separated <code>key=value</code> pairs
* without spaces between key and value.
@@ -44,10 +61,10 @@
* depending on its definition within the media type registry.
* </p>
*
- * @param parameters
- * @param parameterMap
+ * @param parameters as <code>;</code> separated <code>key=value</code> pairs
+ * @param parameterMap map to which all parsed parameters are added
*/
- protected static void parseParameters(final String parameters, final Map<String, String> parameterMap) {
+ static void parseParameters(final String parameters, final Map<String, String> parameterMap) {
if (parameters != null) {
for (String parameter : parameters.split(TypeUtil.PARAMETER_SEPARATOR)) {
final String[] keyValue = parseParameter(parameter);
@@ -56,23 +73,53 @@
}
}
- protected static String[] parseParameter(final String parameter) {
+ /**
+ * Valid input is one <code>key=value</code> pair without spaces between key and value.
+ * <p>
+ * See RFC 7231:
+ * The type, subtype, and parameter name tokens are case-insensitive.
+ * Parameter values might or might not be case-sensitive, depending on
+ * the semantics of the parameter name. The presence or absence of a
+ * parameter might be significant to the processing of a media-type,
+ * depending on its definition within the media type registry.
+ * </p>
+ *
+ * @param parameter as <code>key=value</code> pair
+ * @return <code>key</code> as first array value (as lower case) and <code>value</code> as second array value
+ */
+ static String[] parseParameter(final String parameter) {
if (parameter.isEmpty()) {
throw new IllegalArgumentException("An empty parameter is not allowed.");
}
- String[] keyValue = parameter.trim().split(TypeUtil.PARAMETER_KEY_VALUE_SEPARATOR);
- if (keyValue.length != 2 || keyValue[0].isEmpty()) {
- throw new IllegalArgumentException(
- "Parameter '" + parameter + "' must have exactly one '" + TypeUtil.PARAMETER_KEY_VALUE_SEPARATOR +
- "' that separates the name and the value.");
+ String[] keyValue = parameter.trim().split(PARAMETER_KEY_VALUE_SEPARATOR);
+ if (keyValue.length != 2) {
+ throw new IllegalArgumentException("Parameter '" + parameter + "' must have exactly one '"
+ + PARAMETER_KEY_VALUE_SEPARATOR + "' that separates the name and the value.");
}
+ validateParameterNameAndValue(keyValue[0], keyValue[1]);
keyValue[0] = keyValue[0].toLowerCase(Locale.ENGLISH);
- if (keyValue[0].indexOf(WHITESPACE_CHAR) >= 0) {
- throw new IllegalArgumentException("Parameter name '" + keyValue[0] + "' contains whitespace.");
- }
- if (Character.isWhitespace(keyValue[1].charAt(0))) {
- throw new IllegalArgumentException("Value of parameter '" + keyValue[0] + "' starts with whitespace.");
- }
return keyValue;
}
+
+ /**
+ * Validate that parameter name and parameter value are valid .
+ *
+ * @param parameterName must be <code>not null</code>, <code>not empty</code> and <code>contains no whitespace
+ * characters</code>
+ * @param parameterValue must be <code>not null</code>, <code>not empty</code> and <code>not start with a whitespace
+ * character</code>
+ * @throws IllegalArgumentException if one of the above requirements are not met
+ */
+ static void validateParameterNameAndValue(final String parameterName, final String parameterValue)
+ throws IllegalArgumentException {
+ if (parameterName == null || parameterName.isEmpty() || parameterName.indexOf(WHITESPACE_CHAR) >= 0) {
+ throw new IllegalArgumentException("Illegal parameter name '" + parameterName + "'.");
+ }
+ if (parameterValue == null || parameterValue.isEmpty()) {
+ throw new IllegalArgumentException("Value parameter is NULL or empty.");
+ }
+ if (Character.isWhitespace(parameterValue.charAt(0))) {
+ throw new IllegalArgumentException("Value of parameter '" + parameterName + "' starts with whitespace.");
+ }
+ }
}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/package-info.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/package-info.java
new file mode 100644
index 0000000..ef5c906
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/package-info.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.
+ */
+/**
+ * Contains all the format related objects (also related to http headers <coder>Prefer</coder>, <code>Accepted</code>
+ * and <code>Content-Type</code>) which are used for handling of an OData responses and OData requests.
+ */
+package org.apache.olingo.commons.api.format;
\ No newline at end of file
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpContentType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpContentType.java
index 87612ea..12301f8 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpContentType.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpContentType.java
@@ -25,33 +25,34 @@
*/
public interface HttpContentType {
- public static final String APPLICATION_XML = "application/xml";
- public static final String APPLICATION_XML_UTF8 = APPLICATION_XML + ";charset=utf-8";
+ String APPLICATION_XML = "application/xml";
+ String CHARSET_UTF_8 = ";charset=utf-8";
+ String APPLICATION_XML_UTF8 = APPLICATION_XML + CHARSET_UTF_8;
- public static final String APPLICATION_ATOM_XML = "application/atom+xml";
- public static final String APPLICATION_ATOM_XML_UTF8 = APPLICATION_ATOM_XML + ";charset=utf-8";
- public static final String APPLICATION_ATOM_XML_ENTRY = APPLICATION_ATOM_XML + ";type=entry";
- public static final String APPLICATION_ATOM_XML_ENTRY_UTF8 = APPLICATION_ATOM_XML_ENTRY + ";charset=utf-8";
- public static final String APPLICATION_ATOM_XML_FEED = APPLICATION_ATOM_XML + ";type=feed";
- public static final String APPLICATION_ATOM_XML_FEED_UTF8 = APPLICATION_ATOM_XML_FEED + ";charset=utf-8";
- public static final String APPLICATION_ATOM_SVC = "application/atomsvc+xml";
- public static final String APPLICATION_ATOM_SVC_UTF8 = APPLICATION_ATOM_SVC + ";charset=utf-8";
+ String APPLICATION_ATOM_XML = "application/atom+xml";
+ String APPLICATION_ATOM_XML_UTF8 = APPLICATION_ATOM_XML + CHARSET_UTF_8;
+ String APPLICATION_ATOM_XML_ENTRY = APPLICATION_ATOM_XML + ";type=entry";
+ String APPLICATION_ATOM_XML_ENTRY_UTF8 = APPLICATION_ATOM_XML_ENTRY + CHARSET_UTF_8;
+ String APPLICATION_ATOM_XML_FEED = APPLICATION_ATOM_XML + ";type=feed";
+ String APPLICATION_ATOM_XML_FEED_UTF8 = APPLICATION_ATOM_XML_FEED + CHARSET_UTF_8;
+ String APPLICATION_ATOM_SVC = "application/atomsvc+xml";
+ String APPLICATION_ATOM_SVC_UTF8 = APPLICATION_ATOM_SVC + CHARSET_UTF_8;
- public static final String APPLICATION_JSON = "application/json";
- public static final String APPLICATION_JSON_VERBOSE = APPLICATION_JSON + ";odata=verbose";
- public static final String APPLICATION_JSON_UTF8 = APPLICATION_JSON + ";charset=utf-8";
- public static final String APPLICATION_JSON_UTF8_VERBOSE = APPLICATION_JSON_UTF8 + ";odata=verbose";
+ String APPLICATION_JSON = "application/json";
+ String APPLICATION_JSON_VERBOSE = APPLICATION_JSON + ";odata=verbose";
+ String APPLICATION_JSON_UTF8 = APPLICATION_JSON + CHARSET_UTF_8;
+ String APPLICATION_JSON_UTF8_VERBOSE = APPLICATION_JSON_UTF8 + ";odata=verbose";
- public static final String TEXT_PLAIN = "text/plain";
- public static final String TEXT_PLAIN_UTF8 = TEXT_PLAIN + ";charset=utf-8";
+ String TEXT_PLAIN = "text/plain";
+ String TEXT_PLAIN_UTF8 = TEXT_PLAIN + CHARSET_UTF_8;
- public static final String TEXT_HTML = "text/html";
+ String TEXT_HTML = "text/html";
- public static final String APPLICATION_OCTET_STREAM = "application/octet-stream";
+ String APPLICATION_OCTET_STREAM = "application/octet-stream";
- public static final String APPLICATION_HTTP = "application/http";
+ String APPLICATION_HTTP = "application/http";
- public static final String MULTIPART_MIXED = "multipart/mixed";
+ String MULTIPART_MIXED = "multipart/mixed";
- public static final String WILDCARD = "*/*";
+ String WILDCARD = "*/*";
}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeader.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeader.java
index ab284b1..340c895 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeader.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeader.java
@@ -18,12 +18,16 @@
******************************************************************************/
package org.apache.olingo.commons.api.http;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+
/**
- * HTTP header constants
- *
- *
+ * HTTP header constants.
*/
-public interface HttpHeader {
+public class HttpHeader {
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1">HTTP/1.1 documentation</a>}.
@@ -61,6 +65,8 @@
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.12">HTTP/1.1 documentation</a>}.
*/
public static final String CONTENT_LANGUAGE = "Content-Language";
+ /** See <a href="http://www.rfc-editor.org/rfc/rfc2392.txt">RFC 2392</a>. */
+ public static final String CONTENT_ID = "Content-ID";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13">HTTP/1.1 documentation</a>}.
*/
@@ -81,10 +87,14 @@
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19">HTTP/1.1 documentation</a>}.
*/
public static final String ETAG = "ETag";
+ /** See <a href="http://www.rfc-editor.org/rfc/rfc7231.txt">RFC 7231</a>. */
+ public static final String EXPECT = "Expect";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21">HTTP/1.1 documentation</a>}.
*/
public static final String EXPIRES = "Expires";
+ /** See <a href="http://www.rfc-editor.org/rfc/rfc7231.txt">RFC 7231</a>. */
+ public static final String FROM = "From";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23">HTTP/1.1 documentation</a>}.
*/
@@ -117,10 +127,28 @@
* See {@link <a href="http://tools.ietf.org/html/rfc5988#page-6">Web Linking (IETF RFC-5988) documentation</a>}.
*/
public static final String LINK = "Link";
+ /** See <a href="http://www.rfc-editor.org/rfc/rfc7231.txt">RFC 7231</a>. */
+ public static final String MAX_FORWARDS = "Max-Forwards";
+ /**
+ * OData Prefer Header.
+ * See <a href="http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html#_Toc406398233">
+ * OData Version 4.0 Part 1: Protocol</a> and <a href="https://www.ietf.org/rfc/rfc7240.txt">RFC 7240</a>.
+ */
+ public static final String PREFER = "Prefer";
+ /**
+ * OData Preference-Applied Header.
+ * See <a href="http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html#_Toc406398247">
+ * OData Version 4.0 Part 1: Protocol</a> and <a href="https://www.ietf.org/rfc/rfc7240.txt">RFC 7240</a>.
+ */
+ public static final String PREFERENCE_APPLIED = "Preference-Applied";
+ /** See <a href="http://www.rfc-editor.org/rfc/rfc7233.txt">RFC 7233</a>. */
+ public static final String RANGE = "Range";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.37">HTTP/1.1 documentation</a>}.
*/
public static final String RETRY_AFTER = "Retry-After";
+ /** See <a href="http://www.rfc-editor.org/rfc/rfc7230.txt">RFC 7230</a>. */
+ public static final String TE = "TE";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43">HTTP/1.1 documentation</a>}.
*/
@@ -133,6 +161,7 @@
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.47">HTTP/1.1 documentation</a>}.
*/
public static final String WWW_AUTHENTICATE = "WWW-Authenticate";
+
/**
* See {@link <a href="http://www.ietf.org/rfc/rfc2109.txt">IETF RFC 2109</a>}.
*/
@@ -142,32 +171,118 @@
*/
public static final String SET_COOKIE = "Set-Cookie";
- /**
- * non standard header
- */
+ /** Non standard header. */
public static final String X_HTTP_METHOD = "X-HTTP-Method";
-
- /**
- * non standard header
- */
+ /** Non standard header. */
public static final String X_HTTP_METHOD_OVERRIDE = "X-HTTP-Method-Override";
- /**
- * OData Custom Header
- */
+ /** Custom Header defined in the OData standard. */
public static final String ODATA_VERSION = "OData-Version";
-
- /**
- * OData Custom Header
- */
+ /** Custom Header defined in the OData standard. */
public static final String ODATA_MAX_VERSION = "OData-MaxVersion";
+ /** Custom Header defined in the OData standard. */
+ public static final String ODATA_ENTITY_ID = "OData-EntityID";
- // CHECKSTYLE:OFF
+ private final String name;
+ private final List<String> values;
+
/**
- * OData Prefer Header
- * See
- * {@link <a href="http://docs.oasis-open.org/odata/odata/v4.0/errata01/os/complete/part1-protocol/odata-v4.0-errata01-os-part1-protocol-complete.html#_Toc399426728"> OData Version 4.0 Part 1: Protocol Plus Errata 01</a>}
+ * Create header for given name
+ * @param name of header
*/
- public static final String PREFER = "Prefer";
- // CHECKSTYLE:ON
+ public HttpHeader(String name) {
+ this.name = name;
+ this.values = new ArrayList<String>();
+ }
+
+ /**
+ * Create header for given name and add given values
+ * @param name of header
+ * @param values values for header
+ */
+ public HttpHeader(String name, Collection<String> values) {
+ this(name);
+ this.values.addAll(values);
+ }
+
+ /**
+ * Get name of header (not the canonical name)
+ * @return name of header
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Get all values for this header
+ * @return all header values
+ */
+ public List<String> getValues() {
+ return Collections.unmodifiableList(values);
+ }
+
+ /**
+ * Add header value
+ *
+ * @param value value to be added
+ * @return this header object (fluent interface)
+ */
+ public HttpHeader addValue(String value) {
+ this.values.add(value);
+ return this;
+ }
+
+ /**
+ * Add header values
+ *
+ * @param values values to be added
+ * @return this header object (fluent interface)
+ */
+ public HttpHeader addValues(Collection<String> values) {
+ this.values.addAll(values);
+ return this;
+ }
+
+ /**
+ * Get the canonical name of header
+ * @return canonical name of header
+ */
+ public String getCanonicalName() {
+ return createCanonicalName(name);
+ }
+
+ /**
+ * Create the canonical name based on given name parameter
+ *
+ * @param name name which is canonicalised
+ * @return canonical name
+ */
+ public static String createCanonicalName(String name) {
+ return name.toLowerCase(Locale.ROOT);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ HttpHeader that = (HttpHeader) o;
+
+ if (!name.equals(that.name)) {
+ return false;
+ }
+ return values.equals(that.values);
+
+ }
+
+ @Override
+ public int hashCode() {
+ int result = name.hashCode();
+ result = 31 * result + values.hashCode();
+ return result;
+ }
}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeaders.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeaders.java
new file mode 100644
index 0000000..fb1da7f
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeaders.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * 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.http;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * HttpHeader container
+ */
+public class HttpHeaders {
+ private final Map<String, HttpHeader> headers = new LinkedHashMap<String, HttpHeader>();
+
+ /**
+ * Add a header with given name and value.
+ * If header with name already exists the value is added to this header.
+ *
+ * @param name name of header
+ * @param value value for header
+ * @return this container (fluent interface)
+ */
+ public HttpHeaders addHeader(String name, String value) {
+ HttpHeader eh = grantHeader(name);
+ eh.addValue(value);
+ return this;
+ }
+
+ /**
+ * Add a header with given name and values.
+ * If header with name already exists the values are added to this header.
+ *
+ * @param name name of header
+ * @param values values for header
+ * @return this container (fluent interface)
+ */
+ public HttpHeaders addHeader(String name, Collection<String> values) {
+ HttpHeader eh = grantHeader(name);
+ eh.addValues(values);
+ return this;
+ }
+
+ /**
+ * Set a header with given name and value.
+ * If header with name already exists the old header is replaced with the new one.
+ *
+ * @param name name of header
+ * @param value value for header
+ * @return this container (fluent interface)
+ */
+ public HttpHeaders setHeader(String name, String value) {
+ removeHeader(name);
+
+ HttpHeader eh = grantHeader(name);
+ eh.addValue(value);
+ return this;
+ }
+
+ /**
+ * Get header for given name.
+ *
+ * @param name name of header requested
+ * @return corresponding header
+ */
+ public HttpHeader getHeader(String name) {
+ return headers.get(HttpHeader.createCanonicalName(name));
+ }
+
+ /**
+ * Remove header for given name.
+ *
+ * @param name name of header to be removed
+ * @return header which was removed or null if no header was known for this name
+ */
+ public HttpHeader removeHeader(String name) {
+ return headers.remove(HttpHeader.createCanonicalName(name));
+ }
+
+
+ /**
+ * Get all headers.
+ *
+ * @return all headers
+ */
+ public Collection<HttpHeader> getHeaders() {
+ return Collections.unmodifiableCollection(headers.values());
+ }
+
+
+ /**
+ * Get all headers with the according values.
+ *
+ * @return an unmodifiable Map of header names/values
+ */
+ public Map<String, List<String>> getHeaderToValues() {
+ Map<String, List<String>> result = new HashMap<String, List<String>>();
+ Collection<HttpHeader> allHeaders = headers.values();
+ for (HttpHeader header : allHeaders) {
+ result.put(header.getName(), header.getValues());
+ }
+ return Collections.unmodifiableMap(result);
+ }
+
+ /**
+ * Get all header names.
+ *
+ * @return all header names
+ */
+ public Collection<String> getHeaderNames() {
+ Collection<String> headerNames = new ArrayList<String>();
+ for (HttpHeader header : headers.values()) {
+ headerNames.add(header.getName());
+ }
+ return headerNames;
+ }
+
+ /**
+ * Get or create a header for given name.
+ *
+ * @return new or known header
+ */
+ private HttpHeader grantHeader(String name) {
+ String key = HttpHeader.createCanonicalName(name);
+ HttpHeader eh = headers.get(key);
+ if(eh == null) {
+ eh = new HttpHeader(name);
+ headers.put(key, eh);
+ }
+ return eh;
+ }
+}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpStatusCode.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpStatusCode.java
index 0d7784b..f339429 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpStatusCode.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpStatusCode.java
@@ -81,7 +81,7 @@
* @return the status code info
*/
public String getInfo() {
- return toString();
+ return info;
}
/**
@@ -91,7 +91,6 @@
*/
@Override
public String toString() {
- return info;
+ return getInfo();
}
-
}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/package-info.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/package-info.java
new file mode 100644
index 0000000..df85434
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+/**
+ * Contains all the http related objects which are used for handling of an OData responses and OData requests.
+ */
+package org.apache.olingo.commons.api.http;
\ No newline at end of file
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataDeserializer.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataDeserializer.java
deleted file mode 100755
index d288cf9..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataDeserializer.java
+++ /dev/null
@@ -1,65 +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.serialization;
-
-import java.io.InputStream;
-
-import org.apache.olingo.commons.api.ODataError;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ResWrap;
-
-/**
- * Interface for de-serialization.
- */
-public interface ODataDeserializer {
-
- /**
- * Gets an entity set object from the given InputStream.
- *
- * @param input stream to be de-serialized.
- * @return {@link EntityCollection} instance.
- */
- ResWrap<EntityCollection> toEntitySet(InputStream input) throws ODataDeserializerException;
-
- /**
- * Gets an entity object from the given InputStream.
- *
- * @param input stream to be de-serialized.
- * @return {@link Entity} instance.
- */
- ResWrap<Entity> toEntity(InputStream input) throws ODataDeserializerException;
-
- /**
- * Gets a property object from the given InputStream.
- *
- * @param input stream to be de-serialized.
- * @return Property instance.
- */
- ResWrap<Property> toProperty(InputStream input) throws ODataDeserializerException;
-
- /**
- * Gets the ODataError object represented by the given InputStream.
- *
- * @param input stream to be parsed and de-serialized.
- * @return parsed ODataError object represented by the given InputStream
- */
- ODataError toError(InputStream input) throws ODataDeserializerException;
-}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataDeserializerException.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataDeserializerException.java
deleted file mode 100755
index e5d7df6..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataDeserializerException.java
+++ /dev/null
@@ -1,38 +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.serialization;
-
-import org.apache.olingo.commons.api.ODataException;
-
-public class ODataDeserializerException extends ODataException {
-
- private static final long serialVersionUID = -3236099963180859670L;
-
- public ODataDeserializerException(final String msg) {
- super(msg);
- }
-
- public ODataDeserializerException(final Throwable cause) {
- super(cause);
- }
-
- public ODataDeserializerException(final String msg, final Throwable cause) {
- super(msg, cause);
- }
-}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataSerializer.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataSerializer.java
deleted file mode 100644
index 0c0f795..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataSerializer.java
+++ /dev/null
@@ -1,33 +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.serialization;
-
-import java.io.Writer;
-
-import org.apache.olingo.commons.api.data.ResWrap;
-
-/**
- * Interface for serialization.
- */
-public interface ODataSerializer {
-
- public <T> void write(final Writer writer, final T obj) throws ODataSerializerException;
-
- public <T> void write(final Writer writer, final ResWrap<T> container) throws ODataSerializerException;
-}
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataSerializerException.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataSerializerException.java
deleted file mode 100755
index 797c40a..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataSerializerException.java
+++ /dev/null
@@ -1,38 +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.serialization;
-
-import org.apache.olingo.commons.api.ODataException;
-
-public class ODataSerializerException extends ODataException {
-
- private static final long serialVersionUID = -3236099963180859670L;
-
- public ODataSerializerException(final String msg) {
- super(msg);
- }
-
- public ODataSerializerException(final Throwable cause) {
- super(cause);
- }
-
- public ODataSerializerException(final String msg, final Throwable cause) {
- super(msg, cause);
- }
-}
diff --git a/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/AcceptTypeTest.java b/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/AcceptTypeTest.java
index a6248f3..589fae2 100644
--- a/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/AcceptTypeTest.java
+++ b/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/AcceptTypeTest.java
@@ -27,6 +27,7 @@
import org.junit.Test;
+
public class AcceptTypeTest {
@Test
diff --git a/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/ContentTypeTest.java b/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/ContentTypeTest.java
index 8a7c642..2c21ae5 100644
--- a/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/ContentTypeTest.java
+++ b/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/ContentTypeTest.java
@@ -78,27 +78,31 @@
@Test
public void testCreateWithParameter() {
- assertEquals(ContentType.create("a/b;c=d"), ContentType.create("a/b", "c=d"));
- assertEquals(ContentType.create("a/b;e=f;c=d"), ContentType.create("a/b", "c=d", "e=f"));
- assertEquals(ContentType.create("a/b;e=f;c=d"), ContentType.create("A/B", "C=D", "E=F"));
+ assertEquals(ContentType.create("a/b;c=d"), ContentType.create(ContentType.create("a/b"), "c", "d"));
+ assertEquals(ContentType.create("a/b;e=f;c=d"), ContentType.create(
+ ContentType.create(ContentType.create("a/b"), "c", "d"), "e", "f"));
+ assertEquals(ContentType.create("a/b;e=f;c=d"), ContentType.create(
+ ContentType.create(ContentType.create("A/B"), "C", "D"), "E", "F"));
}
@Test
public void testCreateAndModify() {
ContentType ct1 = ContentType.create("a/b");
- assertEquals(ContentType.create("a/b;c=d"), ContentType.create(ct1, "c=d"));
+ assertEquals(ContentType.create("a/b;c=d"), ContentType.create(ct1, "c", "d"));
ContentType ct2 = ContentType.create("a/b;c=d");
- assertEquals(ContentType.create("a/b;c=d;e=f"), ContentType.create(ct2, "e=f"));
- assertEquals(ContentType.create("a/b;c=g"), ContentType.create(ct2, "c=g"));
+ assertEquals(ContentType.create("a/b;c=d;e=f"), ContentType.create(ct2, "e", "f"));
+ assertEquals(ContentType.create("a/b;c=g"), ContentType.create(ct2, "c", "g"));
- assertFalse(ContentType.create(ct2, "c=g").equals(ct2));
+ assertFalse(ContentType.create(ct2, "c", "g").equals(ct2));
}
@Test
public void testParse() {
assertNull(ContentType.parse("a"));
- assertFalse(ContentType.isParseable("a"));
+ assertNull(ContentType.parse("a/b;c"));
+ assertNull(ContentType.parse("a/b;c="));
+ assertNull(ContentType.parse("a/b;c= "));
}
@Test(expected = IllegalArgumentException.class)
diff --git a/lib/commons-core/pom.xml b/lib/commons-core/pom.xml
index c6d6f98..8b464a8 100644
--- a/lib/commons-core/pom.xml
+++ b/lib/commons-core/pom.xml
@@ -82,6 +82,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
+ <version>${maven.bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityContainerImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityContainerImpl.java
index 027364a..48f0889 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityContainerImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityContainerImpl.java
@@ -24,7 +24,7 @@
import java.util.List;
import java.util.Map;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmActionImport;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEnumTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEnumTypeImpl.java
index f1311c1..2cc1d39 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEnumTypeImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEnumTypeImpl.java
@@ -265,4 +265,29 @@
public FullQualifiedName getAnnotationsTargetFQN() {
return getFullQualifiedName();
}
+
+ @Override
+ public int hashCode() {
+ return this.getFullQualifiedName().getFullQualifiedNameAsString().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj){
+ if(obj == null){
+ return false;
+ }
+
+ if(obj == this){
+ return true;
+ }
+
+ if(obj instanceof EdmEnumType){
+ EdmEnumType other = (EdmEnumType) obj;
+ if(this.getFullQualifiedName().equals(other.getFullQualifiedName())){
+ return true;
+ }
+ }
+
+ return false;
+ }
}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java
index 3239276..53dc4e7 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this 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
@@ -25,7 +25,7 @@
import java.util.List;
import java.util.Map;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.EdmAction;
import org.apache.olingo.commons.api.edm.EdmAnnotation;
import org.apache.olingo.commons.api.edm.EdmAnnotations;
@@ -182,29 +182,29 @@
}
final List<String> parameterNamesCopy =
parameterNames == null ? Collections.<String> emptyList() : parameterNames;
- for (CsdlFunction function : functions) {
- if (function.isBound()) {
- List<CsdlParameter> providerParameters = function.getParameters();
- if (providerParameters == null || providerParameters.size() == 0) {
- throw new EdmException("No parameter specified for bound function: " + functionName);
- }
- final CsdlParameter bindingParameter = providerParameters.get(0);
- if (bindingParameterTypeName.equals(bindingParameter.getTypeFQN())
- && isBindingParameterCollection.booleanValue() == bindingParameter.isCollection()) {
+ for (CsdlFunction function : functions) {
+ if (function.isBound()) {
+ List<CsdlParameter> providerParameters = function.getParameters();
+ if (providerParameters == null || providerParameters.size() == 0) {
+ throw new EdmException("No parameter specified for bound function: " + functionName);
+ }
+ final CsdlParameter bindingParameter = providerParameters.get(0);
+ if (bindingParameterTypeName.equals(bindingParameter.getTypeFQN())
+ && isBindingParameterCollection.booleanValue() == bindingParameter.isCollection()) {
- if (parameterNamesCopy.size() == providerParameters.size() - 1) {
- final List<String> providerParameterNames = new ArrayList<String>();
- for (int i = 1; i < providerParameters.size(); i++) {
- providerParameterNames.add(providerParameters.get(i).getName());
- }
- if (parameterNamesCopy.containsAll(providerParameterNames)) {
- return new EdmFunctionImpl(this, functionName, function);
- }
- }
+ if (parameterNamesCopy.size() == providerParameters.size() - 1) {
+ final List<String> providerParameterNames = new ArrayList<String>();
+ for (int i = 1; i < providerParameters.size(); i++) {
+ providerParameterNames.add(providerParameters.get(i).getName());
+ }
+ if (parameterNamesCopy.containsAll(providerParameterNames)) {
+ return new EdmFunctionImpl(this, functionName, function);
}
}
}
- return null;
+ }
+ }
+ return null;
} catch (ODataException e) {
throw new EdmException(e);
}
@@ -291,25 +291,25 @@
final List<String> parameterNamesCopy =
parameterNames == null ? Collections.<String> emptyList() : parameterNames;
- for (CsdlFunction function : functions) {
- if (!function.isBound()) {
- List<CsdlParameter> providerParameters = function.getParameters();
- if (providerParameters == null) {
- providerParameters = Collections.emptyList();
- }
- if (parameterNamesCopy.size() == providerParameters.size()) {
- final List<String> functionParameterNames = new ArrayList<String>();
- for (CsdlParameter parameter : providerParameters) {
- functionParameterNames.add(parameter.getName());
- }
+ for (CsdlFunction function : functions) {
+ if (!function.isBound()) {
+ List<CsdlParameter> providerParameters = function.getParameters();
+ if (providerParameters == null) {
+ providerParameters = Collections.emptyList();
+ }
+ if (parameterNamesCopy.size() == providerParameters.size()) {
+ final List<String> functionParameterNames = new ArrayList<String>();
+ for (CsdlParameter parameter : providerParameters) {
+ functionParameterNames.add(parameter.getName());
+ }
- if (parameterNamesCopy.containsAll(functionParameterNames)) {
- return new EdmFunctionImpl(this, functionName, function);
- }
- }
+ if (parameterNamesCopy.containsAll(functionParameterNames)) {
+ return new EdmFunctionImpl(this, functionName, function);
}
}
- return null;
+ }
+ }
+ return null;
} catch (ODataException e) {
throw new EdmException(e);
}
@@ -319,8 +319,11 @@
protected Map<String, EdmSchema> createSchemas() {
try {
final Map<String, EdmSchema> providerSchemas = new LinkedHashMap<String, EdmSchema>();
- for (CsdlSchema schema : provider.getSchemas()) {
- providerSchemas.put(schema.getNamespace(), new EdmSchemaImpl(this, provider, schema));
+ List<CsdlSchema> localSchemas = provider.getSchemas();
+ if (localSchemas != null) {
+ for (CsdlSchema schema : localSchemas) {
+ providerSchemas.put(schema.getNamespace(), new EdmSchemaImpl(this, provider, schema));
+ }
}
return providerSchemas;
} catch (ODataException e) {
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTermImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTermImpl.java
index 0f60716..ec6223a 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTermImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTermImpl.java
@@ -30,12 +30,9 @@
import org.apache.olingo.commons.api.edm.geo.SRID;
import org.apache.olingo.commons.api.edm.provider.CsdlTerm;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class EdmTermImpl extends AbstractEdmNamed implements EdmTerm {
- private static final Logger LOG = LoggerFactory.getLogger(EdmTermImpl.class);
private final CsdlTerm term;
private final FullQualifiedName fqn;
private final EdmTypeInfo typeInfo;
@@ -92,7 +89,7 @@
try {
appliesToLocal.add(ClassUtils.getClass(EdmTerm.class.getPackage().getName() + ".Edm" + element));
} catch (ClassNotFoundException e) {
- LOG.error("Could not load Edm class for {}", element, e);
+ throw new EdmException("Could not load Edm class for {} " + element, e);
}
}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/FunctionMapKey.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/FunctionMapKey.java
index 0b37b0c..b2afdd0 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/FunctionMapKey.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/FunctionMapKey.java
@@ -25,7 +25,7 @@
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-public class FunctionMapKey {
+public final class FunctionMapKey {
private final FullQualifiedName functionName;
@@ -54,29 +54,11 @@
@Override
public int hashCode() {
- String hash = functionName.toString();
-
- if (bindingParameterTypeName != null) {
- hash = hash + bindingParameterTypeName.toString();
- } else {
- hash = hash + "typeNull";
- }
-
- if (isBindingParameterCollection != null) {
- hash = hash + isBindingParameterCollection.toString();
- } else {
- hash = hash + "collectionNull";
- }
-
- if (!parameterNames.isEmpty()) {
- for (String name : parameterNames) {
- hash = hash + name;
- }
- } else {
- hash = hash + "parameterNamesEmpty";
- }
-
- return hash.hashCode();
+ int result = functionName != null ? functionName.hashCode() : 0;
+ result = 31 * result + (bindingParameterTypeName != null ? bindingParameterTypeName.hashCode() : 0);
+ result = 31 * result + (isBindingParameterCollection != null ? isBindingParameterCollection.hashCode() : 0);
+ result = 31 * result + parameterNames.hashCode();
+ return result;
}
@Override
@@ -97,9 +79,7 @@
|| (isBindingParameterCollection != null
&& isBindingParameterCollection.equals(other.isBindingParameterCollection))) {
- if (parameterNames == null && other.parameterNames == null) {
- return true;
- } else if (parameterNames.size() == other.parameterNames.size()) {
+ if (parameterNames.size() == other.parameterNames.size()) {
for (String name : parameterNames) {
if (!other.parameterNames.contains(name)) {
return false;
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffset.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffset.java
index 816a9af..ab295bf 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffset.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffset.java
@@ -216,7 +216,7 @@
if (value instanceof Date) {
// Although java.util.Date, as stated in its documentation,
// "is intended to reflect coordinated universal time (UTC)",
- // its toString() method uses the default time zone. And so do we.
+ // its getName() method uses the default time zone. And so do we.
dateTimeValue = Calendar.getInstance();
dateTimeValue.setTime((Date) value);
} else if (value instanceof Calendar) {
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AbstractAtomDealer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AbstractAtomDealer.java
deleted file mode 100644
index d73daca..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AbstractAtomDealer.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.commons.core.serialization;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-
-abstract class AbstractAtomDealer {
-
- protected static final String TYPE_TEXT = "text";
-
- protected final String namespaceMetadata;
- protected final String namespaceData;
-
- protected final QName etagQName;
- protected final QName metadataEtagQName;
- protected final QName inlineQName;
- protected final QName actionQName;
- protected final QName propertiesQName;
- protected final QName typeQName;
- protected final QName nullQName;
- protected final QName elementQName;
- protected final QName countQName;
- protected final QName uriQName;
- protected final QName nextQName;
- protected final QName annotationQName;
- protected final QName contextQName;
- protected final QName entryRefQName;
- protected final QName propertyValueQName;
- protected final QName deletedEntryQName;
- protected final QName reasonQName;
- protected final QName linkQName;
- protected final QName deletedLinkQName;
- protected final QName errorCodeQName;
- protected final QName errorMessageQName;
- protected final QName errorTargetQName;
-
- public AbstractAtomDealer() {
- namespaceMetadata = Constants.NS_METADATA;
- namespaceData = Constants.NS_DATASERVICES;
-
- etagQName = new QName(namespaceMetadata, Constants.ATOM_ATTR_ETAG);
- metadataEtagQName = new QName(namespaceMetadata, Constants.ATOM_ATTR_METADATAETAG);
- inlineQName = new QName(namespaceMetadata, Constants.ATOM_ELEM_INLINE);
- actionQName = new QName(namespaceMetadata, Constants.ATOM_ELEM_ACTION);
- propertiesQName = new QName(namespaceMetadata, Constants.PROPERTIES);
- typeQName = new QName(namespaceMetadata, Constants.ATTR_TYPE);
- nullQName = new QName(namespaceMetadata, Constants.ATTR_NULL);
- elementQName = new QName(namespaceMetadata, Constants.ELEM_ELEMENT);
- countQName = new QName(namespaceMetadata, Constants.ATOM_ELEM_COUNT);
- uriQName = new QName(namespaceData, Constants.ELEM_URI);
- nextQName = new QName(namespaceData, Constants.NEXT_LINK_REL);
- annotationQName = new QName(namespaceMetadata, Constants.ANNOTATION);
- contextQName = new QName(namespaceMetadata, Constants.CONTEXT);
- entryRefQName = new QName(namespaceMetadata, Constants.ATOM_ELEM_ENTRY_REF);
- propertyValueQName = new QName(namespaceMetadata, Constants.VALUE);
-
- deletedEntryQName = new QName(Constants.NS_ATOM_TOMBSTONE, Constants.ATOM_ELEM_DELETED_ENTRY);
- reasonQName = new QName(namespaceMetadata, Constants.ELEM_REASON);
- linkQName = new QName(namespaceMetadata, Constants.ATOM_ELEM_LINK);
- deletedLinkQName = new QName(namespaceMetadata, Constants.ELEM_DELETED_LINK);
-
- errorCodeQName = new QName(namespaceMetadata, Constants.ERROR_CODE);
- errorMessageQName = new QName(namespaceMetadata, Constants.ERROR_MESSAGE);
- errorTargetQName = new QName(namespaceMetadata, Constants.ERROR_TARGET);
- }
-
- protected void namespaces(final XMLStreamWriter writer) throws XMLStreamException {
- writer.writeNamespace(StringUtils.EMPTY, Constants.NS_ATOM);
- writer.writeNamespace(XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI);
- writer.writeNamespace(Constants.PREFIX_METADATA, Constants.NS_METADATA);
- writer.writeNamespace(Constants.PREFIX_DATASERVICES, Constants.NS_DATASERVICES);
- 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/serialization/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java
deleted file mode 100644
index b8b5167..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java
+++ /dev/null
@@ -1,873 +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.serialization;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.Attribute;
-import javax.xml.stream.events.StartElement;
-import javax.xml.stream.events.XMLEvent;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.ODataError;
-import org.apache.olingo.commons.api.ODataPropertyType;
-import org.apache.olingo.commons.api.data.AbstractODataObject;
-import org.apache.olingo.commons.api.data.Annotation;
-import org.apache.olingo.commons.api.data.ComplexValue;
-import org.apache.olingo.commons.api.data.DeletedEntity;
-import org.apache.olingo.commons.api.data.DeletedEntity.Reason;
-import org.apache.olingo.commons.api.data.Delta;
-import org.apache.olingo.commons.api.data.DeltaLink;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Operation;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.data.Valuable;
-import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.serialization.ODataDeserializer;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-
-import com.fasterxml.aalto.stax.InputFactoryImpl;
-
-public class AtomDeserializer extends AbstractAtomDealer implements ODataDeserializer {
-
- protected static final XMLInputFactory FACTORY = new InputFactoryImpl();
-
- private final AtomGeoValueDeserializer geoDeserializer;
-
- protected XMLEventReader getReader(final InputStream input) throws XMLStreamException {
- return FACTORY.createXMLEventReader(input);
- }
-
- public AtomDeserializer() {
- geoDeserializer = new AtomGeoValueDeserializer();
- }
-
- private Object fromPrimitive(final XMLEventReader reader, final StartElement start,
- final EdmTypeInfo typeInfo) throws XMLStreamException, EdmPrimitiveTypeException {
-
- Object value = null;
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement() && typeInfo != null && typeInfo.getPrimitiveTypeKind().isGeospatial()) {
- final EdmPrimitiveTypeKind geoType =
- EdmPrimitiveTypeKind.valueOfFQN(typeInfo.getFullQualifiedName().toString());
- value = geoDeserializer.deserialize(reader, event.asStartElement(), geoType);
- }
-
- if (event.isCharacters() && !event.asCharacters().isWhiteSpace()
- && (typeInfo == null || !typeInfo.getPrimitiveTypeKind().isGeospatial())) {
-
- final String stringValue = event.asCharacters().getData();
- value = typeInfo == null ? stringValue : // TODO: add facets
- ((EdmPrimitiveType) typeInfo.getType()).valueOfString(stringValue, true, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, true,
- ((EdmPrimitiveType) typeInfo.getType()).getDefaultType());
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return value;
- }
-
- private Object fromComplexOrEnum(final XMLEventReader reader, final StartElement start)
- throws XMLStreamException, EdmPrimitiveTypeException {
-
- Object value = null;
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement()) {
- if (value == null) {
- value = new ComplexValue();
- }
-
- if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
- final Link link = new Link();
- final Attribute rel = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REL));
- if (rel != null) {
- link.setRel(rel.getValue());
- }
- final Attribute title = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TITLE));
- if (title != null) {
- link.setTitle(title.getValue());
- }
- final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
- if (href != null) {
- link.setHref(href.getValue());
- }
- final Attribute type = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TYPE));
- if (type != null) {
- link.setType(type.getValue());
- }
-
- if (link.getRel().startsWith(Constants.NS_NAVIGATION_LINK_REL)) {
-
- ((ComplexValue) value).getNavigationLinks().add(link);
- inline(reader, event.asStartElement(), link);
- } else if (link.getRel().startsWith(Constants.NS_ASSOCIATION_LINK_REL)) {
-
- ((Valuable) value).asComplex().getAssociationLinks().add(link);
- }
- } else {
- ((ComplexValue) value).getValue().add(property(reader, event.asStartElement()));
- }
- }
-
- if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
- value = event.asCharacters().getData();
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return value;
- }
-
- private void fromCollection(final Valuable valuable, final XMLEventReader reader, final StartElement start,
- final EdmTypeInfo typeInfo) throws XMLStreamException, EdmPrimitiveTypeException {
-
- List<Object> values = new ArrayList<Object>();
- ValueType valueType = ValueType.COLLECTION_PRIMITIVE;
-
- final EdmTypeInfo type = typeInfo == null ? null :
- new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement()) {
- switch (guessPropertyType(reader, typeInfo)) {
- case COMPLEX:
- final Object complexValue = fromComplexOrEnum(reader, event.asStartElement());
- valueType = ValueType.COLLECTION_COMPLEX;
- values.add(complexValue);
- break;
-
- case ENUM:
- valueType = ValueType.COLLECTION_ENUM;
- values.add(fromComplexOrEnum(reader, event.asStartElement()));
- break;
-
- case PRIMITIVE:
- final Object value = fromPrimitive(reader, event.asStartElement(), type);
- valueType = value instanceof Geospatial ?
- ValueType.COLLECTION_GEOSPATIAL : ValueType.COLLECTION_PRIMITIVE;
- values.add(value);
- break;
-
- default:
- // do not add null or empty values
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
- valuable.setValue(valueType, values);
- }
-
- private ODataPropertyType guessPropertyType(final XMLEventReader reader, final EdmTypeInfo typeInfo)
- throws XMLStreamException {
-
- XMLEvent child = null;
- while (reader.hasNext() && child == null) {
- final XMLEvent event = reader.peek();
- if (event.isCharacters() && event.asCharacters().isWhiteSpace()) {
- reader.nextEvent();
- } else {
- child = event;
- }
- }
-
- final ODataPropertyType type;
- if (child == null) {
- type = typeInfo == null || typeInfo.isPrimitiveType() ? ODataPropertyType.PRIMITIVE : ODataPropertyType.ENUM;
- } else {
- if (child.isStartElement()) {
- if (Constants.NS_GML.equals(child.asStartElement().getName().getNamespaceURI())) {
- type = ODataPropertyType.PRIMITIVE;
- } else if (elementQName.equals(child.asStartElement().getName())) {
- type = ODataPropertyType.COLLECTION;
- } else {
- type = ODataPropertyType.COMPLEX;
- }
- } else if (child.isCharacters()) {
- type = typeInfo == null || typeInfo.isPrimitiveType()
- ? ODataPropertyType.PRIMITIVE
- : ODataPropertyType.ENUM;
- } else {
- type = ODataPropertyType.EMPTY;
- }
- }
-
- return type;
- }
-
- private Property property(final XMLEventReader reader, final StartElement start)
- throws XMLStreamException, EdmPrimitiveTypeException {
-
- final Property property = new Property();
-
- if (propertyValueQName.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());
- }
-
- valuable(property, reader, start);
-
- return property;
- }
-
- private void valuable(final Valuable valuable, final XMLEventReader reader, final StartElement start)
- throws XMLStreamException, EdmPrimitiveTypeException {
-
- final Attribute nullAttr = start.getAttributeByName(nullQName);
-
- final Attribute typeAttr = start.getAttributeByName(typeQName);
- final String typeAttrValue = typeAttr == null ? null : typeAttr.getValue();
-
- final EdmTypeInfo typeInfo = StringUtils.isBlank(typeAttrValue) ? null :
- new EdmTypeInfo.Builder().setTypeExpression(typeAttrValue).build();
-
- if (typeInfo != null) {
- valuable.setType(typeInfo.internal());
- }
-
- final ODataPropertyType propType = typeInfo == null ? guessPropertyType(reader, typeInfo) :
- typeInfo.isCollection() ? ODataPropertyType.COLLECTION :
- typeInfo.isPrimitiveType() ? ODataPropertyType.PRIMITIVE : ODataPropertyType.COMPLEX;
-
- if (nullAttr == null) {
- switch (propType) {
- case COLLECTION:
- fromCollection(valuable, reader, start, typeInfo);
- break;
-
- case COMPLEX:
- final Object complexValue = fromComplexOrEnum(reader, start);
- valuable.setValue(complexValue instanceof ComplexValue ? ValueType.COMPLEX : ValueType.ENUM,
- complexValue);
- break;
-
- case PRIMITIVE:
- // No type specified? Defaults to Edm.String
- if (typeInfo == null) {
- valuable.setType(EdmPrimitiveTypeKind.String.getFullQualifiedName().toString());
- }
- final Object value = fromPrimitive(reader, start, typeInfo);
- valuable.setValue(value instanceof Geospatial ? ValueType.GEOSPATIAL : ValueType.PRIMITIVE, value);
- break;
-
- case EMPTY:
- default:
- valuable.setValue(ValueType.PRIMITIVE, StringUtils.EMPTY);
- }
- } else {
- valuable.setValue(propType == ODataPropertyType.PRIMITIVE ? ValueType.PRIMITIVE :
- propType == ODataPropertyType.ENUM ? ValueType.ENUM :
- propType == ODataPropertyType.COMPLEX ? ValueType.COMPLEX :
- propType == ODataPropertyType.COLLECTION ? ValueType.COLLECTION_PRIMITIVE : ValueType.PRIMITIVE,
- null);
- }
- }
-
- @Override
- public ResWrap<Property> toProperty(final InputStream input) throws ODataDeserializerException {
- try {
- final XMLEventReader reader = getReader(input);
- final StartElement start = skipBeforeFirstStartElement(reader);
- return getContainer(start, property(reader, start));
- } catch (XMLStreamException e) {
- throw new ODataDeserializerException(e);
- } catch (final EdmPrimitiveTypeException e) {
- throw new ODataDeserializerException(e);
- }
- }
-
- private StartElement skipBeforeFirstStartElement(final XMLEventReader reader) throws XMLStreamException {
- StartElement startEvent = null;
- while (reader.hasNext() && startEvent == null) {
- final XMLEvent event = reader.nextEvent();
- if (event.isStartElement()) {
- startEvent = event.asStartElement();
- }
- }
- if (startEvent == null) {
- throw new IllegalArgumentException("Cannot find any XML start element");
- }
-
- return startEvent;
- }
-
- private void common(final XMLEventReader reader, final StartElement start,
- final AbstractODataObject object, final String key) throws XMLStreamException {
-
- boolean foundEndElement = false;
- while (reader.hasNext() && !foundEndElement) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
- try {
- object.setCommonProperty(key, event.asCharacters().getData());
- } catch (ParseException e) {
- throw new XMLStreamException("While parsing Atom entry or feed common elements", e);
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndElement = true;
- }
- }
- }
-
- private void inline(final XMLEventReader reader, final StartElement start, final Link link)
- throws XMLStreamException, EdmPrimitiveTypeException {
-
- boolean foundEndElement = false;
- while (reader.hasNext() && !foundEndElement) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement()) {
- if (inlineQName.equals(event.asStartElement().getName())) {
- StartElement inline = getStartElement(reader);
- if (inline != null) {
- if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(inline.getName())) {
- link.setInlineEntity(entity(reader, inline));
- }
- if (Constants.QNAME_ATOM_ELEM_FEED.equals(inline.getName())) {
- link.setInlineEntitySet(entitySet(reader, inline));
- }
- }
- } else if (annotationQName.equals(event.asStartElement().getName())) {
- link.getAnnotations().add(annotation(reader, event.asStartElement()));
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndElement = true;
- }
- }
- }
-
- private StartElement getStartElement(final XMLEventReader reader) throws XMLStreamException {
- while (reader.hasNext()) {
- final XMLEvent innerEvent = reader.peek();
- if (innerEvent.isCharacters() && innerEvent.asCharacters().isWhiteSpace()) {
- reader.nextEvent();
- } else if (innerEvent.isStartElement()) {
- return innerEvent.asStartElement();
- } else if (innerEvent.isEndElement() && inlineQName.equals(innerEvent.asEndElement().getName())) {
- return null;
- }
- }
- return null;
- }
-
- public ResWrap<Delta> delta(final InputStream input)
- throws XMLStreamException, EdmPrimitiveTypeException {
- final XMLEventReader reader = getReader(input);
- final StartElement start = skipBeforeFirstStartElement(reader);
- return getContainer(start, delta(reader, start));
- }
-
- private Delta delta(final XMLEventReader reader, final StartElement start)
- throws XMLStreamException, EdmPrimitiveTypeException {
- if (!Constants.QNAME_ATOM_ELEM_FEED.equals(start.getName())) {
- return null;
- }
- final Delta delta = new Delta();
- final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
- if (xmlBase != null) {
- delta.setBaseURI(URI.create(xmlBase.getValue()));
- }
-
- boolean foundEndFeed = false;
- while (reader.hasNext() && !foundEndFeed) {
- final XMLEvent event = reader.nextEvent();
- if (event.isStartElement()) {
- if (countQName.equals(event.asStartElement().getName())) {
- count(reader, event.asStartElement(), delta);
- } else if (Constants.QNAME_ATOM_ELEM_ID.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), delta, "id");
- } else if (Constants.QNAME_ATOM_ELEM_TITLE.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), delta, "title");
- } else if (Constants.QNAME_ATOM_ELEM_SUMMARY.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), delta, "summary");
- } else if (Constants.QNAME_ATOM_ELEM_UPDATED.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), delta, "updated");
- } else if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
- final Attribute rel = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REL));
- if (rel != null) {
- if (Constants.NEXT_LINK_REL.equals(rel.getValue())) {
- final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
- if (href != null) {
- delta.setNext(URI.create(href.getValue()));
- }
- }
- if (Constants.NS_DELTA_LINK_REL.equals(rel.getValue())) {
- final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
- if (href != null) {
- delta.setDeltaLink(URI.create(href.getValue()));
- }
- }
- }
- } else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(event.asStartElement().getName())) {
- delta.getEntities().add(entity(reader, event.asStartElement()));
- } else if (deletedEntryQName.equals(event.asStartElement().getName())) {
- final DeletedEntity deletedEntity = new DeletedEntity();
-
- final Attribute ref = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REF));
- if (ref != null) {
- deletedEntity.setId(URI.create(ref.getValue()));
- }
- final Attribute reason = event.asStartElement().getAttributeByName(reasonQName);
- if (reason != null) {
- deletedEntity.setReason(Reason.valueOf(reason.getValue()));
- }
-
- delta.getDeletedEntities().add(deletedEntity);
- } else if (linkQName.equals(event.asStartElement().getName())
- || deletedLinkQName.equals(event.asStartElement().getName())) {
-
- final DeltaLink link = new DeltaLink();
-
- final Attribute source = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_SOURCE));
- if (source != null) {
- link.setSource(URI.create(source.getValue()));
- }
- final Attribute relationship =
- event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_RELATIONSHIP));
- if (relationship != null) {
- link.setRelationship(relationship.getValue());
- }
- final Attribute target = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TARGET));
- if (target != null) {
- link.setTarget(URI.create(target.getValue()));
- }
-
- if (linkQName.equals(event.asStartElement().getName())) {
- delta.getAddedLinks().add(link);
- } else {
- delta.getDeletedLinks().add(link);
- }
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndFeed = true;
- }
- }
-
- return delta;
- }
-
- private void properties(final XMLEventReader reader, final StartElement start, final Entity entity)
- throws XMLStreamException, EdmPrimitiveTypeException {
-
- final Map<String, List<Annotation>> annotations = new HashMap<String, List<Annotation>>();
-
- boolean foundEndProperties = false;
- while (reader.hasNext() && !foundEndProperties) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement()) {
- if (annotationQName.equals(event.asStartElement().getName())) {
- final String target = event.asStartElement().
- getAttributeByName(QName.valueOf(Constants.ATTR_TARGET)).getValue();
- if (!annotations.containsKey(target)) {
- annotations.put(target, new ArrayList<Annotation>());
- }
- annotations.get(target).add(annotation(reader, event.asStartElement()));
- } else {
- entity.getProperties().add(property(reader, event.asStartElement()));
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperties = true;
- }
- }
-
- for (Property property : entity.getProperties()) {
- if (annotations.containsKey(property.getName())) {
- property.getAnnotations().addAll(annotations.get(property.getName()));
- }
- }
- }
-
- private Annotation annotation(final XMLEventReader reader, final StartElement start)
- throws XMLStreamException, EdmPrimitiveTypeException {
-
- final Annotation annotation = new Annotation();
-
- annotation.setTerm(start.getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_TERM)).getValue());
- valuable(annotation, reader, start);
-
- return annotation;
- }
-
- private Entity entityRef(final StartElement start) throws XMLStreamException {
- final Entity entity = new Entity();
-
- final Attribute entityRefId = start.getAttributeByName(Constants.QNAME_ATOM_ATTR_ID);
- if (entityRefId != null) {
- entity.setId(URI.create(entityRefId.getValue()));
- }
-
- return entity;
- }
-
- private Entity entity(final XMLEventReader reader, final StartElement start)
- throws XMLStreamException, EdmPrimitiveTypeException {
- final Entity entity;
- if (entryRefQName.equals(start.getName())) {
- entity = entityRef(start);
- } else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(start.getName())) {
- entity = new Entity();
- final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
- if (xmlBase != null) {
- entity.setBaseURI(URI.create(xmlBase.getValue()));
- }
-
- final Attribute etag = start.getAttributeByName(etagQName);
- if (etag != null) {
- entity.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(), entity, "id");
- } else if (Constants.QNAME_ATOM_ELEM_TITLE.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), entity, "title");
- } else if (Constants.QNAME_ATOM_ELEM_SUMMARY.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), entity, "summary");
- } else if (Constants.QNAME_ATOM_ELEM_UPDATED.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), entity, "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) {
- entity.setType(new EdmTypeInfo.Builder().setTypeExpression(term.getValue()).build().internal());
- }
- } else if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
- final Link link = new Link();
- 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())) {
- entity.setSelfLink(link);
- } else if (Constants.EDIT_LINK_REL.equals(link.getRel())) {
- entity.setEditLink(link);
- } else if (Constants.EDITMEDIA_LINK_REL.equals(link.getRel())) {
- final Attribute mediaETag = event.asStartElement().getAttributeByName(etagQName);
- if (mediaETag != null) {
- entity.setMediaETag(mediaETag.getValue());
- }
- } else if (link.getRel().startsWith(Constants.NS_NAVIGATION_LINK_REL)) {
-
- entity.getNavigationLinks().add(link);
- inline(reader, event.asStartElement(), link);
- } else if (link.getRel().startsWith(Constants.NS_ASSOCIATION_LINK_REL)) {
-
- entity.getAssociationLinks().add(link);
- } else if (link.getRel().startsWith(Constants.NS_MEDIA_EDIT_LINK_REL)) {
-
- final Attribute metag = event.asStartElement().getAttributeByName(etagQName);
- if (metag != null) {
- link.setMediaETag(metag.getValue());
- }
- entity.getMediaEditLinks().add(link);
- }
- } else if (actionQName.equals(event.asStartElement().getName())) {
- final Operation operation = new Operation();
- 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()));
- }
-
- entity.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.toContentTypeString().equals(type.getValue())) {
- properties(reader, skipBeforeFirstStartElement(reader), entity);
- } else {
- entity.setMediaContentType(type.getValue());
- final Attribute src = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_SRC));
- if (src != null) {
- entity.setMediaContentSource(URI.create(src.getValue()));
- }
- }
- } else if (propertiesQName.equals(event.asStartElement().getName())) {
- properties(reader, event.asStartElement(), entity);
- } else if (annotationQName.equals(event.asStartElement().getName())) {
- entity.getAnnotations().add(annotation(reader, event.asStartElement()));
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndEntry = true;
- }
- }
- } else {
- entity = null;
- }
-
- return entity;
- }
-
- @Override
- public ResWrap<Entity> toEntity(final InputStream input) throws ODataDeserializerException {
- try {
- final XMLEventReader reader = getReader(input);
- final StartElement start = skipBeforeFirstStartElement(reader);
- final Entity entity = entity(reader, start);
- if (entity == null) {
- throw new ODataDeserializerException("No entity found!");
- } else {
- return getContainer(start, entity);
- }
- } catch (XMLStreamException e) {
- throw new ODataDeserializerException(e);
- } catch (final EdmPrimitiveTypeException e) {
- throw new ODataDeserializerException(e);
- }
- }
-
- private void count(final XMLEventReader reader, final StartElement start, final EntityCollection entitySet)
- throws XMLStreamException {
-
- boolean foundEndElement = false;
- while (reader.hasNext() && !foundEndElement) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
- entitySet.setCount(Integer.valueOf(event.asCharacters().getData()));
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndElement = true;
- }
- }
- }
-
- private EntityCollection entitySet(final XMLEventReader reader, final StartElement start)
- throws XMLStreamException, EdmPrimitiveTypeException {
- if (!Constants.QNAME_ATOM_ELEM_FEED.equals(start.getName())) {
- return null;
- }
- final EntityCollection entitySet = new EntityCollection();
- final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
- if (xmlBase != null) {
- entitySet.setBaseURI(URI.create(xmlBase.getValue()));
- }
-
- boolean foundEndFeed = false;
- while (reader.hasNext() && !foundEndFeed) {
- final XMLEvent event = reader.nextEvent();
- if (event.isStartElement()) {
- if (countQName.equals(event.asStartElement().getName())) {
- count(reader, event.asStartElement(), entitySet);
- } else if (Constants.QNAME_ATOM_ELEM_ID.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), entitySet, "id");
- } else if (Constants.QNAME_ATOM_ELEM_TITLE.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), entitySet, "title");
- } else if (Constants.QNAME_ATOM_ELEM_SUMMARY.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), entitySet, "summary");
- } else if (Constants.QNAME_ATOM_ELEM_UPDATED.equals(event.asStartElement().getName())) {
- common(reader, event.asStartElement(), entitySet, "updated");
- } else if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
- final Attribute rel = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REL));
- if (rel != null) {
- if (Constants.NEXT_LINK_REL.equals(rel.getValue())) {
- final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
- if (href != null) {
- entitySet.setNext(URI.create(href.getValue()));
- }
- }
- if (Constants.NS_DELTA_LINK_REL.equals(rel.getValue())) {
- final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
- if (href != null) {
- entitySet.setDeltaLink(URI.create(href.getValue()));
- }
- }
- }
- } else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(event.asStartElement().getName())) {
- entitySet.getEntities().add(entity(reader, event.asStartElement()));
- } else if (entryRefQName.equals(event.asStartElement().getName())) {
- entitySet.getEntities().add(entityRef(event.asStartElement()));
- } else if (annotationQName.equals(event.asStartElement().getName())) {
- entitySet.getAnnotations().add(annotation(reader, event.asStartElement()));
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndFeed = true;
- }
- }
-
- return entitySet;
- }
-
- @Override
- public ResWrap<EntityCollection> toEntitySet(final InputStream input) throws ODataDeserializerException {
- try {
- final XMLEventReader reader = getReader(input);
- final StartElement start = skipBeforeFirstStartElement(reader);
- return getContainer(start, entitySet(reader, start));
- } catch (XMLStreamException e) {
- throw new ODataDeserializerException(e);
- } catch (final EdmPrimitiveTypeException e) {
- throw new ODataDeserializerException(e);
- }
- }
-
- private ODataError error(final XMLEventReader reader, final StartElement start) throws XMLStreamException {
- final ODataError error = new ODataError();
-
- 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;
- }
-
- @Override
- public ODataError toError(final InputStream input) throws ODataDeserializerException {
- try {
- final XMLEventReader reader = getReader(input);
- final StartElement start = skipBeforeFirstStartElement(reader);
- return error(reader, start);
- } catch (XMLStreamException e) {
- throw new ODataDeserializerException(e);
- }
- }
-
- private <T> ResWrap<T> getContainer(final StartElement start, final T object) {
- final Attribute context = start.getAttributeByName(contextQName);
- final Attribute metadataETag = start.getAttributeByName(metadataEtagQName);
-
- return new ResWrap<T>(
- context == null ? null : URI.create(context.getValue()),
- metadataETag == null ? null : metadataETag.getValue(),
- object);
- }
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomGeoValueDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomGeoValueDeserializer.java
deleted file mode 100644
index 743b78c..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomGeoValueDeserializer.java
+++ /dev/null
@@ -1,269 +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.serialization;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.Attribute;
-import javax.xml.stream.events.StartElement;
-import javax.xml.stream.events.XMLEvent;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.GeoUtils;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-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.geo.SRID;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
-
-class AtomGeoValueDeserializer {
-
- private List<Point> points(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final SRID srid) throws XMLStreamException {
-
- final List<Point> result = new ArrayList<Point>();
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
- final String[] pointInfo = event.asCharacters().getData().split(" ");
-
- 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));
- point.setY(EdmDouble.getInstance().valueOfString(pointInfo[1], null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
- } catch (EdmPrimitiveTypeException e) {
- throw new XMLStreamException("While deserializing point coordinates as double", e);
- }
- result.add(point);
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- // handles bad input, e.g. things like <gml:pos/>
- if (result.isEmpty()) {
- result.add(new Point(GeoUtils.getDimension(type), srid));
- }
-
- return result;
- }
-
- private MultiPoint multipoint(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final SRID srid) throws XMLStreamException {
-
- List<Point> points = Collections.<Point> emptyList();
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_POINTMEMBERS)) {
- points = points(reader, event.asStartElement(), type, null);
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return new MultiPoint(GeoUtils.getDimension(type), srid, points);
- }
-
- private LineString lineString(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final SRID srid) throws XMLStreamException {
-
- 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 SRID srid) throws XMLStreamException {
-
- List<Point> extPoints = null;
- List<Point> intPoints = null;
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement()) {
- if (event.asStartElement().getName().equals(Constants.QNAME_POLYGON_EXTERIOR)) {
- extPoints = points(reader, event.asStartElement(), type, null);
- }
- if (event.asStartElement().getName().equals(Constants.QNAME_POLYGON_INTERIOR)) {
- intPoints = points(reader, event.asStartElement(), type, null);
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return new Polygon(GeoUtils.getDimension(type), srid, intPoints, extPoints);
- }
-
- private MultiLineString multiLineString(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final SRID srid) throws XMLStreamException {
-
- final List<LineString> lineStrings = new ArrayList<LineString>();
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_LINESTRING)) {
- lineStrings.add(lineString(reader, event.asStartElement(), type, null));
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return new MultiLineString(GeoUtils.getDimension(type), srid, lineStrings);
- }
-
- private MultiPolygon multiPolygon(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final SRID srid) throws XMLStreamException {
-
- final List<Polygon> polygons = new ArrayList<Polygon>();
-
- boolean foundEndProperty = false;
- while (reader.hasNext() && !foundEndProperty) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_POLYGON)) {
- polygons.add(polygon(reader, event.asStartElement(), type, null));
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndProperty = true;
- }
- }
-
- return new MultiPolygon(GeoUtils.getDimension(type), srid, polygons);
- }
-
- private GeospatialCollection collection(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final SRID srid) throws XMLStreamException {
-
- final List<Geospatial> geospatials = new ArrayList<Geospatial>();
-
- boolean foundEndCollection = false;
- while (reader.hasNext() && !foundEndCollection) {
- final XMLEvent event = reader.nextEvent();
-
- if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_GEOMEMBERS)) {
- boolean foundEndMembers = false;
- while (reader.hasNext() && !foundEndMembers) {
- final XMLEvent subevent = reader.nextEvent();
-
- if (subevent.isStartElement()) {
- geospatials.add(deserialize(reader, subevent.asStartElement(),
- GeoUtils.getType(GeoUtils.getDimension(type), subevent.asStartElement().getName().getLocalPart())));
- }
-
- if (subevent.isEndElement() && Constants.QNAME_GEOMEMBERS.equals(subevent.asEndElement().getName())) {
- foundEndMembers = true;
- }
- }
- }
-
- if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
- foundEndCollection = true;
- }
- }
-
- return new GeospatialCollection(GeoUtils.getDimension(type), srid, geospatials);
- }
-
- public Geospatial deserialize(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type) throws XMLStreamException {
-
- SRID srid = null;
- final Attribute srsName = start.getAttributeByName(Constants.QNAME_ATTR_SRSNAME);
- if (srsName != null) {
- srid = SRID.valueOf(StringUtils.substringAfterLast(srsName.getValue(), "/"));
- }
-
- Geospatial value;
-
- switch (type) {
- case GeographyPoint:
- case GeometryPoint:
- value = points(reader, start, type, srid).get(0);
- break;
-
- case GeographyMultiPoint:
- case GeometryMultiPoint:
- value = multipoint(reader, start, type, srid);
- break;
-
- case GeographyLineString:
- case GeometryLineString:
- value = lineString(reader, start, type, srid);
- break;
-
- case GeographyMultiLineString:
- case GeometryMultiLineString:
- value = multiLineString(reader, start, type, srid);
- break;
-
- case GeographyPolygon:
- case GeometryPolygon:
- value = polygon(reader, start, type, srid);
- break;
-
- case GeographyMultiPolygon:
- case GeometryMultiPolygon:
- value = multiPolygon(reader, start, type, srid);
- break;
-
- case GeographyCollection:
- case GeometryCollection:
- value = collection(reader, start, type, srid);
- break;
-
- default:
- value = null;
- }
-
- return value;
- }
-
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomGeoValueSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomGeoValueSerializer.java
deleted file mode 100644
index 8254559..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomGeoValueSerializer.java
+++ /dev/null
@@ -1,223 +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.serialization;
-
-import java.util.Collections;
-import java.util.Iterator;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.olingo.commons.api.Constants;
-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.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.core.edm.primitivetype.EdmDouble;
-
-class AtomGeoValueSerializer {
-
- private void points(final XMLStreamWriter writer, final Iterator<Point> itor, final boolean wrap)
- throws XMLStreamException {
-
- while (itor.hasNext()) {
- final Point point = itor.next();
-
- if (wrap) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POINT, Constants.NS_GML);
- }
-
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POS, Constants.NS_GML);
- try {
- writer.writeCharacters(EdmDouble.getInstance().valueToString(point.getX(), null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
- + " "
- + EdmDouble.getInstance().valueToString(point.getY(), null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
- } catch (EdmPrimitiveTypeException e) {
- throw new XMLStreamException("While serializing point coordinates as double", e);
- }
- writer.writeEndElement();
-
- if (wrap) {
- writer.writeEndElement();
- }
- }
- }
-
- private void lineStrings(final XMLStreamWriter writer, final Iterator<LineString> itor, final boolean wrap)
- throws XMLStreamException {
-
- while (itor.hasNext()) {
- final LineString lineString = itor.next();
-
- if (wrap) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_LINESTRING, Constants.NS_GML);
- }
-
- points(writer, lineString.iterator(), false);
-
- if (wrap) {
- writer.writeEndElement();
- }
- }
- }
-
- private void polygons(final XMLStreamWriter writer, final Iterator<Polygon> itor, final boolean wrap)
- throws XMLStreamException {
-
- while (itor.hasNext()) {
- final Polygon polygon = itor.next();
-
- if (wrap) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON, Constants.NS_GML);
- }
-
- if (!polygon.getExterior().isEmpty()) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_EXTERIOR, Constants.NS_GML);
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_LINEARRING, Constants.NS_GML);
-
- points(writer, polygon.getExterior().iterator(), false);
-
- writer.writeEndElement();
- writer.writeEndElement();
- }
- if (!polygon.getInterior().isEmpty()) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_INTERIOR, Constants.NS_GML);
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON_LINEARRING, Constants.NS_GML);
-
- points(writer, polygon.getInterior().iterator(), false);
-
- writer.writeEndElement();
- writer.writeEndElement();
- }
-
- if (wrap) {
- writer.writeEndElement();
- }
- }
- }
-
- private void writeSrsName(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException {
- if (value.getSrid() != null && value.getSrid().isNotDefault()) {
- writer.writeAttribute(Constants.PREFIX_GML, Constants.NS_GML, Constants.ATTR_SRSNAME,
- Constants.SRS_URLPREFIX + value.getSrid().toString());
- }
- }
-
- public void serialize(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException {
- switch (value.getEdmPrimitiveTypeKind()) {
- case GeographyPoint:
- case GeometryPoint:
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POINT, Constants.NS_GML);
- writeSrsName(writer, value);
-
- points(writer, Collections.singleton((Point) value).iterator(), false);
-
- writer.writeEndElement();
- break;
-
- case GeometryMultiPoint:
- case GeographyMultiPoint:
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_MULTIPOINT, Constants.NS_GML);
- writeSrsName(writer, value);
-
- if (!((MultiPoint) value).isEmpty()) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POINTMEMBERS, Constants.NS_GML);
- points(writer, ((MultiPoint) value).iterator(), true);
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- break;
-
- case GeometryLineString:
- case GeographyLineString:
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_LINESTRING, Constants.NS_GML);
- writeSrsName(writer, value);
-
- lineStrings(writer, Collections.singleton((LineString) value).iterator(), false);
-
- writer.writeEndElement();
- break;
-
- case GeometryMultiLineString:
- case GeographyMultiLineString:
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_MULTILINESTRING, Constants.NS_GML);
- writeSrsName(writer, value);
-
- if (!((MultiLineString) value).isEmpty()) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_LINESTRINGMEMBERS, Constants.NS_GML);
- lineStrings(writer, ((MultiLineString) value).iterator(), true);
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- break;
-
- case GeographyPolygon:
- case GeometryPolygon:
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_POLYGON, Constants.NS_GML);
- writeSrsName(writer, value);
-
- polygons(writer, Collections.singleton(((Polygon) value)).iterator(), false);
-
- writer.writeEndElement();
- break;
-
- case GeographyMultiPolygon:
- case GeometryMultiPolygon:
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_MULTIPOLYGON, Constants.NS_GML);
- writeSrsName(writer, value);
-
- if (!((MultiPolygon) value).isEmpty()) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_SURFACEMEMBERS, Constants.NS_GML);
- polygons(writer, ((MultiPolygon) value).iterator(), true);
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- break;
-
- case GeographyCollection:
- case GeometryCollection:
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_GEOCOLLECTION, Constants.NS_GML);
- writeSrsName(writer, value);
-
- if (!((GeospatialCollection) value).isEmpty()) {
- writer.writeStartElement(Constants.PREFIX_GML, Constants.ELEM_GEOMEMBERS, Constants.NS_GML);
- for (Geospatial geospatial : ((GeospatialCollection) value)) {
- serialize(writer, geospatial);
- }
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- break;
-
- default:
- }
- }
-
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java
deleted file mode 100644
index ecd7be0..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java
+++ /dev/null
@@ -1,570 +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.serialization;
-
-import java.io.Writer;
-import java.net.URI;
-import java.util.Collections;
-import java.util.List;
-
-import javax.xml.XMLConstants;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.commons.api.data.AbstractODataObject;
-import org.apache.olingo.commons.api.data.Annotation;
-import org.apache.olingo.commons.api.data.ComplexValue;
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Operation;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.serialization.ODataSerializer;
-import org.apache.olingo.commons.api.serialization.ODataSerializerException;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-
-import com.fasterxml.aalto.stax.OutputFactoryImpl;
-
-public class AtomSerializer extends AbstractAtomDealer implements ODataSerializer {
-
- private static final XMLOutputFactory FACTORY = new OutputFactoryImpl();
-
- private final AtomGeoValueSerializer geoSerializer;
-
- private final boolean serverMode;
-
- public AtomSerializer() {
- this(false);
- }
-
- public AtomSerializer(final boolean serverMode) {
- geoSerializer = new AtomGeoValueSerializer();
- this.serverMode = serverMode;
- }
-
- private void collection(final XMLStreamWriter writer,
- final ValueType valueType, final EdmPrimitiveTypeKind kind, final List<?> value)
- throws XMLStreamException, EdmPrimitiveTypeException {
- for (Object item : value) {
- writer.writeStartElement(Constants.PREFIX_METADATA, Constants.ELEM_ELEMENT, namespaceMetadata);
- value(writer, valueType, kind, item);
- writer.writeEndElement();
- }
- }
-
- private void value(final XMLStreamWriter writer,
- final ValueType valueType, final EdmPrimitiveTypeKind kind, final Object value)
- throws XMLStreamException, EdmPrimitiveTypeException {
- if (value == null) {
- writer.writeAttribute(Constants.PREFIX_METADATA, namespaceMetadata,
- Constants.ATTR_NULL, Boolean.TRUE.toString());
- return;
- }
- switch (valueType) {
- case PRIMITIVE:
- writer.writeCharacters(kind == null ? value.toString() :
- EdmPrimitiveTypeFactory.getInstance(kind) // TODO: add facets
- .valueToString(value, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
- break;
- case ENUM:
- writer.writeCharacters(value.toString());
- break;
- case GEOSPATIAL:
- geoSerializer.serialize(writer, (Geospatial) value);
- break;
- case COLLECTION_PRIMITIVE:
- case COLLECTION_GEOSPATIAL:
- case COLLECTION_ENUM:
- case COLLECTION_COMPLEX:
- collection(writer, valueType.getBaseType(), kind, (List<?>) value);
- break;
- case COMPLEX:
- for (Property property : ((ComplexValue) value).getValue()) {
- property(writer, property, false);
- }
- break;
- case ENTITY:
- case COLLECTION_ENTITY:
- throw new ODataRuntimeException("Entities cannot appear in this payload");
- }
- }
-
- public void property(final XMLStreamWriter writer, final Property property, final boolean standalone)
- throws XMLStreamException, EdmPrimitiveTypeException {
-
- if (standalone) {
- writer.writeStartElement(Constants.PREFIX_METADATA, Constants.VALUE, namespaceData);
- namespaces(writer);
- } else {
- writer.writeStartElement(Constants.PREFIX_DATASERVICES, property.getName(), namespaceData);
- }
-
- EdmTypeInfo typeInfo = null;
- if (StringUtils.isNotBlank(property.getType())) {
- typeInfo = new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
- if (!EdmPrimitiveTypeKind.String.getFullQualifiedName().toString().equals(typeInfo.internal())) {
- writer.writeAttribute(Constants.PREFIX_METADATA, namespaceMetadata,
- Constants.ATTR_TYPE, typeInfo.external());
- }
- }
-
- value(writer, property.getValueType(), typeInfo == null ? null : typeInfo.getPrimitiveTypeKind(),
- property.getValue());
- if (!property.isNull() && property.isComplex() && !property.isCollection()) {
- links(writer, property.asComplex().getAssociationLinks());
- links(writer, property.asComplex().getNavigationLinks());
- }
-
- writer.writeEndElement();
-
- for (Annotation annotation : property.getAnnotations()) {
- annotation(writer, annotation, property.getName());
- }
- }
-
- private void property(final XMLStreamWriter writer, final Property property)
- throws XMLStreamException, EdmPrimitiveTypeException {
- property(writer, property, true);
- }
-
- private void startDocument(final XMLStreamWriter writer, final String rootElement) throws XMLStreamException {
- writer.writeStartDocument();
- writer.setDefaultNamespace(Constants.NS_ATOM);
-
- writer.writeStartElement(rootElement);
-
- namespaces(writer);
- }
-
- private void property(final Writer outWriter, final Property property)
- throws XMLStreamException, EdmPrimitiveTypeException {
- final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
-
- writer.writeStartDocument();
-
- property(writer, property);
-
- writer.writeEndDocument();
- writer.flush();
- }
-
- private void links(final XMLStreamWriter writer, final List<Link> links)
- throws XMLStreamException, EdmPrimitiveTypeException {
- for (Link link : links) {
- writer.writeStartElement(Constants.ATOM_ELEM_LINK);
-
- if (StringUtils.isNotBlank(link.getRel())) {
- writer.writeAttribute(Constants.ATTR_REL, link.getRel());
- }
- if (StringUtils.isNotBlank(link.getTitle())) {
- writer.writeAttribute(Constants.ATTR_TITLE, link.getTitle());
- }
- if (StringUtils.isNotBlank(link.getHref())) {
- writer.writeAttribute(Constants.ATTR_HREF, link.getHref());
- }
- if (StringUtils.isNotBlank(link.getType())) {
- writer.writeAttribute(Constants.ATTR_TYPE, link.getType());
- }
-
- if (link.getInlineEntity() != null || link.getInlineEntitySet() != null) {
- writer.writeStartElement(Constants.PREFIX_METADATA, Constants.ATOM_ELEM_INLINE, namespaceMetadata);
-
- if (link.getInlineEntity() != null) {
- writer.writeStartElement(Constants.ATOM_ELEM_ENTRY);
- entity(writer, link.getInlineEntity());
- writer.writeEndElement();
- }
- if (link.getInlineEntitySet() != null) {
- writer.writeStartElement(Constants.ATOM_ELEM_FEED);
- entitySet(writer, link.getInlineEntitySet());
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- }
-
- for (Annotation annotation : link.getAnnotations()) {
- annotation(writer, annotation, null);
- }
-
- writer.writeEndElement();
- }
- }
-
- 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);
- writer.writeCharacters(object.getTitle());
- writer.writeEndElement();
- }
- }
-
- private void properties(final XMLStreamWriter writer, final List<Property> properties)
- throws XMLStreamException, EdmPrimitiveTypeException {
- for (Property property : properties) {
- property(writer, property, false);
- }
- }
-
- private void annotation(final XMLStreamWriter writer, final Annotation annotation, final String target)
- throws XMLStreamException, EdmPrimitiveTypeException {
-
- writer.writeStartElement(Constants.PREFIX_METADATA, Constants.ANNOTATION, namespaceMetadata);
-
- writer.writeAttribute(Constants.ATOM_ATTR_TERM, annotation.getTerm());
-
- if (target != null) {
- writer.writeAttribute(Constants.ATTR_TARGET, target);
- }
-
- EdmTypeInfo typeInfo = null;
- if (StringUtils.isNotBlank(annotation.getType())) {
- typeInfo = new EdmTypeInfo.Builder().setTypeExpression(annotation.getType()).build();
- if (!EdmPrimitiveTypeKind.String.getFullQualifiedName().toString().equals(typeInfo.internal())) {
- writer.writeAttribute(Constants.PREFIX_METADATA, namespaceMetadata,
- Constants.ATTR_TYPE, typeInfo.external());
- }
- }
-
- value(writer, annotation.getValueType(), typeInfo == null ? null : typeInfo.getPrimitiveTypeKind(),
- annotation.getValue());
-
- writer.writeEndElement();
- }
-
- private void entity(final XMLStreamWriter writer, final Entity entity)
- throws XMLStreamException, EdmPrimitiveTypeException {
- if (entity.getBaseURI() != null) {
- writer.writeAttribute(XMLConstants.XML_NS_URI, Constants.ATTR_XML_BASE, entity.getBaseURI().toASCIIString());
- }
-
- if (serverMode && StringUtils.isNotBlank(entity.getETag())) {
- writer.writeAttribute(namespaceMetadata, Constants.ATOM_ATTR_ETAG, entity.getETag());
- }
-
- if (entity.getId() != null) {
- writer.writeStartElement(Constants.ATOM_ELEM_ID);
- writer.writeCharacters(entity.getId().toASCIIString());
- writer.writeEndElement();
- }
-
- writer.writeStartElement(Constants.ATOM_ELEM_CATEGORY);
- writer.writeAttribute(Constants.ATOM_ATTR_SCHEME, Constants.NS_SCHEME);
- if (StringUtils.isNotBlank(entity.getType())) {
- writer.writeAttribute(Constants.ATOM_ATTR_TERM,
- new EdmTypeInfo.Builder().setTypeExpression(entity.getType()).build().external());
- }
- writer.writeEndElement();
-
- common(writer, entity);
-
- if (serverMode) {
- if (entity.getEditLink() != null) {
- links(writer, Collections.singletonList(entity.getEditLink()));
- }
-
- if (entity.getSelfLink() != null) {
- links(writer, Collections.singletonList(entity.getSelfLink()));
- }
- }
-
- links(writer, entity.getAssociationLinks());
- links(writer, entity.getNavigationLinks());
- links(writer, entity.getMediaEditLinks());
-
- if (serverMode) {
- for (Operation operation : entity.getOperations()) {
- writer.writeStartElement(namespaceMetadata, Constants.ATOM_ELEM_ACTION);
- writer.writeAttribute(Constants.ATTR_METADATA, operation.getMetadataAnchor());
- writer.writeAttribute(Constants.ATTR_TITLE, operation.getTitle());
- writer.writeAttribute(Constants.ATTR_TARGET, operation.getTarget().toASCIIString());
- writer.writeEndElement();
- }
- }
-
- writer.writeStartElement(Constants.ATOM_ELEM_CONTENT);
- if (entity.isMediaEntity()) {
- if (StringUtils.isNotBlank(entity.getMediaContentType())) {
- writer.writeAttribute(Constants.ATTR_TYPE, entity.getMediaContentType());
- }
- if (entity.getMediaContentSource() != null) {
- writer.writeAttribute(Constants.ATOM_ATTR_SRC, entity.getMediaContentSource().toASCIIString());
- }
- writer.writeEndElement();
-
- writer.writeStartElement(namespaceMetadata, Constants.PROPERTIES);
- properties(writer, entity.getProperties());
- } else {
- writer.writeAttribute(Constants.ATTR_TYPE, ContentType.APPLICATION_XML.toContentTypeString());
- writer.writeStartElement(namespaceMetadata, Constants.PROPERTIES);
- properties(writer, entity.getProperties());
- writer.writeEndElement();
- }
- writer.writeEndElement();
-
- for (Annotation annotation : entity.getAnnotations()) {
- annotation(writer, annotation, null);
- }
- }
-
- private void entityRef(final XMLStreamWriter writer, final Entity entity) throws XMLStreamException {
- writer.writeStartElement(Constants.ATOM_ELEM_ENTRY_REF);
- writer.writeNamespace(StringUtils.EMPTY, namespaceMetadata);
- writer.writeAttribute(Constants.ATOM_ATTR_ID, entity.getId().toASCIIString());
- }
-
- private void entityRef(final XMLStreamWriter writer, final ResWrap<Entity> container) throws XMLStreamException {
- writer.writeStartElement(Constants.ATOM_ELEM_ENTRY_REF);
- writer.writeNamespace(StringUtils.EMPTY, namespaceMetadata);
- addContextInfo(writer, container);
- writer.writeAttribute(Constants.ATOM_ATTR_ID, container.getPayload().getId().toASCIIString());
- }
-
- private void entity(final Writer outWriter, final Entity entity)
- throws XMLStreamException, EdmPrimitiveTypeException {
- final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
-
- if (entity.getType() == null && entity.getProperties().isEmpty()) {
- writer.writeStartDocument();
- writer.setDefaultNamespace(namespaceMetadata);
-
- entityRef(writer, entity);
- } else {
- startDocument(writer, Constants.ATOM_ELEM_ENTRY);
-
- entity(writer, entity);
- }
-
- writer.writeEndElement();
- writer.writeEndDocument();
- writer.flush();
- }
-
- private void entity(final Writer outWriter, final ResWrap<Entity> container)
- throws XMLStreamException, EdmPrimitiveTypeException {
- final Entity entity = container.getPayload();
-
- final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
-
- if (entity.getType() == null && entity.getProperties().isEmpty()) {
- writer.writeStartDocument();
- writer.setDefaultNamespace(namespaceMetadata);
-
- entityRef(writer, container);
- } else {
- startDocument(writer, Constants.ATOM_ELEM_ENTRY);
-
- addContextInfo(writer, container);
-
- entity(writer, entity);
- }
-
- writer.writeEndElement();
- writer.writeEndDocument();
- writer.flush();
- }
-
- private void entitySet(final XMLStreamWriter writer, final EntityCollection entitySet)
- throws XMLStreamException, EdmPrimitiveTypeException {
- if (entitySet.getBaseURI() != null) {
- writer.writeAttribute(XMLConstants.XML_NS_URI, Constants.ATTR_XML_BASE, entitySet.getBaseURI().toASCIIString());
- }
-
- if (entitySet.getCount() != null) {
- writer.writeStartElement(namespaceMetadata, Constants.ATOM_ELEM_COUNT);
- writer.writeCharacters(Integer.toString(entitySet.getCount()));
- writer.writeEndElement();
- }
-
- if (entitySet.getId() != null) {
- writer.writeStartElement(Constants.ATOM_ELEM_ID);
- writer.writeCharacters(entitySet.getId().toASCIIString());
- writer.writeEndElement();
- }
-
- common(writer, entitySet);
-
- for (Entity entity : entitySet.getEntities()) {
- if (entity.getType() == null && entity.getProperties().isEmpty()) {
- entityRef(writer, entity);
- writer.writeEndElement();
- } else {
- writer.writeStartElement(Constants.ATOM_ELEM_ENTRY);
- entity(writer, entity);
- writer.writeEndElement();
- }
- }
-
- if (serverMode) {
- if (entitySet.getNext() != null) {
- final Link next = new Link();
- next.setRel(Constants.NEXT_LINK_REL);
- next.setHref(entitySet.getNext().toASCIIString());
-
- links(writer, Collections.<Link> singletonList(next));
- }
- if (entitySet.getDeltaLink() != null) {
- final Link next = new Link();
- next.setRel(Constants.NS_DELTA_LINK_REL);
- next.setHref(entitySet.getDeltaLink().toASCIIString());
-
- links(writer, Collections.<Link> singletonList(next));
- }
- }
- }
-
- private void entitySet(final Writer outWriter, final EntityCollection entitySet)
- throws XMLStreamException, EdmPrimitiveTypeException {
- final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
-
- startDocument(writer, Constants.ATOM_ELEM_FEED);
-
- entitySet(writer, entitySet);
-
- writer.writeEndElement();
- writer.writeEndDocument();
- writer.flush();
- }
-
- private void entitySet(final Writer outWriter, final ResWrap<EntityCollection> entitySet)
- throws XMLStreamException, EdmPrimitiveTypeException {
- final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
-
- startDocument(writer, Constants.ATOM_ELEM_FEED);
-
- addContextInfo(writer, entitySet);
-
- entitySet(writer, entitySet.getPayload());
-
- writer.writeEndElement();
- writer.writeEndDocument();
- writer.flush();
- }
-
- private void link(final Writer outWriter, final Link link) throws XMLStreamException {
- final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
-
- writer.writeStartDocument();
-
- writer.writeStartElement(Constants.ELEM_LINKS);
- writer.writeDefaultNamespace(namespaceData);
-
- writer.writeStartElement(Constants.ELEM_URI);
- writer.writeCharacters(link.getHref());
- writer.writeEndElement();
-
- writer.writeEndElement();
-
- writer.writeEndDocument();
- writer.flush();
- }
-
- @Override
- public <T> void write(final Writer writer, final T obj) throws ODataSerializerException {
- try {
- if (obj instanceof EntityCollection) {
- entitySet(writer, (EntityCollection) obj);
- } else if (obj instanceof Entity) {
- entity(writer, (Entity) obj);
- } else if (obj instanceof Property) {
- property(writer, (Property) obj);
- } else if (obj instanceof Link) {
- link(writer, (Link) obj);
- }
- } catch (final XMLStreamException e) {
- throw new ODataSerializerException(e);
- } catch (final EdmPrimitiveTypeException e) {
- throw new ODataSerializerException(e);
- }
- }
-
- private void reference(final Writer outWriter, final ResWrap<URI> container) throws XMLStreamException {
- final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
-
- writer.writeStartDocument();
-
- writer.writeStartElement(Constants.ATTR_METADATA, Constants.ATTR_REF);
- writer.writeNamespace(Constants.ATTR_METADATA, Constants.NS_METADATA);
- writer.writeAttribute(Constants.ATTR_METADATA, Constants.CONTEXT, container.getContextURL().toASCIIString());
- writer.writeAttribute(Constants.ATOM_ATTR_ID, container.getPayload().toASCIIString());
- writer.writeEndElement();
-
- writer.writeEndDocument();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T> void write(final Writer writer, final ResWrap<T> container) throws ODataSerializerException {
- final T obj = container == null ? null : container.getPayload();
-
- try {
- if (obj instanceof EntityCollection) {
- this.entitySet(writer, (ResWrap<EntityCollection>) container);
- } else if (obj instanceof Entity) {
- entity(writer, (ResWrap<Entity>) container);
- } else if (obj instanceof Property) {
- property(writer, (Property) obj);
- } else if (obj instanceof Link) {
- link(writer, (Link) obj);
- } else if (obj instanceof URI) {
- reference(writer, (ResWrap<URI>) container);
- }
- } catch (final XMLStreamException e) {
- throw new ODataSerializerException(e);
- } catch (final EdmPrimitiveTypeException e) {
- throw new ODataSerializerException(e);
- }
- }
-
- private <T> void addContextInfo(
- final XMLStreamWriter writer, final ResWrap<T> container) throws XMLStreamException {
-
- if (container.getContextURL() != null) {
- final ContextURL contextURL = ContextURLParser.parse(container.getContextURL());
- final URI base = contextURL.getServiceRoot();
- if (container.getPayload() instanceof EntityCollection) {
- ((EntityCollection) container.getPayload()).setBaseURI(base);
- }
- if (container.getPayload() instanceof Entity) {
- ((Entity) container.getPayload()).setBaseURI(base);
- }
-
- writer.writeAttribute(namespaceMetadata, Constants.CONTEXT,
- container.getContextURL().toASCIIString());
- }
-
- if (StringUtils.isNotBlank(container.getMetadataETag())) {
- writer.writeAttribute(namespaceMetadata, Constants.ATOM_ATTR_METADATAETAG,
- container.getMetadataETag());
- }
- }
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/ContextURLParser.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/ContextURLParser.java
deleted file mode 100644
index 460cd16..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/ContextURLParser.java
+++ /dev/null
@@ -1,118 +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.serialization;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.ContextURL.Suffix;
-
-public class ContextURLParser {
-
- public static ContextURL parse(final URI contextURL) {
- if (contextURL == null) {
- return null;
- }
-
- final ContextURL.Builder contextUrl = ContextURL.with();
-
- String contextURLasString = contextURL.toASCIIString();
-
- boolean isEntity = false;
- if (contextURLasString.endsWith("/$entity") || contextURLasString.endsWith("/@Element")) {
- isEntity = true;
- contextUrl.suffix(Suffix.ENTITY);
- contextURLasString = contextURLasString.replace("/$entity", StringUtils.EMPTY).
- replace("/@Element", StringUtils.EMPTY);
- } else if (contextURLasString.endsWith("/$ref")) {
- contextUrl.suffix(Suffix.REFERENCE);
- contextURLasString = contextURLasString.replace("/$ref", StringUtils.EMPTY);
- } else if (contextURLasString.endsWith("/$delta")) {
- contextUrl.suffix(Suffix.DELTA);
- contextURLasString = contextURLasString.replace("/$delta", StringUtils.EMPTY);
- } else if (contextURLasString.endsWith("/$deletedEntity")) {
- contextUrl.suffix(Suffix.DELTA_DELETED_ENTITY);
- contextURLasString = contextURLasString.replace("/$deletedEntity", StringUtils.EMPTY);
- } else if (contextURLasString.endsWith("/$link")) {
- contextUrl.suffix(Suffix.DELTA_LINK);
- contextURLasString = contextURLasString.replace("/$link", StringUtils.EMPTY);
- } else if (contextURLasString.endsWith("/$deletedLink")) {
- contextUrl.suffix(Suffix.DELTA_DELETED_LINK);
- contextURLasString = contextURLasString.replace("/$deletedLink", StringUtils.EMPTY);
- }
-
- contextUrl.serviceRoot(URI.create(StringUtils.substringBefore(contextURLasString, Constants.METADATA)));
-
- final String rest = StringUtils.substringAfter(contextURLasString, Constants.METADATA + "#");
-
- String firstToken;
- String entitySetOrSingletonOrType;
- if (rest.startsWith("Collection(")) {
- firstToken = rest.substring(0, rest.indexOf(')') + 1);
- entitySetOrSingletonOrType = firstToken;
- } else {
- final int openParIdx = rest.indexOf('(');
- if (openParIdx == -1) {
- firstToken = StringUtils.substringBeforeLast(rest, "/");
-
- entitySetOrSingletonOrType = firstToken;
- } else {
- firstToken = isEntity ? rest : StringUtils.substringBeforeLast(rest, ")") + ")";
-
- final List<String> parts = new ArrayList<String>();
- for (String split : firstToken.split("\\)/")) {
- parts.add(split.replaceAll("\\(.*", ""));
- }
- entitySetOrSingletonOrType = StringUtils.join(parts, '/');
- final int commaIdx = firstToken.indexOf(',');
- if (commaIdx != -1) {
- contextUrl.selectList(firstToken.substring(openParIdx + 1, firstToken.length() - 1));
- }
- }
- }
- contextUrl.entitySetOrSingletonOrType(entitySetOrSingletonOrType);
-
- final int slashIdx = entitySetOrSingletonOrType.lastIndexOf('/');
- if (slashIdx != -1 && entitySetOrSingletonOrType.substring(slashIdx + 1).indexOf('.') != -1) {
- contextUrl.entitySetOrSingletonOrType(entitySetOrSingletonOrType.substring(0, slashIdx));
- contextUrl.derivedEntity(entitySetOrSingletonOrType.substring(slashIdx + 1));
- }
-
- if (!firstToken.equals(rest)) {
- final String[] pathElems = StringUtils.substringAfter(rest, "/").split("/");
- if (pathElems.length > 0 && pathElems[0].length() > 0) {
- if (pathElems[0].indexOf('.') == -1) {
- contextUrl.navOrPropertyPath(pathElems[0]);
- } else {
- contextUrl.derivedEntity(pathElems[0]);
- }
-
- if (pathElems.length > 1) {
- contextUrl.navOrPropertyPath(pathElems[1]);
- }
- }
- }
-
- return contextUrl.build();
- }
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java
deleted file mode 100644
index 89f327f..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeltaDeserializer.java
+++ /dev/null
@@ -1,100 +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.serialization;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.DeletedEntity;
-import org.apache.olingo.commons.api.data.Delta;
-import org.apache.olingo.commons.api.data.DeltaLink;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class JsonDeltaDeserializer extends JsonDeserializer {
-
- public JsonDeltaDeserializer(final boolean serverMode) {
- super(serverMode);
- }
-
- protected ResWrap<Delta> doDeserialize(final JsonParser parser) throws IOException {
-
- final ObjectNode tree = parser.getCodec().readTree(parser);
-
- final Delta delta = new Delta();
-
- final URI contextURL = tree.hasNonNull(Constants.JSON_CONTEXT) ?
- URI.create(tree.get(Constants.JSON_CONTEXT).textValue()) : null;
- if (contextURL != null) {
- delta.setBaseURI(URI.create(StringUtils.substringBefore(contextURL.toASCIIString(), Constants.METADATA)));
- }
-
- if (tree.hasNonNull(Constants.JSON_COUNT)) {
- delta.setCount(tree.get(Constants.JSON_COUNT).asInt());
- }
- if (tree.hasNonNull(Constants.JSON_NEXT_LINK)) {
- delta.setNext(URI.create(tree.get(Constants.JSON_NEXT_LINK).textValue()));
- }
- if (tree.hasNonNull(Constants.JSON_DELTA_LINK)) {
- delta.setDeltaLink(URI.create(tree.get(Constants.JSON_DELTA_LINK).textValue()));
- }
-
- if (tree.hasNonNull(Constants.VALUE)) {
- JsonEntityDeserializer entityDeserializer = new JsonEntityDeserializer(serverMode);
- for (JsonNode jsonNode : tree.get(Constants.VALUE)) {
- final ObjectNode item = (ObjectNode) jsonNode;
- final ContextURL itemContextURL = item.hasNonNull(Constants.JSON_CONTEXT) ?
- ContextURLParser.parse(URI.create(item.get(Constants.JSON_CONTEXT).textValue())) : null;
- item.remove(Constants.JSON_CONTEXT);
-
- if (itemContextURL == null || itemContextURL.isEntity()) {
- delta.getEntities().add(
- entityDeserializer.doDeserialize(item.traverse(parser.getCodec())).getPayload());
- } else if (itemContextURL.isDeltaDeletedEntity()) {
- delta.getDeletedEntities().add(parser.getCodec().treeToValue(item, DeletedEntity.class));
- } else if (itemContextURL.isDeltaLink()) {
- delta.getAddedLinks().add(parser.getCodec().treeToValue(item, DeltaLink.class));
- } else if (itemContextURL.isDeltaDeletedLink()) {
- delta.getDeletedLinks().add(parser.getCodec().treeToValue(item, DeltaLink.class));
- }
- }
- }
-
- return new ResWrap<Delta>(contextURL, null, delta);
- }
-
- public ResWrap<Delta> toDelta(final InputStream input) throws ODataDeserializerException {
- try {
- JsonParser parser = new JsonFactory(new ObjectMapper()).createParser(input);
- return doDeserialize(parser);
- } catch (final IOException e) {
- throw new ODataDeserializerException(e);
- }
- }
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java
deleted file mode 100755
index 5163412..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java
+++ /dev/null
@@ -1,421 +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.serialization;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.AbstractMap.SimpleEntry;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.ODataError;
-import org.apache.olingo.commons.api.ODataPropertyType;
-import org.apache.olingo.commons.api.data.Annotatable;
-import org.apache.olingo.commons.api.data.Annotation;
-import org.apache.olingo.commons.api.data.ComplexValue;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Linked;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.data.Valuable;
-import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.serialization.ODataDeserializer;
-import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.ObjectCodec;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class JsonDeserializer implements ODataDeserializer {
-
- protected final Pattern CUSTOM_ANNOTATION = Pattern.compile("(.+)@(.+)\\.(.+)");
-
- protected final boolean serverMode;
-
- private JsonGeoValueDeserializer geoDeserializer;
-
- private JsonParser parser;
-
- public JsonDeserializer(final boolean serverMode) {
- this.serverMode = serverMode;
- }
-
- private JsonGeoValueDeserializer getGeoDeserializer() {
- if (geoDeserializer == null) {
- geoDeserializer = new JsonGeoValueDeserializer();
- }
- return geoDeserializer;
- }
-
- protected String getJSONAnnotation(final String string) {
- return StringUtils.prependIfMissing(string, "@");
- }
-
- protected String getTitle(final Map.Entry<String, JsonNode> entry) {
- return entry.getKey().substring(0, entry.getKey().indexOf('@'));
- }
-
- protected String setInline(final String name, final String suffix, final JsonNode tree,
- final ObjectCodec codec, final Link link) throws IOException {
-
- final String entityNamePrefix = name.substring(0, name.indexOf(suffix));
- if (tree.has(entityNamePrefix)) {
- final JsonNode inline = tree.path(entityNamePrefix);
- JsonEntityDeserializer entityDeserializer = new JsonEntityDeserializer(serverMode);
-
- if (inline instanceof ObjectNode) {
- link.setType(Constants.ENTITY_NAVIGATION_LINK_TYPE);
- link.setInlineEntity(entityDeserializer.doDeserialize(inline.traverse(codec)).getPayload());
-
- } else if (inline instanceof ArrayNode) {
- link.setType(Constants.ENTITY_SET_NAVIGATION_LINK_TYPE);
-
- final EntityCollection entitySet = new EntityCollection();
- for (final Iterator<JsonNode> entries = inline.elements(); entries.hasNext();) {
- entitySet.getEntities().add(entityDeserializer.doDeserialize(entries.next().traverse(codec)).getPayload());
- }
-
- link.setInlineEntitySet(entitySet);
- }
- }
- return entityNamePrefix;
- }
-
- protected void links(final Map.Entry<String, JsonNode> field, final Linked linked, final Set<String> toRemove,
- final JsonNode tree, final ObjectCodec codec) throws IOException {
- if (serverMode) {
- serverLinks(field, linked, toRemove, tree, codec);
- } else {
- clientLinks(field, linked, toRemove, tree, codec);
- }
- }
-
- private void clientLinks(final Map.Entry<String, JsonNode> field, final Linked linked, final Set<String> toRemove,
- final JsonNode tree, final ObjectCodec codec) throws IOException {
-
- if (field.getKey().endsWith(Constants.JSON_NAVIGATION_LINK)) {
- final Link link = new Link();
- link.setTitle(getTitle(field));
- link.setRel(Constants.NS_NAVIGATION_LINK_REL + getTitle(field));
-
- if (field.getValue().isValueNode()) {
- link.setHref(field.getValue().textValue());
- link.setType(Constants.ENTITY_NAVIGATION_LINK_TYPE);
- }
-
- linked.getNavigationLinks().add(link);
-
- toRemove.add(field.getKey());
- toRemove.add(setInline(field.getKey(), Constants.JSON_NAVIGATION_LINK, tree, codec, link));
- } else if (field.getKey().endsWith(Constants.JSON_ASSOCIATION_LINK)) {
- final Link link = new Link();
- link.setTitle(getTitle(field));
- link.setRel(Constants.NS_ASSOCIATION_LINK_REL + getTitle(field));
- link.setHref(field.getValue().textValue());
- link.setType(Constants.ASSOCIATION_LINK_TYPE);
- linked.getAssociationLinks().add(link);
-
- toRemove.add(field.getKey());
- }
- }
-
- private void serverLinks(final Map.Entry<String, JsonNode> field, final Linked linked, final Set<String> toRemove,
- final JsonNode tree, final ObjectCodec codec) throws IOException {
-
- if (field.getKey().endsWith(Constants.JSON_BIND_LINK_SUFFIX)
- || field.getKey().endsWith(Constants.JSON_NAVIGATION_LINK)) {
-
- if (field.getValue().isValueNode()) {
- final String suffix = field.getKey().replaceAll("^.*@", "@");
-
- final Link link = new Link();
- link.setTitle(getTitle(field));
- link.setRel(Constants.NS_NAVIGATION_LINK_REL + getTitle(field));
- link.setHref(field.getValue().textValue());
- link.setType(Constants.ENTITY_NAVIGATION_LINK_TYPE);
- linked.getNavigationLinks().add(link);
-
- toRemove.add(setInline(field.getKey(), suffix, tree, codec, link));
- } else if (field.getValue().isArray()) {
- for (final Iterator<JsonNode> itor = field.getValue().elements(); itor.hasNext();) {
- final JsonNode node = itor.next();
-
- final Link link = new Link();
- link.setTitle(getTitle(field));
- link.setRel(Constants.NS_NAVIGATION_LINK_REL + getTitle(field));
- link.setHref(node.asText());
- link.setType(Constants.ENTITY_SET_NAVIGATION_LINK_TYPE);
- linked.getNavigationLinks().add(link);
- toRemove.add(setInline(field.getKey(), Constants.JSON_BIND_LINK_SUFFIX, tree, codec, link));
- }
- }
- toRemove.add(field.getKey());
- }
- }
-
- private Map.Entry<ODataPropertyType, EdmTypeInfo> guessPropertyType(final JsonNode node) {
- ODataPropertyType type;
- String typeExpression = null;
-
- if (node.isValueNode() || node.isNull()) {
- type = ODataPropertyType.PRIMITIVE;
- typeExpression = guessPrimitiveTypeKind(node).getFullQualifiedName().toString();
- } else if (node.isArray()) {
- type = ODataPropertyType.COLLECTION;
- if (node.has(0) && node.get(0).isValueNode()) {
- typeExpression = "Collection(" + guessPrimitiveTypeKind(node.get(0)) + ')';
- }
- } else if (node.isObject()) {
- if (node.has(Constants.ATTR_TYPE)) {
- type = ODataPropertyType.PRIMITIVE;
- typeExpression = "Edm.Geography" + node.get(Constants.ATTR_TYPE).asText();
- } else {
- type = ODataPropertyType.COMPLEX;
- }
- } else {
- type = ODataPropertyType.EMPTY;
- }
-
- final EdmTypeInfo typeInfo = typeExpression == null ? null :
- new EdmTypeInfo.Builder().setTypeExpression(typeExpression).build();
- return new SimpleEntry<ODataPropertyType, EdmTypeInfo>(type, typeInfo);
- }
-
- private EdmPrimitiveTypeKind guessPrimitiveTypeKind(final JsonNode node) {
- return node.isShort() ? EdmPrimitiveTypeKind.Int16 :
- node.isInt() ? EdmPrimitiveTypeKind.Int32 :
- node.isLong() ? EdmPrimitiveTypeKind.Int64 :
- node.isBoolean() ? EdmPrimitiveTypeKind.Boolean :
- node.isFloat() ? EdmPrimitiveTypeKind.Single :
- node.isDouble() ? EdmPrimitiveTypeKind.Double :
- node.isBigDecimal() ? EdmPrimitiveTypeKind.Decimal :
- EdmPrimitiveTypeKind.String;
- }
-
- protected void populate(final Annotatable annotatable, final List<Property> properties,
- final ObjectNode tree, final ObjectCodec codec)
- throws IOException, EdmPrimitiveTypeException {
-
- String type = null;
- Annotation annotation = null;
- for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
- final Map.Entry<String, JsonNode> field = itor.next();
- final Matcher customAnnotation = CUSTOM_ANNOTATION.matcher(field.getKey());
-
- if (field.getKey().charAt(0) == '@') {
- final Annotation entityAnnot = new Annotation();
- entityAnnot.setTerm(field.getKey().substring(1));
-
- value(entityAnnot, field.getValue(), codec);
- if (annotatable != null) {
- annotatable.getAnnotations().add(entityAnnot);
- }
- } else if (type == null && field.getKey().endsWith(getJSONAnnotation(Constants.JSON_TYPE))) {
- type = field.getValue().asText();
- } else if (annotation == null && customAnnotation.matches() && !"odata".equals(customAnnotation.group(2))) {
- annotation = new Annotation();
- annotation.setTerm(customAnnotation.group(2) + "." + customAnnotation.group(3));
- value(annotation, field.getValue(), codec);
- } else {
- final Property property = new Property();
- property.setName(field.getKey());
- property.setType(type == null
- ? null
- : new EdmTypeInfo.Builder().setTypeExpression(type).build().internal());
- type = null;
-
- value(property, field.getValue(), codec);
- properties.add(property);
-
- if (annotation != null) {
- property.getAnnotations().add(annotation);
- annotation = null;
- }
- }
- }
- }
-
- private Object fromPrimitive(final JsonNode node, final EdmTypeInfo typeInfo) throws EdmPrimitiveTypeException {
- return node.isNull() ? null
- : typeInfo == null ? node.asText()
- : typeInfo.getPrimitiveTypeKind().isGeospatial()
- ? getGeoDeserializer().deserialize(node, typeInfo)
- : ((EdmPrimitiveType) typeInfo.getType())
- .valueOfString(node.asText(), true, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, true,
- ((EdmPrimitiveType) typeInfo.getType()).getDefaultType());
- }
-
- private Object fromComplex(final ObjectNode node, final ObjectCodec codec)
- throws IOException, EdmPrimitiveTypeException {
-
- final ComplexValue complexValue = new ComplexValue();
- final Set<String> toRemove = new HashSet<String>();
- for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
- final Map.Entry<String, JsonNode> field = itor.next();
-
- links(field, complexValue, toRemove, node, codec);
- }
- node.remove(toRemove);
-
- populate(complexValue, complexValue.getValue(), node, codec);
- return complexValue;
- }
-
- private void fromCollection(final Valuable valuable, final Iterator<JsonNode> nodeItor, final EdmTypeInfo typeInfo,
- final ObjectCodec codec) throws IOException, EdmPrimitiveTypeException {
-
- final List<Object> values = new ArrayList<Object>();
- ValueType valueType = ValueType.COLLECTION_PRIMITIVE;
-
- final EdmTypeInfo type = typeInfo == null ? null
- : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
-
- while (nodeItor.hasNext()) {
- final JsonNode child = nodeItor.next();
-
- if (child.isValueNode()) {
- if (typeInfo == null || typeInfo.isPrimitiveType()) {
- final Object value = fromPrimitive(child, type);
- valueType = value instanceof Geospatial ? ValueType.COLLECTION_GEOSPATIAL : ValueType.COLLECTION_PRIMITIVE;
- values.add(value);
- } else {
- valueType = ValueType.COLLECTION_ENUM;
- values.add(child.asText());
- }
- } else if (child.isContainerNode()) {
- if (child.has(Constants.JSON_TYPE)) {
- ((ObjectNode) child).remove(Constants.JSON_TYPE);
- }
- final Object value = fromComplex((ObjectNode) child, codec);
- valueType = ValueType.COLLECTION_COMPLEX;
- values.add(value);
- }
- }
- valuable.setValue(valueType, values);
- }
-
- protected void value(final Valuable valuable, final JsonNode node, final ObjectCodec codec)
- throws IOException, EdmPrimitiveTypeException {
-
- EdmTypeInfo typeInfo = StringUtils.isBlank(valuable.getType()) ? null
- : new EdmTypeInfo.Builder().setTypeExpression(valuable.getType()).build();
-
- final Map.Entry<ODataPropertyType, EdmTypeInfo> guessed = guessPropertyType(node);
- if (typeInfo == null) {
- typeInfo = guessed.getValue();
- }
-
- final ODataPropertyType propType = typeInfo == null ? guessed.getKey()
- : typeInfo.isCollection() ? ODataPropertyType.COLLECTION
- : typeInfo.isPrimitiveType() ? ODataPropertyType.PRIMITIVE
- : node.isValueNode() ? ODataPropertyType.ENUM : ODataPropertyType.COMPLEX;
-
- switch (propType) {
- case COLLECTION:
- fromCollection(valuable, node.elements(), typeInfo, codec);
- break;
-
- case COMPLEX:
- if (node.has(Constants.JSON_TYPE)) {
- valuable.setType(node.get(Constants.JSON_TYPE).asText());
- ((ObjectNode) node).remove(Constants.JSON_TYPE);
- }
- final Object value = fromComplex((ObjectNode) node, codec);
- valuable.setValue(ValueType.COMPLEX, value);
- break;
-
- case ENUM:
- valuable.setValue(ValueType.ENUM, node.asText());
- break;
-
- case PRIMITIVE:
- if (valuable.getType() == null && typeInfo != null) {
- valuable.setType(typeInfo.getFullQualifiedName().toString());
- }
- final Object primitiveValue = fromPrimitive(node, typeInfo);
- valuable.setValue(primitiveValue instanceof Geospatial ? ValueType.GEOSPATIAL : ValueType.PRIMITIVE,
- primitiveValue);
- break;
-
- case EMPTY:
- default:
- valuable.setValue(ValueType.PRIMITIVE, StringUtils.EMPTY);
- }
- }
-
- @Override
- public ResWrap<EntityCollection> toEntitySet(final InputStream input) throws ODataDeserializerException {
- try {
- parser = new JsonFactory(new ObjectMapper()).createParser(input);
- return new JsonEntitySetDeserializer(serverMode).doDeserialize(parser);
- } catch (final IOException e) {
- throw new ODataDeserializerException(e);
- }
- }
-
- @Override
- public ResWrap<Entity> toEntity(final InputStream input) throws ODataDeserializerException {
- try {
- parser = new JsonFactory(new ObjectMapper()).createParser(input);
- return new JsonEntityDeserializer(serverMode).doDeserialize(parser);
- } catch (final IOException e) {
- throw new ODataDeserializerException(e);
- }
- }
-
- @Override
- public ResWrap<Property> toProperty(final InputStream input) throws ODataDeserializerException {
- try {
- parser = new JsonFactory(new ObjectMapper()).createParser(input);
- return new JsonPropertyDeserializer(serverMode).doDeserialize(parser);
- } catch (final IOException e) {
- throw new ODataDeserializerException(e);
- }
- }
-
- @Override
- public ODataError toError(final InputStream input) throws ODataDeserializerException {
- try {
- parser = new JsonFactory(new ObjectMapper()).createParser(input);
- return new JsonODataErrorDeserializer(serverMode).doDeserialize(parser);
- } catch (final IOException e) {
- throw new ODataDeserializerException(e);
- }
- }
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java
deleted file mode 100644
index 10cc3bb..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java
+++ /dev/null
@@ -1,229 +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.serialization;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Annotation;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Operation;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Reads JSON string into an entity.
- * <br/>
- * If metadata information is available, the corresponding entity fields and content will be populated.
- */
-public class JsonEntityDeserializer extends JsonDeserializer {
-
- public JsonEntityDeserializer(final boolean serverMode) {
- super(serverMode);
- }
-
- protected ResWrap<Entity> doDeserialize(final JsonParser parser) throws IOException {
-
- final ObjectNode tree = parser.getCodec().readTree(parser);
-
- if (tree.has(Constants.VALUE) && tree.get(Constants.VALUE).isArray()) {
- throw new JsonParseException("Expected OData Entity, found EntitySet", parser.getCurrentLocation());
- }
-
- final Entity entity = new Entity();
-
- final URI contextURL;
- 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 (contextURL != null) {
- entity.setBaseURI(URI.create(StringUtils.substringBefore(contextURL.toASCIIString(), Constants.METADATA)));
- }
-
- final String metadataETag;
- 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_ETAG)) {
- entity.setETag(tree.get(Constants.JSON_ETAG).textValue());
- tree.remove(Constants.JSON_ETAG);
- }
-
- if (tree.hasNonNull(Constants.JSON_TYPE)) {
- entity.setType(new EdmTypeInfo.Builder().setTypeExpression(tree.get(Constants.JSON_TYPE).textValue()).build()
- .internal());
- tree.remove(Constants.JSON_TYPE);
- }
-
- if (tree.hasNonNull(Constants.JSON_ID)) {
- entity.setId(URI.create(tree.get(Constants.JSON_ID).textValue()));
- tree.remove(Constants.JSON_ID);
- }
-
- if (tree.hasNonNull(Constants.JSON_READ_LINK)) {
- final Link link = new Link();
- link.setRel(Constants.SELF_LINK_REL);
- link.setHref(tree.get(Constants.JSON_READ_LINK).textValue());
- entity.setSelfLink(link);
-
- tree.remove(Constants.JSON_READ_LINK);
- }
-
- if (tree.hasNonNull(Constants.JSON_EDIT_LINK)) {
- final Link link = new Link();
- if (serverMode) {
- link.setRel(Constants.EDIT_LINK_REL);
- }
- link.setHref(tree.get(Constants.JSON_EDIT_LINK).textValue());
- entity.setEditLink(link);
-
- tree.remove(Constants.JSON_EDIT_LINK);
- }
-
- if (tree.hasNonNull(Constants.JSON_MEDIA_READ_LINK)) {
- entity.setMediaContentSource(URI.create(tree.get(Constants.JSON_MEDIA_READ_LINK).textValue()));
- tree.remove(Constants.JSON_MEDIA_READ_LINK);
- }
- if (tree.hasNonNull(Constants.JSON_MEDIA_EDIT_LINK)) {
- entity.setMediaContentSource(URI.create(tree.get(Constants.JSON_MEDIA_EDIT_LINK).textValue()));
- tree.remove(Constants.JSON_MEDIA_EDIT_LINK);
- }
- if (tree.hasNonNull(Constants.JSON_MEDIA_CONTENT_TYPE)) {
- entity.setMediaContentType(tree.get(Constants.JSON_MEDIA_CONTENT_TYPE).textValue());
- tree.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
- }
- if (tree.hasNonNull(Constants.JSON_MEDIA_ETAG)) {
- entity.setMediaETag(tree.get(Constants.JSON_MEDIA_ETAG).textValue());
- tree.remove(Constants.JSON_MEDIA_ETAG);
- }
-
- final Set<String> toRemove = new HashSet<String>();
-
- final Map<String, List<Annotation>> annotations = new HashMap<String, List<Annotation>>();
- for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
- final Map.Entry<String, JsonNode> field = itor.next();
- final Matcher customAnnotation = CUSTOM_ANNOTATION.matcher(field.getKey());
-
- links(field, entity, toRemove, tree, parser.getCodec());
- if (field.getKey().endsWith(getJSONAnnotation(Constants.JSON_MEDIA_EDIT_LINK))) {
- final Link link = new Link();
- link.setTitle(getTitle(field));
- link.setRel(Constants.NS_MEDIA_EDIT_LINK_REL + getTitle(field));
- link.setHref(field.getValue().textValue());
- link.setType(Constants.MEDIA_EDIT_LINK_TYPE);
- entity.getMediaEditLinks().add(link);
-
- if (tree.has(link.getTitle() + getJSONAnnotation(Constants.JSON_MEDIA_ETAG))) {
- link.setMediaETag(tree.get(link.getTitle() + getJSONAnnotation(Constants.JSON_MEDIA_ETAG)).asText());
- toRemove.add(link.getTitle() + getJSONAnnotation(Constants.JSON_MEDIA_ETAG));
- }
-
- toRemove.add(field.getKey());
- toRemove.add(setInline(field.getKey(), getJSONAnnotation(Constants.JSON_MEDIA_EDIT_LINK), tree, parser
- .getCodec(), link));
- } else if (field.getKey().endsWith(getJSONAnnotation(Constants.JSON_MEDIA_CONTENT_TYPE))) {
- final String linkTitle = getTitle(field);
- for (Link link : entity.getMediaEditLinks()) {
- if (linkTitle.equals(link.getTitle())) {
- link.setType(field.getValue().asText());
- }
- }
- toRemove.add(field.getKey());
- } else if (field.getKey().charAt(0) == '#') {
- final Operation operation = new Operation();
- operation.setMetadataAnchor(field.getKey());
-
- final ObjectNode opNode = (ObjectNode) tree.get(field.getKey());
- operation.setTitle(opNode.get(Constants.ATTR_TITLE).asText());
- operation.setTarget(URI.create(opNode.get(Constants.ATTR_TARGET).asText()));
-
- entity.getOperations().add(operation);
-
- toRemove.add(field.getKey());
- } else if (customAnnotation.matches() && !"odata".equals(customAnnotation.group(2))) {
- final Annotation annotation = new Annotation();
- annotation.setTerm(customAnnotation.group(2) + "." + customAnnotation.group(3));
- try {
- value(annotation, field.getValue(), parser.getCodec());
- } catch (final EdmPrimitiveTypeException e) {
- throw new IOException(e);
- }
-
- if (!annotations.containsKey(customAnnotation.group(1))) {
- annotations.put(customAnnotation.group(1), new ArrayList<Annotation>());
- }
- annotations.get(customAnnotation.group(1)).add(annotation);
- }
- }
-
- for (Link link : entity.getNavigationLinks()) {
- if (annotations.containsKey(link.getTitle())) {
- link.getAnnotations().addAll(annotations.get(link.getTitle()));
- for (Annotation annotation : annotations.get(link.getTitle())) {
- toRemove.add(link.getTitle() + "@" + annotation.getTerm());
- }
- }
- }
- for (Link link : entity.getMediaEditLinks()) {
- if (annotations.containsKey(link.getTitle())) {
- link.getAnnotations().addAll(annotations.get(link.getTitle()));
- for (Annotation annotation : annotations.get(link.getTitle())) {
- toRemove.add(link.getTitle() + "@" + annotation.getTerm());
- }
- }
- }
-
- tree.remove(toRemove);
-
- try {
- populate(entity, entity.getProperties(), tree, parser.getCodec());
- } catch (final EdmPrimitiveTypeException e) {
- throw new IOException(e);
- }
-
- return new ResWrap<Entity>(contextURL, metadataETag, entity);
- }
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java
deleted file mode 100644
index ddb789d..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java
+++ /dev/null
@@ -1,135 +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.serialization;
-
-import java.io.IOException;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Annotation;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Operation;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-
-/**
- * Writes out JSON string from an entity.
- */
-public class JsonEntitySerializer extends JsonSerializer {
-
- public JsonEntitySerializer(final boolean serverMode) {
- super(serverMode);
- }
-
- public JsonEntitySerializer(final boolean serverMode, final ODataFormat format) {
- super(serverMode, format);
- }
-
- protected void doSerialize(final Entity entity, final JsonGenerator jgen)
- throws IOException, EdmPrimitiveTypeException {
-
- doContainerSerialize(new ResWrap<Entity>(null, null, entity), jgen);
- }
-
- protected void doContainerSerialize(final ResWrap<Entity> container, final JsonGenerator jgen)
- throws IOException, EdmPrimitiveTypeException {
-
- final Entity entity = container.getPayload();
-
- jgen.writeStartObject();
-
- if (serverMode) {
- if (container.getContextURL() != null) {
- jgen.writeStringField(Constants.JSON_CONTEXT, container.getContextURL().toASCIIString());
- }
- if (StringUtils.isNotBlank(container.getMetadataETag())) {
- jgen.writeStringField(Constants.JSON_METADATA_ETAG, container.getMetadataETag());
- }
-
- if (StringUtils.isNotBlank(entity.getETag())) {
- jgen.writeStringField(Constants.JSON_ETAG, entity.getETag());
- }
- }
-
- if (StringUtils.isNotBlank(entity.getType()) && format != ODataFormat.JSON_NO_METADATA) {
- jgen.writeStringField(Constants.JSON_TYPE,
- new EdmTypeInfo.Builder().setTypeExpression(entity.getType()).build().external());
- }
-
- if (entity.getId() != null && format != ODataFormat.JSON_NO_METADATA) {
- jgen.writeStringField(Constants.JSON_ID, entity.getId().toASCIIString());
- }
-
- for (Annotation annotation : entity.getAnnotations()) {
- valuable(jgen, annotation, "@" + annotation.getTerm());
- }
-
- for (Property property : entity.getProperties()) {
- valuable(jgen, property, property.getName());
- }
-
- if (serverMode && entity.getEditLink() != null && StringUtils.isNotBlank(entity.getEditLink().getHref())) {
- jgen.writeStringField(Constants.JSON_EDIT_LINK,
- entity.getEditLink().getHref());
-
- if (entity.isMediaEntity()) {
- jgen.writeStringField(Constants.JSON_MEDIA_READ_LINK,
- entity.getEditLink().getHref() + "/$value");
- }
- }
-
- if (format != ODataFormat.JSON_NO_METADATA) {
- links(entity, jgen);
- }
-
- for (Link link : entity.getMediaEditLinks()) {
- if (link.getTitle() == null) {
- jgen.writeStringField(Constants.JSON_MEDIA_EDIT_LINK, link.getHref());
- }
-
- if (link.getInlineEntity() != null) {
- jgen.writeObjectField(link.getTitle(), link.getInlineEntity());
- }
- if (link.getInlineEntitySet() != null) {
- jgen.writeArrayFieldStart(link.getTitle());
- for (Entity subEntry : link.getInlineEntitySet().getEntities()) {
- jgen.writeObject(subEntry);
- }
- jgen.writeEndArray();
- }
- }
-
- if (serverMode) {
- for (Operation operation : entity.getOperations()) {
- jgen.writeObjectFieldStart("#" + StringUtils.substringAfterLast(operation.getMetadataAnchor(), "#"));
- jgen.writeStringField(Constants.ATTR_TITLE, operation.getTitle());
- jgen.writeStringField(Constants.ATTR_TARGET, operation.getTarget().toASCIIString());
- jgen.writeEndObject();
- }
- }
-
- jgen.writeEndObject();
- }
-}
\ No newline at end of file
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.java
deleted file mode 100644
index 354d4dd..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.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.core.serialization;
-
-import java.io.IOException;
-import java.net.URI;
-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.Annotation;
-import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Reads JSON string into an entity set.
- * <br/>
- * If metadata information is available, the corresponding entity fields and content will be populated.
- */
-public class JsonEntitySetDeserializer extends JsonDeserializer {
-
- public JsonEntitySetDeserializer(final boolean serverMode) {
- super(serverMode);
- }
-
- protected ResWrap<EntityCollection> doDeserialize(final JsonParser parser) throws IOException {
-
- final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
-
- if (!tree.has(Constants.VALUE)) {
- return null;
- }
-
- final EntityCollection entitySet = new EntityCollection();
-
- URI contextURL;
- 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 (contextURL != null) {
- entitySet.setBaseURI(URI.create(StringUtils.substringBefore(contextURL.toASCIIString(), Constants.METADATA)));
- }
-
- final String metadataETag;
- 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_COUNT)) {
- entitySet.setCount(tree.get(Constants.JSON_COUNT).asInt());
- tree.remove(Constants.JSON_COUNT);
- }
- if (tree.hasNonNull(Constants.JSON_NEXT_LINK)) {
- entitySet.setNext(URI.create(tree.get(Constants.JSON_NEXT_LINK).textValue()));
- tree.remove(Constants.JSON_NEXT_LINK);
- }
- if (tree.hasNonNull(Constants.JSON_DELTA_LINK)) {
- entitySet.setDeltaLink(URI.create(tree.get(Constants.JSON_DELTA_LINK).textValue()));
- tree.remove(Constants.JSON_DELTA_LINK);
- }
-
- if (tree.hasNonNull(Constants.VALUE)) {
- final JsonEntityDeserializer entityDeserializer = new JsonEntityDeserializer(serverMode);
- for (JsonNode jsonNode : tree.get(Constants.VALUE)) {
- entitySet.getEntities().add(
- entityDeserializer.doDeserialize(jsonNode.traverse(parser.getCodec())).getPayload());
- }
- tree.remove(Constants.VALUE);
- }
-
- // any remaining entry is supposed to be an annotation or is ignored
- for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
- final Map.Entry<String, JsonNode> field = itor.next();
- if (field.getKey().charAt(0) == '@') {
- final Annotation annotation = new Annotation();
- annotation.setTerm(field.getKey().substring(1));
-
- try {
- value(annotation, field.getValue(), parser.getCodec());
- } catch (final EdmPrimitiveTypeException e) {
- throw new IOException(e);
- }
- entitySet.getAnnotations().add(annotation);
- }
- }
-
- return new ResWrap<EntityCollection>(contextURL, metadataETag, entitySet);
- }
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetSerializer.java
deleted file mode 100644
index b7a21da..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetSerializer.java
+++ /dev/null
@@ -1,92 +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.serialization;
-
-import java.io.IOException;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Annotation;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-
-public class JsonEntitySetSerializer extends JsonSerializer {
-
- public JsonEntitySetSerializer(final boolean serverMode) {
- super(serverMode);
- }
-
- protected void doSerialize(final EntityCollection entitySet, final JsonGenerator jgen)
- throws IOException, EdmPrimitiveTypeException {
- doContainerSerialize(new ResWrap<EntityCollection>(null, null, entitySet), jgen);
- }
-
- protected void doContainerSerialize(final ResWrap<EntityCollection> container, final JsonGenerator jgen)
- throws IOException, EdmPrimitiveTypeException {
-
- final EntityCollection entitySet = container.getPayload();
-
- jgen.writeStartObject();
-
- if (serverMode) {
- if (container.getContextURL() != null) {
- jgen.writeStringField(Constants.JSON_CONTEXT, container.getContextURL().toASCIIString());
- }
-
- if (StringUtils.isNotBlank(container.getMetadataETag())) {
- jgen.writeStringField(
- Constants.JSON_METADATA_ETAG,
- container.getMetadataETag());
- }
- }
-
- if (entitySet.getId() != null) {
- jgen.writeStringField(Constants.JSON_ID, entitySet.getId().toASCIIString());
- }
- jgen.writeNumberField(Constants.JSON_COUNT,
- entitySet.getCount() == null ? entitySet.getEntities().size() : entitySet.getCount());
- if (serverMode) {
- if (entitySet.getNext() != null) {
- jgen.writeStringField(Constants.JSON_NEXT_LINK,
- entitySet.getNext().toASCIIString());
- }
- if (entitySet.getDeltaLink() != null) {
- jgen.writeStringField(Constants.JSON_DELTA_LINK,
- entitySet.getDeltaLink().toASCIIString());
- }
- }
-
- for (Annotation annotation : entitySet.getAnnotations()) {
- valuable(jgen, annotation, "@" + annotation.getTerm());
- }
-
- jgen.writeArrayFieldStart(Constants.VALUE);
- final JsonEntitySerializer entitySerializer = new JsonEntitySerializer(serverMode);
- for (Entity entity : entitySet.getEntities()) {
- entitySerializer.doSerialize(entity, jgen);
- }
- jgen.writeEndArray();
-
- jgen.writeEndObject();
- }
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonGeoValueDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonGeoValueDeserializer.java
deleted file mode 100644
index 6bd3d7e..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonGeoValueDeserializer.java
+++ /dev/null
@@ -1,262 +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.serialization;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.GeoUtils;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-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.geo.SRID;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-class JsonGeoValueDeserializer {
-
- private Point point(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final SRID srid) {
- Point point = null;
-
- if (itor.hasNext()) {
- 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));
- point.setY(EdmDouble.getInstance().valueOfString(itor.next().asText(), null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
- } catch (EdmPrimitiveTypeException e) {
- throw new IllegalArgumentException("While deserializing point coordinates as double", e);
- }
- }
-
- return point;
- }
-
- private MultiPoint multipoint(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final SRID srid) {
- final MultiPoint multiPoint;
-
- if (itor.hasNext()) {
- final List<Point> points = new ArrayList<Point>();
- while (itor.hasNext()) {
- final Iterator<JsonNode> mpItor = itor.next().elements();
- points.add(point(mpItor, type, srid));
- }
- multiPoint = new MultiPoint(GeoUtils.getDimension(type), srid, points);
- } else {
- multiPoint = new MultiPoint(GeoUtils.getDimension(type), srid, Collections.<Point> emptyList());
- }
-
- return multiPoint;
- }
-
- private LineString lineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final SRID srid) {
- final LineString lineString;
-
- if (itor.hasNext()) {
- final List<Point> points = new ArrayList<Point>();
- while (itor.hasNext()) {
- final Iterator<JsonNode> mpItor = itor.next().elements();
- points.add(point(mpItor, type, srid));
- }
- lineString = new LineString(GeoUtils.getDimension(type), srid, points);
- } else {
- lineString = new LineString(GeoUtils.getDimension(type), srid, Collections.<Point> emptyList());
- }
-
- return lineString;
- }
-
- private MultiLineString multiLineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final SRID srid) {
-
- final MultiLineString multiLineString;
-
- if (itor.hasNext()) {
- final List<LineString> lineStrings = new ArrayList<LineString>();
- while (itor.hasNext()) {
- final Iterator<JsonNode> mlsItor = itor.next().elements();
- lineStrings.add(lineString(mlsItor, type, srid));
- }
- multiLineString = new MultiLineString(GeoUtils.getDimension(type), srid, lineStrings);
- } else {
- multiLineString = new MultiLineString(GeoUtils.getDimension(type), srid, Collections.<LineString> emptyList());
- }
-
- return multiLineString;
- }
-
- private Polygon polygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final SRID srid) {
- List<Point> extPoints = null;
- if (itor.hasNext()) {
- final Iterator<JsonNode> extItor = itor.next().elements();
- if (extItor.hasNext()) {
- extPoints = new ArrayList<Point>();
- while (extItor.hasNext()) {
- final Iterator<JsonNode> mpItor = extItor.next().elements();
- extPoints.add(point(mpItor, type, srid));
- }
- }
- }
-
- List<Point> intPoints = null;
- if (itor.hasNext()) {
- final Iterator<JsonNode> intItor = itor.next().elements();
- if (intItor.hasNext()) {
- intPoints = new ArrayList<Point>();
- while (intItor.hasNext()) {
- final Iterator<JsonNode> mpItor = intItor.next().elements();
- intPoints.add(point(mpItor, type, srid));
- }
- }
- }
-
- return new Polygon(GeoUtils.getDimension(type), srid, intPoints, extPoints);
- }
-
- private MultiPolygon multiPolygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final SRID srid) {
- final MultiPolygon multiPolygon;
-
- if (itor.hasNext()) {
- final List<Polygon> polygons = new ArrayList<Polygon>();
- while (itor.hasNext()) {
- final Iterator<JsonNode> mpItor = itor.next().elements();
- polygons.add(polygon(mpItor, type, srid));
- }
- multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), srid, polygons);
- } else {
- multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), srid, Collections.<Polygon> emptyList());
- }
-
- return multiPolygon;
- }
-
- private GeospatialCollection collection(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final SRID srid) {
-
- final GeospatialCollection collection;
-
- if (itor.hasNext()) {
- final List<Geospatial> geospatials = new ArrayList<Geospatial>();
-
- while (itor.hasNext()) {
- final JsonNode geo = itor.next();
- final String collItemType = geo.get(Constants.ATTR_TYPE).asText();
- final String callAsType;
- if (EdmPrimitiveTypeKind.GeographyCollection.name().equals(collItemType)
- || EdmPrimitiveTypeKind.GeometryCollection.name().equals(collItemType)) {
-
- callAsType = collItemType;
- } else {
- callAsType = (type == EdmPrimitiveTypeKind.GeographyCollection ? "Geography" : "Geometry")
- + collItemType;
- }
-
- geospatials.add(deserialize(geo, new EdmTypeInfo.Builder().setTypeExpression(callAsType).build()));
- }
-
- collection = new GeospatialCollection(GeoUtils.getDimension(type), srid, geospatials);
- } else {
- collection = new GeospatialCollection(GeoUtils.getDimension(type), srid, Collections.<Geospatial> emptyList());
- }
-
- return collection;
- }
-
- public Geospatial deserialize(final JsonNode node, final EdmTypeInfo typeInfo) {
- final EdmPrimitiveTypeKind actualType;
- if ((typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geography
- || typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geometry)
- && node.has(Constants.ATTR_TYPE)) {
-
- String nodeType = node.get(Constants.ATTR_TYPE).asText();
- if (nodeType.startsWith("Geo")) {
- final int yIdx = nodeType.indexOf('y');
- nodeType = nodeType.substring(yIdx + 1);
- }
- actualType = EdmPrimitiveTypeKind.valueOfFQN(typeInfo.getFullQualifiedName().toString() + nodeType);
- } else {
- actualType = typeInfo.getPrimitiveTypeKind();
- }
-
- final Iterator<JsonNode> cooItor = node.has(Constants.JSON_COORDINATES)
- ? node.get(Constants.JSON_COORDINATES).elements()
- : Collections.<JsonNode> emptyList().iterator();
-
- SRID srid = null;
- if (node.has(Constants.JSON_CRS)) {
- srid = SRID.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, srid);
- break;
-
- case GeographyMultiPoint:
- case GeometryMultiPoint:
- value = multipoint(cooItor, actualType, srid);
- break;
-
- case GeographyLineString:
- case GeometryLineString:
- value = lineString(cooItor, actualType, srid);
- break;
-
- case GeographyMultiLineString:
- case GeometryMultiLineString:
- value = multiLineString(cooItor, actualType, srid);
- break;
-
- case GeographyPolygon:
- case GeometryPolygon:
- value = polygon(cooItor, actualType, srid);
- break;
-
- case GeographyMultiPolygon:
- case GeometryMultiPolygon:
- value = multiPolygon(cooItor, actualType, srid);
- break;
-
- case GeographyCollection:
- case GeometryCollection:
- value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), actualType, srid);
- break;
-
- default:
- }
-
- return value;
- }
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonGeoValueSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonGeoValueSerializer.java
deleted file mode 100644
index 7cd382b..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonGeoValueSerializer.java
+++ /dev/null
@@ -1,184 +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.serialization;
-
-import java.io.IOException;
-
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.geo.ComposedGeospatial;
-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.geo.SRID;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-
-class JsonGeoValueSerializer {
-
- private void srid(final JsonGenerator jgen, final SRID 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:" + srid.toString());
- jgen.writeEndObject();
- jgen.writeEndObject();
- }
-
- private void point(final JsonGenerator jgen, final Point point) throws IOException {
- try {
- jgen.writeNumber(EdmDouble.getInstance().valueToString(point.getX(), null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
- jgen.writeNumber(EdmDouble.getInstance().valueToString(point.getY(), null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
- } catch (EdmPrimitiveTypeException e) {
- throw new IllegalArgumentException("While serializing point coordinates as double", e);
- }
- }
-
- private void multipoint(final JsonGenerator jgen, final MultiPoint multiPoint) throws IOException {
- for (Point point : multiPoint) {
- jgen.writeStartArray();
- point(jgen, point);
- jgen.writeEndArray();
- }
- }
-
- private void lineString(final JsonGenerator jgen, final ComposedGeospatial<Point> lineString) throws IOException {
- for (Point point : lineString) {
- jgen.writeStartArray();
- point(jgen, point);
- jgen.writeEndArray();
- }
- }
-
- private void multiLineString(final JsonGenerator jgen, final MultiLineString multiLineString) throws IOException {
- for (LineString lineString : multiLineString) {
- jgen.writeStartArray();
- lineString(jgen, lineString);
- jgen.writeEndArray();
- }
- }
-
- private void polygon(final JsonGenerator jgen, final Polygon polygon) throws IOException {
- if (!polygon.getExterior().isEmpty()) {
- jgen.writeStartArray();
- lineString(jgen, polygon.getExterior());
- jgen.writeEndArray();
- }
- if (!polygon.getInterior().isEmpty()) {
- jgen.writeStartArray();
- lineString(jgen, polygon.getInterior());
- jgen.writeEndArray();
- }
- }
-
- private void multiPolygon(final JsonGenerator jgen, final MultiPolygon multiPolygon) throws IOException {
- for (Polygon polygon : multiPolygon) {
- jgen.writeStartArray();
- polygon(jgen, polygon);
- jgen.writeEndArray();
- }
- }
-
- private void collection(final JsonGenerator jgen, final GeospatialCollection collection) throws IOException {
- jgen.writeArrayFieldStart(Constants.JSON_GEOMETRIES);
- for (Geospatial geospatial : collection) {
- jgen.writeStartObject();
- serialize(jgen, geospatial);
- jgen.writeEndObject();
- }
- jgen.writeEndArray();
- }
-
- public void serialize(final JsonGenerator jgen, final Geospatial value) throws IOException {
- if (value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeographyCollection)
- || value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeometryCollection)) {
-
- jgen.writeStringField(Constants.ATTR_TYPE, EdmPrimitiveTypeKind.GeometryCollection.name());
- } else {
- final int yIdx = value.getEdmPrimitiveTypeKind().name().indexOf('y');
- final String itemType = value.getEdmPrimitiveTypeKind().name().substring(yIdx + 1);
- jgen.writeStringField(Constants.ATTR_TYPE, itemType);
- }
-
- switch (value.getEdmPrimitiveTypeKind()) {
- case GeographyPoint:
- case GeometryPoint:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- point(jgen, (Point) value);
- jgen.writeEndArray();
- break;
-
- case GeographyMultiPoint:
- case GeometryMultiPoint:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- multipoint(jgen, (MultiPoint) value);
- jgen.writeEndArray();
- break;
-
- case GeographyLineString:
- case GeometryLineString:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- lineString(jgen, (LineString) value);
- jgen.writeEndArray();
- break;
-
- case GeographyMultiLineString:
- case GeometryMultiLineString:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- multiLineString(jgen, (MultiLineString) value);
- jgen.writeEndArray();
- break;
-
- case GeographyPolygon:
- case GeometryPolygon:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- polygon(jgen, (Polygon) value);
- jgen.writeEndArray();
- break;
-
- case GeographyMultiPolygon:
- case GeometryMultiPolygon:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- multiPolygon(jgen, (MultiPolygon) value);
- jgen.writeEndArray();
- break;
-
- case GeographyCollection:
- case GeometryCollection:
- collection(jgen, (GeospatialCollection) value);
- break;
-
- default:
- }
-
- if (value.getSrid() != null && value.getSrid().isNotDefault()) {
- srid(jgen, value.getSrid());
- }
- }
-
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java
deleted file mode 100644
index 3636db6..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java
+++ /dev/null
@@ -1,87 +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.serialization;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.ODataError;
-import org.apache.olingo.commons.api.ODataErrorDetail;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class JsonODataErrorDeserializer extends JsonDeserializer {
-
- public JsonODataErrorDeserializer(final boolean serverMode) {
- super(serverMode);
- }
-
- protected ODataError doDeserialize(final JsonParser parser) throws IOException {
-
- final ODataError error = new ODataError();
-
- final ObjectNode tree = parser.getCodec().readTree(parser);
- if (tree.has(Constants.JSON_ERROR)) {
- final JsonNode errorNode = tree.get(Constants.JSON_ERROR);
-
- 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());
- }
- if (errorNode.hasNonNull(Constants.ERROR_DETAILS)) {
- List<ODataErrorDetail> details = new ArrayList<ODataErrorDetail>();
- JsonODataErrorDetailDeserializer detailDeserializer = new JsonODataErrorDetailDeserializer(serverMode);
- for (JsonNode jsonNode : errorNode.get(Constants.ERROR_DETAILS)) {
- details.add(detailDeserializer.doDeserialize(jsonNode.traverse(parser.getCodec()))
- .getPayload());
- }
-
- error.setDetails(details);
- }
- if (errorNode.hasNonNull(Constants.ERROR_INNERERROR)) {
- HashMap<String, String> innerErrorMap = new HashMap<String, String>();
- final JsonNode innerError = errorNode.get(Constants.ERROR_INNERERROR);
- for (final Iterator<String> itor = innerError.fieldNames(); itor.hasNext();) {
- final String keyTmp = itor.next();
- final String val = innerError.get(keyTmp).toString();
- innerErrorMap.put(keyTmp, val);
- }
- error.setInnerError(innerErrorMap);
- }
- }
-
- return error;
- }
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDetailDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDetailDeserializer.java
deleted file mode 100644
index 1c6a187..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDetailDeserializer.java
+++ /dev/null
@@ -1,58 +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.serialization;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.ODataErrorDetail;
-import org.apache.olingo.commons.api.data.ResWrap;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.JsonNode;
-
-public class JsonODataErrorDetailDeserializer extends JsonDeserializer {
-
- public JsonODataErrorDetailDeserializer(final boolean serverMode) {
- super(serverMode);
- }
-
- protected ResWrap<ODataErrorDetail> doDeserialize(final JsonParser parser) throws IOException {
-
- final ODataErrorDetail error = new ODataErrorDetail();
- final JsonNode errorNode = parser.getCodec().readTree(parser);
- 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 ResWrap<ODataErrorDetail>((URI) null, null, error);
- }
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertyDeserializer.java
deleted file mode 100644
index 8738dd5..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertyDeserializer.java
+++ /dev/null
@@ -1,114 +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.serialization;
-
-import java.io.IOException;
-import java.net.URI;
-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.Annotation;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Parse JSON string into <tt>Property</tt>.
- */
-public class JsonPropertyDeserializer extends JsonDeserializer {
-
- public JsonPropertyDeserializer(final boolean serverMode) {
- super(serverMode);
- }
-
- protected ResWrap<Property> doDeserialize(final JsonParser parser) throws IOException {
-
- final ObjectNode tree = parser.getCodec().readTree(parser);
-
- final String metadataETag;
- final URI contextURL;
- final Property property = new Property();
-
- 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(new EdmTypeInfo.Builder().
- setTypeExpression(StringUtils.substringAfterLast(contextURL.toASCIIString(), "#")).build().internal());
- tree.remove(Constants.JSON_METADATA);
- } else {
- contextURL = null;
- }
-
- if (tree.has(Constants.JSON_TYPE)) {
- property.setType(new EdmTypeInfo.Builder().setTypeExpression(tree.get(Constants.JSON_TYPE).textValue()).build()
- .internal());
- tree.remove(Constants.JSON_TYPE);
- }
-
- if (tree.has(Constants.JSON_NULL) && tree.get(Constants.JSON_NULL).asBoolean()) {
- property.setValue(ValueType.PRIMITIVE, null);
- tree.remove(Constants.JSON_NULL);
- }
-
- if (property.getValue() == null) {
- try {
- value(property, tree.has(Constants.VALUE) ? tree.get(Constants.VALUE) : tree, parser.getCodec());
- } catch (final EdmPrimitiveTypeException e) {
- throw new IOException(e);
- }
- tree.remove(Constants.VALUE);
- }
-
- // any remaining entry is supposed to be an annotation or is ignored
- for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
- final Map.Entry<String, JsonNode> field = itor.next();
- if (field.getKey().charAt(0) == '@') {
- final Annotation annotation = new Annotation();
- annotation.setTerm(field.getKey().substring(1));
-
- try {
- value(annotation, field.getValue(), parser.getCodec());
- } catch (final EdmPrimitiveTypeException e) {
- throw new IOException(e);
- }
- property.getAnnotations().add(annotation);
- }
- }
-
- return new ResWrap<Property>(contextURL, metadataETag, property);
- }
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertySerializer.java
deleted file mode 100644
index cd2227f..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertySerializer.java
+++ /dev/null
@@ -1,93 +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.serialization;
-
-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.Annotation;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-
-/**
- * Writes out JSON string from <tt>PropertyImpl</tt>.
- */
-public class JsonPropertySerializer extends JsonSerializer {
-
- public JsonPropertySerializer(final boolean serverMode) {
- super(serverMode);
- }
-
- protected void doSerialize(final Property property, final JsonGenerator jgen)
- throws IOException, EdmPrimitiveTypeException {
- doContainerSerialize(new ResWrap<Property>((URI) null, null, property), jgen);
- }
-
- protected void doContainerSerialize(final ResWrap<Property> container, final JsonGenerator jgen)
- throws IOException, EdmPrimitiveTypeException {
-
- final Property property = container.getPayload();
-
- jgen.writeStartObject();
-
- if (serverMode && container.getContextURL() != null) {
- jgen.writeStringField(Constants.JSON_CONTEXT, container.getContextURL().toASCIIString());
- }
-
- if (StringUtils.isNotBlank(property.getType())) {
- jgen.writeStringField(Constants.JSON_TYPE,
- new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build().external());
- }
-
- for (Annotation annotation : property.getAnnotations()) {
- valuable(jgen, annotation, "@" + annotation.getTerm());
- }
-
- if (property.isNull()) {
- jgen.writeBooleanField(Constants.JSON_NULL, true);
- } else if (property.isGeospatial() || property.isCollection()) {
- valuable(jgen, property, Constants.VALUE);
- } else if (property.isPrimitive()) {
- final EdmTypeInfo typeInfo = property.getType() == null
- ? null
- : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
-
- jgen.writeFieldName(Constants.VALUE);
- primitiveValue(jgen, typeInfo, property.asPrimitive());
- } else if (property.isEnum()) {
- jgen.writeStringField(Constants.VALUE, property.asEnum().toString());
- } else if (property.isComplex()) {
- for (Property cproperty : property.asComplex().getValue()) {
- valuable(jgen, cproperty, cproperty.getName());
- }
- } else if (property.isComplex()) {
- for (Property cproperty : property.asComplex().getValue()) {
- valuable(jgen, cproperty, cproperty.getName());
- }
- }
-
- jgen.writeEndObject();
- }
-}
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java
deleted file mode 100755
index 92ce269..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java
+++ /dev/null
@@ -1,376 +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.serialization;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Annotatable;
-import org.apache.olingo.commons.api.data.Annotation;
-import org.apache.olingo.commons.api.data.ComplexValue;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Linked;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.data.Valuable;
-import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.serialization.ODataSerializer;
-import org.apache.olingo.commons.api.serialization.ODataSerializerException;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonGenerator;
-
-public class JsonSerializer implements ODataSerializer {
-
- private static final EdmPrimitiveTypeKind[] NUMBER_TYPES = {
- EdmPrimitiveTypeKind.Byte, EdmPrimitiveTypeKind.SByte,
- EdmPrimitiveTypeKind.Single, EdmPrimitiveTypeKind.Double,
- EdmPrimitiveTypeKind.Int16, EdmPrimitiveTypeKind.Int32, EdmPrimitiveTypeKind.Int64,
- EdmPrimitiveTypeKind.Decimal
- };
-
- private final JsonGeoValueSerializer geoSerializer = new JsonGeoValueSerializer();
-
- protected boolean serverMode;
-
- protected ODataFormat format;
-
- public JsonSerializer(final boolean serverMode) {
- this(serverMode, ODataFormat.JSON_FULL_METADATA);
- }
-
- public JsonSerializer(final boolean serverMode, final ODataFormat format) {
- this.serverMode = serverMode;
- this.format = format;
- }
-
- @Override
- public <T> void write(final Writer writer, final T obj) throws ODataSerializerException {
- try {
- final JsonGenerator json = new JsonFactory().createGenerator(writer);
- if (obj instanceof EntityCollection) {
- new JsonEntitySetSerializer(serverMode).doSerialize((EntityCollection) obj, json);
- } else if (obj instanceof Entity) {
- new JsonEntitySerializer(serverMode, format).doSerialize((Entity) obj, json);
- } else if (obj instanceof Property) {
- new JsonPropertySerializer(serverMode).doSerialize((Property) obj, json);
- } else if (obj instanceof Link) {
- link((Link) obj, json);
- }
- json.flush();
- } catch (final IOException e) {
- throw new ODataSerializerException(e);
- } catch (final EdmPrimitiveTypeException e) {
- throw new ODataSerializerException(e);
- }
- }
-
- private void reference(final ResWrap<URI> container, final JsonGenerator json) throws IOException {
- json.writeStartObject();
-
- json.writeStringField(Constants.JSON_CONTEXT, container.getContextURL().toASCIIString());
- json.writeStringField(Constants.JSON_ID, container.getPayload().toASCIIString());
-
- json.writeEndObject();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> void write(final Writer writer, final ResWrap<T> container) throws ODataSerializerException {
- final T obj = container == null ? null : container.getPayload();
- try {
- final JsonGenerator json = new JsonFactory().createGenerator(writer);
- if (obj instanceof EntityCollection) {
- new JsonEntitySetSerializer(serverMode).doContainerSerialize((ResWrap<EntityCollection>) container, json);
- } else if (obj instanceof Entity) {
- new JsonEntitySerializer(serverMode).doContainerSerialize((ResWrap<Entity>) container, json);
- } else if (obj instanceof Property) {
- new JsonPropertySerializer(serverMode).doContainerSerialize((ResWrap<Property>) container, json);
- } else if (obj instanceof Link) {
- link((Link) obj, json);
- } else if (obj instanceof URI) {
- reference((ResWrap<URI>) container, json);
- }
- json.flush();
- } catch (final IOException e) {
- throw new ODataSerializerException(e);
- } catch (final EdmPrimitiveTypeException e) {
- throw new ODataSerializerException(e);
- }
- }
-
- protected void link(final Link link, final JsonGenerator jgen) throws IOException {
- jgen.writeStartObject();
- jgen.writeStringField(Constants.JSON_URL, link.getHref());
- jgen.writeEndObject();
- }
-
- protected void links(final Linked linked, final JsonGenerator jgen)
- throws IOException, EdmPrimitiveTypeException {
-
- if (serverMode) {
- serverLinks(linked, jgen);
- } else {
- clientLinks(linked, jgen);
- }
- }
-
- protected void clientLinks(final Linked linked, final JsonGenerator jgen)
- throws IOException, EdmPrimitiveTypeException {
-
- final Map<String, List<String>> entitySetLinks = new HashMap<String, List<String>>();
- for (Link link : linked.getNavigationLinks()) {
- for (Annotation annotation : link.getAnnotations()) {
- valuable(jgen, annotation, link.getTitle() + "@" + annotation.getTerm());
- }
-
- if (isEntitySetNavigation(link)) {
- final List<String> uris;
- if (entitySetLinks.containsKey(link.getTitle())) {
- uris = entitySetLinks.get(link.getTitle());
- } else {
- uris = new ArrayList<String>();
- entitySetLinks.put(link.getTitle(), uris);
- }
- if (StringUtils.isNotBlank(link.getHref())) {
- uris.add(link.getHref());
- }
- } else {
- if (StringUtils.isNotBlank(link.getHref())) {
- jgen.writeStringField(link.getTitle() + Constants.JSON_BIND_LINK_SUFFIX, link.getHref());
- }
- }
-
- if (link.getInlineEntity() != null) {
- jgen.writeFieldName(link.getTitle());
- new JsonEntitySerializer(serverMode).doSerialize(link.getInlineEntity(), jgen);
- } else if (link.getInlineEntitySet() != null) {
- jgen.writeArrayFieldStart(link.getTitle());
- final JsonEntitySerializer entitySerializer = new JsonEntitySerializer(serverMode);
- for (Entity subEntry : link.getInlineEntitySet().getEntities()) {
- entitySerializer.doSerialize(subEntry, jgen);
- }
- jgen.writeEndArray();
- }
- }
- for (Map.Entry<String, List<String>> entitySetLink : entitySetLinks.entrySet()) {
- if (!entitySetLink.getValue().isEmpty()) {
- jgen.writeArrayFieldStart(entitySetLink.getKey() + Constants.JSON_BIND_LINK_SUFFIX);
- for (String uri : entitySetLink.getValue()) {
- jgen.writeString(uri);
- }
- jgen.writeEndArray();
- }
- }
- }
-
- private boolean isEntitySetNavigation(final Link link) {
- return Constants.ENTITY_SET_NAVIGATION_LINK_TYPE.equals(link.getType());
- }
-
- protected void serverLinks(final Linked linked, final JsonGenerator jgen)
- throws IOException, EdmPrimitiveTypeException {
- if (linked instanceof Entity) {
- for (Link link : ((Entity) linked).getMediaEditLinks()) {
- if (StringUtils.isNotBlank(link.getHref())) {
- jgen.writeStringField(
- link.getTitle() + StringUtils.prependIfMissing(Constants.JSON_MEDIA_EDIT_LINK, "@"),
- link.getHref());
- }
- }
- }
-
- for (Link link : linked.getAssociationLinks()) {
- if (StringUtils.isNotBlank(link.getHref())) {
- jgen.writeStringField(
- link.getTitle() + Constants.JSON_ASSOCIATION_LINK,
- link.getHref());
- }
- }
-
- for (Link link : linked.getNavigationLinks()) {
- for (Annotation annotation : link.getAnnotations()) {
- valuable(jgen, annotation, link.getTitle() + "@" + annotation.getTerm());
- }
-
- if (StringUtils.isNotBlank(link.getHref())) {
- jgen.writeStringField(
- link.getTitle() + Constants.JSON_NAVIGATION_LINK,
- link.getHref());
- }
-
- if (link.getInlineEntity() != null) {
- jgen.writeFieldName(link.getTitle());
- new JsonEntitySerializer(serverMode).doSerialize(link.getInlineEntity(), jgen);
- } else if (link.getInlineEntitySet() != null) {
- jgen.writeArrayFieldStart(link.getTitle());
- JsonEntitySerializer entitySerializer = new JsonEntitySerializer(serverMode);
- for (Entity subEntry : link.getInlineEntitySet().getEntities()) {
- entitySerializer.doSerialize(subEntry, jgen);
- }
- jgen.writeEndArray();
- }
- }
- }
-
- private void collection(final JsonGenerator jgen, final EdmTypeInfo typeInfo,
- final ValueType valueType, final List<?> value)
- throws IOException, EdmPrimitiveTypeException {
-
- jgen.writeStartArray();
-
- for (Object item : value) {
- final EdmTypeInfo itemTypeInfo = typeInfo == null
- ? null
- : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
- switch (valueType) {
- case COLLECTION_PRIMITIVE:
- primitiveValue(jgen, itemTypeInfo, item);
- break;
-
- case COLLECTION_GEOSPATIAL:
- jgen.writeStartObject();
- geoSerializer.serialize(jgen, (Geospatial) item);
- jgen.writeEndObject();
- break;
-
- case COLLECTION_ENUM:
- jgen.writeString(item.toString());
- break;
-
- case COLLECTION_COMPLEX:
- final ComplexValue complexItem2 = (ComplexValue) item;
- complexValue(jgen, itemTypeInfo, complexItem2.getValue(), complexItem2);
- break;
-
- default:
- }
- }
-
- jgen.writeEndArray();
- }
-
- protected void primitiveValue(final JsonGenerator jgen, final EdmTypeInfo typeInfo, final Object value)
- throws IOException, EdmPrimitiveTypeException {
-
- final EdmPrimitiveTypeKind kind = typeInfo == null ? null : typeInfo.getPrimitiveTypeKind();
- final boolean isNumber = kind == null ? value instanceof Number : ArrayUtils.contains(NUMBER_TYPES, kind);
- final boolean isBoolean = kind == null ? value instanceof Boolean : kind == EdmPrimitiveTypeKind.Boolean;
-
- if (value == null) {
- jgen.writeNull();
- } else if (isBoolean) {
- jgen.writeBoolean((Boolean) value);
- } else {
- final String serialized = kind == null
- ? value.toString()
- // TODO: add facets
- : EdmPrimitiveTypeFactory.getInstance(kind).
- valueToString(value, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null);
- if (isNumber) {
- jgen.writeNumber(serialized);
- } else {
- jgen.writeString(serialized);
- }
- }
- }
-
- private void complexValue(final JsonGenerator jgen, final EdmTypeInfo typeInfo,
- final List<Property> value, final Linked linked)
- throws IOException, EdmPrimitiveTypeException {
- jgen.writeStartObject();
-
- if (typeInfo != null && format != ODataFormat.JSON_NO_METADATA) {
- jgen.writeStringField(Constants.JSON_TYPE, typeInfo.external());
- }
-
- for (Property property : value) {
- valuable(jgen, property, property.getName());
- }
- if (linked != null) {
- links(linked, jgen);
- }
-
- jgen.writeEndObject();
- }
-
- private void value(final JsonGenerator jgen, final String type, final Valuable value)
- throws IOException, EdmPrimitiveTypeException {
- final EdmTypeInfo typeInfo = type == null ? null : new EdmTypeInfo.Builder().setTypeExpression(type).build();
-
- if (value.isNull()) {
- jgen.writeNull();
- } else if (value.isCollection()) {
- collection(jgen, typeInfo, value.getValueType(), value.asCollection());
- } else if (value.isPrimitive()) {
- primitiveValue(jgen, typeInfo, value.asPrimitive());
- } else if (value.isEnum()) {
- jgen.writeString(value.asEnum().toString());
- } else if (value.isGeospatial()) {
- jgen.writeStartObject();
- geoSerializer.serialize(jgen, value.asGeospatial());
- jgen.writeEndObject();
- } else if (value.isComplex()) {
- complexValue(jgen, typeInfo, value.asComplex().getValue(), value.asComplex());
- }
- }
-
- protected void valuable(final JsonGenerator jgen, final Valuable valuable, final String name)
- throws IOException, EdmPrimitiveTypeException {
-
- if (!Constants.VALUE.equals(name) && !(valuable instanceof Annotation)
- && !(valuable.isComplex() && !valuable.isCollection())) {
-
- String type = valuable.getType();
- if ((!valuable.isCollection() &&
- StringUtils.isBlank(type) &&
- valuable.isPrimitive()) || valuable.isNull()) {
- type = EdmPrimitiveTypeKind.String.getFullQualifiedName().toString();
- }
- if (StringUtils.isNotBlank(type) && format != ODataFormat.JSON_NO_METADATA) {
- jgen.writeFieldName(
- name + StringUtils.prependIfMissing(Constants.JSON_TYPE, "@"));
- jgen.writeString(new EdmTypeInfo.Builder().setTypeExpression(type).build().external());
- }
- }
-
- for (Annotation annotation : ((Annotatable) valuable).getAnnotations()) {
- valuable(jgen, annotation, name + "@" + annotation.getTerm());
- }
-
- jgen.writeFieldName(name);
- value(jgen, valuable.getType(), valuable);
- }
-}
\ No newline at end of file
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/AtomDeserializerTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/AtomDeserializerTest.java
deleted file mode 100644
index c1226b2..0000000
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/AtomDeserializerTest.java
+++ /dev/null
@@ -1,328 +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.serialization;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.junit.Test;
-
-public class AtomDeserializerTest {
-
- @Test
- public void emptyInlineEntityOlingo540() throws Exception {
- final String content = "" +
- "<entry xmlns=\"http://www.w3.org/2005/Atom\" "
- + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" "
- + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
- + "xmlns:georss=\"http://www.georss.org/georss\" xmlns:gml=\"http://www.opengis.net/gml\" "
- + "xml:base=\"http://services.odata.org/V3/OData/OData.svc/\">\r\n" +
- " <id>http://services.odata.org/V3/OData/OData.svc/Products(3)</id>\r\n" +
- " <category term=\"ODataDemo.Product\" "
- + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" +
- " \r\n" +
- " <link rel=\"edit\" title=\"Product\" href=\"Products\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Categories\" "
- + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Supplier\" "
- + "type=\"application/atom+xml;type=entry\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" +
- " <metadata:inline>\r\n" +
- " </metadata:inline>\r\n" +
- " </link>\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/related/ProductDetail\""
- + " type=\"application/atom+xml;type=entry\" title=\"ProductDetail\" "
- + "href=\"Products(3)/ProductDetail\" />\r\n" +
- " <title type=\"text\">Havina Cola</title>\r\n" +
- " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" +
- " <updated>2015-01-26T08:57:02Z</updated>\r\n" +
- " <author>\r\n" +
- " <name />\r\n" +
- " </author>\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Categories\" "
- + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Supplier\" "
- + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/ProductDetail\""
- + " type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" +
- " <content type=\"application/xml\">\r\n" +
- " <metadata:properties>\r\n" +
- " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" +
- " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" +
- " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" +
- " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" +
- " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" +
- " </metadata:properties>\r\n" +
- " </content>\r\n" +
- " </entry>";
-
- final AtomDeserializer deserializer = new AtomDeserializer();
- final InputStream in = new ByteArrayInputStream(content.getBytes("UTF-8"));
- final ResWrap<Entity> entity = deserializer.toEntity(in);
-
- assertNotNull(entity);
- assertNull(entity.getPayload().getNavigationLink("Supplier").getInlineEntitySet());
- }
-
- @Test
- public void filledInlineEntity() throws Exception {
- final String content = "" +
- "<entry xmlns=\"http://www.w3.org/2005/Atom\" "
- + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" "
- + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
- + "xmlns:georss=\"http://www.georss.org/georss\" "
- + "xmlns:gml=\"http://www.opengis.net/gml\" "
- + "xml:base=\"http://services.odata.org/V4/OData/OData.svc/\">\r\n" +
- " <id>http://services.odata.org/V4/OData/OData.svc/Products(3)</id>\r\n" +
- " <category term=\"#ODataDemo.Product\" "
- + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" +
- " \r\n" +
- " <link rel=\"edit\" title=\"Product\" href=\"Products\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Categories\" "
- + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Supplier\" "
- + "type=\"application/atom+xml;type=entry\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" +
- " <metadata:inline>\r\n" +
- " <entry>\r\n" +
- " <id>http://services.odata.org/V4/OData/OData.svc/Suppliers(0)</id>\r\n" +
- " <category term=\"ODataDemo.Supplier\" "
- + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" +
- " <link rel=\"edit\" title=\"Supplier\" href=\"Suppliers(0)\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Products\" "
- + "type=\"application/atom+xml;type=feed\" title=\"Products\" href=\"Suppliers(0)/Products\" />\r\n" +
- " <title type=\"text\">Exotic Liquids</title>\r\n" +
- " <updated>2015-01-26T08:57:02Z</updated>\r\n" +
- " <author>\r\n" +
- " <name />\r\n" +
- " </author>\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Products\" "
- + "type=\"application/xml\" title=\"Products\" href=\"Suppliers(0)/$links/Products\" />\r\n" +
- " <content type=\"application/xml\">\r\n" +
- " <metadata:properties>\r\n" +
- " <data:ID metadata:type=\"Edm.Int32\">0</data:ID>\r\n" +
- " <data:Name>Exotic Liquids</data:Name>\r\n" +
- " <data:Address metadata:type=\"ODataDemo.Address\">\r\n" +
- " <data:Street>NE 228th</data:Street>\r\n" +
- " <data:City>Sammamish</data:City>\r\n" +
- " <data:State>WA</data:State>\r\n" +
- " <data:ZipCode>98074</data:ZipCode>\r\n" +
- " <data:Country>USA</data:Country>\r\n" +
- " </data:Address>\r\n" +
- " <data:Location metadata:type=\"Edm.GeographyPoint\">\r\n" +
- " <gml:Point gml:srsName=\"http://www.opengis.net/def/crs/EPSG/0/4326\">\r\n" +
- " <gml:pos>47.6316604614258 -122.03547668457</gml:pos>\r\n" +
- " </gml:Point>\r\n" +
- " </data:Location>\r\n" +
- " <data:Concurrency metadata:type=\"Edm.Int32\">0</data:Concurrency>\r\n" +
- " </metadata:properties>\r\n" +
- " </content>\r\n" +
- " </entry>" +
- " </metadata:inline>\r\n" +
- " </link>\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/related/ProductDetail\" "
- + "type=\"application/atom+xml;type=entry\" "
- + "title=\"ProductDetail\" href=\"Products(3)/ProductDetail\" />\r\n" +
- " <title type=\"text\">Havina Cola</title>\r\n" +
- " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" +
- " <updated>2015-01-26T08:57:02Z</updated>\r\n" +
- " <author>\r\n" +
- " <name />\r\n" +
- " </author>\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Categories\" "
- + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Supplier\" "
- + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/ProductDetail\" "
- + "type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" +
- " <content type=\"application/xml\">\r\n" +
- " <metadata:properties>\r\n" +
- " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" +
- " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" +
- " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" +
- " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" +
- " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" +
- " </metadata:properties>\r\n" +
- " </content>\r\n" +
- " </entry>";
- final AtomDeserializer deserializer = new AtomDeserializer();
- final InputStream in = new ByteArrayInputStream(content.getBytes("UTF-8"));
- final ResWrap<Entity> entity = deserializer.toEntity(in);
-
- assertNotNull(entity);
- final Entity inlineEntity = entity.getPayload().getNavigationLink("Supplier").getInlineEntity();
- assertNotNull(inlineEntity);
-
- assertEquals(new Integer(0), inlineEntity.getProperty("ID").getValue());
- assertEquals("Exotic Liquids", inlineEntity.getProperty("Name").getValue());
- }
-
- @Test
- public void emptyInlineEntityCollection() throws Exception {
- final String content = "" +
- "<entry xmlns=\"http://www.w3.org/2005/Atom\" "
- + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" "
- + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
- + "xmlns:georss=\"http://www.georss.org/georss\" xmlns:gml=\"http://www.opengis.net/gml\" "
- + "xml:base=\"http://services.odata.org/V3/OData/OData.svc/\">\r\n" +
- " <id>http://services.odata.org/V3/OData/OData.svc/Products(3)</id>\r\n" +
- " <category term=\"ODataDemo.Product\" "
- + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" +
- " \r\n" +
- " <link rel=\"edit\" title=\"Product\" href=\"Products(3)\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Categories\" "
- + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Supplier\" "
- + "type=\"application/atom+xml;type=feed\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" +
- " <metadata:inline>\r\n" +
- " <feed>\r\n" +
- " </feed>\r\n" +
- " </metadata:inline>\r\n" +
- " </link>\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/related/ProductDetail\" "
- + "type=\"application/atom+xml;type=entry\" "
- + "title=\"ProductDetail\" href=\"Products(3)/ProductDetail\" />\r\n" +
- " <title type=\"text\">Havina Cola</title>\r\n" +
- " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" +
- " <updated>2015-01-26T08:57:02Z</updated>\r\n" +
- " <author>\r\n" +
- " <name />\r\n" +
- " </author>\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Categories\" "
- + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Supplier\" "
- + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/ProductDetail\" "
- + "type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" +
- " <content type=\"application/xml\">\r\n" +
- " <metadata:properties>\r\n" +
- " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" +
- " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" +
- " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" +
- " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" +
- " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" +
- " </metadata:properties>\r\n" +
- " </content>\r\n" +
- " </entry>";
- final AtomDeserializer deserializer = new AtomDeserializer();
- final InputStream in = new ByteArrayInputStream(content.getBytes("UTF-8"));
- final ResWrap<Entity> entity = deserializer.toEntity(in);
-
- assertNotNull(entity);
- final EntityCollection inlineEntitySet = entity.getPayload().getNavigationLink("Supplier").getInlineEntitySet();
- assertNotNull(inlineEntitySet);
- assertEquals(0, inlineEntitySet.getEntities().size());
- }
-
- @Test
- public void filledInlineEntityCollection() throws Exception {
- final String content = "" +
- "<entry xmlns=\"http://www.w3.org/2005/Atom\" "
- + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" "
- + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
- + "xmlns:georss=\"http://www.georss.org/georss\" xmlns:gml=\"http://www.opengis.net/gml\" "
- + "xml:base=\"http://services.odata.org/V3/OData/OData.svc/\">\r\n" +
- " <id>http://services.odata.org/V3/OData/OData.svc/Products(3)</id>\r\n" +
- " <category term=\"ODataDemo.Product\" "
- + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" +
- " \r\n" +
- " <link rel=\"edit\" title=\"Product\" href=\"Products(3)\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Categories\" "
- + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Supplier\" "
- + "type=\"application/atom+xml;type=feed\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" +
- " <metadata:inline>\r\n" +
- " <feed>\r\n" +
- " <entry>\r\n" +
- " <id>http://services.odata.org/V3/OData/OData.svc/Suppliers(0)</id>\r\n" +
- " <category term=\"ODataDemo.Supplier\" "
- + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" +
- " <link rel=\"edit\" title=\"Supplier\" href=\"Suppliers(0)\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Products\" "
- + "type=\"application/atom+xml;type=feed\" title=\"Products\" href=\"Suppliers(0)/Products\" />\r\n" +
- " <title type=\"text\">Exotic Liquids</title>\r\n" +
- " <updated>2015-01-26T08:57:02Z</updated>\r\n" +
- " <author>\r\n" +
- " <name />\r\n" +
- " </author>\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Products\" "
- + "type=\"application/xml\" title=\"Products\" href=\"Suppliers(0)/$links/Products\" />\r\n" +
- " <content type=\"application/xml\">\r\n" +
- " <metadata:properties>\r\n" +
- " <data:ID metadata:type=\"Edm.Int32\">0</data:ID>\r\n" +
- " <data:Name>Exotic Liquids</data:Name>\r\n" +
- " <data:Address metadata:type=\"ODataDemo.Address\">\r\n" +
- " <data:Street>NE 228th</data:Street>\r\n" +
- " <data:City>Sammamish</data:City>\r\n" +
- " <data:State>WA</data:State>\r\n" +
- " <data:ZipCode>98074</data:ZipCode>\r\n" +
- " <data:Country>USA</data:Country>\r\n" +
- " </data:Address>\r\n" +
- " <data:Location metadata:type=\"Edm.GeographyPoint\">\r\n" +
- " <gml:Point gml:srsName=\"http://www.opengis.net/def/crs/EPSG/0/4326\">\r\n" +
- " <gml:pos>47.6316604614258 -122.03547668457</gml:pos>\r\n" +
- " </gml:Point>\r\n" +
- " </data:Location>\r\n" +
- " <data:Concurrency metadata:type=\"Edm.Int32\">0</data:Concurrency>\r\n" +
- " </metadata:properties>\r\n" +
- " </content>\r\n" +
- " </entry>\r\n" +
- " </feed>\r\n" +
- " </metadata:inline>\r\n" +
- " </link>\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/related/ProductDetail\" "
- + "type=\"application/atom+xml;type=entry\" "
- + "title=\"ProductDetail\" href=\"Products(3)/ProductDetail\" />\r\n" +
- " <title type=\"text\">Havina Cola</title>\r\n" +
- " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" +
- " <updated>2015-01-26T08:57:02Z</updated>\r\n" +
- " <author>\r\n" +
- " <name />\r\n" +
- " </author>\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Categories\" "
- + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Supplier\" "
- + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" +
- " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/ProductDetail\" "
- + "type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" +
- " <content type=\"application/xml\">\r\n" +
- " <metadata:properties>\r\n" +
- " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" +
- " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" +
- " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" +
- " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" +
- " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" +
- " </metadata:properties>\r\n" +
- " </content>\r\n" +
- " </entry>";
- final AtomDeserializer deserializer = new AtomDeserializer();
- final InputStream in = new ByteArrayInputStream(content.getBytes("UTF-8"));
- final ResWrap<Entity> entity = deserializer.toEntity(in);
-
- assertNotNull(entity);
- final EntityCollection inlineEntitySet = entity.getPayload().getNavigationLink("Supplier").getInlineEntitySet();
- assertNotNull(inlineEntitySet);
- assertEquals(1, inlineEntitySet.getEntities().size());
- }
-}
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/ContextURLParserTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/ContextURLParserTest.java
deleted file mode 100644
index 7c401e1..0000000
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/ContextURLParserTest.java
+++ /dev/null
@@ -1,255 +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.serialization;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.net.URI;
-
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.junit.Test;
-
-public class ContextURLParserTest {
-
- @Test
- public void collectionOfEntities() {
- ContextURL contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Customers"));
-
- assertEquals(URI.create("http://host/service/"), contextURL.getServiceRoot());
- assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
- assertNull(contextURL.getDerivedEntity());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
-
- contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Orders(4711)/Items"));
-
- assertEquals("Orders", contextURL.getEntitySetOrSingletonOrType());
- assertNull(contextURL.getDerivedEntity());
- assertNull(contextURL.getSelectList());
- assertEquals("Items", contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
-
- contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Me/Folders('Inbox')/Messages"));
-
- assertEquals("Me/Folders", contextURL.getEntitySetOrSingletonOrType());
- assertEquals("Messages", contextURL.getNavOrPropertyPath());
- }
-
- @Test
- public void entity() {
- ContextURL contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Customers/$entity"));
-
- assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
- assertNull(contextURL.getDerivedEntity());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertTrue(contextURL.isEntity());
-
- contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Orders(4711)/Items/$entity"));
-
- assertEquals("Orders/Items", contextURL.getEntitySetOrSingletonOrType());
- assertNull(contextURL.getDerivedEntity());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertTrue(contextURL.isEntity());
-
- contextURL = ContextURLParser.parse(
- URI.create("http://host/service/$metadata#Users('user')/Messages('message')/Attachments/$entity"));
-
- assertEquals("Users/Messages/Attachments", contextURL.getEntitySetOrSingletonOrType());
- assertNull(contextURL.getDerivedEntity());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertTrue(contextURL.isEntity());
-
- // v3
- contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Products/@Element"));
-
- assertEquals("Products", contextURL.getEntitySetOrSingletonOrType());
- assertNull(contextURL.getDerivedEntity());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertTrue(contextURL.isEntity());
- }
-
- @Test
- public void singleton() {
- ContextURL contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Contoso"));
-
- assertEquals("Contoso", contextURL.getEntitySetOrSingletonOrType());
- assertNull(contextURL.getDerivedEntity());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
- }
-
- @Test
- public void collectionOfDerivedEntities() {
- final ContextURL contextURL = ContextURLParser.parse(
- URI.create("http://host/service/$metadata#Customers/Model.VipCustomer"));
-
- assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
- assertEquals("Model.VipCustomer", contextURL.getDerivedEntity());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
- }
-
- @Test
- public void derivedEntity() {
- final ContextURL contextURL = ContextURLParser.parse(
- URI.create("http://host/service/$metadata#Customers/Model.VipCustomer/$entity"));
-
- assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
- assertEquals("Model.VipCustomer", contextURL.getDerivedEntity());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertTrue(contextURL.isEntity());
- }
-
- @Test
- public void collectionOfProjectedEntities() {
- final ContextURL contextURL = ContextURLParser.parse(
- URI.create("http://host/service/$metadata#Customers(Address,Orders)"));
-
- assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
- assertNull(contextURL.getDerivedEntity());
- assertEquals("Address,Orders", contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
- }
-
- @Test
- public void projectedEntity() {
- ContextURL contextURL = ContextURLParser.parse(
- URI.create("http://host/service/$metadata#Customers(Name,Rating)/$entity"));
-
- assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
- assertNull(contextURL.getDerivedEntity());
- assertEquals("Name,Rating", contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertTrue(contextURL.isEntity());
-
- contextURL = ContextURLParser.parse(
- URI.create("http://host/service/$metadata#Customers(Name,Address/Country)"));
-
- assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
- assertNull(contextURL.getDerivedEntity());
- assertEquals("Name,Address/Country", contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
- }
-
- @Test
- public void collectionOfProjectedExpandedEntities() {
- final ContextURL contextURL = ContextURLParser.parse(
- URI.create("http://host/service/$metadata#Employees/"
- + "Sales.Manager(DirectReports,DirectReports+(FirstName,LastName))"));
-
- assertEquals("Employees", contextURL.getEntitySetOrSingletonOrType());
- assertEquals("Sales.Manager", contextURL.getDerivedEntity());
- assertEquals("DirectReports,DirectReports+(FirstName,LastName)", contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
- }
-
- @Test
- public void propertyValue() {
- final ContextURL contextURL = ContextURLParser.parse(
- URI.create("http://host/service/$metadata#Customers(1)/Addresses"));
-
- assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType());
- assertNull(contextURL.getDerivedEntity());
- assertNull(contextURL.getSelectList());
- assertEquals("Addresses", contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
- }
-
- @Test
- public void CollectionOfComplexOrPrimitiveTypes() {
- final ContextURL contextURL = ContextURLParser.parse(
- URI.create("http://host/service/$metadata#Collection(Edm.String)"));
-
- assertEquals("Collection(Edm.String)", contextURL.getEntitySetOrSingletonOrType());
- assertNull(contextURL.getDerivedEntity());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
- }
-
- @Test
- public void complexOrPrimitiveType() {
- ContextURL contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Edm.String"));
-
- assertEquals("Edm.String", contextURL.getEntitySetOrSingletonOrType());
- assertNull(contextURL.getDerivedEntity());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
-
- contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#ODataDemo.Address"));
-
- assertEquals("ODataDemo.Address", contextURL.getEntitySetOrSingletonOrType());
- assertNull(contextURL.getDerivedEntity());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
- }
-
- @Test
- public void reference() {
- ContextURL contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Customers/$ref"));
- assertTrue(contextURL.isReference());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
- assertFalse(contextURL.isDelta());
- }
-
- @Test
- public void delta() {
- ContextURL contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Customers/$delta"));
- assertTrue(contextURL.isDelta());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
-
- contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Customers/$deletedLink"));
- assertTrue(contextURL.isDeltaDeletedLink());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
-
- contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Customers/$link"));
- assertTrue(contextURL.isDeltaLink());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
-
- contextURL = ContextURLParser.parse(URI.create("http://host/service/$metadata#Customers/$deletedEntity"));
- assertTrue(contextURL.isDeltaDeletedEntity());
- assertNull(contextURL.getSelectList());
- assertNull(contextURL.getNavOrPropertyPath());
- assertFalse(contextURL.isEntity());
- }
-}
diff --git a/lib/pom.xml b/lib/pom.xml
index a02d36c..060afa0 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -23,7 +23,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.olingo</groupId>
<artifactId>odata-lib</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
@@ -46,4 +45,30 @@
<module>server-tecsvc</module>
<module>server-test</module>
</modules>
+
+ <properties>
+ <cobertura.skip>true</cobertura.skip>
+ <!-- exclude proxy tests by default -->
+ <exclude.regex>.*proxy.*</exclude.regex>
+ </properties>
+
+ <profiles>
+ <profile>
+ <id>build.fast</id>
+ <properties>
+ <pmd.skip>true</pmd.skip>
+ <rat.skip>true</rat.skip>
+ <checkstyle.skip>true</checkstyle.skip>
+ <exclude.regex>.*(proxy|client).*</exclude.regex>
+ </properties>
+ </profile>
+ <profile>
+ <id>build.quality</id>
+ <properties>
+ <cobertura.skip>false</cobertura.skip>
+ <!-- nothing excluded -->
+ <exclude.regex></exclude.regex>
+ </properties>
+ </profile>
+ </profiles>
</project>
diff --git a/lib/server-api/pom.xml b/lib/server-api/pom.xml
index 393939f..0d636f0 100644
--- a/lib/server-api/pom.xml
+++ b/lib/server-api/pom.xml
@@ -56,6 +56,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
+ <version>${maven.bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
index 3a9c1cb..f21cfb5 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
@@ -18,19 +18,22 @@
*/
package org.apache.olingo.server.api;
+import java.util.Collection;
import java.util.List;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.server.api.debug.DebugResponseHelper;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.deserializer.FixedFormatDeserializer;
import org.apache.olingo.server.api.deserializer.ODataDeserializer;
import org.apache.olingo.server.api.edmx.EdmxReference;
import org.apache.olingo.server.api.etag.ETagHelper;
import org.apache.olingo.server.api.etag.ServiceMetadataETagSupport;
+import org.apache.olingo.server.api.prefer.Preferences;
import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
import org.apache.olingo.server.api.serializer.ODataSerializer;
import org.apache.olingo.server.api.serializer.SerializerException;
@@ -45,6 +48,10 @@
private static final String IMPLEMENTATION = "org.apache.olingo.server.core.ODataImpl";
+ /**
+ * Use this method to create a new OData instance. Each thread/request should keep its own instance.
+ * @return a new OData instance
+ */
public static OData newInstance() {
try {
final Class<?> clazz = Class.forName(OData.IMPLEMENTATION);
@@ -66,12 +73,13 @@
* Creates a new serializer object for rendering content in the specified format.
* Serializers are used in Processor implementations.
*
- * @param format any format supported by Olingo (XML, JSON ...)
+ * @param contentType any format supported by Olingo (XML, JSON ...)
*/
- public abstract ODataSerializer createSerializer(ODataFormat format) throws SerializerException;
+ public abstract ODataSerializer createSerializer(ContentType contentType) throws SerializerException;
/**
- * Creates a new serializer object for rendering content in a fixed format, e.g., for binary output.
+ * Creates a new serializer object for rendering content in a fixed format, e.g., for binary output or multipart/mixed
+ * outpu.
* Serializers are used in Processor implementations.
*/
public abstract FixedFormatSerializer createFixedFormatSerializer();
@@ -119,9 +127,9 @@
* Creates a new deserializer object for reading content in the specified format.
* Deserializer are used in Processor implementations.
*
- * @param format any format supported by Olingo (XML, JSON ...)
+ * @param contentType any content type supported by Olingo (XML, JSON ...)
*/
- public abstract ODataDeserializer createDeserializer(ODataFormat format) throws DeserializerException;
+ public abstract ODataDeserializer createDeserializer(ContentType contentType) throws DeserializerException;
/**
* Creates a primitive-type instance.
@@ -135,4 +143,18 @@
* It can be used in Processor implementations.
*/
public abstract ETagHelper createETagHelper();
+
+ /**
+ * Creates a new Preferences object out of Prefer HTTP request headers.
+ * It can be used in Processor implementations.
+ */
+ public abstract Preferences createPreferences(Collection<String> preferHeaders);
+
+ /**
+ * This method creates a DebugResponseHelper for the given debugFormat. If the format is not supported no
+ * exception is thrown. Instead we give back the implementation for the json format.
+ * @param debugFormat to be used.
+ * @return a debug response serializer
+ */
+ public abstract DebugResponseHelper createDebugResponseHelper(String debugFormat);
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java
index db27121..3e92820 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this 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
@@ -20,7 +20,7 @@
import java.util.Locale;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.http.HttpStatusCode;
/**
@@ -97,14 +97,27 @@
this.oDataErrorCode = oDataErrorCode;
}
+ /**
+ * Will return the status code which will be used as a status code for the HTTP response. If not set the default is a
+ * 500 Internal Server Error.
+ * @return status code for this exception
+ */
public int getStatusCode() {
return statusCode;
}
+ /**
+ * Returns the Locale which was used for the error message. The default is null.
+ * @return locale used for the error message
+ */
public Locale getLocale() {
return locale;
}
+ /**
+ * This method will return the error code specified by the application. The default is null.
+ * @return the applications error code.
+ */
public String getODataErrorCode() {
return oDataErrorCode;
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java
index 20ed77e..d641581 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java
@@ -21,6 +21,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.olingo.server.api.debug.DebugSupport;
import org.apache.olingo.server.api.etag.CustomETagSupport;
import org.apache.olingo.server.api.processor.Processor;
import org.apache.olingo.server.api.serializer.CustomContentTypeSupport;
@@ -66,4 +67,10 @@
*/
void register(CustomETagSupport customConcurrencyControlSupport);
+ /**
+ * Register the debug support handler
+ * @param debugSupport
+ */
+ void register(DebugSupport debugSupport);
+
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataLibraryException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataLibraryException.java
index b639702..f7f5dee 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataLibraryException.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataLibraryException.java
@@ -25,9 +25,7 @@
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import org.apache.olingo.commons.api.ODataException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.olingo.commons.api.ex.ODataException;
/**
* Abstract superclass of all translatable server exceptions.
@@ -35,15 +33,14 @@
public abstract class ODataLibraryException extends ODataException {
private static final long serialVersionUID = -1210541002198287561L;
- private static final Logger LOG = LoggerFactory.getLogger(ODataLibraryException.class);
private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
protected static final String DEFAULT_SERVER_BUNDLE_NAME = "server-core-exceptions-i18n";
/** Key for the exception text in the resource bundle. */
- public static interface MessageKey {
+ public interface MessageKey {
/** Gets this key. */
- public String getKey();
+ String getKey();
}
private MessageKey messageKey;
@@ -109,7 +106,6 @@
try {
return ResourceBundle.getBundle(getBundleName(), locale == null ? DEFAULT_LOCALE : locale);
} catch (final MissingResourceException e) {
- LOG.error(e.getMessage(), e);
return null;
}
}
@@ -137,9 +133,9 @@
}
/** Error message text and {@link Locale} used for it. */
- public class ODataErrorMessage {
- String message;
- Locale locale;
+ public static class ODataErrorMessage {
+ private String message;
+ private Locale locale;
public ODataErrorMessage(final String message, final Locale usedLocale) {
this.message = message;
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java
index d18f67e..7e806ea 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this 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
@@ -20,10 +20,11 @@
import java.io.InputStream;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpHeaders;
import org.apache.olingo.commons.api.http.HttpMethod;
/**
@@ -31,13 +32,14 @@
*/
public class ODataRequest {
private HttpMethod method;
- private Map<String, List<String>> headers = new HashMap<String, List<String>>();
+ private HttpHeaders headers = new HttpHeaders();
private InputStream body;
private String rawQueryPath;
private String rawRequestUri;
private String rawODataPath;
private String rawBaseUri;
private String rawServiceResolutionUri;
+ private String protocol;
/**
* Gets the HTTP method.
@@ -56,6 +58,30 @@
}
/**
+ * <p>Set a header to the response.</p>
+ * <p>The header name will be handled as case-insensitive key.</p>
+ * <p>If a header already exists then the header will be replaced by this new value.</p>
+ * @param name case-insensitive header name
+ * @param value value for the given header name
+ * @see <a href="http://ietf.org/rfc/rfc7230.txt">RFC 7230, section 3.2.2</a>
+ */
+ public void setHeader(final String name, final String value) {
+ headers.setHeader(name, value);
+ }
+
+ /**
+ * <p>Adds a header to the request.</p>
+ * <p>The header name will be handled as case-insensitive key.</p>
+ * <p>If a header already exists then the list of values will just be extended.</p>
+ * @param name case-insensitive header name
+ * @param value value for the given header name
+ * @see <a href="http://ietf.org/rfc/rfc7230.txt">RFC 7230, section 3.2.2</a>
+ */
+ public void addHeader(final String name, final String value) {
+ headers.addHeader(name, value);
+ }
+
+ /**
* <p>Adds a header to the request.</p>
* <p>The header name will be handled as case-insensitive key.</p>
* <p>If a header already exists then the list of values will just be extended.</p>
@@ -64,31 +90,24 @@
* @see <a href="http://ietf.org/rfc/rfc7230.txt">RFC 7230, section 3.2.2</a>
*/
public void addHeader(final String name, final List<String> values) {
- String key = name.toUpperCase();
- if (headers.containsKey(key)) {
- List<String> oldValues = headers.get(key);
-
- List<String> newValues = new ArrayList<String>();
- newValues.addAll(oldValues);
- newValues.addAll(values);
-
- headers.put(name.toUpperCase(), newValues);
- } else {
- headers.put(name.toUpperCase(), values);
- }
+ headers.addHeader(name, values);
}
/**
- * Gets header value for a given name.
+ * Get header values for a given name.
* @param name the header name as a case-insensitive key
* @return the header value(s) or null if not found
*/
public List<String> getHeaders(final String name) {
- return headers.get(name.toUpperCase());
+ HttpHeader h = headers.getHeader(name);
+ if(h == null) {
+ return null;
+ }
+ return new ArrayList<String>(h.getValues());
}
/**
- * Gets first header value for a given name.
+ * Get first header value for a given name.
* @param name the header name as a case-insensitive key
* @return the first header value or null if not found
*/
@@ -98,6 +117,15 @@
}
/**
+ * Gets all headers.
+ * @return an unmodifiable Map of header names/values
+ */
+ public Map<String, List<String>> getAllHeaders() {
+ return headers.getHeaderToValues();
+ }
+
+
+ /**
* Gets the body of the request.
* @return the request payload as {@link InputStream} or null
*/
@@ -193,4 +221,21 @@
public void setRawServiceResolutionUri(final String rawServiceResolutionUri) {
this.rawServiceResolutionUri = rawServiceResolutionUri;
}
+
+ /**
+ * @return the protocol version used e.g. HTTP/1.1
+ */
+ public String getProtocol() {
+ return protocol;
+ }
+
+ /**
+ * Sets the HTTP protocol used
+ * @param protocol
+ * @see #getProtocol()
+ */
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
index 493e794..a53b1e4 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
@@ -19,10 +19,12 @@
package org.apache.olingo.server.api;
import java.io.InputStream;
-import java.util.Collections;
-import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpHeaders;
import org.apache.olingo.commons.api.http.HttpStatusCode;
/**
@@ -31,7 +33,7 @@
public class ODataResponse {
private int statusCode = HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode();
- private Map<String, String> headers = new HashMap<String, String>();
+ private final HttpHeaders headers = new HttpHeaders();
private InputStream content;
/**
@@ -51,23 +53,77 @@
}
/**
- * Sets a header.
- * @param name the name
- * @param value the value
+ * <p>Set a header to the response.</p>
+ * <p>The header name will be handled as case-insensitive key.</p>
+ * <p>If a header already exists then the header will be replaced by this new value.</p>
+ * @param name case-insensitive header name
+ * @param value value for the given header name
+ * @see <a href="http://ietf.org/rfc/rfc7230.txt">RFC 7230, section 3.2.2</a>
*/
public void setHeader(final String name, final String value) {
- headers.put(name, value);
+ headers.setHeader(name, value);
}
/**
- * Gets all headers.
+ * <p>Adds a header to the response.</p>
+ * <p>The header name will be handled as case-insensitive key.</p>
+ * <p>If a header already exists then the list of values will just be extended.</p>
+ * @param name case-insensitive header name
+ * @param value value for the given header name
+ * @see <a href="http://ietf.org/rfc/rfc7230.txt">RFC 7230, section 3.2.2</a>
+ */
+ public void addHeader(final String name, final String value) {
+ headers.setHeader(name, value);
+ }
+
+ /**
+ * <p>Adds a header to the response.</p>
+ * <p>The header name will be handled as case-insensitive key.</p>
+ * <p>If a header already exists then the list of values will just be extended.</p>
+ * @param name case-insensitive header name
+ * @param values list of values for the given header name
+ * @see <a href="http://ietf.org/rfc/rfc7230.txt">RFC 7230, section 3.2.2</a>
+ */
+ public void addHeader(final String name, final List<String> values) {
+ headers.addHeader(name, values);
+ }
+
+ /**
+ * Get all headers with the according values.
+ *
* @return an unmodifiable Map of header names/values
*/
- public Map<String, String> getHeaders() {
- return Collections.unmodifiableMap(headers);
+ public Map<String, List<String>> getAllHeaders() {
+ return headers.getHeaderToValues();
}
/**
+ * Gets header value for a given name.
+ * @param name the header name as a case-insensitive key
+ * @return the header value(s) or null if not found
+ */
+ public List<String> getHeaders(final String name) {
+ HttpHeader h = headers.getHeader(name);
+ if(h == null) {
+ return null;
+ }
+ return new ArrayList<String>(h.getValues());
+ }
+
+ /**
+ * Gets first header value for a given name.
+ * If header name is not known <code>null</code> is returned.
+ *
+ * @param name the header name as a case-insensitive key
+ * @return the first header value or null if not found
+ */
+ public String getHeader(final String name) {
+ final List<String> values = getHeaders(name);
+ return values == null ? null : values.get(0);
+ }
+
+
+ /**
* Sets the content (body).
* @param content the content as {@link InputStream}
*/
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java
index 9365d7e..b9c6dcb 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java
@@ -22,11 +22,11 @@
import java.util.Locale;
import java.util.Map;
-import org.apache.olingo.commons.api.ODataError;
-import org.apache.olingo.commons.api.ODataErrorDetail;
+import org.apache.olingo.commons.api.ex.ODataError;
+import org.apache.olingo.commons.api.ex.ODataErrorDetail;
/**
- * Server error.
+ * Class to hold all server relevant error information.
*/
public class ODataServerError extends ODataError {
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchDeserializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchDeserializerException.java
deleted file mode 100644
index b00ae53..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchDeserializerException.java
+++ /dev/null
@@ -1,65 +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.server.api.batch.exception;
-
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-
-public class BatchDeserializerException extends DeserializerException {
- public static enum MessageKeys implements MessageKey {
- INVALID_BOUNDARY,
- INVALID_CHANGESET_METHOD,
- INVALID_CONTENT,
- INVALID_CONTENT_LENGTH,
- INVALID_CONTENT_TRANSFER_ENCODING,
- INVALID_CONTENT_TYPE,
- INVALID_HEADER,
- INVALID_HTTP_VERSION,
- INVALID_METHOD,
- INVALID_QUERY_OPERATION_METHOD,
- INVALID_STATUS_LINE,
- INVALID_URI,
- MISSING_BLANK_LINE,
- MISSING_BOUNDARY_DELIMITER,
- MISSING_CLOSE_DELIMITER,
- MISSING_CONTENT_ID,
- MISSING_CONTENT_TRANSFER_ENCODING,
- MISSING_CONTENT_TYPE,
- MISSING_MANDATORY_HEADER,
- FORBIDDEN_HEADER,
- INVALID_BASE_URI;
-
- @Override
- public String getKey() {
- return name();
- }
- }
-
- private static final long serialVersionUID = -907752788975531134L;
-
- public BatchDeserializerException(final String developmentMessage, final MessageKey messageKey,
- final int lineNumber) {
- this(developmentMessage, messageKey, "" + lineNumber);
- }
-
- public BatchDeserializerException(final String developmentMessage, final MessageKey messageKey,
- final String... parameters) {
- super(developmentMessage, messageKey, parameters);
- }
-
-}
\ No newline at end of file
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchSerializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchSerializerException.java
deleted file mode 100644
index 9a645a1..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchSerializerException.java
+++ /dev/null
@@ -1,46 +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.server.api.batch.exception;
-
-import org.apache.olingo.server.api.serializer.SerializerException;
-
-public class BatchSerializerException extends SerializerException {
-
- private static final long serialVersionUID = 2634433974342796905L;
-
- public static enum MessageKeys implements MessageKey {
- MISSING_CONTENT_ID;
-
- @Override
- public String getKey() {
- return name();
- }
- }
-
- public BatchSerializerException(final String developmentMessage, final MessageKey messageKey,
- final String... parameters) {
- super(developmentMessage, messageKey, parameters);
- }
-
- @Override
- protected String getBundleName() {
- return DEFAULT_SERVER_BUNDLE_NAME;
- }
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugInformation.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugInformation.java
new file mode 100644
index 0000000..2f4e67d
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugInformation.java
@@ -0,0 +1,118 @@
+/*
+ * 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.api.debug;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.uri.UriInfo;
+
+/**
+ * This class contains all information necessary to construct a debug response.
+ */
+public class DebugInformation {
+
+ private ODataRequest request;
+ private ODataResponse applicationResponse;
+ private UriInfo uriInfo;
+ private Exception exception;
+ private Map<String, String> serverEnvironmentVariables;
+ private List<RuntimeMeasurement> runtimeInformation;
+
+ /**
+ * This method will return the ODataRequest the library created. This request will never be null but might be filled
+ * incompletely if there has been an exception during the request parsing.
+ * @return the ODataRequest the library built
+ */
+ public ODataRequest getRequest() {
+ return request;
+ }
+
+ public void setRequest(ODataRequest request) {
+ this.request = request;
+ }
+
+ /**
+ * This method will return the ODataResponse which was filled by the Application or the library in an exception case.
+ * The response might be null or might not be filled completely.
+ * @return the response filled by the application
+ */
+ public ODataResponse getApplicationResponse() {
+ return applicationResponse;
+ }
+
+ public void setApplicationResponse(ODataResponse applicationResponse) {
+ this.applicationResponse = applicationResponse;
+ }
+
+ /**
+ * The URI Info object the library created during URI parsing. Might be null if there was an exception during URI
+ * parsing.
+ * @return the URI Info Object
+ */
+ public UriInfo getUriInfo() {
+ return uriInfo;
+ }
+
+ public void setUriInfo(UriInfo uriInfo) {
+ this.uriInfo = uriInfo;
+ }
+
+ /**
+ * This method will return any exception that was thrown from the application or library. Will be null if there was no
+ * exception.
+ * @return an exception if thrown.
+ */
+ public Exception getException() {
+ return exception;
+ }
+
+ public void setException(Exception exception) {
+ this.exception = exception;
+ }
+
+ /**
+ * A map containing information about the runtime environment. Depending on the servlet or webserver used this map
+ * might contain different information. Will never be null but might be empty.
+ * @return environment variables
+ */
+ public Map<String, String> getServerEnvironmentVariables() {
+ return serverEnvironmentVariables;
+ }
+
+ public void setServerEnvironmentVariables(Map<String, String> serverEnvironmentVariables) {
+ this.serverEnvironmentVariables = serverEnvironmentVariables;
+ }
+
+ /**
+ * This method will return all runtime information which was collected inside the library. Might be null if no data
+ * could be collected.
+ * @return runtime information collected by the library
+ */
+ public List<RuntimeMeasurement> getRuntimeInformation() {
+ return runtimeInformation;
+ }
+
+ public void setRuntimeInformation(List<RuntimeMeasurement> runtimeInformation) {
+ this.runtimeInformation = runtimeInformation;
+ }
+
+}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugResponseHelper.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugResponseHelper.java
new file mode 100644
index 0000000..e2f6933
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugResponseHelper.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.api.debug;
+
+import org.apache.olingo.server.api.ODataResponse;
+
+/**
+ * This class supports applications in creating debug responses.
+ */
+public interface DebugResponseHelper {
+
+ /**
+ * Creates a debug response based on the given parameters. Will never throw an exception.
+ * @param request
+ * @param applicationResponse
+ * @param exception
+ * @param serverEnvironmentVaribles
+ * @param runtimeInformation
+ * @return the debug response or the raw application response in case an exception occurred.
+ */
+ ODataResponse createDebugResponse(DebugInformation debugInfo);
+}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugSupport.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugSupport.java
new file mode 100644
index 0000000..34527b9
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugSupport.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.api.debug;
+
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataResponse;
+
+/**
+ * Register this interface to add debug support to your service.
+ */
+public interface DebugSupport {
+
+ public static final String ODATA_DEBUG_QUERY_PARAMETER = "odata-debug";
+ public static final String ODATA_DEBUG_JSON = "json";
+ public static final String ODATA_DEBUG_HTML = "html";
+ public static final String ODATA_DEBUG_DOWNLOAD = "download";
+
+ /**
+ * Initializes the debug support implementation.
+ * Is called before {@link #isUserAuthorized()} and
+ * {@link #createDebugResponse(String, DebugInformation)}.
+ * @param odata
+ */
+ void init(OData odata);
+
+ /**
+ * Ensures that the user that requested the debug output is authorized to see this output.
+ * @return true if the current user is authorized
+ */
+ boolean isUserAuthorized();
+
+ /**
+ * Creates a debug response and delivers it back to the Olingo library.
+ * This method MUST NEVER throw an exception.
+ * @param debugFormat the value of the odata-debug query parameter
+ * @param debugInfo all necessary information to construct debug output
+ * @return a new debug response which will be sent to the client
+ */
+ ODataResponse createDebugResponse(String debugFormat, DebugInformation debugInfo);
+
+}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DefaultDebugSupport.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DefaultDebugSupport.java
new file mode 100644
index 0000000..7079e76
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DefaultDebugSupport.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.api.debug;
+
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataResponse;
+
+/**
+ * Supports the default debug case. Will always deliver a debug response if requested from the server.
+ */
+public class DefaultDebugSupport implements DebugSupport {
+
+ private OData odata;
+
+ @Override
+ public void init(OData odata) {
+ this.odata = odata;
+ }
+
+ @Override
+ public boolean isUserAuthorized() {
+ return true;
+ }
+
+ @Override
+ public ODataResponse createDebugResponse(String debugFormat, DebugInformation debugInfo) {
+ // Check if debugFormat is supported by the library
+ if (DebugSupport.ODATA_DEBUG_JSON.equalsIgnoreCase(debugFormat)
+ || DebugSupport.ODATA_DEBUG_HTML.equalsIgnoreCase(debugFormat)
+ || DebugSupport.ODATA_DEBUG_DOWNLOAD.equalsIgnoreCase(debugFormat)) {
+ return odata.createDebugResponseHelper(debugFormat).createDebugResponse(debugInfo);
+ } else {
+ // Debug format is not supported by the library by default so in order to avoid an exception we will just give
+ // back the original response from the application.
+ return debugInfo.getApplicationResponse();
+ }
+ }
+
+}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/RuntimeMeasurement.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/RuntimeMeasurement.java
new file mode 100644
index 0000000..69e30da
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/RuntimeMeasurement.java
@@ -0,0 +1,106 @@
+/*
+ * 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.api.debug;
+
+/**
+ * <p>Runtime measurements.</p>
+ * <p>All times are in nanoseconds since some fixed but arbitrary time
+ * (perhaps in the future, so values may be negative).</p>
+ * @see System#nanoTime()
+ */
+public class RuntimeMeasurement {
+
+ private String className;
+ private String methodName;
+ private long timeStarted;
+ private long timeStopped;
+
+ /**
+ * Sets the class name.
+ * @param className the name of the class that is measured
+ */
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ /**
+ * Gets the class name.
+ * @return the name of the class that is measured
+ */
+ public String getClassName() {
+ return className;
+ };
+
+ /**
+ * Sets the method name.
+ * @param methodName the name of the method that is measured
+ */
+ public void setMethodName(String methodName) {
+ this.methodName = methodName;
+ }
+
+ /**
+ * Gets the method name.
+ * @return the name of the method that is measured
+ */
+ public String getMethodName() {
+ return methodName;
+ }
+
+ /**
+ * Sets the start time.
+ * @param timeStarted the start time in nanoseconds
+ * @see System#nanoTime()
+ */
+ public void setTimeStarted(long timeStarted) {
+ this.timeStarted = timeStarted;
+ }
+
+ /**
+ * Gets the start time.
+ * @return the start time in nanoseconds or 0 if not set yet
+ * @see System#nanoTime()
+ */
+ public long getTimeStarted() {
+ return timeStarted;
+ }
+
+ /**
+ * Sets the stop time.
+ * @param timeStopped the stop time in nanoseconds
+ * @see System#nanoTime()
+ */
+ public void setTimeStopped(long timeStopped) {
+ this.timeStopped = timeStopped;
+ }
+
+ /**
+ * Gets the stop time.
+ * @return the stop time in nanoseconds or 0 if not set yet
+ * @see System#nanoTime()
+ */
+ public long getTimeStopped() {
+ return timeStopped;
+ }
+
+ @Override
+ public String toString() {
+ return className + "." + methodName + ": duration: " + (timeStopped - timeStarted);
+ }
+}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java
index bded690..22dd711 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java
@@ -22,7 +22,7 @@
import java.util.List;
import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
import org.apache.olingo.server.api.deserializer.batch.BatchOptions;
import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
@@ -42,6 +42,13 @@
*/
public Object primitiveValue(InputStream content, EdmProperty property) throws DeserializerException;
+ /**
+ * Reads batch data from an InputStream.
+ * @param content the data as multipart input stream
+ * @param boundary the boundary between the parts
+ * @param options options for the deserializer
+ * @return a list of batch-request parts
+ */
public List<BatchRequestPart> parseBatchRequest(InputStream content, String boundary, BatchOptions options)
throws BatchDeserializerException;
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerException.java
new file mode 100644
index 0000000..fbc958b
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerException.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.server.api.deserializer.batch;
+
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+
+public class BatchDeserializerException extends DeserializerException {
+ public static enum MessageKeys implements MessageKey {
+ INVALID_BOUNDARY,
+ INVALID_CHANGESET_METHOD,
+ INVALID_CONTENT,
+ INVALID_CONTENT_LENGTH,
+ INVALID_CONTENT_TRANSFER_ENCODING,
+ INVALID_CONTENT_TYPE,
+ INVALID_HEADER,
+ INVALID_HTTP_VERSION,
+ INVALID_METHOD,
+ INVALID_QUERY_OPERATION_METHOD,
+ INVALID_STATUS_LINE,
+ INVALID_URI,
+ MISSING_BLANK_LINE,
+ MISSING_BOUNDARY_DELIMITER,
+ MISSING_CLOSE_DELIMITER,
+ MISSING_CONTENT_ID,
+ MISSING_CONTENT_TRANSFER_ENCODING,
+ MISSING_CONTENT_TYPE,
+ MISSING_MANDATORY_HEADER,
+ FORBIDDEN_HEADER,
+ INVALID_BASE_URI;
+
+ @Override
+ public String getKey() {
+ return name();
+ }
+ }
+
+ private static final long serialVersionUID = -907752788975531134L;
+
+ /**
+ * Creates batch deserializer exception.
+ * @param developmentMessage message text as fallback and for debugging purposes
+ * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle
+ * @param parameters parameters for the exception text
+ */
+ public BatchDeserializerException(final String developmentMessage, final MessageKey messageKey,
+ final String... parameters) {
+ super(developmentMessage, messageKey, parameters);
+ }
+
+ /**
+ * Creates batch deserializer exception.
+ * @param developmentMessage message text as fallback and for debugging purposes
+ * @param cause the cause of this exception
+ * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle
+ * @param parameters parameters for the exception text
+ */
+ public BatchDeserializerException(final String developmentMessage, final Throwable cause,
+ final MessageKey messageKey, final String... parameters) {
+ super(developmentMessage, cause, messageKey, parameters);
+ }
+}
\ No newline at end of file
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java
index 0873e23..98b0f10 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java
@@ -24,7 +24,7 @@
* {@link org.apache.olingo.server.api.deserializer.FixedFormatDeserializer
* #parseBatchRequest(java.io.InputStream, String, BatchOptions)}
*/
-public class BatchOptions {
+public final class BatchOptions {
private boolean isStrict = true;
private String rawBaseUri = "";
private String rawServiceResolutionUri = "";
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/ODataResponsePart.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/ODataResponsePart.java
index 56c0084..8b0bd52 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/ODataResponsePart.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/ODataResponsePart.java
@@ -24,23 +24,23 @@
import org.apache.olingo.server.api.ODataResponse;
/**
- * An ODataResponsePart represents a collections of ODataResponses.
+ * An ODataResponsePart represents a collection of ODataResponses.
* A list of ODataResponseParts can be combined by the BatchSerializer to a single
* OData batch response.
*/
public class ODataResponsePart {
- private List<ODataResponse> responses;
- private boolean isChangeSet;
+ private final List<ODataResponse> responses;
+ private final boolean isChangeSet;
/**
* Creates a new ODataResponsePart.
*
- * An ODataResponsePart represents a collections of ODataResponses.
+ * An ODataResponsePart represents a collection of ODataResponses.
* A list of ODataResponseParts can be combined by the BatchSerializer to a single
* OData batch response.
*
* @param responses A list of {@link ODataResponse}
- * @param isChangeSet True this ODataResponsePart represents a change set, otherwise false
+ * @param isChangeSet whether this ODataResponsePart represents a change set
*/
public ODataResponsePart(final List<ODataResponse> responses, final boolean isChangeSet) {
this.responses = responses;
@@ -50,12 +50,12 @@
/**
* Creates a new ODataResponsePart.
*
- * An ODataResponsePart represents a collections of ODataResponses.
+ * An ODataResponsePart represents a collection of ODataResponses.
* A list of ODataResponseParts can be combined by the BatchSerializer to a single
* OData batch response.
*
* @param response A single {@link ODataResponse}
- * @param isChangeSet True this ODataResponsePart represents a change set, otherwise false
+ * @param isChangeSet whether this ODataResponsePart represents a change set
*/
public ODataResponsePart(final ODataResponse response, final boolean isChangeSet) {
responses = Arrays.asList(response);
@@ -63,21 +63,18 @@
}
/**
- * Returns true if the current instance represents a change set.
- *
- * @return true or false
+ * Returns a collection of ODataResponses.
+ * Each collection contains at least one {@link ODataResponse}.
+ * If this instance represents a change set, there may be many ODataResponses.
+ * @return a list of {@link ODataResponse}
*/
public List<ODataResponse> getResponses() {
return responses;
}
/**
- * Returns a collection of ODataResponses.
- * Each collections contains at least one {@link ODataResponse}.
- *
- * If this instance represents a change set, there are may many ODataResponses
- *
- * @return a list of {@link ODataResponse}
+ * Returns true if the current instance represents a change set.
+ * @return true or false
*/
public boolean isChangeSet() {
return isChangeSet;
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/PreconditionException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/PreconditionException.java
index 8e9c84f..efa606c 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/PreconditionException.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/PreconditionException.java
@@ -20,6 +20,9 @@
import org.apache.olingo.server.api.ODataLibraryException;
+/**
+ * This exception is thrown for invalid precondition error cases.
+ */
public class PreconditionException extends ODataLibraryException {
private static final long serialVersionUID = -8112658467394158700L;
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/ServiceMetadataETagSupport.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/ServiceMetadataETagSupport.java
index 76e60f2..430fce5 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/ServiceMetadataETagSupport.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/etag/ServiceMetadataETagSupport.java
@@ -18,6 +18,9 @@
*/
package org.apache.olingo.server.api.etag;
+/**
+ * Register implementations for this interface in oder to support etags for the metadata document and service document.
+ */
public interface ServiceMetadataETagSupport {
/**
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/package-info.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/package-info.java
new file mode 100644
index 0000000..2cdb677
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/package-info.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+/**
+ * Olingo Server API
+ * <p>
+ * OData Library is a protocol implementation of the OData V4.0 standard. For details of this standard
+ * see <a href="http://odata.org">odata.org</a>.
+ * <p>
+ * This API is intended to help implement an OData service. An OData service consists of a metadata provider
+ * implementation and an OData processor implementation.
+ * <p>
+ * An OData service can be exposed by a web application using the standard java servlet API. See the Olingo tutorials
+ * section on how to implement a V4 service for further information:
+ * <a href="http://olingo.apache.org/doc/odata4/index.html">http://olingo.apache.org/doc/odata4/index.html
+ * <p>
+ * The main entry point is the org.apache.olingo.server.api.OData class. Use the newInstance() method to create a new
+ * object and start providing your service from there.
+ *
+ */
+package org.apache.olingo.server.api;
+
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/prefer/Preferences.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/prefer/Preferences.java
new file mode 100644
index 0000000..2050474
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/prefer/Preferences.java
@@ -0,0 +1,110 @@
+/*
+ * 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.api.prefer;
+
+import java.net.URI;
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * Provides access methods to the preferences set in Prefer HTTP request headers
+ * as described in <a href="https://www.ietf.org/rfc/rfc7240.txt">RFC 7240</a>.
+ * Preferences defined in the OData standard can be accessed with named methods.
+ */
+public interface Preferences {
+
+ /**
+ * Gets named preference. Names are case insensitive.
+ * @param name name of the preference
+ * @return {@link Preference} or <code>null</code> if no such preference has been set
+ */
+ public Preference getPreference(String name);
+
+ /** Whether the preference <code>odata.allow-entityreferences</code> has been set. */
+ public boolean hasAllowEntityReferences();
+
+ /**
+ * Gets the value of the <code>url</code> parameter of the preference
+ * <code>odata.callback</code> or <code>null</code> if not set or the URI is not valid.
+ * @return the callback URI
+ */
+ public URI getCallback();
+
+ /** Whether the preference <code>odata.continue-on-error</code> has been set. */
+ public boolean hasContinueOnError();
+
+ /**
+ * Gets the value of the preference <code>odata.maxpagesize</code>
+ * or <code>null</code> if not set or an invalid value has been set.
+ * @return the page size for server-driven paging
+ */
+ public Integer getMaxPageSize();
+
+ /** Whether the preference <code>odata.track-changes</code> has been set. */
+ public boolean hasTrackChanges();
+
+ public enum Return { REPRESENTATION, MINIMAL }
+ /**
+ * Gets the value of the preference <code>return</code> or <code>null</code> if not set
+ * or the value is not valid.
+ */
+ public Return getReturn();
+
+ /** Whether the preference <code>respond-async</code> has been set. */
+ public boolean hasRespondAsync();
+
+ /**
+ * Gets the value of the preference <code>wait</code> or <code>null</code> if not set
+ * or the value is not valid.
+ * @return the number of seconds the client is prepared to wait for the service
+ * to process the request synchronously
+ */
+ public Integer getWait();
+
+ /** Generic preference object. */
+ public class Preference {
+ private final String value;
+ private final Map<String, String> parameters;
+
+ public Preference(final String value, final Map<String, String> parameters) {
+ this.value = value;
+ this.parameters = parameters;
+ }
+
+ /**
+ * Gets the value of the preference. It may be <code>null</code> if the preference has
+ * no value; this is not the same as the preference not set.
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Gets the parameters of the preference. The value of a parameter may be
+ * <code>null</code> if the parameter has no value; this is not the same as
+ * the parameter not set. Parameter names are all lowercase.
+ * @return a map from parameter names to parameter values
+ */
+ public Map<String, String> getParameters() {
+ return parameters == null ?
+ Collections.<String, String> emptyMap() :
+ Collections.unmodifiableMap(parameters);
+ }
+ }
+}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/prefer/PreferencesApplied.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/prefer/PreferencesApplied.java
new file mode 100644
index 0000000..5aa04c1
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/prefer/PreferencesApplied.java
@@ -0,0 +1,180 @@
+/*
+ * 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.api.prefer;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.olingo.commons.api.format.PreferenceName;
+import org.apache.olingo.server.api.prefer.Preferences.Return;
+
+/**
+ * Provides methods to set values suitable for the Preference-Applied HTTP response header
+ * as described in <a href="https://www.ietf.org/rfc/rfc7240.txt">RFC 7240</a>.
+ * There are named methods for preferences defined in the OData standard.
+ */
+public final class PreferencesApplied {
+
+ private static final Set<String> SAFE_PREFERENCE_NAMES = new HashSet<String>();
+ private Map<String, String> applied;
+
+ private PreferencesApplied() {
+ applied = new LinkedHashMap<String, String>();
+ }
+
+ /**
+ * Gets the applied preferences.
+ * @return a map from preference names to preference values
+ */
+ public Map<String, String> getAppliedPreferences() {
+ return Collections.unmodifiableMap(applied);
+ }
+
+ /** Returns a string representation that can be used as value of a Preference-Applied HTTP response header. */
+ public String toValueString() {
+ StringBuilder result = new StringBuilder();
+ for (final Map.Entry<String, String> entry : applied.entrySet()) {
+ if (result.length() > 0) {
+ result.append(',').append(' ');
+ }
+ final String key = entry.getKey();
+ result.append(key);
+ if (entry.getValue() != null) {
+ final boolean safe = isSafe(key);
+ result.append('=')
+ .append(safe ? "" : '"')
+ .append(entry.getValue().replaceAll("\\\\|\"", "\\\\$0"))
+ .append(safe ? "" : '"');
+ }
+ }
+ return result.toString();
+ }
+
+ private boolean isSafe(String key) {
+ if(SAFE_PREFERENCE_NAMES.isEmpty()) {
+ SAFE_PREFERENCE_NAMES.add(PreferenceName.ALLOW_ENTITY_REFERENCES.getName());
+ SAFE_PREFERENCE_NAMES.add(PreferenceName.CALLBACK.getName());
+ SAFE_PREFERENCE_NAMES.add(PreferenceName.CONTINUE_ON_ERROR.getName());
+ SAFE_PREFERENCE_NAMES.add(PreferenceName.MAX_PAGE_SIZE.getName());
+ SAFE_PREFERENCE_NAMES.add(PreferenceName.TRACK_CHANGES.getName());
+ SAFE_PREFERENCE_NAMES.add(PreferenceName.RETURN.getName());
+ SAFE_PREFERENCE_NAMES.add(PreferenceName.RESPOND_ASYNC.getName());
+ SAFE_PREFERENCE_NAMES.add(PreferenceName.WAIT.getName());
+ }
+ return SAFE_PREFERENCE_NAMES.contains(key);
+ }
+
+ @Override
+ public String toString() {
+ return toValueString();
+ }
+
+ /** Initializes the builder. */
+ public static Builder with() {
+ return new Builder();
+ }
+
+ /** Builder of OData serializer options. */
+ public static final class Builder {
+
+ private final PreferencesApplied preferencesApplied;
+
+ private Builder() {
+ preferencesApplied = new PreferencesApplied();
+ }
+
+ /** Sets <code>odata.allow-entityreferences</code>. */
+ public Builder allowEntityReferences() {
+ add(PreferenceName.ALLOW_ENTITY_REFERENCES.getName(), null);
+ return this;
+ }
+
+ /** Sets <code>odata.callback</code>. */
+ public Builder callback() {
+ add(PreferenceName.CALLBACK.getName(), null);
+ return this;
+ }
+
+ /** Sets <code>odata.continue-on-error</code>. */
+ public Builder continueOnError() {
+ add(PreferenceName.CONTINUE_ON_ERROR.getName(), null);
+ return this;
+ }
+
+ /** Sets the value of the applied preference <code>odata.maxpagesize</code>. */
+ public Builder maxPageSize(final Integer maxPageSize) {
+ add(PreferenceName.MAX_PAGE_SIZE.getName(), Integer.toString(maxPageSize));
+ return this;
+ }
+
+ /** Sets <code>odata.track-changes</code>. */
+ public Builder trackChanges() {
+ add(PreferenceName.TRACK_CHANGES.getName(), null);
+ return this;
+ }
+
+ /** Sets the value of the applied preference <code>return</code>. */
+ public Builder returnRepresentation(final Return returnRepresentation) {
+ add(PreferenceName.RETURN.getName(), returnRepresentation.name().toLowerCase(Locale.ROOT));
+ return this;
+ }
+
+ /** Sets <code>odata.respond-async</code>. */
+ public Builder respondAsync() {
+ add(PreferenceName.RESPOND_ASYNC.getName(), null);
+ return this;
+ }
+
+ /** Sets the value of the applied preference <code>wait</code>. */
+ public Builder waitPreference(final Integer wait) {
+ add(PreferenceName.WAIT.getName(), Integer.toString(wait));
+ return this;
+ }
+
+ /**
+ * Sets an arbitrary preference as applied.
+ * The preference name is converted to lowercase.
+ * The value of this preference may be <code>null</code>.
+ * Name and value are not checked for validity.
+ * @param name preference name
+ * @param value preference value
+ */
+ public Builder preference(final String name, final String value) {
+ if (name != null) {
+ add(name.toLowerCase(Locale.ROOT), value);
+ }
+ return this;
+ }
+
+ /** Builds the applied preferences. */
+ public PreferencesApplied build() {
+ return preferencesApplied;
+ }
+
+ private void add(final String name, final String value) {
+ if (!preferencesApplied.applied.containsKey(name)) {
+ preferencesApplied.applied.put(name, value);
+ }
+ }
+ }
+}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java
index c209764..46c7d88 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java
@@ -19,9 +19,9 @@
package org.apache.olingo.server.api.processor;
import java.io.ByteArrayInputStream;
+import java.nio.charset.Charset;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -72,7 +72,7 @@
if (isNotModified) {
response.setStatusCode(HttpStatusCode.NOT_MODIFIED.getStatusCode());
} else {
- ODataSerializer serializer = odata.createSerializer(ODataFormat.fromContentType(requestedContentType));
+ ODataSerializer serializer = odata.createSerializer(requestedContentType);
response.setContent(serializer.serviceDocument(serviceMetadata, null).getContent());
response.setStatusCode(HttpStatusCode.OK.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
@@ -97,7 +97,7 @@
if (isNotModified) {
response.setStatusCode(HttpStatusCode.NOT_MODIFIED.getStatusCode());
} else {
- ODataSerializer serializer = odata.createSerializer(ODataFormat.fromContentType(requestedContentType));
+ ODataSerializer serializer = odata.createSerializer(requestedContentType);
response.setContent(serializer.metadataDocument(serviceMetadata).getContent());
response.setStatusCode(HttpStatusCode.OK.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
@@ -109,7 +109,7 @@
final ODataServerError serverError,
final ContentType requestedContentType) {
try {
- ODataSerializer serializer = odata.createSerializer(ODataFormat.fromContentType(requestedContentType));
+ ODataSerializer serializer = odata.createSerializer(requestedContentType);
response.setContent(serializer.error(serverError).getContent());
response.setStatusCode(serverError.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
@@ -117,7 +117,7 @@
// This should never happen but to be sure we have this catch here to prevent sending a stacktrace to a client.
String responseContent =
"{\"error\":{\"code\":null,\"message\":\"An unexpected exception occurred during error processing\"}}";
- response.setContent(new ByteArrayInputStream(responseContent.getBytes()));
+ response.setContent(new ByteArrayInputStream(responseContent.getBytes(Charset.forName("utf-8"))));
response.setStatusCode(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_JSON.toContentTypeString());
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java
index 00058a6..c58d25d 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java
@@ -36,6 +36,6 @@
* @param serverError the server error
* @param responseFormat requested content type after content negotiation
*/
- public void processError(ODataRequest request, ODataResponse response, ODataServerError serverError,
+ void processError(ODataRequest request, ODataResponse response, ODataServerError serverError,
ContentType responseFormat);
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/package-info.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/package-info.java
new file mode 100644
index 0000000..bc21fd0
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/package-info.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+/**
+ * Olingo Processors
+ * <p>
+ * Processors are used to handle OData requests and send back the OData reponse. Before a specific processor is called
+ * the Olingo library will parse the URI and validate it. Afterwards the Processor which matches the return type is
+ * called. E.g.: If a primitive property is requested by the URI we will call the PrimitveProcessor.read method.
+ * <p>
+ * Processors can be registered at the {@link org.apache.olingo.server.api.ODataHttpHandler} object. Per default we will
+ * have the {@link org.apache.olingo.server.api.processor.DefaultProcessor} registered to perform basic functionality
+ * like delivering the metadata and service document as well as rendering an OData error.
+ * <br>In case an application would like to perform custom tasks for these cases a new
+ * {@link org.apache.olingo.server.api.processor.ServiceDocumentProcessor} can be registered in order to overwrite the
+ * default behaviour.
+ */
+package org.apache.olingo.server.api.processor;
+
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/BatchSerializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/BatchSerializerException.java
new file mode 100644
index 0000000..ddef3ae
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/BatchSerializerException.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.server.api.serializer;
+
+
+/**
+ * Thrown for invalid batch payloads.
+ */
+public class BatchSerializerException extends SerializerException {
+
+ private static final long serialVersionUID = 2634433974342796905L;
+
+ public enum MessageKeys implements MessageKey {
+ MISSING_CONTENT_ID;
+
+ @Override
+ public String getKey() {
+ return name();
+ }
+ }
+
+ public BatchSerializerException(final String developmentMessage, final MessageKey messageKey,
+ final String... parameters) {
+ super(developmentMessage, messageKey, parameters);
+ }
+
+ @Override
+ protected String getBundleName() {
+ return DEFAULT_SERVER_BUNDLE_NAME;
+ }
+
+}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ComplexSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ComplexSerializerOptions.java
index b89dac8..99c6926 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ComplexSerializerOptions.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ComplexSerializerOptions.java
@@ -28,7 +28,7 @@
private ContextURL contextURL;
private ExpandOption expand;
private SelectOption select;
-
+
/** Gets the {@link ContextURL}. */
public ContextURL getContextURL() {
return contextURL;
@@ -43,7 +43,7 @@
public SelectOption getSelect() {
return select;
}
-
+
private ComplexSerializerOptions() {}
/** Initializes the options builder. */
@@ -77,7 +77,7 @@
options.select = select;
return this;
}
-
+
/** Builds the OData serializer options. */
public ComplexSerializerOptions build() {
return options;
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntityCollectionSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntityCollectionSerializerOptions.java
index bbfe1bf..0eab699 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntityCollectionSerializerOptions.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntityCollectionSerializerOptions.java
@@ -31,6 +31,7 @@
private ExpandOption expand;
private SelectOption select;
private boolean onlyReferences;
+ private String id;
/** Gets the {@link ContextURL}. */
public ContextURL getContextURL() {
@@ -56,6 +57,11 @@
public boolean onlyReferences() {
return onlyReferences;
}
+
+ /** Gets the id of the entity collection */
+ public String getId() {
+ return id;
+ }
/** Initializes the options builder. */
public static Builder with() {
@@ -100,6 +106,12 @@
options.onlyReferences = ref;
return this;
}
+
+ /** Sets id of the collection */
+ public Builder setId(final String id) {
+ options.id = id;
+ return this;
+ }
/** Builds the OData serializer options. */
public EntityCollectionSerializerOptions build() {
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntitySerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntitySerializerOptions.java
index 563b058..db73c43 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntitySerializerOptions.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntitySerializerOptions.java
@@ -28,7 +28,7 @@
private ExpandOption expand;
private SelectOption select;
private boolean onlyReferences;
-
+
/** Gets the {@link ContextURL}. */
public ContextURL getContextURL() {
return contextURL;
@@ -88,7 +88,7 @@
options.onlyReferences = ref;
return this;
}
-
+
/** Builds the OData serializer options. */
public EntitySerializerOptions build() {
return options;
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java
index fc41c73..42b6efd 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java
@@ -22,7 +22,7 @@
import java.util.List;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.server.api.batch.exception.BatchSerializerException;
+import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
/** OData serializer for fixed output formats. */
@@ -50,11 +50,17 @@
throws SerializerException;
/**
- * Serializes a batch response
- * @param batchResponses
- * @param boundary
+ * Serializes a batch response.
+ * @param batchResponses the response parts
+ * @param boundary the boundary between the parts
* @return response as an input stream
- * @throws BatchSerializerException
*/
InputStream batchResponse(List<ODataResponsePart> batchResponses, String boundary) throws BatchSerializerException;
+
+ /**
+ * Serializes a ODataResponse into an async response.
+ * @param odataResponse the response parts
+ * @return response as an input stream
+ */
+ InputStream asyncResponse(ODataResponse odataResponse) throws SerializerException;
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java
index 3727064..21066bb 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java
@@ -18,7 +18,6 @@
*/
package org.apache.olingo.server.api.serializer;
-import org.apache.olingo.commons.api.data.ContextURL;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Property;
@@ -119,18 +118,18 @@
* @param metadata metadata for the service
* @param edmEntitySet {@link EdmEntitySet}
* @param entity data of the entity
- * @param contextURL {@link ContextURL}
+ * @param options {@link ReferenceSerializerOptions}
*/
- SerializerResult reference(ServiceMetadata metadata, EdmEntitySet edmEntitySet, Entity entity,
- ContextURL contextURL) throws SerializerException;
-
+ SerializerResult reference(ServiceMetadata metadata, EdmEntitySet edmEntitySet, Entity entity,
+ ReferenceSerializerOptions options) throws SerializerException;
+
/**
* Writes entity-collection references into an InputStream.
* @param metadata metadata for the service
* @param edmEntitySet {@link EdmEntitySet}
* @param entityCollection data of the entity collection
- * @param contextURL {@link ContextURL}
+ * @param ReferenceCollectionSerializerOptions {@link ReferenceCollectionSerializerOptions}
*/
- SerializerResult referenceCollection(ServiceMetadata metadata, EdmEntitySet edmEntitySet,
- EntityCollection entityCollection, ContextURL contextURL) throws SerializerException;
+ SerializerResult referenceCollection(ServiceMetadata metadata, EdmEntitySet edmEntitySet,
+ EntityCollection entityCollection, ReferenceCollectionSerializerOptions options) throws SerializerException;
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/PrimitiveSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/PrimitiveSerializerOptions.java
index bd34599..3a507c6 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/PrimitiveSerializerOptions.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/PrimitiveSerializerOptions.java
@@ -22,7 +22,7 @@
import org.apache.olingo.commons.api.edm.EdmProperty;
/** Options for the OData serializer. */
-public class PrimitiveSerializerOptions {
+public final class PrimitiveSerializerOptions {
private ContextURL contextURL;
private Boolean isNullable;
@@ -30,7 +30,7 @@
private Integer precision;
private Integer scale;
private Boolean isUnicode;
-
+
/** Gets the {@link ContextURL}. */
public ContextURL getContextURL() {
return contextURL;
@@ -60,7 +60,7 @@
public Boolean isUnicode() {
return isUnicode;
}
-
+
private PrimitiveSerializerOptions() {}
/** Initializes the options builder. */
@@ -112,7 +112,7 @@
options.isUnicode = isUnicode;
return this;
}
-
+
/** Sets all facets from an EDM property. */
public Builder facetsFrom(final EdmProperty property) {
options.isNullable = property.isNullable();
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceCollectionSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceCollectionSerializerOptions.java
new file mode 100644
index 0000000..2e979e6
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceCollectionSerializerOptions.java
@@ -0,0 +1,71 @@
+/*
+ * 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.api.serializer;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.server.api.uri.queryoption.CountOption;
+
+/** Options for the OData serializer. */
+public final class ReferenceCollectionSerializerOptions {
+ private ContextURL contextURL;
+ private CountOption count;
+
+ /** Gets the {@link ContextURL}. */
+ public ContextURL getContextURL() {
+ return contextURL;
+ }
+
+ /** Gets the $count system query option. */
+ public CountOption getCount() {
+ return count;
+ }
+
+ private ReferenceCollectionSerializerOptions() {}
+
+ /** Initializes the options builder. */
+ public static Builder with() {
+ return new Builder();
+ }
+
+ /** Builder of OData serializer options. */
+ public static final class Builder {
+ private ReferenceCollectionSerializerOptions options;
+
+ public Builder() {
+ options = new ReferenceCollectionSerializerOptions();
+ }
+
+ /** Sets the {@link ContextURL}. */
+ public Builder contextURL(final ContextURL contextURL) {
+ options.contextURL = contextURL;
+ return this;
+ }
+
+ /** Sets the $count system query option. */
+ public Builder count(final CountOption count) {
+ options.count = count;
+ return this;
+ }
+
+ /** Builds the OData serializer options. */
+ public ReferenceCollectionSerializerOptions build() {
+ return options;
+ }
+ }
+}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java
new file mode 100644
index 0000000..e3a82cc
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.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.server.api.serializer;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+
+/**
+ * Use this options calls to pass additional information to the reference serializer.
+ */
+public final class ReferenceSerializerOptions {
+ private ContextURL contextURL;
+
+ /** Gets the {@link ContextURL}. */
+ public ContextURL getContextURL() {
+ return contextURL;
+ }
+
+ private ReferenceSerializerOptions() {}
+
+ /** Initializes the options builder. */
+ public static Builder with() {
+ return new Builder();
+ }
+
+ /** Builder of OData serializer options. */
+ public static final class Builder {
+ private ReferenceSerializerOptions options;
+
+ public Builder() {
+ options = new ReferenceSerializerOptions();
+ }
+
+ /** Sets the {@link ContextURL}. */
+ public Builder contextURL(final ContextURL contextURL) {
+ options.contextURL = contextURL;
+ return this;
+ }
+
+ /** Builds the OData serializer options. */
+ public ReferenceSerializerOptions build() {
+ return options;
+ }
+ }
+}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/SerializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/SerializerException.java
index 8a65976..6db8230 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/SerializerException.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/SerializerException.java
@@ -26,7 +26,8 @@
private static final long serialVersionUID = 5358683245923127425L;
/** Keys for exception texts in the resource bundle. */
- public static enum MessageKeys implements MessageKey {
+ public enum MessageKeys implements MessageKey {
+ NULL_METADATA_OR_EDM,
NOT_IMPLEMENTED,
/** parameter: format */
UNSUPPORTED_FORMAT,
@@ -45,7 +46,9 @@
/** parameters: primitive-type name, value */
WRONG_PRIMITIVE_VALUE,
UNKNOWN_TYPE,
- WRONG_BASE_TYPE;
+ WRONG_BASE_TYPE,
+ /** parameter: encoding-name */
+ UNSUPPORTED_ENCODING;
@Override
public String getKey() {
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfo.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfo.java
index c7f1e7e..d12c524 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfo.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfo.java
@@ -31,22 +31,57 @@
UriInfoService, UriInfoAll, UriInfoBatch, UriInfoCrossjoin,
UriInfoEntityId, UriInfoMetadata, UriInfoResource {
- public UriInfoKind getKind();
+ /**
+ * See {@link UriInfoKind} for more details which kinds are allowed.
+ * @return the kind of this URI info object.
+ */
+ UriInfoKind getKind();
- public UriInfoService asUriInfoService();
+ /**
+ * Convenience casting method.
+ * @return this as a {@link UriInfoService} object
+ */
+ UriInfoService asUriInfoService();
- public UriInfoAll asUriInfoAll();
+ /**
+ * Convenience casting method.
+ * @return this as a {@link UriInfoAll} object
+ */
+ UriInfoAll asUriInfoAll();
- public UriInfoBatch asUriInfoBatch();
+ /**
+ * Convenience casting method.
+ * @return this as a {@link UriInfoBatch} object
+ */
+ UriInfoBatch asUriInfoBatch();
- public UriInfoCrossjoin asUriInfoCrossjoin();
+ /**
+ * Convenience casting method.
+ * @return this as a {@link UriInfoCrossjoin} object
+ */
+ UriInfoCrossjoin asUriInfoCrossjoin();
- public UriInfoEntityId asUriInfoEntityId();
+ /**
+ * Convenience casting method.
+ * @return this as a {@link UriInfoEntityId} object
+ */
+ UriInfoEntityId asUriInfoEntityId();
- public UriInfoMetadata asUriInfoMetadata();
+ /**
+ * Convenience casting method.
+ * @return this as a {@link UriInfoMetadata} object
+ */
+ UriInfoMetadata asUriInfoMetadata();
- public UriInfoResource asUriInfoResource();
+ /**
+ * Convenience casting method.
+ * @return this as a {@link UriInfoResource} object
+ */
+ UriInfoResource asUriInfoResource();
- public Collection<SystemQueryOption> getSystemQueryOptions();
-
+ /**
+ * A collection of all system query options which were in the URI.
+ * @return a collection of all system query options used.
+ */
+ Collection<SystemQueryOption> getSystemQueryOptions();
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoEntityId.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoEntityId.java
index 6736ddc..2579b6d 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoEntityId.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoEntityId.java
@@ -36,33 +36,32 @@
/**
* @return List of custom query options used in the URI
*/
- public List<CustomQueryOption> getCustomQueryOptions();
+ List<CustomQueryOption> getCustomQueryOptions();
/**
* Behind $entity a optional type cast can be used in the URI.
* For example: http://.../serviceroot/$entity/namespace.entitytype
* @return Type cast if found, otherwise null
*/
- public EdmEntityType getEntityTypeCast();
+ EdmEntityType getEntityTypeCast();
/**
* @return Object containing information of the $expand option
*/
- public ExpandOption getExpandOption();
+ ExpandOption getExpandOption();
/**
* @return Object containing information of the $format option
*/
- public FormatOption getFormatOption();
+ FormatOption getFormatOption();
/**
* @return Object containing information of the $id option
*/
- public IdOption getIdOption();
+ IdOption getIdOption();
/**
* @return Object containing information of the $select option
*/
- public SelectOption getSelectOption();
-
+ SelectOption getSelectOption();
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoMetadata.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoMetadata.java
index b16f76c..7bf8d91 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoMetadata.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoMetadata.java
@@ -29,11 +29,11 @@
/**
* @return Object containing information of the $id option
*/
- public FormatOption getFormatOption();
+ FormatOption getFormatOption();
/**
* @return Object containing information of the URI fragment
*/
- public String getFragment();
+ String getFragment();
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoResource.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoResource.java
index 20d4880..3ea1058 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoResource.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoResource.java
@@ -75,6 +75,7 @@
OrderByOption getOrderByOption();
/**
+ * <b>CURRENTLY NOT SUPPORTED. WILL ALWAYS RETURN NULL</b>
* @return Object containing information of the $search option
*/
SearchOption getSearchOption();
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriParameter.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriParameter.java
index db2f9d0..ab8bfec 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriParameter.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriParameter.java
@@ -28,26 +28,25 @@
/**
* @return Alias name if the parameters values is an alias, otherwise null
*/
- public String getAlias();
+ String getAlias();
/**
* @return Text of the parameters value
*/
- public String getText();
+ String getText();
/**
* @return If the parameters value is a expression and expression is returned, otherwise null
*/
- public Expression getExpression();
+ Expression getExpression();
/**
* @return Name of the parameter
*/
- public String getName();
+ String getName();
/**
* @return Name of the referenced property when referential constrains are used
*/
- public String getReferencedProperty();
-
+ String getReferencedProperty();
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResource.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResource.java
index acafa57..016cbcb 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResource.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResource.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this 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
@@ -29,6 +29,13 @@
*/
UriResourceKind getKind();
+ /**
+ * In case of an EntitySet this method will return the EntitySet name. In Case of $ref this method will return '$ref"
+ * as a String.
+ * @return the value of this URI Resource Segment
+ */
+ String getSegmentValue();
+
@Override
String toString();
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceFunction.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceFunction.java
index d92dd89..f509bd7 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceFunction.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceFunction.java
@@ -45,7 +45,7 @@
EdmFunctionImport getFunctionImport();
/**
- * @return Key predicates if used, otherwise null
+ * @return Key predicates if used, otherwise an empty list
*/
List<UriParameter> getKeyPredicates();
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaAll.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaAll.java
index cbb9edf..2abe93e 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaAll.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaAll.java
@@ -29,11 +29,10 @@
/**
* @return Name of the lambda variable
*/
- public String getLambdaVariable();
+ String getLambdaVariable();
/**
* @return Lambda expression
*/
- public Expression getExpression();
-
+ Expression getExpression();
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaAny.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaAny.java
index 8908284..198ac3c 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaAny.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaAny.java
@@ -29,11 +29,11 @@
/**
* @return Name of the lambda variable
*/
- public String getLamdaVariable();
+ String getLambdaVariable();
/**
* @return Lambda expression
*/
- public Expression getExpression();
+ Expression getExpression();
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaVariable.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaVariable.java
index 67a5d3d..376e88f 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaVariable.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaVariable.java
@@ -27,6 +27,5 @@
/**
* @return Name of the lambda variable
*/
- public String getVariableName();
-
+ String getVariableName();
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceNavigation.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceNavigation.java
index 3ef4c05..fab09a3 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceNavigation.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceNavigation.java
@@ -35,7 +35,7 @@
EdmNavigationProperty getProperty();
/**
- * @return Key predicates if used, otherwise null
+ * @return Key predicates if used, otherwise an empty list
*/
List<UriParameter> getKeyPredicates();
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourcePartTyped.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourcePartTyped.java
index 5ff183c..407623e 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourcePartTyped.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourcePartTyped.java
@@ -38,6 +38,11 @@
/**
* @return String representation of the type
*/
+ public String getSegmentValue(final boolean includeFilters);
+
+ /**
+ * @return String representation of the type
+ */
String toString(boolean includeFilters);
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/package-info.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/package-info.java
new file mode 100644
index 0000000..2a0aab6
--- /dev/null
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/package-info.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.
+ ******************************************************************************/
+/**
+ * Olingo URI
+ * <p>
+ * The URI package is used to condense all information about the OData path used to query the data.
+ * <br> In order to support filter and orderby statements the
+ * {@link org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor} has to be implemented by an
+ * application.
+ */
+package org.apache.olingo.server.api.uri;
+
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/ExpandItem.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/ExpandItem.java
index fccf844..a16c137 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/ExpandItem.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/ExpandItem.java
@@ -38,6 +38,7 @@
FilterOption getFilterOption();
/**
+ * <b>CURRENTLY NOT SUPPORTED. WILL ALWAYS RETURN NULL</b>
* @return Information of the option $search when used within $expand
*/
SearchOption getSearchOption();
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SystemQueryOptionKind.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SystemQueryOptionKind.java
index 248790e..77dfb84 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SystemQueryOptionKind.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SystemQueryOptionKind.java
@@ -84,9 +84,9 @@
*/
LEVELS("$level");
- String syntax;
+ private String syntax;
- private SystemQueryOptionKind(final String syntax) {
+ SystemQueryOptionKind(final String syntax) {
this.syntax = syntax;
}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitException.java
index c114c65..956b06f 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitException.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitException.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.server.api.uri.queryoption.expression;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
/**
* Exception class used by the {@link ExpressionVisitor} to throw exceptions while traversing the expression tree
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitor.java
index e2d4f94..f0ddce8 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitor.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitor.java
@@ -85,7 +85,7 @@
* @throws ExpressionVisitException Thrown if an exception while traversing occured
* @throws ODataApplicationException Thrown by the application
*/
- T visitLiteral(String literal) throws ExpressionVisitException, ODataApplicationException;
+ T visitLiteral(Literal literal) throws ExpressionVisitException, ODataApplicationException;
/**
* Called for each traversed {@link Member} expression
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Literal.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Literal.java
index 524074d..b4bdde2 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Literal.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Literal.java
@@ -31,7 +31,12 @@
public String getText();
/**
- * @return Type of the literal if detected
+ * Numeric literals without an dot and without an e return the smallest possible Edm Integer type.
+ * Numeric literals without an dot, without an e and larger than 2^63 - 1 are considered as Edm.Decimal
+ * Numeric literals with an e, are considered to be Edm.Double
+ * Numeric literals with an dot and without an e, are supposed to be Edm.Decimal
+ *
+ * @return Type of the literal if detected. The type of the literal is guessed by the parser.
*/
public EdmType getType();
diff --git a/lib/server-api/src/test/java/org/apache/olingo/server/api/prefer/PreferencesAppliedTest.java b/lib/server-api/src/test/java/org/apache/olingo/server/api/prefer/PreferencesAppliedTest.java
new file mode 100644
index 0000000..49948dd
--- /dev/null
+++ b/lib/server-api/src/test/java/org/apache/olingo/server/api/prefer/PreferencesAppliedTest.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.server.api.prefer;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.olingo.server.api.prefer.Preferences.Return;
+import org.junit.Test;
+
+public class PreferencesAppliedTest {
+
+ @Test
+ public void empty() {
+ assertEquals("", PreferencesApplied.with().build().toValueString());
+ }
+
+ @Test
+ public void all() {
+ assertEquals("odata.allow-entityreferences, odata.callback,"
+ + " odata.continue-on-error, odata.include-annotations=\"*\", odata.maxpagesize=42,"
+ + " odata.track-changes, return=representation, respond-async, wait=12345",
+ PreferencesApplied.with().allowEntityReferences().callback().continueOnError()
+ .preference("odata.include-annotations", "*").maxPageSize(42).trackChanges()
+ .returnRepresentation(Return.REPRESENTATION).respondAsync().waitPreference(12345)
+ .build().toValueString());
+ }
+
+ @Test
+ public void caseSensitivity() {
+ assertEquals("odata.include-annotations=\"*\", odata.maxpagesize=255",
+ PreferencesApplied.with()
+ .preference("OData.Include-Annotations", "*").maxPageSize(0xFF)
+ .build().toValueString());
+ }
+
+ @Test
+ public void multipleValues() {
+ assertEquals("return=minimal, wait=1",
+ PreferencesApplied.with()
+ .returnRepresentation(Return.MINIMAL).returnRepresentation(Return.REPRESENTATION)
+ .preference(null, null).preference(null, "nullValue")
+ .waitPreference(1).waitPreference(2).waitPreference(3)
+ .build().toValueString());
+ }
+
+ @Test
+ public void quotedValue() {
+ assertEquals("strangepreference=\"x\\\\y,\\\"abc\\\"z\"",
+ PreferencesApplied.with().preference("strangePreference", "x\\y,\"abc\"z").build().toValueString());
+ }
+}
diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java
index b83d383..5f425da 100644
--- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java
+++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java
@@ -21,7 +21,6 @@
import java.io.ByteArrayInputStream;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@@ -29,8 +28,8 @@
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.ODataServerError;
import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
import org.apache.olingo.server.api.serializer.CustomContentTypeSupport;
import org.apache.olingo.server.api.serializer.ODataSerializer;
import org.apache.olingo.server.api.serializer.RepresentationType;
@@ -96,9 +95,9 @@
requestedContentType = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
request, this.customContent, RepresentationType.ERROR);
} catch (final ContentNegotiatorException e) {
- requestedContentType = ODataFormat.JSON.getContentType();
+ requestedContentType = ContentType.JSON;
} catch (UriParserException e) {
- requestedContentType = ODataFormat.JSON.getContentType();
+ requestedContentType = ContentType.JSON;
}
processError(response, serverError, requestedContentType);
}
@@ -106,8 +105,7 @@
void processError(ODataResponse response, ODataServerError serverError,
ContentType requestedContentType) {
try {
- ODataSerializer serializer = this.odata.createSerializer(ODataFormat
- .fromContentType(requestedContentType));
+ ODataSerializer serializer = this.odata.createSerializer(requestedContentType);
response.setContent(serializer.error(serverError).getContent());
response.setStatusCode(serverError.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/OData4HttpHandler.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/OData4HttpHandler.java
index 6392414..7811cdf 100644
--- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/OData4HttpHandler.java
+++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/OData4HttpHandler.java
@@ -79,9 +79,9 @@
ODataRequest odRequest = new ODataRequest();
odRequest.setBody(httpRequest.getInputStream());
- extractHeaders(odRequest, httpRequest);
- extractMethod(odRequest, httpRequest);
- extractUri(odRequest, httpRequest, split);
+ copyHeaders(odRequest, httpRequest);
+ odRequest.setMethod(extractMethod(httpRequest));
+ fillUriInformation(odRequest, httpRequest, split);
return odRequest;
} catch (final IOException e) {
diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/OData4Impl.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/OData4Impl.java
index bde9c96..29cb551 100644
--- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/OData4Impl.java
+++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/OData4Impl.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.server.core;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ODataHttpHandler;
import org.apache.olingo.server.api.ServiceMetadata;
diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/SchemaBasedEdmProvider.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/SchemaBasedEdmProvider.java
index a35f3bc..3256bf4 100644
--- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/SchemaBasedEdmProvider.java
+++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/SchemaBasedEdmProvider.java
@@ -22,7 +22,7 @@
import java.util.Arrays;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlAction;
import org.apache.olingo.commons.api.edm.provider.CsdlActionImport;
diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceHandler.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceHandler.java
index a7753ec..a223120 100644
--- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceHandler.java
+++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceHandler.java
@@ -102,6 +102,21 @@
EntityResponse response) throws ODataLibraryException, ODataApplicationException;
/**
+ * Update or create the entity object. If based on passed in entity object's key value, if
+ * entity exists update the entity, else create a new entity
+ * @param request
+ * @param entity - Entity to create or update
+ * @param merge - in the case of update, true to do merge operation with current entity,
+ * false the entity needs to be replaced
+ * @param entityETag - previous entity tag if provided by the user. "*" means allow.
+ * @param response
+ * @throws ODataLibraryException
+ * @throws ODataApplicationException
+ */
+ void upsertEntity(DataRequest request, Entity entity, boolean merge, String entityETag,
+ EntityResponse response) throws ODataLibraryException, ODataApplicationException;
+
+ /**
* Delete the Entity
* @param request
* @param entityETag - entity tag to match, if provided by the user. "*" means allow
diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceRequest.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceRequest.java
index 53db4c8..7f3f234 100644
--- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceRequest.java
+++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceRequest.java
@@ -28,7 +28,6 @@
import org.apache.olingo.commons.api.data.ContextURL;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.server.api.OData;
@@ -143,18 +142,18 @@
@SuppressWarnings("unchecked")
public <T> T getSerializerOptions(Class<T> serilizerOptions, ContextURL contextUrl,
boolean references) throws ContentNegotiatorException {
- final ODataFormat format = ODataFormat.fromContentType(getResponseContentType());
-
+
if (serilizerOptions.isAssignableFrom(EntitySerializerOptions.class)) {
return (T) EntitySerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null : contextUrl)
+ .contextURL(isODataMetadataNone(getResponseContentType()) ? null : contextUrl)
.expand(uriInfo.getExpandOption()).select(this.uriInfo.getSelectOption())
.setWriteOnlyReferences(references).build();
} else if (serilizerOptions.isAssignableFrom(EntityCollectionSerializerOptions.class)) {
return (T) EntityCollectionSerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null : contextUrl)
+ .contextURL(isODataMetadataNone(getResponseContentType()) ? null : contextUrl)
.count(uriInfo.getCountOption()).expand(uriInfo.getExpandOption())
- .select(uriInfo.getSelectOption()).setWriteOnlyReferences(references).build();
+ .select(uriInfo.getSelectOption()).setWriteOnlyReferences(references)
+ .setId(getODataRequest().getRawBaseUri()+getODataRequest().getRawODataPath()).build();
} else if (serilizerOptions.isAssignableFrom(ComplexSerializerOptions.class)) {
return (T) ComplexSerializerOptions.with().contextURL(contextUrl)
.expand(this.uriInfo.getExpandOption()).select(this.uriInfo.getSelectOption()).build();
@@ -191,8 +190,7 @@
public ODataSerializer getSerializer() throws ContentNegotiatorException,
SerializerException {
- ODataFormat format = ODataFormat.fromContentType(getResponseContentType());
- return this.odata.createSerializer(format);
+ return this.odata.createSerializer(getResponseContentType());
}
public Map<String, String> getPreferences(){
@@ -261,4 +259,9 @@
dispatcher.visit(uriInfo);
return (DataRequest)dispatcher.request;
}
+
+ private boolean isODataMetadataNone(final ContentType contentType) {
+ return contentType.isCompatible(ContentType.JSON)
+ && ContentType.VALUE_ODATA_METADATA_NONE.equals(contentType.getParameter(ContentType.PARAMETER_ODATA_METADATA));
+ }
}
diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/legacy/ProcessorServiceHandler.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/legacy/ProcessorServiceHandler.java
index acbc8c0..b65f19c 100644
--- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/legacy/ProcessorServiceHandler.java
+++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/legacy/ProcessorServiceHandler.java
@@ -430,4 +430,11 @@
throw new ODataHandlerException("not implemented",
ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
}
+
+ @Override
+ public void upsertEntity(DataRequest request, Entity entity, boolean merge, String entityETag,
+ EntityResponse response) throws ODataLibraryException, ODataApplicationException {
+ throw new ODataHandlerException("not implemented",
+ ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
+ }
}
diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/requests/BatchRequest.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/requests/BatchRequest.java
index a38f9d8..d14b5ad 100644
--- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/requests/BatchRequest.java
+++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/requests/BatchRequest.java
@@ -33,7 +33,7 @@
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.ODataLibraryException;
import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
import org.apache.olingo.server.api.deserializer.batch.BatchOptions;
import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
@@ -165,9 +165,9 @@
}
private void addContentID(ODataRequest batchPartRequest, ODataResponse batchPartResponse) {
- final String contentId = batchPartRequest.getHeader(BatchParserCommon.HTTP_CONTENT_ID);
+ final String contentId = batchPartRequest.getHeader(HttpHeader.CONTENT_ID);
if (contentId != null) {
- batchPartResponse.setHeader(BatchParserCommon.HTTP_CONTENT_ID, contentId);
+ batchPartResponse.setHeader(HttpHeader.CONTENT_ID, contentId);
}
}
@@ -177,12 +177,10 @@
}
private void validateContentType() throws ODataApplicationException {
- final String contentType = getRequestContentType().toContentTypeString();
-
- if (contentType == null
- || !BatchParserCommon.PATTERN_MULTIPART_BOUNDARY.matcher(contentType).matches()) {
+ final ContentType contentType = getRequestContentType();
+ if (contentType == null || !contentType.isCompatible(ContentType.MULTIPART_MIXED)) {
throw new ODataApplicationException("Invalid content type",
- HttpStatusCode.PRECONDITION_FAILED.getStatusCode(), Locale.getDefault());
+ HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.getDefault());
}
}
diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/requests/DataRequest.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/requests/DataRequest.java
index 0d98de5..2966d86 100644
--- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/requests/DataRequest.java
+++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/requests/DataRequest.java
@@ -41,14 +41,13 @@
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.commons.core.edm.primitivetype.EdmStream;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.ODataLibraryException;
+import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.deserializer.DeserializerException.MessageKeys;
@@ -318,7 +317,7 @@
getContextURL(odata), false, response, getReturnRepresentation());
handler.createEntity(DataRequest.this, getEntityFromClient(), entityResponse);
} else {
- handler.updateEntity(DataRequest.this, getEntityFromClient(), isPATCH(), getETag(),
+ handler.upsertEntity(DataRequest.this, getEntityFromClient(), isPATCH(), getETag(),
entityResponse);
}
} else if (isPOST()) {
@@ -331,8 +330,7 @@
}
private Entity getEntityFromClient() throws DeserializerException {
- ODataDeserializer deserializer = odata.createDeserializer(ODataFormat
- .fromContentType(getRequestContentType()));
+ ODataDeserializer deserializer = odata.createDeserializer(getRequestContentType());
return deserializer.entity(getODataRequest().getBody(), getEntitySet().getEntityType()).getEntity();
}
@@ -459,8 +457,7 @@
// /odata-json-format-v4.0-errata02-os-complete.html#_Toc403940643
// The below code reads as property and converts to an URI
private List<URI> getPayload() throws DeserializerException {
- ODataDeserializer deserializer = odata.createDeserializer(ODataFormat
- .fromContentType(getRequestContentType()));
+ ODataDeserializer deserializer = odata.createDeserializer(getRequestContentType());
return deserializer.entityReferences(getODataRequest().getBody()).getEntityReferences();
}
@@ -700,8 +697,7 @@
private org.apache.olingo.commons.api.data.Property getPropertyValueFromClient(
EdmProperty edmProperty) throws DeserializerException {
- ODataDeserializer deserializer = odata.createDeserializer(ODataFormat
- .fromContentType(getRequestContentType()));
+ ODataDeserializer deserializer = odata.createDeserializer(getRequestContentType());
return deserializer.property(getODataRequest().getBody(), edmProperty).getProperty();
}
diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ServiceResponse.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ServiceResponse.java
index deb1206..56ae9f4 100644
--- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ServiceResponse.java
+++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ServiceResponse.java
@@ -55,7 +55,7 @@
if (!this.closed) {
if (this.strictApplyPreferences) {
if (!preferences.isEmpty()) {
- assert(this.response.getHeaders().get("Preference-Applied") != null);
+ assert(this.response.getAllHeaders().get("Preference-Applied") != null);
}
}
this.closed = true;
@@ -97,7 +97,7 @@
public void writeHeader(String key, String value) {
if ("Preference-Applied".equals(key)) {
- String previous = this.response.getHeaders().get(key);
+ String previous = this.response.getHeader(key);
if (previous != null) {
value = previous+";"+value;
}
diff --git a/lib/server-core-ext/src/test/java/org/apache/olingo/server/core/MetadataParserTest.java b/lib/server-core-ext/src/test/java/org/apache/olingo/server/core/MetadataParserTest.java
index 10502ad..1c2b28f 100644
--- a/lib/server-core-ext/src/test/java/org/apache/olingo/server/core/MetadataParserTest.java
+++ b/lib/server-core-ext/src/test/java/org/apache/olingo/server/core/MetadataParserTest.java
@@ -27,7 +27,7 @@
import java.io.FileReader;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlAction;
import org.apache.olingo.commons.api.edm.provider.CsdlActionImport;
diff --git a/lib/server-core-ext/src/test/java/org/apache/olingo/server/core/ServiceDispatcherTest.java b/lib/server-core-ext/src/test/java/org/apache/olingo/server/core/ServiceDispatcherTest.java
index 62f91fb..636a6b6 100644
--- a/lib/server-core-ext/src/test/java/org/apache/olingo/server/core/ServiceDispatcherTest.java
+++ b/lib/server-core-ext/src/test/java/org/apache/olingo/server/core/ServiceDispatcherTest.java
@@ -69,6 +69,7 @@
private Tomcat tomcat = new Tomcat();
public class SampleODataServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
private final ServiceHandler handler; // must be stateless
private final CsdlEdmProvider provider; // must be stateless
@@ -158,7 +159,7 @@
request = delete;
}
request.setHeader("Content-Type", "application/json;odata.metadata=minimal");
- HttpResponse response = http.execute(getLocalhost(), request);
+ http.execute(getLocalhost(), request);
validator.validate();
afterTest();
@@ -188,9 +189,9 @@
Mockito.verify(handler).read(arg1.capture(), arg2.capture());
DataRequest request = arg1.getValue();
- // Need toString on ContextURL class
+ // Need getName on ContextURL class
// assertEquals("",
- // request.getContextURL(request.getOdata()).toString());
+ // request.getContextURL(request.getOdata()).getName());
assertEquals("application/json;odata.metadata=minimal", request.getResponseContentType()
.toContentTypeString());
}
@@ -208,9 +209,9 @@
Mockito.verify(handler).read(arg1.capture(), arg2.capture());
DataRequest request = arg1.getValue();
- // Need toString on ContextURL class
+ // Need getName on ContextURL class
// assertEquals("",
- // request.getContextURL(request.getOdata()).toString());
+ // request.getContextURL(request.getOdata()).getName());
assertEquals("text/plain", request.getResponseContentType().toContentTypeString());
}
});
@@ -325,7 +326,7 @@
ArgumentCaptor<HttpMethod> arg2 = ArgumentCaptor.forClass(HttpMethod.class);
Mockito.verify(handler).invoke(arg1.capture(), arg2.capture(), arg3.capture());
- FunctionRequest request = arg1.getValue();
+ arg1.getValue();
}
});
}
@@ -340,7 +341,7 @@
ArgumentCaptor<NoContentResponse> arg2 = ArgumentCaptor.forClass(NoContentResponse.class);
Mockito.verify(handler).invoke(arg1.capture(), Mockito.anyString(), arg2.capture());
- ActionRequest request = arg1.getValue();
+ arg1.getValue();
}
});
}
@@ -403,7 +404,6 @@
final ServiceHandler handler = Mockito.mock(ServiceHandler.class);
helpTest(handler, "trippin/People('russelwhyte')/Friends/$ref", "POST", payload,
new TestResult() {
- @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void validate() throws Exception {
ArgumentCaptor<DataRequest> arg1 = ArgumentCaptor.forClass(DataRequest.class);
diff --git a/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinDataModel.java b/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinDataModel.java
index 290f38d..646e835 100644
--- a/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinDataModel.java
+++ b/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinDataModel.java
@@ -45,6 +45,7 @@
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.deserializer.DeserializerException;
@@ -115,7 +116,7 @@
private EntityCollection loadEnities(String entitySetName, EdmEntityType type) {
try {
- ODataJsonDeserializer deserializer = new ODataJsonDeserializer();
+ ODataJsonDeserializer deserializer = new ODataJsonDeserializer(ContentType.JSON);
EntityCollection set = deserializer.entityCollection(new FileInputStream(new File(
"src/test/resources/" + entitySetName.toLowerCase() + ".json")), type).getEntityCollection();
diff --git a/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinHandler.java b/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinHandler.java
index 6ca0fcd..db06558 100644
--- a/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinHandler.java
+++ b/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinHandler.java
@@ -544,4 +544,16 @@
public void crossJoin(DataRequest dataRequest, List<String> entitySetNames, ODataResponse response) {
response.setStatusCode(200);
}
+
+ @Override
+ public void upsertEntity(DataRequest request, Entity entity, boolean merge, String entityETag,
+ EntityResponse response) throws ODataLibraryException, ODataApplicationException {
+ EdmEntitySet edmEntitySet = request.getEntitySet();
+ Entity currentEntity = this.dataModel.getEntity(edmEntitySet.getName(), request.getKeyPredicates());
+ if(currentEntity == null) {
+ createEntity(request, entity, response);
+ } else {
+ updateEntity(request, entity, merge, entityETag, response);
+ }
+ }
}
diff --git a/lib/server-core/pom.xml b/lib/server-core/pom.xml
index 1c2d1f5..6d9c70f 100644
--- a/lib/server-core/pom.xml
+++ b/lib/server-core/pom.xml
@@ -55,7 +55,10 @@
<version>2.5</version>
<scope>provided</scope>
</dependency>
-
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
<dependency>
<groupId>junit</groupId>
@@ -69,11 +72,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
@@ -118,9 +116,12 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
+ <version>${maven.bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
+ <Implementation-Version>${project.version}</Implementation-Version>
+ <Implementation-Title>${project.name}</Implementation-Title>
<Export-Package>
org.apache.olingo.server.core
</Export-Package>
diff --git a/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriLexer.g4 b/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriLexer.g4
index f74e721..8092276 100644
--- a/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriLexer.g4
+++ b/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriLexer.g4
@@ -26,9 +26,9 @@
QM : '?' -> pushMode(MODE_QUERY); //first query parameter
AMP : '&' -> pushMode(MODE_QUERY); //more query parameters
STRING : '\'' -> more, pushMode(MODE_STRING); //reads up to next single '
-QUOTATION_MARK : ('\u0022' | '%22') -> more, pushMode(MODE_JSON_STRING); //reads up to next unescaped "
+QUOTATION_MARK : '\u0022' -> more, pushMode(MODE_JSON_STRING); //reads up to next unescaped "
SEARCH_INLINE : '$search' -> pushMode(MODE_SYSTEM_QUERY_SEARCH); //
-FRAGMENT : '#' -> pushMode(MODE_FRAGMENT); //
+FRAGMENT : '#' -> pushMode(MODE_FRAGMENT); //
GEOGRAPHY : G E O G R A P H Y SQUOTE -> pushMode(MODE_ODATA_GEO); //TODO make case insensitive
GEOMETRY : G E O M E T R Y SQUOTE -> pushMode(MODE_ODATA_GEO);
@@ -55,28 +55,28 @@
fragment Z : 'Z'|'z';
//special chars
-OPEN : '(' | '%28';
-CLOSE : ')' | '%29';
-COMMA : ',' | '%2C';
+OPEN : '(';
+CLOSE : ')';
+COMMA : ',';
SLASH : '/';
POINT : '.';
AT : '@';
EQ : '=' ;
STAR : '*';
-SEMI : ';' | '%3b';
+SEMI : ';';
COLON : ':';
EQ_sq : '=' -> type(EQ);
AMP_sq : '&' -> type(AMP), popMode;
-fragment WS : ( ' ' | '%09' | '%20' | '%09' );
+fragment WS : ( ' ' | '\u0009' );
WSP : WS+;
//JSON support
-BEGIN_OBJECT : WS* ( '{' / '%7B' ) WS*;
-END_OBJECT : WS* ( '}' / '%7D' ) WS*;
+BEGIN_OBJECT : WS* '{' WS*;
+END_OBJECT : WS* '}' WS*;
-BEGIN_ARRAY : WS* ( '[' / '%5B' ) WS*;
-END_ARRAY : WS* ( ']' / '%5D' ) WS*;
+BEGIN_ARRAY : WS* '[' WS*;
+END_ARRAY : WS* ']' WS*;
//alpha stuff
@@ -112,13 +112,13 @@
COUNT : '$count';
//inlined query parameters ( e.g. $skip)
-TOP_I : '$top' -> type(TOP);
-SKIP_I : '$skip' -> type(SKIP);
-FILTER_I : '$filter' -> type(FILTER);
-ORDERBY_I: '$orderby' -> type(ORDERBY);
-SELECT_I : '$select' -> type(SELECT);
-EXPAND_I : '$expand' -> type(EXPAND);
-LEVELS_I : '$levels' -> type(LEVELS);
+TOP_I : '$top' -> type(TOP);
+SKIP_QO_I : '$skip' -> type(SKIP_QO);
+FILTER_I : '$filter' -> type(FILTER);
+ORDERBY_I : '$orderby'-> type(ORDERBY);
+SELECT_I : '$select' -> type(SELECT);
+EXPAND_I : '$expand' -> type(EXPAND);
+LEVELS_I : '$levels' -> type(LEVELS);
MAX: 'max';
ROOT : '$root/';
@@ -132,7 +132,7 @@
PLUS : '+';
MINUS : '-';
-SIGN : PLUS | '%2B' | '-';
+SIGN : PLUS | '-';
INT : SIGN? DIGITS;
DECIMAL : INT '.' DIGITS (('e'|'E') SIGN? DIGITS)?;
NANINFINITY : 'NaN' | '-INF' | 'INF';
@@ -254,7 +254,7 @@
ORDERBY : '$orderby' -> pushMode(DEFAULT_MODE);
EXPAND : '$expand' -> pushMode(DEFAULT_MODE);
SELECT : '$select' -> pushMode(DEFAULT_MODE);
-SKIP : '$skip' -> pushMode(DEFAULT_MODE);
+SKIP_QO : '$skip' -> pushMode(DEFAULT_MODE);
SKIPTOKEN : '$skiptoken' -> pushMode(MODE_SYSTEM_QUERY_REST);
TOP : '$top' -> pushMode(DEFAULT_MODE);
LEVELS_q : '$levels' -> type(LEVELS), pushMode(DEFAULT_MODE);
@@ -334,13 +334,18 @@
OR_sqc : 'OR' -> type(OR);
EQ_sqc : '=' -> type(EQ);
-fragment WS_sqc : ( ' ' | '\u0009' | '%20' | '%09' );
+fragment WS_sqc : ( ' ' | '\u0009');
WSP_sqc : WS_sqc+ -> type(WSP);
-QUOTATION_MARK_sqc : '\u0022' | '%22';
+QUOTATION_MARK_sqc : '\u0022';
SEARCHWORD : ('a'..'z'|'A'..'Z')+;
-SEARCHPHRASE : QUOTATION_MARK_sqc ~["]* QUOTATION_MARK_sqc -> popMode;
+SEARCHPHRASE : QUOTATION_MARK_sqc ~["]* QUOTATION_MARK_sqc;
+
+// Follow Set
+CLOSE_qs : ')' -> popMode, type(CLOSE);
+SEMI_qs : ';' -> popMode, type(SEMI);
+AMP_qs : '&' -> popMode, type(AMP);
//;==============================================================================
mode MODE_STRING;
@@ -356,7 +361,7 @@
// Any """ characters inside a string are escaped with "\".
//;==============================================================================
-STRING_IN_JSON : ('\\"' | ~[\u0022] )* ('"' | '%22') -> popMode;
+STRING_IN_JSON : ('\\"' | ~[\u0022] )* '"' -> popMode;
//;==============================================================================
mode MODE_ODATA_GEO;
@@ -379,21 +384,21 @@
fragment U_ : 'u'|'U';
fragment Y_ : 'y'|'Y';
-fragment SP_g : ' ';//'\u0020'; // a simple space
-fragment WS_g : ( ' ' | '%20' | '%09' );
+fragment SP_g : ' '; //'\u0020'; // a simple space
+fragment WS_g : ( ' ' | '\u0009' );
-OPEN_g : ('(' | '%28') -> type(OPEN);
-CLOSE_g : (')' | '%29') -> type(CLOSE);
-COMMA_g : (',' | '%2C') -> type(COMMA);
+OPEN_g : '(' -> type(OPEN);
+CLOSE_g : ')' -> type(CLOSE);
+COMMA_g : ',' -> type(COMMA);
WSP_g : WS_g+ -> type(WSP);
-POINT_g : '.' -> type(POINT);
-AT_g : '@' -> type(AT);
-SEMI_g : (';' | '%3B') -> type(SEMI);
-EQ_g : '=' -> type(EQ);
+POINT_g : '.' -> type(POINT);
+AT_g : '@' -> type(AT);
+SEMI_g : ';' -> type(SEMI);
+EQ_g : '=' -> type(EQ);
fragment DIGIT_g : '0'..'9';
fragment DIGITS_g : DIGIT_g+;
-SIGN_g : ('+' | '%2B' |'-') -> type(SIGN);
+SIGN_g : ('+' | '-') -> type(SIGN);
INT_g : SIGN_g? DIGITS_g -> type(INT);
DECIMAL_g : 'SS' INT_g '.' DIGITS_g (('e'|'E') SIGN_g? DIGITS_g)? -> type(DECIMAL);
COLLECTION_g : C_ O_ L_ L_ E_ C_ T_ I_ O_ N_ -> type(COLLECTION);
diff --git a/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriParser.g4 b/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriParser.g4
index 7efc14c..198d1ba 100644
--- a/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriParser.g4
+++ b/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriParser.g4
@@ -115,7 +115,7 @@
;
expandCountOption : filter
- | search
+ | searchInline
;
expandRefOption : expandCountOption
@@ -144,11 +144,11 @@
orderByItem : vC=commonExpr ( WSP ( vA=ASC | vD=DESC ) )?;
-skip : SKIP EQ INT;
+skip : SKIP_QO EQ INT;
top : TOP EQ INT;
//format : FORMAT EQ ( ATOM | JSON | XML | PCHARS SLASH PCHARS);
-inlinecount : COUNT EQ booleanNonCase;
+inlinecount : COUNT EQ booleanNonCaseLiteral;
search : SEARCH searchSpecialToken;
searchInline : SEARCH_INLINE searchSpecialToken;
@@ -342,19 +342,19 @@
//;------------------------------------------------------------------------------
-primitiveLiteral : nullrule
- | booleanNonCase
- | DECIMAL //includes double and single literals
- | naninfinity
- | INT //includes int16/int32 and int64 literals
- | BINARY
- | DATE
- | DATETIMEOFFSET
- | DURATION
- | GUID
- | string
- | TIMEOFDAY
- | enumLit
+primitiveLiteral : nullruleLiteral
+ | booleanNonCaseLiteral
+ | decimalLiteral //includes double and single literals
+ | naninfinityLiteral
+ | intLiteral //includes int16/int32 and int64 literals
+ | binaryLiteral
+ | dateLiteral
+ | datetimeoffsetLiteral
+ | durationLiteral
+ | guidLiteral
+ | stringLiteral
+ | timeofdayLiteral
+ | enumLiteral
| geographyCollection
| geographyLineString
| geographyMultilineString
@@ -371,14 +371,22 @@
| geometryPolygon
;
-naninfinity : NANINFINITY;
-nullrule : NULLVALUE;
-booleanNonCase : BOOLEAN | TRUE | FALSE;
-string : STRING;
+nullruleLiteral : NULLVALUE;
+booleanNonCaseLiteral : BOOLEAN | TRUE | FALSE;
+decimalLiteral : DECIMAL;
+naninfinityLiteral : NANINFINITY;
+intLiteral : INT;
+binaryLiteral : BINARY;
+dateLiteral : DATE;
+datetimeoffsetLiteral : DATETIMEOFFSET;
+durationLiteral : DURATION;
+guidLiteral : GUID;
+stringLiteral : STRING;
+timeofdayLiteral : TIMEOFDAY;
-enumLit : vNS=namespace vODI=odataIdentifier vValues=STRING;
-enumValues : vlODI+=odataIdentifier ( COMMA vlODI+=odataIdentifier )*;
+enumLiteral : vNS=namespace vODI=odataIdentifier vValues=STRING;
+enumValues : vlODI+=odataIdentifier ( COMMA vlODI+=odataIdentifier )*;
geographyCollection : GEOGRAPHY fullCollectionLiteral SQUOTE;
fullCollectionLiteral : sridLiteral collectionLiteral;
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java
index 351b769..8da326d 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java
@@ -19,38 +19,47 @@
package org.apache.olingo.server.core;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import org.apache.olingo.commons.api.format.AcceptType;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.serializer.CustomContentTypeSupport;
import org.apache.olingo.server.api.serializer.RepresentationType;
import org.apache.olingo.server.api.uri.queryoption.FormatOption;
-public class ContentNegotiator {
+public final class ContentNegotiator {
+
+ private static final String ATOM = "atom";
+ private static final String JSON = "json";
+ private static final String XML = "xml";
+
+ private static final List<ContentType> DEFAULT_SUPPORTED_CONTENT_TYPES =
+ Collections.unmodifiableList(Arrays.asList(
+ ContentType.JSON,
+ ContentType.JSON_NO_METADATA,
+ ContentType.APPLICATION_JSON,
+ ContentType.APPLICATION_ATOM_XML,
+ ContentType.APPLICATION_XML));
private ContentNegotiator() {}
private static List<ContentType> getDefaultSupportedContentTypes(final RepresentationType type) {
switch (type) {
case METADATA:
- return Arrays.asList(ContentType.APPLICATION_XML);
+ return Collections.singletonList(ContentType.APPLICATION_XML);
case MEDIA:
case BINARY:
- return Arrays.asList(ContentType.APPLICATION_OCTET_STREAM);
+ return Collections.singletonList(ContentType.APPLICATION_OCTET_STREAM);
case VALUE:
case COUNT:
- return Arrays.asList(ContentType.TEXT_PLAIN);
+ return Collections.singletonList(ContentType.TEXT_PLAIN);
case BATCH:
- return Arrays.asList(ContentType.MULTIPART_MIXED);
+ return Collections.singletonList(ContentType.MULTIPART_MIXED);
default:
- return Arrays.asList(
- ODataFormat.JSON.getContentType(),
- ODataFormat.JSON_NO_METADATA.getContentType(),
- ODataFormat.APPLICATION_JSON.getContentType());
+ return DEFAULT_SUPPORTED_CONTENT_TYPES;
}
}
@@ -78,14 +87,12 @@
if (formatOption != null && formatOption.getFormat() != null) {
final String formatString = formatOption.getFormat().trim();
- final ODataFormat format =
- ODataFormat.JSON.name().equalsIgnoreCase(formatString) ? ODataFormat.JSON :
- ODataFormat.XML.name().equalsIgnoreCase(formatString) ? ODataFormat.XML :
- ODataFormat.ATOM.name().equalsIgnoreCase(formatString) ? ODataFormat.ATOM : null;
+ final ContentType contentType = mapContentType(formatString);
+
try {
result = getAcceptedType(
- AcceptType.fromContentType(format == null ?
- ContentType.create(formatOption.getFormat()) : format.getContentType()),
+ AcceptType.fromContentType(contentType == null ?
+ ContentType.create(formatOption.getFormat()) : contentType),
supportedContentTypes);
} catch (final IllegalArgumentException e) {
// Exception results in result = null for next check.
@@ -120,19 +127,35 @@
return result;
}
+ private static ContentType mapContentType(String formatString) {
+ return JSON.equalsIgnoreCase(formatString) ? ContentType.JSON :
+ XML.equalsIgnoreCase(formatString) ? ContentType.APPLICATION_XML :
+ ATOM.equalsIgnoreCase(formatString) ? ContentType.APPLICATION_ATOM_XML : null;
+ }
+
private static ContentType getAcceptedType(final List<AcceptType> acceptedContentTypes,
final List<ContentType> supportedContentTypes) {
for (final AcceptType acceptedType : acceptedContentTypes) {
for (final ContentType supportedContentType : supportedContentTypes) {
ContentType contentType = supportedContentType;
- if (acceptedType.getParameters().containsKey("charset")) {
- final String value = acceptedType.getParameters().get("charset");
- if ("utf8".equalsIgnoreCase(value) || "utf-8".equalsIgnoreCase(value)) {
- contentType = ContentType.create(contentType, ContentType.PARAMETER_CHARSET_UTF8);
+ final String charSetValue = acceptedType.getParameter(ContentType.PARAMETER_CHARSET);
+ if (charSetValue != null) {
+ if ("utf8".equalsIgnoreCase(charSetValue) || "utf-8".equalsIgnoreCase(charSetValue)) {
+ contentType = ContentType.create(contentType, ContentType.PARAMETER_CHARSET, "utf-8");
} else {
throw new IllegalArgumentException("charset not supported: " + acceptedType);
}
}
+
+ final String ieee754compatibleValue = acceptedType.getParameter(ContentType.PARAMETER_IEEE754_COMPATIBLE);
+ if ("true".equalsIgnoreCase(ieee754compatibleValue)) {
+ contentType = ContentType.create(contentType, ContentType.PARAMETER_IEEE754_COMPATIBLE, "true");
+ } else if ("false".equalsIgnoreCase(ieee754compatibleValue)) {
+ contentType = ContentType.create(contentType, ContentType.PARAMETER_IEEE754_COMPATIBLE, "false");
+ } else if (ieee754compatibleValue != null) {
+ throw new IllegalArgumentException("Invalid IEEE754Compatible value " + ieee754compatibleValue);
+ }
+
if (acceptedType.matches(contentType)) {
return contentType;
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java
index e444cf4..459c1ae 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java
@@ -33,6 +33,7 @@
import org.apache.olingo.server.api.ODataLibraryException;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.etag.CustomETagSupport;
import org.apache.olingo.server.api.etag.PreconditionException;
import org.apache.olingo.server.api.processor.ActionComplexCollectionProcessor;
import org.apache.olingo.server.api.processor.ActionComplexProcessor;
@@ -72,12 +73,11 @@
public class ODataDispatcher {
- private final HttpMethod method;
+ private static final String NOT_IMPLEMENTED_MESSAGE = "not implemented";
private final UriInfo uriInfo;
private final ODataHandler handler;
- public ODataDispatcher(HttpMethod method, UriInfo uriInfo, ODataHandler handler) {
- this.method = method;
+ public ODataDispatcher(UriInfo uriInfo, ODataHandler handler) {
this.uriInfo = uriInfo;
this.handler = handler;
}
@@ -86,7 +86,7 @@
ODataLibraryException {
switch (uriInfo.getKind()) {
case metadata:
- checkMethod(method, HttpMethod.GET);
+ checkMethod(request.getMethod(), HttpMethod.GET);
final ContentType requestedContentType = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
request, handler.getCustomContentTypeSupport(), RepresentationType.METADATA);
handler.selectProcessor(MetadataProcessor.class)
@@ -94,7 +94,7 @@
break;
case service:
- checkMethod(method, HttpMethod.GET);
+ checkMethod(request.getMethod(), HttpMethod.GET);
if ("".equals(request.getRawODataPath())) {
handler.selectProcessor(RedirectProcessor.class)
.redirect(request, response);
@@ -111,13 +111,13 @@
break;
case batch:
- checkMethod(method, HttpMethod.POST);
+ checkMethod(request.getMethod(), HttpMethod.POST);
new BatchHandler(handler, handler.selectProcessor(BatchProcessor.class))
.process(request, response, true);
break;
default:
- throw new ODataHandlerException("not implemented",
+ throw new ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,
ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
}
}
@@ -169,7 +169,7 @@
break;
default:
- throw new ODataHandlerException("not implemented",
+ throw new ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,
ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
}
}
@@ -194,7 +194,7 @@
handleComplexDispatching(request, response, returnType.isCollection());
break;
default:
- throw new ODataHandlerException("not implemented",
+ throw new ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,
ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
}
}
@@ -203,7 +203,7 @@
final UriResourceAction uriResourceAction) throws ODataApplicationException, ODataLibraryException {
final EdmAction action = uriResourceAction.getAction();
if (action.isBound()) {
- // Only bound actions can have etag control for the binding parameter
+ // Only bound actions can have ETag control for the binding parameter.
validatePreconditions(request, false);
}
final EdmReturnType returnType = action.getReturnType();
@@ -257,7 +257,7 @@
break;
default:
- throw new ODataHandlerException("not implemented",
+ throw new ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,
ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
}
}
@@ -265,44 +265,48 @@
private void handleReferenceDispatching(final ODataRequest request, final ODataResponse response,
final int lastPathSegmentIndex) throws ODataApplicationException, ODataLibraryException {
- final HttpMethod method = request.getMethod();
+ final HttpMethod httpMethod = request.getMethod();
final boolean isCollection = ((UriResourcePartTyped) uriInfo.getUriResourceParts()
.get(lastPathSegmentIndex - 1))
.isCollection();
- if (isCollection && method == HttpMethod.GET) {
+ if (isCollection && httpMethod == HttpMethod.GET) {
final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
request, handler.getCustomContentTypeSupport(), RepresentationType.COLLECTION_REFERENCE);
handler.selectProcessor(ReferenceCollectionProcessor.class)
.readReferenceCollection(request, response, uriInfo, responseFormat);
- } else if (isCollection && method == HttpMethod.POST) {
+ } else if (isCollection && httpMethod == HttpMethod.POST) {
final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
checkContentTypeSupport(requestFormat, RepresentationType.REFERENCE);
handler.selectProcessor(ReferenceProcessor.class)
.createReference(request, response, uriInfo, requestFormat);
- } else if (!isCollection && method == HttpMethod.GET) {
+ } else if (!isCollection && httpMethod == HttpMethod.GET) {
final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
request, handler.getCustomContentTypeSupport(), RepresentationType.REFERENCE);
handler.selectProcessor(ReferenceProcessor.class).readReference(request, response, uriInfo, responseFormat);
- } else if (!isCollection && (method == HttpMethod.PUT || method == HttpMethod.PATCH)) {
+ } else if (!isCollection && (httpMethod == HttpMethod.PUT || httpMethod == HttpMethod.PATCH)) {
final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
checkContentTypeSupport(requestFormat, RepresentationType.REFERENCE);
handler.selectProcessor(ReferenceProcessor.class)
.updateReference(request, response, uriInfo, requestFormat);
- } else if (method == HttpMethod.DELETE) {
+ } else if (httpMethod == HttpMethod.DELETE) {
handler.selectProcessor(ReferenceProcessor.class)
.deleteReference(request, response, uriInfo);
} else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
+ throw new ODataHandlerException(getMethodNotAllowedStringMessage(httpMethod),
+ ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, httpMethod.toString());
}
}
+ private String getMethodNotAllowedStringMessage(final HttpMethod httpMethod) {
+ return "HTTP method " + httpMethod + " is not allowed.";
+ }
+
private void handleValueDispatching(final ODataRequest request, final ODataResponse response,
final int lastPathSegmentIndex) throws ODataApplicationException, ODataLibraryException {
final HttpMethod method = request.getMethod();
@@ -322,6 +326,7 @@
handler.selectProcessor(PrimitiveValueProcessor.class)
.readPrimitiveValue(request, response, uriInfo, requestedContentType);
} else if (method == HttpMethod.PUT && resource instanceof UriResourceProperty) {
+ validatePreconditions(request, false);
final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
checkContentTypeSupport(requestFormat, valueRepresentationType);
final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
@@ -329,10 +334,11 @@
handler.selectProcessor(PrimitiveValueProcessor.class)
.updatePrimitiveValue(request, response, uriInfo, requestFormat, responseFormat);
} else if (method == HttpMethod.DELETE && resource instanceof UriResourceProperty) {
+ validatePreconditions(request, false);
handler.selectProcessor(PrimitiveValueProcessor.class)
.deletePrimitiveValue(request, response, uriInfo);
} else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
+ throw new ODataHandlerException(getMethodNotAllowedStringMessage(method),
ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
}
} else {
@@ -353,7 +359,7 @@
handler.selectProcessor(MediaEntityProcessor.class)
.deleteMediaEntity(request, response, uriInfo);
} else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
+ throw new ODataHandlerException(getMethodNotAllowedStringMessage(method),
ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
}
}
@@ -375,6 +381,7 @@
.readComplex(request, response, uriInfo, requestedContentType);
}
} else if (method == HttpMethod.PUT || method == HttpMethod.PATCH) {
+ validatePreconditions(request, false);
final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
checkContentTypeSupport(requestFormat, complexRepresentationType);
final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
@@ -387,6 +394,7 @@
.updateComplex(request, response, uriInfo, requestFormat, responseFormat);
}
} else if (method == HttpMethod.DELETE) {
+ validatePreconditions(request, false);
if (isCollection) {
handler.selectProcessor(ComplexCollectionProcessor.class)
.deleteComplexCollection(request, response, uriInfo);
@@ -395,7 +403,7 @@
.deleteComplex(request, response, uriInfo);
}
} else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
+ throw new ODataHandlerException(getMethodNotAllowedStringMessage(method),
ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
}
}
@@ -416,6 +424,7 @@
.readPrimitive(request, response, uriInfo, requestedContentType);
}
} else if (method == HttpMethod.PUT || method == HttpMethod.PATCH) {
+ validatePreconditions(request, false);
final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
checkContentTypeSupport(requestFormat, representationType);
final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
@@ -428,6 +437,7 @@
.updatePrimitive(request, response, uriInfo, requestFormat, responseFormat);
}
} else if (method == HttpMethod.DELETE) {
+ validatePreconditions(request, false);
if (isCollection) {
handler.selectProcessor(PrimitiveCollectionProcessor.class)
.deletePrimitiveCollection(request, response, uriInfo);
@@ -436,34 +446,28 @@
.deletePrimitive(request, response, uriInfo);
}
} else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
+ throw new ODataHandlerException(getMethodNotAllowedStringMessage(method),
ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
}
}
private void handleCountDispatching(final ODataRequest request, final ODataResponse response,
final int lastPathSegmentIndex) throws ODataApplicationException, ODataLibraryException {
- final HttpMethod method = request.getMethod();
- if (method == HttpMethod.GET) {
- final UriResource resource = uriInfo.getUriResourceParts().get(lastPathSegmentIndex - 1);
- if (resource instanceof UriResourceEntitySet
- || resource instanceof UriResourceNavigation
- || resource instanceof UriResourceFunction
- && ((UriResourceFunction) resource).getType().getKind() == EdmTypeKind.ENTITY) {
- handler.selectProcessor(CountEntityCollectionProcessor.class)
- .countEntityCollection(request, response, uriInfo);
- } else if (resource instanceof UriResourcePrimitiveProperty
- || resource instanceof UriResourceFunction
- && ((UriResourceFunction) resource).getType().getKind() == EdmTypeKind.PRIMITIVE) {
- handler.selectProcessor(CountPrimitiveCollectionProcessor.class)
- .countPrimitiveCollection(request, response, uriInfo);
- } else {
- handler.selectProcessor(CountComplexCollectionProcessor.class)
- .countComplexCollection(request, response, uriInfo);
- }
+ final UriResource resource = uriInfo.getUriResourceParts().get(lastPathSegmentIndex - 1);
+ if (resource instanceof UriResourceEntitySet
+ || resource instanceof UriResourceNavigation
+ || resource instanceof UriResourceFunction
+ && ((UriResourceFunction) resource).getType().getKind() == EdmTypeKind.ENTITY) {
+ handler.selectProcessor(CountEntityCollectionProcessor.class)
+ .countEntityCollection(request, response, uriInfo);
+ } else if (resource instanceof UriResourcePrimitiveProperty
+ || resource instanceof UriResourceFunction
+ && ((UriResourceFunction) resource).getType().getKind() == EdmTypeKind.PRIMITIVE) {
+ handler.selectProcessor(CountPrimitiveCollectionProcessor.class)
+ .countPrimitiveCollection(request, response, uriInfo);
} else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed for count.",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
+ handler.selectProcessor(CountComplexCollectionProcessor.class)
+ .countComplexCollection(request, response, uriInfo);
}
}
@@ -489,7 +493,7 @@
.createEntity(request, response, uriInfo, requestFormat, responseFormat);
}
} else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
+ throw new ODataHandlerException(getMethodNotAllowedStringMessage(method),
ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
}
} else {
@@ -511,25 +515,29 @@
handler.selectProcessor(isMedia ? MediaEntityProcessor.class : EntityProcessor.class)
.deleteEntity(request, response, uriInfo);
} else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
+ throw new ODataHandlerException(getMethodNotAllowedStringMessage(method),
ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
}
}
}
- private void validatePreconditions(ODataRequest request, boolean isMediaValue) throws PreconditionException {
- // If needed perform preconditions validation
- if (handler.getCustomETagSupport() != null) {
- new PreconditionsValidator(handler.getCustomETagSupport(), uriInfo,
- request.getHeader(HttpHeader.IF_MATCH),
- request.getHeader(HttpHeader.IF_NONE_MATCH)).validatePreconditions(isMediaValue);
+ private void validatePreconditions(final ODataRequest request, final boolean isMediaValue)
+ throws PreconditionException {
+ // If needed perform preconditions validation.
+ final CustomETagSupport eTagSupport = handler.getCustomETagSupport();
+ if (eTagSupport != null
+ && new PreconditionsValidator(uriInfo).mustValidatePreconditions(eTagSupport, isMediaValue)
+ && request.getHeader(HttpHeader.IF_MATCH) == null
+ && request.getHeader(HttpHeader.IF_NONE_MATCH) == null) {
+ throw new PreconditionException("Expected an if-match or if-none-match header.",
+ PreconditionException.MessageKeys.MISSING_HEADER);
}
}
private void checkMethod(final HttpMethod requestMethod, final HttpMethod allowedMethod)
throws ODataHandlerException {
if (requestMethod != allowedMethod) {
- throw new ODataHandlerException("HTTP method " + requestMethod + " is not allowed.",
+ throw new ODataHandlerException(getMethodNotAllowedStringMessage(requestMethod),
ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, requestMethod.toString());
}
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
index d6ed039..830867b 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
@@ -34,6 +34,10 @@
import org.apache.olingo.server.core.uri.validator.UriValidationException;
public class ODataExceptionHelper {
+
+ private ODataExceptionHelper() {
+ //Private Constructor
+ }
public static ODataServerError createServerErrorObject(final UriValidationException e,
final Locale requestedLocale) {
@@ -48,6 +52,8 @@
if (UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND.equals(e.getMessageKey())
|| UriParserSemanticException.MessageKeys.PROPERTY_NOT_IN_TYPE.equals(e.getMessageKey())) {
serverError.setStatusCode(HttpStatusCode.NOT_FOUND.getStatusCode());
+ } else if(UriParserSemanticException.MessageKeys.NOT_IMPLEMENTED.equals(e.getMessageKey())) {
+ serverError.setStatusCode(HttpStatusCode.NOT_IMPLEMENTED.getStatusCode());
} else {
serverError.setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode());
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
index b9989f0..12f2dfd 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
@@ -23,7 +23,6 @@
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.server.api.OData;
@@ -43,6 +42,7 @@
import org.apache.olingo.server.api.serializer.RepresentationType;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.core.debug.ServerCoreDebugger;
import org.apache.olingo.server.core.uri.parser.Parser;
import org.apache.olingo.server.core.uri.parser.UriParserException;
import org.apache.olingo.server.core.uri.parser.UriParserSemanticException;
@@ -55,14 +55,18 @@
private final OData odata;
private final ServiceMetadata serviceMetadata;
private final List<Processor> processors = new LinkedList<Processor>();
+ private final ServerCoreDebugger debugger;
+
private CustomContentTypeSupport customContentTypeSupport;
private CustomETagSupport customETagSupport;
private UriInfo uriInfo;
+ private Exception lastThrownException;
- public ODataHandler(final OData server, final ServiceMetadata serviceMetadata) {
+ public ODataHandler(final OData server, final ServiceMetadata serviceMetadata, ServerCoreDebugger debugger) {
odata = server;
this.serviceMetadata = serviceMetadata;
+ this.debugger = debugger;
register(new DefaultRedirectProcessor());
register(new DefaultProcessor());
@@ -70,63 +74,93 @@
public ODataResponse process(final ODataRequest request) {
ODataResponse response = new ODataResponse();
+ final int responseHandle = debugger.startRuntimeMeasurement("ODataHandler", "process");
try {
-
processInternal(request, response);
-
} catch (final UriValidationException e) {
ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
+ handleException(request, response, serverError, e);
} catch (final UriParserSemanticException e) {
ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
+ handleException(request, response, serverError, e);
} catch (final UriParserSyntaxException e) {
ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
+ handleException(request, response, serverError, e);
} catch (final UriParserException e) {
ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
+ handleException(request, response, serverError, e);
} catch (ContentNegotiatorException e) {
ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
+ handleException(request, response, serverError, e);
} catch (SerializerException e) {
ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
+ handleException(request, response, serverError, e);
} catch (DeserializerException e) {
ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
+ handleException(request, response, serverError, e);
} catch (PreconditionException e) {
ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
+ handleException(request, response, serverError, e);
} catch (ODataHandlerException e) {
ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
+ handleException(request, response, serverError, e);
} catch (ODataApplicationException e) {
ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e);
- handleException(request, response, serverError);
+ handleException(request, response, serverError, e);
} catch (Exception e) {
ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e);
- handleException(request, response, serverError);
+ handleException(request, response, serverError, e);
}
+ debugger.stopRuntimeMeasurement(responseHandle);
return response;
}
private void processInternal(final ODataRequest request, final ODataResponse response)
throws ODataApplicationException, ODataLibraryException {
- validateODataVersion(request, response);
+ final int measurementHandle = debugger.startRuntimeMeasurement("ODataHandler", "processInternal");
- uriInfo = new Parser().parseUri(request.getRawODataPath(), request.getRawQueryPath(), null,
- serviceMetadata.getEdm());
+ response.setHeader(HttpHeader.ODATA_VERSION, ODataServiceVersion.V40.toString());
+ try {
+ validateODataVersion(request);
+ } catch (final ODataHandlerException e) {
+ debugger.stopRuntimeMeasurement(measurementHandle);
+ throw e;
+ }
+ final int measurementUriParser = debugger.startRuntimeMeasurement("UriParser", "parseUri");
+ try {
+ uriInfo = new Parser().parseUri(request.getRawODataPath(), request.getRawQueryPath(), null,
+ serviceMetadata.getEdm());
+ } catch (final ODataLibraryException e) {
+ debugger.stopRuntimeMeasurement(measurementUriParser);
+ debugger.stopRuntimeMeasurement(measurementHandle);
+ throw e;
+ }
+ debugger.stopRuntimeMeasurement(measurementUriParser);
+
+ final int measurementUriValidator = debugger.startRuntimeMeasurement("UriValidator", "validate");
final HttpMethod method = request.getMethod();
- new UriValidator().validate(uriInfo, method);
+ try {
+ new UriValidator().validate(uriInfo, method);
+ } catch (final UriValidationException e) {
+ debugger.stopRuntimeMeasurement(measurementUriValidator);
+ debugger.stopRuntimeMeasurement(measurementHandle);
+ throw e;
+ }
+ debugger.stopRuntimeMeasurement(measurementUriValidator);
- new ODataDispatcher(method, uriInfo, this).dispatch(request, response);
+ final int measurementDispatcher = debugger.startRuntimeMeasurement("ODataDispatcher", "dispatch");
+ try {
+ new ODataDispatcher(uriInfo, this).dispatch(request, response);
+ } finally {
+ debugger.stopRuntimeMeasurement(measurementDispatcher);
+ debugger.stopRuntimeMeasurement(measurementHandle);
+ }
}
public void handleException(final ODataRequest request, final ODataResponse response,
- final ODataServerError serverError) {
-
+ final ODataServerError serverError, Exception exception) {
+ this.lastThrownException = exception;
ErrorProcessor exceptionProcessor;
try {
exceptionProcessor = selectProcessor(ErrorProcessor.class);
@@ -140,21 +174,18 @@
uriInfo == null ? null : uriInfo.getFormatOption(), request, getCustomContentTypeSupport(),
RepresentationType.ERROR);
} catch (final ContentNegotiatorException e) {
- requestedContentType = ODataFormat.JSON.getContentType();
+ requestedContentType = ContentType.JSON;
}
+ final int measurementHandle = debugger.startRuntimeMeasurement("ErrorProcessor", "processError");
exceptionProcessor.processError(request, response, serverError, requestedContentType);
+ debugger.stopRuntimeMeasurement(measurementHandle);
}
- private void validateODataVersion(final ODataRequest request, final ODataResponse response)
- throws ODataHandlerException {
+ private void validateODataVersion(final ODataRequest request) throws ODataHandlerException {
final String maxVersion = request.getHeader(HttpHeader.ODATA_MAX_VERSION);
- response.setHeader(HttpHeader.ODATA_VERSION, ODataServiceVersion.V40.toString());
-
- if (maxVersion != null) {
- if (ODataServiceVersion.isBiggerThan(ODataServiceVersion.V40.toString(), maxVersion)) {
+ if (maxVersion != null && ODataServiceVersion.isBiggerThan(ODataServiceVersion.V40.toString(), maxVersion)) {
throw new ODataHandlerException("ODataVersion not supported: " + maxVersion,
ODataHandlerException.MessageKeys.ODATA_VERSION_NOT_SUPPORTED, maxVersion);
- }
}
}
@@ -188,4 +219,12 @@
public CustomETagSupport getCustomETagSupport() {
return customETagSupport;
}
+
+ public Exception getLastThrownException() {
+ return lastThrownException;
+ }
+
+ public UriInfo getUriInfo() {
+ return uriInfo;
+ }
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerException.java
index 145bae9..62adf19 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerException.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerException.java
@@ -51,6 +51,11 @@
super(developmentMessage, messageKey, parameters);
}
+ public ODataHandlerException(final String developmentMessage, final Throwable cause, final MessageKey messageKey,
+ final String... parameters) {
+ super(developmentMessage, cause, messageKey, parameters);
+ }
+
@Override
protected String getBundleName() {
return DEFAULT_SERVER_BUNDLE_NAME;
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
index 5563f1b..1624943 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this 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
@@ -18,62 +18,109 @@
*/
package org.apache.olingo.server.core;
-import java.io.Closeable;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channel;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.ODataServerError;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ODataHttpHandler;
+import org.apache.olingo.server.api.ODataLibraryException;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.ODataLibraryException;
+import org.apache.olingo.server.api.ODataServerError;
import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.debug.DebugSupport;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.etag.CustomETagSupport;
import org.apache.olingo.server.api.processor.Processor;
import org.apache.olingo.server.api.serializer.CustomContentTypeSupport;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.olingo.server.core.debug.ServerCoreDebugger;
public class ODataHttpHandlerImpl implements ODataHttpHandler {
- private static final Logger LOG = LoggerFactory.getLogger(ODataHttpHandlerImpl.class);
+ public static final int COPY_BUFFER_SIZE = 8192;
- private ODataHandler handler;
+ private final ODataHandler handler;
+ private final ServerCoreDebugger debugger;
+
private int split = 0;
public ODataHttpHandlerImpl(final OData odata, final ServiceMetadata serviceMetadata) {
- handler = new ODataHandler(odata, serviceMetadata);
+ debugger = new ServerCoreDebugger(odata);
+ handler = new ODataHandler(odata, serviceMetadata, debugger);
}
@Override
public void process(final HttpServletRequest request, final HttpServletResponse response) {
- ODataRequest odRequest = null;
+ ODataRequest odRequest = new ODataRequest();
+ Exception exception = null;
ODataResponse odResponse;
+ debugger.resolveDebugMode(request);
+
+ final int processMethodHandle = debugger.startRuntimeMeasurement("ODataHttpHandlerImpl", "process");
try {
- odRequest = new ODataRequest();
fillODataRequest(odRequest, request, split);
+
odResponse = handler.process(odRequest);
// ALL future methods after process must not throw exceptions!
} catch (Exception e) {
+ exception = e;
odResponse = handleException(odRequest, e);
}
+ debugger.stopRuntimeMeasurement(processMethodHandle);
+
+ if (debugger.isDebugMode()) {
+ Map<String, String> serverEnvironmentVariables = createEnvironmentVariablesMap(request);
+ if (exception == null) {
+ // This is to ensure that we have access to the thrown OData Exception
+ exception = handler.getLastThrownException();
+ }
+ odResponse =
+ debugger.createDebugResponse(odRequest, odResponse, exception, handler.getUriInfo(),
+ serverEnvironmentVariables);
+ }
convertToHttp(response, odResponse);
}
+ private Map<String, String> createEnvironmentVariablesMap(HttpServletRequest request) {
+ Map<String, String> environment = new LinkedHashMap<String, String>();
+ environment.put("authType", request.getAuthType());
+ environment.put("localAddr", request.getLocalAddr());
+ environment.put("localName", request.getLocalName());
+ environment.put("localPort", getIntAsString(request.getLocalPort()));
+ environment.put("pathInfo", request.getPathInfo());
+ environment.put("pathTranslated", request.getPathTranslated());
+ environment.put("remoteAddr", request.getRemoteAddr());
+ environment.put("remoteHost", request.getRemoteHost());
+ environment.put("remotePort", getIntAsString(request.getRemotePort()));
+ environment.put("remoteUser", request.getRemoteUser());
+ environment.put("scheme", request.getScheme());
+ environment.put("serverName", request.getServerName());
+ environment.put("serverPort", getIntAsString(request.getServerPort()));
+ environment.put("servletPath", request.getServletPath());
+ return environment;
+ }
+
+ private String getIntAsString(final int number) {
+ return number == 0 ? "unknown" : Integer.toString(number);
+ }
+
@Override
public void setSplit(final int split) {
this.split = split;
@@ -89,65 +136,74 @@
} else {
serverError = ODataExceptionHelper.createServerErrorObject(e);
}
- handler.handleException(odRequest, resp, serverError);
+ handler.handleException(odRequest, resp, serverError, e);
return resp;
}
static void convertToHttp(final HttpServletResponse response, final ODataResponse odResponse) {
response.setStatus(odResponse.getStatusCode());
- for (Entry<String, String> entry : odResponse.getHeaders().entrySet()) {
- response.setHeader(entry.getKey(), entry.getValue());
+ for (Entry<String, List<String>> entry : odResponse.getAllHeaders().entrySet()) {
+ for (String headerValue : entry.getValue()) {
+ response.addHeader(entry.getKey(), headerValue);
+ }
}
- InputStream input = odResponse.getContent();
- if (input != null) {
- OutputStream output = null;
- try {
- output = response.getOutputStream();
- byte[] buffer = new byte[1024];
- int n;
- while (-1 != (n = input.read(buffer))) {
- output.write(buffer, 0, n);
- }
- } catch (IOException e) {
- LOG.error(e.getMessage(), e);
- throw new ODataRuntimeException(e);
- } finally {
- closeStream(output);
- closeStream(input);
- }
+ if (odResponse.getContent() != null) {
+ copyContent(odResponse, response);
}
}
- private static void closeStream(final Closeable closeable) {
+ static void copyContent(final ODataResponse odataResponse, final HttpServletResponse servletResponse) {
+ ReadableByteChannel input = null;
+ WritableByteChannel output = null;
+ try {
+ ByteBuffer inBuffer = ByteBuffer.allocate(COPY_BUFFER_SIZE);
+ output = Channels.newChannel(servletResponse.getOutputStream());
+ input = Channels.newChannel(odataResponse.getContent());
+ while (input.read(inBuffer) > 0) {
+ inBuffer.flip();
+ output.write(inBuffer);
+ inBuffer.rewind();
+ }
+ } catch (IOException e) {
+ throw new ODataRuntimeException("Error on reading request content", e);
+ } finally {
+ closeStream(input);
+ closeStream(output);
+ }
+ }
+
+ private static void closeStream(final Channel closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException e) {
- LOG.error(e.getMessage(), e);
+ // ignore
}
}
}
- private ODataRequest fillODataRequest(final ODataRequest odRequest, final HttpServletRequest httpRequest,
- final int split)
- throws ODataLibraryException {
+ private ODataRequest fillODataRequest(ODataRequest odRequest, final HttpServletRequest httpRequest,
+ final int split) throws ODataLibraryException {
+ final int requestHandle = debugger.startRuntimeMeasurement("ODataHttpHandlerImpl", "fillODataRequest");
try {
odRequest.setBody(httpRequest.getInputStream());
- extractHeaders(odRequest, httpRequest);
- extractUri(odRequest, httpRequest, split);
- extractMethod(odRequest, httpRequest);
+ odRequest.setProtocol(httpRequest.getProtocol());
+ odRequest.setMethod(extractMethod(httpRequest));
+ copyHeaders(odRequest, httpRequest);
+ fillUriInformation(odRequest, httpRequest, split);
return odRequest;
} catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
+ throw new DeserializerException("An I/O exception occurred.", e,
+ DeserializerException.MessageKeys.IO_EXCEPTION);
+ } finally {
+ debugger.stopRuntimeMeasurement(requestHandle);
}
}
- static void extractMethod(final ODataRequest odRequest, final HttpServletRequest httpRequest)
- throws ODataLibraryException {
+ static HttpMethod extractMethod(final HttpServletRequest httpRequest) throws ODataLibraryException {
try {
HttpMethod httpRequestMethod = HttpMethod.valueOf(httpRequest.getMethod());
@@ -156,60 +212,55 @@
String xHttpMethodOverride = httpRequest.getHeader(HttpHeader.X_HTTP_METHOD_OVERRIDE);
if (xHttpMethod == null && xHttpMethodOverride == null) {
- odRequest.setMethod(httpRequestMethod);
+ return httpRequestMethod;
} else if (xHttpMethod == null) {
- odRequest.setMethod(HttpMethod.valueOf(xHttpMethodOverride));
+ return HttpMethod.valueOf(xHttpMethodOverride);
} else if (xHttpMethodOverride == null) {
- odRequest.setMethod(HttpMethod.valueOf(xHttpMethod));
+ return HttpMethod.valueOf(xHttpMethod);
} else {
if (!xHttpMethod.equalsIgnoreCase(xHttpMethodOverride)) {
throw new ODataHandlerException("Ambiguous X-HTTP-Methods",
ODataHandlerException.MessageKeys.AMBIGUOUS_XHTTP_METHOD, xHttpMethod, xHttpMethodOverride);
}
- odRequest.setMethod(HttpMethod.valueOf(xHttpMethod));
+ return HttpMethod.valueOf(xHttpMethod);
}
} else {
- odRequest.setMethod(httpRequestMethod);
+ return httpRequestMethod;
}
} catch (IllegalArgumentException e) {
- throw new ODataHandlerException("Invalid HTTP method" + httpRequest.getMethod(),
+ throw new ODataHandlerException("Invalid HTTP method" + httpRequest.getMethod(), e,
ODataHandlerException.MessageKeys.INVALID_HTTP_METHOD, httpRequest.getMethod());
}
}
- static void extractUri(final ODataRequest odRequest, final HttpServletRequest httpRequest, final int split) {
+ static void fillUriInformation(final ODataRequest odRequest, final HttpServletRequest httpRequest, final int split) {
String rawRequestUri = httpRequest.getRequestURL().toString();
String rawODataPath;
if (!"".equals(httpRequest.getServletPath())) {
- int beginIndex;
- beginIndex = rawRequestUri.indexOf(httpRequest.getServletPath());
- beginIndex += httpRequest.getServletPath().length();
+ int beginIndex = rawRequestUri.indexOf(httpRequest.getServletPath()) + httpRequest.getServletPath().length();
rawODataPath = rawRequestUri.substring(beginIndex);
} else if (!"".equals(httpRequest.getContextPath())) {
- int beginIndex;
- beginIndex = rawRequestUri.indexOf(httpRequest.getContextPath());
- beginIndex += httpRequest.getContextPath().length();
+ int beginIndex = rawRequestUri.indexOf(httpRequest.getContextPath()) + httpRequest.getContextPath().length();
rawODataPath = rawRequestUri.substring(beginIndex);
} else {
rawODataPath = httpRequest.getRequestURI();
}
- String rawServiceResolutionUri;
+ String rawServiceResolutionUri = null;
if (split > 0) {
rawServiceResolutionUri = rawODataPath;
for (int i = 0; i < split; i++) {
- int e = rawODataPath.indexOf("/", 1);
- if (-1 == e) {
+ int index = rawODataPath.indexOf('/', 1);
+ if (-1 == index) {
rawODataPath = "";
+ break;
} else {
- rawODataPath = rawODataPath.substring(e);
+ rawODataPath = rawODataPath.substring(index);
}
}
int end = rawServiceResolutionUri.length() - rawODataPath.length();
rawServiceResolutionUri = rawServiceResolutionUri.substring(0, end);
- } else {
- rawServiceResolutionUri = null;
}
String rawBaseUri = rawRequestUri.substring(0, rawRequestUri.length() - rawODataPath.length());
@@ -222,7 +273,7 @@
odRequest.setRawServiceResolutionUri(rawServiceResolutionUri);
}
- static void extractHeaders(final ODataRequest odRequest, final HttpServletRequest req) {
+ static void copyHeaders(final ODataRequest odRequest, final HttpServletRequest req) {
for (Enumeration<?> headerNames = req.getHeaderNames(); headerNames.hasMoreElements();) {
String headerName = (String) headerNames.nextElement();
List<String> headerValues = new ArrayList<String>();
@@ -243,9 +294,14 @@
public void register(final CustomContentTypeSupport customContentTypeSupport) {
handler.register(customContentTypeSupport);
}
-
+
@Override
public void register(final CustomETagSupport customConcurrencyControlSupport) {
handler.register(customConcurrencyControlSupport);
}
+
+ @Override
+ public void register(final DebugSupport debugSupport) {
+ debugger.setDebugSupportProcessor(debugSupport);
+ }
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java
index 57cceaf..22fdc2b 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java
@@ -18,54 +18,64 @@
*/
package org.apache.olingo.server.core;
+import java.util.Collection;
import java.util.List;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ODataHttpHandler;
import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.debug.DebugResponseHelper;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.deserializer.FixedFormatDeserializer;
import org.apache.olingo.server.api.deserializer.ODataDeserializer;
import org.apache.olingo.server.api.edmx.EdmxReference;
import org.apache.olingo.server.api.etag.ETagHelper;
import org.apache.olingo.server.api.etag.ServiceMetadataETagSupport;
+import org.apache.olingo.server.api.prefer.Preferences;
import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
import org.apache.olingo.server.api.serializer.ODataSerializer;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.uri.UriHelper;
+import org.apache.olingo.server.core.debug.DebugResponseHelperImpl;
import org.apache.olingo.server.core.deserializer.FixedFormatDeserializerImpl;
import org.apache.olingo.server.core.deserializer.json.ODataJsonDeserializer;
+import org.apache.olingo.server.core.deserializer.xml.ODataXmlDeserializer;
import org.apache.olingo.server.core.etag.ETagHelperImpl;
+import org.apache.olingo.server.core.prefer.PreferencesImpl;
import org.apache.olingo.server.core.serializer.FixedFormatSerializerImpl;
import org.apache.olingo.server.core.serializer.json.ODataJsonSerializer;
-import org.apache.olingo.server.core.serializer.xml.ODataXmlSerializerImpl;
+import org.apache.olingo.server.core.serializer.xml.ODataXmlSerializer;
import org.apache.olingo.server.core.uri.UriHelperImpl;
public class ODataImpl extends OData {
@Override
- public ODataSerializer createSerializer(final ODataFormat format) throws SerializerException {
- ODataSerializer serializer;
- switch (format) {
- case JSON:
- case JSON_NO_METADATA:
- case JSON_FULL_METADATA:
- serializer = new ODataJsonSerializer(format);
- break;
- case XML:
- serializer = new ODataXmlSerializerImpl();
- break;
- default:
- throw new SerializerException("Unsupported format: " + format,
- SerializerException.MessageKeys.UNSUPPORTED_FORMAT, format.toString());
+ public ODataSerializer createSerializer(final ContentType contentType) throws SerializerException {
+ ODataSerializer serializer = null;
+
+ if (contentType.isCompatible(ContentType.APPLICATION_JSON)) {
+ final String metadata = contentType.getParameter(ContentType.PARAMETER_ODATA_METADATA);
+ if (metadata == null
+ || ContentType.VALUE_ODATA_METADATA_MINIMAL.equals(metadata)
+ || ContentType.VALUE_ODATA_METADATA_NONE.equals(metadata)) {
+ serializer = new ODataJsonSerializer(contentType);
+ }
+ } else if (contentType.isCompatible(ContentType.APPLICATION_XML)
+ || contentType.isCompatible(ContentType.APPLICATION_ATOM_XML)) {
+ serializer = new ODataXmlSerializer();
}
- return serializer;
+ if (serializer == null) {
+ throw new SerializerException("Unsupported format: " + contentType.toContentTypeString(),
+ SerializerException.MessageKeys.UNSUPPORTED_FORMAT, contentType.toContentTypeString());
+ } else {
+ return serializer;
+ }
}
@Override
@@ -85,8 +95,8 @@
}
@Override
- public ServiceMetadata createServiceMetadata(CsdlEdmProvider edmProvider, List<EdmxReference> references,
- ServiceMetadataETagSupport serviceMetadataETagSupport) {
+ public ServiceMetadata createServiceMetadata(final CsdlEdmProvider edmProvider,
+ final List<EdmxReference> references, final ServiceMetadataETagSupport serviceMetadataETagSupport) {
return new ServiceMetadataImpl(edmProvider, references, serviceMetadataETagSupport);
}
@@ -101,19 +111,17 @@
}
@Override
- public ODataDeserializer createDeserializer(final ODataFormat format) throws DeserializerException {
+ public ODataDeserializer createDeserializer(final ContentType contentType) throws DeserializerException {
ODataDeserializer deserializer;
- switch (format) {
- case JSON:
- case JSON_NO_METADATA:
- case JSON_FULL_METADATA:
- deserializer = new ODataJsonDeserializer();
- break;
- case XML:
- // We do not support XML deserialization right now so this must lead to an error.
- default:
- throw new DeserializerException("Unsupported format: " + format,
- DeserializerException.MessageKeys.UNSUPPORTED_FORMAT, format.toString());
+
+ if (contentType.isCompatible(ContentType.JSON)) {
+ deserializer = new ODataJsonDeserializer(contentType);
+ } else if (contentType.isCompatible(ContentType.APPLICATION_XML)
+ || contentType.isCompatible(ContentType.APPLICATION_ATOM_XML)) {
+ deserializer = new ODataXmlDeserializer();
+ } else {
+ throw new DeserializerException("Unsupported format: " + contentType.toContentTypeString(),
+ DeserializerException.MessageKeys.UNSUPPORTED_FORMAT, contentType.toContentTypeString());
}
return deserializer;
}
@@ -128,4 +136,16 @@
return new ETagHelperImpl();
}
+ @Override
+ public Preferences createPreferences(final Collection<String> preferHeaders) {
+ return new PreferencesImpl(preferHeaders);
+ }
+
+ @Override
+ public DebugResponseHelper createDebugResponseHelper(String debugFormat) {
+ //TODO: What should we do with invalid formats?
+ //TODO: Support more debug formats
+ return new DebugResponseHelperImpl(debugFormat);
+ }
+
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchFacadeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchFacadeImpl.java
index 856897c..9bb042d 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchFacadeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchFacadeImpl.java
@@ -23,7 +23,7 @@
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.batch.BatchFacade;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
import org.apache.olingo.server.api.processor.BatchProcessor;
@@ -34,8 +34,7 @@
private final BatchPartHandler partHandler;
public BatchFacadeImpl(final ODataHandler oDataHandler, final ODataRequest request,
- final BatchProcessor batchProcessor,
- final boolean isStrict) {
+ final BatchProcessor batchProcessor, final boolean isStrict) {
partHandler = new BatchPartHandler(oDataHandler, batchProcessor, this);
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchHandler.java
index 7568f67..18cc69b 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchHandler.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchHandler.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.server.core.batchhandler;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.server.api.ODataApplicationException;
@@ -25,8 +26,8 @@
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.batch.BatchFacade;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException.MessageKeys;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException.MessageKeys;
import org.apache.olingo.server.api.processor.BatchProcessor;
import org.apache.olingo.server.core.ODataHandler;
import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
@@ -55,16 +56,13 @@
}
private void validateContentType(final ODataRequest request) throws BatchDeserializerException {
- final String contentType = request.getHeader(HttpHeader.CONTENT_TYPE);
-
- if (contentType == null || !BatchParserCommon.PATTERN_MULTIPART_BOUNDARY.matcher(contentType).matches()) {
- throw new BatchDeserializerException("Invalid content type", MessageKeys.INVALID_CONTENT_TYPE, 0);
- }
+ // This method does validation.
+ BatchParserCommon.parseContentType(request.getHeader(HttpHeader.CONTENT_TYPE), ContentType.MULTIPART_MIXED, 0);
}
private void validateHttpMethod(final ODataRequest request) throws BatchDeserializerException {
if (request.getMethod() != HttpMethod.POST) {
- throw new BatchDeserializerException("Invalid HTTP method", MessageKeys.INVALID_METHOD, 0);
+ throw new BatchDeserializerException("Invalid HTTP method", MessageKeys.INVALID_METHOD, "0");
}
}
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchPartHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchPartHandler.java
index c3cf73a..653fd5f 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchPartHandler.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchPartHandler.java
@@ -18,30 +18,30 @@
*/
package org.apache.olingo.server.core.batchhandler;
+import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.ODataLibraryException;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.batch.BatchFacade;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
import org.apache.olingo.server.api.processor.BatchProcessor;
import org.apache.olingo.server.core.ODataHandler;
import org.apache.olingo.server.core.batchhandler.referenceRewriting.BatchReferenceRewriter;
-import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
public class BatchPartHandler {
private final ODataHandler oDataHandler;
private final BatchProcessor batchProcessor;
- private final BatchFacade batchFascade;
+ private final BatchFacade batchFacade;
private final BatchReferenceRewriter rewriter;
public BatchPartHandler(final ODataHandler oDataHandler, final BatchProcessor processor,
- final BatchFacade batchFascade) {
+ final BatchFacade batchFacade) {
this.oDataHandler = oDataHandler;
batchProcessor = processor;
- this.batchFascade = batchFascade;
+ this.batchFacade = batchFacade;
rewriter = new BatchReferenceRewriter();
}
@@ -49,8 +49,8 @@
return handle(request, true);
}
- public ODataResponsePart handleBatchRequest(final BatchRequestPart request) throws ODataApplicationException,
- ODataLibraryException {
+ public ODataResponsePart handleBatchRequest(final BatchRequestPart request)
+ throws ODataApplicationException, ODataLibraryException {
if (request.isChangeSet()) {
return handleChangeSet(request);
} else {
@@ -62,7 +62,7 @@
public ODataResponse handle(final ODataRequest request, final boolean isChangeSet)
throws BatchDeserializerException {
- final ODataResponse response;
+ ODataResponse response;
if (isChangeSet) {
rewriter.replaceReference(request);
@@ -75,9 +75,9 @@
}
// Add content id to response
- final String contentId = request.getHeader(BatchParserCommon.HTTP_CONTENT_ID);
+ final String contentId = request.getHeader(HttpHeader.CONTENT_ID);
if (contentId != null) {
- response.setHeader(BatchParserCommon.HTTP_CONTENT_ID, contentId);
+ response.setHeader(HttpHeader.CONTENT_ID, contentId);
}
return response;
@@ -85,7 +85,7 @@
private ODataResponsePart handleChangeSet(final BatchRequestPart request) throws ODataApplicationException,
ODataLibraryException {
- return batchProcessor.processChangeSet(batchFascade, request.getRequests());
+ return batchProcessor.processChangeSet(batchFacade, request.getRequests());
}
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/referenceRewriting/BatchReferenceRewriter.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/referenceRewriting/BatchReferenceRewriter.java
index a39f8c5..a05b1e9 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/referenceRewriting/BatchReferenceRewriter.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/referenceRewriting/BatchReferenceRewriter.java
@@ -23,14 +23,13 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException.MessageKeys;
-import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException.MessageKeys;
public class BatchReferenceRewriter {
private static final String REG_EX_REFERENCE = "\\$(.*)(/.*)?";
@@ -67,7 +66,7 @@
public void addMapping(final ODataRequest request, final ODataResponse response)
throws BatchDeserializerException {
final String resourceUri = getODataPath(request, response);
- final String contentId = request.getHeader(BatchParserCommon.HTTP_CONTENT_ID);
+ final String contentId = request.getHeader(HttpHeader.CONTENT_ID);
contentIdMapping.put(contentId, resourceUri);
}
@@ -79,7 +78,7 @@
if (request.getMethod() == HttpMethod.POST) {
// Create entity
// The URI of the new resource will be generated by the server and published in the location header
- final String locationHeader = response.getHeaders().get(HttpHeader.LOCATION);
+ final String locationHeader = response.getHeader(HttpHeader.LOCATION);
resourceUri = locationHeader == null ? null : parseODataPath(locationHeader, request.getRawBaseUri());
} else {
// Update, Upsert (PUT, PATCH, Delete)
@@ -91,17 +90,15 @@
}
private String parseODataPath(final String uri, final String rawBaseUri) throws BatchDeserializerException {
- int index = uri.indexOf(rawBaseUri);
-
- if (index == 0) {
+ if (uri.indexOf(rawBaseUri) == 0) {
return uri.substring(rawBaseUri.length());
} else {
- throw new BatchDeserializerException("Invalid base uri or uri", MessageKeys.INVALID_URI, 0);
+ throw new BatchDeserializerException("Invalid base uri or uri", MessageKeys.INVALID_URI, "0");
}
}
private String removeSlash(final String rawODataPath, final boolean first) {
- final int indexOfSlash = rawODataPath.indexOf("/");
+ final int indexOfSlash = rawODataPath.indexOf('/');
if (first) {
return (indexOfSlash == 0) ? rawODataPath.substring(1) : rawODataPath;
} else {
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugResponseHelperImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugResponseHelperImpl.java
new file mode 100644
index 0000000..4cc17e6
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugResponseHelperImpl.java
@@ -0,0 +1,302 @@
+/*
+ * 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.debug;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.debug.DebugInformation;
+import org.apache.olingo.server.api.debug.DebugResponseHelper;
+import org.apache.olingo.server.api.debug.DebugSupport;
+import org.apache.olingo.server.api.debug.RuntimeMeasurement;
+import org.apache.olingo.server.core.serializer.utils.CircleStreamBuffer;
+
+import com.fasterxml.jackson.core.JsonEncoding;
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonGenerator;
+
+public class DebugResponseHelperImpl implements DebugResponseHelper {
+
+ private enum DebugFormat {
+ JSON, HTML, DOWNLOAD
+ }
+
+ private final DebugFormat requestedFormat;
+
+ public DebugResponseHelperImpl(String debugFormat) {
+ if (DebugSupport.ODATA_DEBUG_HTML.equals(debugFormat)) {
+ requestedFormat = DebugFormat.HTML;
+ } else if (DebugSupport.ODATA_DEBUG_DOWNLOAD.equals(debugFormat)) {
+ requestedFormat = DebugFormat.DOWNLOAD;
+ } else {
+ requestedFormat = DebugFormat.JSON;
+ }
+ }
+
+ @Override
+ public ODataResponse createDebugResponse(final DebugInformation debugInfo) {
+ try {
+ final List<DebugTab> parts = createParts(debugInfo);
+
+ ODataResponse response = new ODataResponse();
+ String contentTypeString;
+ InputStream body;
+ switch (requestedFormat) {
+ case DOWNLOAD:
+ response.setHeader("Content-Disposition", "attachment; filename=OData-Response."
+ + new Date().toString().replace(' ', '_').replace(':', '.') + ".html");
+ // Download is the same as html except for the above header
+ case HTML:
+ String title = debugInfo.getRequest() == null ?
+ "V4 Service" : "V4 Service: " + debugInfo.getRequest().getRawODataPath();
+ body = wrapInHtml(parts, title);
+ contentTypeString = ContentType.TEXT_HTML.toContentTypeString();
+ break;
+ case JSON:
+ default:
+ body = wrapInJson(parts);
+ contentTypeString = ContentType.APPLICATION_JSON.toContentTypeString();
+ break;
+ }
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, contentTypeString);
+ response.setContent(body);
+
+ return response;
+ } catch (IOException e) {
+ // Should not happen. In case it does the library will deliver a default response. So no handling here.
+ throw new ODataRuntimeException(e);
+ }
+ }
+
+ private List<DebugTab> createParts(final DebugInformation debugInfo) {
+ List<DebugTab> parts = new ArrayList<DebugTab>();
+
+ // request
+ parts.add(new DebugTabRequest(debugInfo.getRequest()));
+
+ // response
+ parts.add(new DebugTabResponse(debugInfo.getApplicationResponse()));
+
+ // server
+ Map<String, String> serverEnvironmentVariables = debugInfo.getServerEnvironmentVariables();
+ if (serverEnvironmentVariables != null && !serverEnvironmentVariables.isEmpty()) {
+ parts.add(new DebugTabServer(serverEnvironmentVariables));
+ }
+
+ // URI
+ if (debugInfo.getUriInfo() != null) {
+ parts.add(new DebugTabUri(debugInfo.getUriInfo()));
+ }
+
+ // runtime measurements
+ List<RuntimeMeasurement> runtimeInformation = debugInfo.getRuntimeInformation();
+ if (runtimeInformation != null && !runtimeInformation.isEmpty()) {
+ parts.add(new DebugTabRuntime(runtimeInformation));
+ }
+
+ // exceptions
+ if (debugInfo.getException() != null) {
+ parts.add(new DebugTabStacktrace(debugInfo.getException()));
+ }
+
+ return parts;
+ }
+
+ private InputStream wrapInJson(final List<DebugTab> parts) throws IOException {
+ IOException cachedException = null;
+ OutputStream outputStream = null;
+
+ try {
+ CircleStreamBuffer csb = new CircleStreamBuffer();
+ outputStream = csb.getOutputStream();
+ JsonGenerator gen = new JsonFactory().createGenerator(outputStream, JsonEncoding.UTF8);
+
+ gen.writeStartObject();
+ DebugTab requestInfo = parts.get(0);
+ gen.writeFieldName(requestInfo.getName().toLowerCase(Locale.ROOT));
+ requestInfo.appendJson(gen);
+
+ DebugTab responseInfo = parts.get(1);
+ gen.writeFieldName(responseInfo.getName().toLowerCase(Locale.ROOT));
+ responseInfo.appendJson(gen);
+
+ gen.writeFieldName("server");
+ gen.writeStartObject();
+ gen.writeStringField("version", getVersion());
+ for (DebugTab part : parts.subList(2, parts.size())) {
+ gen.writeFieldName(part.getName().toLowerCase(Locale.ROOT));
+ part.appendJson(gen);
+ }
+ gen.writeEndObject();
+
+ gen.writeEndObject();
+ gen.close();
+ outputStream.close();
+
+ return csb.getInputStream();
+ } finally {
+ if (outputStream != null) {
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+ if (cachedException != null) {
+ throw cachedException;
+ } else {
+ throw e;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Gets version field information for response. Result is never null.
+ * @return version field information
+ */
+ protected static String getVersion() {
+ final Package pack = DebugResponseHelperImpl.class.getPackage();
+ final String name = pack.getImplementationTitle();
+ final String version = pack.getImplementationVersion();
+ return (name == null ? "Olingo" : name)
+ + (version == null ? "" : " Version " + version);
+ }
+
+ private InputStream wrapInHtml(final List<DebugTab> parts, final String title) throws IOException {
+ StringWriter writer = new StringWriter();
+
+ writer.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\n")
+ .append(" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n")
+ .append("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n")
+ .append("<head>\n")
+ .append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n")
+ .append("<title>")
+ .append(escapeHtml(title))
+ .append("</title>\n")
+ .append("<style type=\"text/css\">\n")
+ .append("body { font-family: Arial, sans-serif; font-size: 13px;\n")
+ .append(" line-height: 16px; margin: 0;\n")
+ .append(" background-color: #eeeeee; color: #333333; }\n")
+ .append(".header { float: left; }\n")
+ .append(".header a { line-height: 22px; padding: 10px 18px;\n")
+ .append(" text-decoration: none; color: #333333; }\n")
+ .append(":target, .header:nth-last-child(2) { background-color: #cccccc; }\n")
+ .append(":target ~ .header:nth-last-child(2) { background-color: inherit; }\n")
+ .append(".header:focus, .header:hover,\n")
+ .append(" .header:nth-last-child(2):focus, .header:nth-last-child(2):hover\n")
+ .append(" { background-color: #999999; }\n")
+ .append(".section { position: absolute; top: 42px; min-width: 100%;\n")
+ .append(" padding-top: 18px; border-top: 1px solid #dddddd; }\n")
+ .append(".section > * { margin-left: 18px; }\n")
+ .append(":target + .section, .section:last-child { display: block; }\n")
+ .append(".section, :target + .section ~ .section { display: none; }\n")
+ .append("h1 { font-size: 18px; font-weight: normal; margin: 10px 0; }\n")
+ .append("h2 { font-size: 15px; }\n")
+ .append("h2:not(:first-child) { margin-top: 2em; }\n")
+ .append("table { border-collapse: collapse; border-spacing: 0;\n")
+ .append(" margin-top: 1.5em; }\n")
+ .append("table, thead { border-width: 1px 0; border-style: solid;\n")
+ .append(" border-color: #dddddd; text-align: left; }\n")
+ .append("th.name, td.name { padding: 1ex 2em 1ex 0; }\n")
+ .append("tbody > tr:hover { background-color: #cccccc; }\n")
+ .append(".code { font-family: \"Courier New\", monospace; }\n")
+ .append(".code, .tree li { line-height: 15px; }\n")
+ .append(".code a { text-decoration: underline; color: #666666; }\n")
+ .append(".xml .ns { font-style: italic; color: #999999; }\n")
+ .append("ul, .tree { list-style-type: none; }\n")
+ .append("div > ul.expr, div > .expand, .tree { padding-left: 0; }\n")
+ .append(".expr, .expand, .null, .numeric { padding-left: 1.5em; }\n")
+ .append(".json { white-space: pre-wrap; }\n")
+ .append("</style>\n")
+ .append("</head>\n")
+ .append("<body>\n");
+ char count = '0';
+ for (final DebugTab part : parts) {
+ writer.append("<div class=\"header\" id=\"sec").append(++count).append("\">\n")
+ .append("<h1><a href=\"#sec").append(count).append("\">")
+ .append(part.getName())
+ .append("</a></h1>\n")
+ .append("</div>\n")
+ .append("<div class=\"section\">\n");
+ part.appendHtml(writer);
+ writer.append("</div>\n");
+ }
+ writer.append("</body>\n")
+ .append("</html>\n")
+ .close();
+ byte[] bytes = writer.toString().getBytes("UTF-8");
+ return new ByteArrayInputStream(bytes);
+ }
+
+ protected static String escapeHtml(final String value) {
+ return value == null ? null : value.replace("&", "&").replace("<", "<").replace(">", ">");
+ }
+
+ protected static void appendJsonTable(JsonGenerator gen, final Map<String, String> entries)
+ throws IOException {
+ if (entries == null || entries.isEmpty()) {
+ gen.writeNull();
+ } else {
+ gen.writeStartObject();
+ for (Map.Entry<String, String> entry : entries.entrySet()) {
+ gen.writeFieldName(entry.getKey());
+ if (entry.getValue() == null) {
+ gen.writeNull();
+ } else {
+ gen.writeString(entry.getValue());
+ }
+ }
+ gen.writeEndObject();
+ }
+ }
+
+ protected static void appendHtmlTable(Writer writer, final Map<String, String> entries) throws IOException {
+ writer.append("<table>\n<thead>\n")
+ .append("<tr><th class=\"name\">Name</th><th class=\"value\">Value</th></tr>\n")
+ .append("</thead>\n<tbody>\n");
+ if (entries != null && !entries.isEmpty()) {
+ for (final Entry<String, String> entry : entries.entrySet()) {
+ writer.append("<tr><td class=\"name\">").append(entry.getKey()).append("</td>")
+ .append("<td class=\"value\">");
+ if (entry.getValue() != null) {
+ writer.append(escapeHtml(entry.getValue()));
+ } else {
+ writer.append("null");
+ }
+ writer.append("</td></tr>\n");
+ }
+ }
+ writer.append("</tbody>\n</table>\n");
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTab.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTab.java
new file mode 100644
index 0000000..76384b0
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTab.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.server.core.debug;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+
+
+/**
+ * Debug information.
+ */
+public interface DebugTab {
+
+ /**
+ * Gets the name of this debug information part, useful as title.
+ * @return the name
+ */
+ String getName();
+
+ /**
+ * Appends the content of this debug information part
+ * to the given JSON stream writer.
+ * @param jsonGenerator a JSON generator
+ */
+ void appendJson(JsonGenerator jsonGenerator) throws IOException;
+
+ /**
+ * Appends the content of this debug information part to the given writer.
+ * @param writer a {@link Writer}
+ */
+ void appendHtml(Writer writer) throws IOException;
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabBody.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabBody.java
new file mode 100644
index 0000000..36c1d05
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabBody.java
@@ -0,0 +1,129 @@
+/*
+ * 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.debug;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.server.api.ODataResponse;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+
+/**
+ * Response body debug information.
+ */
+public class DebugTabBody implements DebugTab {
+
+ private static enum ResponseContent {
+ JSON, XML, TEXT, IMAGE
+ };
+
+ private final ODataResponse response;
+ private final ResponseContent responseContent;
+
+ public DebugTabBody(final ODataResponse response) {
+ this.response = response;
+ if (response != null) {
+ final String contentTypeString = response.getHeader(HttpHeader.CONTENT_TYPE);
+ if (contentTypeString != null) {
+ if (contentTypeString.startsWith("application/json")) {
+ responseContent = ResponseContent.JSON;
+ } else if (contentTypeString.startsWith("image/")) {
+ responseContent = ResponseContent.IMAGE;
+ } else if (contentTypeString.contains("xml")) {
+ responseContent = ResponseContent.XML;
+ } else {
+ responseContent = ResponseContent.TEXT;
+ }
+ } else {
+ responseContent = ResponseContent.TEXT;
+ }
+ } else {
+ responseContent = ResponseContent.TEXT;
+ }
+ }
+
+ @Override
+ public String getName() {
+ return "Body";
+ }
+
+//
+ @Override
+ public void appendJson(final JsonGenerator gen) throws IOException {
+ if (response == null || response.getContent() == null) {
+ gen.writeNull();
+ } else {
+ gen.writeString(getContentString());
+ }
+ }
+
+ private String getContentString() {
+ try {
+ String contentString;
+ switch (responseContent) {
+ case IMAGE:
+ contentString = Base64.encodeBase64String(IOUtils.toString(response.getContent()).getBytes("UTF-8"));
+ break;
+ case JSON:
+ case XML:
+ case TEXT:
+ default:
+ contentString = IOUtils.toString(response.getContent(), "UTF-8");
+ break;
+ }
+ return contentString;
+ } catch (IOException e) {
+ return "Could not parse Body for Debug Output";
+ }
+ }
+
+ @Override
+ public void appendHtml(final Writer writer) throws IOException {
+
+ final String body =
+ response == null || response.getContent() == null ? "ODataLibrary: No body." : getContentString();
+ switch (responseContent) {
+ case XML:
+ writer.append("<pre class=\"code").append(" xml").append("\">\n");
+ writer.append(DebugResponseHelperImpl.escapeHtml(body));
+ writer.append("\n</pre>\n");
+ break;
+ case JSON:
+ writer.append("<pre class=\"code").append(" json").append("\">\n");
+ writer.append(DebugResponseHelperImpl.escapeHtml(body));
+ writer.append("\n</pre>\n");
+ break;
+ case IMAGE:
+ writer.append("<img src=\"data:").append(response.getHeader(HttpHeader.CONTENT_TYPE)).append(";base64,")
+ .append(body)
+ .append("\" />\n");
+ break;
+ case TEXT:
+ default:
+ writer.append("<pre class=\"code").append("\">\n");
+ writer.append(DebugResponseHelperImpl.escapeHtml(body));
+ writer.append("\n</pre>\n");
+ break;
+ }
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRequest.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRequest.java
new file mode 100644
index 0000000..4f9bc5c
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRequest.java
@@ -0,0 +1,129 @@
+/*
+ * 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.debug;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.server.api.ODataRequest;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+
+/**
+ * Request debug information.
+ */
+public class DebugTabRequest implements DebugTab {
+
+ private static final String UNKOWN_MSG = "unkown";
+ private final String method;
+ private final String uri;
+ private final String protocol;
+ private final Map<String, List<String>> headers;
+
+ public DebugTabRequest(ODataRequest request) {
+ if (request != null) {
+ method = request.getMethod() == null ? UNKOWN_MSG : request.getMethod().toString();
+ uri = request.getRawRequestUri() == null ? UNKOWN_MSG : request.getRawRequestUri();
+ protocol = request.getProtocol() == null ? UNKOWN_MSG : request.getProtocol();
+ headers = request.getAllHeaders();
+ } else {
+ method = UNKOWN_MSG;
+ uri = UNKOWN_MSG;
+ protocol = UNKOWN_MSG;
+ headers = Collections.emptyMap();
+ }
+ }
+
+ @Override
+ public void appendHtml(final Writer writer) throws IOException {
+ writer.append("<h2>Request Method</h2>\n")
+ .append("<p>").append(method).append("</p>\n")
+ .append("<h2>Request URI</h2>\n")
+ .append("<p>").append(DebugResponseHelperImpl.escapeHtml(uri)).append("</p>\n")
+ .append("<h2>Request Protocol</h2>\n")
+ .append("<p>").append(DebugResponseHelperImpl.escapeHtml(protocol)).append("</p>\n");
+ writer.append("<h2>Request Headers</h2>\n");
+
+ writer.append("<table>\n<thead>\n")
+ .append("<tr><th class=\"name\">Name</th><th class=\"value\">Value</th></tr>\n")
+ .append("</thead>\n<tbody>\n");
+ for (final Map.Entry<String, List<String>> entry : headers.entrySet()) {
+ List<String> headersList = entry.getValue();
+ if (headersList != null && !headersList.isEmpty()) {
+ for (String headerValue : headersList) {
+ writer.append("<tr><td class=\"name\">").append(entry.getKey()).append("</td>")
+ .append("<td class=\"value\">")
+ .append(DebugResponseHelperImpl.escapeHtml(headerValue))
+ .append("</td></tr>\n");
+ }
+ }
+ }
+ writer.append("</tbody>\n</table>\n");
+ }
+
+ @Override
+ public String getName() {
+ return "Request";
+ }
+
+ @Override
+ public void appendJson(JsonGenerator gen) throws IOException {
+ gen.writeStartObject();
+ gen.writeStringField("method", method);
+
+ gen.writeStringField("uri", uri);
+
+ gen.writeStringField("protocol", protocol);
+
+ if (!headers.isEmpty()) {
+ gen.writeFieldName("headers");
+
+ gen.writeStartObject();
+
+ for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
+ List<String> headersList = entry.getValue();
+ if (headersList != null && !headersList.isEmpty()) {
+ if (headersList.size() == 1) {
+ gen.writeStringField(entry.getKey(), headersList.get(0));
+ } else {
+ gen.writeFieldName(entry.getKey());
+ gen.writeStartArray();
+ for (String headerValue : headersList) {
+ if (headerValue != null) {
+ gen.writeString(headerValue);
+ } else {
+ gen.writeNull();
+ }
+ }
+ gen.writeEndArray();
+ }
+ } else {
+ gen.writeNullField(entry.getKey());
+ }
+ }
+
+ gen.writeEndObject();
+ }
+
+ gen.writeEndObject();
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabResponse.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabResponse.java
new file mode 100644
index 0000000..12ffc00
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabResponse.java
@@ -0,0 +1,111 @@
+/*
+ * 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.debug;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataResponse;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+
+/**
+ * Response debug information.
+ */
+public class DebugTabResponse implements DebugTab {
+
+ private final ODataResponse response;
+ private final HttpStatusCode status;
+ private final Map<String, List<String>> headers;
+
+ public DebugTabResponse(final ODataResponse applicationResponse) {
+ this.response = applicationResponse;
+ if (response != null) {
+ status = HttpStatusCode.fromStatusCode(response.getStatusCode());
+ headers = response.getAllHeaders();
+ } else {
+ status = HttpStatusCode.INTERNAL_SERVER_ERROR;
+ headers = Collections.emptyMap();
+ }
+ }
+
+ @Override
+ public String getName() {
+ return "Response";
+ }
+
+ @Override
+ public void appendJson(final JsonGenerator gen) throws IOException {
+ gen.writeStartObject();
+
+ if (status != null) {
+ gen.writeFieldName("status");
+ gen.writeStartObject();
+ gen.writeStringField("code", Integer.toString(status.getStatusCode()));
+ gen.writeStringField("info", status.getInfo());
+ gen.writeEndObject();
+ }
+
+ if (headers != null && !headers.isEmpty()) {
+ gen.writeFieldName("headers");
+ DebugResponseHelperImpl.appendJsonTable(gen, map(headers));
+ }
+
+ gen.writeFieldName("body");
+ if (response != null && response.getContent() != null) {
+ new DebugTabBody(response).appendJson(gen);
+ } else {
+ gen.writeNull();
+ }
+
+ gen.writeEndObject();
+ }
+
+ private Map<String, String> map(Map<String, List<String>> headers) {
+ Map<String, String> result = new HashMap<String, String>();
+ for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
+ if (entry.getValue().size() == 1) {
+ result.put(entry.getKey(), entry.getValue().get(0));
+ } else {
+ result.put(entry.getKey(), entry.getValue().toString());
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public void appendHtml(final Writer writer) throws IOException {
+ writer.append("<h2>Status Code</h2>\n")
+ .append("<p>").append(Integer.toString(status.getStatusCode())).append(' ')
+ .append(status.getInfo()).append("</p>\n")
+ .append("<h2>Response Headers</h2>\n");
+ DebugResponseHelperImpl.appendHtmlTable(writer, map(headers));
+ writer.append("<h2>Response Body</h2>\n");
+ if (response != null && response.getContent() != null) {
+ new DebugTabBody(response).appendHtml(writer);
+ } else {
+ writer.append("<p>ODataLibrary: no response body</p>\n");
+ }
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRuntime.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRuntime.java
new file mode 100644
index 0000000..757a8b3
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabRuntime.java
@@ -0,0 +1,181 @@
+/*
+ * 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.debug;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.olingo.server.api.debug.RuntimeMeasurement;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+
+/**
+ * Runtime debug information.
+ */
+public class DebugTabRuntime implements DebugTab {
+
+ private final RuntimeNode rootNode;
+
+ public DebugTabRuntime(List<RuntimeMeasurement> runtimeInformation) {
+ rootNode = new RuntimeNode();
+ for (final RuntimeMeasurement runtimeMeasurement : runtimeInformation) {
+ rootNode.add(runtimeMeasurement);
+ }
+ rootNode.combineRuntimeMeasurements();
+ }
+
+ @Override
+ public String getName() {
+ return "Runtime";
+ }
+
+ @Override
+ public void appendJson(JsonGenerator gen) throws IOException {
+ appendJsonChildren(gen, rootNode);
+ }
+
+ private void appendJsonChildren(JsonGenerator gen, RuntimeNode node) throws IOException {
+ gen.writeStartArray();
+ for (RuntimeNode child : node.children) {
+ appendJsonNode(gen, child);
+ }
+ gen.writeEndArray();
+ }
+
+ private void appendJsonNode(JsonGenerator gen, RuntimeNode node) throws IOException {
+ gen.writeStartObject();
+ gen.writeStringField("class", node.className);
+ gen.writeStringField("method ", node.methodName);
+
+ if (node.timeStopped == 0) {
+ gen.writeNullField("duration");
+ } else {
+ gen.writeStringField("duration", Long.toString((node.timeStopped - node.timeStarted) / 1000));
+ gen.writeStringField("unit", "µs");
+ }
+
+ if (!node.children.isEmpty()) {
+ gen.writeFieldName("children");
+ appendJsonChildren(gen, node);
+ }
+
+ gen.writeEndObject();
+ }
+
+ @Override
+ public void appendHtml(final Writer writer) throws IOException {
+ appendRuntimeNode(rootNode, "", true, writer);
+ }
+
+ private void appendRuntimeNode(final RuntimeNode node, final String draw, final boolean isLast, final Writer writer)
+ throws IOException {
+ if (node.className != null) {
+ writer.append("<li>\n")
+ .append("<span class=\"code\">")
+ .append("<span class=\"draw\">").append(draw)
+ .append(isLast ? "└" : "├").append("─ </span>")
+ .append("<span class=\"class\">").append(node.className).append("</span>.")
+ .append("<span class=\"method\">").append(node.methodName).append("(…)")
+ .append("</span></span>");
+ long time = node.timeStopped == 0 ? 0 : (node.timeStopped - node.timeStarted) / 1000;
+ writer.append("<span class=\"").append(time == 0 ? "null" : "numeric")
+ .append("\" title=\"").append(time == 0 ? "Stop time missing" : "Gross duration")
+ .append("\">").append(time == 0 ? "unfinished" : Long.toString(time) + " µs")
+ .append("</span>\n");
+ }
+ if (!node.children.isEmpty()) {
+ writer.append("<ol class=\"tree\">\n");
+ for (final RuntimeNode childNode : node.children) {
+ appendRuntimeNode(childNode,
+ node.className == null ? draw : draw + (isLast ? " " : "│") + " ",
+ node.children.indexOf(childNode) == node.children.size() - 1,
+ writer);
+ }
+ writer.append("</ol>\n");
+ }
+ if (node.className != null) {
+ writer.append("</li>\n");
+ }
+ }
+
+ private class RuntimeNode {
+
+ private String className;
+ private String methodName;
+ private long timeStarted;
+ private long timeStopped;
+ private List<RuntimeNode> children = new ArrayList<RuntimeNode>();
+
+ protected RuntimeNode() {
+ timeStarted = 0;
+ timeStopped = Long.MAX_VALUE;
+ }
+
+ private RuntimeNode(final RuntimeMeasurement runtimeMeasurement) {
+ className = runtimeMeasurement.getClassName();
+ methodName = runtimeMeasurement.getMethodName();
+ timeStarted = runtimeMeasurement.getTimeStarted();
+ timeStopped = runtimeMeasurement.getTimeStopped();
+ }
+
+ protected boolean add(final RuntimeMeasurement runtimeMeasurement) {
+ if (timeStarted <= runtimeMeasurement.getTimeStarted()
+ && timeStopped != 0 && timeStopped >= runtimeMeasurement.getTimeStopped()) {
+ for (RuntimeNode candidate : children) {
+ if (candidate.add(runtimeMeasurement)) {
+ return true;
+ }
+ }
+ children.add(new RuntimeNode(runtimeMeasurement));
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Combines runtime measurements with identical class names and method
+ * names into one measurement, assuming that they originate from a loop
+ * or a similar construct where a summary measurement has been intended.
+ */
+ protected void combineRuntimeMeasurements() {
+ RuntimeNode preceding = null;
+ for (Iterator<RuntimeNode> iterator = children.iterator(); iterator.hasNext();) {
+ final RuntimeNode child = iterator.next();
+ if (preceding != null
+ && preceding.timeStopped != 0 && child.timeStopped != 0
+ && preceding.timeStopped <= child.timeStarted
+ && preceding.children.isEmpty() && child.children.isEmpty()
+ && preceding.methodName.equals(child.methodName)
+ && preceding.className.equals(child.className)) {
+ preceding.timeStarted = child.timeStarted - (preceding.timeStopped - preceding.timeStarted);
+ preceding.timeStopped = child.timeStopped;
+
+ iterator.remove();
+ } else {
+ preceding = child;
+ child.combineRuntimeMeasurements();
+ }
+ }
+ }
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabServer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabServer.java
new file mode 100644
index 0000000..1601075
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabServer.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.debug;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Map;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+
+/**
+ * Server debug information.
+ */
+public class DebugTabServer implements DebugTab {
+
+ private final Map<String, String> serverEnvironmentVariables;
+
+ public DebugTabServer(Map<String, String> serverEnvironmentVariables) {
+ this.serverEnvironmentVariables = serverEnvironmentVariables;
+ }
+
+ @Override
+ public String getName() {
+ return "Environment";
+ }
+
+ @Override
+ public void appendJson(JsonGenerator gen) throws IOException {
+ DebugResponseHelperImpl.appendJsonTable(gen, serverEnvironmentVariables);
+ }
+
+ @Override
+ public void appendHtml(Writer writer) throws IOException {
+ writer.append("<h2>Library Version</h2>\n")
+ .append("<p>").append(DebugResponseHelperImpl.getVersion()).append("</p>\n")
+ .append("<h2>Server Environment</h2>\n");
+ DebugResponseHelperImpl.appendHtmlTable(writer, serverEnvironmentVariables);
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabStacktrace.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabStacktrace.java
new file mode 100644
index 0000000..0d79e85
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabStacktrace.java
@@ -0,0 +1,136 @@
+/*
+ * 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.debug;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import org.apache.olingo.server.api.ODataLibraryException;
+import org.apache.olingo.server.api.ODataLibraryException.ODataErrorMessage;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+
+/**
+ * Exception debug information.
+ */
+public class DebugTabStacktrace implements DebugTab {
+
+ private final Exception exception;
+
+ public DebugTabStacktrace(final Exception exception) {
+ this.exception = exception;
+ }
+
+ @Override
+ public String getName() {
+ return "Stacktrace";
+ }
+
+ @Override
+ public void appendJson(final JsonGenerator gen) throws IOException {
+ gen.writeStartObject();
+ gen.writeFieldName("exceptions");
+ gen.writeStartArray();
+ Throwable throwable = exception;
+ while (throwable != null) {
+ gen.writeStartObject();
+ gen.writeStringField("class", throwable.getClass().getCanonicalName());
+ gen.writeStringField("message", getMessageText(throwable));
+ gen.writeFieldName("invocation");
+ appendJsonStackTraceElement(gen, throwable.getStackTrace()[0]);
+ gen.writeEndObject();
+
+ // Get next exception in the cause list
+ throwable = throwable.getCause();
+ }
+ gen.writeEndArray();
+
+ gen.writeFieldName("stacktrace");
+ gen.writeStartArray();
+ for (final StackTraceElement stackTraceElement : exception.getStackTrace()) {
+ appendJsonStackTraceElement(gen, stackTraceElement);
+ }
+ gen.writeEndArray();
+
+ gen.writeEndObject();
+ }
+
+ private String getMessageText(final Throwable throwable) {
+ String message;
+ if (throwable instanceof ODataLibraryException) {
+ ODataLibraryException ex = (ODataLibraryException) throwable;
+ // We use the default locale
+ ODataErrorMessage translatedMessage = ex.getTranslatedMessage(null);
+ // We provide the best message we can
+ message = translatedMessage.getMessage() == null ? ex.getMessage() : translatedMessage.getMessage();
+ } else {
+ message = throwable.getMessage();
+ }
+ return message;
+ }
+
+ private void appendJsonStackTraceElement(final JsonGenerator gen, final StackTraceElement element)
+ throws IOException {
+ gen.writeStartObject();
+ gen.writeStringField("class", element.getClassName());
+ gen.writeStringField("method", element.getMethodName());
+ gen.writeStringField("line", Integer.toString(element.getLineNumber()));
+ gen.writeEndObject();
+ }
+
+ @Override
+ public void appendHtml(final Writer writer) throws IOException {
+ appendException(exception, writer);
+ writer.append("<h2>Stacktrace</h2>\n");
+ int count = 0;
+ for (final StackTraceElement stackTraceElement : exception.getStackTrace()) {
+ appendStackTraceElement(stackTraceElement, ++count == 1, count == exception.getStackTrace().length, writer);
+ }
+ }
+
+ private void appendException(final Throwable throwable, final Writer writer) throws IOException {
+ if (throwable.getCause() != null) {
+ appendException(throwable.getCause(), writer);
+ }
+ final StackTraceElement details = throwable.getStackTrace()[0];
+ writer.append("<h2>").append(throwable.getClass().getCanonicalName()).append("</h2>\n")
+ .append("<p>")
+ .append(DebugResponseHelperImpl.escapeHtml(getMessageText(throwable)))
+ .append("</p>\n");
+ appendStackTraceElement(details, true, true, writer);
+ }
+
+ private void appendStackTraceElement(final StackTraceElement stackTraceElement,
+ final boolean isFirst, final boolean isLast, final Writer writer) throws IOException {
+ if (isFirst) {
+ writer.append("<table>\n<thead>\n")
+ .append("<tr>\n<th class=\"name\">Class</th>\n")
+ .append("<th class=\"name\">Method</th>\n")
+ .append("<th class=\"value\">Line number in class</th>\n</tr>\n")
+ .append("</thead>\n<tbody>\n");
+ }
+ writer.append("<tr>\n<td class=\"name\">").append(stackTraceElement.getClassName()).append("</td>\n")
+ .append("<td class=\"name\">").append(stackTraceElement.getMethodName()).append("</td>\n")
+ .append("<td class=\"value\">").append(Integer.toString(stackTraceElement.getLineNumber()))
+ .append("</td>\n</tr>\n");
+ if (isLast) {
+ writer.append("</tbody>\n</table>\n");
+ }
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabUri.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabUri.java
new file mode 100644
index 0000000..f67f02d
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/DebugTabUri.java
@@ -0,0 +1,246 @@
+/*
+ * 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.debug;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.List;
+
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.queryoption.CountOption;
+import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
+import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
+import org.apache.olingo.server.api.uri.queryoption.FilterOption;
+import org.apache.olingo.server.api.uri.queryoption.OrderByItem;
+import org.apache.olingo.server.api.uri.queryoption.OrderByOption;
+import org.apache.olingo.server.api.uri.queryoption.SelectItem;
+import org.apache.olingo.server.api.uri.queryoption.SelectOption;
+import org.apache.olingo.server.api.uri.queryoption.SkipOption;
+import org.apache.olingo.server.api.uri.queryoption.TopOption;
+import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
+
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
+
+/**
+ * URI parser debug information.
+ */
+public class DebugTabUri implements DebugTab {
+
+ private final UriInfo uriInfo;
+
+ public DebugTabUri(UriInfo uriInfo) {
+ this.uriInfo = uriInfo;
+ }
+
+ @Override
+ public String getName() {
+ return "URI";
+ }
+
+ @Override
+ public void appendJson(JsonGenerator gen) throws IOException {
+ gen.writeStartObject();
+
+ if (uriInfo.getFormatOption() != null) {
+ gen.writeStringField("format", uriInfo.getFormatOption().getFormat());
+ }
+
+ if (uriInfo.getIdOption() != null) {
+ gen.writeStringField("id", uriInfo.getIdOption().getValue());
+ }
+
+ if (uriInfo.getSkipTokenOption() != null) {
+ gen.writeStringField("skiptoken", uriInfo.getSkipTokenOption().getValue());
+ }
+
+ appendCommonJsonObjects(gen, uriInfo.getCountOption(), uriInfo.getSkipOption(), uriInfo.getTopOption(), uriInfo
+ .getFilterOption(), uriInfo.getOrderByOption(), uriInfo.getSelectOption(), uriInfo.getExpandOption());
+
+ if (uriInfo.getUriResourceParts() != null) {
+ appendURIResourceParts(gen, uriInfo.getUriResourceParts());
+ }
+
+ gen.writeEndObject();
+ }
+
+ private void appendCommonJsonObjects(JsonGenerator gen, CountOption countOption, SkipOption skipOption,
+ TopOption topOption, FilterOption filterOption, OrderByOption orderByOption, SelectOption selectOption,
+ ExpandOption expandOption)
+ throws IOException {
+ if (countOption != null) {
+ gen.writeBooleanField("isCount", countOption.getValue());
+ }
+
+ if (skipOption != null) {
+ gen.writeNumberField("skip", skipOption.getValue());
+ }
+
+ if (topOption != null) {
+ gen.writeNumberField("top", topOption.getValue());
+ }
+
+ if (filterOption != null) {
+ gen.writeFieldName("filter");
+ appendJsonExpressionString(gen, filterOption.getExpression());
+ }
+
+ if (orderByOption != null && orderByOption.getOrders() != null) {
+ gen.writeFieldName("orderby");
+ gen.writeStartObject();
+ gen.writeStringField("nodeType", "orderCollection");
+ gen.writeFieldName("orders");
+ gen.writeStartArray();
+ for (OrderByItem item : orderByOption.getOrders()) {
+ gen.writeStartObject();
+ gen.writeStringField("nodeType", "order");
+ gen.writeStringField("sortorder", item.isDescending() ? "desc" : "asc");
+ gen.writeFieldName("expression");
+ appendJsonExpressionString(gen, item.getExpression());
+ gen.writeEndObject();
+ }
+ gen.writeEndArray();
+ gen.writeEndObject();
+ }
+
+ if (selectOption != null && !selectOption.getSelectItems().isEmpty()) {
+ appendSelectedPropertiesJson(gen, selectOption.getSelectItems());
+ }
+
+ if (expandOption != null && !expandOption.getExpandItems().isEmpty()) {
+ appendExpandedPropertiesJson(gen, expandOption.getExpandItems());
+ }
+ }
+
+ private void appendURIResourceParts(JsonGenerator gen, List<UriResource> uriResourceParts) throws IOException {
+ gen.writeFieldName("uriResourceParts");
+
+ gen.writeStartArray();
+ for (UriResource resource : uriResourceParts) {
+ gen.writeStartObject();
+ gen.writeStringField("uriResourceKind", resource.getKind().toString());
+ gen.writeStringField("segment", resource.toString());
+ gen.writeEndObject();
+ }
+ gen.writeEndArray();
+ }
+
+ private void appendExpandedPropertiesJson(JsonGenerator gen, List<ExpandItem> expandItems) throws IOException {
+ gen.writeFieldName("expand");
+
+ gen.writeStartArray();
+
+ for (ExpandItem item : expandItems) {
+ appendExpandItemJson(gen, item);
+ }
+
+ gen.writeEndArray();
+ }
+
+ private void appendExpandItemJson(JsonGenerator gen, ExpandItem item) throws IOException {
+ gen.writeStartObject();
+
+ if (item.isStar()) {
+ gen.writeBooleanField("star", item.isStar());
+ } else if (item.getResourcePath() != null && item.getResourcePath().getUriResourceParts() != null) {
+ gen.writeFieldName("expandPath");
+ gen.writeStartArray();
+ for (UriResource resource : item.getResourcePath().getUriResourceParts()) {
+ gen.writeStartObject();
+ gen.writeStringField("propertyKind", resource.getKind().toString());
+ gen.writeStringField("propertyName", resource.toString());
+ gen.writeEndObject();
+ }
+ gen.writeEndArray();
+ }
+
+ if (item.isRef()) {
+ gen.writeBooleanField("isRef", item.isRef());
+ }
+
+ if (item.getLevelsOption() != null) {
+ gen.writeNumberField("levels", item.getLevelsOption().getValue());
+ }
+
+ appendCommonJsonObjects(gen, item.getCountOption(), item.getSkipOption(), item.getTopOption(), item
+ .getFilterOption(), item.getOrderByOption(), item.getSelectOption(), item.getExpandOption());
+
+ gen.writeEndObject();
+ }
+
+ private void appendJsonExpressionString(JsonGenerator gen, Expression expression) throws IOException {
+ if (expression == null) {
+ gen.writeNull();
+ return;
+ }
+ String expressionJsonString;
+ try {
+ expressionJsonString = expression.accept(new ExpressionJsonVisitor());
+ } catch (Exception e) {
+ expressionJsonString = "Exception in Debug Filter visitor occurred: " + e.getMessage();
+ }
+
+ gen.writeRawValue(expressionJsonString);
+ }
+
+ private void appendSelectedPropertiesJson(JsonGenerator gen, List<SelectItem> selectItems) throws IOException {
+ gen.writeFieldName("select");
+
+ gen.writeStartArray();
+ for (SelectItem selectItem : selectItems) {
+ appendSelectItemJson(gen, selectItem);
+ }
+ gen.writeEndArray();
+ }
+
+ private void appendSelectItemJson(JsonGenerator gen, SelectItem selectItem) throws IOException {
+ String selectedProperty = "";
+ if (selectItem.isStar()) {
+ if (selectItem.getAllOperationsInSchemaNameSpace() == null) {
+ selectedProperty = "*";
+ } else {
+ selectedProperty = selectItem.getAllOperationsInSchemaNameSpace().getFullQualifiedNameAsString() + ".*";
+ }
+ } else {
+ boolean first = true;
+ for (UriResource resourcePart : selectItem.getResourcePath().getUriResourceParts()) {
+ if (!first) {
+ selectedProperty += "/";
+ }
+ selectedProperty = resourcePart.toString();
+ first = false;
+ }
+ }
+
+ gen.writeString(selectedProperty);
+ }
+
+ @Override
+ public void appendHtml(final Writer writer) throws IOException {
+ writer.append("<h2>Uri Information</h2>\n")
+ .append("<ul class=\"json\">\n<li>\n");
+ JsonGenerator json = new JsonFactory().createGenerator(writer)
+ .setPrettyPrinter(new DefaultPrettyPrinter());
+ appendJson(json);
+ json.close();
+ writer.append("\n</li>\n</ul>\n");
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/ExpressionJsonVisitor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/ExpressionJsonVisitor.java
new file mode 100644
index 0000000..b09a991
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/ExpressionJsonVisitor.java
@@ -0,0 +1,393 @@
+/*
+ * 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.debug;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.uri.UriInfoResource;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceLambdaAll;
+import org.apache.olingo.server.api.uri.UriResourceLambdaAny;
+import org.apache.olingo.server.api.uri.UriResourcePartTyped;
+import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind;
+import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
+import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
+import org.apache.olingo.server.api.uri.queryoption.expression.Literal;
+import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind;
+import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind;
+
+/**
+ * A custom expression visitor which writes down the tree from top to bottom
+ */
+public class ExpressionJsonVisitor implements ExpressionVisitor<String> {
+
+ private static final String ANY_NAME = "ANY";
+ private static final String ALL_NAME = "ALL";
+ private static final String STRING_NAME = "String";
+ private static final String UNKNOWN_NAME = "unknown";
+ private static final String BOOLEAN_NAME = "Boolean";
+ private static final String NUMBER_NAME = "Number";
+ private static final String ENUM_NAME = "enum";
+ private static final String VALUES_NAME = "values";
+ private static final String NAME_NAME = "name";
+ private static final String LAMBDA_REFERENCE_NAME = "lambdaReference";
+ private static final String ALIAS_NAME = "alias";
+ private static final String RESOURCE_SEGMENTS_NAME = "resourceSegments";
+ private static final String MEMBER_NAME = "member";
+ private static final String VALUE_NAME = "value";
+ private static final String LITERAL_NAME = "literal";
+ private static final String EXPRESSION_NAME = "expression";
+ private static final String LAMBDA_VARIABLE_NAME = "lambdaVariable";
+ private static final String LAMBDA_FUNCTION_NAME = "lambdaFunction";
+ private static final String UNARY_NAME = "unary";
+ private static final String BINARY_NAME = "binary";
+ private static final String LEFT_NODE_NAME = "left";
+ private static final String RIGHT_NODE_NAME = "right";
+ private static final String IO_EXCEPTION_OCCURRED_MESSAGE = "IOException occurred";
+ private static final String PARAMETERS_NAME = "parameters";
+ private static final String METHOD_NAME = "method";
+ private static final String OPERAND_NAME = "operand";
+ private static final String TYPE_NAME = "type";
+ private static final String OPERATOR_NAME = "operator";
+ private static final String NODE_TYPE_NAME = "nodeType";
+
+ @Override
+ public String visitBinaryOperator(BinaryOperatorKind operator, String left, String right)
+ throws ExpressionVisitException, ODataApplicationException {
+ try {
+ StringWriter writer = new StringWriter();
+ JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
+ jsonStreamWriter.beginObject().namedStringValue(NODE_TYPE_NAME, BINARY_NAME).separator().namedStringValue(
+ OPERATOR_NAME, operator.toString()).separator().namedStringValueRaw(TYPE_NAME, getType(operator)).separator()
+ .name(LEFT_NODE_NAME).unquotedValue(left).separator().name(RIGHT_NODE_NAME).unquotedValue(right).endObject();
+ writer.flush();
+ return writer.toString();
+ } catch (final IOException e) {
+ throw new ExpressionVisitException(IO_EXCEPTION_OCCURRED_MESSAGE, e);
+ }
+ }
+
+ @Override
+ public String visitUnaryOperator(UnaryOperatorKind operator, String operand) throws ExpressionVisitException,
+ ODataApplicationException {
+ try {
+ StringWriter writer = new StringWriter();
+ JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
+ jsonStreamWriter.beginObject().namedStringValue(NODE_TYPE_NAME, UNARY_NAME).separator()
+ .namedStringValueRaw(OPERATOR_NAME, operator.toString()).separator().namedStringValueRaw(TYPE_NAME,
+ getType(operator)).separator().name(OPERAND_NAME).unquotedValue(operand).endObject();
+ writer.flush();
+ return writer.toString();
+ } catch (final IOException e) {
+ throw new ExpressionVisitException(IO_EXCEPTION_OCCURRED_MESSAGE, e);
+ }
+ }
+
+ @Override
+ public String visitMethodCall(MethodKind methodCall, List<String> parameters) throws ExpressionVisitException,
+ ODataApplicationException {
+ try {
+ StringWriter writer = new StringWriter();
+ JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
+ jsonStreamWriter.beginObject().namedStringValueRaw(NODE_TYPE_NAME, METHOD_NAME).separator()
+ .namedStringValueRaw(OPERATOR_NAME, methodCall.toString()).separator().namedStringValueRaw(TYPE_NAME,
+ getType(methodCall)).separator().name(PARAMETERS_NAME).beginArray();
+ boolean first = true;
+ for (String parameter : parameters) {
+ if (first) {
+ first = false;
+ } else {
+ jsonStreamWriter.separator();
+ }
+ jsonStreamWriter.unquotedValue(parameter);
+ }
+ jsonStreamWriter.endArray().endObject();
+ writer.flush();
+ return writer.toString();
+ } catch (final IOException e) {
+ throw new ExpressionVisitException(IO_EXCEPTION_OCCURRED_MESSAGE, e);
+ }
+ }
+
+ @Override
+ public String visitLambdaExpression(String lambdaFunction, String lambdaVariable, Expression expression)
+ throws ExpressionVisitException, ODataApplicationException {
+ try {
+ StringWriter writer = new StringWriter();
+ JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
+ jsonStreamWriter.beginObject().namedStringValue(NODE_TYPE_NAME, LAMBDA_FUNCTION_NAME).separator()
+ .namedStringValue(LAMBDA_VARIABLE_NAME, lambdaVariable).separator().name(EXPRESSION_NAME);
+
+ // Write expression string object
+ String expressionJsonTree = expression.accept(this);
+ jsonStreamWriter.unquotedValue(expressionJsonTree).endObject();
+ writer.flush();
+ return writer.toString();
+ } catch (final IOException e) {
+ throw new ExpressionVisitException(IO_EXCEPTION_OCCURRED_MESSAGE, e);
+ }
+ }
+
+ @Override
+ public String visitLiteral(Literal literal) throws ExpressionVisitException, ODataApplicationException {
+ try {
+ StringWriter writer = new StringWriter();
+ JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
+ jsonStreamWriter.beginObject().namedStringValueRaw(NODE_TYPE_NAME, LITERAL_NAME).separator().namedStringValueRaw(
+ TYPE_NAME, getTypeString(literal.getType())).separator().namedStringValue(VALUE_NAME, literal.getText())
+ .endObject();
+ writer.flush();
+ return writer.toString();
+ } catch (final IOException e) {
+ throw new ExpressionVisitException(IO_EXCEPTION_OCCURRED_MESSAGE);
+ }
+ }
+
+ @Override
+ public String visitMember(UriInfoResource member) throws ExpressionVisitException, ODataApplicationException {
+ try {
+ StringWriter writer = new StringWriter();
+ JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
+ List<UriResource> uriResourceParts = member.getUriResourceParts();
+ jsonStreamWriter.beginObject().namedStringValue(NODE_TYPE_NAME, MEMBER_NAME).separator()
+ .namedStringValueRaw(TYPE_NAME, getType(uriResourceParts)).separator();
+
+ // write all member properties in an array
+ jsonStreamWriter.name(RESOURCE_SEGMENTS_NAME).beginArray();
+ if (uriResourceParts != null) {
+ boolean first = true;
+ for (UriResource segment : uriResourceParts) {
+ if (first) {
+ first = false;
+ } else {
+ jsonStreamWriter.separator();
+ }
+ appendUriResourcePartObject(jsonStreamWriter, segment);
+ }
+ }
+ jsonStreamWriter.endArray();
+
+ jsonStreamWriter.endObject();
+ writer.flush();
+ return writer.toString();
+ } catch (final IOException e) {
+ throw new ExpressionVisitException(IO_EXCEPTION_OCCURRED_MESSAGE, e);
+ }
+ }
+
+ @Override
+ public String visitAlias(String aliasName) throws ExpressionVisitException, ODataApplicationException {
+ try {
+ StringWriter writer = new StringWriter();
+ JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
+ jsonStreamWriter.beginObject().namedStringValueRaw(NODE_TYPE_NAME, ALIAS_NAME).separator()
+ .namedStringValue(ALIAS_NAME, aliasName).endObject();
+ writer.flush();
+ return writer.toString();
+ } catch (final IOException e) {
+ throw new ExpressionVisitException(IO_EXCEPTION_OCCURRED_MESSAGE, e);
+ }
+ }
+
+ @Override
+ public String visitTypeLiteral(EdmType type) throws ExpressionVisitException, ODataApplicationException {
+ try {
+ StringWriter writer = new StringWriter();
+ JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
+ jsonStreamWriter.beginObject().namedStringValueRaw(NODE_TYPE_NAME, TYPE_NAME).separator()
+ .namedStringValueRaw(TYPE_NAME, getTypeString(type)).endObject();
+ writer.flush();
+ return writer.toString();
+ } catch (final IOException e) {
+ throw new ExpressionVisitException(IO_EXCEPTION_OCCURRED_MESSAGE, e);
+ }
+ }
+
+ @Override
+ public String visitLambdaReference(String variableName) throws ExpressionVisitException, ODataApplicationException {
+ try {
+ StringWriter writer = new StringWriter();
+ JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
+ jsonStreamWriter.beginObject().namedStringValueRaw(NODE_TYPE_NAME, LAMBDA_REFERENCE_NAME).separator()
+ .namedStringValueRaw(NAME_NAME, variableName).endObject();
+ writer.flush();
+ return writer.toString();
+ } catch (final IOException e) {
+ throw new ExpressionVisitException(IO_EXCEPTION_OCCURRED_MESSAGE, e);
+ }
+ }
+
+ @Override
+ public String visitEnum(EdmEnumType type, List<String> enumValues) throws ExpressionVisitException,
+ ODataApplicationException {
+ try {
+ StringWriter writer = new StringWriter();
+ JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
+ jsonStreamWriter.beginObject().namedStringValueRaw(NODE_TYPE_NAME, ENUM_NAME).separator()
+ .namedStringValueRaw(TYPE_NAME, getTypeString(type)).separator();
+ jsonStreamWriter.name(VALUES_NAME).beginArray();
+ if (enumValues != null) {
+ boolean first = true;
+ for (String value : enumValues) {
+ if (first) {
+ first = false;
+ } else {
+ jsonStreamWriter.separator();
+ }
+ jsonStreamWriter.stringValue(value);
+ }
+ }
+ jsonStreamWriter.endArray();
+
+ jsonStreamWriter.endObject();
+ writer.flush();
+ return writer.toString();
+ } catch (final IOException e) {
+ throw new ExpressionVisitException(IO_EXCEPTION_OCCURRED_MESSAGE, e);
+ }
+ }
+
+ private String getType(UnaryOperatorKind operator) {
+ switch (operator) {
+ case MINUS:
+ return NUMBER_NAME;
+ case NOT:
+ return BOOLEAN_NAME;
+ default:
+ return UNKNOWN_NAME;
+ }
+ }
+
+ private String getType(MethodKind methodCall) {
+ switch (methodCall) {
+ case STARTSWITH:
+ case CONTAINS:
+ case ENDSWITH:
+ case ISOF:
+ return BOOLEAN_NAME;
+ case INDEXOF:
+ case LENGTH:
+ case ROUND:
+ case FLOOR:
+ case CEILING:
+ case DAY:
+ case HOUR:
+ case MINUTE:
+ case MONTH:
+ case SECOND:
+ case FRACTIONALSECONDS:
+ return NUMBER_NAME;
+ case CAST:
+ case CONCAT:
+ case DATE:
+ case GEODISTANCE:
+ case GEOINTERSECTS:
+ case GEOLENGTH:
+ case MAXDATETIME:
+ case MINDATETIME:
+ case NOW:
+ case SUBSTRING:
+ case TIME:
+ case TOLOWER:
+ case TOTALOFFSETMINUTES:
+ case TOTALSECONDS:
+ case TOUPPER:
+ case TRIM:
+ case YEAR:
+ return STRING_NAME;
+ default:
+ return UNKNOWN_NAME;
+ }
+ }
+
+ private void appendUriResourcePartObject(JsonStreamWriter jsonStreamWriter, UriResource segment) throws IOException,
+ ExpressionVisitException, ODataApplicationException {
+ if (segment instanceof UriResourceLambdaAll) {
+ UriResourceLambdaAll all = (UriResourceLambdaAll) segment;
+ String lambdaJsonObjectString = visitLambdaExpression(ALL_NAME, all.getLambdaVariable(), all.getExpression());
+ jsonStreamWriter.unquotedValue(lambdaJsonObjectString);
+ return;
+ } else if (segment instanceof UriResourceLambdaAny) {
+ UriResourceLambdaAny any = (UriResourceLambdaAny) segment;
+ String lambdaJsonObjectString = visitLambdaExpression(ANY_NAME, any.getLambdaVariable(), any.getExpression());
+ jsonStreamWriter.unquotedValue(lambdaJsonObjectString);
+ return;
+ } else if (segment instanceof UriResourcePartTyped) {
+ String typeName =
+ ((UriResourcePartTyped) segment).getType().getFullQualifiedName().getFullQualifiedNameAsString();
+ jsonStreamWriter.beginObject().namedStringValue(NODE_TYPE_NAME, segment.getKind().toString()).separator()
+ .namedStringValue(NAME_NAME, segment.toString()).separator().namedStringValueRaw(TYPE_NAME, typeName)
+ .endObject();
+ } else {
+ jsonStreamWriter.beginObject().namedStringValue(NODE_TYPE_NAME, segment.getKind().toString()).separator()
+ .namedStringValue(NAME_NAME, segment.toString()).separator().namedStringValueRaw(TYPE_NAME, null).endObject();
+ }
+ }
+
+ private String getType(BinaryOperatorKind operator) {
+ switch (operator) {
+ case MUL:
+ case DIV:
+ case MOD:
+ case ADD:
+ case SUB:
+ return NUMBER_NAME;
+
+ case HAS:
+ case GT:
+ case GE:
+ case LT:
+ case LE:
+ case EQ:
+ case NE:
+ case AND:
+ case OR:
+ return BOOLEAN_NAME;
+
+ default:
+ return UNKNOWN_NAME;
+ }
+ }
+
+ private String getTypeString(EdmType type) {
+ if (type == null) {
+ return null;
+ }
+ return type.getFullQualifiedName().getFullQualifiedNameAsString();
+ }
+
+ private String getType(List<UriResource> uriResourceParts) {
+ if (uriResourceParts == null || uriResourceParts.isEmpty()) {
+ return null;
+ }
+ UriResource lastSegment = uriResourceParts.get(uriResourceParts.size() - 1);
+ EdmType type = null;
+ if (lastSegment instanceof UriResourcePartTyped) {
+ type = ((UriResourcePartTyped) lastSegment).getType();
+ }
+ return type == null ? UNKNOWN_NAME : type.getFullQualifiedName().getFullQualifiedNameAsString();
+ }
+
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/JsonStreamWriter.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/JsonStreamWriter.java
new file mode 100644
index 0000000..113b45d
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/JsonStreamWriter.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.debug;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * Writes JSON output.
+ *
+ */
+class JsonStreamWriter {
+ private final Writer writer;
+
+ public JsonStreamWriter(final Writer writer) {
+ this.writer = writer;
+ }
+
+ public JsonStreamWriter beginObject() throws IOException {
+ writer.append('{');
+ return this;
+ }
+
+ public JsonStreamWriter endObject() throws IOException {
+ writer.append('}');
+ return this;
+ }
+
+ public JsonStreamWriter beginArray() throws IOException {
+ writer.append('[');
+ return this;
+ }
+
+ public JsonStreamWriter endArray() throws IOException {
+ writer.append(']');
+ return this;
+ }
+
+ public JsonStreamWriter name(final String name) throws IOException {
+ writer.append('"').append(name).append('"').append(':');
+ return this;
+ }
+
+ public JsonStreamWriter unquotedValue(final String value) throws IOException {
+ writer.append(value == null ? "null" : value);
+ return this;
+ }
+
+ public JsonStreamWriter stringValueRaw(final String value) throws IOException {
+ if (value == null) {
+ writer.append("null");
+ } else {
+ writer.append('"').append(value).append('"');
+ }
+ return this;
+ }
+
+ public JsonStreamWriter stringValue(final String value) throws IOException {
+ if (value == null) {
+ writer.append("null");
+ } else {
+ writer.append('"');
+ escape(value);
+ writer.append('"');
+ }
+ return this;
+ }
+
+ public JsonStreamWriter namedStringValueRaw(final String name, final String value) throws IOException {
+ name(name);
+ stringValueRaw(value);
+ return this;
+ }
+
+ public JsonStreamWriter namedStringValue(final String name, final String value) throws IOException {
+ name(name);
+ stringValue(value);
+ return this;
+ }
+
+ public JsonStreamWriter separator() throws IOException {
+ writer.append(',');
+ return this;
+ }
+
+ /**
+ * Writes the JSON-escaped form of a Java String value according to RFC 4627.
+ * @param value the Java String
+ * @throws IOException if an I/O error occurs
+ */
+ protected void escape(final String value) throws IOException {
+ // RFC 4627 says: "All Unicode characters may be placed within the
+ // quotation marks except for the characters that must be escaped:
+ // quotation mark, reverse solidus, and the control characters
+ // (U+0000 through U+001F)."
+ // All output here is done on character basis which should be faster
+ // than writing Strings.
+ for (int i = 0; i < value.length(); i++) {
+ final char c = value.charAt(i);
+ switch (c) {
+ case '\\':
+ writer.append('\\').append(c);
+ break;
+ case '"':
+ writer.append('\\').append(c);
+ break;
+ case '\b':
+ writer.append('\\').append('b');
+ break;
+ case '\t':
+ writer.append('\\').append('t');
+ break;
+ case '\n':
+ writer.append('\\').append('n');
+ break;
+ case '\f':
+ writer.append('\\').append('f');
+ break;
+ case '\r':
+ writer.append('\\').append('r');
+ break;
+ case '\u0000':
+ case '\u0001':
+ case '\u0002':
+ case '\u0003':
+ case '\u0004':
+ case '\u0005':
+ case '\u0006':
+ case '\u0007':
+ case '\u000B':
+ case '\u000E':
+ case '\u000F':
+ case '\u0010':
+ case '\u0011':
+ case '\u0012':
+ case '\u0013':
+ case '\u0014':
+ case '\u0015':
+ case '\u0016':
+ case '\u0017':
+ case '\u0018':
+ case '\u0019':
+ case '\u001A':
+ case '\u001B':
+ case '\u001C':
+ case '\u001D':
+ case '\u001E':
+ case '\u001F':
+ final int lastHexDigit = c % 0x10;
+ writer.append('\\').append('u').append('0').append('0')
+ .append(c >= '\u0010' ? '1' : '0')
+ .append((char) ((lastHexDigit > 9 ? 'A' : '0') + lastHexDigit % 10));
+ break;
+ default:
+ writer.append(c);
+ }
+ }
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/ServerCoreDebugger.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/ServerCoreDebugger.java
new file mode 100644
index 0000000..09ef98d
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/ServerCoreDebugger.java
@@ -0,0 +1,140 @@
+/*
+ * 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.debug;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.debug.DebugInformation;
+import org.apache.olingo.server.api.debug.DebugSupport;
+import org.apache.olingo.server.api.debug.RuntimeMeasurement;
+import org.apache.olingo.server.api.uri.UriInfo;
+
+public class ServerCoreDebugger {
+
+ private final List<RuntimeMeasurement> runtimeInformation = new ArrayList<RuntimeMeasurement>();
+ private final OData odata;
+
+ private boolean isDebugMode = false;
+ private DebugSupport debugSupport;
+ private String debugFormat;
+
+ public ServerCoreDebugger(OData odata) {
+ this.odata = odata;
+ }
+
+ public void resolveDebugMode(HttpServletRequest request) {
+ if (debugSupport != null) {
+ // Should we read the parameter from the servlet here and ignore multiple parameters?
+ debugFormat = request.getParameter(DebugSupport.ODATA_DEBUG_QUERY_PARAMETER);
+ if (debugFormat != null) {
+ debugSupport.init(odata);
+ isDebugMode = debugSupport.isUserAuthorized();
+ }
+ }
+ }
+
+ public ODataResponse createDebugResponse(final ODataRequest request, final ODataResponse response,
+ final Exception exception, final UriInfo uriInfo, final Map<String, String> serverEnvironmentVariables) {
+ //Failsafe so we do not generate unauthorized debug messages
+ if (!isDebugMode) {
+ return response;
+ }
+
+ try {
+ DebugInformation debugInfo =
+ createDebugInformation(request, response, exception, uriInfo, serverEnvironmentVariables);
+
+ return debugSupport.createDebugResponse(debugFormat, debugInfo);
+ } catch (Exception e) {
+ return createFailResponse();
+ }
+ }
+
+ private ODataResponse createFailResponse() {
+ ODataResponse odResponse = new ODataResponse();
+ odResponse.setStatusCode(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode());
+ odResponse.setHeader(HttpHeader.CONTENT_TYPE, ContentType.TEXT_PLAIN.toContentTypeString());
+ InputStream content = new ByteArrayInputStream("ODataLibrary: Could not assemble debug response.".getBytes());
+ odResponse.setContent(content);
+ return odResponse;
+ }
+
+ private DebugInformation createDebugInformation(final ODataRequest request, final ODataResponse response,
+ final Exception exception, final UriInfo uriInfo, final Map<String, String> serverEnvironmentVariables) {
+ DebugInformation debugInfo = new DebugInformation();
+ debugInfo.setRequest(request);
+ debugInfo.setApplicationResponse(response);
+
+ debugInfo.setException(exception);
+
+ debugInfo.setServerEnvironmentVariables(serverEnvironmentVariables);
+
+ debugInfo.setUriInfo(uriInfo);
+
+ debugInfo.setRuntimeInformation(runtimeInformation);
+ return debugInfo;
+ }
+
+ public int startRuntimeMeasurement(final String className, final String methodName) {
+ if (isDebugMode) {
+ int handleId = runtimeInformation.size();
+
+ final RuntimeMeasurement measurement = new RuntimeMeasurement();
+ measurement.setTimeStarted(System.nanoTime());
+ measurement.setClassName(className);
+ measurement.setMethodName(methodName);
+
+ runtimeInformation.add(measurement);
+
+ return handleId;
+ } else {
+ return 0;
+ }
+ }
+
+ public void stopRuntimeMeasurement(final int handle) {
+ if (isDebugMode && handle < runtimeInformation.size()) {
+ long stopTime = System.nanoTime();
+ RuntimeMeasurement runtimeMeasurement = runtimeInformation.get(handle);
+ if (runtimeMeasurement != null) {
+ runtimeMeasurement.setTimeStopped(stopTime);
+ }
+ }
+ }
+
+ public void setDebugSupportProcessor(DebugSupport debugSupport) {
+ this.debugSupport = debugSupport;
+ }
+
+ public boolean isDebugMode() {
+ return isDebugMode;
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/FixedFormatDeserializerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/FixedFormatDeserializerImpl.java
index 46910f1..7c54f1d 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/FixedFormatDeserializerImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/FixedFormatDeserializerImpl.java
@@ -28,9 +28,9 @@
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.deserializer.FixedFormatDeserializer;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
import org.apache.olingo.server.api.deserializer.batch.BatchOptions;
import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
import org.apache.olingo.server.core.deserializer.batch.BatchParser;
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchBodyPart.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchBodyPart.java
index cfb531f..6c88da2 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchBodyPart.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchBodyPart.java
@@ -21,13 +21,14 @@
import java.util.LinkedList;
import java.util.List;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
public class BatchBodyPart implements BatchPart {
- final private String boundary;
- final private boolean isStrict;
- final List<Line> remainingMessage = new LinkedList<Line>();
+ private final String boundary;
+ private final boolean isStrict;
+ private final List<Line> remainingMessage = new LinkedList<Line>();
private Header headers;
private boolean isChangeSet;
@@ -48,35 +49,30 @@
return this;
}
- private boolean isChangeSet(final Header header) throws BatchDeserializerException {
+ private boolean isChangeSet(final Header headers) throws BatchDeserializerException {
final List<String> contentTypes = headers.getHeaders(HttpHeader.CONTENT_TYPE);
- boolean isChangeSet = false;
- if (contentTypes.size() == 0) {
+ if (contentTypes.isEmpty()) {
throw new BatchDeserializerException("Missing content type",
- BatchDeserializerException.MessageKeys.MISSING_CONTENT_TYPE, ""
- + headers.getLineNumber());
+ BatchDeserializerException.MessageKeys.MISSING_CONTENT_TYPE,
+ Integer.toString(headers.getLineNumber()));
}
+ boolean changeSet = false;
for (String contentType : contentTypes) {
if (isContentTypeMultiPartMixed(contentType)) {
- isChangeSet = true;
+ changeSet = true;
}
}
-
- return isChangeSet;
+ return changeSet;
}
private List<BatchQueryOperation> consumeRequest(final List<Line> remainingMessage)
throws BatchDeserializerException {
- if (isChangeSet) {
- return consumeChangeSet(remainingMessage);
- } else {
- return consumeQueryOperation(remainingMessage);
- }
+ return isChangeSet ? consumeChangeSet(remainingMessage) : consumeQueryOperation(remainingMessage);
}
- private List<BatchQueryOperation> consumeChangeSet(final List<Line> remainingMessage2)
+ private List<BatchQueryOperation> consumeChangeSet(List<Line> remainingMessage)
throws BatchDeserializerException {
final List<List<Line>> changeRequests = splitChangeSet(remainingMessage);
final List<BatchQueryOperation> requestList = new LinkedList<BatchQueryOperation>();
@@ -88,10 +84,10 @@
return requestList;
}
- private List<List<Line>> splitChangeSet(final List<Line> remainingMessage2) throws BatchDeserializerException {
+ private List<List<Line>> splitChangeSet(List<Line> remainingMessage) throws BatchDeserializerException {
final HeaderField contentTypeField = headers.getHeaderField(HttpHeader.CONTENT_TYPE);
- final String changeSetBoundary = BatchParserCommon.getBoundary(contentTypeField.getValueNotNull(),
+ final String changeSetBoundary = BatchParserCommon.getBoundary(contentTypeField.getValue(),
contentTypeField.getLineNumber());
validateChangeSetBoundary(changeSetBoundary, headers);
@@ -103,7 +99,7 @@
if (changeSetBoundary.equals(boundary)) {
throw new BatchDeserializerException("Change set boundary is equals to batch request boundary",
BatchDeserializerException.MessageKeys.INVALID_BOUNDARY,
- "" + header.getHeaderField(HttpHeader.CONTENT_TYPE).getLineNumber());
+ Integer.toString(header.getHeaderField(HttpHeader.CONTENT_TYPE).getLineNumber()));
}
}
@@ -116,7 +112,12 @@
}
private boolean isContentTypeMultiPartMixed(final String contentType) {
- return BatchParserCommon.PATTERN_MULTIPART_BOUNDARY.matcher(contentType).matches();
+ try {
+ BatchParserCommon.parseContentType(contentType, ContentType.MULTIPART_MIXED, 0);
+ return true;
+ } catch (final BatchDeserializerException e) {
+ return false;
+ }
}
@Override
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchChangeSetPart.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchChangeSetPart.java
index 47210c3..3c596fd 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchChangeSetPart.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchChangeSetPart.java
@@ -20,7 +20,7 @@
import java.util.List;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
public class BatchChangeSetPart extends BatchQueryOperation {
private BatchQueryOperation request;
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchLineReader.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchLineReader.java
new file mode 100644
index 0000000..c0a1e20
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchLineReader.java
@@ -0,0 +1,223 @@
+/*
+ * 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.deserializer.batch;
+
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
+
+public class BatchLineReader {
+ private static final byte CR = '\r';
+ private static final byte LF = '\n';
+ private static final int EOF = -1;
+ private static final int BUFFER_SIZE = 8192;
+ private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
+ private static final Charset CS_ISO_8859_1 = Charset.forName("iso-8859-1");
+ public static final String BOUNDARY = "boundary";
+ public static final String DOUBLE_DASH = "--";
+ public static final String CRLF = "\r\n";
+ private Charset currentCharset = DEFAULT_CHARSET;
+ private String currentBoundary = null;
+ private ReadState readState = new ReadState();
+ private InputStream reader;
+ private byte[] buffer;
+ private int offset = 0;
+ private int limit = 0;
+
+ public BatchLineReader(final InputStream reader) {
+ this(reader, BUFFER_SIZE);
+ }
+
+ public BatchLineReader(final InputStream reader, final int bufferSize) {
+ if (bufferSize <= 0) {
+ throw new IllegalArgumentException("Buffer size must be greater than zero.");
+ }
+
+ this.reader = reader;
+ buffer = new byte[bufferSize];
+ }
+
+ public void close() throws IOException {
+ reader.close();
+ }
+
+ public List<String> toList() throws IOException {
+ final List<String> result = new ArrayList<String>();
+ String currentLine = readLine();
+ if(currentLine != null) {
+ currentBoundary = currentLine.trim();
+ result.add(currentLine);
+
+ while ((currentLine = readLine()) != null) {
+ result.add(currentLine);
+ }
+ }
+ return result;
+ }
+
+ public List<Line> toLineList() throws IOException {
+ final List<Line> result = new ArrayList<Line>();
+ String currentLine = readLine();
+ if(currentLine != null) {
+ currentBoundary = currentLine.trim();
+ int counter = 1;
+ result.add(new Line(currentLine, counter++));
+
+ while ((currentLine = readLine()) != null) {
+ result.add(new Line(currentLine, counter++));
+ }
+ }
+
+ return result;
+ }
+
+ private void updateCurrentCharset(String currentLine) {
+ if(currentLine != null) {
+ if(currentLine.startsWith(HttpHeader.CONTENT_TYPE)) {
+ String clValue = currentLine.substring(13, currentLine.length() - 2).trim();
+ ContentType ct = ContentType.parse(clValue);
+ if (ct != null) {
+ String charsetString = ct.getParameter(ContentType.PARAMETER_CHARSET);
+ if (charsetString != null) {
+ currentCharset = Charset.forName(charsetString);
+ } else {
+ currentCharset = DEFAULT_CHARSET;
+ }
+ // boundary
+ String boundary = ct.getParameter(BOUNDARY);
+ if (boundary != null) {
+ currentBoundary = DOUBLE_DASH + boundary;
+ }
+ }
+ } else if(CRLF.equals(currentLine)) {
+ readState.foundLinebreak();
+ } else if(isBoundary(currentLine)) {
+ readState.foundBoundary();
+ }
+ }
+ }
+
+ private boolean isBoundary(String currentLine) {
+ if((currentBoundary + CRLF).equals(currentLine)) {
+ return true;
+ } else if((currentBoundary + DOUBLE_DASH + CRLF).equals(currentLine)) {
+ return true;
+ }
+ return false;
+ }
+
+ String readLine() throws IOException {
+ if (limit == EOF) {
+ return null;
+ }
+
+ ByteBuffer innerBuffer = ByteBuffer.allocate(BUFFER_SIZE);
+ boolean foundLineEnd = false; // EOF will be considered as line ending
+
+ while (!foundLineEnd) {
+ // Is buffer refill required?
+ if (limit == offset) {
+ if (fillBuffer() == EOF) {
+ foundLineEnd = true;
+ }
+ }
+
+ if (!foundLineEnd) {
+ byte currentChar = this.buffer[offset++];
+ if(!innerBuffer.hasRemaining()) {
+ innerBuffer.flip();
+ ByteBuffer tmp = ByteBuffer.allocate(innerBuffer.limit() *2);
+ tmp.put(innerBuffer);
+ innerBuffer = tmp;
+ }
+ innerBuffer.put(currentChar);
+
+ if (currentChar == LF) {
+ foundLineEnd = true;
+ } else if (currentChar == CR) {
+ foundLineEnd = true;
+
+ // Check next byte. Consume \n if available
+ // Is buffer refill required?
+ if (limit == offset) {
+ fillBuffer();
+ }
+
+ // Check if there is at least one character
+ if (limit != EOF && this.buffer[offset] == LF) {
+ innerBuffer.put(LF);
+ offset++;
+ }
+ }
+ }
+ }
+
+ if(innerBuffer.position() == 0) {
+ return null;
+ } else {
+ String currentLine;
+ if(readState.isReadBody()) {
+ currentLine = new String(innerBuffer.array(), 0, innerBuffer.position(), getCurrentCharset());
+ } else {
+ currentLine = new String(innerBuffer.array(), 0, innerBuffer.position(), CS_ISO_8859_1);
+ }
+ updateCurrentCharset(currentLine);
+ return currentLine;
+ }
+ }
+
+ private int fillBuffer() throws IOException {
+ limit = reader.read(buffer, 0, buffer.length);
+ offset = 0;
+
+ return limit;
+ }
+
+ private Charset getCurrentCharset() {
+ return currentCharset;
+ }
+
+ /**
+ * Read state indicator (whether currently the <code>body</code> or <code>header</code> part is read).
+ */
+ private static class ReadState {
+ private int state = 0;
+
+ public void foundLinebreak() {
+ state++;
+ }
+ public void foundBoundary() {
+ state = 0;
+ }
+ public boolean isReadBody() {
+ return state >= 2;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(state);
+ }
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParser.java
index 17b10bc..243cbe0 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParser.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParser.java
@@ -20,12 +20,11 @@
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.List;
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
import org.apache.olingo.server.api.deserializer.batch.BatchOptions;
import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
@@ -74,7 +73,7 @@
private List<List<Line>> splitBodyParts(final InputStream in, final String boundary) throws IOException,
BatchDeserializerException {
- final BufferedReaderIncludingLineEndings reader = new BufferedReaderIncludingLineEndings(new InputStreamReader(in));
+ final BatchLineReader reader = new BatchLineReader(in);
final List<Line> message = reader.toLineList();
reader.close();
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java
index ed75acf..256e05e 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java
@@ -20,91 +20,99 @@
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import java.util.ArrayList;
+import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.Locale;
+import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.olingo.commons.api.http.HttpContentType;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
public class BatchParserCommon {
- private static final String REG_EX_BOUNDARY =
- "([a-zA-Z0-9_\\-\\.'\\+]{1,70})|\"([a-zA-Z0-9_\\-\\.'\\+\\s\\" +
- "(\\),/:=\\?]{1,69}[a-zA-Z0-9_\\-\\.'\\+\\(\\),/:=\\?])\"";
- private static final Pattern PATTERN_LAST_CRLF = Pattern.compile("(.*)(\r\n){1}( *)", Pattern.DOTALL);
+ private static final String PATTERN_BOUNDARY =
+ "([a-zA-Z0-9_\\-\\.'\\+]{1,70})|"
+ + "\"([a-zA-Z0-9_\\-\\.'\\+\\s\\(\\),/:=\\?]{1,69}[a-zA-Z0-9_\\-\\.'\\+\\(\\),/:=\\?])\"";
+ private static final Pattern PATTERN_LAST_CRLF = Pattern.compile("(.*)\\r\\n\\s*", Pattern.DOTALL);
private static final Pattern PATTERN_HEADER_LINE = Pattern.compile("([a-zA-Z\\-]+):\\s?(.*)\\s*");
- private static final String REG_EX_APPLICATION_HTTP = "application/http";
- public static final Pattern PATTERN_MULTIPART_BOUNDARY = Pattern.compile("multipart/mixed(.*)",
- Pattern.CASE_INSENSITIVE);
- public static final Pattern PATTERN_CONTENT_TYPE_APPLICATION_HTTP = Pattern.compile(REG_EX_APPLICATION_HTTP,
- Pattern.CASE_INSENSITIVE);
+ public static final String CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
+
+ protected static final String BOUNDARY = "boundary";
public static final String BINARY_ENCODING = "binary";
- public static final String HTTP_CONTENT_ID = "Content-Id";
- public static final String HTTP_CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
- public static final String HTTP_EXPECT = "Expect";
- public static final String HTTP_FROM = "From";
- public static final String HTTP_MAX_FORWARDS = "Max-Forwards";
- public static final String HTTP_RANGE = "Range";
- public static final String HTTP_TE = "TE";
+ private BatchParserCommon() { /* private ctor for helper class */}
public static String getBoundary(final String contentType, final int line) throws BatchDeserializerException {
- if (contentType == null) {
- throw new BatchDeserializerException("Missing content type",
- BatchDeserializerException.MessageKeys.MISSING_CONTENT_TYPE, line);
- }
-
- if (contentType.toLowerCase(Locale.ENGLISH).startsWith("multipart/mixed")) {
- final String[] parameter = contentType.split(";");
-
- for (final String pair : parameter) {
-
- final String[] attrValue = pair.split("=");
- if (attrValue.length == 2 && "boundary".equals(attrValue[0].trim().toLowerCase(Locale.ENGLISH))) {
- if (attrValue[1].matches(REG_EX_BOUNDARY)) {
- return trimQuota(attrValue[1].trim());
- } else {
- throw new BatchDeserializerException("Invalid boundary format",
- BatchDeserializerException.MessageKeys.INVALID_BOUNDARY, "" + line);
- }
+ final ContentType type = parseContentType(contentType, ContentType.MULTIPART_MIXED, line);
+ final Map<String, String> parameters = type.getParameters();
+ for (final Map.Entry<String, String> entries : parameters.entrySet()) {
+ if (BOUNDARY.equalsIgnoreCase(entries.getKey())) {
+ final String boundary = entries.getValue().trim();
+ if (boundary.matches(PATTERN_BOUNDARY)) {
+ return trimQuotes(boundary);
+ } else {
+ throw new BatchDeserializerException("Invalid boundary format",
+ BatchDeserializerException.MessageKeys.INVALID_BOUNDARY, Integer.toString(line));
}
-
}
}
- throw new BatchDeserializerException("Content type is not multipart mixed",
- BatchDeserializerException.MessageKeys.INVALID_CONTENT_TYPE, HttpContentType.MULTIPART_MIXED);
+ throw new BatchDeserializerException("Missing boundary.",
+ BatchDeserializerException.MessageKeys.MISSING_BOUNDARY_DELIMITER, Integer.toString(line));
}
- public static String removeEndingSlash(final String content) {
- String newContent = content.trim();
- int lastSlashIndex = newContent.lastIndexOf('/');
-
- return (lastSlashIndex == newContent.length() - 1) ? newContent.substring(0, newContent.length() - 1) : newContent;
- }
-
- private static String trimQuota(final String boundary) {
- if (boundary.matches("\".*\"")) {
- return boundary.replace("\"", "");
+ /**
+ * Get the content type based on <code>contentType</code> parameter.
+ * If this content type is not compatible to the expected ContentType a
+ * BatchDeserializerException is thrown.
+ *
+ * @param contentType content type string which is parsed
+ * @param expected content type to which the parsed must be compatible
+ * @param line parsed line
+ * @return the parsed content type or if not compatible or parseable an exception is thrown (never returns null)
+ * @throws BatchDeserializerException
+ */
+ public static ContentType parseContentType(final String contentType, final ContentType expected, final int line)
+ throws BatchDeserializerException {
+ ContentType type;
+ try {
+ type = ContentType.create(contentType);
+ } catch (final IllegalArgumentException e) {
+ if (contentType == null) {
+ throw new BatchDeserializerException("Missing content type", e,
+ BatchDeserializerException.MessageKeys.MISSING_CONTENT_TYPE, Integer.toString(line));
+ } else {
+ throw new BatchDeserializerException("Invalid content type.", e,
+ BatchDeserializerException.MessageKeys.INVALID_CONTENT_TYPE, Integer.toString(line));
+ }
}
+ if (type.isCompatible(expected)) {
+ return type;
+ } else {
+ throw new BatchDeserializerException("Content type is not the expected content type",
+ BatchDeserializerException.MessageKeys.INVALID_CONTENT_TYPE, expected.toContentTypeString());
+ }
+ }
+ private static String trimQuotes(final String boundary) {
+ if (boundary != null && boundary.length() >= 2 && boundary.startsWith("\"") && boundary.endsWith("\"")) {
+ return boundary.substring(1, boundary.length() - 1);
+ }
return boundary;
}
public static List<List<Line>> splitMessageByBoundary(final List<Line> message, final String boundary)
throws BatchDeserializerException {
final List<List<Line>> messageParts = new LinkedList<List<Line>>();
- List<Line> currentPart = new ArrayList<Line>();
+ List<Line> currentPart = new LinkedList<Line>();
boolean isEndReached = false;
final String quotedBoundary = Pattern.quote(boundary);
- final Pattern boundaryDelimiterPattern = Pattern.compile("--" + quotedBoundary + "--[\\s ]*");
- final Pattern boundaryPattern = Pattern.compile("--" + quotedBoundary + "[\\s ]*");
+ final Pattern boundaryDelimiterPattern = Pattern.compile("--" + quotedBoundary + "--\\s*");
+ final Pattern boundaryPattern = Pattern.compile("--" + quotedBoundary + "\\s*");
for (Line currentLine : message) {
if (boundaryDelimiterPattern.matcher(currentLine.toString()).matches()) {
@@ -124,22 +132,21 @@
}
}
- final int lineNumer = (message.size() > 0) ? message.get(0).getLineNumber() : 0;
// Remove preamble
if (messageParts.size() > 0) {
messageParts.remove(0);
}
if (!isEndReached) {
+ final int lineNumber = (message.size() > 0) ? message.get(0).getLineNumber() : 0;
throw new BatchDeserializerException("Missing close boundary delimiter",
- BatchDeserializerException.MessageKeys.MISSING_CLOSE_DELIMITER,
- "" + lineNumer);
+ BatchDeserializerException.MessageKeys.MISSING_CLOSE_DELIMITER, Integer.toString(lineNumber));
}
return messageParts;
}
- private static void removeEndingCRLFFromList(final List<Line> list) {
+ private static void removeEndingCRLFFromList(List<Line> list) {
if (list.size() > 0) {
Line lastLine = list.remove(list.size() - 1);
list.add(removeEndingCRLF(lastLine));
@@ -147,9 +154,7 @@
}
public static Line removeEndingCRLF(final Line line) {
- Pattern pattern = PATTERN_LAST_CRLF;
- Matcher matcher = pattern.matcher(line.toString());
-
+ Matcher matcher = PATTERN_LAST_CRLF.matcher(line.toString());
if (matcher.matches()) {
return new Line(matcher.group(1), line.getLineNumber());
} else {
@@ -157,7 +162,7 @@
}
}
- public static Header consumeHeaders(final List<Line> remainingMessage) {
+ public static Header consumeHeaders(List<Line> remainingMessage) {
final int headerLineNumber = remainingMessage.size() != 0 ? remainingMessage.get(0).getLineNumber() : 0;
final Header headers = new Header(headerLineNumber);
final Iterator<Line> iter = remainingMessage.iterator();
@@ -183,24 +188,23 @@
return headers;
}
- public static void consumeBlankLine(final List<Line> remainingMessage, final boolean isStrict)
+ public static void consumeBlankLine(List<Line> remainingMessage, final boolean isStrict)
throws BatchDeserializerException {
- if (remainingMessage.size() > 0 && remainingMessage.get(0).toString().matches("\\s*(\r\n|\n)\\s*")) {
+ if (remainingMessage.size() > 0 && remainingMessage.get(0).toString().matches("\\s*\r?\n\\s*")) {
remainingMessage.remove(0);
} else {
if (isStrict) {
final int lineNumber = (remainingMessage.size() > 0) ? remainingMessage.get(0).getLineNumber() : 0;
throw new BatchDeserializerException("Missing blank line",
- BatchDeserializerException.MessageKeys.MISSING_BLANK_LINE, "[None]", ""
- + lineNumber);
+ BatchDeserializerException.MessageKeys.MISSING_BLANK_LINE, "[None]", Integer.toString(lineNumber));
}
}
}
- public static InputStream convertLineListToInputStream(final List<Line> messageList) {
+ public static InputStream convertLineListToInputStream(final List<Line> messageList, final Charset charset) {
final String message = lineListToString(messageList);
- return new ByteArrayInputStream(message.getBytes());
+ return new ByteArrayInputStream(message.getBytes(charset));
}
private static String lineListToString(final List<Line> messageList) {
@@ -220,9 +224,10 @@
return (lastIndex > 0) ? message.substring(0, lastIndex) : "";
}
- public static InputStream convertLineListToInputStream(final List<Line> list, final int length) {
+ public static InputStream convertLineListToInputStream(final List<Line> list, final Charset charset,
+ final int length) {
final String message = trimLineListToLength(list, length);
- return new ByteArrayInputStream(message.getBytes());
+ return new ByteArrayInputStream(message.getBytes(charset));
}
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchPart.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchPart.java
index 9ee642d..13986c4 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchPart.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchPart.java
@@ -19,7 +19,7 @@
package org.apache.olingo.server.core.deserializer.batch;
public interface BatchPart {
- public Header getHeaders();
+ Header getHeaders();
- public boolean isStrict();
+ boolean isStrict();
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchQueryOperation.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchQueryOperation.java
index efc9f32..8bbcb81 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchQueryOperation.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchQueryOperation.java
@@ -20,7 +20,7 @@
import java.util.List;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
public class BatchQueryOperation implements BatchPart {
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java
index 16e8af3..4e5ef9d 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java
@@ -20,18 +20,21 @@
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException.MessageKeys;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException.MessageKeys;
public class BatchRequestTransformator {
+ private static final Charset DEFAULT_CHARSET = Charset.forName("utf-8");
private final String baseUri;
private final String rawServiceResolutionUri;
@@ -73,23 +76,22 @@
final HeaderField contentIdRequest = getContentId(request);
if (contentIdChangeRequestPart == null && contentIdRequest == null) {
- throw new BatchDeserializerException("Missing content id", MessageKeys.MISSING_CONTENT_ID, changeRequestPart
- .getHeaders()
- .getLineNumber());
+ throw new BatchDeserializerException("Missing content id", MessageKeys.MISSING_CONTENT_ID,
+ Integer.toString(changeRequestPart.getHeaders().getLineNumber()));
} else if (contentIdChangeRequestPart != null) {
request.getHeaders().replaceHeaderField(contentIdChangeRequestPart);
}
}
private HeaderField getContentId(final BatchQueryOperation queryOperation) throws BatchDeserializerException {
- final HeaderField contentTypeHeader = queryOperation.getHeaders().getHeaderField(BatchParserCommon.HTTP_CONTENT_ID);
+ final HeaderField contentTypeHeader = queryOperation.getHeaders().getHeaderField(HttpHeader.CONTENT_ID);
if (contentTypeHeader != null) {
if (contentTypeHeader.getValues().size() == 1) {
return contentTypeHeader;
} else {
- throw new BatchDeserializerException("Invalid header", MessageKeys.INVALID_HEADER, contentTypeHeader
- .getLineNumber());
+ throw new BatchDeserializerException("Invalid header", MessageKeys.INVALID_HEADER,
+ Integer.toString(contentTypeHeader.getLineNumber()));
}
}
@@ -104,7 +106,8 @@
statusLine.validateHttpMethod(isChangeSet);
validateBody(statusLine, operation);
- InputStream bodyStrean = getBodyStream(operation, statusLine);
+ Charset charset = getCharset(operation);
+ InputStream bodyStrean = getBodyStream(operation, statusLine, charset);
validateForbiddenHeader(operation);
@@ -124,17 +127,33 @@
return request;
}
+ private Charset getCharset(BatchQueryOperation operation) {
+ String ct = operation.getHeaders().getHeader(HttpHeader.CONTENT_TYPE);
+ if(ct != null) {
+ ContentType contentType = ContentType.parse(ct);
+ if(contentType != null) {
+ String charsetValue = contentType.getParameter(ContentType.PARAMETER_CHARSET);
+ if(charsetValue != null) {
+ return Charset.forName(charsetValue);
+ }
+ }
+ }
+ return DEFAULT_CHARSET;
+ }
+
private void validateForbiddenHeader(final BatchQueryOperation operation) throws BatchDeserializerException {
final Header header = operation.getHeaders();
- if (header.exists(HttpHeader.AUTHORIZATION) || header.exists(BatchParserCommon.HTTP_EXPECT)
- || header.exists(BatchParserCommon.HTTP_FROM) || header.exists(BatchParserCommon.HTTP_MAX_FORWARDS)
- || header.exists(BatchParserCommon.HTTP_RANGE) || header.exists(BatchParserCommon.HTTP_TE)) {
- throw new BatchDeserializerException("Forbidden header", MessageKeys.FORBIDDEN_HEADER, header.getLineNumber());
+ if (header.exists(HttpHeader.AUTHORIZATION) || header.exists(HttpHeader.EXPECT)
+ || header.exists(HttpHeader.FROM) || header.exists(HttpHeader.MAX_FORWARDS)
+ || header.exists(HttpHeader.RANGE) || header.exists(HttpHeader.TE)) {
+ throw new BatchDeserializerException("Forbidden header", MessageKeys.FORBIDDEN_HEADER,
+ Integer.toString(header.getLineNumber()));
}
}
- private InputStream getBodyStream(final BatchQueryOperation operation, final HttpRequestStatusLine statusLine)
+ private InputStream getBodyStream(final BatchQueryOperation operation, final HttpRequestStatusLine statusLine,
+ final Charset charset)
throws BatchDeserializerException {
if (statusLine.getMethod().equals(HttpMethod.GET)) {
return new ByteArrayInputStream(new byte[0]);
@@ -142,9 +161,9 @@
int contentLength = BatchTransformatorCommon.getContentLength(operation.getHeaders());
if (contentLength == -1) {
- return BatchParserCommon.convertLineListToInputStream(operation.getBody());
+ return BatchParserCommon.convertLineListToInputStream(operation.getBody(), charset);
} else {
- return BatchParserCommon.convertLineListToInputStream(operation.getBody(), contentLength);
+ return BatchParserCommon.convertLineListToInputStream(operation.getBody(), charset, contentLength);
}
}
}
@@ -152,8 +171,8 @@
private void validateBody(final HttpRequestStatusLine statusLine, final BatchQueryOperation operation)
throws BatchDeserializerException {
if (statusLine.getMethod().equals(HttpMethod.GET) && isUnvalidGetRequestBody(operation)) {
- throw new BatchDeserializerException("Invalid request line", MessageKeys.INVALID_CONTENT, statusLine
- .getLineNumber());
+ throw new BatchDeserializerException("Invalid request line", MessageKeys.INVALID_CONTENT,
+ Integer.toString(statusLine.getLineNumber()));
}
}
@@ -165,7 +184,7 @@
private void validateHeader(final BatchPart bodyPart, final boolean isChangeSet) throws BatchDeserializerException {
final Header headers = bodyPart.getHeaders();
- BatchTransformatorCommon.validateContentType(headers, BatchParserCommon.PATTERN_CONTENT_TYPE_APPLICATION_HTTP);
+ BatchTransformatorCommon.validateContentType(headers, ContentType.APPLICATION_HTTP);
if (isChangeSet) {
BatchTransformatorCommon.validateContentTransferEncoding(headers);
}
@@ -175,10 +194,10 @@
final Header header = bodyPart.getHeaders();
if (bodyPart.isChangeSet()) {
- BatchTransformatorCommon.validateContentType(header, BatchParserCommon.PATTERN_MULTIPART_BOUNDARY);
+ BatchTransformatorCommon.validateContentType(header, ContentType.MULTIPART_MIXED);
} else {
BatchTransformatorCommon.validateContentTransferEncoding(header);
- BatchTransformatorCommon.validateContentType(header, BatchParserCommon.PATTERN_CONTENT_TYPE_APPLICATION_HTTP);
+ BatchTransformatorCommon.validateContentType(header, ContentType.APPLICATION_HTTP);
}
}
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
index e445e10..1543c43 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
@@ -19,32 +19,31 @@
package org.apache.olingo.server.core.deserializer.batch;
import java.util.List;
-import java.util.regex.Pattern;
-import org.apache.olingo.commons.api.http.HttpContentType;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException.MessageKeys;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException.MessageKeys;
public class BatchTransformatorCommon {
+
+ private BatchTransformatorCommon() {
+ //Private Utility Constructor
+ }
- public static void validateContentType(final Header headers, final Pattern pattern)
+ public static void validateContentType(final Header headers, final ContentType expected)
throws BatchDeserializerException {
- List<String> contentTypes = headers.getHeaders(HttpHeader.CONTENT_TYPE);
+ final List<String> contentTypes = headers.getHeaders(HttpHeader.CONTENT_TYPE);
- if (contentTypes.size() == 0) {
- throw new BatchDeserializerException("Missing content type", MessageKeys.MISSING_CONTENT_TYPE, headers
- .getLineNumber());
+ if (contentTypes.isEmpty()) {
+ throw new BatchDeserializerException("Missing content type", MessageKeys.MISSING_CONTENT_TYPE,
+ Integer.toString(headers.getLineNumber()));
}
- if (!headers.isHeaderMatching(HttpHeader.CONTENT_TYPE, pattern)) {
-
- throw new BatchDeserializerException("Invalid content type", MessageKeys.INVALID_CONTENT_TYPE,
- HttpContentType.MULTIPART_MIXED + " or " + HttpContentType.APPLICATION_HTTP);
- }
+ BatchParserCommon.parseContentType(contentTypes.get(0), expected, headers.getLineNumber());
}
public static void validateContentTransferEncoding(final Header headers) throws BatchDeserializerException {
- final HeaderField contentTransferField = headers.getHeaderField(BatchParserCommon.HTTP_CONTENT_TRANSFER_ENCODING);
+ final HeaderField contentTransferField = headers.getHeaderField(BatchParserCommon.CONTENT_TRANSFER_ENCODING);
if (contentTransferField != null) {
final List<String> contentTransferValues = contentTransferField.getValues();
@@ -54,15 +53,16 @@
if (!BatchParserCommon.BINARY_ENCODING.equalsIgnoreCase(encoding)) {
throw new BatchDeserializerException("Invalid content transfer encoding",
MessageKeys.INVALID_CONTENT_TRANSFER_ENCODING,
- headers.getLineNumber());
+ Integer.toString(headers.getLineNumber()));
}
} else {
- throw new BatchDeserializerException("Invalid header", MessageKeys.INVALID_HEADER, headers.getLineNumber());
+ throw new BatchDeserializerException("Invalid header", MessageKeys.INVALID_HEADER,
+ Integer.toString(headers.getLineNumber()));
}
} else {
throw new BatchDeserializerException("Missing mandatory content transfer encoding",
MessageKeys.MISSING_CONTENT_TRANSFER_ENCODING,
- headers.getLineNumber());
+ Integer.toString(headers.getLineNumber()));
}
}
@@ -77,14 +77,13 @@
if (contentLength < 0) {
throw new BatchDeserializerException("Invalid content length", MessageKeys.INVALID_CONTENT_LENGTH,
- contentLengthField
- .getLineNumber());
+ Integer.toString(contentLengthField.getLineNumber()));
}
return contentLength;
} catch (NumberFormatException e) {
- throw new BatchDeserializerException("Invalid header", MessageKeys.INVALID_HEADER, contentLengthField
- .getLineNumber());
+ throw new BatchDeserializerException("Invalid header", e, MessageKeys.INVALID_HEADER,
+ Integer.toString(contentLengthField.getLineNumber()));
}
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BufferedReaderIncludingLineEndings.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BufferedReaderIncludingLineEndings.java
deleted file mode 100644
index 2268a1d..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BufferedReaderIncludingLineEndings.java
+++ /dev/null
@@ -1,233 +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.server.core.deserializer.batch;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.List;
-
-public class BufferedReaderIncludingLineEndings extends Reader {
- private static final char CR = '\r';
- private static final char LF = '\n';
- private static final int EOF = -1;
- private static final int BUFFER_SIZE = 8192;
- private Reader reader;
- private char[] buffer;
- private int offset = 0;
- private int limit = 0;
-
- public BufferedReaderIncludingLineEndings(final Reader reader) {
- this(reader, BUFFER_SIZE);
- }
-
- public BufferedReaderIncludingLineEndings(final Reader reader, final int bufferSize) {
- if (bufferSize <= 0) {
- throw new IllegalArgumentException("Buffer size must be greater than zero.");
- }
-
- this.reader = reader;
- buffer = new char[bufferSize];
- }
-
- @Override
- public int read(final char[] charBuffer, final int bufferOffset, final int length) throws IOException {
- if ((bufferOffset + length) > charBuffer.length) {
- throw new IndexOutOfBoundsException("Buffer is too small");
- }
-
- if (length < 0 || bufferOffset < 0) {
- throw new IndexOutOfBoundsException("Offset and length must be grater than zero");
- }
-
- // Check if buffer is filled. Return if EOF is reached
- // Is buffer refill required
- if (limit == offset || isEOF()) {
- fillBuffer();
-
- if (isEOF()) {
- return EOF;
- }
- }
-
- int bytesRead = 0;
- int bytesToRead = length;
- int currentOutputOffset = bufferOffset;
-
- while (bytesToRead != 0) {
- // Is buffer refill required?
- if (limit == offset) {
- fillBuffer();
-
- if (isEOF()) {
- bytesToRead = 0;
- }
- }
-
- if (bytesToRead > 0) {
- int readByte = Math.min(limit - offset, bytesToRead);
- bytesRead += readByte;
- bytesToRead -= readByte;
-
- for (int i = 0; i < readByte; i++) {
- charBuffer[currentOutputOffset++] = buffer[offset++];
- }
- }
- }
-
- return bytesRead;
- }
-
- public List<String> toList() throws IOException {
- final List<String> result = new ArrayList<String>();
- String currentLine;
-
- while ((currentLine = readLine()) != null) {
- result.add(currentLine);
- }
-
- return result;
- }
-
- public List<Line> toLineList() throws IOException {
- final List<Line> result = new ArrayList<Line>();
- String currentLine;
- int counter = 1;
-
- while ((currentLine = readLine()) != null) {
- result.add(new Line(currentLine, counter++));
- }
-
- return result;
- }
-
- public String readLine() throws IOException {
- if (limit == EOF) {
- return null;
- }
-
- final StringBuilder stringBuffer = new StringBuilder();
- boolean foundLineEnd = false; // EOF will be considered as line ending
-
- while (!foundLineEnd) {
- // Is buffer refill required?
- if (limit == offset) {
- if (fillBuffer() == EOF) {
- foundLineEnd = true;
- }
- }
-
- if (!foundLineEnd) {
- char currentChar = buffer[offset++];
- stringBuffer.append(currentChar);
-
- if (currentChar == LF) {
- foundLineEnd = true;
- } else if (currentChar == CR) {
- foundLineEnd = true;
-
- // Check next char. Consume \n if available
- // Is buffer refill required?
- if (limit == offset) {
- fillBuffer();
- }
-
- // Check if there is at least one character
- if (limit != EOF && buffer[offset] == LF) {
- stringBuffer.append(LF);
- offset++;
- }
- }
- }
- }
-
- return (stringBuffer.length() == 0) ? null : stringBuffer.toString();
- }
-
- @Override
- public void close() throws IOException {
- reader.close();
- }
-
- @Override
- public boolean ready() throws IOException {
- // Not EOF and buffer refill is not required
- return !isEOF() && !(limit == offset);
- }
-
- @Override
- public void reset() throws IOException {
- throw new IOException("Reset is not supported");
- }
-
- @Override
- public void mark(final int readAheadLimit) throws IOException {
- throw new IOException("Mark is not supported");
- }
-
- @Override
- public boolean markSupported() {
- return false;
- }
-
- @Override
- public long skip(final long n) throws IOException {
- if (n == 0) {
- return 0;
- } else if (n < 0) {
- throw new IllegalArgumentException("skip value is negative");
- } else {
- long charactersToSkip = n;
- long charactersSkiped = 0;
-
- while (charactersToSkip != 0) {
- // Is buffer refill required?
- if (limit == offset) {
- fillBuffer();
-
- if (isEOF()) {
- charactersToSkip = 0;
- }
- }
-
- // Check if more characters are available
- if (!isEOF()) {
- int skipChars = (int) Math.min(limit - offset, charactersToSkip);
-
- charactersSkiped += skipChars;
- charactersToSkip -= skipChars;
- offset += skipChars;
- }
- }
-
- return charactersSkiped;
- }
- }
-
- private boolean isEOF() {
- return limit == EOF;
- }
-
- private int fillBuffer() throws IOException {
- limit = reader.read(buffer, 0, buffer.length);
- offset = 0;
-
- return limit;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/Header.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/Header.java
index a9b05b1..1391f94 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/Header.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/Header.java
@@ -24,9 +24,8 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.regex.Pattern;
-public class Header implements Iterable<HeaderField> {
+public class Header implements Iterable<HeaderField>, Cloneable {
private final Map<String, HeaderField> headers = new HashMap<String, HeaderField>();
private int lineNumber;
@@ -64,14 +63,6 @@
return field != null && field.getValues().size() != 0;
}
- public boolean isHeaderMatching(final String name, final Pattern pattern) {
- if (getHeaders(name).size() != 1) {
- return false;
- } else {
- return pattern.matcher(getHeaders(name).get(0)).matches();
- }
- }
-
public void removeHeader(final String name) {
headers.remove(name.toLowerCase(Locale.ENGLISH));
}
@@ -82,12 +73,6 @@
return (headerField == null) ? null : headerField.getValue();
}
- public String getHeaderNotNull(final String name) {
- final HeaderField headerField = getHeaderField(name);
-
- return (headerField == null) ? "" : headerField.getValueNotNull();
- }
-
public List<String> getHeaders(final String name) {
final HeaderField headerField = getHeaderField(name);
@@ -105,9 +90,9 @@
public Map<String, String> toSingleMap() {
final Map<String, String> singleMap = new HashMap<String, String>();
- for (final String key : headers.keySet()) {
- HeaderField field = headers.get(key);
- singleMap.put(field.getFieldName(), getHeader(key));
+ for (final Map.Entry<String, HeaderField> entries : headers.entrySet()) {
+ HeaderField field = entries.getValue();
+ singleMap.put(field.getFieldName(), getHeader(entries.getKey()));
}
return singleMap;
@@ -116,8 +101,8 @@
public Map<String, List<String>> toMultiMap() {
final Map<String, List<String>> singleMap = new HashMap<String, List<String>>();
- for (final String key : headers.keySet()) {
- HeaderField field = headers.get(key);
+ for (final Map.Entry<String, HeaderField> entries : headers.entrySet()) {
+ HeaderField field = entries.getValue();
singleMap.put(field.getFieldName(), field.getValues());
}
@@ -139,8 +124,8 @@
public Header clone() {
final Header newInstance = new Header(lineNumber);
- for (final String key : headers.keySet()) {
- newInstance.headers.put(key, headers.get(key).clone());
+ for (final Map.Entry<String, HeaderField> entries : headers.entrySet()) {
+ newInstance.headers.put(entries.getKey(), entries.getValue().clone());
}
return newInstance;
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/HeaderField.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/HeaderField.java
index 870f276..fc0e156 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/HeaderField.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/HeaderField.java
@@ -59,15 +59,9 @@
return result.toString();
}
- public String getValueNotNull() {
- final String value = getValue();
-
- return (value == null) ? "" : value;
- }
-
@Override
public HeaderField clone() {
- List<String> newValues = new ArrayList<String>();
+ List<String> newValues = new ArrayList<String>(values.size());
newValues.addAll(values);
return new HeaderField(fieldName, newValues, lineNumber);
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/HttpRequestStatusLine.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/HttpRequestStatusLine.java
index c4fb8f7..efe1ce1 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/HttpRequestStatusLine.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/HttpRequestStatusLine.java
@@ -27,8 +27,8 @@
import java.util.regex.Pattern;
import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException.MessageKeys;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException.MessageKeys;
public class HttpRequestStatusLine {
private static final Pattern PATTERN_RELATIVE_URI = Pattern.compile("([^/][^?]*)(?:\\?(.*))?");
@@ -67,8 +67,8 @@
parseUri(parts[1], requestBaseUri);
httpVersion = parseHttpVersion(parts[2]);
} else {
- throw new BatchDeserializerException("Invalid status line", MessageKeys.INVALID_STATUS_LINE, statusLine
- .getLineNumber());
+ throw new BatchDeserializerException("Invalid status line", MessageKeys.INVALID_STATUS_LINE,
+ Integer.toString(statusLine.getLineNumber()));
}
}
@@ -81,8 +81,9 @@
} else {
parseRelativeUri(rawUri);
}
- } catch (URISyntaxException e) {
- throw new BatchDeserializerException("Malformed uri", MessageKeys.INVALID_URI, statusLine.getLineNumber());
+ } catch (final URISyntaxException e) {
+ throw new BatchDeserializerException("Malformed uri", e, MessageKeys.INVALID_URI,
+ Integer.toString(statusLine.getLineNumber()));
}
}
@@ -91,8 +92,8 @@
final String relativeUri = removeLeadingSlash(rawUri.substring(baseUri.length()));
parseRelativeUri(relativeUri);
} else {
- throw new BatchDeserializerException("Base uri do not match", MessageKeys.INVALID_BASE_URI, statusLine
- .getLineNumber());
+ throw new BatchDeserializerException("Base uri does not match", MessageKeys.INVALID_BASE_URI,
+ Integer.toString(statusLine.getLineNumber()));
}
}
@@ -106,7 +107,8 @@
if (relativeUriMatcher.matches()) {
buildUri(relativeUriMatcher.group(1), relativeUriMatcher.group(2));
} else {
- throw new BatchDeserializerException("Malformed uri", MessageKeys.INVALID_URI, statusLine.getLineNumber());
+ throw new BatchDeserializerException("Malformed uri", MessageKeys.INVALID_URI,
+ Integer.toString(statusLine.getLineNumber()));
}
}
@@ -127,15 +129,15 @@
try {
return HttpMethod.valueOf(method.trim());
} catch (IllegalArgumentException e) {
- throw new BatchDeserializerException("Illegal http method", MessageKeys.INVALID_METHOD, statusLine
- .getLineNumber());
+ throw new BatchDeserializerException("Illegal http method", e, MessageKeys.INVALID_METHOD,
+ Integer.toString(statusLine.getLineNumber()));
}
}
private String parseHttpVersion(final String httpVersion) throws BatchDeserializerException {
if (!HTTP_VERSION.equals(httpVersion.trim())) {
- throw new BatchDeserializerException("Invalid http version", MessageKeys.INVALID_HTTP_VERSION, statusLine
- .getLineNumber());
+ throw new BatchDeserializerException("Invalid http version", MessageKeys.INVALID_HTTP_VERSION,
+ Integer.toString(statusLine.getLineNumber()));
} else {
return HTTP_VERSION;
}
@@ -147,11 +149,11 @@
if (!validMethods.contains(getMethod().toString())) {
if (isChangeSet) {
throw new BatchDeserializerException("Invalid change set method", MessageKeys.INVALID_CHANGESET_METHOD,
- statusLine.getLineNumber());
+ Integer.toString(statusLine.getLineNumber()));
} else {
throw new BatchDeserializerException("Invalid query operation method",
MessageKeys.INVALID_QUERY_OPERATION_METHOD,
- statusLine.getLineNumber());
+ Integer.toString(statusLine.getLineNumber()));
}
}
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
index a03206b..759cf66 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
@@ -50,7 +50,10 @@
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.deserializer.DeserializerException.MessageKeys;
import org.apache.olingo.server.api.deserializer.DeserializerResult;
import org.apache.olingo.server.api.deserializer.ODataDeserializer;
import org.apache.olingo.server.core.deserializer.DeserializerResultImpl;
@@ -60,7 +63,6 @@
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
@@ -70,8 +72,18 @@
public class ODataJsonDeserializer implements ODataDeserializer {
+ private static final String AN_IO_EXCEPTION_OCCURRED_MSG = "An IOException occurred";
+ private static final String DUPLICATE_JSON_PROPERTY_DETECTED_MSG = "Duplicate json property detected";
+ private static final String AN_JSON_PARSE_EXCEPTION_OCCURRED_MSG = "An JsonParseException occurred";
private static final String ODATA_ANNOTATION_MARKER = "@";
private static final String ODATA_CONTROL_INFORMATION_PREFIX = "@odata.";
+ private static final EdmPrimitiveType EDM_INT64 = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64);
+ private static final EdmPrimitiveType EDM_DECIMAL = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal);
+ private final boolean isIEEE754Compatible;
+
+ public ODataJsonDeserializer(final ContentType contentType) {
+ isIEEE754Compatible = isODataIEEE754Compatible(contentType);
+ }
@Override
public DeserializerResult entityCollection(final InputStream stream, final EdmEntityType edmEntityType)
@@ -82,13 +94,13 @@
return DeserializerResultImpl.with().entityCollection(consumeEntitySetNode(edmEntityType, tree, null))
.build();
} catch (JsonParseException e) {
- throw new DeserializerException("An JsonParseException occurred", e,
+ throw new DeserializerException(AN_JSON_PARSE_EXCEPTION_OCCURRED_MSG, e,
DeserializerException.MessageKeys.JSON_SYNTAX_EXCEPTION);
} catch (JsonMappingException e) {
- throw new DeserializerException("Duplicate json property detected", e,
+ throw new DeserializerException(DUPLICATE_JSON_PROPERTY_DETECTED_MSG, e,
DeserializerException.MessageKeys.DUPLICATE_JSON_PROPERTY);
} catch (IOException e) {
- throw new DeserializerException("An IOException occurred", e, DeserializerException.MessageKeys.IO_EXCEPTION);
+ throw new DeserializerException(AN_IO_EXCEPTION_OCCURRED_MSG, e, DeserializerException.MessageKeys.IO_EXCEPTION);
}
}
@@ -157,13 +169,13 @@
.build();
} catch (JsonParseException e) {
- throw new DeserializerException("An JsonParseException occurred", e,
+ throw new DeserializerException(AN_JSON_PARSE_EXCEPTION_OCCURRED_MSG, e,
DeserializerException.MessageKeys.JSON_SYNTAX_EXCEPTION);
} catch (JsonMappingException e) {
- throw new DeserializerException("Duplicate property detected", e,
+ throw new DeserializerException(DUPLICATE_JSON_PROPERTY_DETECTED_MSG, e,
DeserializerException.MessageKeys.DUPLICATE_PROPERTY);
} catch (IOException e) {
- throw new DeserializerException("An IOException occurred", e, DeserializerException.MessageKeys.IO_EXCEPTION);
+ throw new DeserializerException(AN_IO_EXCEPTION_OCCURRED_MSG, e, DeserializerException.MessageKeys.IO_EXCEPTION);
}
}
@@ -192,9 +204,8 @@
throws DeserializerException {
try {
ObjectNode tree = parseJsonTree(stream);
- Map<String, Parameter> parameters = new LinkedHashMap<String, Parameter>();
if (tree != null) {
- consumeParameters(edmAction, tree, parameters);
+ Map<String, Parameter> parameters = consumeParameters(edmAction, tree);
final List<String> toRemove = new ArrayList<String>();
Iterator<Entry<String, JsonNode>> fieldsIterator = tree.fields();
@@ -212,71 +223,51 @@
// remove here to avoid iterator issues.
tree.remove(toRemove);
assertJsonNodeIsEmpty(tree);
+ return DeserializerResultImpl.with().actionParameters(parameters).build();
}
- return DeserializerResultImpl.with().actionParameters(parameters).build();
+ return DeserializerResultImpl.with().build();
} catch (final JsonParseException e) {
- throw new DeserializerException("An JsonParseException occurred", e,
+ throw new DeserializerException(AN_JSON_PARSE_EXCEPTION_OCCURRED_MSG, e,
DeserializerException.MessageKeys.JSON_SYNTAX_EXCEPTION);
} catch (final JsonMappingException e) {
- throw new DeserializerException("Duplicate property detected", e,
+ throw new DeserializerException(DUPLICATE_JSON_PROPERTY_DETECTED_MSG, e,
DeserializerException.MessageKeys.DUPLICATE_PROPERTY);
} catch (final IOException e) {
- throw new DeserializerException("An IOException occurred", e,
+ throw new DeserializerException(AN_IO_EXCEPTION_OCCURRED_MSG, e,
DeserializerException.MessageKeys.IO_EXCEPTION);
}
}
- private ObjectNode parseJsonTree(final InputStream stream)
- throws IOException, JsonParseException, JsonProcessingException {
+ private ObjectNode parseJsonTree(final InputStream stream) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_READING_DUP_TREE_KEY, true);
JsonParser parser = new JsonFactory(objectMapper).createParser(stream);
- ObjectNode tree = parser.getCodec().readTree(parser);
- return tree;
+ return parser.getCodec().readTree(parser);
}
- private void consumeParameters(final EdmAction edmAction, final ObjectNode node,
- final Map<String, Parameter> parameters)
- throws DeserializerException {
+ private Map<String, Parameter> consumeParameters(final EdmAction edmAction, final ObjectNode node)
+ throws DeserializerException {
List<String> parameterNames = edmAction.getParameterNames();
if (edmAction.isBound()) {
// The binding parameter must not occur in the payload.
parameterNames = parameterNames.subList(1, parameterNames.size());
}
+ Map<String, Parameter> parameters = new LinkedHashMap<String, Parameter>();
for (final String paramName : parameterNames) {
final EdmParameter edmParameter = edmAction.getParameter(paramName);
- Parameter parameter = new Parameter();
- parameter.setName(paramName);
- JsonNode jsonNode = node.get(paramName);
switch (edmParameter.getType().getKind()) {
case PRIMITIVE:
case DEFINITION:
case ENUM:
- if (jsonNode == null || jsonNode.isNull()) {
- if (!edmParameter.isNullable()) {
- throw new DeserializerException("Non-nullable parameter not present or null",
- DeserializerException.MessageKeys.INVALID_NULL_PARAMETER, paramName);
- }
- if (edmParameter.isCollection()) {
- throw new DeserializerException("Collection must not be null for parameter: " + paramName,
- DeserializerException.MessageKeys.INVALID_NULL_PARAMETER, paramName);
- }
- parameter.setValue(ValueType.PRIMITIVE, null);
- } else {
- Property consumePropertyNode =
- consumePropertyNode(edmParameter.getName(), edmParameter.getType(), edmParameter.isCollection(),
- edmParameter.isNullable(), edmParameter.getMaxLength(), edmParameter.getPrecision(), edmParameter
- .getScale(), true, edmParameter.getMapping(), jsonNode);
- parameter.setValue(consumePropertyNode.getValueType(), consumePropertyNode.getValue());
- parameters.put(paramName, parameter);
- node.remove(paramName);
- }
+ Parameter parameter = createParameter(node.get(paramName), paramName, edmParameter);
+ parameters.put(paramName, parameter);
+ node.remove(paramName);
break;
case COMPLEX:
case ENTITY:
- throw new DeserializerException("Entity an complex parameters currently not Implemented",
+ throw new DeserializerException("Entity and complex parameters currently not Implemented",
DeserializerException.MessageKeys.NOT_IMPLEMENTED);
default:
throw new DeserializerException("Invalid type kind " + edmParameter.getType().getKind().toString()
@@ -284,6 +275,31 @@
paramName);
}
}
+ return parameters;
+ }
+
+ private Parameter createParameter(JsonNode node, String paramName, EdmParameter edmParameter) throws
+ DeserializerException {
+ Parameter parameter = new Parameter();
+ parameter.setName(paramName);
+ if (node == null || node.isNull()) {
+ if (!edmParameter.isNullable()) {
+ throw new DeserializerException("Non-nullable parameter not present or null",
+ MessageKeys.INVALID_NULL_PARAMETER, paramName);
+ }
+ if (edmParameter.isCollection()) {
+ throw new DeserializerException("Collection must not be null for parameter: " + paramName,
+ MessageKeys.INVALID_NULL_PARAMETER, paramName);
+ }
+ parameter.setValue(ValueType.PRIMITIVE, null);
+ } else {
+ Property consumePropertyNode =
+ consumePropertyNode(edmParameter.getName(), edmParameter.getType(), edmParameter.isCollection(),
+ edmParameter.isNullable(), edmParameter.getMaxLength(), edmParameter.getPrecision(), edmParameter
+ .getScale(), true, edmParameter.getMapping(), node);
+ parameter.setValue(consumePropertyNode.getValueType(), consumePropertyNode.getValue());
+ }
+ return parameter;
}
/**
@@ -330,9 +346,8 @@
DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, propertyName);
}
Property property = consumePropertyNode(edmProperty.getName(), edmProperty.getType(),
- edmProperty.isCollection(),
- edmProperty.isNullable(), edmProperty.getMaxLength(), edmProperty.getPrecision(), edmProperty.getScale(),
- edmProperty.isUnicode(), edmProperty.getMapping(),
+ edmProperty.isCollection(), edmProperty.isNullable(), edmProperty.getMaxLength(),
+ edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode(), edmProperty.getMapping(),
jsonNode);
entity.addProperty(property);
node.remove(propertyName);
@@ -348,41 +363,59 @@
JsonNode jsonNode = node.get(navigationPropertyName);
if (jsonNode != null) {
EdmNavigationProperty edmNavigationProperty = edmEntityType.getNavigationProperty(navigationPropertyName);
- boolean isNullable = edmNavigationProperty.isNullable();
- if ((jsonNode.isNull() && !isNullable) || (jsonNode.isNull() && edmNavigationProperty.isCollection())) {
- throw new DeserializerException("Property: " + navigationPropertyName + " must not be null.",
- DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, navigationPropertyName);
- }
+ checkNotNullOrValidNull(jsonNode, edmNavigationProperty);
- Link link = new Link();
- link.setTitle(navigationPropertyName);
- final ExpandTreeBuilder childExpandBuilder = (expandBuilder != null) ?
- expandBuilder.expand(edmNavigationProperty) : null;
- if (jsonNode.isArray() && edmNavigationProperty.isCollection()) {
- link.setType(Constants.ENTITY_SET_NAVIGATION_LINK_TYPE);
- EntityCollection inlineEntitySet = new EntityCollection();
- inlineEntitySet.getEntities().addAll(consumeEntitySetArray(edmNavigationProperty.getType(), jsonNode,
- childExpandBuilder));
- link.setInlineEntitySet(inlineEntitySet);
- } else if (!jsonNode.isArray() && (!jsonNode.isValueNode() || jsonNode.isNull())
- && !edmNavigationProperty.isCollection()) {
- link.setType(Constants.ENTITY_NAVIGATION_LINK_TYPE);
- if (!jsonNode.isNull()) {
- Entity inlineEntity = consumeEntityNode(edmNavigationProperty.getType(), (ObjectNode) jsonNode,
- childExpandBuilder);
- link.setInlineEntity(inlineEntity);
- }
- } else {
- throw new DeserializerException("Invalid value: " + jsonNode.getNodeType()
- + " for expanded navigation property: " + navigationPropertyName,
- DeserializerException.MessageKeys.INVALID_VALUE_FOR_NAVIGATION_PROPERTY, navigationPropertyName);
- }
+ Link link = createLink(expandBuilder, navigationPropertyName, jsonNode, edmNavigationProperty);
entity.getNavigationLinks().add(link);
node.remove(navigationPropertyName);
}
}
}
+ /**
+ * Check if jsonNode is not null or if null but nullable or collection navigationProperty
+ *
+ * @param jsonNode related json node
+ * @param edmNavigationProperty related navigation property
+ * @throws DeserializerException if jsonNode is not null or if null but nullable or collection navigationProperty
+ */
+ private void checkNotNullOrValidNull(JsonNode jsonNode,
+ EdmNavigationProperty edmNavigationProperty) throws DeserializerException {
+ boolean isNullable = edmNavigationProperty.isNullable();
+ if ((jsonNode.isNull() && !isNullable) || (jsonNode.isNull() && edmNavigationProperty.isCollection())) {
+ throw new DeserializerException("Property: " + edmNavigationProperty.getName() + " must not be null.",
+ MessageKeys.INVALID_NULL_PROPERTY, edmNavigationProperty.getName());
+ }
+ }
+
+ private Link createLink(ExpandTreeBuilder expandBuilder, String navigationPropertyName, JsonNode jsonNode,
+ EdmNavigationProperty edmNavigationProperty) throws DeserializerException {
+ Link link = new Link();
+ link.setTitle(navigationPropertyName);
+ final ExpandTreeBuilder childExpandBuilder = (expandBuilder != null) ?
+ expandBuilder.expand(edmNavigationProperty) : null;
+ if (jsonNode.isArray() && edmNavigationProperty.isCollection()) {
+ link.setType(Constants.ENTITY_SET_NAVIGATION_LINK_TYPE);
+ EntityCollection inlineEntitySet = new EntityCollection();
+ inlineEntitySet.getEntities().addAll(
+ consumeEntitySetArray(edmNavigationProperty.getType(), jsonNode, childExpandBuilder));
+ link.setInlineEntitySet(inlineEntitySet);
+ } else if (!jsonNode.isArray() && (!jsonNode.isValueNode() || jsonNode.isNull())
+ && !edmNavigationProperty.isCollection()) {
+ link.setType(Constants.ENTITY_NAVIGATION_LINK_TYPE);
+ if (!jsonNode.isNull()) {
+ Entity inlineEntity = consumeEntityNode(edmNavigationProperty.getType(), (ObjectNode) jsonNode,
+ childExpandBuilder);
+ link.setInlineEntity(inlineEntity);
+ }
+ } else {
+ throw new DeserializerException("Invalid value: " + jsonNode.getNodeType()
+ + " for expanded navigation property: " + navigationPropertyName,
+ MessageKeys.INVALID_VALUE_FOR_NAVIGATION_PROPERTY, navigationPropertyName);
+ }
+ return link;
+ }
+
private Link consumeBindingLink(final String key, final JsonNode jsonNode, final EdmEntityType edmEntityType)
throws DeserializerException {
String[] splitKey = key.split("@");
@@ -438,11 +471,11 @@
property.setName(name);
property.setType(type.getFullQualifiedName().getFullQualifiedNameAsString());
if (isCollection) {
- consumePropertyCollectionNode(name, type, isNullable, maxLength, precision, scale, isUnicode, mapping,
- jsonNode, property);
+ consumePropertyCollectionNode(name, type, isNullable, maxLength, precision, scale, isUnicode, mapping, jsonNode,
+ property);
} else {
- consumePropertySingleNode(name, type, isNullable, maxLength, precision, scale, isUnicode, mapping,
- jsonNode, property);
+ consumePropertySingleNode(name, type, isNullable, maxLength, precision, scale, isUnicode, mapping, jsonNode,
+ property);
}
return property;
}
@@ -479,7 +512,7 @@
private Object readComplexNode(final String name, final EdmType type, final boolean isNullable,
final JsonNode jsonNode)
- throws DeserializerException {
+ throws DeserializerException {
// read and add all complex properties
ComplexValue value = readComplexValue(name, type, isNullable, jsonNode);
@@ -663,8 +696,17 @@
EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) type;
checkJsonTypeBasedOnPrimitiveType(name, edmPrimitiveType.getName(), jsonNode);
Class<?> javaClass = getJavaClassForPrimitiveType(mapping, edmPrimitiveType);
- return edmPrimitiveType.valueOfString(jsonNode.asText(),
- isNullable, maxLength, precision, scale, isUnicode, javaClass);
+ String jsonNodeAsText = jsonNode.asText();
+
+ if (isIEEE754Compatible
+ && (edmPrimitiveType.equals(EDM_INT64) || edmPrimitiveType.equals(EDM_DECIMAL))
+ && jsonNodeAsText.length() == 0) {
+ throw new DeserializerException("IEEE754Compatible values must not be of length 0",
+ MessageKeys.INVALID_NULL_PROPERTY, name);
+ }
+
+ return edmPrimitiveType.valueOfString(jsonNodeAsText, isNullable, maxLength, precision, scale, isUnicode,
+ javaClass);
} catch (EdmPrimitiveTypeException e) {
throw new DeserializerException(
"Invalid value: " + jsonNode.asText() + " for property: " + name, e,
@@ -674,7 +716,7 @@
/**
* This method either returns the primitive types default class or the manually mapped class if present.
- * @param edmMapping
+ * @param mapping
* @param edmPrimitiveType
* @return the java class to be used during deserialization
*/
@@ -715,7 +757,8 @@
private void checkJsonTypeBasedOnPrimitiveType(final String propertyName, final String edmPrimitiveTypeName,
final JsonNode jsonNode)
- throws DeserializerException {
+ throws DeserializerException {
+
EdmPrimitiveTypeKind primKind;
try {
primKind = EdmPrimitiveTypeKind.valueOf(edmPrimitiveTypeName);
@@ -723,47 +766,81 @@
throw new DeserializerException("Unknown Primitive Type: " + edmPrimitiveTypeName, e,
DeserializerException.MessageKeys.UNKNOWN_PRIMITIVE_TYPE, edmPrimitiveTypeName, propertyName);
}
- switch (primKind) {
- // Booleans
- case Boolean:
- if (!jsonNode.isBoolean()) {
- throw new DeserializerException("Invalid json type: " + jsonNode.getNodeType() + " for edm " + primKind
- + " property: " + propertyName, DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, propertyName);
- }
- break;
- // Numbers
- case Int16:
- case Int32:
- case Int64:
- case Byte:
- case SByte:
- case Single:
- case Double:
- case Decimal:
- if (!jsonNode.isNumber()) {
- throw new DeserializerException("Invalid json type: " + jsonNode.getNodeType() + " for edm " + primKind
- + " property: " + propertyName, DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, propertyName);
- }
- break;
- // Strings
- case String:
- case Binary:
- case Date:
- case DateTimeOffset:
- case Duration:
- case Guid:
- case TimeOfDay:
- if (!jsonNode.isTextual()) {
- throw new DeserializerException("Invalid json type: " + jsonNode.getNodeType() + " for edm " + primKind
- + " property: " + propertyName, DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, propertyName);
- }
- break;
- default:
- throw new DeserializerException("Unsupported Edm Primitive Type: " + primKind,
- DeserializerException.MessageKeys.NOT_IMPLEMENTED);
+
+ boolean valid = matchTextualCase(jsonNode, primKind);
+ valid |= matchNumberCase(jsonNode, primKind);
+ valid |= matchBooleanCase(jsonNode, primKind);
+ valid |= matchIEEENumberCase(jsonNode, primKind);
+
+ if (!valid) {
+ throw new DeserializerException("Invalid json type: " + jsonNode.getNodeType() + " for edm " + primKind
+ + " property: " + propertyName, DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, propertyName);
}
}
+ private boolean matchIEEENumberCase(JsonNode node, EdmPrimitiveTypeKind primKind) {
+ switch (primKind) {
+ case Int64:
+ case Decimal:
+ // Numbers (either numbers or string)
+ if (isIEEE754Compatible) {
+ return node.isTextual();
+ } else {
+ return node.isNumber();
+ }
+ default:
+ return false;
+ }
+ }
+
+ private boolean matchBooleanCase(JsonNode node, EdmPrimitiveTypeKind primKind) {
+ if (node.isBoolean()) {
+ switch (primKind) {
+ case Boolean:
+ return true;
+ default:
+ return false;
+ }
+ }
+ return false;
+ }
+
+ private boolean matchNumberCase(JsonNode node, EdmPrimitiveTypeKind primKind) {
+ if (node.isNumber()) {
+ switch (primKind) {
+ // Numbers (must be numbers)
+ case Int16:
+ case Int32:
+ case Byte:
+ case SByte:
+ case Single:
+ case Double:
+ return true;
+ default:
+ return false;
+ }
+ }
+ return false;
+ }
+
+ private boolean matchTextualCase(JsonNode node, EdmPrimitiveTypeKind primKind) {
+ if (node.isTextual()) {
+ switch (primKind) {
+ case String:
+ case Binary:
+ case Date:
+ case DateTimeOffset:
+ case Duration:
+ case Guid:
+ case TimeOfDay:
+ return true;
+ default:
+ return false;
+ }
+ }
+ return false;
+ }
+
@Override
public DeserializerResult property(final InputStream stream, final EdmProperty edmProperty)
throws DeserializerException {
@@ -773,7 +850,7 @@
JsonParser parser = new JsonFactory(objectMapper).createParser(stream);
final ObjectNode tree = parser.getCodec().readTree(parser);
- Property property = null;
+ final Property property;
JsonNode jsonNode = tree.get(Constants.VALUE);
if (jsonNode != null) {
property = consumePropertyNode(edmProperty.getName(), edmProperty.getType(),
@@ -791,13 +868,13 @@
}
return DeserializerResultImpl.with().property(property).build();
} catch (JsonParseException e) {
- throw new DeserializerException("An JsonParseException occurred", e,
+ throw new DeserializerException(AN_JSON_PARSE_EXCEPTION_OCCURRED_MSG, e,
DeserializerException.MessageKeys.JSON_SYNTAX_EXCEPTION);
} catch (JsonMappingException e) {
- throw new DeserializerException("Duplicate property detected", e,
+ throw new DeserializerException(DUPLICATE_JSON_PROPERTY_DETECTED_MSG, e,
DeserializerException.MessageKeys.DUPLICATE_PROPERTY);
} catch (IOException e) {
- throw new DeserializerException("An IOException occurred", e, DeserializerException.MessageKeys.IO_EXCEPTION);
+ throw new DeserializerException(AN_IO_EXCEPTION_OCCURRED_MSG, e, DeserializerException.MessageKeys.IO_EXCEPTION);
}
}
@@ -817,7 +894,7 @@
Iterator<JsonNode> it = arrayNode.iterator();
while (it.hasNext()) {
final JsonNode next = it.next();
- if(next.has(key)) {
+ if (next.has(key)) {
parsedValues.add(new URI(next.get(key).asText()));
}
}
@@ -825,27 +902,32 @@
throw new DeserializerException("Value must be an array", DeserializerException.MessageKeys.UNKNOWN_CONTENT);
}
tree.remove(Constants.VALUE);
- // if this is value there can be only one property
return DeserializerResultImpl.with().entityReferences(parsedValues).build();
}
- if(tree.get(key) != null) {
+ if (tree.get(key) != null) {
parsedValues.add(new URI(tree.get(key).asText()));
} else {
throw new DeserializerException("Missing entity reference", DeserializerException.MessageKeys.UNKNOWN_CONTENT);
}
return DeserializerResultImpl.with().entityReferences(parsedValues).build();
} catch (JsonParseException e) {
- throw new DeserializerException("An JsonParseException occurred", e,
+ throw new DeserializerException(AN_JSON_PARSE_EXCEPTION_OCCURRED_MSG, e,
DeserializerException.MessageKeys.JSON_SYNTAX_EXCEPTION);
} catch (JsonMappingException e) {
- throw new DeserializerException("Duplicate property detected", e,
+ throw new DeserializerException(DUPLICATE_JSON_PROPERTY_DETECTED_MSG, e,
DeserializerException.MessageKeys.DUPLICATE_PROPERTY);
} catch (IOException e) {
- throw new DeserializerException("An IOException occurred", e,
+ throw new DeserializerException(AN_IO_EXCEPTION_OCCURRED_MSG, e,
DeserializerException.MessageKeys.IO_EXCEPTION);
} catch (URISyntaxException e) {
throw new DeserializerException("failed to read @odata.id", e,
DeserializerException.MessageKeys.UNKNOWN_CONTENT);
}
}
+
+ private boolean isODataIEEE754Compatible(final ContentType contentType) {
+ return contentType.getParameters().containsKey(ContentType.PARAMETER_IEEE754_COMPATIBLE)
+ && Boolean.TRUE.toString().equalsIgnoreCase(
+ contentType.getParameter(ContentType.PARAMETER_IEEE754_COMPATIBLE));
+ }
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java
new file mode 100644
index 0000000..efbad95
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java
@@ -0,0 +1,698 @@
+/*
+ * 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.deserializer.xml;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.AbstractODataObject;
+import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.Valuable;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.primitivetype.AbstractGeospatialType;
+import org.apache.olingo.commons.core.edm.primitivetype.SingletonPrimitiveType;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.deserializer.DeserializerResult;
+import org.apache.olingo.server.api.deserializer.ODataDeserializer;
+import org.apache.olingo.server.core.deserializer.DeserializerResultImpl;
+
+import com.fasterxml.aalto.stax.InputFactoryImpl;
+
+public class ODataXmlDeserializer implements ODataDeserializer {
+
+ private static final XMLInputFactory FACTORY = new InputFactoryImpl();
+ private static final String ATOM = "a";
+ private static final String NS_ATOM = "http://www.w3.org/2005/Atom";
+ private static final QName REF_ELEMENT = new QName("http://docs.oasis-open.org/odata/ns/metadata", "ref");
+// private static final QName FEED_ELEMENT = new QName("http://www.w3.org/2005/Atom", "feed");
+ private static final QName ID_ATTR = new QName(NS_ATOM, ATOM);
+
+ private final QName propertiesQName = new QName(Constants.NS_METADATA, Constants.PROPERTIES);
+ private final QName propertyValueQName = new QName(Constants.NS_METADATA, Constants.VALUE);
+ private final QName contextQName = new QName(Constants.NS_METADATA, Constants.CONTEXT);
+ private final QName nullQName = new QName(Constants.NS_METADATA, Constants.ATTR_NULL);
+ private final QName inlineQName = new QName(Constants.NS_METADATA, Constants.ATOM_ELEM_INLINE);
+ private final QName entryRefQName = new QName(Constants.NS_METADATA, Constants.ATOM_ELEM_ENTRY_REF);
+ private final QName etagQName = new QName(Constants.NS_METADATA, Constants.ATOM_ATTR_ETAG);
+ private final QName countQName = new QName(Constants.NS_METADATA, Constants.ATOM_ELEM_COUNT);
+
+// private void namespaces(final XMLStreamWriter writer) throws XMLStreamException {
+// writer.writeNamespace(StringUtils.EMPTY, Constants.NS_ATOM);
+// writer.writeNamespace(XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI);
+// writer.writeNamespace(Constants.PREFIX_METADATA, Constants.NS_METADATA);
+// writer.writeNamespace(Constants.PREFIX_DATASERVICES, Constants.NS_DATASERVICES);
+// writer.writeNamespace(Constants.PREFIX_GML, Constants.NS_GML);
+// writer.writeNamespace(Constants.PREFIX_GEORSS, Constants.NS_GEORSS);
+// }
+
+ protected XMLEventReader getReader(final InputStream input) throws XMLStreamException {
+ return FACTORY.createXMLEventReader(input);
+ }
+
+ private Object primitive(final XMLEventReader reader, final StartElement start,
+ final EdmProperty edmProperty) throws XMLStreamException, EdmPrimitiveTypeException,
+ DeserializerException {
+
+ Object value = null;
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ if (edmProperty.getType() instanceof AbstractGeospatialType<?>) {
+ throw new DeserializerException("geo types support not implemented",
+ DeserializerException.MessageKeys.NOT_IMPLEMENTED);
+ }
+ final String stringValue = event.asCharacters().getData();
+ value = ((EdmPrimitiveType)edmProperty.getType()).valueOfString(stringValue,
+ edmProperty.isNullable(),
+ edmProperty.getMaxLength(),
+ edmProperty.getPrecision(),
+ edmProperty.getScale(),
+ edmProperty.isUnicode(),
+ ((EdmPrimitiveType)edmProperty.getType()).getDefaultType());
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+ return value;
+ }
+
+ private Object complex(final XMLEventReader reader, final StartElement start, EdmComplexType edmComplex,
+ boolean validateType)
+ throws XMLStreamException, EdmPrimitiveTypeException, DeserializerException {
+
+ ComplexValue value = new ComplexValue();
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.isStartElement()) {
+ StartElement se = event.asStartElement();
+ value.getValue().add(property(reader, se, (EdmProperty)edmComplex.getProperty(se.getName().getLocalPart())));
+ }
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+ return value;
+ }
+
+ private void collection(final Valuable valuable, final XMLEventReader reader, final StartElement start,
+ final EdmProperty edmProperty) throws XMLStreamException, EdmPrimitiveTypeException, DeserializerException {
+
+ List<Object> values = new ArrayList<Object>();
+ EdmType edmType = edmProperty.getType();
+
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ if (edmType instanceof SingletonPrimitiveType) {
+ values.add(primitive(reader, event.asStartElement(), edmProperty));
+ } else if (edmType instanceof EdmComplexType) {
+ values.add(complex(reader, event.asStartElement(), (EdmComplexType)edmType, false));
+ } else if (edmType instanceof EdmEnumType) {
+ values.add(readEnum(reader, event.asStartElement(), edmProperty));
+ } else {
+ // do not add null or empty values
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+ valuable.setValue(getValueType(edmType, true), values);
+ }
+
+ private Object readEnum(XMLEventReader reader, StartElement start, EdmProperty edmProperty)
+ throws XMLStreamException {
+ boolean foundEndProperty = false;
+ Object value = null;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ value = event.asCharacters().getData();
+ }
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+ return value;
+ }
+
+ private Property property(final XMLEventReader reader, final StartElement start, final EdmProperty edmProperty)
+ throws XMLStreamException, EdmPrimitiveTypeException, DeserializerException {
+
+ final Property property = new Property();
+
+ if (propertyValueQName.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());
+ }
+ valuable(property, reader, start, edmProperty);
+ return property;
+ }
+
+ private ValueType getValueType(EdmType edmType, boolean isCollection) {
+ if (edmType instanceof SingletonPrimitiveType) {
+ return isCollection? ValueType.COLLECTION_PRIMITIVE:ValueType.PRIMITIVE;
+ } else if (edmType instanceof EdmComplexType) {
+ return isCollection? ValueType.COLLECTION_COMPLEX:ValueType.COMPLEX;
+ } else if (edmType instanceof EdmEnumType) {
+ return isCollection?ValueType.COLLECTION_ENUM:ValueType.ENUM;
+ } else {
+ return ValueType.PRIMITIVE;
+ }
+ }
+
+ private void valuable(final Valuable valuable, final XMLEventReader reader, final StartElement start,
+ EdmProperty edmProperty) throws XMLStreamException, EdmPrimitiveTypeException,
+ DeserializerException {
+
+ final Attribute nullAttr = start.getAttributeByName(nullQName);
+ if (nullAttr != null) {
+ //found null
+ boolean foundEndProperty = false;
+ while (reader.hasNext() && !foundEndProperty) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperty = true;
+ }
+ }
+ valuable.setValue(getValueType(edmProperty.getType(), false), null);
+ return;
+ }
+
+ EdmType edmType = edmProperty.getType();
+ if (edmProperty.isCollection()) {
+ collection(valuable, reader, start, edmProperty);
+ valuable.setType("Collection("+edmType.getFullQualifiedName().getFullQualifiedNameAsString()+")");
+ } else if (edmType instanceof SingletonPrimitiveType) {
+ valuable.setType(edmType.getFullQualifiedName().getFullQualifiedNameAsString());
+ valuable.setValue(ValueType.PRIMITIVE, primitive(reader, start, edmProperty));
+ } else if (edmType instanceof EdmComplexType) {
+ valuable.setValue(ValueType.COMPLEX, complex(reader, start, (EdmComplexType)edmType, true));
+ valuable.setType(edmType.getFullQualifiedName().getFullQualifiedNameAsString());
+ } else if (edmType instanceof EdmEnumType) {
+ valuable.setValue(ValueType.ENUM, readEnum(reader, start, edmProperty));
+ valuable.setType(edmType.getFullQualifiedName().getFullQualifiedNameAsString());
+ } else {
+ // do not add null or empty values
+ }
+ }
+
+ @Override
+ public DeserializerResult property(InputStream input, EdmProperty edmProperty)
+ throws DeserializerException {
+ try {
+ final XMLEventReader reader = getReader(input);
+ final StartElement start = skipBeforeFirstStartElement(reader);
+ Property property = property(reader, start, edmProperty);
+ return DeserializerResultImpl.with().property(property)
+ .build();
+ } catch (XMLStreamException e) {
+ throw new DeserializerException(e.getMessage(), e, DeserializerException.MessageKeys.IO_EXCEPTION);
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new DeserializerException(e.getMessage(), e,
+ DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY);
+ }
+ }
+
+ private StartElement skipBeforeFirstStartElement(final XMLEventReader reader) throws XMLStreamException {
+ StartElement startEvent = null;
+ while (reader.hasNext() && startEvent == null) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.isStartElement()) {
+ startEvent = event.asStartElement();
+ }
+ }
+ if (startEvent == null) {
+ throw new IllegalArgumentException("Cannot find any XML start element");
+ }
+
+ return startEvent;
+ }
+
+ private void common(final XMLEventReader reader, final StartElement start,
+ final AbstractODataObject object, final String key) throws XMLStreamException {
+
+ boolean foundEndElement = false;
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ try {
+ object.setCommonProperty(key, event.asCharacters().getData());
+ } catch (ParseException e) {
+ throw new XMLStreamException("While parsing Atom entry or feed common elements", e);
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+ }
+
+ private void inline(final XMLEventReader reader, final StartElement start, final Link link,
+ final EdmEntityType edmEntityType) throws XMLStreamException, EdmPrimitiveTypeException,
+ DeserializerException {
+
+ boolean foundEndElement = false;
+ EdmNavigationProperty navigationProperty = edmEntityType.getNavigationProperty(link.getTitle());
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ if (inlineQName.equals(event.asStartElement().getName())) {
+ StartElement inline = getStartElement(reader);
+ if (inline != null) {
+ if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(inline.getName())) {
+ if (navigationProperty.isCollection()) {
+ throw new DeserializerException( "Navigation Property "+ link.getTitle() +
+ " must be collection entities",
+ DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, link.getTitle());
+ }
+
+ link.setInlineEntity(entity(reader, inline, navigationProperty.getType()));
+ }
+ if (Constants.QNAME_ATOM_ELEM_FEED.equals(inline.getName())) {
+ if (!navigationProperty.isCollection()) {
+ throw new DeserializerException("Navigation Property " + link.getTitle() +
+ " must be single entity",
+ DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, link.getTitle());
+ }
+ link.setInlineEntitySet(entitySet(reader, inline, navigationProperty.getType()));
+ }
+ }
+ } else if (REF_ELEMENT.equals(event.asStartElement().getName())) {
+ if (navigationProperty.isCollection()) {
+ throw new DeserializerException("Binding annotation: " + link.getTitle() +
+ " must be collection of entity refercences",
+ DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, link.getTitle());
+ }
+ link.setBindingLink(entityRef(reader, event.asStartElement()));
+ link.setType(Constants.ENTITY_BINDING_LINK_TYPE);
+ } else if (Constants.QNAME_ATOM_ELEM_FEED.equals(event.asStartElement().getName())) {
+ if (navigationProperty.isCollection()) {
+ throw new DeserializerException("Binding annotation: " + link.getTitle() +
+ " must be single entity refercences",
+ DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, link.getTitle());
+ }
+ link.setBindingLinks(entityRefCollection(reader, event.asStartElement()));
+ link.setType(Constants.ENTITY_COLLECTION_BINDING_LINK_TYPE);
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+ }
+
+ private List<String> entityRefCollection(XMLEventReader reader, StartElement start)
+ throws XMLStreamException {
+ boolean foundEndElement = false;
+ ArrayList<String> references = new ArrayList<String>();
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement() && REF_ELEMENT.equals(event.asStartElement().getName())) {
+ references.add(entityRef(reader, event.asStartElement()));
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+ return references;
+ }
+
+ private String entityRef(XMLEventReader reader, StartElement start) throws XMLStreamException {
+ boolean foundEndElement = false;
+ final Attribute entityRefId = start.getAttributeByName(Constants.QNAME_ATOM_ATTR_ID);
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+ return entityRefId.getValue();
+ }
+
+ private StartElement getStartElement(final XMLEventReader reader) throws XMLStreamException {
+ while (reader.hasNext()) {
+ final XMLEvent innerEvent = reader.peek();
+ if (innerEvent.isCharacters() && innerEvent.asCharacters().isWhiteSpace()) {
+ reader.nextEvent();
+ } else if (innerEvent.isStartElement()) {
+ return innerEvent.asStartElement();
+ } else if (innerEvent.isEndElement() && inlineQName.equals(innerEvent.asEndElement().getName())) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ private void properties(final XMLEventReader reader, final StartElement start, final Entity entity,
+ final EdmEntityType edmEntityType)
+ throws XMLStreamException, EdmPrimitiveTypeException, DeserializerException {
+
+ boolean foundEndProperties = false;
+ while (reader.hasNext() && !foundEndProperties) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ EdmProperty edmProperty = (EdmProperty)edmEntityType
+ .getProperty(event.asStartElement().getName().getLocalPart());
+ entity.getProperties().add(property(reader, event.asStartElement(), edmProperty));
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndProperties = true;
+ }
+ }
+ }
+
+ private Entity entityRef(final StartElement start) throws XMLStreamException {
+ final Entity entity = new Entity();
+
+ final Attribute entityRefId = start.getAttributeByName(Constants.QNAME_ATOM_ATTR_ID);
+ if (entityRefId != null) {
+ entity.setId(URI.create(entityRefId.getValue()));
+ }
+
+ return entity;
+ }
+
+ private Entity entity(final XMLEventReader reader, final StartElement start, final EdmEntityType edmEntityType)
+ throws XMLStreamException, EdmPrimitiveTypeException, DeserializerException {
+ Entity entity = null;
+ if (entryRefQName.equals(start.getName())) {
+ entity = entityRef(start);
+ } else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(start.getName())) {
+ entity = new Entity();
+ final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
+ if (xmlBase != null) {
+ entity.setBaseURI(URI.create(xmlBase.getValue()));
+ }
+
+ final Attribute etag = start.getAttributeByName(etagQName);
+ if (etag != null) {
+ entity.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(), entity, "id");
+ } 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) {
+ entity.setType(new EdmTypeInfo.Builder().setTypeExpression(term.getValue()).build().internal());
+ }
+ } else if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
+ final Link link = new Link();
+ 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.setBindingLink(href.getValue());
+ }
+ final Attribute linktype = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_TYPE));
+ if (linktype != null) {
+ link.setType(linktype.getValue());
+ }
+ if (Constants.SELF_LINK_REL.equals(link.getRel())) {
+ entity.setSelfLink(link);
+ } else if (Constants.EDIT_LINK_REL.equals(link.getRel())) {
+ entity.setEditLink(link);
+ } else if (Constants.EDITMEDIA_LINK_REL.equals(link.getRel())) {
+ final Attribute mediaETag = event.asStartElement().getAttributeByName(etagQName);
+ if (mediaETag != null) {
+ entity.setMediaETag(mediaETag.getValue());
+ }
+ } else if (link.getRel().startsWith(Constants.NS_NAVIGATION_LINK_REL)) {
+ inline(reader, event.asStartElement(), link, edmEntityType);
+ if (link.getInlineEntity() == null && link.getInlineEntitySet() == null) {
+ entity.getNavigationBindings().add(link);
+ } else {
+ if (link.getInlineEntitySet() != null) {
+ List<String> bindings = new ArrayList<String>();
+ List<Entity> enities = link.getInlineEntitySet().getEntities();
+
+ for (Entity inlineEntity:enities) {
+ // check if this is reference
+ if (inlineEntity.getId() != null && inlineEntity.getProperties().isEmpty()) {
+ bindings.add(inlineEntity.getId().toASCIIString());
+ }
+ }
+ if (!bindings.isEmpty()) {
+ link.setInlineEntitySet(null);
+ link.setBindingLinks(bindings);
+ entity.getNavigationBindings().add(link);
+ } else {
+ entity.getNavigationLinks().add(link);
+ }
+ } else {
+ // add link
+ entity.getNavigationLinks().add(link);
+ }
+ }
+ } else if (link.getRel().startsWith(Constants.NS_ASSOCIATION_LINK_REL)) {
+ entity.getAssociationLinks().add(link);
+ } else if (link.getRel().startsWith(Constants.NS_MEDIA_EDIT_LINK_REL)) {
+ final Attribute metag = event.asStartElement().getAttributeByName(etagQName);
+ if (metag != null) {
+ link.setMediaETag(metag.getValue());
+ }
+ entity.getMediaEditLinks().add(link);
+ }
+ } else if (Constants.QNAME_ATOM_ELEM_CONTENT.equals(event.asStartElement().getName())) {
+ final Attribute contenttype = event.asStartElement()
+ .getAttributeByName(QName.valueOf(Constants.ATTR_TYPE));
+ if (contenttype == null || ContentType.APPLICATION_XML.toContentTypeString()
+ .equals(contenttype.getValue())) {
+ properties(reader, skipBeforeFirstStartElement(reader), entity, edmEntityType);
+ } else {
+ entity.setMediaContentType(contenttype.getValue());
+ final Attribute src = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_SRC));
+ if (src != null) {
+ entity.setMediaContentSource(URI.create(src.getValue()));
+ }
+ }
+ } else if (propertiesQName.equals(event.asStartElement().getName())) {
+ properties(reader, event.asStartElement(), entity, edmEntityType);
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndEntry = true;
+ }
+ }
+ }
+ return entity;
+ }
+
+ @Override
+ public DeserializerResult entity(InputStream input, EdmEntityType edmEntityType)
+ throws DeserializerException {
+ try {
+ final XMLEventReader reader = getReader(input);
+ final StartElement start = skipBeforeFirstStartElement(reader);
+ final Entity entity = entity(reader, start, edmEntityType);
+ if (entity == null) {
+ throw new DeserializerException("No entity found!", DeserializerException.MessageKeys.INVALID_ENTITY);
+ }
+ return DeserializerResultImpl.with().entity(entity)
+ .build();
+ } catch (XMLStreamException e) {
+ throw new DeserializerException(e.getMessage(), e,
+ DeserializerException.MessageKeys.IO_EXCEPTION);
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new DeserializerException(e.getMessage(), e,
+ DeserializerException.MessageKeys.INVALID_ENTITY);
+ }
+ }
+
+ private void count(final XMLEventReader reader, final StartElement start, final EntityCollection entitySet)
+ throws XMLStreamException {
+
+ boolean foundEndElement = false;
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ entitySet.setCount(Integer.valueOf(event.asCharacters().getData()));
+ }
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+ }
+
+ private EntityCollection entitySet(final XMLEventReader reader, final StartElement start,
+ final EdmEntityType edmEntityType) throws XMLStreamException, EdmPrimitiveTypeException,
+ DeserializerException {
+ if (!Constants.QNAME_ATOM_ELEM_FEED.equals(start.getName())) {
+ return null;
+ }
+ final EntityCollection entitySet = new EntityCollection();
+ final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
+ if (xmlBase != null) {
+ entitySet.setBaseURI(URI.create(xmlBase.getValue()));
+ }
+
+ boolean foundEndFeed = false;
+ while (reader.hasNext() && !foundEndFeed) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.isStartElement()) {
+ if (countQName.equals(event.asStartElement().getName())) {
+ count(reader, event.asStartElement(), entitySet);
+ } else if (Constants.QNAME_ATOM_ELEM_ID.equals(event.asStartElement().getName())) {
+ common(reader, event.asStartElement(), entitySet, "id");
+ } else if (Constants.QNAME_ATOM_ELEM_LINK.equals(event.asStartElement().getName())) {
+ final Attribute rel = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REL));
+ if (rel != null) {
+ if (Constants.NEXT_LINK_REL.equals(rel.getValue())) {
+ final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
+ if (href != null) {
+ entitySet.setNext(URI.create(href.getValue()));
+ }
+ }
+ if (Constants.NS_DELTA_LINK_REL.equals(rel.getValue())) {
+ final Attribute href = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_HREF));
+ if (href != null) {
+ entitySet.setDeltaLink(URI.create(href.getValue()));
+ }
+ }
+ }
+ } else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(event.asStartElement().getName())) {
+ entitySet.getEntities().add(entity(reader, event.asStartElement(), edmEntityType));
+ } else if (entryRefQName.equals(event.asStartElement().getName())) {
+ entitySet.getEntities().add(entityRef(event.asStartElement()));
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndFeed = true;
+ }
+ }
+ return entitySet;
+ }
+
+ @Override
+ public DeserializerResult entityCollection(InputStream input, EdmEntityType edmEntityType)
+ throws DeserializerException {
+ try {
+ final XMLEventReader reader = getReader(input);
+ final StartElement start = skipBeforeFirstStartElement(reader);
+ EntityCollection entityCollection = entitySet(reader, start, edmEntityType);
+ for (Entity entity:entityCollection.getEntities()) {
+ entity.setType(edmEntityType.getFullQualifiedName().getFullQualifiedNameAsString());
+ }
+ return DeserializerResultImpl.with().entityCollection(entityCollection)
+ .build();
+ } catch (XMLStreamException e) {
+ throw new DeserializerException(e.getMessage(), e, DeserializerException.MessageKeys.IO_EXCEPTION);
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new DeserializerException(e.getMessage(), e,
+ DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY);
+ }
+ }
+
+ @Override
+ public DeserializerResult entityReferences(InputStream stream) throws DeserializerException {
+ try {
+ XMLEventReader reader = getReader(stream);
+ ArrayList<URI> references = new ArrayList<URI>();
+
+ while (reader.hasNext()) {
+ final XMLEvent event = reader.nextEvent();
+ if (event.isStartElement()) {
+ StartElement start = event.asStartElement();
+ if (REF_ELEMENT.equals(start.getName())) {
+ Attribute context = start.getAttributeByName(ID_ATTR);
+ if (context == null) {
+ context = start.getAttributeByName(new QName("id"));
+ }
+ URI uri = URI.create(context.getValue());
+ references.add(uri);
+ }
+ }
+ }
+ return DeserializerResultImpl.with().entityReferences(references).build();
+ } catch (XMLStreamException e) {
+ throw new DeserializerException("An IOException occurred", e,
+ DeserializerException.MessageKeys.IO_EXCEPTION);
+ }
+ }
+
+ @Override
+ public DeserializerResult actionParameters(InputStream stream, EdmAction edmAction)
+ throws DeserializerException {
+ throw new DeserializerException("Not implemented", DeserializerException.MessageKeys.NOT_IMPLEMENTED);
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/etag/ETagParser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/etag/ETagParser.java
index b8534dd..805a29c 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/etag/ETagParser.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/etag/ETagParser.java
@@ -43,6 +43,10 @@
public class ETagParser {
private static final Pattern ETAG = Pattern.compile("\\s*(,\\s*)+|((?:W/)?\"[!#-~\\x80-\\xFF]*\")");
+
+ private ETagParser (){
+ //Private constructor for utility classes
+ }
protected static Collection<String> parse(final Collection<String> values) {
if (values == null) {
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/etag/PreconditionsValidator.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/etag/PreconditionsValidator.java
index 32c055b..a8690d1 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/etag/PreconditionsValidator.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/etag/PreconditionsValidator.java
@@ -32,37 +32,20 @@
public class PreconditionsValidator {
- private final CustomETagSupport customETagSupport;
- private final UriInfo uriInfo;
- private final String ifMatch;
- private final String ifNoneMatch;
+ private final EdmBindingTarget affectedEntitySetOrSingleton;
- public PreconditionsValidator(CustomETagSupport customETagSupport, UriInfo uriInfo, String ifMatch,
- String ifNoneMatch) {
- this.customETagSupport = customETagSupport;
- this.uriInfo = uriInfo;
- this.ifMatch = ifMatch;
- this.ifNoneMatch = ifNoneMatch;
+ public PreconditionsValidator(final UriInfo uriInfo) throws PreconditionException {
+ affectedEntitySetOrSingleton = extractInformation(uriInfo);
}
- public void validatePreconditions(boolean isMediaValue) throws PreconditionException {
- EdmBindingTarget affectedEntitySetOrSingleton = extractInformation();
- if (affectedEntitySetOrSingleton != null) {
- if ((isMediaValue && customETagSupport.hasMediaETag(affectedEntitySetOrSingleton)) ||
- (!isMediaValue && customETagSupport.hasETag(affectedEntitySetOrSingleton))) {
- checkETagHeaderPresent();
- }
- }
+ public boolean mustValidatePreconditions(final CustomETagSupport customETagSupport, final boolean isMediaValue) {
+ return affectedEntitySetOrSingleton != null
+ && (isMediaValue ?
+ customETagSupport.hasMediaETag(affectedEntitySetOrSingleton) :
+ customETagSupport.hasETag(affectedEntitySetOrSingleton));
}
- private void checkETagHeaderPresent() throws PreconditionException {
- if (ifMatch == null && ifNoneMatch == null) {
- throw new PreconditionException("Expected an if-match or if-none-match header",
- PreconditionException.MessageKeys.MISSING_HEADER);
- }
- }
-
- private EdmBindingTarget extractInformation() throws PreconditionException {
+ private EdmBindingTarget extractInformation(final UriInfo uriInfo) throws PreconditionException {
EdmBindingTarget lastFoundEntitySetOrSingleton = null;
int counter = 0;
for (UriResource uriResourcePart : uriInfo.getUriResourceParts()) {
@@ -78,13 +61,16 @@
break;
case navigationProperty:
lastFoundEntitySetOrSingleton = getEntitySetFromNavigation(lastFoundEntitySetOrSingleton,
- (UriResourceNavigation) uriResourcePart);
+ (UriResourceNavigation) uriResourcePart);
+ break;
+ case primitiveProperty:
+ case complexProperty:
break;
case value:
case action:
// This should not be possible since the URI Parser validates this but to be sure we throw an exception.
if (counter != uriInfo.getUriResourceParts().size() - 1) {
- throw new PreconditionException("$Value or Action must be the last segment in the URI.",
+ throw new PreconditionException("$value or Action must be the last segment in the URI.",
PreconditionException.MessageKeys.INVALID_URI);
}
break;
@@ -111,14 +97,11 @@
}
private EdmBindingTarget getEntitySet(UriResourceEntitySet uriResourceEntitySet) {
- if (!uriResourceEntitySet.isCollection()) {
- return uriResourceEntitySet.getEntitySet();
- }
- return null;
+ return uriResourceEntitySet.isCollection() ? null : uriResourceEntitySet.getEntitySet();
}
private EdmBindingTarget getEntitySetFromNavigation(EdmBindingTarget lastFoundEntitySetOrSingleton,
- UriResourceNavigation uriResourceNavigation) {
+ UriResourceNavigation uriResourceNavigation) {
if (lastFoundEntitySetOrSingleton != null && !uriResourceNavigation.isCollection()) {
EdmNavigationProperty navProp = uriResourceNavigation.getProperty();
return lastFoundEntitySetOrSingleton.getRelatedBindingTarget(navProp.getName());
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/prefer/PreferParser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/prefer/PreferParser.java
new file mode 100644
index 0000000..eee7959
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/prefer/PreferParser.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.prefer;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.olingo.server.api.prefer.Preferences.Preference;
+
+/**
+ * <p>Parses the values of <code>Prefer</code> HTTP header fields.</p>
+ * <p>See <a href="https://www.ietf.org/rfc/rfc7240.txt">RFC 7240</a> for details;
+ * there the following grammar is defined:</p>
+ * <pre>
+ * Prefer = "Prefer" ":" 1#preference
+ * preference = token [ BWS "=" BWS word ] *( OWS ";" [ OWS parameter ] )
+ * parameter = token [ BWS "=" BWS word ]
+ * token = 1*tchar
+ * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
+ / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA
+ * word = token / quoted-string
+ * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
+ * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / %x80-FF
+ * quoted-pair = "\" ( HTAB / SP / %x21-7E / %x80-FF )
+ * OWS = *( SP / HTAB ) ; optional whitespace
+ * BWS = OWS ; "bad" whitespace
+ * </pre>
+ * <p>Values with illegal syntax do not contribute to the result but no exception is thrown.</p>
+ */
+public class PreferParser {
+
+ private static final String token = "(?:[-!#$%&'*+.^_`|~]|\\w)+";
+ private static final String quotedString = "(?:\"(?:[\\t !#-\\[\\]-~\\x80-\\xFF]|"
+ + "(?:\\\\[\\t !-~\\x80-\\xFF]))*\")";
+ private static final String namedValue =
+ "(" + token + ")(?:\\s*=\\s*(" + token + "|" + quotedString + "))?";
+ private static final Pattern PREFERENCE = Pattern.compile("\\s*(,\\s*)+|"
+ + "(?:" + namedValue + "((?:\\s*;\\s*(?:" + namedValue + ")?)*))");
+ private static final Pattern PARAMETER = Pattern.compile("\\s*(;\\s*)+|(?:" + namedValue + ")");
+
+ private PreferParser (){
+ //Private constructor for utility classes
+ }
+
+ protected static Map<String, Preference> parse(final Collection<String> values) {
+ if (values == null || values.isEmpty()) {
+ return Collections.emptyMap();
+ }
+
+ Map<String, Preference> result = new HashMap<String, Preference>();
+ for (final String value : values) {
+ if (value != null && !value.isEmpty()) {
+ parse(value, result);
+ }
+ }
+ return result;
+ }
+
+ private static void parse(final String value, Map<String, Preference> result) {
+ Map<String, Preference> partResult = new HashMap<String, Preference>();
+ String separator = "";
+ int start = 0;
+ Matcher matcher = PREFERENCE.matcher(value.trim());
+ while (matcher.find() && matcher.start() == start) {
+ start = matcher.end();
+ if (matcher.group(1) != null) {
+ separator = matcher.group(1);
+ } else if (separator != null) {
+ final String name = matcher.group(2).toLowerCase(Locale.ROOT);
+ // RFC 7240:
+ // If any preference is specified more than once, only the first instance is to be
+ // considered. All subsequent occurrences SHOULD be ignored without signaling
+ // an error or otherwise altering the processing of the request.
+ if (!partResult.containsKey(name)) {
+ final String preferenceValue = getValue(matcher.group(3));
+ final Map<String, String> parameters =
+ matcher.group(4) == null || matcher.group(4).isEmpty() ? null :
+ parseParameters(matcher.group(4));
+ partResult.put(name, new Preference(preferenceValue, parameters));
+ }
+ separator = null;
+ } else {
+ return;
+ }
+ }
+ if (matcher.hitEnd()) {
+ // Here we also have to keep already existing preferences.
+ for (final Map.Entry<String, Preference> entry : partResult.entrySet()) {
+ if (!result.containsKey(entry.getKey())) {
+ result.put(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+ }
+
+ private static Map<String, String> parseParameters(final String parameters) {
+ Map<String, String> result = new HashMap<String, String>();
+ String separator = "";
+ int start = 0;
+ Matcher matcher = PARAMETER.matcher(parameters.trim());
+ while (matcher.find() && matcher.start() == start) {
+ start = matcher.end();
+ if (matcher.group(1) != null) {
+ separator = matcher.group(1);
+ } else if (separator != null) {
+ final String name = matcher.group(2).toLowerCase(Locale.ROOT);
+ // We have to keep already existing parameters.
+ if (!result.containsKey(name)) {
+ result.put(name, getValue(matcher.group(3)));
+ }
+ separator = null;
+ } else {
+ return null;
+ }
+ }
+ return matcher.hitEnd() ? Collections.unmodifiableMap(result) : null;
+ }
+
+ private static String getValue(final String value) {
+ if (value == null) {
+ return null;
+ }
+ String result = value;
+ if (value.startsWith("\"")) {
+ result = value.substring(1, value.length() - 1);
+ }
+ // Unquote backslash-quoted characters.
+ if (result.indexOf('\\') >= 0) {
+ result = result.replaceAll("\\\\(.)", "$1");
+ }
+ return result;
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/prefer/PreferencesImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/prefer/PreferencesImpl.java
new file mode 100644
index 0000000..ecafdc4
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/prefer/PreferencesImpl.java
@@ -0,0 +1,108 @@
+/*
+ * 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.prefer;
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.format.PreferenceName;
+import org.apache.olingo.server.api.prefer.Preferences;
+
+/**
+ * Provides access methods to the preferences set in the Prefer HTTP request
+ * header as described in <a href="https://www.ietf.org/rfc/rfc7240.txt">RFC 7240</a>.
+ * Preferences defined in the OData standard can be accessed with named methods.
+ */
+public class PreferencesImpl implements Preferences {
+
+ private static final String URL = "url"; // parameter name for odata.callback
+
+ private final Map<String, Preference> preferences;
+
+ public PreferencesImpl(final Collection<String> preferHeaders) {
+ preferences = PreferParser.parse(preferHeaders);
+ }
+
+ public Preference getPreference(final String name) {
+ return preferences.get(name.toLowerCase(Locale.ROOT));
+ }
+
+ public boolean hasAllowEntityReferences() {
+ return preferences.containsKey(PreferenceName.ALLOW_ENTITY_REFERENCES.getName());
+ }
+
+ public URI getCallback() {
+ if (preferences.containsKey(PreferenceName.CALLBACK.getName())
+ && preferences.get(PreferenceName.CALLBACK.getName()).getParameters() != null
+ && preferences.get(PreferenceName.CALLBACK.getName()).getParameters().get(URL) != null) {
+ try {
+ return URI.create(preferences.get(PreferenceName.CALLBACK.getName()).getParameters().get(URL));
+ } catch (final IllegalArgumentException e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public boolean hasContinueOnError() {
+ return preferences.containsKey(PreferenceName.CONTINUE_ON_ERROR.getName());
+ }
+
+ public Integer getMaxPageSize() {
+ return getNonNegativeIntegerPreference(PreferenceName.MAX_PAGE_SIZE.getName());
+ }
+
+ public boolean hasTrackChanges() {
+ return preferences.containsKey(PreferenceName.TRACK_CHANGES.getName());
+ }
+
+ public Return getReturn() {
+ if (preferences.containsKey(PreferenceName.RETURN.getName())) {
+ final String value = preferences.get(PreferenceName.RETURN.getName()).getValue();
+ if (Return.REPRESENTATION.toString().toLowerCase(Locale.ROOT).equals(value)) {
+ return Return.REPRESENTATION;
+ } else if (Return.MINIMAL.toString().toLowerCase(Locale.ROOT).equals(value)) {
+ return Return.MINIMAL;
+ }
+ }
+ return null;
+ }
+
+ public boolean hasRespondAsync() {
+ return preferences.containsKey(PreferenceName.RESPOND_ASYNC.getName());
+ }
+
+ public Integer getWait() {
+ return getNonNegativeIntegerPreference(PreferenceName.WAIT.getName());
+ }
+
+ private Integer getNonNegativeIntegerPreference(final String name) {
+ if (preferences.containsKey(name) && preferences.get(name).getValue() != null) {
+ try {
+ final Integer result = Integer.valueOf(preferences.get(name).getValue());
+ return result < 0 ? null : result;
+ } catch (final NumberFormatException e) {
+ return null;
+ }
+ }
+ return null;
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/AbstractODataSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/AbstractODataSerializer.java
new file mode 100644
index 0000000..c279586
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/AbstractODataSerializer.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.serializer;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+
+public abstract class AbstractODataSerializer implements ODataSerializer {
+
+ protected static final String IO_EXCEPTION_TEXT = "An I/O exception occurred.";
+
+ protected void closeCircleStreamBufferOutput(OutputStream outputStream, SerializerException cachedException)
+ throws SerializerException {
+ if (outputStream != null) {
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+ if (cachedException != null) {
+ throw cachedException;
+ } else {
+ throw new SerializerException("An I/O exception occurred.", e,
+ SerializerException.MessageKeys.IO_EXCEPTION);
+ }
+ }
+ }
+ }
+
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/AsyncResponseSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/AsyncResponseSerializer.java
new file mode 100644
index 0000000..6f431d4
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/AsyncResponseSerializer.java
@@ -0,0 +1,105 @@
+/*
+ * 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 org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.serializer.SerializerException;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
+import java.util.List;
+import java.util.Map;
+
+public class AsyncResponseSerializer {
+ private static final int BUFFER_SIZE = 8192;
+ private static final String COLON = ":";
+ private static final String SP = " ";
+ private static final String CRLF = "\r\n";
+ private static final String HEADER_CHARSET_NAME = "ISO-8859-1";
+ private static final String HTTP_VERSION = "HTTP/1.1";
+
+ public InputStream serialize(final ODataResponse response) throws SerializerException {
+ try {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ appendStatusLine(response, buffer);
+ appendResponseHeader(response, buffer);
+ append(CRLF, buffer);
+ appendBody(response, buffer);
+
+ buffer.flush();
+ return new ByteArrayInputStream(buffer.toByteArray(), 0, buffer.size());
+ } catch (IOException e) {
+ throw new SerializerException("Exception occurred during serialization of asynchronous response.",
+ e, SerializerException.MessageKeys.IO_EXCEPTION);
+ }
+ }
+
+ private void appendResponseHeader(final ODataResponse response,
+ final ByteArrayOutputStream buffer) throws IOException {
+ final Map<String, List<String>> header = response.getAllHeaders();
+
+ for (final Map.Entry<String, List<String>> entry: header.entrySet()) {
+ appendHeader(entry.getKey(), entry.getValue(), buffer);
+ }
+ }
+
+ private void appendHeader(final String name, final List<String> values, final ByteArrayOutputStream buffer)
+ throws IOException {
+ for (String value : values) {
+ append(name + COLON + SP + value + CRLF, buffer);
+ }
+ }
+
+ private void appendStatusLine(final ODataResponse response, final ByteArrayOutputStream buffer)
+ throws IOException {
+ HttpStatusCode status = HttpStatusCode.fromStatusCode(response.getStatusCode());
+ append(HTTP_VERSION + SP + response.getStatusCode() + SP + status + CRLF, buffer);
+ }
+
+ private void appendBody(ODataResponse response, ByteArrayOutputStream buffer) throws IOException {
+ InputStream input = response.getContent();
+ if (input != null) {
+ ByteBuffer inBuffer = ByteBuffer.allocate(BUFFER_SIZE);
+ ReadableByteChannel ic = Channels.newChannel(input);
+ WritableByteChannel oc = Channels.newChannel(buffer);
+ while (ic.read(inBuffer) > 0) {
+ inBuffer.flip();
+ oc.write(inBuffer);
+ inBuffer.rewind();
+ }
+ }
+ }
+
+ private void append(final String value, final ByteArrayOutputStream buffer) throws IOException {
+ try {
+ buffer.write(value.getBytes(HEADER_CHARSET_NAME));
+ } catch (UnsupportedEncodingException e) {
+ throw new IOException("Default header charset with name '" + HEADER_CHARSET_NAME +
+ "' is not available.", e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
index 3661907..f7fd01d 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
@@ -22,18 +22,23 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
+import java.nio.charset.Charset;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.batch.exception.BatchSerializerException;
-import org.apache.olingo.server.api.batch.exception.BatchSerializerException.MessageKeys;
import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
+import org.apache.olingo.server.api.serializer.BatchSerializerException;
+import org.apache.olingo.server.api.serializer.BatchSerializerException.MessageKeys;
import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
public class BatchResponseSerializer {
@@ -45,14 +50,14 @@
public InputStream serialize(final List<ODataResponsePart> responses, final String boundary)
throws BatchSerializerException {
- StringBuilder builder = createBody(responses, boundary);
+ BodyBuilder builder = createBody(responses, boundary);
- return new ByteArrayInputStream(builder.toString().getBytes());
+ return new ByteArrayInputStream(builder.getContent());
}
- private StringBuilder createBody(final List<ODataResponsePart> batchResponses, final String boundary)
+ private BodyBuilder createBody(final List<ODataResponsePart> batchResponses, final String boundary)
throws BatchSerializerException {
- final StringBuilder builder = new StringBuilder();
+ final BodyBuilder builder = new BodyBuilder();
for (final ODataResponsePart part : batchResponses) {
builder.append(getDashBoundary(boundary));
@@ -68,7 +73,7 @@
return builder;
}
- private void appendChangeSet(final ODataResponsePart part, final StringBuilder builder)
+ private void appendChangeSet(final ODataResponsePart part, final BodyBuilder builder)
throws BatchSerializerException {
final String changeSetBoundary = generateBoundary("changeset");
@@ -83,50 +88,27 @@
builder.append(getCloseDelimiter(changeSetBoundary));
}
- private void appendBodyPart(final ODataResponse response, final StringBuilder builder, final boolean isChangeSet)
+ private void appendBodyPart(final ODataResponse response, final BodyBuilder builder, final boolean isChangeSet)
throws BatchSerializerException {
- byte[] body = getBody(response);
appendBodyPartHeader(response, builder, isChangeSet);
builder.append(CRLF);
appendStatusLine(response, builder);
- appendResponseHeader(response, body.length, builder);
+ Body body = new Body(response);
+ appendResponseHeader(response, body.getLength(), builder);
builder.append(CRLF);
- builder.append(new String(body));
+ builder.append(body);
builder.append(CRLF);
}
- private byte[] getBody(final ODataResponse response) {
- final InputStream content = response.getContent();
- final ByteArrayOutputStream out = new ByteArrayOutputStream();
-
- if (content != null) {
- byte[] buffer = new byte[BUFFER_SIZE];
- int n;
-
- try {
- while ((n = content.read(buffer, 0, buffer.length)) != -1) {
- out.write(buffer, 0, n);
- }
- out.flush();
- } catch (IOException e) {
- throw new ODataRuntimeException(e);
- }
-
- return out.toByteArray();
- } else {
- return new byte[0];
- }
- }
-
- private void appendChangeSetHeader(final StringBuilder builder, final String changeSetBoundary) {
+ private void appendChangeSetHeader(final BodyBuilder builder, final String changeSetBoundary) {
appendHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED + "; boundary="
- + changeSetBoundary, builder);
+ + changeSetBoundary, builder);
}
- private void appendHeader(final String name, final String value, final StringBuilder builder) {
+ private void appendHeader(final String name, final String value, final BodyBuilder builder) {
builder.append(name)
.append(COLON)
.append(SP)
@@ -134,39 +116,45 @@
.append(CRLF);
}
- private void appendStatusLine(final ODataResponse response, final StringBuilder builder) {
+ private void appendStatusLine(final ODataResponse response, final BodyBuilder builder) {
builder.append("HTTP/1.1")
.append(SP)
.append(response.getStatusCode())
.append(SP)
- .append(HttpStatusCode.fromStatusCode(response.getStatusCode()).toString())
+ .append(getStatusCodeInfo(response))
.append(CRLF);
}
- private void appendResponseHeader(final ODataResponse response, final int contentLength,
- final StringBuilder builder) {
- final Map<String, String> header = response.getHeaders();
+ private String getStatusCodeInfo(ODataResponse response) {
+ HttpStatusCode status = HttpStatusCode.fromStatusCode(response.getStatusCode());
+ if(status == null) {
+ throw new ODataRuntimeException("Invalid status code in response '" + response.getStatusCode() + "'");
+ }
+ return status.getInfo();
+ }
- for (final String key : header.keySet()) {
+ private void appendResponseHeader(final ODataResponse response, final int contentLength,
+ final BodyBuilder builder) {
+ final Map<String, List<String>> header = response.getAllHeaders();
+
+ for (final Map.Entry<String, List<String>> entry : header.entrySet()) {
// Requests do never has a content id header
- if (!key.equalsIgnoreCase(BatchParserCommon.HTTP_CONTENT_ID)) {
- appendHeader(key, header.get(key), builder);
+ if (!entry.getKey().equalsIgnoreCase(HttpHeader.CONTENT_ID)) {
+ appendHeader(entry.getKey(), entry.getValue().get(0), builder);
}
}
appendHeader(HttpHeader.CONTENT_LENGTH, "" + contentLength, builder);
}
- private void
- appendBodyPartHeader(final ODataResponse response, final StringBuilder builder, final boolean isChangeSet)
- throws BatchSerializerException {
+ private void appendBodyPartHeader(final ODataResponse response, final BodyBuilder builder,
+ final boolean isChangeSet) throws BatchSerializerException {
appendHeader(HttpHeader.CONTENT_TYPE, HttpContentType.APPLICATION_HTTP, builder);
- appendHeader(BatchParserCommon.HTTP_CONTENT_TRANSFER_ENCODING, BatchParserCommon.BINARY_ENCODING, builder);
+ appendHeader(BatchParserCommon.CONTENT_TRANSFER_ENCODING, BatchParserCommon.BINARY_ENCODING, builder);
if (isChangeSet) {
- if (response.getHeaders().get(BatchParserCommon.HTTP_CONTENT_ID) != null) {
- appendHeader(BatchParserCommon.HTTP_CONTENT_ID, response.getHeaders().get(BatchParserCommon.HTTP_CONTENT_ID),
- builder);
+ if (response.getAllHeaders().get(HttpHeader.CONTENT_ID) != null) {
+ appendHeader(HttpHeader.CONTENT_ID, response.getHeader(HttpHeader.CONTENT_ID), builder);
} else {
throw new BatchSerializerException("Missing content id", MessageKeys.MISSING_CONTENT_ID);
}
@@ -184,4 +172,94 @@
private String generateBoundary(final String value) {
return value + "_" + UUID.randomUUID().toString();
}
-}
+
+ /**
+ * Builder class to create the body and the header.
+ */
+ private static class BodyBuilder {
+ private static final Charset CHARSET_ISO_8859_1 = Charset.forName("iso-8859-1");
+ private ByteBuffer buffer = ByteBuffer.allocate(8192);
+ private boolean isClosed = false;
+
+ public byte[] getContent() {
+ isClosed = true;
+ byte[] tmp = new byte[buffer.position()];
+ buffer.flip();
+ buffer.get(tmp, 0, buffer.limit());
+ return tmp;
+ }
+
+ public BodyBuilder append(String string) {
+ byte [] b = string.getBytes(CHARSET_ISO_8859_1);
+ put(b);
+ return this;
+ }
+
+ private void put(byte[] b) {
+ if(isClosed) {
+ throw new RuntimeException("BodyBuilder is closed.");
+ }
+ if(buffer.remaining() < b.length) {
+ buffer.flip();
+ int newSize = (buffer.limit() * 2) + b.length;
+ ByteBuffer tmp = ByteBuffer.allocate(newSize);
+ tmp.put(buffer);
+ buffer = tmp;
+ }
+ buffer.put(b);
+ }
+
+ public BodyBuilder append(int statusCode) {
+ return append(String.valueOf(statusCode));
+ }
+
+ public BodyBuilder append(Body body) {
+ put(body.getContent());
+ return this;
+ }
+
+ public String toString() {
+ return new String(buffer.array(), 0, buffer.position(), CHARSET_ISO_8859_1);
+ }
+ }
+
+ /**
+ * Body part which is read and stored as bytes (no charset conversion).
+ */
+ private class Body {
+ private final byte[] content;
+
+ public Body(ODataResponse response) {
+ this.content = getBody(response);
+ }
+
+ public int getLength() {
+ return content.length;
+ }
+
+ public byte[] getContent() {
+ return content;
+ }
+
+ private byte[] getBody(final ODataResponse response) {
+ if (response == null || response.getContent() == null) {
+ return new byte[0];
+ }
+
+ try {
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ ByteBuffer inBuffer = ByteBuffer.allocate(BUFFER_SIZE);
+ ReadableByteChannel ic = Channels.newChannel(response.getContent());
+ WritableByteChannel oc = Channels.newChannel(output);
+ while (ic.read(inBuffer) > 0) {
+ inBuffer.flip();
+ oc.write(inBuffer);
+ inBuffer.rewind();
+ }
+ return output.toByteArray();
+ } catch (IOException e) {
+ throw new ODataRuntimeException("Error on reading request content", e);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/FixedFormatSerializerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/FixedFormatSerializerImpl.java
index 6fd911b..3066839 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/FixedFormatSerializerImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/FixedFormatSerializerImpl.java
@@ -25,8 +25,9 @@
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.server.api.batch.exception.BatchSerializerException;
+import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
+import org.apache.olingo.server.api.serializer.BatchSerializerException;
import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
import org.apache.olingo.server.api.serializer.PrimitiveValueSerializerOptions;
import org.apache.olingo.server.api.serializer.SerializerException;
@@ -40,7 +41,12 @@
@Override
public InputStream count(final Integer count) throws SerializerException {
- return new ByteArrayInputStream(count.toString().getBytes());
+ try {
+ return new ByteArrayInputStream(count.toString().getBytes("UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ throw new SerializerException("UTF-8 is nott supprted as an encoding", e,
+ SerializerException.MessageKeys.UNSUPPORTED_ENCODING, "UTF-8");
+ }
}
@Override
@@ -60,6 +66,12 @@
}
}
+ @Override
+ public InputStream asyncResponse(ODataResponse odataResponse) throws SerializerException {
+ AsyncResponseSerializer serializer = new AsyncResponseSerializer();
+ return serializer.serialize(odataResponse);
+ }
+
// TODO: Signature refactoring for writeBatchResponse
@Override
public InputStream batchResponse(final List<ODataResponsePart> batchResponses, final String boundary)
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java
index 97faaa0..c3c39d0 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java
@@ -21,8 +21,8 @@
import java.io.IOException;
import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.ODataError;
-import org.apache.olingo.commons.api.ODataErrorDetail;
+import org.apache.olingo.commons.api.ex.ODataError;
+import org.apache.olingo.commons.api.ex.ODataErrorDetail;
import org.apache.olingo.server.api.serializer.SerializerException;
import com.fasterxml.jackson.core.JsonGenerator;
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
index 168adfa..f9c0c8f 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this 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
@@ -19,7 +19,9 @@
package org.apache.olingo.server.core.serializer.json;
import java.io.IOException;
+import java.io.OutputStream;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -41,73 +43,64 @@
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmStructuredType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.ODataServerError;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
+import org.apache.olingo.server.api.serializer.ReferenceCollectionSerializerOptions;
+import org.apache.olingo.server.api.serializer.ReferenceSerializerOptions;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.serializer.SerializerResult;
import org.apache.olingo.server.api.uri.UriHelper;
import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
import org.apache.olingo.server.api.uri.queryoption.SelectOption;
+import org.apache.olingo.server.core.serializer.AbstractODataSerializer;
import org.apache.olingo.server.core.serializer.SerializerResultImpl;
import org.apache.olingo.server.core.serializer.utils.CircleStreamBuffer;
+import org.apache.olingo.server.core.serializer.utils.ContentTypeHelper;
import org.apache.olingo.server.core.serializer.utils.ContextURLBuilder;
import org.apache.olingo.server.core.serializer.utils.ExpandSelectHelper;
import org.apache.olingo.server.core.uri.UriHelperImpl;
-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 {
+public class ODataJsonSerializer extends AbstractODataSerializer {
- private static final Logger log = LoggerFactory.getLogger(ODataJsonSerializer.class);
+ private final boolean isIEEE754Compatible;
+ private final boolean isODataMetadataNone;
- private final ODataFormat format;
-
- public ODataJsonSerializer(final ODataFormat format) {
- this.format = format;
+ public ODataJsonSerializer(final ContentType contentType) {
+ this.isIEEE754Compatible = isODataIEEE754Compatible(contentType);
+ this.isODataMetadataNone = ContentTypeHelper.isODataMetadataNone(contentType);
}
@Override
public SerializerResult serviceDocument(final ServiceMetadata metadata, final String serviceRoot)
throws SerializerException {
- CircleStreamBuffer buffer;
- JsonGenerator gen = null;
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
try {
- buffer = new CircleStreamBuffer();
- gen = new JsonFactory().createGenerator(buffer.getOutputStream())
- .setPrettyPrinter(new DefaultPrettyPrinter());
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ JsonGenerator json = new JsonFactory().createGenerator(outputStream);
+ new ServiceDocumentJsonSerializer(metadata, serviceRoot, isODataMetadataNone).writeServiceDocument(json);
- new ServiceDocumentJsonSerializer(metadata, serviceRoot, format).writeServiceDocument(gen);
-
- gen.close();
-
+ json.close();
+ outputStream.close();
return SerializerResultImpl.with().content(buffer.getInputStream()).build();
-
} catch (final IOException e) {
- log.error(e.getMessage(), e);
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
} finally {
- if (gen != null) {
- try {
- gen.close();
- } catch (IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- }
- }
+ closeCircleStreamBufferOutput(outputStream, cachedException);
}
}
@@ -119,37 +112,44 @@
@Override
public SerializerResult error(final ODataServerError error) throws SerializerException {
- CircleStreamBuffer buffer = new CircleStreamBuffer();
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
try {
- JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ JsonGenerator json = new JsonFactory().createGenerator(outputStream);
new ODataErrorSerializer().writeErrorDocument(json, error);
+
json.close();
+ outputStream.close();
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
} catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
}
- return SerializerResultImpl.with().content(buffer.getInputStream()).build();
}
@Override
public SerializerResult entityCollection(final ServiceMetadata metadata,
final EdmEntityType entityType, final EntityCollection entitySet,
final EntityCollectionSerializerOptions options) throws SerializerException {
- CircleStreamBuffer buffer = new CircleStreamBuffer();
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
try {
- JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ JsonGenerator json = new JsonFactory().createGenerator(outputStream);
json.writeStartObject();
final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
- if (contextURL != null) {
- json.writeStringField(Constants.JSON_CONTEXT,
- ContextURLBuilder.create(contextURL).toASCIIString());
- }
+ writeContextURL(contextURL, json);
writeMetadataETag(metadata, json);
- if (options != null && options.getCount() != null && options.getCount().getValue()
- && entitySet.getCount() != null) {
+ if (options != null && options.getCount() != null && options.getCount().getValue()) {
writeCount(entitySet, json);
}
json.writeFieldName(Constants.VALUE);
@@ -159,38 +159,50 @@
writeEntitySet(metadata, entityType, entitySet,
options.getExpand(), options.getSelect(), options.onlyReferences(), json);
}
- if (entitySet.getNext() != null) {
- writeNextLink(entitySet, json);
- }
+ writeNextLink(entitySet, json);
+
json.close();
+ outputStream.close();
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
} catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
}
- return SerializerResultImpl.with().content(buffer.getInputStream()).build();
}
@Override
public SerializerResult entity(final ServiceMetadata metadata, final EdmEntityType entityType,
final Entity entity, final EntitySerializerOptions options) throws SerializerException {
- final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
- CircleStreamBuffer buffer = new CircleStreamBuffer();
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
try {
- JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
+ final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ JsonGenerator json = new JsonFactory().createGenerator(outputStream);
writeEntity(metadata, entityType, entity, contextURL,
options == null ? null : options.getExpand(),
options == null ? null : options.getSelect(),
- options == null ? false : options.onlyReferences(), json);
+ options == null ? false : options.onlyReferences(),
+ json);
+
json.close();
+ outputStream.close();
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
} catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
}
- return SerializerResultImpl.with().content(buffer.getInputStream()).build();
}
private ContextURL checkContextURL(final ContextURL contextURL) throws SerializerException {
- if (format == ODataFormat.JSON_NO_METADATA) {
+ if (isODataMetadataNone) {
return null;
} else if (contextURL == null) {
throw new SerializerException("ContextURL null!", SerializerException.MessageKeys.NO_CONTEXT_URL);
@@ -198,16 +210,6 @@
return contextURL;
}
- private void writeMetadataETag(final ServiceMetadata metadata, JsonGenerator json) throws IOException {
- if (format != ODataFormat.JSON_NO_METADATA
- && metadata != null
- && metadata.getServiceMetadataETagSupport() != null
- && metadata.getServiceMetadataETagSupport().getMetadataETag() != null) {
- json.writeStringField(Constants.JSON_METADATA_ETAG,
- metadata.getServiceMetadataETagSupport().getMetadataETag());
- }
- }
-
protected void writeEntitySet(final ServiceMetadata metadata, final EdmEntityType entityType,
final EntityCollection entitySet, final ExpandOption expand, final SelectOption select,
final boolean onlyReference, final JsonGenerator json) throws IOException,
@@ -230,9 +232,9 @@
final SelectOption select, final boolean onlyReference, final JsonGenerator json)
throws IOException, SerializerException {
json.writeStartObject();
- if (format != ODataFormat.JSON_NO_METADATA) {
+ if (!isODataMetadataNone) {
if (contextURL != null) { // top-level entity
- json.writeStringField(Constants.JSON_CONTEXT, ContextURLBuilder.create(contextURL).toASCIIString());
+ writeContextURL(contextURL, json);
writeMetadataETag(metadata, json);
}
if (entity.getETag() != null) {
@@ -256,8 +258,8 @@
if (onlyReference) {
json.writeStringField(Constants.JSON_ID, entity.getId().toASCIIString());
} else {
- EdmEntityType resolvedType = resolveEntityType(metadata, entityType, entity.getType());
- if (!resolvedType.equals(entityType)) {
+ final EdmEntityType resolvedType = resolveEntityType(metadata, entityType, entity.getType());
+ if (!isODataMetadataNone && !resolvedType.equals(entityType)) {
json.writeStringField(Constants.JSON_TYPE, "#" + entity.getType());
}
writeProperties(resolvedType, entity.getProperties(), select, json);
@@ -315,9 +317,10 @@
}
protected void writeProperties(final EdmStructuredType type, final List<Property> properties,
- final SelectOption select, final JsonGenerator json) throws IOException, SerializerException {
+ final SelectOption select, final JsonGenerator json)
+ throws IOException, SerializerException {
final boolean all = ExpandSelectHelper.isAll(select);
- final Set<String> selected = all ? null :
+ final Set<String> selected = all ? new HashSet<String>() :
ExpandSelectHelper.getSelectedPropertyNames(select.getSelectItems());
for (final String propertyName : type.getPropertyNames()) {
if (all || selected.contains(propertyName)) {
@@ -335,7 +338,7 @@
final JsonGenerator json) throws SerializerException, IOException {
if (ExpandSelectHelper.hasExpand(expand)) {
final boolean expandAll = ExpandSelectHelper.isExpandAll(expand);
- final Set<String> expanded = expandAll ? null :
+ final Set<String> expanded = expandAll ? new HashSet<String>() :
ExpandSelectHelper.getExpandedPropertyNames(expand.getExpandItems());
for (final String propertyName : type.getNavigationPropertyNames()) {
if (expandAll || expanded.contains(propertyName)) {
@@ -349,19 +352,15 @@
}
writeExpandedNavigationProperty(metadata, property, navigationLink,
innerOptions == null ? null : innerOptions.getExpandOption(),
- innerOptions == null ? null : innerOptions.getSelectOption(),
- innerOptions == null ? false: innerOptions.isRef(),
- json);
+ innerOptions == null ? null : innerOptions.getSelectOption(), json);
}
}
}
}
- protected void writeExpandedNavigationProperty(final ServiceMetadata metadata,
- final EdmNavigationProperty property, final Link navigationLink,
- final ExpandOption innerExpand, final SelectOption innerSelect, boolean onlyReference,
- final JsonGenerator json)
- throws IOException, SerializerException {
+ protected void writeExpandedNavigationProperty(final ServiceMetadata metadata, final EdmNavigationProperty property,
+ final Link navigationLink, final ExpandOption innerExpand, final SelectOption innerSelect,
+ final JsonGenerator json) throws IOException, SerializerException {
json.writeFieldName(property.getName());
if (property.isCollection()) {
if (navigationLink == null || navigationLink.getInlineEntitySet() == null) {
@@ -369,20 +368,21 @@
json.writeEndArray();
} else {
writeEntitySet(metadata, property.getType(), navigationLink.getInlineEntitySet(), innerExpand,
- innerSelect, onlyReference, json);
+ innerSelect, false, json);
}
} else {
if (navigationLink == null || navigationLink.getInlineEntity() == null) {
json.writeNull();
} else {
writeEntity(metadata, property.getType(), navigationLink.getInlineEntity(), null,
- innerExpand, innerSelect, onlyReference, json);
+ innerExpand, innerSelect, false, json);
}
}
}
protected void writeProperty(final EdmProperty edmProperty, final Property property,
- final Set<List<String>> selectedPaths, final JsonGenerator json) throws IOException, SerializerException {
+ final Set<List<String>> selectedPaths, final JsonGenerator json)
+ throws IOException, SerializerException {
json.writeFieldName(edmProperty.getName());
if (property == null || property.isNull()) {
if (edmProperty.isNullable() == Boolean.FALSE) {
@@ -397,31 +397,27 @@
}
private void writePropertyValue(final EdmProperty edmProperty,
- final Property property, final Set<List<String>> selectedPaths,
- final JsonGenerator json) throws IOException, SerializerException {
+ final Property property, final Set<List<String>> selectedPaths, final JsonGenerator json)
+ throws IOException, SerializerException {
try {
if (edmProperty.isPrimitive()) {
if (edmProperty.isCollection()) {
writePrimitiveCollection((EdmPrimitiveType) edmProperty.getType(), property,
edmProperty.isNullable(), edmProperty.getMaxLength(),
- edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode(),
- json);
+ edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode(), json);
} else {
writePrimitive((EdmPrimitiveType) edmProperty.getType(), property,
edmProperty.isNullable(), edmProperty.getMaxLength(),
- edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode(),
- json);
+ edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode(), json);
}
} else if (edmProperty.isCollection()) {
writeComplexCollection((EdmComplexType) edmProperty.getType(), property, selectedPaths, json);
} else if (property.isComplex()) {
- writeComplexValue((EdmComplexType) edmProperty.getType(), property.asComplex().getValue(),
- selectedPaths, json);
+ writeComplexValue((EdmComplexType) edmProperty.getType(), property.asComplex().getValue(), selectedPaths, json);
} else if (property.isEnum()) {
writePrimitive((EdmPrimitiveType) edmProperty.getType(), property,
edmProperty.isNullable(), edmProperty.getMaxLength(),
- edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode(),
- json);
+ edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode(), json);
} else {
throw new SerializerException("Property type not yet supported!",
SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, edmProperty.getName());
@@ -435,13 +431,19 @@
private void writePrimitiveCollection(final EdmPrimitiveType type, final Property property,
final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale,
- final Boolean isUnicode,
- final JsonGenerator json) throws IOException, EdmPrimitiveTypeException, SerializerException {
+ final Boolean isUnicode, final JsonGenerator json)
+ throws IOException, SerializerException {
json.writeStartArray();
for (Object value : property.asCollection()) {
switch (property.getValueType()) {
case COLLECTION_PRIMITIVE:
- writePrimitiveValue(type, value, isNullable, maxLength, precision, scale, isUnicode, json);
+ try {
+ writePrimitiveValue(type, value, isNullable, maxLength, precision, scale, isUnicode, json);
+ } catch (EdmPrimitiveTypeException e) {
+ throw new SerializerException("Wrong value for property!", e,
+ SerializerException.MessageKeys.WRONG_PROPERTY_VALUE,
+ property.getName(), property.getValue().toString());
+ }
break;
case COLLECTION_GEOSPATIAL:
throw new SerializerException("Property type not yet supported!",
@@ -459,7 +461,7 @@
private void writeComplexCollection(final EdmComplexType type, final Property property,
final Set<List<String>> selectedPaths, final JsonGenerator json)
- throws IOException, EdmPrimitiveTypeException, SerializerException {
+ throws IOException, SerializerException {
json.writeStartArray();
for (Object value : property.asCollection()) {
switch (property.getValueType()) {
@@ -495,22 +497,22 @@
protected void writePrimitiveValue(final EdmPrimitiveType type, final Object primitiveValue,
final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale,
- final Boolean isUnicode,
- final JsonGenerator json) throws EdmPrimitiveTypeException, IOException {
+ final Boolean isUnicode, final JsonGenerator json) throws EdmPrimitiveTypeException, IOException {
final String value = type.valueToString(primitiveValue,
isNullable, maxLength, precision, scale, isUnicode);
if (value == null) {
json.writeNull();
- } else if(type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean)) {
- json.writeBoolean(Boolean.parseBoolean(value));
+ } else if (type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean)) {
+ json.writeBoolean(Boolean.parseBoolean(value));
} else if (type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte)
- || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal)
|| type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double)
|| type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16)
|| type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32)
- || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64)
|| type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte)
- || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single)) {
+ || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single)
+ || (type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal)
+ || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64))
+ && !isIEEE754Compatible) {
json.writeNumber(value);
} else {
json.writeString(value);
@@ -519,7 +521,7 @@
protected void writeComplexValue(final EdmComplexType type, final List<Property> properties,
final Set<List<String>> selectedPaths, final JsonGenerator json)
- throws IOException, EdmPrimitiveTypeException, SerializerException {
+ throws IOException, SerializerException {
json.writeStartObject();
for (final String propertyName : type.getPropertyNames()) {
final Property property = findProperty(propertyName, properties);
@@ -544,51 +546,61 @@
@Override
public SerializerResult primitive(final ServiceMetadata metadata, final EdmPrimitiveType type,
final Property property, final PrimitiveSerializerOptions options) throws SerializerException {
- final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
- CircleStreamBuffer buffer = new CircleStreamBuffer();
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
try {
- JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
+ final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ JsonGenerator json = new JsonFactory().createGenerator(outputStream);
json.writeStartObject();
- if (contextURL != null) {
- json.writeStringField(Constants.JSON_CONTEXT, ContextURLBuilder.create(contextURL).toASCIIString());
- }
+ writeContextURL(contextURL, json);
writeMetadataETag(metadata, json);
if (property.isNull()) {
throw new SerializerException("Property value can not be null.", SerializerException.MessageKeys.NULL_INPUT);
} else {
json.writeFieldName(Constants.VALUE);
writePrimitive(type, property,
- options.isNullable(), options.getMaxLength(), options.getPrecision(), options.getScale(),
- options.isUnicode(),
- json);
+ options == null ? null : options.isNullable(),
+ options == null ? null : options.getMaxLength(),
+ options == null ? null : options.getPrecision(),
+ options == null ? null : options.getScale(),
+ options == null ? null : options.isUnicode(), json);
}
json.writeEndObject();
+
json.close();
+ outputStream.close();
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
} catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
} catch (final EdmPrimitiveTypeException e) {
- throw new SerializerException("Wrong value for property!", e,
+ cachedException = new SerializerException("Wrong value for property!", e,
SerializerException.MessageKeys.WRONG_PROPERTY_VALUE,
property.getName(), property.getValue().toString());
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
}
- return SerializerResultImpl.with().content(buffer.getInputStream()).build();
}
@Override
public SerializerResult complex(final ServiceMetadata metadata, final EdmComplexType type,
final Property property, final ComplexSerializerOptions options) throws SerializerException {
- final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
- CircleStreamBuffer buffer = new CircleStreamBuffer();
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
try {
- JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
+ final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ JsonGenerator json = new JsonFactory().createGenerator(outputStream);
json.writeStartObject();
- if (contextURL != null) {
- json.writeStringField(Constants.JSON_CONTEXT, ContextURLBuilder.create(contextURL).toASCIIString());
- }
+ writeContextURL(contextURL, json);
writeMetadataETag(metadata, json);
- EdmComplexType resolvedType = resolveComplexType(metadata, type, property.getType());
- if (!resolvedType.equals(type)) {
+ final EdmComplexType resolvedType = resolveComplexType(metadata, type, property.getType());
+ if (!isODataMetadataNone && !resolvedType.equals(type)) {
json.writeStringField(Constants.JSON_TYPE, "#" + property.getType());
}
final List<Property> values =
@@ -599,151 +611,192 @@
options == null ? null : options.getExpand(), json);
}
json.writeEndObject();
+
json.close();
+ outputStream.close();
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
} catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
}
- return SerializerResultImpl.with().content(buffer.getInputStream()).build();
}
@Override
public SerializerResult primitiveCollection(final ServiceMetadata metadata, final EdmPrimitiveType type,
final Property property, final PrimitiveSerializerOptions options) throws SerializerException {
- final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
- CircleStreamBuffer buffer = new CircleStreamBuffer();
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
try {
- JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
+ final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ JsonGenerator json = new JsonFactory().createGenerator(outputStream);
json.writeStartObject();
- if (contextURL != null) {
- json.writeStringField(Constants.JSON_CONTEXT, ContextURLBuilder.create(contextURL).toASCIIString());
- }
+ writeContextURL(contextURL, json);
writeMetadataETag(metadata, json);
json.writeFieldName(Constants.VALUE);
writePrimitiveCollection(type, property,
- options.isNullable(), options.getMaxLength(), options.getPrecision(), options.getScale(),
- options.isUnicode(),
- json);
+ options == null ? null : options.isNullable(),
+ options == null ? null : options.getMaxLength(),
+ options == null ? null : options.getPrecision(),
+ options == null ? null : options.getScale(),
+ options == null ? null : options.isUnicode(), json);
json.writeEndObject();
+
json.close();
+ outputStream.close();
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
} catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- } catch (final EdmPrimitiveTypeException e) {
- throw new SerializerException("Wrong value for property!", e,
- SerializerException.MessageKeys.WRONG_PROPERTY_VALUE,
- property.getName(), property.getValue().toString());
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
}
- return SerializerResultImpl.with().content(buffer.getInputStream()).build();
}
@Override
public SerializerResult complexCollection(final ServiceMetadata metadata, final EdmComplexType type,
final Property property, final ComplexSerializerOptions options) throws SerializerException {
- final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
- CircleStreamBuffer buffer = new CircleStreamBuffer();
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
try {
- JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
+ final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ JsonGenerator json = new JsonFactory().createGenerator(outputStream);
json.writeStartObject();
- if (contextURL != null) {
- json.writeStringField(Constants.JSON_CONTEXT, ContextURLBuilder.create(contextURL).toASCIIString());
- }
+ writeContextURL(contextURL, json);
writeMetadataETag(metadata, json);
json.writeFieldName(Constants.VALUE);
writeComplexCollection(type, property, null, json);
json.writeEndObject();
+
json.close();
+ outputStream.close();
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
} catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- } catch (final EdmPrimitiveTypeException e) {
- throw new SerializerException("Wrong value for property!", e,
- SerializerException.MessageKeys.WRONG_PROPERTY_VALUE,
- property.getName(), property.getValue().toString());
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
}
- return SerializerResultImpl.with().content(buffer.getInputStream()).build();
}
@Override
- public SerializerResult reference(final ServiceMetadata metadata, final EdmEntitySet edmEntitySet,
- final Entity entity, final ContextURL contextURL) throws SerializerException {
-
- final CircleStreamBuffer buffer = new CircleStreamBuffer();
- final UriHelper uriHelper = new UriHelperImpl();
-
+ public SerializerResult reference(final ServiceMetadata metadata, final EdmEntitySet edmEntitySet,
+ final Entity entity, final ReferenceSerializerOptions options) throws SerializerException {
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
+
try {
- final JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
- writeReference(metadata, edmEntitySet, entity, contextURL, uriHelper, json);
+ final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ final UriHelper uriHelper = new UriHelperImpl();
+ outputStream = buffer.getOutputStream();
+ final JsonGenerator json = new JsonFactory().createGenerator(outputStream);
+
+ json.writeStartObject();
+ writeContextURL(contextURL, json);
+ json.writeStringField(Constants.JSON_ID, uriHelper.buildCanonicalURL(edmEntitySet, entity));
+ json.writeEndObject();
json.close();
- } catch (IOException e) {
- throw new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
+ outputStream.close();
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
+ } catch (final IOException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
}
-
- return SerializerResultImpl.with().content(buffer.getInputStream()).build();
}
-
+
@Override
- public SerializerResult referenceCollection(final ServiceMetadata metadata, final EdmEntitySet edmEntitySet,
- final EntityCollection entityCollection, final ContextURL contextURL) throws SerializerException {
-
- final CircleStreamBuffer buffer = new CircleStreamBuffer();
- final UriHelper uriHelper = new UriHelperImpl();
-
+ public SerializerResult referenceCollection(final ServiceMetadata metadata, final EdmEntitySet edmEntitySet,
+ final EntityCollection entityCollection, final ReferenceCollectionSerializerOptions options)
+ throws SerializerException {
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
+
try {
- final JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
+ final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ final UriHelper uriHelper = new UriHelperImpl();
+ outputStream = buffer.getOutputStream();
+ final JsonGenerator json = new JsonFactory().createGenerator(outputStream);
json.writeStartObject();
-
- if(entityCollection.getCount() != null) {
+
+ writeContextURL(contextURL, json);
+ if (options != null && options.getCount() != null && options.getCount().getValue()) {
writeCount(entityCollection, json);
}
-
- json.writeStringField(Constants.JSON_CONTEXT, ContextURLBuilder.create(contextURL).toASCIIString());
- writeMetadataETag(metadata, json);
- writeReferenceCollection(edmEntitySet, entityCollection, uriHelper,json);
- if(entityCollection.getNext() != null) {
- writeNextLink(entityCollection, json);
+ json.writeArrayFieldStart(Constants.VALUE);
+ for (final Entity entity : entityCollection.getEntities()) {
+ json.writeStartObject();
+ json.writeStringField(Constants.JSON_ID, uriHelper.buildCanonicalURL(edmEntitySet, entity));
+ json.writeEndObject();
}
-
+ json.writeEndArray();
+
+ writeNextLink(entityCollection, json);
+
json.writeEndObject();
+
json.close();
- } catch (IOException e) {
- throw new SerializerException("An I/O exception occurred.", e, SerializerException.MessageKeys.IO_EXCEPTION);
- }
-
- return SerializerResultImpl.with().content(buffer.getInputStream()).build();
- }
-
- protected void writeReferenceCollection(final EdmEntitySet edmEntitySet, final EntityCollection entityCollection,
- final UriHelper uriHelper, final JsonGenerator json) throws IOException, SerializerException {
- json.writeArrayFieldStart(Constants.VALUE);
-
- for(final Entity entity : entityCollection.getEntities()) {
- writeReference(null, edmEntitySet, entity, null, uriHelper, json);
+ outputStream.close();
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
+ } catch (final IOException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
}
- json.writeEndArray();
}
-
- protected void writeReference(final ServiceMetadata metadata, final EdmEntitySet edmEntitySet, final Entity entity,
- final ContextURL contextURL, final UriHelper uriHelper, final JsonGenerator json)
- throws IOException, SerializerException {
- json.writeStartObject();
- if (contextURL != null) {
+
+ private void writeContextURL(final ContextURL contextURL, JsonGenerator json) throws IOException {
+ if (!isODataMetadataNone && contextURL != null) {
json.writeStringField(Constants.JSON_CONTEXT, ContextURLBuilder.create(contextURL).toASCIIString());
- writeMetadataETag(metadata, json);
}
-
- json.writeStringField(Constants.JSON_ID, uriHelper.buildCanonicalURL(edmEntitySet, entity));
- json.writeEndObject();
}
-
- private void writeCount(final EntityCollection entitySet, JsonGenerator json) throws IOException {
- json.writeNumberField(Constants.JSON_COUNT, entitySet.getCount());
+
+ private void writeMetadataETag(final ServiceMetadata metadata, JsonGenerator json) throws IOException {
+ if (!isODataMetadataNone
+ && metadata != null
+ && metadata.getServiceMetadataETagSupport() != null
+ && metadata.getServiceMetadataETagSupport().getMetadataETag() != null) {
+ json.writeStringField(Constants.JSON_METADATA_ETAG,
+ metadata.getServiceMetadataETagSupport().getMetadataETag());
+ }
+ }
+
+ private void writeCount(final EntityCollection entityCollection, JsonGenerator json) throws IOException {
+ if (entityCollection.getCount() != null) {
+ if (isIEEE754Compatible) {
+ json.writeStringField(Constants.JSON_COUNT, entityCollection.getCount().toString());
+ } else {
+ json.writeNumberField(Constants.JSON_COUNT, entityCollection.getCount());
+ }
+ }
}
private void writeNextLink(final EntityCollection entitySet, JsonGenerator json) throws IOException {
- json.writeStringField(Constants.JSON_NEXT_LINK, entitySet.getNext().toASCIIString());
+ if (entitySet.getNext() != null) {
+ json.writeStringField(Constants.JSON_NEXT_LINK, entitySet.getNext().toASCIIString());
+ }
+ }
+
+ private boolean isODataIEEE754Compatible(final ContentType contentType) {
+ return contentType.getParameters().containsKey(ContentType.PARAMETER_IEEE754_COMPATIBLE)
+ && Boolean.TRUE.toString().equalsIgnoreCase(
+ contentType.getParameter(ContentType.PARAMETER_IEEE754_COMPATIBLE).toLowerCase());
}
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java
index 65b4673..0136df4 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java
@@ -26,8 +26,8 @@
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.commons.api.format.ODataFormat;
import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.serializer.SerializerException;
import com.fasterxml.jackson.core.JsonGenerator;
@@ -40,30 +40,35 @@
private final ServiceMetadata metadata;
private final String serviceRoot;
- private final ODataFormat format;
+ private final boolean isODataMetadataNone;
public ServiceDocumentJsonSerializer(final ServiceMetadata metadata, final String serviceRoot,
- final ODataFormat format) {
+ final boolean isODataMetadataNone) throws SerializerException {
+ if (metadata == null || metadata.getEdm() == null) {
+ throw new SerializerException("Service Metadata and EDM must not be null for a service.",
+ SerializerException.MessageKeys.NULL_METADATA_OR_EDM);
+ }
this.metadata = metadata;
this.serviceRoot = serviceRoot;
- this.format = format;
+ this.isODataMetadataNone = isODataMetadataNone;
}
public void writeServiceDocument(final JsonGenerator gen) throws IOException {
gen.writeStartObject();
- final String metadataUri =
- (serviceRoot == null ? "" :
- serviceRoot.endsWith("/") ? serviceRoot : (serviceRoot + "/"))
- + Constants.METADATA;
- gen.writeObjectField(Constants.JSON_CONTEXT, metadataUri);
+ if (!isODataMetadataNone) {
+ final String metadataUri =
+ (serviceRoot == null ? "" :
+ serviceRoot.endsWith("/") ? serviceRoot : (serviceRoot + "/"))
+ + Constants.METADATA;
+ gen.writeObjectField(Constants.JSON_CONTEXT, metadataUri);
- if (format != ODataFormat.JSON_NO_METADATA
- && metadata != null
- && metadata.getServiceMetadataETagSupport() != null
- && metadata.getServiceMetadataETagSupport().getMetadataETag() != null) {
- gen.writeStringField(Constants.JSON_METADATA_ETAG,
- metadata.getServiceMetadataETagSupport().getMetadataETag());
+ if (metadata != null
+ && metadata.getServiceMetadataETagSupport() != null
+ && metadata.getServiceMetadataETagSupport().getMetadataETag() != null) {
+ gen.writeStringField(Constants.JSON_METADATA_ETAG,
+ metadata.getServiceMetadataETagSupport().getMetadataETag());
+ }
}
gen.writeArrayFieldStart(Constants.VALUE);
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java
index 8a450d8..20d9ca5 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java
@@ -47,8 +47,8 @@
private Queue<ByteBuffer> bufferQueue = new LinkedBlockingQueue<ByteBuffer>();
private ByteBuffer currentWriteBuffer;
- private InternalInputStream inStream;
- private InternalOutputStream outStream;
+ private final InternalInputStream inStream;
+ private final InternalOutputStream outStream;
/**
* Creates a {@link CircleStreamBuffer} with default buffer size.
@@ -58,12 +58,12 @@
}
/**
- * Create a {@link CircleStreamBuffer} with given buffer size in bytes.
+ * Create a {@link CircleStreamBuffer} with given initial buffer size.
*
- * @param bufferSize
+ * @param initialCapacity initial capacity of internal buffer
*/
- public CircleStreamBuffer(final int bufferSize) {
- currentAllocateCapacity = bufferSize;
+ public CircleStreamBuffer(final int initialCapacity) {
+ currentAllocateCapacity = initialCapacity;
createNewWriteBuffer();
inStream = new InternalInputStream(this);
outStream = new InternalOutputStream(this);
@@ -244,21 +244,27 @@
}
/**
+ * Allocate a new buffer with requested capacity
*
- * @param requestedCapacity
+ * @param requestedCapacity minimal capacity of new buffer
* @return the buffer
*/
private ByteBuffer allocateBuffer(final int requestedCapacity) {
- int allocateCapacity = requestedCapacity;
- if (allocateCapacity < currentAllocateCapacity) {
- allocateCapacity = currentAllocateCapacity * NEW_BUFFER_RESIZE_FACTOR;
+ if (requestedCapacity > MAX_CAPACITY) {
+ currentAllocateCapacity = MAX_CAPACITY;
+ return ByteBuffer.allocate(requestedCapacity);
}
- if (allocateCapacity > MAX_CAPACITY) {
- allocateCapacity = MAX_CAPACITY;
+
+ if (requestedCapacity <= currentAllocateCapacity) {
+ currentAllocateCapacity *= NEW_BUFFER_RESIZE_FACTOR;
+ if (currentAllocateCapacity > MAX_CAPACITY) {
+ currentAllocateCapacity = MAX_CAPACITY;
+ }
+ } else {
+ currentAllocateCapacity = requestedCapacity;
}
- // update current
- currentAllocateCapacity = allocateCapacity;
- return ByteBuffer.allocate(allocateCapacity);
+
+ return ByteBuffer.allocate(currentAllocateCapacity);
}
// #############################################
@@ -289,8 +295,8 @@
}
@Override
- public int read(final byte[] b, final int off, final int len) throws IOException {
- return inBuffer.read(b, off, len);
+ public int read(final byte[] buffer, final int off, final int len) throws IOException {
+ return inBuffer.read(buffer, off, len);
}
@Override
@@ -315,8 +321,8 @@
}
@Override
- public void write(final byte[] b, final int off, final int len) throws IOException {
- outBuffer.write(b, off, len);
+ public void write(final byte[] buffer, final int off, final int len) throws IOException {
+ outBuffer.write(buffer, off, len);
}
@Override
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContentTypeHelper.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContentTypeHelper.java
new file mode 100644
index 0000000..8710158
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContentTypeHelper.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.serializer.utils;
+
+import org.apache.olingo.commons.api.format.ContentType;
+
+public class ContentTypeHelper {
+
+ private ContentTypeHelper (){
+ //Private constructor for utility classes
+ }
+
+ public static boolean isODataMetadataNone(final ContentType contentType) {
+ return contentType.isCompatible(ContentType.APPLICATION_JSON)
+ && ContentType.VALUE_ODATA_METADATA_NONE.equals(contentType.getParameter(ContentType.PARAMETER_ODATA_METADATA));
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilder.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilder.java
index e79a295..8c7a8d5 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilder.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilder.java
@@ -31,11 +31,22 @@
*/
public final class ContextURLBuilder {
+ private ContextURLBuilder() { /* private ctor for helper class */ }
+
public static URI create(final ContextURL contextURL) {
StringBuilder result = new StringBuilder();
if (contextURL.getServiceRoot() != null) {
result.append(contextURL.getServiceRoot());
+ } else if(contextURL.getODataPath() != null) {
+ String oDataPath = contextURL.getODataPath();
+ char[] chars = oDataPath.toCharArray();
+ for (int i = 1; i < chars.length-1; i++) {
+ if(chars[i] == '/' && chars[i-1] != '/') {
+ result.append("../");
+ }
+ }
}
+
result.append(Constants.METADATA);
if (contextURL.getEntitySetOrSingletonOrType() != null) {
result.append('#');
@@ -67,10 +78,10 @@
throw new IllegalArgumentException("ContextURL: $ref with Entity Set");
}
if (contextURL.isCollection()) {
- result.append('#');
- result.append("Collection(")
- .append(ContextURL.Suffix.REFERENCE.getRepresentation())
- .append(")");
+ result.append('#')
+ .append("Collection(")
+ .append(ContextURL.Suffix.REFERENCE.getRepresentation())
+ .append(")");
} else {
result.append('#').append(ContextURL.Suffix.REFERENCE.getRepresentation());
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContextURLHelper.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContextURLHelper.java
index 421c6eb..22a2301 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContextURLHelper.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContextURLHelper.java
@@ -29,6 +29,8 @@
import org.apache.olingo.commons.core.Encoder;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceProperty;
import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
import org.apache.olingo.server.api.uri.queryoption.SelectItem;
@@ -36,6 +38,8 @@
public final class ContextURLHelper {
+ private ContextURLHelper() { /* private ctor for helper class */ }
+
/**
* Builds a list of selected Properties for the ContextURL,
* taking care to preserve the order as defined in the EDM;
@@ -117,11 +121,39 @@
}
result.append(Encoder.encode(propertyName)).append('(').append(innerSelectList).append(')');
}
+ } else {
+ final List<UriResource> resourceParts = expandItem.getResourcePath().getUriResourceParts();
+ if(resourceParts.size() > 1) {
+ if (result.length() > 0) {
+ result.append(',');
+ }
+ final List<String> path = getPropertyPath(resourceParts);
+ String propertyPath = buildPropertyPath(path);
+ result.append(Encoder.encode(propertyName));
+ result.append("/").append(propertyPath);
+ }
}
}
}
}
+ private static List<String> getPropertyPath(final List<UriResource> path) {
+ List<String> result = new LinkedList<String>();
+ int index = 1;
+ while (index < path.size() && path.get(index) instanceof UriResourceProperty) {
+ result.add(((UriResourceProperty) path.get(index)).getProperty().getName());
+ index++;
+ }
+ return result;
+ }
+
+ private static String buildPropertyPath(final List<String> path) {
+ StringBuilder result = new StringBuilder();
+ for (final String segment : path) {
+ result.append(result.length() == 0 ? "" : '/').append(Encoder.encode(segment)); //$NON-NLS-1$
+ }
+ return result.length() == 0?null:result.toString();
+ }
private static List<List<String>> getComplexSelectedPaths(final EdmProperty edmProperty,
final Set<List<String>> selectedPaths) {
List<List<String>> result = new ArrayList<List<String>>();
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ExpandSelectHelper.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ExpandSelectHelper.java
index 3acdbd3..30810f0 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ExpandSelectHelper.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ExpandSelectHelper.java
@@ -127,14 +127,9 @@
Set<String> expanded = new HashSet<String>();
for (final ExpandItem item : expandItems) {
final List<UriResource> resourceParts = item.getResourcePath().getUriResourceParts();
- if (resourceParts.size() == 1) {
- final UriResource resource = resourceParts.get(0);
- if (resource instanceof UriResourceNavigation) {
- expanded.add(((UriResourceNavigation) resource).getProperty().getName());
- }
- } else {
- throw new SerializerException("Expand is not supported within complex properties.",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
+ final UriResource resource = resourceParts.get(0);
+ if (resource instanceof UriResourceNavigation) {
+ expanded.add(((UriResourceNavigation) resource).getProperty().getName());
}
}
return expanded;
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
index 2957bce..81d516b 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
@@ -56,6 +56,7 @@
import org.apache.olingo.server.api.edmx.EdmxReferenceInclude;
import org.apache.olingo.server.api.edmx.EdmxReferenceIncludeAnnotation;
import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
public class MetadataDocumentXmlSerializer {
@@ -112,18 +113,22 @@
private static final String DATA_SERVICES = "DataServices";
private static final String ABSTRACT = "Abstract";
- 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 static final String EDMX = "Edmx";
+ private static final String PREFIX_EDMX = "edmx";
+ private static final 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";
+ private static final String NS_EDM = "http://docs.oasis-open.org/odata/ns/edm";
private static final String XML_ENTITY_SET_PATH = "EntitySetPath";
private static final String XML_CONTAINS_TARGET = "ContainsTarget";
private final ServiceMetadata serviceMetadata;
private final Map<String, String> namespaceToAlias = new HashMap<String, String>();
- public MetadataDocumentXmlSerializer(final ServiceMetadata serviceMetadata) {
+ public MetadataDocumentXmlSerializer(final ServiceMetadata serviceMetadata) throws SerializerException {
+ if (serviceMetadata == null || serviceMetadata.getEdm() == null) {
+ throw new SerializerException("Service Metadata and EDM must not be null for a service.",
+ SerializerException.MessageKeys.NULL_METADATA_OR_EDM);
+ }
this.serviceMetadata = serviceMetadata;
}
@@ -401,7 +406,7 @@
private void appendReturnTypeFacets(final XMLStreamWriter writer, final EdmReturnType returnType)
throws XMLStreamException {
- if (returnType.isNullable() == false) {
+ if (!returnType.isNullable()) {
writer.writeAttribute(XML_NULLABLE, "" + returnType.isNullable());
}
if (returnType.getMaxLength() != null) {
@@ -417,7 +422,7 @@
private void appendParameterFacets(final XMLStreamWriter writer, final EdmParameter parameter)
throws XMLStreamException {
- if (parameter.isNullable() == false) {
+ if (!parameter.isNullable()) {
writer.writeAttribute(XML_NULLABLE, "" + parameter.isNullable());
}
if (parameter.getMaxLength() != null) {
@@ -494,7 +499,7 @@
writer.writeAttribute(XML_NAME, navigationPropertyName);
writer.writeAttribute(XML_TYPE, getAliasedFullQualifiedName(navigationProperty.getType(), navigationProperty
.isCollection()));
- if (navigationProperty.isNullable() == false) {
+ if (!navigationProperty.isNullable()) {
writer.writeAttribute(XML_NULLABLE, "" + navigationProperty.isNullable());
}
@@ -537,11 +542,11 @@
writer.writeAttribute(XML_TYPE, fqnString);
// Facets
- if (property.isNullable() == false) {
+ if (!property.isNullable()) {
writer.writeAttribute(XML_NULLABLE, "" + property.isNullable());
}
- if (property.isUnicode() == false) {
+ if (!property.isUnicode()) {
writer.writeAttribute(XML_UNICODE, "" + property.isUnicode());
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
new file mode 100644
index 0000000..f998fe7
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java
@@ -0,0 +1,1114 @@
+/*
+ * 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.io.IOException;
+import java.io.OutputStream;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.ex.ODataErrorDetail;
+import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Linked;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmStructuredType;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmString;
+import org.apache.olingo.server.api.ODataServerError;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
+import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
+import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
+import org.apache.olingo.server.api.serializer.ReferenceCollectionSerializerOptions;
+import org.apache.olingo.server.api.serializer.ReferenceSerializerOptions;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
+import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
+import org.apache.olingo.server.api.uri.queryoption.SelectOption;
+import org.apache.olingo.server.core.serializer.AbstractODataSerializer;
+import org.apache.olingo.server.core.serializer.SerializerResultImpl;
+import org.apache.olingo.server.core.serializer.utils.CircleStreamBuffer;
+import org.apache.olingo.server.core.serializer.utils.ContextURLBuilder;
+import org.apache.olingo.server.core.serializer.utils.ExpandSelectHelper;
+
+public class ODataXmlSerializer extends AbstractODataSerializer {
+
+ private static final String DATA = "d";
+ private static final String CONTEXT = "context";
+ /** The default character set is UTF-8. */
+ public static final String DEFAULT_CHARSET = "UTF-8";
+ private static final String ATOM = "a";
+ private static final String NS_ATOM = "http://www.w3.org/2005/Atom";
+ private static final String METADATA = "m";
+ private static final String NS_METADATA = "http://docs.oasis-open.org/odata/ns/metadata";
+ private static final String NS_DATA = "http://docs.oasis-open.org/odata/ns/data";
+ private static final String NS_SCHEMA = "http://docs.oasis-open.org/odata/ns/scheme";
+
+ @Override
+ public SerializerResult serviceDocument(final ServiceMetadata metadata, final String serviceRoot)
+ throws SerializerException {
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
+ try {
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream, DEFAULT_CHARSET);
+ ServiceDocumentXmlSerializer serializer = new ServiceDocumentXmlSerializer(metadata, serviceRoot);
+ serializer.writeServiceDocument(writer);
+
+ writer.flush();
+ writer.close();
+ outputStream.close();
+
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
+ } catch (final XMLStreamException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } catch (IOException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
+ }
+ }
+
+ @Override
+ public SerializerResult metadataDocument(final ServiceMetadata serviceMetadata) throws SerializerException {
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
+ try {
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream, DEFAULT_CHARSET);
+ MetadataDocumentXmlSerializer serializer = new MetadataDocumentXmlSerializer(serviceMetadata);
+ serializer.writeMetadataDocument(writer);
+
+ writer.flush();
+ writer.close();
+ outputStream.close();
+
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
+ } catch (final XMLStreamException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } catch (IOException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
+ }
+ }
+
+ @Override
+ public SerializerResult error(final ODataServerError error) throws SerializerException {
+ if (error == null) {
+ throw new SerializerException("ODataError object MUST NOT be null!",
+ SerializerException.MessageKeys.NULL_INPUT);
+ }
+
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
+ try {
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream, DEFAULT_CHARSET);
+ writer.writeStartDocument(ODataSerializer.DEFAULT_CHARSET, "1.0");
+
+ writer.writeStartElement("error");
+ writer.writeDefaultNamespace(NS_METADATA);
+ writeErrorDetails(String.valueOf(error.getStatusCode()), error.getMessage(), error.getTarget(), writer);
+ if (error.getDetails() != null && !error.getDetails().isEmpty()) {
+ writer.writeStartElement("details");
+ for (ODataErrorDetail inner : error.getDetails()) {
+ writeErrorDetails(inner.getCode(), inner.getMessage(), inner.getTarget(), writer);
+ }
+ writer.writeEndElement();
+ }
+ writer.writeEndElement();
+ writer.writeEndDocument();
+
+ writer.flush();
+ writer.close();
+ outputStream.close();
+
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
+ } catch (final XMLStreamException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } catch (IOException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
+ }
+ }
+
+ private void writeErrorDetails(String code, String message, String target, XMLStreamWriter writer)
+ throws XMLStreamException {
+ if (code != null) {
+ writer.writeStartElement("code");
+ writer.writeCharacters(String.valueOf(code));
+ writer.writeEndElement();
+ }
+
+ writer.writeStartElement("message");
+ writer.writeCharacters(message);
+ writer.writeEndElement();
+
+ if (target != null) {
+ writer.writeStartElement("target");
+ writer.writeCharacters(target);
+ writer.writeEndElement();
+ }
+ }
+
+ @Override
+ public SerializerResult entityCollection(final ServiceMetadata metadata,
+ final EdmEntityType entityType, final EntityCollection entitySet,
+ final EntityCollectionSerializerOptions options) throws SerializerException {
+
+ final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
+ if (options != null && options.onlyReferences()) {
+ ReferenceCollectionSerializerOptions rso = ReferenceCollectionSerializerOptions.with()
+ .contextURL(contextURL).build();
+ return entityReferenceCollection(metadata, entityType, entitySet, rso);
+ }
+
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
+ try {
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream, DEFAULT_CHARSET);
+ writer.writeStartDocument(ODataSerializer.DEFAULT_CHARSET, "1.0");
+ writer.writeStartElement(ATOM, "feed", NS_ATOM);
+ writer.writeNamespace(ATOM, NS_ATOM);
+ writer.writeNamespace(METADATA, NS_METADATA);
+ writer.writeNamespace(DATA, NS_DATA);
+
+ writer.writeAttribute(METADATA, NS_METADATA, "context",
+ ContextURLBuilder.create(contextURL).toASCIIString());
+ writeMetadataETag(metadata, writer);
+
+ if (options != null) {
+ writer.writeStartElement(ATOM, "id", NS_ATOM);
+ writer.writeCharacters(options.getId());
+ writer.writeEndElement();
+ }
+
+ if (options != null && options.getCount() != null && options.getCount().getValue()
+ && entitySet.getCount() != null) {
+ writeCount(entitySet, writer);
+ }
+ if (entitySet.getNext() != null) {
+ writeNextLink(entitySet, writer);
+ }
+
+ if (options == null) {
+ writeEntitySet(metadata, entityType, entitySet, null, null, false, writer);
+ } else {
+ writeEntitySet(metadata, entityType, entitySet,
+ options.getExpand(), options.getSelect(), options.onlyReferences(), writer);
+ }
+
+ writer.writeEndElement();
+ writer.writeEndDocument();
+
+ writer.flush();
+ writer.close();
+ outputStream.close();
+
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
+ } catch (final XMLStreamException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } catch (IOException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
+ }
+ }
+
+ @Override
+ public SerializerResult entity(final ServiceMetadata metadata, final EdmEntityType entityType,
+ final Entity entity, final EntitySerializerOptions options) throws SerializerException {
+ final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
+
+ if (options != null && options.onlyReferences()) {
+ ReferenceSerializerOptions rso = ReferenceSerializerOptions.with()
+ .contextURL(contextURL).build();
+ return entityReference(metadata, entityType, entity, rso);
+ }
+
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
+ try {
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream, DEFAULT_CHARSET);
+ writer.writeStartDocument(ODataSerializer.DEFAULT_CHARSET, "1.0");
+ writeEntity(metadata, entityType, entity, contextURL,
+ options == null ? null : options.getExpand(),
+ options == null ? null : options.getSelect(),
+ options == null ? false : options.onlyReferences(), writer, true);
+ writer.writeEndDocument();
+
+ writer.flush();
+ writer.close();
+ outputStream.close();
+
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
+ } catch (final XMLStreamException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } catch (IOException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
+ }
+ }
+
+ private ContextURL checkContextURL(final ContextURL contextURL) throws SerializerException {
+ if (contextURL == null) {
+ throw new SerializerException("ContextURL null!", SerializerException.MessageKeys.NO_CONTEXT_URL);
+ }
+ return contextURL;
+ }
+
+ private void writeMetadataETag(final ServiceMetadata metadata, XMLStreamWriter writer)
+ throws XMLStreamException {
+ if (metadata != null
+ && metadata.getServiceMetadataETagSupport() != null
+ && metadata.getServiceMetadataETagSupport().getMetadataETag() != null) {
+ writer.writeAttribute(METADATA, NS_METADATA, "metadata-etag",
+ metadata.getServiceMetadataETagSupport().getMetadataETag());
+ }
+ }
+
+ protected void writeEntitySet(final ServiceMetadata metadata, final EdmEntityType entityType,
+ final EntityCollection entitySet, final ExpandOption expand, final SelectOption select,
+ final boolean onlyReference, final XMLStreamWriter writer) throws XMLStreamException,
+ SerializerException {
+ for (final Entity entity : entitySet.getEntities()) {
+ writeEntity(metadata, entityType, entity, null, expand, select, false, writer, false);
+ }
+ }
+
+ protected void writeEntity(final ServiceMetadata metadata, final EdmEntityType entityType,
+ final Entity entity, final ContextURL contextURL, final ExpandOption expand,
+ final SelectOption select, final boolean onlyReference, final XMLStreamWriter writer,
+ final boolean top) throws XMLStreamException, SerializerException {
+
+ writer.writeStartElement(ATOM, "entry", NS_ATOM);
+ if (top) {
+ writer.writeNamespace(ATOM, NS_ATOM);
+ writer.writeNamespace(METADATA, NS_METADATA);
+ writer.writeNamespace(DATA, NS_DATA);
+
+ if (contextURL != null) { // top-level entity
+ writer.writeAttribute(METADATA, NS_METADATA, CONTEXT,
+ ContextURLBuilder.create(contextURL).toASCIIString());
+ writeMetadataETag(metadata, writer);
+
+ }
+ }
+ if (entity.getETag() != null) {
+ writer.writeAttribute(METADATA, NS_METADATA, "etag", entity.getETag());
+ }
+
+ writer.writeStartElement(NS_ATOM, "id");
+ writer.writeCharacters(entity.getId().toASCIIString());
+ writer.writeEndElement();
+
+ writerAuthorInfo(entity.getTitle(), writer);
+
+ writer.writeStartElement(NS_ATOM, "link");
+ writer.writeAttribute("rel", "edit");
+ writer.writeAttribute("href", entity.getId().toASCIIString());
+ writer.writeEndElement();
+
+ if (entityType.hasStream()) {
+ writer.writeStartElement(NS_ATOM, "content");
+ writer.writeAttribute("type", entity.getMediaContentType());
+ if (entity.getMediaContentSource() != null) {
+ writer.writeAttribute("src", entity.getMediaContentSource().toString());
+ } else {
+ String id = entity.getId().toASCIIString();
+ if (id.endsWith("/")) {
+ writer.writeAttribute("src", id + "$value");
+ } else {
+ writer.writeAttribute("src", id + "/$value");
+ }
+ }
+ writer.writeEndElement();
+ }
+
+ // write media links
+ for (Link link : entity.getMediaEditLinks()) {
+ writeLink(writer, link);
+ }
+
+ EdmEntityType resolvedType = resolveEntityType(metadata, entityType, entity.getType());
+ writeNavigationProperties(metadata, resolvedType, entity, expand, writer);
+
+ writer.writeStartElement(ATOM, "category", NS_ATOM);
+ writer.writeAttribute("scheme", NS_SCHEMA);
+ writer.writeAttribute("term", "#" + resolvedType.getFullQualifiedName().getFullQualifiedNameAsString());
+ writer.writeEndElement();
+
+ // In the case media, content is sibiling
+ if (!entityType.hasStream()) {
+ writer.writeStartElement(NS_ATOM, "content");
+ writer.writeAttribute("type", "application/xml");
+ }
+
+ writer.writeStartElement(METADATA, "properties", NS_METADATA);
+ writeProperties(metadata, resolvedType, entity.getProperties(), select, writer);
+ writer.writeEndElement(); // properties
+
+ if (!entityType.hasStream()) { // content
+ writer.writeEndElement();
+ }
+ writer.writeEndElement(); // entry
+ }
+
+ private void writerAuthorInfo(final String title, final XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeStartElement(NS_ATOM, "title");
+ if (title != null) {
+ writer.writeCharacters(title);
+ }
+ writer.writeEndElement();
+ writer.writeStartElement(NS_ATOM, "summary");
+ writer.writeEndElement();
+
+ writer.writeStartElement(NS_ATOM, "updated");
+ writer.writeCharacters(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(System.currentTimeMillis())));
+ writer.writeEndElement();
+
+ writer.writeStartElement(NS_ATOM, "author");
+ writer.writeStartElement(NS_ATOM, "name");
+ writer.writeEndElement();
+ writer.writeEndElement();
+ }
+
+ protected EdmEntityType resolveEntityType(final ServiceMetadata metadata, final EdmEntityType baseType,
+ final String derivedTypeName) throws SerializerException {
+ if (derivedTypeName == null ||
+ baseType.getFullQualifiedName().getFullQualifiedNameAsString().equals(derivedTypeName)) {
+ return baseType;
+ }
+ EdmEntityType derivedType = metadata.getEdm().getEntityType(new FullQualifiedName(derivedTypeName));
+ if (derivedType == null) {
+ throw new SerializerException("EntityType not found",
+ SerializerException.MessageKeys.UNKNOWN_TYPE, derivedTypeName);
+ }
+ EdmEntityType type = derivedType.getBaseType();
+ while (type != null) {
+ if (type.getFullQualifiedName().getFullQualifiedNameAsString()
+ .equals(baseType.getFullQualifiedName().getFullQualifiedNameAsString())) {
+ return derivedType;
+ }
+ type = type.getBaseType();
+ }
+ throw new SerializerException("Wrong base type",
+ SerializerException.MessageKeys.WRONG_BASE_TYPE, derivedTypeName, baseType
+ .getFullQualifiedName().getFullQualifiedNameAsString());
+ }
+
+ protected EdmComplexType resolveComplexType(final ServiceMetadata metadata, final EdmComplexType baseType,
+ final String derivedTypeName) throws SerializerException {
+ if (derivedTypeName == null ||
+ baseType.getFullQualifiedName().getFullQualifiedNameAsString().equals(derivedTypeName)) {
+ return baseType;
+ }
+ EdmComplexType derivedType = metadata.getEdm().getComplexType(new FullQualifiedName(derivedTypeName));
+ if (derivedType == null) {
+ throw new SerializerException("Complex Type not found",
+ SerializerException.MessageKeys.UNKNOWN_TYPE, derivedTypeName);
+ }
+ EdmComplexType type = derivedType.getBaseType();
+ while (type != null) {
+ if (type.getFullQualifiedName().getFullQualifiedNameAsString()
+ .equals(baseType.getFullQualifiedName().getFullQualifiedNameAsString())) {
+ return derivedType;
+ }
+ type = type.getBaseType();
+ }
+ throw new SerializerException("Wrong base type",
+ SerializerException.MessageKeys.WRONG_BASE_TYPE, derivedTypeName, baseType
+ .getFullQualifiedName().getFullQualifiedNameAsString());
+ }
+
+ protected void writeProperties(final ServiceMetadata metadata, final EdmStructuredType type,
+ final List<Property> properties, final SelectOption select, final XMLStreamWriter writer)
+ throws XMLStreamException, SerializerException {
+ final boolean all = ExpandSelectHelper.isAll(select);
+ final Set<String> selected = all ? new HashSet<String>() :
+ ExpandSelectHelper.getSelectedPropertyNames(select.getSelectItems());
+ for (final String propertyName : type.getPropertyNames()) {
+ if (all || selected.contains(propertyName)) {
+ final EdmProperty edmProperty = type.getStructuralProperty(propertyName);
+ final Property property = findProperty(propertyName, properties);
+ final Set<List<String>> selectedPaths = all || edmProperty.isPrimitive() ? null :
+ ExpandSelectHelper.getSelectedPaths(select.getSelectItems(), propertyName);
+ writeProperty(metadata, edmProperty, property, selectedPaths, writer);
+ }
+ }
+ }
+
+ protected void writeNavigationProperties(final ServiceMetadata metadata,
+ final EdmStructuredType type, final Linked linked, final ExpandOption expand,
+ final XMLStreamWriter writer) throws SerializerException, XMLStreamException {
+ if (ExpandSelectHelper.hasExpand(expand)) {
+ final boolean expandAll = ExpandSelectHelper.isExpandAll(expand);
+ final Set<String> expanded = expandAll ? new HashSet<String>() :
+ ExpandSelectHelper.getExpandedPropertyNames(expand.getExpandItems());
+ for (final String propertyName : type.getNavigationPropertyNames()) {
+ final EdmNavigationProperty property = type.getNavigationProperty(propertyName);
+ final Link navigationLink = getOrCreateLink(linked, propertyName);
+ if (expandAll || expanded.contains(propertyName)) {
+ final ExpandItem innerOptions = expandAll ? null :
+ ExpandSelectHelper.getExpandItem(expand.getExpandItems(), propertyName);
+ if (innerOptions != null && innerOptions.getLevelsOption() != null) {
+ throw new SerializerException("Expand option $levels is not supported.",
+ SerializerException.MessageKeys.NOT_IMPLEMENTED);
+ }
+ if (navigationLink != null) {
+ writeLink(writer, navigationLink, false);
+ writer.writeStartElement(METADATA, "inline", NS_METADATA);
+ writeExpandedNavigationProperty(metadata, property, navigationLink,
+ innerOptions == null ? null : innerOptions.getExpandOption(),
+ innerOptions == null ? null : innerOptions.getSelectOption(),
+ innerOptions == null ? false : innerOptions.isRef(),
+ writer);
+ writer.writeEndElement();
+ writer.writeEndElement();
+ }
+ } else {
+ writeLink(writer, getOrCreateLink(linked, propertyName));
+ }
+ }
+ } else {
+ for (final String propertyName : type.getNavigationPropertyNames()) {
+ writeLink(writer, getOrCreateLink(linked, propertyName));
+ }
+ }
+ for (Link link : linked.getAssociationLinks()) {
+ writeLink(writer, link);
+ }
+ }
+
+ protected Link getOrCreateLink(final Linked linked, final String navigationPropertyName)
+ throws XMLStreamException {
+ Link link = linked.getNavigationLink(navigationPropertyName);
+ if (link == null) {
+ link = new Link();
+ link.setRel("http://docs.oasis-open.org/odata/ns/related/" + navigationPropertyName);
+ link.setType(Constants.ENTITY_SET_NAVIGATION_LINK_TYPE);
+ link.setTitle(navigationPropertyName);
+ EntityCollection target = new EntityCollection();
+ link.setInlineEntitySet(target);
+ link.setHref(linked.getId().toASCIIString() + "/" + navigationPropertyName);
+ }
+ return link;
+ }
+
+ private void writeLink(final XMLStreamWriter writer, final Link link) throws XMLStreamException {
+ writeLink(writer, link, true);
+ }
+
+ private void writeLink(final XMLStreamWriter writer, final Link link, final boolean close)
+ throws XMLStreamException {
+ writer.writeStartElement(ATOM, "link", NS_ATOM);
+ writer.writeAttribute("rel", link.getRel());
+ if (link.getType() != null) {
+ writer.writeAttribute("type", link.getType());
+ }
+ if (link.getTitle() != null) {
+ writer.writeAttribute("title", link.getTitle());
+ }
+ writer.writeAttribute("href", link.getHref());
+ if (close) {
+ writer.writeEndElement();
+ }
+ }
+
+ protected void writeExpandedNavigationProperty(final ServiceMetadata metadata,
+ final EdmNavigationProperty property, final Link navigationLink,
+ final ExpandOption innerExpand, final SelectOption innerSelect, boolean onlyReference,
+ final XMLStreamWriter writer)
+ throws XMLStreamException, SerializerException {
+ if (property.isCollection()) {
+ if (navigationLink == null || navigationLink.getInlineEntitySet() == null) {
+ // nothing to write.
+ } else {
+ writer.writeStartElement(ATOM, "feed", NS_ATOM);
+ writeEntitySet(metadata, property.getType(), navigationLink.getInlineEntitySet(), innerExpand,
+ innerSelect, onlyReference, writer);
+ writer.writeEndElement();
+ }
+ } else {
+ if (navigationLink == null || navigationLink.getInlineEntity() == null) {
+ // nothing to write
+ } else {
+ writeEntity(metadata, property.getType(), navigationLink.getInlineEntity(), null,
+ innerExpand, innerSelect, onlyReference, writer, false);
+ }
+ }
+ }
+
+ protected void writeProperty(final ServiceMetadata metadata, final EdmProperty edmProperty,
+ final Property property,
+ final Set<List<String>> selectedPaths, final XMLStreamWriter writer) throws XMLStreamException,
+ SerializerException {
+ writer.writeStartElement(DATA, edmProperty.getName(), NS_DATA);
+ if (property == null || property.isNull()) {
+ if (edmProperty.isNullable() == Boolean.FALSE) {
+ throw new SerializerException("Non-nullable property not present!",
+ SerializerException.MessageKeys.MISSING_PROPERTY, edmProperty.getName());
+ } else {
+ writer.writeAttribute(METADATA, NS_METADATA, "null", "true");
+ }
+ } else {
+ writePropertyValue(metadata, edmProperty, property, selectedPaths, writer);
+ }
+ writer.writeEndElement();
+ }
+
+ private String collectionType(EdmType type) {
+ return "#Collection(" + type.getFullQualifiedName().getFullQualifiedNameAsString() + ")";
+ }
+
+ private String complexType(ServiceMetadata metadata, EdmComplexType baseType, String definedType)
+ throws SerializerException {
+ EdmComplexType type = resolveComplexType(metadata, baseType, definedType);
+ return type.getFullQualifiedName().getFullQualifiedNameAsString();
+ }
+
+ private String derivedComplexType(ServiceMetadata metadata, EdmComplexType baseType, String definedType)
+ throws SerializerException {
+ String derived = baseType.getFullQualifiedName().getFullQualifiedNameAsString();
+ if (derived.equals(definedType)) {
+ return null;
+ }
+ return definedType;
+ }
+
+ private void writePropertyValue(final ServiceMetadata metadata, final EdmProperty edmProperty,
+ final Property property, final Set<List<String>> selectedPaths,
+ final XMLStreamWriter writer) throws XMLStreamException, SerializerException {
+ try {
+ if (edmProperty.isPrimitive()) {
+ if (edmProperty.isCollection()) {
+ writer.writeAttribute(METADATA, NS_METADATA, "type", "#Collection(" + edmProperty.getType().getName() + ")");
+ writePrimitiveCollection((EdmPrimitiveType) edmProperty.getType(), property,
+ edmProperty.isNullable(), edmProperty.getMaxLength(),
+ edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode(),
+ writer);
+ } else {
+ writePrimitive((EdmPrimitiveType) edmProperty.getType(), property,
+ edmProperty.isNullable(), edmProperty.getMaxLength(),
+ edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode(),
+ writer);
+ }
+ } else if (edmProperty.isCollection()) {
+ writer.writeAttribute(METADATA, NS_METADATA, "type", collectionType(edmProperty.getType()));
+ writeComplexCollection(metadata, (EdmComplexType) edmProperty.getType(), property, selectedPaths, writer);
+ } else if (property.isComplex()) {
+ writer.writeAttribute(METADATA, NS_METADATA, "type",
+ "#" + complexType(metadata, (EdmComplexType) edmProperty.getType(), property.getType()));
+ writeComplexValue(metadata, (EdmComplexType) edmProperty.getType(), property.asComplex().getValue(),
+ selectedPaths, writer);
+ } else if (property.isEnum()) {
+ writePrimitive((EdmPrimitiveType) edmProperty.getType(), property,
+ edmProperty.isNullable(), edmProperty.getMaxLength(),
+ edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode(),
+ writer);
+ } else {
+ throw new SerializerException("Property type not yet supported!",
+ SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, edmProperty.getName());
+ }
+ } catch (final EdmPrimitiveTypeException e) {
+ throw new SerializerException("Wrong value for property!", e,
+ SerializerException.MessageKeys.WRONG_PROPERTY_VALUE,
+ edmProperty.getName(), property.getValue().toString());
+ }
+ }
+
+ private void writePrimitiveCollection(final EdmPrimitiveType type, final Property property,
+ final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale,
+ final Boolean isUnicode,
+ final XMLStreamWriter writer) throws XMLStreamException, EdmPrimitiveTypeException, SerializerException {
+ for (Object value : property.asCollection()) {
+ writer.writeStartElement(METADATA, "element", NS_METADATA);
+ switch (property.getValueType()) {
+ case COLLECTION_PRIMITIVE:
+ case COLLECTION_ENUM:
+ writePrimitiveValue(type, value, isNullable, maxLength, precision, scale, isUnicode, writer);
+ break;
+ case COLLECTION_GEOSPATIAL:
+ throw new SerializerException("Property type not yet supported!",
+ SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, property.getName());
+ default:
+ throw new SerializerException("Property type not yet supported!",
+ SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, property.getName());
+ }
+ writer.writeEndElement();
+ }
+ }
+
+ private void writeComplexCollection(final ServiceMetadata metadata, final EdmComplexType type,
+ final Property property, final Set<List<String>> selectedPaths, final XMLStreamWriter writer)
+ throws XMLStreamException, SerializerException {
+ for (Object value : property.asCollection()) {
+ writer.writeStartElement(METADATA, "element", NS_METADATA);
+ if (derivedComplexType(metadata, type, property.getType()) != null) {
+ writer.writeAttribute(METADATA, NS_METADATA, "type", property.getType());
+ }
+ switch (property.getValueType()) {
+ case COLLECTION_COMPLEX:
+ writeComplexValue(metadata, type, ((ComplexValue) value).getValue(), selectedPaths, writer);
+ break;
+ default:
+ throw new SerializerException("Property type not yet supported!",
+ SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, property.getName());
+ }
+ writer.writeEndElement();
+ }
+ }
+
+ private void writePrimitive(final EdmPrimitiveType type, final Property property,
+ final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale,
+ final Boolean isUnicode, final XMLStreamWriter writer)
+ throws EdmPrimitiveTypeException, XMLStreamException, SerializerException {
+ if (property.isPrimitive()) {
+ if (!(type instanceof EdmString)) {
+ writer.writeAttribute(METADATA, NS_METADATA, "type", type.getName());
+ }
+ writePrimitiveValue(type, property.asPrimitive(),
+ isNullable, maxLength, precision, scale, isUnicode, writer);
+ } else if (property.isGeospatial()) {
+ throw new SerializerException("Property type not yet supported!",
+ SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, property.getName());
+ } else if (property.isEnum()) {
+ writer.writeAttribute(METADATA, NS_METADATA, "type", "#" + type.getName());
+ writePrimitiveValue(type, property.asEnum(),
+ isNullable, maxLength, precision, scale, isUnicode, writer);
+ } else {
+ throw new SerializerException("Inconsistent property type!",
+ SerializerException.MessageKeys.INCONSISTENT_PROPERTY_TYPE, property.getName());
+ }
+ }
+
+ protected void writePrimitiveValue(final EdmPrimitiveType type, final Object primitiveValue,
+ final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale,
+ final Boolean isUnicode,
+ final XMLStreamWriter writer) throws EdmPrimitiveTypeException, XMLStreamException {
+ final String value = type.valueToString(primitiveValue,
+ isNullable, maxLength, precision, scale, isUnicode);
+ if (value == null) {
+ writer.writeAttribute(DATA, NS_DATA, "null", "true");
+ } else if (type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean)) {
+ writer.writeCharacters(value);
+ } else if (type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte)
+ || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal)
+ || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double)
+ || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16)
+ || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32)
+ || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64)
+ || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte)
+ || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single)) {
+ writer.writeCharacters(value);
+ } else {
+ writer.writeCharacters(value);
+ }
+ }
+
+ protected void writeComplexValue(final ServiceMetadata metadata, final EdmComplexType type,
+ final List<Property> properties, final Set<List<String>> selectedPaths, final XMLStreamWriter writer)
+ throws XMLStreamException, SerializerException {
+ for (final String propertyName : type.getPropertyNames()) {
+ final Property property = findProperty(propertyName, properties);
+ if (selectedPaths == null || ExpandSelectHelper.isSelected(selectedPaths, propertyName)) {
+ writeProperty(metadata, (EdmProperty) type.getProperty(propertyName), property,
+ selectedPaths == null ? null : ExpandSelectHelper.getReducedSelectedPaths(selectedPaths, propertyName),
+ writer);
+ }
+ }
+ }
+
+ private Property findProperty(final String propertyName, final List<Property> properties) {
+ for (final Property property : properties) {
+ if (propertyName.equals(property.getName())) {
+ return property;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public SerializerResult primitive(final ServiceMetadata metadata, final EdmPrimitiveType type,
+ final Property property, final PrimitiveSerializerOptions options) throws SerializerException {
+ final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
+
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
+ try {
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream, DEFAULT_CHARSET);
+
+ writer.writeStartDocument(ODataSerializer.DEFAULT_CHARSET, "1.0");
+ writer.writeStartElement(METADATA, "value", NS_METADATA);
+ writer.writeNamespace(METADATA, NS_METADATA);
+ if (contextURL != null) {
+ writer.writeAttribute(METADATA, NS_METADATA, CONTEXT,
+ ContextURLBuilder.create(contextURL).toASCIIString());
+ }
+ writeMetadataETag(metadata, writer);
+ if (property.isNull()) {
+ writer.writeAttribute(METADATA, NS_METADATA, "null", "true");
+ } else {
+ writePrimitive(type, property,
+ options == null ? null : options.isNullable(),
+ options == null ? null : options.getMaxLength(),
+ options == null ? null : options.getPrecision(),
+ options == null ? null : options.getScale(),
+ options == null ? null : options.isUnicode(),
+ writer);
+ }
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.flush();
+ writer.close();
+ outputStream.close();
+
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
+ } catch (final XMLStreamException e) {
+ cachedException = new SerializerException(IO_EXCEPTION_TEXT, e,
+ SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } catch (final EdmPrimitiveTypeException e) {
+ cachedException = new SerializerException("Wrong value for property!", e,
+ SerializerException.MessageKeys.WRONG_PROPERTY_VALUE,
+ property.getName(), property.getValue().toString());
+ throw cachedException;
+ } catch (IOException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
+ }
+ }
+
+ @Override
+ public SerializerResult complex(final ServiceMetadata metadata, final EdmComplexType type,
+ final Property property, final ComplexSerializerOptions options) throws SerializerException {
+ final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
+
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
+ try {
+ EdmComplexType resolvedType = resolveComplexType(metadata, type, property.getType());
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream, DEFAULT_CHARSET);
+ writer.writeStartDocument(ODataSerializer.DEFAULT_CHARSET, "1.0");
+ writer.writeStartElement(METADATA, "value", NS_METADATA);
+ writer.writeNamespace(METADATA, NS_METADATA);
+ writer.writeNamespace(DATA, NS_DATA);
+ writer.writeAttribute(METADATA, NS_METADATA, "type", "#"
+ + resolvedType.getFullQualifiedName().getFullQualifiedNameAsString());
+ writer.writeAttribute(METADATA, NS_METADATA, CONTEXT,
+ ContextURLBuilder.create(contextURL).toASCIIString());
+ writeMetadataETag(metadata, writer);
+ if (property.isNull()) {
+ writer.writeAttribute(METADATA, NS_METADATA, "null", "true");
+ } else {
+ final List<Property> values = property.asComplex().getValue();
+ writeProperties(metadata, resolvedType, values, options == null ? null : options.getSelect(), writer);
+ }
+ writer.writeEndDocument();
+ writer.flush();
+ writer.close();
+ outputStream.close();
+
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
+ } catch (final XMLStreamException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } catch (IOException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
+ }
+ }
+
+ @Override
+ public SerializerResult primitiveCollection(final ServiceMetadata metadata, final EdmPrimitiveType type,
+ final Property property, final PrimitiveSerializerOptions options) throws SerializerException {
+ final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
+
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
+ try {
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream, DEFAULT_CHARSET);
+
+ writer.writeStartDocument(ODataSerializer.DEFAULT_CHARSET, "1.0");
+ writer.writeStartElement(METADATA, "value", NS_METADATA);
+ writer.writeNamespace(METADATA, NS_METADATA);
+ if (contextURL != null) {
+ writer.writeAttribute(METADATA, NS_METADATA, CONTEXT,
+ ContextURLBuilder.create(contextURL).toASCIIString());
+ }
+ writeMetadataETag(metadata, writer);
+ writer.writeAttribute(METADATA, NS_METADATA, "type", "#Collection(" + type.getName() + ")");
+ writePrimitiveCollection(type, property,
+ options == null ? null : options.isNullable(),
+ options == null ? null : options.getMaxLength(),
+ options == null ? null : options.getPrecision(),
+ options == null ? null : options.getScale(),
+ options == null ? null : options.isUnicode(),
+ writer);
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.flush();
+ writer.close();
+ outputStream.close();
+
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
+ } catch (final XMLStreamException e) {
+ cachedException = new SerializerException(IO_EXCEPTION_TEXT, e,
+ SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } catch (final EdmPrimitiveTypeException e) {
+ cachedException = new SerializerException("Wrong value for property!", e,
+ SerializerException.MessageKeys.WRONG_PROPERTY_VALUE,
+ property.getName(), property.getValue().toString());
+ throw cachedException;
+ } catch (IOException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
+ }
+ }
+
+ @Override
+ public SerializerResult complexCollection(final ServiceMetadata metadata, final EdmComplexType type,
+ final Property property, final ComplexSerializerOptions options) throws SerializerException {
+ final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
+
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
+ try {
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream, DEFAULT_CHARSET);
+
+ writer.writeStartElement(METADATA, "value", NS_METADATA);
+ writer.writeNamespace(METADATA, NS_METADATA);
+ writer.writeNamespace(DATA, NS_DATA);
+ writer.writeAttribute(METADATA, NS_METADATA, "type", collectionType(type));
+ writer.writeAttribute(METADATA, NS_METADATA, CONTEXT,
+ ContextURLBuilder.create(contextURL).toASCIIString());
+ writeMetadataETag(metadata, writer);
+ writeComplexCollection(metadata, type, property, null, writer);
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.flush();
+ writer.close();
+ outputStream.close();
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
+ } catch (final XMLStreamException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } catch (IOException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
+ }
+ }
+
+ @Override
+ public SerializerResult reference(final ServiceMetadata metadata, final EdmEntitySet edmEntitySet,
+ final Entity entity, final ReferenceSerializerOptions options) throws SerializerException {
+ return entityReference(metadata, edmEntitySet.getEntityType(), entity, options);
+ }
+
+ protected SerializerResult entityReference(final ServiceMetadata metadata, final EdmEntityType entityType,
+ final Entity entity, ReferenceSerializerOptions options) throws SerializerException {
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
+ try {
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream, DEFAULT_CHARSET);
+ writer.writeStartDocument(ODataSerializer.DEFAULT_CHARSET, "1.0");
+ writeReference(metadata, entityType, entity, options == null ? null : options.getContextURL(), writer, true);
+ writer.writeEndDocument();
+ writer.flush();
+ writer.close();
+ outputStream.close();
+
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
+ } catch (final XMLStreamException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } catch (IOException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
+ }
+ }
+
+ private void writeReference(ServiceMetadata metadata, EdmEntityType entityType,
+ Entity entity, ContextURL contextURL, XMLStreamWriter writer, boolean top) throws XMLStreamException {
+ writer.writeStartElement(METADATA, "ref", NS_METADATA);
+ if (top) {
+ writer.writeNamespace(METADATA, NS_METADATA);
+ if (contextURL != null) { // top-level entity
+ writer.writeAttribute(METADATA, NS_METADATA, CONTEXT,
+ ContextURLBuilder.create(contextURL).toASCIIString());
+ }
+ }
+ writer.writeAttribute("id", entity.getId().toASCIIString());
+ writer.writeEndElement();
+ }
+
+ @Override
+ public SerializerResult referenceCollection(final ServiceMetadata metadata, final EdmEntitySet edmEntitySet,
+ final EntityCollection entityCollection, ReferenceCollectionSerializerOptions options)
+ throws SerializerException {
+ return entityReferenceCollection(metadata, edmEntitySet.getEntityType(), entityCollection, options);
+ }
+
+ protected SerializerResult entityReferenceCollection(final ServiceMetadata metadata,
+ final EdmEntityType entityType, final EntityCollection entitySet,
+ ReferenceCollectionSerializerOptions options) throws SerializerException {
+ OutputStream outputStream = null;
+ SerializerException cachedException = null;
+ try {
+ CircleStreamBuffer buffer = new CircleStreamBuffer();
+ outputStream = buffer.getOutputStream();
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream, DEFAULT_CHARSET);
+ writer.writeStartDocument(ODataSerializer.DEFAULT_CHARSET, "1.0");
+ writer.writeStartElement(ATOM, "feed", NS_ATOM);
+ writer.writeNamespace(ATOM, NS_ATOM);
+ writer.writeNamespace(METADATA, NS_METADATA);
+ if (options != null && options.getContextURL() != null) { // top-level entity
+ writer.writeAttribute(METADATA, NS_METADATA, CONTEXT, ContextURLBuilder.create(options.getContextURL())
+ .toASCIIString());
+ }
+ if (options != null && options.getCount() != null && options.getCount().getValue()
+ && entitySet.getCount() != null) {
+ writeCount(entitySet, writer);
+ }
+ if (entitySet.getNext() != null) {
+ writeNextLink(entitySet, writer);
+ }
+ for (final Entity entity : entitySet.getEntities()) {
+ writeReference(metadata, entityType, entity, options == null ? null : options.getContextURL(), writer, false);
+ }
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.flush();
+ writer.close();
+ outputStream.close();
+
+ return SerializerResultImpl.with().content(buffer.getInputStream()).build();
+ } catch (final XMLStreamException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } catch (IOException e) {
+ cachedException =
+ new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
+ throw cachedException;
+ } finally {
+ closeCircleStreamBufferOutput(outputStream, cachedException);
+ }
+ }
+
+ private void writeCount(final EntityCollection entitySet, XMLStreamWriter writer)
+ throws XMLStreamException {
+ writer.writeStartElement(METADATA, "count", NS_METADATA);
+ writer.writeCharacters(String.valueOf(entitySet.getCount()));
+ writer.writeEndElement();
+ }
+
+ private void writeNextLink(final EntityCollection entitySet, XMLStreamWriter writer)
+ throws XMLStreamException {
+ writer.writeStartElement(ATOM, "link", NS_ATOM);
+ writer.writeAttribute("rel", "next");
+ writer.writeAttribute("href", entitySet.getNext().toASCIIString());
+ writer.writeEndElement();
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerImpl.java
deleted file mode 100644
index e6b04a6..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerImpl.java
+++ /dev/null
@@ -1,153 +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.server.core.serializer.xml;
-
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.server.api.ODataServerError;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
-import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
-import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.serializer.SerializerResult;
-import org.apache.olingo.server.core.serializer.SerializerResultImpl;
-import org.apache.olingo.server.core.serializer.utils.CircleStreamBuffer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ODataXmlSerializerImpl implements ODataSerializer {
-
- /** The default character set is UTF-8. */
- public static final String DEFAULT_CHARSET = "UTF-8";
-
- private static final Logger log = LoggerFactory.getLogger(ODataXmlSerializerImpl.class);
-
- @Override
- public SerializerResultImpl serviceDocument(final ServiceMetadata metadata, final String serviceRoot)
- throws SerializerException {
- throw new SerializerException("Service Document not implemented for XML format",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public SerializerResult metadataDocument(final ServiceMetadata serviceMetadata) throws SerializerException {
- CircleStreamBuffer buffer;
- XMLStreamWriter xmlStreamWriter = null;
-
- try {
- buffer = new CircleStreamBuffer();
- xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(buffer.getOutputStream(), DEFAULT_CHARSET);
- MetadataDocumentXmlSerializer serializer = new MetadataDocumentXmlSerializer(serviceMetadata);
- serializer.writeMetadataDocument(xmlStreamWriter);
- xmlStreamWriter.flush();
- xmlStreamWriter.close();
-
- return SerializerResultImpl.with().content(buffer.getInputStream()).build();
- } catch (final XMLStreamException e) {
- log.error(e.getMessage(), e);
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- } finally {
- if (xmlStreamWriter != null) {
- try {
- xmlStreamWriter.close();
- } catch (XMLStreamException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- }
- }
- }
- }
-
- @Override
- public SerializerResult entity(final ServiceMetadata metadata, final EdmEntityType entityType,
- final Entity entity, final EntitySerializerOptions options) throws SerializerException {
- throw new SerializerException("Entity serialization not implemented for XML format",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public SerializerResult entityCollection(final ServiceMetadata metadata,
- final EdmEntityType entityType, final EntityCollection entitySet,
- final EntityCollectionSerializerOptions options) throws SerializerException {
- throw new SerializerException("Entityset serialization not implemented for XML format",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public SerializerResult error(final ODataServerError error) throws SerializerException {
- throw new SerializerException("error serialization not implemented for XML format",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public SerializerResult primitive(final ServiceMetadata metadata, final EdmPrimitiveType type,
- final Property property, final PrimitiveSerializerOptions options) throws SerializerException {
- throw new SerializerException("Serialization not implemented for XML format.",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public SerializerResult complex(final ServiceMetadata metadata, final EdmComplexType type,
- final Property property, final ComplexSerializerOptions options) throws SerializerException {
- throw new SerializerException("Serialization not implemented for XML format.",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public SerializerResult primitiveCollection(final ServiceMetadata metadata, final EdmPrimitiveType type,
- final Property property, final PrimitiveSerializerOptions options) throws SerializerException {
- throw new SerializerException("Serialization not implemented for XML format.",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public SerializerResult complexCollection(final ServiceMetadata metadata, final EdmComplexType type,
- final Property property, final ComplexSerializerOptions options) throws SerializerException {
- throw new SerializerException("Serialization not implemented for XML format.",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public SerializerResult reference(final ServiceMetadata metadata, final EdmEntitySet edmEntotySet,
- final Entity entity, final ContextURL contextURL) throws SerializerException {
- throw new SerializerException("Serialization not implemented for XML format.",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public SerializerResult referenceCollection(final ServiceMetadata metadata, final EdmEntitySet edmEntitySet,
- final EntityCollection entityCollection, final ContextURL contextURL) throws SerializerException {
- throw new SerializerException("Serialization not implemented for XML format.",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ServiceDocumentXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ServiceDocumentXmlSerializer.java
new file mode 100644
index 0000000..b931227
--- /dev/null
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ServiceDocumentXmlSerializer.java
@@ -0,0 +1,149 @@
+/*
+ * 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 javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.olingo.commons.api.Constants;
+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.ServiceMetadata;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+
+public class ServiceDocumentXmlSerializer {
+ public static final String KIND = "kind";
+
+ public static final String FUNCTION_IMPORT = "FunctionImport";
+ public static final String SINGLETON = "Singleton";
+ public static final String SERVICE_DOCUMENT = "ServiceDocument";
+
+ private static final String APP = "app";
+ private static final String NS_APP = "http://www.w3.org/2007/app";
+ private static final String ATOM = "atom";
+ private static final String NS_ATOM = "http://www.w3.org/2005/Atom";
+ private static final String METADATA = "metadata";
+ private static final String NS_METADATA = "http://docs.oasis-open.org/odata/ns/metadata";
+
+ private final ServiceMetadata metadata;
+ private final String serviceRoot;
+
+ public ServiceDocumentXmlSerializer(final ServiceMetadata metadata, final String serviceRoot)
+ throws SerializerException {
+ if (metadata == null || metadata.getEdm() == null) {
+ throw new SerializerException("Service Metadata and EDM must not be null for a service.",
+ SerializerException.MessageKeys.NULL_METADATA_OR_EDM);
+ }
+ this.metadata = metadata;
+ this.serviceRoot = serviceRoot;
+ }
+
+ public void writeServiceDocument(final XMLStreamWriter writer) throws XMLStreamException {
+ final String metadataUri =
+ (serviceRoot == null ? "" : serviceRoot.endsWith("/") ? serviceRoot : (serviceRoot + "/"))
+ + Constants.METADATA;
+
+ writer.writeStartDocument(ODataSerializer.DEFAULT_CHARSET, "1.0");
+ writer.writeStartElement(APP, "service", NS_APP);
+ writer.writeNamespace(ATOM, NS_ATOM);
+ writer.writeNamespace(APP, NS_APP);
+ writer.writeNamespace(METADATA, NS_METADATA);
+ writer.writeAttribute(METADATA, NS_METADATA, "context", metadataUri);
+
+ if (metadata != null
+ && metadata.getServiceMetadataETagSupport() != null
+ && metadata.getServiceMetadataETagSupport().getMetadataETag() != null) {
+ writer.writeAttribute(METADATA, NS_METADATA, "metadata-etag",
+ metadata.getServiceMetadataETagSupport().getMetadataETag());
+ }
+
+ writer.writeStartElement(APP, "workspace", NS_APP);
+
+ final Edm edm = metadata.getEdm();
+
+ writer.writeStartElement(ATOM, "title", NS_APP);
+ writer.writeCharacters(edm.getEntityContainer(null).getFullQualifiedName().getFullQualifiedNameAsString());
+ writer.writeEndElement();
+
+ writeEntitySets(writer, edm);
+ writeFunctionImports(writer, edm);
+ writeSingletons(writer, edm);
+ writeServiceDocuments(writer);
+ writer.writeEndElement(); // end workspace
+ writer.writeEndElement(); // end service
+ }
+
+ private void writeServiceDocuments(XMLStreamWriter writer) throws XMLStreamException {
+
+ for (EdmxReference reference : this.metadata.getReferences()) {
+ writer.writeStartElement(METADATA, "service-document", NS_METADATA);
+ writer.writeAttribute("href", reference.getUri().toASCIIString());
+ writer.writeStartElement(ATOM, "title", NS_ATOM);
+ writer.writeCharacters(reference.getUri().toASCIIString());
+ writer.writeEndElement();
+ writer.writeEndElement();
+ }
+ }
+
+ private void writeEntitySets(final XMLStreamWriter writer, final Edm edm) throws XMLStreamException {
+ EdmEntityContainer container = edm.getEntityContainer(null);
+ for (EdmEntitySet edmEntitySet : container.getEntitySets()) {
+ if (edmEntitySet.isIncludeInServiceDocument()) {
+ writer.writeStartElement(APP, "collection", NS_APP);
+ writer.writeAttribute("href", edmEntitySet.getName());
+ writer.writeStartElement(ATOM, "title", NS_ATOM);
+ writer.writeCharacters(edmEntitySet.getName());
+ writer.writeEndElement();
+ writer.writeEndElement();
+ }
+ }
+ }
+
+ private void writeFunctionImports(final XMLStreamWriter writer, final Edm edm) throws XMLStreamException {
+ EdmEntityContainer container = edm.getEntityContainer(null);
+
+ for (EdmFunctionImport edmFunctionImport : container.getFunctionImports()) {
+ if (edmFunctionImport.isIncludeInServiceDocument()) {
+ writer.writeStartElement(METADATA, "function-import", NS_METADATA);
+ writer.writeAttribute("href", edmFunctionImport.getName());
+ writer.writeStartElement(ATOM, "title", NS_ATOM);
+ writer.writeCharacters(edmFunctionImport.getName());
+ writer.writeEndElement();
+ writer.writeEndElement();
+ }
+ }
+ }
+
+ private void writeSingletons(final XMLStreamWriter writer, final Edm edm) throws XMLStreamException {
+ EdmEntityContainer container = edm.getEntityContainer(null);
+ for (EdmSingleton edmSingleton : container.getSingletons()) {
+ writer.writeStartElement(METADATA, "singleton", NS_METADATA);
+ writer.writeAttribute("href", edmSingleton.getName());
+ writer.writeStartElement(ATOM, "title", NS_ATOM);
+ writer.writeCharacters(edmSingleton.getName());
+ writer.writeEndElement();
+ writer.writeEndElement();
+ }
+ }
+}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java
index 850a5d2..ae2700d 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java
@@ -85,7 +85,7 @@
edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode()));
result.append(Encoder.encode(value));
} catch (final EdmPrimitiveTypeException e) {
- throw new SerializerException("Wrong key value!",
+ throw new SerializerException("Wrong key value!", e,
SerializerException.MessageKeys.WRONG_PROPERTY_VALUE, edmProperty.getName(), propertyValue.toString());
}
}
@@ -114,7 +114,7 @@
throw new DeserializerException("Invalid entity binding link", MessageKeys.INVALID_ENTITY_BINDING_LINK,
entityId);
} catch (UriParserException e) {
- throw new DeserializerException("Invalid entity binding link", MessageKeys.INVALID_ENTITY_BINDING_LINK,
+ throw new DeserializerException("Invalid entity binding link", e, MessageKeys.INVALID_ENTITY_BINDING_LINK,
entityId);
}
}
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 ae46328..6b42a99 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
@@ -25,7 +25,7 @@
import java.util.List;
import java.util.Map;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.server.api.uri.UriInfo;
import org.apache.olingo.server.api.uri.UriInfoAll;
@@ -65,7 +65,7 @@
private List<CustomQueryOptionImpl> customQueryOptions = new ArrayList<CustomQueryOptionImpl>();
private Map<String, String> aliasToValue = new HashMap<String, String>();
- Map<SystemQueryOptionKind, SystemQueryOption> systemQueryOptions =
+ private Map<SystemQueryOptionKind, SystemQueryOption> systemQueryOptions =
new HashMap<SystemQueryOptionKind, SystemQueryOption>();
private String fragment;
@@ -227,14 +227,14 @@
if (item instanceof SystemQueryOptionImpl) {
setSystemQueryOption((SystemQueryOptionImpl) item);
} else if (item instanceof CustomQueryOptionImpl) {
- addCustomQueryOption(item);
+ addCustomQueryOption((CustomQueryOptionImpl) item);
}
}
return this;
}
- public void addCustomQueryOption(final QueryOptionImpl item) {
- customQueryOptions.add((CustomQueryOptionImpl) item);
+ public void addCustomQueryOption(final CustomQueryOptionImpl item) {
+ customQueryOptions.add(item);
if (item.getName().startsWith("@")) {
aliasToValue.put(item.getName(), item.getText());
}
@@ -249,27 +249,27 @@
*/
public UriInfoImpl setSystemQueryOption(final SystemQueryOption systemOption) {
final SystemQueryOptionKind kind = systemOption.getKind();
+ if (systemQueryOptions.containsKey(kind)) {
+ throw new ODataRuntimeException("Double System Query Option: " + systemOption.getName());
+ }
+
switch (kind) {
- case EXPAND:
- case FILTER:
- case FORMAT:
- case ID:
- case COUNT:
- case ORDERBY:
- case SEARCH:
- case SELECT:
- case SKIP:
- case SKIPTOKEN:
- case TOP:
- case LEVELS:
- if (systemQueryOptions.containsKey(kind)) {
- throw new ODataRuntimeException("Double System Query Option: " + systemOption.getName());
- } else {
+ case EXPAND:
+ case FILTER:
+ case FORMAT:
+ case ID:
+ case COUNT:
+ case ORDERBY:
+ case SEARCH:
+ case SELECT:
+ case SKIP:
+ case SKIPTOKEN:
+ case TOP:
+ case LEVELS:
systemQueryOptions.put(kind, systemOption);
- }
- break;
- default:
- throw new ODataRuntimeException("Unsupported System Query Option: " + systemOption.getName());
+ break;
+ default:
+ throw new ODataRuntimeException("Unsupported System Query Option: " + systemOption.getName());
}
return this;
}
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 a78d79f..008d693 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
@@ -24,7 +24,12 @@
import org.apache.olingo.server.api.uri.UriResourceAction;
import org.apache.olingo.server.api.uri.UriResourceKind;
-public class UriResourceActionImpl extends UriResourceTypedImpl implements UriResourceAction {
+/**
+ * Implementation of the {@link UriResourceAction} interface. This class does not extend
+ * {@link org.apache.olingo.server.core.uri.UriResourceTypedImpl UriResourceTypedImpl}
+ * since that would allow type filters and subsequent path segments.
+ */
+public class UriResourceActionImpl extends UriResourceImpl implements UriResourceAction {
protected EdmAction action;
protected EdmActionImport actionImport;
@@ -69,10 +74,24 @@
}
return null;
}
-
+
@Override
- public String toString() {
+ public String getSegmentValue(final boolean includeFilters){
return actionImport == null ? (action == null ? "" : action.getName()) : actionImport.getName();
}
+ @Override
+ public String getSegmentValue(){
+ return getSegmentValue(false);
+ }
+
+ @Override
+ public String toString(final boolean includeFilters) {
+ return getSegmentValue(includeFilters);
+ }
+
+ @Override
+ public String toString() {
+ return getSegmentValue();
+ }
}
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 f7a8502..63db69c 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
@@ -63,8 +63,13 @@
}
@Override
- public String toString() {
+ public String getSegmentValue(){
return property.getName();
}
+
+ @Override
+ public String toString() {
+ return getSegmentValue();
+ }
}
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 14f43ec..e1859a6 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
@@ -26,10 +26,15 @@
public UriResourceCountImpl() {
super(UriResourceKind.count);
}
+
+ @Override
+ public String getSegmentValue(){
+ return "$count";
+ }
@Override
public String toString() {
- return "$count";
+ return getSegmentValue();
}
}
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 a769ad6..4675964 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
@@ -55,9 +55,15 @@
public boolean isCollection() {
return keyPredicates == null;
}
+
+ @Override
+ public String getSegmentValue(){
+ return edmEntitySet.getName();
+ }
+
@Override
public String toString() {
- return edmEntitySet.getName();
+ return getSegmentValue();
}
}
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 6f23d23..072230e 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
@@ -95,7 +95,7 @@
}
@Override
- public String toString() {
+ public String getSegmentValue(){
if (functionImport != null) {
return functionImport.getName();
} else if (function != null) {
@@ -103,6 +103,11 @@
}
return "";
}
+
+ @Override
+ public String toString() {
+ return getSegmentValue();
+ }
public boolean isParameterListFilled() {
return isParameterListFilled;
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 b28ddf8..fc31910 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
@@ -56,10 +56,15 @@
this.isCollection = isCollection;
return this;
}
+
+ @Override
+ public String getSegmentValue(){
+ return "$it";
+ }
@Override
public String toString() {
- return "$it";
+ return getSegmentValue();
}
}
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 08f0347..b57d12c 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
@@ -68,10 +68,15 @@
this.expression = expression;
return this;
}
+
+ @Override
+ public String getSegmentValue(){
+ return "all";
+ }
@Override
public String toString() {
- return "all";
+ return getSegmentValue();
}
}
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 e66a37c..49be2fe 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
@@ -50,7 +50,7 @@
}
@Override
- public String getLamdaVariable() {
+ public String getLambdaVariable() {
return lambdaVariable;
}
@@ -68,9 +68,14 @@
this.expression = expression;
return this;
}
+
+ @Override
+ public String getSegmentValue(){
+ return "any";
+ }
@Override
public String toString() {
- return "any";
+ return getSegmentValue();
}
}
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 f71fe04..f7fa6fc 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
@@ -64,7 +64,12 @@
}
@Override
- public String toString() {
+ public String getSegmentValue(){
return variableText;
}
+
+ @Override
+ public String toString() {
+ return getSegmentValue();
+ }
}
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 3da7aef..1a4fa44 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
@@ -54,10 +54,15 @@
}
return navigationProperty.isCollection();
}
+
+ @Override
+ public String getSegmentValue(){
+ return navigationProperty.getName();
+ }
@Override
public String toString() {
- return navigationProperty.getName();
+ return getSegmentValue();
}
}
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 d599b9b..d470ef4 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
@@ -50,10 +50,15 @@
public boolean isCollection() {
return property.isCollection();
}
+
+ @Override
+ public String getSegmentValue(){
+ return property.getName();
+ }
@Override
public String toString() {
- return property.getName();
+ return getSegmentValue();
}
}
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 a0cdc3e..0c45f9a 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
@@ -27,10 +27,14 @@
super(UriResourceKind.ref);
}
+ @Override
+ public String getSegmentValue(){
+ return "$ref";
+ }
@Override
public String toString() {
- return "$ref";
+ return getSegmentValue();
}
}
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 0db0a01..5d8737f 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
@@ -53,10 +53,15 @@
this.isCollection = isCollection;
return this;
}
+
+ @Override
+ public String getSegmentValue(){
+ return "$root";
+ }
@Override
public String toString() {
- return "$root";
+ return getSegmentValue();
}
}
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 cc9c606..72289f6 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
@@ -62,10 +62,15 @@
public boolean isCollection() {
return false;
}
+
+ @Override
+ public String getSegmentValue(){
+ return singleton.getName();
+ }
@Override
public String toString() {
- return singleton.getName();
+ return getSegmentValue();
}
}
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 152f44c..24d3713 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
@@ -59,8 +59,13 @@
}
@Override
- public String toString() {
+ public String getSegmentValue(){
return type.getNamespace() + "." + type.getName();
}
+
+ @Override
+ public String toString() {
+ return getSegmentValue();
+ }
}
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 d5f01ea..d6710ad 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
@@ -20,7 +20,6 @@
import org.apache.olingo.commons.api.edm.EdmStructuredType;
import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.server.api.uri.UriResourceKind;
import org.apache.olingo.server.api.uri.UriResourcePartTyped;
@@ -41,20 +40,19 @@
return this;
}
- @Override
- public String toString(final boolean includeFilters) {
+ public String getSegmentValue(final boolean includeFilters) {
if (includeFilters) {
if (typeFilter != null) {
- return toString() + "/" + getFQN(typeFilter).toString();
+ return getSegmentValue() + "/" + typeFilter.getFullQualifiedName().toString();
} else {
- return toString();
+ return getSegmentValue();
}
}
- return toString();
+ return getSegmentValue();
}
- private FullQualifiedName getFQN(final EdmType type) {
- return new FullQualifiedName(type.getNamespace(), type.getName());
+ @Override
+ public String toString(final boolean includeFilters) {
+ return getSegmentValue(includeFilters);
}
-
}
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 7611ecb..73f86c4 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
@@ -29,8 +29,13 @@
}
@Override
- public String toString() {
+ public String getSegmentValue(){
return "$value";
}
+ @Override
+ public String toString() {
+ return getSegmentValue();
+ }
+
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.java
index aef5800..2e7fdb5 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.java
@@ -71,31 +71,36 @@
}
@Override
- public String toString(final boolean includeFilters) {
-
- if (includeFilters == true) {
- String tmp = "";
+ public String getSegmentValue(final boolean includeFilters) {
+ if (includeFilters) {
+ StringBuilder tmp = new StringBuilder();
if (collectionTypeFilter != null) {
- tmp += getFQN(collectionTypeFilter).toString();
+ tmp.append(getFQN(collectionTypeFilter));
}
if (entryTypeFilter != null) {
if (tmp.length() == 0) {
- tmp = getFQN(entryTypeFilter).toString();
+ tmp.append(getFQN(entryTypeFilter));
} else {
- tmp += "/()" + getFQN(entryTypeFilter).toString();
+ tmp.append("/()").append(getFQN(entryTypeFilter));
}
}
+
if (tmp.length() != 0) {
- return toString() + "/" + tmp;
+ return getSegmentValue() + "/" + tmp.toString();
}
}
- return toString();
+ return getSegmentValue();
}
- private FullQualifiedName getFQN(final EdmType type) {
- return new FullQualifiedName(type.getNamespace(), type.getName());
+ @Override
+ public String toString(final boolean includeFilters) {
+ return getSegmentValue(includeFilters);
+ }
+
+ private String getFQN(final EdmType type) {
+ return new FullQualifiedName(type.getNamespace(), type.getName()).getFullQualifiedNameAsString();
}
}
\ No newline at end of file
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
index 6391212..794948e 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
@@ -30,9 +30,8 @@
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.atn.PredictionMode;
import org.antlr.v4.runtime.misc.ParseCancellationException;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.server.api.uri.UriInfo;
import org.apache.olingo.server.api.uri.UriInfoKind;
import org.apache.olingo.server.api.uri.UriResource;
@@ -68,6 +67,9 @@
import org.apache.olingo.server.core.uri.queryoption.TopOptionImpl;
public class Parser {
+ private static final String ATOM = "atom";
+ private static final String JSON = "json";
+ private static final String XML = "xml";
int logLevel = 0;
private enum ParserEntryRules {
@@ -177,9 +179,9 @@
FormatOptionImpl formatOption = new FormatOptionImpl();
formatOption.setName(option.name);
formatOption.setText(option.value);
- if (option.value.equalsIgnoreCase(ODataFormat.JSON.name())
- || option.value.equalsIgnoreCase(ODataFormat.XML.name())
- || option.value.equalsIgnoreCase(ODataFormat.ATOM.name())
+ if (option.value.equalsIgnoreCase(JSON)
+ || option.value.equalsIgnoreCase(XML)
+ || option.value.equalsIgnoreCase(ATOM)
|| isFormatSyntaxValid(option.value)) {
formatOption.setFormat(option.value);
} else {
@@ -209,7 +211,8 @@
systemOption = (OrderByOptionImpl) uriParseTreeVisitor.visitOrderByEOF(ctxOrderByExpression);
} else if (option.name.equals(SystemQueryOptionKind.SEARCH.toString())) {
- throw new RuntimeException("System query option '$search' not implemented!");
+ throw new UriParserSemanticException("System query option '$search' not implemented!",
+ UriParserSemanticException.MessageKeys.NOT_IMPLEMENTED, "System query option '$search");
} else if (option.name.equals(SystemQueryOptionKind.SELECT.toString())) {
SelectEOFContext ctxSelectEOF =
(SelectEOFContext) parseRule(option.value, ParserEntryRules.Select);
@@ -310,6 +313,7 @@
// create parser
if (logLevel > 0) {
+ //TODO: Discuss if we should keep this code
lexer = new UriLexer(new ANTLRInputStream(input));
showTokens(input, lexer.getAllTokens());
}
@@ -463,22 +467,23 @@
boolean first = true;
System.out.println("input: " + input);
String nL = "\n";
- String out = "[" + nL;
+ StringBuilder out = new StringBuilder("[").append(nL);
for (Token token : list) {
if (!first) {
- out += ",";
+ out.append(",");
first = false;
}
int index = token.getType();
+ out.append("\"").append(token.getText()).append("\"").append(" ");
if (index != -1) {
- out += "\"" + token.getText() + "\"" + " " + UriLexer.tokenNames[index] + nL;
+ out.append(UriLexer.VOCABULARY.getDisplayName(index));
} else {
- out += "\"" + token.getText() + "\"" + " " + index + nL;
+ out.append(index);
}
+ out.append(nL);
}
- out += ']';
- System.out.println("tokens: " + out);
- return;
+ out.append(']');
+ System.out.println("tokens: " + out.toString());
}
}
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 07eb1d3..a6b9bff 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
@@ -63,7 +63,19 @@
*/
public ExpandItemImpl contextExpandItemPath;
// CHECKSTYLE:ON (Maven checkstyle)
-
+
+ //CHECKSTYLE:OFF (Maven checkstyle)
+ /**
+ * Set to true in method {@link UriParseTreeVisitor#visitExpandPath} right before
+ * calling {@link org.apache.olingo.server.core.uri.parser.UriParseTreeVisitor#readResourcePathSegment}
+ * After reading the path the variable is set back to false
+ *
+ * readResourcePathSegment handles all navigation properties, it depends on the context if key predicates are allowed or not.
+ * In case of expand
+ */
+ public boolean contextVisitExpandResourcePath;
+ //CHECKSTYLE:ON (Maven checkstyle)
+
// CHECKSTYLE:OFF (Maven checkstyle)
/**
* Set within method
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java
index 5918b6f..4649ac5 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java
@@ -59,15 +59,13 @@
private static List<RawUri.QueryOption> splitOptions(final String queryOptionString) {
if (queryOptionString == null) {
- return Collections.<RawUri.QueryOption> emptyList();
+ return Collections.emptyList();
}
List<RawUri.QueryOption> queryOptionList = new ArrayList<RawUri.QueryOption>();
- for (String option : split(queryOptionString, '&')) {
- if (option.length() != 0) {
- final List<String> pair = splitFirst(option, '=');
- queryOptionList.add(new RawUri.QueryOption(pair.get(0), pair.get(1)));
- }
+ for (String option : splitSkipEmpty(queryOptionString, '&')) {
+ final List<String> pair = splitFirst(option, '=');
+ queryOptionList.add(new RawUri.QueryOption(pair.get(0), pair.get(1)));
}
return queryOptionList;
}
@@ -82,29 +80,38 @@
}
private static List<String> splitPath(final String path, final int skipSegments) {
- List<String> list = split(path, '/');
-
- // Empty path segments of the resource path are removed.
- while (list.remove("")) {
- // this place intentionally left blank
- }
+ List<String> list = splitSkipEmpty(path, '/');
return skipSegments > 0 ? list.subList(skipSegments, list.size()) : list;
}
- public static List<String> split(final String input, final char c) {
+ /**
+ * Split the input string at given character and drop all empty elements.
+ *
+ * @param input string to split
+ * @param c character at which to split
+ * @return list of elements (can be empty)
+ */
+ static List<String> splitSkipEmpty(final String input, final char c) {
+ if(input.isEmpty() || input.length() == 1 && input.charAt(0) == c) {
+ return Collections.emptyList();
+ }
List<String> list = new LinkedList<String>();
int start = 0;
- int end = -1;
+ int end;
while ((end = input.indexOf(c, start)) >= 0) {
- list.add(input.substring(start, end));
+ if(start != end) {
+ list.add(input.substring(start, end));
+ }
start = end + 1;
}
- list.add(input.substring(start));
+ if(input.charAt(input.length()-1) != c) {
+ list.add(input.substring(start));
+ }
return list;
}
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 803b0ad..8c25150 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
@@ -44,9 +44,13 @@
import org.apache.olingo.commons.api.edm.EdmStructuredType;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.server.api.uri.UriInfoKind;
+import org.apache.olingo.server.api.uri.UriInfoResource;
import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.server.api.uri.UriResourceNavigation;
import org.apache.olingo.server.api.uri.UriResourcePartTyped;
import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind;
import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind;
@@ -88,18 +92,23 @@
import org.apache.olingo.server.core.uri.antlr.UriParserParser.AltOrContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.AnyExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.BatchEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.BooleanNonCaseContext;
+import org.apache.olingo.server.core.uri.antlr.UriParserParser.BinaryLiteralContext;
+import org.apache.olingo.server.core.uri.antlr.UriParserParser.BooleanNonCaseLiteralContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.CastExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.CeilingMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.ConcatMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.ConstSegmentContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.ContainsMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.CrossjoinEOFContext;
+import org.apache.olingo.server.core.uri.antlr.UriParserParser.DateLiteralContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.DateMethodCallExprContext;
+import org.apache.olingo.server.core.uri.antlr.UriParserParser.DatetimeoffsetLiteralContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.DayMethodCallExprContext;
+import org.apache.olingo.server.core.uri.antlr.UriParserParser.DecimalLiteralContext;
+import org.apache.olingo.server.core.uri.antlr.UriParserParser.DurationLiteralContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.EndsWithMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.EntityEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.EnumLitContext;
+import org.apache.olingo.server.core.uri.antlr.UriParserParser.EnumLiteralContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandCountOptionContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandItemContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandItemsContext;
@@ -114,9 +123,11 @@
import org.apache.olingo.server.core.uri.antlr.UriParserParser.GeoDistanceMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.GeoIntersectsMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.GeoLengthMethodCallExprContext;
+import org.apache.olingo.server.core.uri.antlr.UriParserParser.GuidLiteralContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.HourMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.IndexOfMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.InlinecountContext;
+import org.apache.olingo.server.core.uri.antlr.UriParserParser.IntLiteralContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.IsofExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.LengthMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.LevelsContext;
@@ -129,9 +140,9 @@
import org.apache.olingo.server.core.uri.antlr.UriParserParser.NameValueOptListContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.NameValuePairContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.NamespaceContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.NaninfinityContext;
+import org.apache.olingo.server.core.uri.antlr.UriParserParser.NaninfinityLiteralContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.NowMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.NullruleContext;
+import org.apache.olingo.server.core.uri.antlr.UriParserParser.NullruleLiteralContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.OdataIdentifierContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.OrderByContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.OrderByEOFContext;
@@ -144,6 +155,7 @@
import org.apache.olingo.server.core.uri.antlr.UriParserParser.QueryOptionsContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.RootExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.RoundMethodCallExprContext;
+import org.apache.olingo.server.core.uri.antlr.UriParserParser.SearchSpecialTokenContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.SecondMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectEOFContext;
@@ -152,8 +164,10 @@
import org.apache.olingo.server.core.uri.antlr.UriParserParser.SkipContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.SkiptokenContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.StartsWithMethodCallExprContext;
+import org.apache.olingo.server.core.uri.antlr.UriParserParser.StringLiteralContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.SubstringMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.TimeMethodCallExprContext;
+import org.apache.olingo.server.core.uri.antlr.UriParserParser.TimeofdayLiteralContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.ToLowerMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.ToUpperMethodCallExprContext;
import org.apache.olingo.server.core.uri.antlr.UriParserParser.TopContext;
@@ -288,8 +302,21 @@
String odi = ctx.vODI.getText();
- if (checkFirst && ctx.vNS == null) {
+ boolean searchInContainer = true;
+ // validate if context type and according property is available
+ // otherwise search in container for first element
+ if (checkFirst && ctx.vNS == null && !context.contextTypes.empty()) {
+ TypeInformation source = context.contextTypes.peek();
+ if (source.type instanceof EdmStructuredType) {
+ EdmStructuredType str = (EdmStructuredType) source.type;
+ EdmElement property = str.getProperty(odi);
+ if (property != null) {
+ searchInContainer = false;
+ }
+ }
+ }
+ if(searchInContainer) {
// check EntitySet
EdmEntitySet edmEntitySet = edmEntityContainer.getEntitySet(odi);
if (edmEntitySet != null) {
@@ -347,13 +374,13 @@
// get function from function import
EdmFunction function = edmFunctionImport.getUnboundFunction(names);
if (function == null) {
- String tmp = "";
+ StringBuilder tmp = new StringBuilder();
for (String name : names) {
- tmp += (tmp.length() != 0 ? "," : "") + name;
+ tmp.append((tmp.length() != 0 ? "," : "")).append(name);
}
throw wrap(new UriParserSemanticException("Function of functionimport '" + edmFunctionImport.getName()
- + "' with parameters [" + tmp + "] not found",
- UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND, edmFunctionImport.getName(), tmp));
+ + "' with parameters [" + tmp.toString() + "] not found",
+ UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND, edmFunctionImport.getName(), tmp.toString()));
}
uriResource.setFunction(edmFunctionImport.getUnboundFunction(names));
@@ -362,8 +389,8 @@
}
}
- TypeInformation source = null;
- UriResource lastResourcePart = context.contextUriInfo.getLastResourcePart();
+ final TypeInformation source;
+ final UriResource lastResourcePart = context.contextUriInfo.getLastResourcePart();
if (lastResourcePart == null) {
if (context.contextTypes.empty()) {
@@ -427,7 +454,7 @@
}
if (property instanceof EdmProperty) {
- if (((EdmProperty) property).isPrimitive() == true) {
+ if (((EdmProperty) property).isPrimitive()) {
// create simple property
UriResourcePrimitivePropertyImpl simpleResource = new UriResourcePrimitivePropertyImpl()
.setProperty((EdmProperty) property);
@@ -442,6 +469,12 @@
}
} else if (property instanceof EdmNavigationProperty) {
// create navigation property
+ if(context.contextVisitExpandResourcePath && ctx.vlNVO.size() > 0) {
+ //if(ctx.getParent() instanceof ExpandPathContext && ctx.vlNVO.size() > 0) {
+ throw wrap(new UriParserSemanticException("Navigation properties in expand system query options must not"
+ + " be followed a an key", UriParserSemanticException.MessageKeys.KEY_NOT_ALLOWED));
+ }
+
UriResourceNavigationPropertyImpl navigationResource = new UriResourceNavigationPropertyImpl()
.setNavigationProperty((EdmNavigationProperty) property);
context.contextUriInfo.addResourcePart(navigationResource);
@@ -485,7 +518,7 @@
if (lastResourcePart instanceof UriResourceWithKeysImpl) {
UriResourceWithKeysImpl lastPartWithKeys = (UriResourceWithKeysImpl) lastResourcePart;
- if (lastPartWithKeys.isCollection() == false) {
+ if (!lastPartWithKeys.isCollection()) {
if (lastPartWithKeys.getTypeFilterOnEntry() != null) {
throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '"
+ getName(filterEntityType) + "' behind '"
@@ -559,7 +592,7 @@
// e.g. in case of function returning complex data or a list of complex data
UriResourceWithKeysImpl lastPartWithKeys = (UriResourceWithKeysImpl) lastResourcePart;
- if (lastPartWithKeys.isCollection() == false) {
+ if (!lastPartWithKeys.isCollection()) {
if (lastPartWithKeys.getTypeFilterOnEntry() != null) {
throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '"
+ getName(filterComplexType) + "' behind '"
@@ -681,6 +714,11 @@
if (!(obj instanceof UriResourcePartTyped)) {
throw wrap(new UriParserSemanticException("all only allowed on typed path segments",
UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS, "all"));
+ } else if(obj instanceof UriResourceNavigation) {
+ if(!((UriResourceNavigation) obj).getKeyPredicates().isEmpty()) {
+ throw wrap(new UriParserSemanticException("Any lamdba expression must not be following navigation properties"
+ + "with key predicates", UriParserSemanticException.MessageKeys.KEY_NOT_ALLOWED));
+ }
}
UriContext.LambdaVariables var = new UriContext.LambdaVariables();
@@ -906,6 +944,11 @@
if (!(lastResourcePart instanceof UriResourcePartTyped)) {
throw wrap(new UriParserSemanticException("any only allowed on typed path segments",
UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS, "any"));
+ } else if(lastResourcePart instanceof UriResourceNavigation) {
+ if(!((UriResourceNavigation) lastResourcePart).getKeyPredicates().isEmpty()) {
+ throw wrap(new UriParserSemanticException("Any lamdba expression must not be following navigation properties"
+ + "with key predicates", UriParserSemanticException.MessageKeys.KEY_NOT_ALLOWED));
+ }
}
UriContext.LambdaVariables var = new UriContext.LambdaVariables();
@@ -922,7 +965,7 @@
}
@Override
- public Object visitBooleanNonCase(final BooleanNonCaseContext ctx) {
+ public Object visitBooleanNonCaseLiteral(final BooleanNonCaseLiteralContext ctx) {
String text = ctx.getText().toLowerCase();
if (text.equals("false")) {
@@ -1116,7 +1159,7 @@
}
@Override
- public Object visitEnumLit(final EnumLitContext ctx) {
+ public Object visitEnumLiteral(final EnumLiteralContext ctx) {
EnumerationImpl enum1 = new EnumerationImpl();
// get type
@@ -1160,13 +1203,25 @@
} else if (ctx.vM != null) {
LevelsOptionImpl levels = new LevelsOptionImpl().setMax();
levels.setText(ctx.vM.getText());
- expandItem.setSystemQueryOption(levels);
+ try {
+ expandItem.setSystemQueryOption(levels);
+ } catch(ODataRuntimeException e) {
+ // Thrown if duplicated system query options are detected
+ throw wrap(new UriParserSyntaxException("Double system query option!", e,
+ UriParserSyntaxException.MessageKeys.DOUBLE_SYSTEM_QUERY_OPTION, e.getMessage()));
+ }
} else if (ctx.vL != null) {
LevelsOptionImpl levels = new LevelsOptionImpl();
String text = ctx.vL.getText();
levels.setText(text);
levels.setValue(Integer.parseInt(text));
- expandItem.setSystemQueryOption(levels);
+ try {
+ expandItem.setSystemQueryOption(levels);
+ } catch(ODataRuntimeException e) {
+ // Thrown if duplicated system query options are detected
+ throw wrap(new UriParserSyntaxException("Double system query option!", e,
+ UriParserSyntaxException.MessageKeys.DOUBLE_SYSTEM_QUERY_OPTION, e.getMessage()));
+ }
}
} else if (ctx.vEP != null) {
@@ -1178,8 +1233,14 @@
@SuppressWarnings("unchecked")
List<SystemQueryOptionImpl> list = (List<SystemQueryOptionImpl>) ctx.vEPE.accept(this);
- for (SystemQueryOptionImpl option : list) {
- expandItem.setSystemQueryOption(option);
+ try {
+ for (SystemQueryOptionImpl option : list) {
+ expandItem.setSystemQueryOption(option);
+ }
+ } catch(ODataRuntimeException e) {
+ // Thrown if duplicated system query options are detected
+ throw wrap(new UriParserSyntaxException("Double system query option!", e,
+ UriParserSyntaxException.MessageKeys.DOUBLE_SYSTEM_QUERY_OPTION, e.getMessage()));
}
context.contextExpandItemPath = contextExpandItemPathBU;
}
@@ -1193,9 +1254,6 @@
public Object visitExpandPath(final ExpandPathContext ctx) {
ExpandItemImpl expandItem = new ExpandItemImpl();
- // UriResourceItImpl pathInfoIT = new UriResourceItImpl();
- context.contextUriInfo.getLastResourcePart();
-
// save context
ExpandItemImpl contextExpandItemPathBU = context.contextExpandItemPath;
UriInfoImpl uriInfoResourceBU = context.contextUriInfo;
@@ -1203,10 +1261,11 @@
// set tmp context
context.contextExpandItemPath = expandItem;
context.contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
- // contextUriInfo.addPathInfo(pathInfoIT);
-
+
+ context.contextVisitExpandResourcePath = true;
super.visitExpandPath(ctx);
-
+ context.contextVisitExpandResourcePath = false;
+
EdmType startType = removeUriResourceStartingTypeFilterImpl(context.contextUriInfo);
expandItem.setResourcePath(context.contextUriInfo);
if (startType != null) {
@@ -1217,9 +1276,43 @@
context.contextUriInfo = uriInfoResourceBU;
context.contextExpandItemPath = contextExpandItemPathBU;
+ // test
+ validate(uriInfoResourceBU.asUriInfoResource(), expandItem);
+ //
+
return expandItem;
}
+ private void validate(UriInfoResource uriInfoResource, ExpandItemImpl expandItem) {
+ if(uriInfoResource != null) {
+ EdmEntityType type = getEntityType(uriInfoResource);
+ EdmEntityType name = getEntityType(expandItem.getResourcePath());
+
+ if(name != null && type != null) {
+ EdmElement property = type.getProperty(name.getName());
+ if(! (property instanceof EdmNavigationProperty)) {
+ throw wrap(new UriParserSemanticException("NavigationProperty '" + name.getName() + "' not found in type '" +
+ type.getFullQualifiedName().getFullQualifiedNameAsString() + "'",
+ UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE,
+ name.getFullQualifiedName().getFullQualifiedNameAsString(),
+ type.getFullQualifiedName().getFullQualifiedNameAsString()));
+ }
+ }
+ }
+ }
+
+ private EdmEntityType getEntityType(UriInfoResource test) {
+ List<UriResource> parts = test.getUriResourceParts();
+ if (!parts.isEmpty()) {
+ UriResource lastPart = parts.get(parts.size() - 1);
+ if (lastPart instanceof UriResourceEntitySet) {
+ UriResourceEntitySet entitySet = (UriResourceEntitySet) lastPart;
+ return entitySet.getEntityType();
+ }
+ }
+ return null;
+ }
+
@Override
public Object visitExpandPathExtension(final ExpandPathExtensionContext ctx) {
List<SystemQueryOptionImpl> list = new ArrayList<SystemQueryOptionImpl>();
@@ -1636,7 +1729,8 @@
uriParameter.setName(ctx.vODI.getText());
if (ctx.vCOM != null) {
- uriParameter.setText(ctx.vCOM.getText());
+ final String text = ctx.vCOM.getText();
+ uriParameter.setText("null".equals(text) ? null : text);
uriParameter.setExpression((ExpressionImpl) ctx.vCOM.accept(this));
} else {
uriParameter.setAlias("@" + ctx.vALI.getText());
@@ -1646,7 +1740,7 @@
}
@Override
- public Object visitNaninfinity(final NaninfinityContext ctx) {
+ public Object visitNaninfinityLiteral(final NaninfinityLiteralContext ctx) {
return new LiteralImpl().setType(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal)).
setText(ctx.getText());
}
@@ -1658,7 +1752,7 @@
}
@Override
- public Object visitNullrule(final NullruleContext ctx) {
+ public Object visitNullruleLiteral(final NullruleLiteralContext ctx) {
return new LiteralImpl().setText("null");
}
@@ -1723,6 +1817,11 @@
if (ctx.vlNVO.size() > 0) {
// check for keyPredicates
if (pathInfoSegment instanceof UriResourceWithKeysImpl) {
+ if(ctx.vlNVO.size() > 1) {
+ throw wrap(new UriParserSemanticException("More than one key predicates found",
+ UriParserSemanticException.MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES));
+ }
+
@SuppressWarnings("unchecked")
List<UriParameterImpl> list = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
((UriResourceWithKeysImpl) pathInfoSegment)
@@ -1753,15 +1852,107 @@
@Override
public Object visitPrimitiveLiteral(final PrimitiveLiteralContext ctx) {
ParseTree child1 = ctx.children.get(0);
-
- if (child1 instanceof EnumLitContext
- || child1 instanceof BooleanNonCaseContext
- || child1 instanceof NullruleContext
- || child1 instanceof NaninfinityContext) {
+
+ if (child1 instanceof EnumLiteralContext
+ || child1 instanceof BooleanNonCaseLiteralContext
+ || child1 instanceof NullruleLiteralContext
+ || child1 instanceof NaninfinityLiteralContext
+ || child1 instanceof StringLiteralContext
+ || child1 instanceof IntLiteralContext
+ || child1 instanceof BinaryLiteralContext
+ || child1 instanceof DateLiteralContext
+ || child1 instanceof DatetimeoffsetLiteralContext
+ || child1 instanceof DurationLiteralContext
+ || child1 instanceof GuidLiteralContext
+ || child1 instanceof TimeofdayLiteralContext
+ || child1 instanceof DecimalLiteralContext
+ || child1 instanceof BinaryLiteralContext) {
return child1.accept(this);
}
+
+ // TODO Implement geography types and set the proper type
return new LiteralImpl().setText(ctx.getText());
}
+
+ @Override
+ public Object visitBinaryLiteral(BinaryLiteralContext ctx) {
+ return new LiteralImpl().setText(ctx.getText())
+ .setType(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary));
+ }
+
+ @Override
+ public Object visitStringLiteral(final StringLiteralContext ctx) {
+ return new LiteralImpl().setText(ctx.getText())
+ .setType(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String));
+ }
+
+ @Override
+ public Object visitDecimalLiteral(final DecimalLiteralContext ctx) {
+ EdmType type = null;
+
+ if(!ctx.getText().matches(".*[eE].*")) {
+ type = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal);
+ } else {
+ type = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double);
+ }
+
+ return new LiteralImpl().setText(ctx.getText()).setType(type);
+ }
+
+ @Override
+ public Object visitIntLiteral(final IntLiteralContext ctx) {
+ try {
+ final long value = Long.parseLong(ctx.getText());
+ EdmType type = null;
+
+ if(value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE) {
+ type = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte);
+ } else if (value >= 0 && value <= 255) {
+ type = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte);
+ } else if(value >= Short.MIN_VALUE && value <= Short.MAX_VALUE) {
+ type = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16);
+ } else if(value >= Integer.MIN_VALUE && value <= Integer.MAX_VALUE) {
+ type = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32);
+ } else {
+ type = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64);
+ }
+
+ return new LiteralImpl().setText(ctx.getText()).setType(type);
+ } catch( NumberFormatException e) {
+ return new LiteralImpl().setText(ctx.getText())
+ .setType(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal));
+ }
+ }
+
+ @Override
+ public Object visitDateLiteral(final DateLiteralContext ctx) {
+ return new LiteralImpl().setText(ctx.getText())
+ .setType(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Date));
+ }
+
+ @Override
+ public Object visitDatetimeoffsetLiteral(final DatetimeoffsetLiteralContext ctx) {
+ return new LiteralImpl().setText(ctx.getText())
+ .setType(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.DateTimeOffset));
+ }
+
+ @Override
+ public Object visitDurationLiteral(final DurationLiteralContext ctx) {
+ return new LiteralImpl().setText(ctx.getText())
+ .setType(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Duration));
+ }
+
+ @Override
+ public Object visitGuidLiteral(final GuidLiteralContext ctx) {
+ return new LiteralImpl().setText(ctx.getText())
+ .setType(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Guid));
+ }
+
+ @Override
+ public Object visitTimeofdayLiteral(final TimeofdayLiteralContext ctx) {
+ return new LiteralImpl().setText(ctx.getText())
+ .setType(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.TimeOfDay));
+ }
@Override
public Object visitQueryOptions(final QueryOptionsContext ctx) {
@@ -2220,4 +2411,10 @@
alias.setParameter("@" + ctx.odataIdentifier().getChild(0).getText());
return alias;
}
+
+ @Override
+ public Object visitSearchSpecialToken(final SearchSpecialTokenContext ctx) {
+ throw wrap(new UriParserSemanticException("System query option '$search' not implemented!",
+ UriParserSemanticException.MessageKeys.NOT_IMPLEMENTED, "System query option '$search"));
+ }
}
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 c1b171e..75744c9 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
@@ -73,7 +73,9 @@
NOT_FOR_ENTITY_TYPE,
PREVIOUS_PART_TYPED,
/** parameter: resource_name */
- RESOURCE_NOT_FOUND;
+ RESOURCE_NOT_FOUND,
+ /** parameter: not implemented part */
+ NOT_IMPLEMENTED;
@Override
public String getKey() {
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 12985ee..8ff22b0 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
@@ -21,6 +21,7 @@
import java.util.List;
import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.server.api.uri.UriInfoResource;
import org.apache.olingo.server.api.uri.queryoption.CountOption;
import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
@@ -31,7 +32,7 @@
import org.apache.olingo.server.api.uri.queryoption.SearchOption;
import org.apache.olingo.server.api.uri.queryoption.SelectOption;
import org.apache.olingo.server.api.uri.queryoption.SkipOption;
-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.TopOption;
public class ExpandItemImpl implements ExpandItem {
@@ -54,28 +55,45 @@
public ExpandItemImpl setSystemQueryOption(final SystemQueryOptionImpl sysItem) {
- if (sysItem.getKind() == SystemQueryOptionKind.EXPAND) {
+ if (sysItem instanceof ExpandOptionImpl) {
+ validateDoubleSystemQueryOption(expandOption, sysItem);
expandOption = (ExpandOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.FILTER) {
+ } else if (sysItem instanceof FilterOptionImpl) {
+ validateDoubleSystemQueryOption(filterOption, sysItem);
filterOption = (FilterOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.COUNT) {
+ } else if (sysItem instanceof CountOptionImpl) {
+ validateDoubleSystemQueryOption(inlineCountOption, sysItem);
inlineCountOption = (CountOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.ORDERBY) {
+ } else if (sysItem instanceof OrderByOptionImpl) {
+ validateDoubleSystemQueryOption(orderByOption, sysItem);
orderByOption = (OrderByOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.SEARCH) {
+ } else if (sysItem instanceof SearchOptionImpl) {
+ validateDoubleSystemQueryOption(searchOption, sysItem);
searchOption = (SearchOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.SELECT) {
+ } else if (sysItem instanceof SelectOptionImpl) {
+ validateDoubleSystemQueryOption(selectOption, sysItem);
selectOption = (SelectOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.SKIP) {
+ } else if (sysItem instanceof SkipOptionImpl) {
+ validateDoubleSystemQueryOption(skipOption, sysItem);
skipOption = (SkipOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.TOP) {
+ } else if (sysItem instanceof TopOptionImpl) {
+ validateDoubleSystemQueryOption(topOption, sysItem);
topOption = (TopOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.LEVELS) {
+ } else if (sysItem instanceof LevelsExpandOption) {
+ if(levelsExpandOption != null) {
+ throw new ODataRuntimeException("$levels");
+ }
levelsExpandOption = (LevelsExpandOption) sysItem;
}
return this;
}
-
+
+ private void validateDoubleSystemQueryOption(final SystemQueryOption oldOption, final SystemQueryOption newOption) {
+ if(oldOption != null) {
+ throw new ODataRuntimeException(newOption.getName());
+ }
+ }
+
public ExpandItemImpl setSystemQueryOptions(final List<SystemQueryOptionImpl> list) {
for (SystemQueryOptionImpl item : list) {
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 d9db0d4..1dd9fa7 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
@@ -51,7 +51,7 @@
@Override
public <T> T accept(final ExpressionVisitor<T> visitor) throws ExpressionVisitException, ODataApplicationException {
- return visitor.visitLiteral(text);
+ return visitor.visitLiteral(this);
}
}
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 8940bcf..5f6162f 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
@@ -25,6 +25,7 @@
import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
import org.apache.olingo.server.api.uri.queryoption.expression.Member;
import org.apache.olingo.server.core.uri.UriInfoImpl;
+import org.apache.olingo.server.core.uri.UriResourceActionImpl;
import org.apache.olingo.server.core.uri.UriResourceImpl;
import org.apache.olingo.server.core.uri.UriResourceTypedImpl;
import org.apache.olingo.server.core.uri.UriResourceWithKeysImpl;
@@ -69,6 +70,8 @@
return type;
}
return lastTyped.getType();
+ } else if (lastResourcePart instanceof UriResourceActionImpl) {
+ return ((UriResourceActionImpl) lastResourcePart).getType();
} else {
return null;
}
@@ -81,6 +84,8 @@
if (lastResourcePart instanceof UriResourceTypedImpl) {
UriResourceTypedImpl lastTyped = (UriResourceTypedImpl) lastResourcePart;
return lastTyped.isCollection();
+ } else if (lastResourcePart instanceof UriResourceActionImpl) {
+ return ((UriResourceActionImpl) lastResourcePart).isCollection();
}
return false;
}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java
index fbd010a..e1d9638 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java
@@ -502,22 +502,22 @@
private void validateNoQueryOptionsForHttpMethod(final UriInfo uriInfo, final HttpMethod httpMethod)
throws UriValidationException {
if (!uriInfo.getSystemQueryOptions().isEmpty()) {
- String options = "";
+ StringBuilder options = new StringBuilder();
for (SystemQueryOption option : uriInfo.getSystemQueryOptions()) {
- options = options + option.getName() + " ";
+ options.append(option.getName()).append(" ");
}
- throw new UriValidationException("System query option " + options + " not allowed for method "
+ throw new UriValidationException("System query option " + options.toString() + " not allowed for method "
+ httpMethod, UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED_FOR_HTTP_METHOD,
- options, httpMethod.toString());
+ options.toString(), httpMethod.toString());
}
}
private boolean isAction(final UriInfo uriInfo) {
List<UriResource> uriResourceParts = uriInfo.getUriResourceParts();
- if (!uriResourceParts.isEmpty()) {
- return UriResourceKind.action == uriResourceParts.get(uriResourceParts.size() - 1).getKind();
+ if (uriResourceParts.isEmpty()) {
+ return false;
}
- return false;
+ return UriResourceKind.action == uriResourceParts.get(uriResourceParts.size() - 1).getKind();
}
private void validateKeyPredicates(final UriInfo uriInfo) throws UriValidationException {
@@ -586,7 +586,8 @@
if (last != null
&& (last.getKind() == UriResourceKind.primitiveProperty
|| last.getKind() == UriResourceKind.complexProperty
- || last.getKind() == UriResourceKind.value && previous.getKind() == UriResourceKind.primitiveProperty)) {
+ || (last.getKind() == UriResourceKind.value
+ && previous != null && previous.getKind() == UriResourceKind.primitiveProperty))) {
final EdmProperty property = ((UriResourceProperty)
(last.getKind() == UriResourceKind.value ? previous : last)).getProperty();
if (method == HttpMethod.PATCH && property.isCollection()) {
diff --git a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
index fbb4d62..f6440fb 100644
--- a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
+++ b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
@@ -63,6 +63,7 @@
UriParserSemanticException.NOT_FOR_ENTITY_TYPE=Not allowed for entity type.
UriParserSemanticException.PREVIOUS_PART_TYPED=The previous part is typed.
UriParserSemanticException.RESOURCE_NOT_FOUND=Cannot find EntitySet, Singleton, ActionImport or FunctionImport with name '%1$s'.
+UriParserSemanticException.NOT_IMPLEMENTED=%1$s is not implemented!
UriValidationException.UNSUPPORTED_QUERY_OPTION=The query option '%1$s' is not supported.
UriValidationException.UNSUPPORTED_URI_KIND=The URI kind '%1$s' is not supported.
@@ -85,6 +86,7 @@
ContentNegotiatorException.NO_CONTENT_TYPE_SUPPORTED=No content type has been specified as supported.
ContentNegotiatorException.UNSUPPORTED_FORMAT_OPTION=The $format option '%1$s' is not supported.
+SerializerException.NULL_METADATA_OR_EDM=The server does not define any service metadata.
SerializerException.NOT_IMPLEMENTED=The requested serialization method has not been implemented yet.
SerializerException.UNSUPPORTED_FORMAT=The format '%1$s' is not supported.
SerializerException.JSON_METADATA=The metadata document cannot be provided in JSON format.
@@ -98,6 +100,7 @@
SerializerException.WRONG_PRIMITIVE_VALUE=The value '%2$s' is not valid for the primitive type '%1$s' and the given facets.
SerializerException.UNKNOWN_TYPE=Type '%1s' not found in metadata.
SerializerException.WRONG_BASE_TYPE=Type '%1s' is not derived from '%2s'.
+SerializerException.UNSUPPORTED_ENCODING=The encoding '%1s' is not supported.
DeserializerException.NOT_IMPLEMENTED=The requested deserialization method has not been implemented yet.
DeserializerException.IO_EXCEPTION=An I/O exception occurred.
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/ContentNegotiatorTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/ContentNegotiatorTest.java
index f84ef95..0d17a5b 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/ContentNegotiatorTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/ContentNegotiatorTest.java
@@ -31,7 +31,6 @@
import java.util.List;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.server.api.ODataRequest;
@@ -46,32 +45,41 @@
static final private String ACCEPT_CASE_MIN_UTF8 = "application/json;charset=UTF-8;odata.metadata=minimal";
static final private String ACCEPT_CASE_FULL = "application/json;odata.metadata=full";
static final private String ACCEPT_CASE_NONE = "application/json;odata.metadata=none";
+ static final private String ACCEPT_CASE_MIN_UTF8_IEEE754
+ = "application/json;charset=UTF-8;odata.metadata=minimal;IEEE754Compatible=true";
+ static final private String ACCEPT_CASE_MIN_IEEE754
+ = "application/json;odata.metadata=minimal;IEEE754Compatible=true";
static final private String ACCEPT_CASE_JSONQ = "application/json;q=0.2";
static final private String ACCEPT_CASE_XML = HttpContentType.APPLICATION_XML;
static final private String ACCEPT_CASE_WILDCARD1 = HttpContentType.WILDCARD;
static final private String ACCEPT_CASE_WILDCARD2 = "application/*";
-
+
//@formatter:off (Eclipse formatter)
//CHECKSTYLE:OFF (Maven checkstyle)
String[][] casesServiceDocument = {
- /* expected $format accept modified content types */
- { ACCEPT_CASE_MIN, null, null, null },
- { ACCEPT_CASE_MIN, "json", null, null },
- { ACCEPT_CASE_MIN, "json", ACCEPT_CASE_JSONQ, null },
- { ACCEPT_CASE_NONE, ACCEPT_CASE_NONE, null, null },
- { "a/a", "a/a", null, "a/a" },
- { ACCEPT_CASE_MIN, null, ACCEPT_CASE_JSONQ, null },
- { ACCEPT_CASE_MIN, null, ACCEPT_CASE_WILDCARD1, null },
- { ACCEPT_CASE_MIN, null, ACCEPT_CASE_WILDCARD2, null },
- { ACCEPT_CASE_MIN, null, null, ACCEPT_CASE_MIN },
- { "a/a", "a/a", null, "a/a,b/b" },
- { "a/a;x=y", "a/a", ACCEPT_CASE_WILDCARD1, "a/a;x=y" },
- { "a/a;v=w;x=y", null, "a/a;x=y", "a/a;b=c,a/a;v=w;x=y" },
- { "a/a;v=w;x=y", "a/a;x=y", null, "a/a;b=c,a/a;v=w;x=y" },
- { ACCEPT_CASE_MIN, "json", ACCEPT_CASE_MIN, null },
- { ACCEPT_CASE_FULL, null, ACCEPT_CASE_FULL, ACCEPT_CASE_FULL },
- { ACCEPT_CASE_MIN_UTF8, null, ACCEPT_CASE_MIN_UTF8, null }
+ /* expected $format accept modified content types */
+ { ACCEPT_CASE_MIN, null, null, null },
+ { ACCEPT_CASE_MIN, "json", null, null },
+ { ACCEPT_CASE_MIN, "json", ACCEPT_CASE_JSONQ, null },
+ { ACCEPT_CASE_NONE, ACCEPT_CASE_NONE, null, null },
+ { "a/a", "a/a", null, "a/a" },
+ { ACCEPT_CASE_MIN, null, ACCEPT_CASE_JSONQ, null },
+ { ACCEPT_CASE_MIN, null, ACCEPT_CASE_WILDCARD1, null },
+ { ACCEPT_CASE_MIN, null, ACCEPT_CASE_WILDCARD2, null },
+ { ACCEPT_CASE_MIN, null, null, ACCEPT_CASE_MIN },
+ { "a/a", "a/a", null, "a/a,b/b" },
+ { "a/a;x=y", "a/a", ACCEPT_CASE_WILDCARD1, "a/a;x=y" },
+ { "a/a;v=w;x=y", null, "a/a;x=y", "a/a;b=c,a/a;v=w;x=y" },
+ { "a/a;v=w;x=y", "a/a;x=y", null, "a/a;b=c,a/a;v=w;x=y" },
+ { ACCEPT_CASE_MIN, "json", ACCEPT_CASE_MIN, null },
+ { ACCEPT_CASE_FULL, null, ACCEPT_CASE_FULL, ACCEPT_CASE_FULL },
+ { ACCEPT_CASE_MIN_UTF8, null, ACCEPT_CASE_MIN_UTF8, null },
+ { ACCEPT_CASE_MIN_IEEE754, null, ACCEPT_CASE_MIN_IEEE754, null },
+ { ACCEPT_CASE_MIN_UTF8_IEEE754, null, ACCEPT_CASE_MIN_UTF8_IEEE754, null },
+ { ACCEPT_CASE_MIN_IEEE754, ACCEPT_CASE_MIN_IEEE754, ACCEPT_CASE_MIN , null },
+ { ACCEPT_CASE_XML, "xml", null, null },
+ { ACCEPT_CASE_XML, null, ACCEPT_CASE_XML, null }
};
String[][] casesMetadata = {
@@ -93,7 +101,6 @@
{ null, "a/a", null, "b/b" },
{ null, "a/a;x=y", null, "a/a;v=w" },
{ null, null, "a/a;x=y", "a/a;v=w" },
- { null, "atom", null, null }, // not yet supported
{ null, null, ACCEPT_CASE_FULL, null }, // not yet supported
{ null, "a/b;charset=ISO-8859-1", null, "a/b" },
{ null, null, "a/b;charset=ISO-8859-1", "a/b" },
@@ -147,7 +154,7 @@
@Test
public void checkSupport() throws Exception {
- ContentNegotiator.checkSupport(ODataFormat.JSON.getContentType(), null,
+ ContentNegotiator.checkSupport(ContentType.JSON, null,
RepresentationType.ENTITY);
ContentNegotiator.checkSupport(ContentType.TEXT_PLAIN, null, RepresentationType.VALUE);
try {
@@ -159,7 +166,8 @@
ContentNegotiator.checkSupport(ContentType.create("a/b"), createCustomContentTypeSupport("a/b"),
RepresentationType.ENTITY);
- ContentNegotiator.checkSupport(ContentType.create("a/b", "c=d"), createCustomContentTypeSupport("a/b"),
+ ContentNegotiator.checkSupport(ContentType.create(ContentType.create("a/b"), "c", "d"),
+ createCustomContentTypeSupport("a/b"),
RepresentationType.ENTITY);
try {
ContentNegotiator.checkSupport(ContentType.create("a/b"), createCustomContentTypeSupport("a/b;c=d"),
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/ODataHttpHandlerImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/ODataHttpHandlerImplTest.java
index 516fea0..1fcef84 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/ODataHttpHandlerImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/ODataHttpHandlerImplTest.java
@@ -59,10 +59,7 @@
when(hr.getHeader("X-HTTP-Method")).thenReturn(m[1]);
when(hr.getHeader("X-HTTP-Method-Override")).thenReturn(m[2]);
- ODataRequest odr = new ODataRequest();
- ODataHttpHandlerImpl.extractMethod(odr, hr);
-
- assertEquals(HttpMethod.valueOf(m[3]), odr.getMethod());
+ assertEquals(HttpMethod.valueOf(m[3]), ODataHttpHandlerImpl.extractMethod(hr));
}
}
@@ -83,9 +80,8 @@
when(hr.getHeader("X-HTTP-Method")).thenReturn(m[1]);
when(hr.getHeader("X-HTTP-Method-Override")).thenReturn(m[2]);
- ODataRequest odr = new ODataRequest();
try {
- ODataHttpHandlerImpl.extractMethod(odr, hr);
+ ODataHttpHandlerImpl.extractMethod(hr);
fail();
} catch (ODataLibraryException e) {
// expected
@@ -153,7 +149,7 @@
when(hr.getServletPath()).thenReturn(p[2]);
ODataRequest odr = new ODataRequest();
- ODataHttpHandlerImpl.extractUri(odr, hr, Integer.parseInt(p[6]));
+ ODataHttpHandlerImpl.fillUriInformation(odr, hr, Integer.parseInt(p[6]));
String rawBaseUri = p[0] + p[1] + p[2] + p[3];
String rawODataPath = p[4];
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/ODataImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/ODataImplTest.java
new file mode 100644
index 0000000..3954a5a
--- /dev/null
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/ODataImplTest.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.server.core;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.junit.Test;
+
+public class ODataImplTest {
+
+ private final OData odata = OData.newInstance();
+
+ @Test
+ public void serializerSupportedFormats() throws SerializerException {
+ assertNotNull(odata.createSerializer(ContentType.JSON_NO_METADATA));
+ assertNotNull(odata.createSerializer(ContentType.JSON));
+ assertNotNull(odata.createSerializer(ContentType.APPLICATION_JSON));
+ }
+
+ @Test(expected = SerializerException.class)
+ public void jsonSerializerForODataMetadataFull() throws SerializerException {
+ odata.createSerializer(ContentType.JSON_FULL_METADATA);
+ }
+
+ @Test
+ public void deserializerSupportedFormats() throws DeserializerException {
+ assertNotNull(odata.createDeserializer(ContentType.JSON_NO_METADATA));
+ assertNotNull(odata.createDeserializer(ContentType.JSON));
+ assertNotNull(odata.createDeserializer(ContentType.JSON_FULL_METADATA));
+ assertNotNull(odata.createDeserializer(ContentType.APPLICATION_JSON));
+ }
+
+ public void xmlDeserializer() throws DeserializerException {
+ assertNotNull(odata.createDeserializer(ContentType.APPLICATION_XML));
+ }
+}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/batchhandler/MockedBatchHandlerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/batchhandler/MockedBatchHandlerTest.java
index 75496e3..7d13d8a 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/batchhandler/MockedBatchHandlerTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/batchhandler/MockedBatchHandlerTest.java
@@ -26,9 +26,9 @@
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -45,15 +45,15 @@
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.batch.BatchFacade;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchSerializerException;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
import org.apache.olingo.server.api.deserializer.batch.BatchOptions;
import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
import org.apache.olingo.server.api.processor.BatchProcessor;
+import org.apache.olingo.server.api.serializer.BatchSerializerException;
import org.apache.olingo.server.core.ODataHandler;
import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
-import org.apache.olingo.server.core.deserializer.batch.BufferedReaderIncludingLineEndings;
+import org.apache.olingo.server.core.deserializer.batch.BatchLineReader;
import org.junit.Before;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
@@ -148,8 +148,8 @@
batchHandler.process(request, response, true);
- BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(response.getContent()));
+ BatchLineReader reader =
+ new BatchLineReader(response.getContent());
final List<String> responseContent = reader.toList();
reader.close();
@@ -219,8 +219,8 @@
batchHandler.process(request, response, true);
- BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(response.getContent()));
+ BatchLineReader reader =
+ new BatchLineReader(response.getContent());
final List<String> responseContent = reader.toList();
int line = 0;
@@ -298,8 +298,8 @@
batchHandler.process(request, response, true);
- BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(response.getContent()));
+ BatchLineReader reader =
+ new BatchLineReader(response.getContent());
final List<String> responseContent = reader.toList();
reader.close();
@@ -364,7 +364,7 @@
}
@Test
- public void testMineBodyPartTransitiv() throws Exception {
+ public void mimeBodyPartTransitive() throws Exception {
final String content = ""
+ "--batch_12345" + CRLF
+ "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
@@ -416,8 +416,8 @@
batchHandler.process(request, response, true);
- BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(response.getContent()));
+ BatchLineReader reader =
+ new BatchLineReader(response.getContent());
final List<String> responseContent = reader.toList();
reader.close();
@@ -528,7 +528,7 @@
assertEquals("Content-Type: application/http" + CRLF, response.get(lineNumber++));
assertEquals("Content-Transfer-Encoding: binary" + CRLF, response.get(lineNumber++));
- assertTrue(response.get(lineNumber).contains("Content-Id:"));
+ assertTrue(response.get(lineNumber).contains("Content-ID:"));
String contentId = response.get(lineNumber).split(":")[1].trim();
lineNumber++;
@@ -538,10 +538,7 @@
}
private Map<String, List<String>> getMimeHeader() {
- final Map<String, List<String>> header = new HashMap<String, List<String>>();
- header.put(HttpHeader.CONTENT_TYPE, Arrays.asList(new String[] { BATCH_CONTENT_TYPE }));
-
- return header;
+ return Collections.singletonMap(HttpHeader.CONTENT_TYPE, Collections.singletonList(BATCH_CONTENT_TYPE));
}
private ODataRequest buildODataRequest(final String content, final Map<String, List<String>> header)
@@ -640,9 +637,9 @@
oDataResponse.setStatusCode(HttpStatusCode.OK.getStatusCode());
}
- final String contentId = request.getHeader(BatchParserCommon.HTTP_CONTENT_ID);
+ final String contentId = request.getHeader(HttpHeader.CONTENT_ID);
if (contentId != null) {
- oDataResponse.setHeader(BatchParserCommon.HTTP_CONTENT_ID, contentId);
+ oDataResponse.setHeader(HttpHeader.CONTENT_ID, contentId);
}
return oDataResponse;
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/AbstractDebugTabTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/AbstractDebugTabTest.java
new file mode 100644
index 0000000..13a690f
--- /dev/null
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/AbstractDebugTabTest.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.server.core.debug;
+
+import java.io.IOException;
+import java.io.StringWriter;
+
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonGenerator;
+
+public abstract class AbstractDebugTabTest {
+
+ protected String createHtml(DebugTab tab) throws IOException {
+ StringWriter writer = new StringWriter();
+ tab.appendHtml(writer);
+ writer.flush();
+ return writer.toString();
+ }
+
+ protected String createJson(DebugTab tab) throws IOException {
+ StringWriter writer = new StringWriter();
+ JsonGenerator gen = new JsonFactory().createGenerator(writer);
+ tab.appendJson(gen);
+ gen.flush();
+ gen.close();
+ writer.flush();
+ return writer.toString();
+ }
+}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/DebugTabBodyTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/DebugTabBodyTest.java
new file mode 100644
index 0000000..16f0e15
--- /dev/null
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/DebugTabBodyTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.debug;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class DebugTabBodyTest extends AbstractDebugTabTest {
+
+ @Test
+ public void nullResponseMustNotLeadToException() throws Exception {
+ DebugTabBody tab = new DebugTabBody(null);
+
+ assertEquals("null", createJson(tab));
+ assertEquals("<pre class=\"code\">\nODataLibrary: No body.\n</pre>\n", createHtml(tab));
+ }
+}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/DebugTabRequestTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/DebugTabRequestTest.java
new file mode 100644
index 0000000..24732ba
--- /dev/null
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/DebugTabRequestTest.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.debug;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.commons.api.http.HttpMethod;
+import org.apache.olingo.server.api.ODataRequest;
+import org.junit.Test;
+
+public class DebugTabRequestTest extends AbstractDebugTabTest {
+
+ @Test
+ public void initialRequestMustNotleadToException() throws Exception {
+ String expectedJson = "{\"method\":\"unkown\",\"uri\":\"unkown\",\"protocol\":\"unkown\"}";
+ String expectedHtml = "<h2>Request Method</h2>\n"
+ + "<p>unkown</p>\n"
+ + "<h2>Request URI</h2>\n"
+ + "<p>unkown</p>\n"
+ + "<h2>Request Protocol</h2>\n"
+ + "<p>unkown</p>\n"
+ + "<h2>Request Headers</h2>\n"
+ + "<table>\n"
+ + "<thead>\n"
+ + "<tr><th class=\"name\">Name</th><th class=\"value\">Value</th></tr>\n"
+ + "</thead>\n"
+ + "<tbody>\n"
+ + "</tbody>\n"
+ + "</table>\n";
+
+ DebugTabRequest requestTab = new DebugTabRequest(null);
+ assertEquals(expectedJson, createJson(requestTab));
+ assertEquals(expectedHtml, createHtml(requestTab));
+
+ requestTab = new DebugTabRequest(new ODataRequest());
+ assertEquals(expectedJson, createJson(requestTab));
+ assertEquals(expectedHtml, createHtml(requestTab));
+ }
+
+ @Test
+ public void onlyProtocolNotSet() throws Exception {
+ String expectedJson = "{\"method\":\"GET\",\"uri\":\"def&\",\"protocol\":\"unkown\"}";
+ String expectedHtml = "<h2>Request Method</h2>\n"
+ + "<p>GET</p>\n"
+ + "<h2>Request URI</h2>\n"
+ + "<p>def&</p>\n"
+ + "<h2>Request Protocol</h2>\n"
+ + "<p>unkown</p>\n"
+ + "<h2>Request Headers</h2>\n"
+ + "<table>\n"
+ + "<thead>\n"
+ + "<tr><th class=\"name\">Name</th><th class=\"value\">Value</th></tr>\n"
+ + "</thead>\n"
+ + "<tbody>\n"
+ + "</tbody>\n"
+ + "</table>\n";
+
+ ODataRequest oDataRequest = new ODataRequest();
+ oDataRequest.setMethod(HttpMethod.GET);
+ oDataRequest.setRawRequestUri("def&");
+
+ DebugTabRequest requestTab = new DebugTabRequest(oDataRequest);
+ assertEquals(expectedJson, createJson(requestTab));
+ assertEquals(expectedHtml, createHtml(requestTab));
+ }
+
+ @Test
+ public void singleHeaderValue() throws Exception {
+ String expectedJson =
+ "{\"method\":\"GET\",\"uri\":\"def&\",\"protocol\":\"def&\",\"headers\":{\"HeaderName\":\"Value1\"}}";
+ String expectedHtml = "<h2>Request Method</h2>\n"
+ + "<p>GET</p>\n"
+ + "<h2>Request URI</h2>\n"
+ + "<p>def&</p>\n"
+ + "<h2>Request Protocol</h2>\n"
+ + "<p>def&</p>\n"
+ + "<h2>Request Headers</h2>\n"
+ + "<table>\n"
+ + "<thead>\n"
+ + "<tr><th class=\"name\">Name</th><th class=\"value\">Value</th></tr>\n"
+ + "</thead>\n"
+ + "<tbody>\n"
+ + "<tr><td class=\"name\">HeaderName</td><td class=\"value\">Value1</td></tr>\n"
+ + "</tbody>\n"
+ + "</table>\n";
+
+ ODataRequest oDataRequest = new ODataRequest();
+ oDataRequest.setMethod(HttpMethod.GET);
+ oDataRequest.setRawRequestUri("def&");
+ oDataRequest.setProtocol("def&");
+ List<String> headerValues = new ArrayList<String>();
+ headerValues.add("Value1");
+ oDataRequest.addHeader("HeaderName", headerValues);
+
+ DebugTabRequest requestTab = new DebugTabRequest(oDataRequest);
+ assertEquals(expectedJson, createJson(requestTab));
+ assertEquals(expectedHtml, createHtml(requestTab));
+ }
+
+ @Test
+ public void multiHeaderValueResultsInMap() throws Exception {
+ String expectedJson = "{\"method\":\"GET\",\"uri\":\"def&\",\"protocol\":\"def&\","
+ + "\"headers\":{\"HeaderName\":[\"Value1\",\"Value2\"]}}";
+ String expectedHtml = "<h2>Request Method</h2>\n"
+ + "<p>GET</p>\n"
+ + "<h2>Request URI</h2>\n"
+ + "<p>def&</p>\n"
+ + "<h2>Request Protocol</h2>\n"
+ + "<p>def&</p>\n"
+ + "<h2>Request Headers</h2>\n"
+ + "<table>\n"
+ + "<thead>\n"
+ + "<tr><th class=\"name\">Name</th><th class=\"value\">Value</th></tr>\n"
+ + "</thead>\n"
+ + "<tbody>\n"
+ + "<tr><td class=\"name\">HeaderName</td><td class=\"value\">Value1</td></tr>\n"
+ + "<tr><td class=\"name\">HeaderName</td><td class=\"value\">Value2</td></tr>\n"
+ + "</tbody>\n"
+ + "</table>\n";
+
+ ODataRequest oDataRequest = new ODataRequest();
+ oDataRequest.setMethod(HttpMethod.GET);
+ oDataRequest.setRawRequestUri("def&");
+ oDataRequest.setProtocol("def&");
+ List<String> headerValues = new ArrayList<String>();
+ headerValues.add("Value1");
+ headerValues.add("Value2");
+ oDataRequest.addHeader("HeaderName", headerValues);
+
+ DebugTabRequest requestTab = new DebugTabRequest(oDataRequest);
+ assertEquals(expectedJson, createJson(requestTab));
+ assertEquals(expectedHtml, createHtml(requestTab));
+ }
+
+}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/DebugTabResponseTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/DebugTabResponseTest.java
new file mode 100644
index 0000000..8ca5306
--- /dev/null
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/DebugTabResponseTest.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.server.core.debug;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataResponse;
+import org.junit.Test;
+
+public class DebugTabResponseTest extends AbstractDebugTabTest {
+
+ @Test
+ public void nullResponseMustNotLeadToException() throws Exception {
+ DebugTabResponse tab = new DebugTabResponse(null);
+
+ String expectedJson = "{\"status\":{\"code\":\"500\",\"info\":\"Internal Server Error\"},\"body\":null}";
+ String expectedHtml = "<h2>Status Code</h2>\n"
+ + "<p>500 Internal Server Error</p>\n"
+ + "<h2>Response Headers</h2>\n"
+ + "<table>\n"
+ + "<thead>\n"
+ + "<tr><th class=\"name\">Name</th><th class=\"value\">Value</th></tr>\n"
+ + "</thead>\n"
+ + "<tbody>\n"
+ + "</tbody>\n"
+ + "</table>\n"
+ + "<h2>Response Body</h2>\n"
+ + "<p>ODataLibrary: no response body</p>\n";
+
+ assertEquals(expectedJson, createJson(tab));
+ assertEquals(expectedHtml, createHtml(tab));
+ }
+
+ @Test
+ public void withInformationNoBody() throws Exception {
+ ODataResponse response = new ODataResponse();
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ response.setHeader("headername", "headervalue");
+ response.setHeader("headername2", "headervalue2");
+ DebugTabResponse tab = new DebugTabResponse(response);
+
+ String expectedJson = "{\"status\":{\"code\":\"204\",\"info\":\"No Content\"},"
+ + "\"headers\":{\"headername\":\"headervalue\",\"headername2\":\"headervalue2\"},\"body\":null}";
+ String expectedHtml = "<h2>Status Code</h2>\n"
+ + "<p>204 No Content</p>\n"
+ + "<h2>Response Headers</h2>\n"
+ + "<table>\n"
+ + "<thead>\n"
+ + "<tr><th class=\"name\">Name</th><th class=\"value\">Value</th></tr>\n"
+ + "</thead>\n"
+ + "<tbody>\n"
+ + "<tr><td class=\"name\">headername</td><td class=\"value\">headervalue</td></tr>\n"
+ + "<tr><td class=\"name\">headername2</td><td class=\"value\">headervalue2</td></tr>\n"
+ + "</tbody>\n"
+ + "</table>\n"
+ + "<h2>Response Body</h2>\n"
+ + "<p>ODataLibrary: no response body</p>\n";
+ assertEquals(expectedJson, createJson(tab));
+ assertEquals(expectedHtml, createHtml(tab));
+ }
+
+}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/DebugTabServerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/DebugTabServerTest.java
new file mode 100644
index 0000000..fa54c3d
--- /dev/null
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/DebugTabServerTest.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.debug;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class DebugTabServerTest extends AbstractDebugTabTest {
+
+ @Test
+ public void nullServerInformationMustNotleadToException() throws Exception {
+ DebugTabServer serverTab = new DebugTabServer(null);
+
+ assertEquals("null", createJson(serverTab));
+ String html = createHtml(serverTab);
+ assertTrue(html.startsWith("<h2>Library Version</h2>"));
+ assertTrue(html.contains("<h2>Server Environment</h2>\n"));
+ }
+
+ @Test
+ public void initialServerInformationMustNotleadToException() throws Exception {
+ DebugTabServer serverTab = new DebugTabServer(Collections.<String, String> emptyMap());
+
+ assertEquals("null", createJson(serverTab));
+ String html = createHtml(serverTab);
+ assertTrue(html.startsWith("<h2>Library Version</h2>"));
+ assertTrue(html.contains("<h2>Server Environment</h2>\n"));
+ }
+
+ @Test
+ public void twoParametersNoNull() throws Exception {
+ Map<String, String> env = new LinkedHashMap<String, String>();
+ env.put("key1", "value1");
+ env.put("key2", "value2");
+ DebugTabServer serverTab = new DebugTabServer(env);
+
+ String expectedJson = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
+
+ assertEquals(expectedJson, createJson(serverTab));
+ String html = createHtml(serverTab);
+ assertTrue(html.contains("<tr><td class=\"name\">key1</td><td class=\"value\">value1</td></tr>"));
+ assertTrue(html.contains("<tr><td class=\"name\">key2</td><td class=\"value\">value2</td></tr>"));
+ assertTrue(html.endsWith("</table>\n"));
+ }
+
+ @Test
+ public void twoParametersWithNull() throws Exception {
+ Map<String, String> env = new LinkedHashMap<String, String>();
+ env.put("key1", null);
+ env.put("key2", null);
+ DebugTabServer serverTab = new DebugTabServer(env);
+
+ String expectedJson = "{\"key1\":null,\"key2\":null}";
+
+ assertEquals(expectedJson, createJson(serverTab));
+ String html = createHtml(serverTab);
+ assertTrue(html.contains("<tr><td class=\"name\">key1</td><td class=\"value\">null</td></tr>"));
+ assertTrue(html.contains("<tr><td class=\"name\">key2</td><td class=\"value\">null</td></tr>"));
+ assertTrue(html.endsWith("</table>\n"));
+ }
+
+}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/ServerCoreDebuggerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/ServerCoreDebuggerTest.java
new file mode 100644
index 0000000..3d994a9
--- /dev/null
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/debug/ServerCoreDebuggerTest.java
@@ -0,0 +1,111 @@
+/*
+ * 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.debug;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.debug.DebugInformation;
+import org.apache.olingo.server.api.debug.DebugSupport;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ServerCoreDebuggerTest {
+
+ private ServerCoreDebugger debugger;
+
+ @Before
+ public void setupDebugger() {
+ debugger = new ServerCoreDebugger(OData.newInstance());
+ DebugSupport processor = mock(DebugSupport.class);
+ when(processor.isUserAuthorized()).thenReturn(true);
+ when(processor.createDebugResponse(anyString(), any(DebugInformation.class)))
+ .thenThrow(new ODataRuntimeException("Test"));
+ debugger.setDebugSupportProcessor(processor);
+ }
+
+ @Test
+ public void standardIsDebugModeIsFalse() {
+ assertFalse(debugger.isDebugMode());
+ }
+
+ @Test
+ public void resolveDebugModeNoDebugSupportProcessor() {
+ HttpServletRequest request = mock(HttpServletRequest.class);
+ when(request.getParameter(DebugSupport.ODATA_DEBUG_QUERY_PARAMETER)).thenReturn(DebugSupport.ODATA_DEBUG_JSON);
+
+ ServerCoreDebugger localDebugger = new ServerCoreDebugger(OData.newInstance());
+ localDebugger.resolveDebugMode(request);
+ assertFalse(debugger.isDebugMode());
+ }
+
+ @Test
+ public void resolveDebugModeNullParameter() {
+ HttpServletRequest request = mock(HttpServletRequest.class);
+ when(request.getParameter(DebugSupport.ODATA_DEBUG_QUERY_PARAMETER)).thenReturn(null);
+ debugger.resolveDebugMode(request);
+ assertFalse(debugger.isDebugMode());
+ }
+
+ @Test
+ public void resolveDebugModeJsonNotAuthorized() {
+ HttpServletRequest request = mock(HttpServletRequest.class);
+ when(request.getParameter(DebugSupport.ODATA_DEBUG_QUERY_PARAMETER)).thenReturn(DebugSupport.ODATA_DEBUG_JSON);
+
+ DebugSupport debugSupportMock = mock(DebugSupport.class);
+ when(debugSupportMock.isUserAuthorized()).thenReturn(false);
+
+ ServerCoreDebugger localDebugger = new ServerCoreDebugger(OData.newInstance());
+ localDebugger.setDebugSupportProcessor(debugSupportMock);
+
+ localDebugger.resolveDebugMode(request);
+ assertFalse(debugger.isDebugMode());
+ }
+
+ @Test
+ public void failResponse() throws IOException {
+ HttpServletRequest request = mock(HttpServletRequest.class);
+ when(request.getParameter(DebugSupport.ODATA_DEBUG_QUERY_PARAMETER)).thenReturn(DebugSupport.ODATA_DEBUG_JSON);
+ debugger.resolveDebugMode(request);
+ ODataResponse debugResponse = debugger.createDebugResponse(null, null, null, null, null);
+ assertEquals(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), debugResponse.getStatusCode());
+ assertEquals("ODataLibrary: Could not assemble debug response.", IOUtils.toString(debugResponse.getContent()));
+ }
+
+ @Test
+ public void noDebugModeCreateDebugResponseCallMustDoNothing() {
+ ODataResponse odResponse = new ODataResponse();
+ ODataResponse debugResponse = debugger.createDebugResponse(null, odResponse, null, null, null);
+
+ assertEquals(odResponse, debugResponse);
+ }
+}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchLineReaderTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchLineReaderTest.java
new file mode 100644
index 0000000..9861b7f
--- /dev/null
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchLineReaderTest.java
@@ -0,0 +1,257 @@
+/*
+ * 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.deserializer.batch;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.util.List;
+
+import org.junit.Test;
+
+public class BatchLineReaderTest {
+
+ private static final String TEXT_COMBINED = "Test\r" +
+ "Test2\r\n" +
+ "Test3\n" +
+ "Test4\r" +
+ "\r" +
+ "\r\n" +
+ "\r\n" +
+ "Test5\n" +
+ "Test6\r\n" +
+ "Test7\n" +
+ "\n";
+
+ private static final String TEXT_EMPTY = "";
+
+ @Test
+ public void testSimpleText() throws Exception {
+ final String TEXT = "Test";
+ BatchLineReader reader = create(TEXT);
+
+ assertEquals(TEXT, reader.readLine());
+ assertNull(reader.readLine());
+ assertNull(reader.readLine());
+ reader.close();
+ }
+
+ @Test
+ public void testNoText() throws Exception {
+ final String TEXT = "";
+ BatchLineReader reader = create(TEXT);
+
+ assertNull(reader.readLine());
+ assertNull(reader.readLine());
+ reader.close();
+ }
+
+ @Test
+ public void testNoBytes() throws Exception {
+ BatchLineReader reader =
+ new BatchLineReader(new ByteArrayInputStream(new byte[0]));
+
+ assertNull(reader.readLine());
+ assertNull(reader.readLine());
+ reader.close();
+ }
+
+ @Test
+ public void testCRLF() throws Exception {
+ final String TEXT = "Test\r\n" +
+ "Test2";
+
+ BatchLineReader reader = create(TEXT);
+
+ assertEquals("Test\r\n", reader.readLine());
+ assertEquals("Test2", reader.readLine());
+ assertNull(reader.readLine());
+ assertNull(reader.readLine());
+ reader.close();
+ }
+
+ @Test
+ public void testLF() throws Exception {
+ final String TEXT = "Test\n" +
+ "Test2";
+
+ BatchLineReader reader = create(TEXT);
+
+ assertEquals("Test\n", reader.readLine());
+ assertEquals("Test2", reader.readLine());
+ assertNull(reader.readLine());
+ assertNull(reader.readLine());
+ reader.close();
+ }
+
+ @Test
+ public void testCR() throws Exception {
+ final String TEXT = "Test\r" +
+ "Test2";
+
+ BatchLineReader reader = create(TEXT);
+
+ assertEquals("Test\r", reader.readLine());
+ assertEquals("Test2", reader.readLine());
+ assertNull(reader.readLine());
+ assertNull(reader.readLine());
+ reader.close();
+ }
+
+ @Test
+ public void testCombined() throws Exception {
+ BatchLineReader reader = create(TEXT_COMBINED);
+
+ assertEquals("Test\r", reader.readLine());
+ assertEquals("Test2\r\n", reader.readLine());
+ assertEquals("Test3\n", reader.readLine());
+ assertEquals("Test4\r", reader.readLine());
+ assertEquals("\r", reader.readLine());
+ assertEquals("\r\n", reader.readLine());
+ assertEquals("\r\n", reader.readLine());
+ assertEquals("Test5\n", reader.readLine());
+ assertEquals("Test6\r\n", reader.readLine());
+ assertEquals("Test7\n", reader.readLine());
+ assertEquals("\n", reader.readLine());
+ assertNull(reader.readLine());
+ assertNull(reader.readLine());
+ reader.close();
+ }
+
+ @Test
+ public void testCombinedBufferSizeTwo() throws Exception {
+ BatchLineReader reader = create(TEXT_COMBINED, 2);
+
+ assertEquals("Test\r", reader.readLine());
+ assertEquals("Test2\r\n", reader.readLine());
+ assertEquals("Test3\n", reader.readLine());
+ assertEquals("Test4\r", reader.readLine());
+ assertEquals("\r", reader.readLine());
+ assertEquals("\r\n", reader.readLine());
+ assertEquals("\r\n", reader.readLine());
+ assertEquals("Test5\n", reader.readLine());
+ assertEquals("Test6\r\n", reader.readLine());
+ assertEquals("Test7\n", reader.readLine());
+ assertEquals("\n", reader.readLine());
+ assertNull(reader.readLine());
+ assertNull(reader.readLine());
+ reader.close();
+ }
+
+ @Test
+ public void testCombinedBufferSizeOne() throws Exception {
+ final String TEXT = "Test\r" +
+ "Test2\r\n" +
+ "Test3\n" +
+ "Test4\r" +
+ "\r" +
+ "\r\n" +
+ "\r\n" +
+ "Test5\n" +
+ "Test6\r\n" +
+ "Test7\n" +
+ "\r\n";
+
+ BatchLineReader reader = create(TEXT, 1);
+
+ assertEquals("Test\r", reader.readLine());
+ assertEquals("Test2\r\n", reader.readLine());
+ assertEquals("Test3\n", reader.readLine());
+ assertEquals("Test4\r", reader.readLine());
+ assertEquals("\r", reader.readLine());
+ assertEquals("\r\n", reader.readLine());
+ assertEquals("\r\n", reader.readLine());
+ assertEquals("Test5\n", reader.readLine());
+ assertEquals("Test6\r\n", reader.readLine());
+ assertEquals("Test7\n", reader.readLine());
+ assertEquals("\r\n", reader.readLine());
+ assertNull(reader.readLine());
+ assertNull(reader.readLine());
+
+ reader.close();
+ }
+
+ @Test
+ public void testDoubleLF() throws Exception {
+ final String TEXT = "Test\r" +
+ "\r";
+
+ BatchLineReader reader = create(TEXT, 1);
+
+ assertEquals("Test\r", reader.readLine());
+ assertEquals("\r", reader.readLine());
+ reader.close();
+ }
+
+ @Test
+ public void testLineEqualsAndHashCode() {
+ Line l1 = new Line("The first line", 1);
+ Line l2 = new Line("The first line", 1);
+ Line l3 = new Line("The second line", 2);
+
+ assertEquals(l1, l2);
+ assertFalse(l1.equals(l3));
+ assertTrue(l1.hashCode() != l3.hashCode());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testFailBufferSizeZero() throws Exception {
+ BatchLineReader reader = create(TEXT_EMPTY, 0);
+ reader.close();
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testFailBufferSizeNegative() throws Exception {
+ BatchLineReader reader = create(TEXT_EMPTY, -1);
+ reader.close();
+ }
+
+ @Test
+ public void testToList() throws Exception {
+ BatchLineReader reader = create(TEXT_COMBINED);
+ List<Line> stringList = reader.toLineList();
+
+ assertEquals(11, stringList.size());
+ assertEquals("Test\r", stringList.get(0).toString());
+ assertEquals("Test2\r\n", stringList.get(1).toString());
+ assertEquals("Test3\n", stringList.get(2).toString());
+ assertEquals("Test4\r", stringList.get(3).toString());
+ assertEquals("\r", stringList.get(4).toString());
+ assertEquals("\r\n", stringList.get(5).toString());
+ assertEquals("\r\n", stringList.get(6).toString());
+ assertEquals("Test5\n", stringList.get(7).toString());
+ assertEquals("Test6\r\n", stringList.get(8).toString());
+ assertEquals("Test7\n", stringList.get(9).toString());
+ assertEquals("\n", stringList.get(10).toString());
+ reader.close();
+ }
+
+ private BatchLineReader create(final String inputString) throws Exception {
+ return new BatchLineReader(new ByteArrayInputStream(inputString
+ .getBytes("UTF-8")));
+ }
+
+ private BatchLineReader create(final String inputString, final int bufferSize) throws Exception {
+ return new BatchLineReader(new ByteArrayInputStream(inputString
+ .getBytes("UTF-8")), bufferSize);
+ }
+}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommonTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommonTest.java
index 89656ab..137c89a 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommonTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommonTest.java
@@ -44,7 +44,7 @@
final Header header = BatchParserCommon.consumeHeaders(message);
assertNotNull(header);
- final List<String> contentIdHeaders = header.getHeaders(BatchParserCommon.HTTP_CONTENT_ID);
+ final List<String> contentIdHeaders = header.getHeaders(HttpHeader.CONTENT_ID);
assertNotNull(contentIdHeaders);
assertEquals(2, contentIdHeaders.size());
assertEquals("1", contentIdHeaders.get(0));
@@ -64,7 +64,7 @@
final Header header = BatchParserCommon.consumeHeaders(message);
assertNotNull(header);
- final List<String> contentIdHeaders = header.getHeaders(BatchParserCommon.HTTP_CONTENT_ID);
+ final List<String> contentIdHeaders = header.getHeaders(HttpHeader.CONTENT_ID);
assertNotNull(contentIdHeaders);
assertEquals(1, contentIdHeaders.size());
assertEquals("1", contentIdHeaders.get(0));
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java
index a194cc9..e43840d 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java
@@ -32,10 +32,10 @@
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException.MessageKeys;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
import org.apache.olingo.server.api.deserializer.batch.BatchOptions;
import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException.MessageKeys;
import org.junit.Test;
public class BatchRequestParserTest {
@@ -143,7 +143,7 @@
for (ODataRequest request : requests) {
assertEquals(HttpMethod.POST, request.getMethod());
assertEquals("100000", request.getHeader(HttpHeader.CONTENT_LENGTH));
- assertEquals("1", request.getHeader(BatchParserCommon.HTTP_CONTENT_ID));
+ assertEquals("1", request.getHeader(HttpHeader.CONTENT_ID));
assertEquals("application/octet-stream", request.getHeader(HttpHeader.CONTENT_TYPE));
final InputStream body = request.getBody();
@@ -213,7 +213,7 @@
}
@Test
- public void testBoundaryParameterWithQuotas() throws Exception {
+ public void boundaryParameterWithQuotes() throws Exception {
final String contentType = "multipart/mixed; boundary=\"batch_1.2+34:2j)0?\"";
final String boundary = BatchParserCommon.getBoundary(contentType, 0);
final String batch = ""
@@ -250,19 +250,19 @@
}
@Test
- public void testBatchWithoutBoundaryParameter() throws Exception {
+ public void batchWithoutBoundaryParameter() throws Exception {
final String invalidContentType = "multipart/mixed";
try {
BatchParserCommon.getBoundary(invalidContentType, 0);
fail();
} catch (BatchDeserializerException e) {
- assertMessageKey(e, BatchDeserializerException.MessageKeys.INVALID_CONTENT_TYPE);
+ assertMessageKey(e, BatchDeserializerException.MessageKeys.MISSING_BOUNDARY_DELIMITER);
}
}
@Test
- public void testBoundaryParameterWithoutQuota() throws Exception {
+ public void boundaryParameterWithoutQuote() throws Exception {
final String invalidContentType = "multipart/mixed;boundary=batch_1740-bb:84-2f7f";
try {
@@ -917,13 +917,13 @@
assertEquals(1, multipart.getRequests().size());
final ODataRequest retrieveRequest = multipart.getRequests().get(0);
- assertEquals("BBB", retrieveRequest.getHeader(BatchParserCommon.HTTP_CONTENT_ID));
+ assertEquals("BBB", retrieveRequest.getHeader(HttpHeader.CONTENT_ID));
} else {
for (ODataRequest request : multipart.getRequests()) {
if (HttpMethod.POST.equals(request.getMethod())) {
- assertEquals("1", request.getHeader(BatchParserCommon.HTTP_CONTENT_ID));
+ assertEquals("1", request.getHeader(HttpHeader.CONTENT_ID));
} else if (HttpMethod.PUT.equals(request.getMethod())) {
- assertEquals("2", request.getHeader(BatchParserCommon.HTTP_CONTENT_ID));
+ assertEquals("2", request.getHeader(HttpHeader.CONTENT_ID));
assertEquals("/$1/EmployeeName", request.getRawODataPath());
assertEquals("http://localhost/odata/$1/EmployeeName", request.getRawRequestUri());
}
@@ -1147,7 +1147,7 @@
}
@Test
- public void testForddenHeaderAuthorisation() throws Exception {
+ public void forbiddenHeaderAuthorization() throws Exception {
final String batch = ""
+ "--batch_8194-cf13-1f56" + CRLF
+ MIME_HEADERS
@@ -1162,7 +1162,7 @@
}
@Test
- public void testForddenHeaderExpect() throws Exception {
+ public void forbiddenHeaderExpect() throws Exception {
final String batch = ""
+ "--batch_8194-cf13-1f56" + CRLF
+ MIME_HEADERS
@@ -1177,7 +1177,7 @@
}
@Test
- public void testForddenHeaderFrom() throws Exception {
+ public void forbiddenHeaderFrom() throws Exception {
final String batch = ""
+ "--batch_8194-cf13-1f56" + CRLF
+ MIME_HEADERS
@@ -1192,7 +1192,7 @@
}
@Test
- public void testForddenHeaderRange() throws Exception {
+ public void forbiddenHeaderRange() throws Exception {
final String batch = ""
+ "--batch_8194-cf13-1f56" + CRLF
+ MIME_HEADERS
@@ -1207,7 +1207,7 @@
}
@Test
- public void testForddenHeaderMaxForwards() throws Exception {
+ public void forbiddenHeaderMaxForwards() throws Exception {
final String batch = ""
+ "--batch_8194-cf13-1f56" + CRLF
+ MIME_HEADERS
@@ -1222,7 +1222,7 @@
}
@Test
- public void testForddenHeaderTE() throws Exception {
+ public void forbiddenHeaderTE() throws Exception {
final String batch = ""
+ "--batch_8194-cf13-1f56" + CRLF
+ MIME_HEADERS
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BufferedReaderIncludingLineEndingsTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BufferedReaderIncludingLineEndingsTest.java
deleted file mode 100644
index 4a41dc6..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BufferedReaderIncludingLineEndingsTest.java
+++ /dev/null
@@ -1,481 +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.server.core.deserializer.batch;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStreamReader;
-import java.util.List;
-
-import org.junit.Test;
-
-public class BufferedReaderIncludingLineEndingsTest {
-
- private static final String TEXT_COMBINED = "Test\r" +
- "Test2\r\n" +
- "Test3\n" +
- "Test4\r" +
- "\r" +
- "\r\n" +
- "\r\n" +
- "Test5\n" +
- "Test6\r\n" +
- "Test7\n" +
- "\n";
-
- private static final String TEXT_SMALL = "Test\r" +
- "123";
- private static final String TEXT_EMPTY = "";
-
- @Test
- public void testSimpleText() throws Exception {
- final String TEXT = "Test";
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertEquals(TEXT, reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testNoText() throws Exception {
- final String TEXT = "";
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testNoBytes() throws Exception {
- BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(new ByteArrayInputStream(new byte[0])));
-
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testCRLF() throws Exception {
- final String TEXT = "Test\r\n" +
- "Test2";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertEquals("Test\r\n", reader.readLine());
- assertEquals("Test2", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testLF() throws Exception {
- final String TEXT = "Test\n" +
- "Test2";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertEquals("Test\n", reader.readLine());
- assertEquals("Test2", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testCR() throws Exception {
- final String TEXT = "Test\r" +
- "Test2";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertEquals("Test\r", reader.readLine());
- assertEquals("Test2", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testCombined() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_COMBINED);
-
- assertEquals("Test\r", reader.readLine());
- assertEquals("Test2\r\n", reader.readLine());
- assertEquals("Test3\n", reader.readLine());
- assertEquals("Test4\r", reader.readLine());
- assertEquals("\r", reader.readLine());
- assertEquals("\r\n", reader.readLine());
- assertEquals("\r\n", reader.readLine());
- assertEquals("Test5\n", reader.readLine());
- assertEquals("Test6\r\n", reader.readLine());
- assertEquals("Test7\n", reader.readLine());
- assertEquals("\n", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testCombinedBufferSizeTwo() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_COMBINED, 2);
-
- assertEquals("Test\r", reader.readLine());
- assertEquals("Test2\r\n", reader.readLine());
- assertEquals("Test3\n", reader.readLine());
- assertEquals("Test4\r", reader.readLine());
- assertEquals("\r", reader.readLine());
- assertEquals("\r\n", reader.readLine());
- assertEquals("\r\n", reader.readLine());
- assertEquals("Test5\n", reader.readLine());
- assertEquals("Test6\r\n", reader.readLine());
- assertEquals("Test7\n", reader.readLine());
- assertEquals("\n", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testCombinedBufferSizeOne() throws Exception {
- final String TEXT = "Test\r" +
- "Test2\r\n" +
- "Test3\n" +
- "Test4\r" +
- "\r" +
- "\r\n" +
- "\r\n" +
- "Test5\n" +
- "Test6\r\n" +
- "Test7\n" +
- "\r\n";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT, 1);
-
- assertEquals("Test\r", reader.readLine());
- assertEquals("Test2\r\n", reader.readLine());
- assertEquals("Test3\n", reader.readLine());
- assertEquals("Test4\r", reader.readLine());
- assertEquals("\r", reader.readLine());
- assertEquals("\r\n", reader.readLine());
- assertEquals("\r\n", reader.readLine());
- assertEquals("Test5\n", reader.readLine());
- assertEquals("Test6\r\n", reader.readLine());
- assertEquals("Test7\n", reader.readLine());
- assertEquals("\r\n", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
-
- reader.close();
- }
-
- @Test
- public void testDoubleLF() throws Exception {
- final String TEXT = "Test\r" +
- "\r";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT, 1);
-
- assertEquals("Test\r", reader.readLine());
- assertEquals("\r", reader.readLine());
- reader.close();
- }
-
- @Test
- public void testSkipSimple() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_SMALL);
-
- assertEquals(5, reader.skip(5)); // Test\r
- assertEquals("123", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testSkipBufferOne() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_SMALL, 1);
-
- assertEquals(5, reader.skip(5)); // Test\r
- assertEquals("123", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testReadThanSkip() throws Exception {
- final String TEXT = "Test\r" +
- "\r" +
- "123";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertEquals("Test\r", reader.readLine());
- assertEquals(1, reader.skip(1)); // Test\r
- assertEquals("123", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testReadMoreBufferCapacityThanCharacterAvailable() throws Exception {
- final String TEXT = "Foo";
- char[] buffer = new char[20];
-
- BufferedReaderIncludingLineEndings reader = create(TEXT);
- assertEquals(3, reader.read(buffer, 0, 20));
- assertEquals(-1, reader.read(buffer, 0, 20));
- reader.close();
-
- BufferedReaderIncludingLineEndings readerBufferOne = create(TEXT, 1);
- assertEquals(3, readerBufferOne.read(buffer, 0, 20));
- assertEquals(-1, readerBufferOne.read(buffer, 0, 20));
- readerBufferOne.close();
- }
-
- @Test
- public void testSkipZero() throws Exception {
- final String TEXT = "Test\r" +
- "123\r\n";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertEquals(0, reader.skip(0)); // Test\r
- assertEquals("Test\r", reader.readLine());
- assertEquals("123\r\n", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testSkipToMuch() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_SMALL);
-
- assertEquals(8, reader.skip(10)); // Test\r
- assertEquals(null, reader.readLine());
- reader.close();
- }
-
- @Test
- public void testReadBufferOne() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_SMALL, 1);
-
- assertEquals('T', reader.read());
- assertEquals('e', reader.read());
- assertEquals('s', reader.read());
- assertEquals('t', reader.read());
- assertEquals('\r', reader.read());
- assertEquals('1', reader.read());
- assertEquals('2', reader.read());
- assertEquals('3', reader.read());
- assertEquals(-1, reader.read());
- assertEquals(-1, reader.read());
- }
-
- @Test
- public void testReadZeroBytes() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_SMALL, 1);
-
- char[] buffer = new char[3];
- assertEquals(0, reader.read(buffer, 0, 0));
- assertEquals('T', reader.read());
- assertEquals(0, reader.read(buffer, 0, 0));
- assertEquals("est\r", reader.readLine());
- assertEquals("123", reader.readLine());
-
- reader.close();
- }
-
- @Test
- public void testRead() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_SMALL);
-
- assertEquals('T', reader.read());
- assertEquals('e', reader.read());
- assertEquals('s', reader.read());
- assertEquals('t', reader.read());
- assertEquals('\r', reader.read());
- assertEquals('1', reader.read());
- assertEquals('2', reader.read());
- assertEquals('3', reader.read());
- assertEquals(-1, reader.read());
- assertEquals(-1, reader.read());
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testFailReadBufferAndOffsetBiggerThanBuffer() throws Exception {
- BufferedReaderIncludingLineEndings reader = create("");
-
- final char[] buffer = new char[3];
- reader.read(buffer, 1, 3);
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testFailLengthNegative() throws Exception {
- final char[] buffer = new char[3];
- BufferedReaderIncludingLineEndings reader = create("123");
-
- reader.read(buffer, 1, -2);
- reader.close();
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testFailOffsetNegative() throws Exception {
- final char[] buffer = new char[3];
- BufferedReaderIncludingLineEndings reader = create("123");
-
- reader.read(buffer, -1, 2);
- reader.close();
- }
-
- @Test
- public void testReadAndReadLine() throws Exception {
- final String TEXT = "Test\r" +
- "bar\n" +
- "123\r\n" +
- "foo";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertEquals('T', reader.read());
- assertEquals('e', reader.read());
- assertEquals('s', reader.read());
- assertEquals('t', reader.read());
- assertEquals("\r", reader.readLine());
- assertEquals("bar\n", reader.readLine());
- assertEquals('1', reader.read());
- assertEquals('2', reader.read());
- assertEquals("3\r\n", reader.readLine());
- assertEquals("foo", reader.readLine());
- assertEquals(null, reader.readLine());
- assertEquals(-1, reader.read());
- }
-
- @Test
- public void testLineEqualsAndHashCode() {
- Line l1 = new Line("The first line", 1);
- Line l2 = new Line("The first line", 1);
- Line l3 = new Line("The second line", 2);
-
- assertEquals(l1, l2);
- assertFalse(l1.equals(l3));
- assertTrue(l1.hashCode() != l3.hashCode());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSkipNegative() throws Exception {
- BufferedReaderIncludingLineEndings reader = create("123");
- reader.skip(-1);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testFailBufferSizeZero() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_EMPTY, 0);
- reader.close();
- }
-
- @Test(expected = NullPointerException.class)
- public void testInputStreamIsNull() throws Exception {
- // Same behaviour like BufferedReader
- BufferedReaderIncludingLineEndings reader = new BufferedReaderIncludingLineEndings(null);
- reader.close();
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testFailBufferSizeNegative() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_EMPTY, -1);
- reader.close();
- }
-
- @Test
- public void testMarkSupoorted() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_EMPTY);
-
- assertEquals(false, reader.markSupported());
- reader.close();
- }
-
- @Test(expected = Exception.class)
- public void testFailMark() throws Exception {
- BufferedReaderIncludingLineEndings reader = create("123");
-
- reader.mark(1);
- }
-
- @Test(expected = Exception.class)
- public void testFailReset() throws Exception {
- BufferedReaderIncludingLineEndings reader = create("123");
-
- reader.reset();
- }
-
- @Test
- public void testReady() throws Exception {
- BufferedReaderIncludingLineEndings reader = create("123\r123");
- assertEquals(false, reader.ready());
- assertEquals("123\r", reader.readLine());
- assertEquals(true, reader.ready());
- assertEquals("123", reader.readLine());
- assertEquals(false, reader.ready());
-
- reader.close();
- }
-
- @Test
- public void testToList() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_COMBINED);
- List<Line> stringList = reader.toLineList();
-
- assertEquals(11, stringList.size());
- assertEquals("Test\r", stringList.get(0).toString());
- assertEquals("Test2\r\n", stringList.get(1).toString());
- assertEquals("Test3\n", stringList.get(2).toString());
- assertEquals("Test4\r", stringList.get(3).toString());
- assertEquals("\r", stringList.get(4).toString());
- assertEquals("\r\n", stringList.get(5).toString());
- assertEquals("\r\n", stringList.get(6).toString());
- assertEquals("Test5\n", stringList.get(7).toString());
- assertEquals("Test6\r\n", stringList.get(8).toString());
- assertEquals("Test7\n", stringList.get(9).toString());
- assertEquals("\n", stringList.get(10).toString());
- reader.close();
- }
-
- private BufferedReaderIncludingLineEndings create(final String inputString) throws Exception {
- return new BufferedReaderIncludingLineEndings(new InputStreamReader(new ByteArrayInputStream(inputString
- .getBytes("UTF-8"))));
- }
-
- private BufferedReaderIncludingLineEndings create(final String inputString, final int bufferSize) throws Exception {
- return new BufferedReaderIncludingLineEndings(new InputStreamReader(new ByteArrayInputStream(inputString
- .getBytes("UTF-8"))), bufferSize);
- }
-
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/HeaderTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/HeaderTest.java
index 6ab6491..ad3b2db 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/HeaderTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/HeaderTest.java
@@ -19,7 +19,6 @@
package org.apache.olingo.server.core.deserializer.batch;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@@ -48,7 +47,6 @@
assertNull(header.getHeader(HttpHeader.CONTENT_TYPE));
assertEquals(0, header.getHeaders(HttpHeader.CONTENT_TYPE).size());
- assertEquals("", header.getHeaderNotNull(HttpHeader.CONTENT_TYPE));
}
@Test
@@ -73,14 +71,6 @@
}
@Test
- public void testMatcher() {
- Header header = new Header(1);
- header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED + ";boundary=123", 1);
-
- assertTrue(header.isHeaderMatching(HttpHeader.CONTENT_TYPE, BatchParserCommon.PATTERN_MULTIPART_BOUNDARY));
- }
-
- @Test
public void testFieldName() {
Header header = new Header(0);
header.addHeader("MyFieldNamE", "myValue", 1);
@@ -108,13 +98,6 @@
}
@Test
- public void testMatcherNoHeader() {
- Header header = new Header(1);
-
- assertFalse(header.isHeaderMatching(HttpHeader.CONTENT_TYPE, BatchParserCommon.PATTERN_MULTIPART_BOUNDARY));
- }
-
- @Test
public void testDuplicatedAddList() {
Header header = new Header(1);
header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED, 1);
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/HttpRequestStatusLineTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/HttpRequestStatusLineTest.java
index f859481..1d3bb1f 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/HttpRequestStatusLineTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/HttpRequestStatusLineTest.java
@@ -22,8 +22,8 @@
import static org.junit.Assert.fail;
import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException.MessageKeys;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException;
+import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerException.MessageKeys;
import org.junit.Test;
public class HttpRequestStatusLineTest {
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerBasicTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerBasicTest.java
index 053dd07..c73acab 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerBasicTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerBasicTest.java
@@ -26,7 +26,7 @@
import java.net.URI;
import java.util.List;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.deserializer.ODataDeserializer;
@@ -36,15 +36,15 @@
@Test
public void checkSupportedJsonFormats() throws Exception {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ContentType.JSON);
assertNotNull(deserializer);
deserializer = null;
- deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON_NO_METADATA);
+ deserializer = OData.newInstance().createDeserializer(ContentType.JSON_NO_METADATA);
assertNotNull(deserializer);
deserializer = null;
- deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON_FULL_METADATA);
+ deserializer = OData.newInstance().createDeserializer(ContentType.JSON_FULL_METADATA);
assertNotNull(deserializer);
deserializer = null;
}
@@ -58,7 +58,7 @@
" { \"@odata.id\": \"Orders(10759)\" }\n" +
" ]\n" +
"}";
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ContentType.JSON);
List<URI> values = deserializer.entityReferences(new ByteArrayInputStream(payload.getBytes()))
.getEntityReferences();
assertEquals(2, values.size());
@@ -72,13 +72,13 @@
" \"@odata.context\": \"http://host/service/$metadata#$ref\",\n" +
" \"@odata.id\": \"Orders(10643)\"\n" +
"}";
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ContentType.JSON);
List<URI> values = deserializer.entityReferences(new ByteArrayInputStream(payload
.getBytes())).getEntityReferences();
assertEquals(1, values.size());
assertEquals("Orders(10643)", values.get(0).toASCIIString());
}
-
+
@Test
public void reference() throws Exception {
String entityString = "{"
@@ -87,84 +87,84 @@
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ContentType.JSON);
final List<URI> entityReferences = deserializer.entityReferences(stream).getEntityReferences();
-
+
assertEquals(1, entityReferences.size());
assertEquals("ESAllPrim(0)", entityReferences.get(0).toASCIIString());
}
-
+
@Test
public void references() throws Exception {
- String entityString = "{" +
- " \"@odata.context\": \"$metadata#Collection($ref)\"," +
- " \"value\": [" +
- " { \"@odata.id\": \"ESAllPrim(0)\" }," +
- " { \"@odata.id\": \"ESAllPrim(1)\" }" +
- " ]" +
+ String entityString = "{" +
+ " \"@odata.context\": \"$metadata#Collection($ref)\"," +
+ " \"value\": [" +
+ " { \"@odata.id\": \"ESAllPrim(0)\" }," +
+ " { \"@odata.id\": \"ESAllPrim(1)\" }" +
+ " ]" +
"}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ContentType.JSON);
final List<URI> entityReferences = deserializer.entityReferences(stream).getEntityReferences();
-
+
assertEquals(2, entityReferences.size());
assertEquals("ESAllPrim(0)", entityReferences.get(0).toASCIIString());
assertEquals("ESAllPrim(1)", entityReferences.get(1).toASCIIString());
}
-
+
@Test
public void referencesWithOtherAnnotations() throws Exception {
- String entityString = "{" +
- " \"@odata.context\": \"$metadata#Collection($ref)\"," +
- " \"value\": [" +
- " { \"@odata.id\": \"ESAllPrim(0)\" }," +
- " { \"@odata.nonExistingODataAnnotation\": \"ESAllPrim(1)\" }" +
- " ]" +
+ String entityString = "{" +
+ " \"@odata.context\": \"$metadata#Collection($ref)\"," +
+ " \"value\": [" +
+ " { \"@odata.id\": \"ESAllPrim(0)\" }," +
+ " { \"@odata.nonExistingODataAnnotation\": \"ESAllPrim(1)\" }" +
+ " ]" +
"}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ContentType.JSON);
final List<URI> entityReferences = deserializer.entityReferences(stream).getEntityReferences();
-
+
assertEquals(1, entityReferences.size());
assertEquals("ESAllPrim(0)", entityReferences.get(0).toASCIIString());
}
-
+
@Test
public void referencesWithCustomAnnotation() throws Exception {
- String entityString = "{" +
- " \"@odata.context\": \"$metadata#Collection($ref)\"," +
- " \"value\": [" +
- " { \"@odata.id\": \"ESAllPrim(0)\" }," +
- " { \"@invalid\": \"ESAllPrim(1)\" }" +
- " ]" +
+ String entityString = "{" +
+ " \"@odata.context\": \"$metadata#Collection($ref)\"," +
+ " \"value\": [" +
+ " { \"@odata.id\": \"ESAllPrim(0)\" }," +
+ " { \"@invalid\": \"ESAllPrim(1)\" }" +
+ " ]" +
"}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ContentType.JSON);
final List<URI> entityReferences = deserializer.entityReferences(stream).getEntityReferences();
-
+
assertEquals(1, entityReferences.size());
assertEquals("ESAllPrim(0)", entityReferences.get(0).toASCIIString());
}
-
+
@Test
public void referenceEmpty() throws Exception {
- String entityString = "{" +
- " \"@odata.context\": \"$metadata#Collection($ref)\"," +
- " \"value\": [" +
- " ]" +
+ String entityString = "{" +
+ " \"@odata.context\": \"$metadata#Collection($ref)\"," +
+ " \"value\": [" +
+ " ]" +
"}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ContentType.JSON);
final List<URI> entityReferences = deserializer.entityReferences(stream).getEntityReferences();
-
+
assertEquals(0, entityReferences.size());
}
-
- @Test(expected=DeserializerException.class)
+
+ @Test(expected = DeserializerException.class)
public void referencesEmpty() throws Exception {
/*
* See OData JSON Format chaper 13
@@ -173,21 +173,21 @@
String entityString = "{ }";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ContentType.JSON);
final List<URI> entityReferences = deserializer.entityReferences(stream).getEntityReferences();
-
+
assertEquals(0, entityReferences.size());
}
-
- @Test(expected=DeserializerException.class)
+
+ @Test(expected = DeserializerException.class)
public void referenceValueIsNotAnArray() throws Exception {
- String entityString = "{" +
- " \"@odata.context\": \"$metadata#Collection($ref)\"," +
- " \"value\": \"ESAllPrim(0)\"" + // This is not allowed. Value must be followed by an array
+ String entityString = "{" +
+ " \"@odata.context\": \"$metadata#Collection($ref)\"," +
+ " \"value\": \"ESAllPrim(0)\"" + // This is not allowed. Value must be followed by an array
"}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ContentType.JSON);
deserializer.entityReferences(stream);
}
}
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 b7017ec..82aa145 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
@@ -29,7 +29,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.EdmActionImport;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
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 f87c47f..25dcb03 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
@@ -51,6 +51,7 @@
public class EdmEnumTest {
private final EdmEnumType instance;
+ private final EdmEnumType otherInstance;
private final EdmEnumType nonFlagsInstance;
private final EdmEnumType int16EnumType;
private final EdmEnumType int32EnumType;
@@ -66,6 +67,10 @@
instance = new EdmEnumTypeImpl(mock(EdmProviderImpl.class), enumName,
new CsdlEnumType().setName("name").setMembers(memberList).setFlags(true)
.setUnderlyingType(EdmPrimitiveTypeKind.SByte.getFullQualifiedName()));
+
+ otherInstance = new EdmEnumTypeImpl(mock(EdmProviderImpl.class), enumName,
+ new CsdlEnumType().setName("name").setMembers(memberList).setFlags(true)
+ .setUnderlyingType(EdmPrimitiveTypeKind.SByte.getFullQualifiedName()));
nonFlagsInstance = new EdmEnumTypeImpl(mock(EdmProviderImpl.class), enumName,
new CsdlEnumType().setName("name").setMembers(memberList).setFlags(false)
@@ -128,6 +133,7 @@
@Test
public void compatibility() {
assertTrue(instance.isCompatible(instance));
+ assertTrue(instance.isCompatible(otherInstance));
assertFalse(instance.isCompatible(instance.getUnderlyingType()));
}
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 1456c37..c094b1d 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
@@ -30,7 +30,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
@@ -125,24 +125,24 @@
try {
localEdm.getUnboundAction(fqn);
} catch (EdmException e) {
- assertEquals("org.apache.olingo.commons.api.ODataException: msg", e.getMessage());
+ assertEquals("org.apache.olingo.commons.api.ex.ODataException: msg", e.getMessage());
}
try {
localEdm.getUnboundFunction(fqn, null);
} catch (EdmException e) {
- assertEquals("org.apache.olingo.commons.api.ODataException: msg", e.getMessage());
+ assertEquals("org.apache.olingo.commons.api.ex.ODataException: msg", e.getMessage());
}
try {
localEdm.getBoundAction(fqn, fqn, true);
} catch (EdmException e) {
- assertEquals("org.apache.olingo.commons.api.ODataException: msg", e.getMessage());
+ assertEquals("org.apache.olingo.commons.api.ex.ODataException: msg", e.getMessage());
}
try {
localEdm.getBoundFunction(fqn, fqn, true, null);
} catch (EdmException e) {
- assertEquals("org.apache.olingo.commons.api.ODataException: msg", e.getMessage());
+ assertEquals("org.apache.olingo.commons.api.ex.ODataException: msg", e.getMessage());
}
}
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 3714046..fd344c5 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
@@ -27,7 +27,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmAction;
import org.apache.olingo.commons.api.edm.EdmActionImport;
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/prefer/PreferencesTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/prefer/PreferencesTest.java
new file mode 100644
index 0000000..b0e8d74
--- /dev/null
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/prefer/PreferencesTest.java
@@ -0,0 +1,168 @@
+/*
+ * 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.prefer;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.olingo.server.api.prefer.Preferences;
+import org.apache.olingo.server.api.prefer.Preferences.Preference;
+import org.apache.olingo.server.api.prefer.Preferences.Return;
+import org.junit.Test;
+
+public class PreferencesTest {
+
+ @Test
+ public void empty() {
+ final Preferences preferences = new PreferencesImpl(null);
+ assertFalse(preferences.hasAllowEntityReferences());
+ assertNull(preferences.getCallback());
+ assertFalse(preferences.hasContinueOnError());
+ assertNull(preferences.getMaxPageSize());
+ assertFalse(preferences.hasTrackChanges());
+ assertNull(preferences.getReturn());
+ assertFalse(preferences.hasRespondAsync());
+ assertNull(preferences.getWait());
+ }
+
+ @Test
+ public void all() {
+ final Preferences preferences = new PreferencesImpl(Collections.singleton(
+ "odata.allow-entityreferences, odata.callback;url=\"callbackURI\","
+ + "odata.continue-on-error, odata.include-annotations=\"*\", odata.maxpagesize=42,"
+ + "odata.track-changes, return=representation, respond-async, wait=12345"));
+ assertTrue(preferences.hasAllowEntityReferences());
+ assertEquals(URI.create("callbackURI"), preferences.getCallback());
+ assertNotNull(preferences.getPreference("odata.callback"));
+ assertNull(preferences.getPreference("odata.callback").getValue());
+ assertEquals("callbackURI", preferences.getPreference("odata.callback").getParameters().get("url"));
+ assertTrue(preferences.hasContinueOnError());
+ assertEquals("*", preferences.getPreference("odata.Include-Annotations").getValue());
+ assertEquals(Integer.valueOf(42), preferences.getMaxPageSize());
+ assertEquals("42", preferences.getPreference("odata.MaxPageSize").getValue());
+ assertTrue(preferences.hasTrackChanges());
+ assertEquals(Return.REPRESENTATION, preferences.getReturn());
+ assertTrue(preferences.hasRespondAsync());
+ assertEquals(Integer.valueOf(12345), preferences.getWait());
+ }
+
+ @Test
+ public void caseSensitivity() {
+ final Preferences preferences = new PreferencesImpl(Collections.singleton(
+ "OData.Callback;URL=\"callbackURI\", return=REPRESENTATION, Wait=42"));
+ assertEquals(URI.create("callbackURI"), preferences.getCallback());
+ assertNull(preferences.getReturn());
+ assertEquals(Integer.valueOf(42), preferences.getWait());
+ }
+
+ @Test
+ public void multipleValues() {
+ final Preferences preferences = new PreferencesImpl(Collections.singleton(
+ ",return=minimal, ,, return=representation, wait=1, wait=2, wait=3,"));
+ assertEquals(Return.MINIMAL, preferences.getReturn());
+ assertEquals(Integer.valueOf(1), preferences.getWait());
+ }
+
+ @Test
+ public void multipleValuesDifferentHeaders() {
+ final Preferences preferences = new PreferencesImpl(Arrays.asList(
+ null, "",
+ "return=representation, wait=1",
+ "return=minimal, wait=2",
+ "wait=3"));
+ assertEquals(Return.REPRESENTATION, preferences.getReturn());
+ assertEquals(Integer.valueOf(1), preferences.getWait());
+ }
+
+ @Test
+ public void multipleParameters() {
+ final Preferences preferences = new PreferencesImpl(Collections.singleton(
+ "preference=a;;b=c; d = e; f;; ; g; h=\"i\";, wait=42"));
+ final Preference preference = preferences.getPreference("preference");
+ assertEquals("a", preference.getValue());
+ final Map<String, String> parameters = preference.getParameters();
+ assertEquals(5, parameters.size());
+ assertEquals("c", parameters.get("b"));
+ assertEquals("e", parameters.get("d"));
+ assertTrue(parameters.containsKey("f"));
+ assertNull(parameters.get("f"));
+ assertTrue(parameters.containsKey("g"));
+ assertNull(parameters.get("g"));
+ assertEquals("i", parameters.get("h"));
+ assertEquals(Integer.valueOf(42), preferences.getWait());
+ }
+
+ @Test
+ public void quotedValue() {
+ final Preferences preferences = new PreferencesImpl(Collections.singleton(
+ "strangePreference=\"x\\\\y,\\\"abc\\\"z\", wait=42"));
+ assertEquals("x\\y,\"abc\"z", preferences.getPreference("strangePreference").getValue());
+ assertEquals(Integer.valueOf(42), preferences.getWait());
+ }
+
+ @Test
+ public void specialCharacters() {
+ final Preferences preferences = new PreferencesImpl(Collections.singleton(
+ "!#$%&'*+-.^_`|~ = \"!#$%&'()*+,-./:;<=>?@[]^_`{|}~¡\u00FF\", wait=42"));
+ assertEquals("!#$%&'()*+,-./:;<=>?@[]^_`{|}~¡\u00FF",
+ preferences.getPreference("!#$%&'*+-.^_`|~").getValue());
+ assertEquals(Integer.valueOf(42), preferences.getWait());
+ }
+
+ @Test
+ public void wrongContent() {
+ final Preferences preferences = new PreferencesImpl(Arrays.asList(
+ "odata.callback;url=\":\"",
+ "odata.maxpagesize=12345678901234567890",
+ "return=something",
+ "wait=-1"));
+ assertNull(preferences.getCallback());
+ assertEquals(":", preferences.getPreference("odata.callback").getParameters().get("url"));
+ assertNull(preferences.getMaxPageSize());
+ assertEquals("12345678901234567890", preferences.getPreference("odata.maxpagesize").getValue());
+ assertNull(preferences.getReturn());
+ assertEquals("something", preferences.getPreference("return").getValue());
+ assertNull(preferences.getWait());
+ assertEquals("-1", preferences.getPreference("wait").getValue());
+ }
+
+ @Test
+ public void wrongFormat() {
+ final Preferences preferences = new PreferencesImpl(Arrays.asList(
+ "return=, wait=1",
+ "return=;, wait=2",
+ "return=representation=, wait=3",
+ "return=\"representation\"respond-async, wait=4",
+ "respond-async[], wait=5",
+ "odata.callback;=, wait=6",
+ "odata.callback;url=, wait=7",
+ "odata.callback;[], wait=8",
+ "odata.callback;url=\"url\"parameter, wait=9",
+ "wait=10"));
+ assertEquals(Integer.valueOf(10), preferences.getWait());
+ }
+}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/AsyncResponseSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/AsyncResponseSerializerTest.java
new file mode 100644
index 0000000..b720cb7
--- /dev/null
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/AsyncResponseSerializerTest.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.server.core.serializer;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataResponse;
+import org.junit.Test;
+
+import java.io.InputStream;
+import java.util.Random;
+
+import static org.junit.Assert.assertEquals;
+
+public class AsyncResponseSerializerTest {
+ private static final String CRLF = "\r\n";
+
+ @Test
+ public void testSimpleResponse() throws Exception {
+ ODataResponse response = new ODataResponse();
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_JSON.toContentTypeString());
+ response.setHeader(HttpHeader.CONTENT_LENGTH, String.valueOf(200));
+
+ response.setContent(IOUtils.toInputStream("Walter Winter" + CRLF));
+
+ AsyncResponseSerializer serializer = new AsyncResponseSerializer();
+ InputStream in = serializer.serialize(response);
+ String result = IOUtils.toString(in);
+ assertEquals("HTTP/1.1 200 OK" + CRLF +
+ "Content-Length: 200" + CRLF +
+ "Content-Type: application/json" + CRLF + CRLF +
+ "Walter Winter" + CRLF, result);
+ }
+
+ @Test
+ public void testBiggerResponse() throws Exception {
+ ODataResponse response = new ODataResponse();
+ response.setStatusCode(HttpStatusCode.ACCEPTED.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_JSON.toContentTypeString());
+ response.setHeader(HttpHeader.CONTENT_LENGTH, String.valueOf(0));
+
+ String testData = testData(20000);
+ response.setContent(IOUtils.toInputStream(testData));
+
+ AsyncResponseSerializer serializer = new AsyncResponseSerializer();
+ InputStream in = serializer.serialize(response);
+ String result = IOUtils.toString(in);
+ assertEquals("HTTP/1.1 202 Accepted" + CRLF +
+ "Content-Length: 0" + CRLF +
+ "Content-Type: application/json" + CRLF + CRLF +
+ testData, result);
+ }
+
+ private String testData(int amount) {
+ StringBuilder result = new StringBuilder();
+ Random r = new Random();
+ for (int i = 0; i < amount; i++) {
+ result.append((char)(r.nextInt(26) + 'a'));
+ }
+
+ return result.toString();
+ }
+}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/BatchResponseSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/BatchResponseSerializerTest.java
index e9e5868..b57340d 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/BatchResponseSerializerTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/BatchResponseSerializerTest.java
@@ -22,31 +22,35 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import java.io.InputStreamReader;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
+import java.util.Random;
import java.util.UUID;
import org.apache.commons.io.IOUtils;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
-import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
-import org.apache.olingo.server.core.deserializer.batch.BufferedReaderIncludingLineEndings;
+import org.apache.olingo.server.core.deserializer.batch.BatchLineReader;
import org.junit.Test;
public class BatchResponseSerializerTest {
private static final String CRLF = "\r\n";
private static final String BOUNDARY = "batch_" + UUID.randomUUID().toString();
+ private static final Charset CS_ISO_8859_1 = Charset.forName("iso-8859-1");
+
@Test
public void testBatchResponse() throws Exception {
final List<ODataResponsePart> parts = new ArrayList<ODataResponsePart>();
ODataResponse response = new ODataResponse();
response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, "application/json");
+ response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_JSON.toContentTypeString());
response.setContent(IOUtils.toInputStream("Walter Winter" + CRLF));
List<ODataResponse> responses = new ArrayList<ODataResponse>(1);
@@ -55,7 +59,7 @@
ODataResponse changeSetResponse = new ODataResponse();
changeSetResponse.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
- changeSetResponse.setHeader(BatchParserCommon.HTTP_CONTENT_ID, "1");
+ changeSetResponse.setHeader(HttpHeader.CONTENT_ID, "1");
responses = new ArrayList<ODataResponse>(1);
responses.add(changeSetResponse);
parts.add(new ODataResponsePart(responses, true));
@@ -63,8 +67,8 @@
BatchResponseSerializer serializer = new BatchResponseSerializer();
final InputStream content = serializer.serialize(parts, BOUNDARY);
assertNotNull(content);
- final BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(content));
+ final BatchLineReader reader =
+ new BatchLineReader(content);
final List<String> body = reader.toList();
reader.close();
@@ -86,7 +90,219 @@
assertTrue(body.get(line++).contains("--changeset_"));
assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
- assertEquals("Content-Id: 1" + CRLF, body.get(line++));
+ assertEquals("Content-ID: 1" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertEquals("HTTP/1.1 204 No Content" + CRLF, body.get(line++));
+ assertEquals("Content-Length: 0" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertTrue(body.get(line++).contains("--changeset_"));
+ assertTrue(body.get(line++).contains("--batch_"));
+ }
+
+ @Test
+ public void testBatchResponseUmlautsUtf8() throws Exception {
+ final List<ODataResponsePart> parts = new ArrayList<ODataResponsePart>();
+ ODataResponse response = new ODataResponse();
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE,
+ ContentType.APPLICATION_JSON.toContentTypeString() + "; charset=UTF-8");
+ response.setContent(IOUtils.toInputStream("Wälter Winter" + CRLF));
+
+ List<ODataResponse> responses = new ArrayList<ODataResponse>(1);
+ responses.add(response);
+ parts.add(new ODataResponsePart(responses, false));
+
+ ODataResponse changeSetResponse = new ODataResponse();
+ changeSetResponse.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ changeSetResponse.setHeader(HttpHeader.CONTENT_ID, "1");
+ responses = new ArrayList<ODataResponse>(1);
+ responses.add(changeSetResponse);
+ parts.add(new ODataResponsePart(responses, true));
+
+ BatchResponseSerializer serializer = new BatchResponseSerializer();
+ final InputStream content = serializer.serialize(parts, BOUNDARY);
+ assertNotNull(content);
+ final BatchLineReader reader =
+ new BatchLineReader(content);
+ final List<String> body = reader.toList();
+ reader.close();
+
+ int line = 0;
+ assertEquals(24, body.size());
+ assertTrue(body.get(line++).contains("--batch_"));
+ assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
+ assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertEquals("HTTP/1.1 200 OK" + CRLF, body.get(line++));
+ assertEquals("Content-Type: application/json; charset=UTF-8" + CRLF, body.get(line++));
+ assertEquals("Content-Length: 16" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertEquals("Wälter Winter" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertTrue(body.get(line++).contains("--batch_"));
+ assertTrue(body.get(line++).contains("Content-Type: multipart/mixed; boundary=changeset_"));
+ assertEquals(CRLF, body.get(line++));
+ assertTrue(body.get(line++).contains("--changeset_"));
+ assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
+ assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
+ assertEquals("Content-ID: 1" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertEquals("HTTP/1.1 204 No Content" + CRLF, body.get(line++));
+ assertEquals("Content-Length: 0" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertTrue(body.get(line++).contains("--changeset_"));
+ assertTrue(body.get(line++).contains("--batch_"));
+ }
+
+ @Test
+ public void testBatchResponseUmlautsUtf8BodyIsoHeader() throws Exception {
+ final List<ODataResponsePart> parts = new ArrayList<ODataResponsePart>();
+ ODataResponse response = new ODataResponse();
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE,
+ ContentType.APPLICATION_JSON.toContentTypeString() + "; charset=UTF-8");
+ response.setContent(IOUtils.toInputStream("Wälter Winter" + CRLF));
+
+ List<ODataResponse> responses = new ArrayList<ODataResponse>(1);
+ responses.add(response);
+ parts.add(new ODataResponsePart(responses, false));
+
+ ODataResponse changeSetResponse = new ODataResponse();
+ changeSetResponse.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ changeSetResponse.setHeader(HttpHeader.CONTENT_ID, "1");
+
+ byte[] umlauts = "äüö".getBytes(CS_ISO_8859_1);
+ changeSetResponse.setHeader("Custom-Header", new String(umlauts, CS_ISO_8859_1));
+ responses = new ArrayList<ODataResponse>(1);
+ responses.add(changeSetResponse);
+ parts.add(new ODataResponsePart(responses, true));
+
+ BatchResponseSerializer serializer = new BatchResponseSerializer();
+ final InputStream content = serializer.serialize(parts, BOUNDARY);
+ assertNotNull(content);
+ final BatchLineReader reader =
+ new BatchLineReader(content);
+ final List<String> body = reader.toList();
+ reader.close();
+
+ int line = 0;
+ assertEquals(25, body.size());
+ assertTrue(body.get(line++).contains("--batch_"));
+ assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
+ assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertEquals("HTTP/1.1 200 OK" + CRLF, body.get(line++));
+ assertEquals("Content-Type: application/json; charset=UTF-8" + CRLF, body.get(line++));
+ assertEquals("Content-Length: 16" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertEquals("Wälter Winter" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertTrue(body.get(line++).contains("--batch_"));
+ assertTrue(body.get(line++).contains("Content-Type: multipart/mixed; boundary=changeset_"));
+ assertEquals(CRLF, body.get(line++));
+ assertTrue(body.get(line++).contains("--changeset_"));
+ assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
+ assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
+ assertEquals("Content-ID: 1" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertEquals("HTTP/1.1 204 No Content" + CRLF, body.get(line++));
+ assertEquals("Custom-Header: äüö" + CRLF, body.get(line++));
+ assertEquals("Content-Length: 0" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertTrue(body.get(line++).contains("--changeset_"));
+ assertTrue(body.get(line++).contains("--batch_"));
+ }
+
+ @Test
+ public void testBatchResponseUmlautsUtf8BodyAndHeader() throws Exception {
+ final List<ODataResponsePart> parts = new ArrayList<ODataResponsePart>();
+ ODataResponse response = new ODataResponse();
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE,
+ ContentType.APPLICATION_JSON.toContentTypeString() + "; charset=UTF-8");
+ response.setContent(IOUtils.toInputStream("Wälter Winter" + CRLF));
+
+ List<ODataResponse> responses = new ArrayList<ODataResponse>(1);
+ responses.add(response);
+ parts.add(new ODataResponsePart(responses, false));
+
+ ODataResponse changeSetResponse = new ODataResponse();
+ changeSetResponse.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ changeSetResponse.setHeader(HttpHeader.CONTENT_ID, "1");
+
+// byte[] umlauts = "äüö".getBytes(CS_UTF_8);
+// changeSetResponse.setHeader("Custom-Header", new String(umlauts, CS_UTF_8));
+ changeSetResponse.setHeader("Custom-Header", "äüö");
+ responses = new ArrayList<ODataResponse>(1);
+ responses.add(changeSetResponse);
+ parts.add(new ODataResponsePart(responses, true));
+
+ BatchResponseSerializer serializer = new BatchResponseSerializer();
+ final InputStream content = serializer.serialize(parts, BOUNDARY);
+ assertNotNull(content);
+ final BatchLineReader reader =
+ new BatchLineReader(content);
+ final List<String> body = reader.toList();
+ reader.close();
+
+ assertEquals(25, body.size());
+ // TODO: check: with latest change in BatchResponseSerializer is not possible
+ // to set header values with UTF-8 (only iso-8859-1)
+// assertEquals("Custom-Header: äüö" + CRLF, body.get(19));
+ assertEquals("Custom-Header: äüö" + CRLF, body.get(19));
+ }
+
+ @Test
+ public void testBatchResponseUmlautsIso() throws Exception {
+ final List<ODataResponsePart> parts = new ArrayList<ODataResponsePart>();
+ ODataResponse response = new ODataResponse();
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE,
+ ContentType.APPLICATION_JSON.toContentTypeString() + "; charset=iso-8859-1");
+ byte[] payload = ("Wälter Winter" + CRLF).getBytes("iso-8859-1");
+ response.setContent(new ByteArrayInputStream(payload));
+
+ List<ODataResponse> responses = new ArrayList<ODataResponse>(1);
+ responses.add(response);
+ parts.add(new ODataResponsePart(responses, false));
+
+ ODataResponse changeSetResponse = new ODataResponse();
+ changeSetResponse.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ changeSetResponse.setHeader(HttpHeader.CONTENT_ID, "1");
+ responses = new ArrayList<ODataResponse>(1);
+ responses.add(changeSetResponse);
+ parts.add(new ODataResponsePart(responses, true));
+
+ BatchResponseSerializer serializer = new BatchResponseSerializer();
+ final InputStream content = serializer.serialize(parts, BOUNDARY);
+ assertNotNull(content);
+ final BatchLineReader reader =
+ new BatchLineReader(content);
+ final List<String> body = reader.toList();
+ reader.close();
+
+ int line = 0;
+ assertEquals(24, body.size());
+ assertTrue(body.get(line++).contains("--batch_"));
+ assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
+ assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertEquals("HTTP/1.1 200 OK" + CRLF, body.get(line++));
+ assertEquals("Content-Type: application/json; charset=iso-8859-1" + CRLF, body.get(line++));
+ assertEquals("Content-Length: 15" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertEquals("Wälter Winter" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertTrue(body.get(line++).contains("--batch_"));
+ assertTrue(body.get(line++).contains("Content-Type: multipart/mixed; boundary=changeset_"));
+ assertEquals(CRLF, body.get(line++));
+ assertTrue(body.get(line++).contains("--changeset_"));
+ assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
+ assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
+ assertEquals("Content-ID: 1" + CRLF, body.get(line++));
assertEquals(CRLF, body.get(line++));
assertEquals("HTTP/1.1 204 No Content" + CRLF, body.get(line++));
assertEquals("Content-Length: 0" + CRLF, body.get(line++));
@@ -110,7 +326,7 @@
ODataResponse changeSetResponse = new ODataResponse();
changeSetResponse.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
- changeSetResponse.setHeader(BatchParserCommon.HTTP_CONTENT_ID, "1");
+ changeSetResponse.setHeader(HttpHeader.CONTENT_ID, "1");
responses = new ArrayList<ODataResponse>(1);
responses.add(changeSetResponse);
parts.add(new ODataResponsePart(responses, true));
@@ -118,8 +334,8 @@
BatchResponseSerializer serializer = new BatchResponseSerializer();
final InputStream content = serializer.serialize(parts, BOUNDARY);
assertNotNull(content);
- final BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(content));
+ final BatchLineReader reader =
+ new BatchLineReader(content);
final List<String> body = reader.toList();
reader.close();
@@ -140,7 +356,7 @@
assertTrue(body.get(line++).contains("--changeset_"));
assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
- assertEquals("Content-Id: 1" + CRLF, body.get(line++));
+ assertEquals("Content-ID: 1" + CRLF, body.get(line++));
assertEquals(CRLF, body.get(line++));
assertEquals("HTTP/1.1 204 No Content" + CRLF, body.get(line++));
assertEquals("Content-Length: 0" + CRLF, body.get(line++));
@@ -166,8 +382,8 @@
final InputStream content = serializer.serialize(parts, BOUNDARY);
assertNotNull(content);
- final BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(content));
+ final BatchLineReader reader =
+ new BatchLineReader(content);
final List<String> body = reader.toList();
reader.close();
@@ -186,10 +402,46 @@
}
@Test
+ public void testBigResponse() throws Exception {
+ List<ODataResponsePart> parts = new ArrayList<ODataResponsePart>();
+ ODataResponse response = new ODataResponse();
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, "application/json");
+ String bigData = generateData(10000);
+ response.setContent(IOUtils.toInputStream(bigData));
+
+ List<ODataResponse> responses = new ArrayList<ODataResponse>(1);
+ responses.add(response);
+ parts.add(new ODataResponsePart(responses, false));
+
+ final BatchResponseSerializer serializer = new BatchResponseSerializer();
+ final InputStream content = serializer.serialize(parts, BOUNDARY);
+
+ assertNotNull(content);
+ final BatchLineReader reader =
+ new BatchLineReader(content);
+ final List<String> body = reader.toList();
+ reader.close();
+
+ int line = 0;
+ assertEquals(10, body.size());
+ assertTrue(body.get(line++).contains("--batch_"));
+ assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
+ assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertEquals("HTTP/1.1 200 OK" + CRLF, body.get(line++));
+ assertEquals("Content-Type: application/json" + CRLF, body.get(line++));
+ assertEquals("Content-Length: 10000" + CRLF, body.get(line++));
+ assertEquals(CRLF, body.get(line++));
+ assertEquals(bigData + CRLF, body.get(line++));
+ assertTrue(body.get(line++).contains("--batch_"));
+ }
+
+ @Test
public void testChangeSetResponse() throws Exception {
List<ODataResponsePart> parts = new ArrayList<ODataResponsePart>();
ODataResponse response = new ODataResponse();
- response.setHeader(BatchParserCommon.HTTP_CONTENT_ID, "1");
+ response.setHeader(HttpHeader.CONTENT_ID, "1");
response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
List<ODataResponse> responses = new ArrayList<ODataResponse>(1);
@@ -201,8 +453,8 @@
assertNotNull(content);
- final BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(content));
+ final BatchLineReader reader =
+ new BatchLineReader(content);
final List<String> body = reader.toList();
reader.close();
@@ -214,7 +466,7 @@
assertTrue(body.get(line++).contains("--changeset_"));
assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
- assertEquals("Content-Id: 1" + CRLF, body.get(line++));
+ assertEquals("Content-ID: 1" + CRLF, body.get(line++));
assertEquals(CRLF, body.get(line++));
assertEquals("HTTP/1.1 204 No Content" + CRLF, body.get(line++));
assertEquals("Content-Length: 0" + CRLF, body.get(line++));
@@ -223,4 +475,19 @@
assertTrue(body.get(line++).contains("--changeset_"));
assertTrue(body.get(line++).contains("--batch_"));
}
+
+ /**
+ * Generates a string with given length containing random upper case characters ([A-Z]).
+ * @param len length of the generated string
+ * @return random upper case characters ([A-Z])
+ */
+ public static String generateData(final int len) {
+ Random random = new Random();
+ StringBuilder b = new StringBuilder(len);
+ for (int j = 0; j < len; j++) {
+ final char c = (char) ('A' + random.nextInt('Z' - 'A' + 1));
+ b.append(c);
+ }
+ return b.toString();
+ }
}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java
index 567e3a5..eff637f 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java
@@ -24,7 +24,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
index 08aed13..4be074b 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
@@ -27,12 +27,12 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.data.ComplexValue;
import org.apache.olingo.commons.api.data.ContextURL;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
import org.junit.Test;
@@ -44,7 +44,7 @@
col.add(getValues(2));
final Property complexCollection = new Property(null, "ComplexCol", ValueType.COLLECTION_COMPLEX, col);
- final ODataJsonSerializer serializer = new ODataJsonSerializer(ODataFormat.APPLICATION_JSON);
+ final ODataJsonSerializer serializer = new ODataJsonSerializer(ContentType.APPLICATION_JSON);
final ComplexSerializerOptions options = ComplexSerializerOptions.with()
.contextURL(ContextURL.with().selectList("ComplexCollection").build()).build();
final InputStream in = serializer.complexCollection(null, ComplexTypeHelper.createType(),
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ServerErrorSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ServerErrorSerializerTest.java
index c9efe07..8f5cb87 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ServerErrorSerializerTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ServerErrorSerializerTest.java
@@ -26,10 +26,10 @@
import java.util.List;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.commons.api.ODataErrorDetail;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.server.api.ODataServerError;
+import org.apache.olingo.commons.api.ex.ODataErrorDetail;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataServerError;
import org.apache.olingo.server.api.serializer.ODataSerializer;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.junit.Before;
@@ -45,7 +45,7 @@
@Before
public void before() throws Exception {
- ser = OData.newInstance().createSerializer(ODataFormat.JSON);
+ ser = OData.newInstance().createSerializer(ContentType.JSON);
}
@Test
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBufferTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBufferTest.java
new file mode 100644
index 0000000..9ac2c81
--- /dev/null
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBufferTest.java
@@ -0,0 +1,310 @@
+/*******************************************************************************
+ * 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.utils;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.charset.Charset;
+
+import org.junit.Test;
+
+/**
+ *
+ */
+public class CircleStreamBufferTest {
+
+ private static final Charset DEFAULT_CHARSET = Charset.forName("utf-8");
+
+ @Test
+ public void testSimpleWriteReadSignBySign() throws Exception {
+ CircleStreamBuffer csb = new CircleStreamBuffer();
+
+ OutputStream write = csb.getOutputStream();
+ byte[] writeData = "Test".getBytes(DEFAULT_CHARSET);
+ for (byte element : writeData) {
+ write.write(element);
+ }
+
+ InputStream inStream = csb.getInputStream();
+ byte[] buffer = new byte[4];
+ for (int i = 0; i < buffer.length; i++) {
+ buffer[i] = (byte) inStream.read();
+ }
+
+ String result = new String(buffer, DEFAULT_CHARSET);
+
+ assertEquals("Test", result);
+ }
+
+ @Test
+ public void testSimpleWriteReadSignBySignMoreThenBufferSize() throws Exception {
+ CircleStreamBuffer csb = new CircleStreamBuffer(128);
+
+ OutputStream write = csb.getOutputStream();
+ int signs = 1024;
+ String testData = createTestString(signs);
+ byte[] writeData = testData.getBytes(DEFAULT_CHARSET);
+ for (byte element : writeData) {
+ write.write(element);
+ }
+
+ InputStream inStream = csb.getInputStream();
+ byte[] buffer = new byte[signs];
+ for (int i = 0; i < buffer.length; i++) {
+ buffer[i] = (byte) inStream.read();
+ }
+
+ String result = new String(buffer, DEFAULT_CHARSET);
+ assertEquals(testData, result);
+ }
+
+ @Test
+ public void testSimpleWriteReadOnce() throws Exception {
+ CircleStreamBuffer csb = new CircleStreamBuffer();
+
+ OutputStream write = csb.getOutputStream();
+ write.write("Test".getBytes(DEFAULT_CHARSET), 0, 4);
+
+ InputStream inStream = csb.getInputStream();
+
+ String result = readFrom(inStream);
+ assertEquals(4, result.length());
+ assertEquals("Test", result);
+ }
+
+ @Test
+ public void testSimpleWriteReadTwice() throws Exception {
+ CircleStreamBuffer csb = new CircleStreamBuffer();
+
+ OutputStream outStream = csb.getOutputStream();
+ InputStream inStream = csb.getInputStream();
+
+ // first writeInternal/read cycle
+ outStream.write("Test_1".getBytes(DEFAULT_CHARSET));
+ String firstResult = readFrom(inStream);
+ assertEquals("Test_1", firstResult);
+
+ // second writeInternal/read cycle
+ outStream.write("Test_2".getBytes(DEFAULT_CHARSET));
+ String secondResult = readFrom(inStream);
+ assertEquals("Test_2", secondResult);
+ }
+
+ @Test
+ public void testSimpleWriteReadOnce8k() throws Exception {
+ CircleStreamBuffer csb = new CircleStreamBuffer();
+
+ OutputStream outStream = csb.getOutputStream();
+ InputStream inStream = csb.getInputStream();
+ final int signs = 8192;
+
+ String testData = createTestString(signs);
+ outStream.write(testData.getBytes(DEFAULT_CHARSET));
+ String result = readFrom(inStream);
+
+ assertEquals(signs, result.length());
+ assertEquals(testData, result);
+ }
+
+ @Test
+ public void testSimpleWriteExactOneCharacterMoreThenBufferSize() throws Exception {
+ int bufferSize = 4096;
+ CircleStreamBuffer csb = new CircleStreamBuffer(bufferSize);
+
+ OutputStream outStream = csb.getOutputStream();
+ InputStream inStream = csb.getInputStream();
+ final int signs = bufferSize + 1;
+
+ String testData = createTestString(signs);
+ outStream.write(testData.getBytes(DEFAULT_CHARSET));
+ String result = readFrom(inStream, bufferSize * 2);
+
+ assertEquals(signs, result.length());
+ assertEquals(testData, result);
+ }
+
+ @Test
+ public void testSimpleWriteReadOneCharacterMoreThenBufferSize() throws Exception {
+ int bufferSize = 4096;
+ CircleStreamBuffer csb = new CircleStreamBuffer(bufferSize);
+
+ OutputStream outStream = csb.getOutputStream();
+ InputStream inStream = csb.getInputStream();
+
+ int signs = (1 + bufferSize) * 3;
+ String testData = createTestString(signs);
+ outStream.write(testData.getBytes(DEFAULT_CHARSET));
+ String result = readFrom(inStream);
+
+ assertEquals(signs, result.length());
+ assertEquals(testData, result);
+ }
+
+
+ @Test
+ public void testSimpleWriteMoreThenDefaultBufferSize() throws Exception {
+ CircleStreamBuffer csb = new CircleStreamBuffer();
+
+ OutputStream outStream = csb.getOutputStream();
+ InputStream inStream = csb.getInputStream();
+ final int signs = 70110;
+
+ String testData = createTestString(signs);
+ outStream.write(testData.getBytes(DEFAULT_CHARSET));
+ String result = readFrom(inStream);
+
+ assertEquals(signs, result.length());
+ assertEquals(testData, result);
+ }
+
+ @Test
+ public void testSimpleWriteMoreThenBufferSize() throws Exception {
+ int bufferSize = 4096;
+ CircleStreamBuffer csb = new CircleStreamBuffer(bufferSize);
+
+ OutputStream outStream = csb.getOutputStream();
+ InputStream inStream = csb.getInputStream();
+ final int signs = bufferSize * 10;
+
+ String testData = createTestString(signs);
+ outStream.write(testData.getBytes(DEFAULT_CHARSET));
+ String result = readFrom(inStream, bufferSize * 2);
+
+ assertEquals(signs, result.length());
+ assertEquals(testData, result);
+ }
+
+ @Test
+ public void testSimpleWriteMoreThenBufferSizeAndUmlauts() throws Exception {
+ int bufferSize = 4096;
+ CircleStreamBuffer csb = new CircleStreamBuffer(bufferSize);
+
+ OutputStream outStream = csb.getOutputStream();
+ InputStream inStream = csb.getInputStream();
+ final int signs = bufferSize * 10;
+
+ String testData = createTestString(signs);
+ testData = "äüöÄÜÖ" + testData + "äüöÄÜÖ";
+ outStream.write(testData.getBytes(DEFAULT_CHARSET));
+ String result = readFrom(inStream);
+
+ assertEquals(testData.length(), result.length());
+ assertEquals(testData, result);
+ }
+
+ @Test
+ public void testSimpleWriteMoreThenBufferSizeAndUmlautsIso() throws Exception {
+ int bufferSize = 4096;
+ CircleStreamBuffer csb = new CircleStreamBuffer(bufferSize);
+
+ OutputStream outStream = csb.getOutputStream();
+ InputStream inStream = csb.getInputStream();
+ final int signs = bufferSize * 10;
+
+ String testData = createTestString(signs);
+ testData = "äüöÄÜÖ" + testData + "äüöÄÜÖ";
+ outStream.write(testData.getBytes("iso-8859-1"));
+ String result = readFrom(inStream, "iso-8859-1");
+
+ assertEquals(testData.length(), result.length());
+ assertEquals(testData, result);
+ }
+
+ @Test
+ public void testSimpleWriteALotMoreThenBufferSize() throws Exception {
+ int bufferSize = 4096;
+ CircleStreamBuffer csb = new CircleStreamBuffer(bufferSize);
+
+ OutputStream outStream = csb.getOutputStream();
+ InputStream inStream = csb.getInputStream();
+ final int signs = bufferSize * 100;
+
+ String testData = createTestString(signs);
+ outStream.write(testData.getBytes(DEFAULT_CHARSET));
+ String result = readFrom(inStream, bufferSize * 2);
+
+ assertEquals(signs, result.length());
+ assertEquals(testData, result);
+ }
+
+ @Test(expected = IOException.class)
+ public void testCloseInputStream() throws Exception {
+ CircleStreamBuffer csb = new CircleStreamBuffer();
+
+ OutputStream write = csb.getOutputStream();
+ write.write("Test".getBytes(DEFAULT_CHARSET), 0, 4);
+
+ InputStream inStream = csb.getInputStream();
+ inStream.close();
+ byte[] buffer = new byte[4];
+ int count = inStream.read(buffer);
+ assertEquals(4, count);
+ }
+
+ @Test(expected = IOException.class)
+ public void testCloseOutputStream() throws Exception {
+ CircleStreamBuffer csb = new CircleStreamBuffer();
+
+ OutputStream write = csb.getOutputStream();
+ write.close();
+ write.write("Test".getBytes(DEFAULT_CHARSET), 0, 4);
+ }
+
+ // ###################################################
+ // #
+ // # Below here are test helper methods
+ // #
+ // ###################################################
+
+ private String readFrom(final InputStream stream) throws IOException {
+ return readFrom(stream, DEFAULT_CHARSET, 128);
+ }
+
+ private String readFrom(final InputStream stream, final String charset) throws IOException {
+ return readFrom(stream, Charset.forName(charset), 128);
+ }
+
+ private String readFrom(final InputStream stream, final int bufferSize) throws IOException {
+ return readFrom(stream, DEFAULT_CHARSET, bufferSize);
+ }
+
+ private String readFrom(final InputStream stream, final Charset charset, final int bufferSize) throws IOException {
+ StringBuilder b = new StringBuilder();
+ int count;
+ byte[] buffer = new byte[bufferSize];
+ while ((count = stream.read(buffer)) >= 0) {
+ b.append(new String(buffer, 0, count, charset));
+ }
+ return b.toString();
+ }
+
+ private String createTestString(final int signs) {
+ StringBuilder b = new StringBuilder();
+
+ for (int i = 0; i < signs; i++) {
+ int sign = (int) (32 + (Math.random() * 90));
+ b.append((char) sign);
+ }
+
+ return b.toString();
+ }
+}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java
index d78b50e..52fc773 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java
@@ -32,7 +32,7 @@
import java.util.List;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -45,6 +45,7 @@
import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider;
import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo;
import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
import org.apache.olingo.commons.api.edm.provider.CsdlEnumMember;
@@ -57,7 +58,7 @@
import org.apache.olingo.commons.api.edm.provider.CsdlReturnType;
import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
import org.apache.olingo.commons.api.edm.provider.CsdlSingleton;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.edm.EdmComplexTypeImpl;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ServiceMetadata;
@@ -73,10 +74,10 @@
public class MetadataDocumentXmlSerializerTest {
private static ODataSerializer serializer;
-
+
@BeforeClass
public static void init() throws SerializerException {
- serializer = OData.newInstance().createSerializer(ODataFormat.XML);
+ serializer = OData.newInstance().createSerializer(ContentType.APPLICATION_XML);
}
@Test
@@ -263,7 +264,7 @@
+ "</ComplexType>"));
}
- private class LocalProvider extends CsdlAbstractEdmProvider {
+ static class LocalProvider extends CsdlAbstractEdmProvider {
private final static String nameSpace = "namespace";
private final FullQualifiedName nameETAbstract = new FullQualifiedName(nameSpace, "ETAbstract");
@@ -469,6 +470,15 @@
}
@Override
+ public CsdlEntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName)
+ throws ODataException {
+ if (entityContainerName == null) {
+ return new CsdlEntityContainerInfo().setContainerName(new FullQualifiedName("org.olingo", "container"));
+ }
+ return null;
+ }
+
+ @Override
public CsdlEntityContainer getEntityContainer() throws ODataException {
CsdlEntityContainer container = new CsdlEntityContainer();
container.setName("container");
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/ServerErrorXmlSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/ServerErrorXmlSerializerTest.java
new file mode 100644
index 0000000..aea1fdb
--- /dev/null
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/ServerErrorXmlSerializerTest.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.server.core.serializer.xml;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.commons.api.ex.ODataErrorDetail;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataServerError;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ServerErrorXmlSerializerTest {
+
+ ODataSerializer ser;
+
+ @Before
+ public void before() throws Exception {
+ ser = OData.newInstance().createSerializer(ContentType.APPLICATION_XML);
+ }
+
+ @Test
+ public void basicODataErrorWithCode() throws Exception {
+ ODataServerError error = new ODataServerError();
+ error.setCode("Code").setMessage("ErrorMessage");
+ InputStream stream = ser.error(error).getContent();
+ String jsonString = IOUtils.toString(stream);
+ assertEquals("<?xml version='1.0' encoding='UTF-8'?>"
+ + "<error xmlns=\"http://docs.oasis-open.org/odata/ns/metadata\">"
+ + "<code>0</code>"
+ + "<message>ErrorMessage</message>"
+ + "</error>",
+ jsonString);
+ }
+
+ @Test(expected = SerializerException.class)
+ public void nullErrorResultsInException() throws Exception {
+ ser.error(null);
+ }
+
+ @Test
+ public void singleDetailNothingSet() throws Exception {
+ ODataErrorDetail detail = new ODataErrorDetail();
+ detail.setCode("detail code");
+ detail.setMessage("detail message");
+
+ List<ODataErrorDetail> details = new ArrayList<ODataErrorDetail>();
+ details.add(detail);
+
+ ODataServerError error = new ODataServerError().setDetails(details);
+ error.setCode("code");
+ error.setMessage("err message");
+ error.setTarget("target");
+
+ InputStream stream = ser.error(error).getContent();
+ String jsonString = IOUtils.toString(stream);
+ assertEquals("<?xml version='1.0' encoding='UTF-8'?>"
+ + "<error xmlns=\"http://docs.oasis-open.org/odata/ns/metadata\">"
+ + "<code>0</code>"
+ + "<message>err message</message>"
+ + "<target>target</target>"
+ + "<details>"
+ + "<code>detail code</code>"
+ + "<message>detail message</message>"
+ + "</details>"
+ + "</error>",
+ jsonString);
+ }
+}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/ServiceDocumentXmlSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/ServiceDocumentXmlSerializerTest.java
new file mode 100644
index 0000000..04bf11d
--- /dev/null
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/ServiceDocumentXmlSerializerTest.java
@@ -0,0 +1,105 @@
+/*
+ * 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.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+
+import org.apache.commons.io.IOUtils;
+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.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.core.ServiceMetadataImpl;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+public class ServiceDocumentXmlSerializerTest {
+ private static ODataSerializer serializer;
+
+ @BeforeClass
+ public static void init() throws SerializerException {
+ serializer = OData.newInstance().createSerializer(ContentType.APPLICATION_ATOM_XML);
+ }
+
+ @Test
+ public void writeServiceWithEmptyMockedEdm() throws Exception {
+ final Edm edm = mock(Edm.class);
+ EdmEntityContainer container = mock(EdmEntityContainer.class);
+ Mockito.stub(container.getFullQualifiedName()).toReturn(new FullQualifiedName("service.test"));
+ when(container.getEntitySets()).thenReturn(new ArrayList<EdmEntitySet>());
+ when(container.getFunctionImports()).thenReturn(new ArrayList<EdmFunctionImport>());
+ when(container.getSingletons()).thenReturn(new ArrayList<EdmSingleton>());
+ when(edm.getEntityContainer(null)).thenReturn(container);
+ ServiceMetadata metadata = mock(ServiceMetadata.class);
+ when(metadata.getEdm()).thenReturn(edm);
+
+ assertEquals("<?xml version='1.0' encoding='UTF-8'?>"
+ + "<app:service xmlns:atom=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:app=\"http://www.w3.org/2007/app\" "
+ + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
+ + "metadata:context=\"http://host/svc/$metadata\">"
+ + "<app:workspace><atom:title>service.test</atom:title></app:workspace>"
+ + "</app:service>",
+ IOUtils.toString(serializer.serviceDocument(metadata, "http://host/svc").getContent()));
+ }
+
+ @Test
+ public void writeServiceDocument() throws Exception {
+ CsdlEdmProvider provider = new MetadataDocumentXmlSerializerTest.LocalProvider();
+ ServiceMetadata serviceMetadata = new ServiceMetadataImpl(provider,
+ Collections.<EdmxReference> emptyList(), null);
+ InputStream metadataStream = serializer.serviceDocument(serviceMetadata, "http://host/svc").getContent();
+ String metadata = IOUtils.toString(metadataStream);
+ assertEquals("<?xml version='1.0' encoding='UTF-8'?>"
+ + "<app:service xmlns:atom=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:app=\"http://www.w3.org/2007/app\" "
+ + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
+ + "metadata:context=\"http://host/svc/$metadata\">"
+ + "<app:workspace>"
+ + "<atom:title>org.olingo.container</atom:title>"
+ + "<app:collection href=\"ESAllPrim\">"
+ + "<atom:title>ESAllPrim</atom:title>"
+ + "</app:collection>"
+ + "<metadata:function-import href=\"FINRTInt16\">"
+ + "<atom:title>FINRTInt16</atom:title>"
+ + "</metadata:function-import>"
+ + "<metadata:singleton href=\"SI\">"
+ + "<atom:title>SI</atom:title>"
+ + "</metadata:singleton>"
+ + "</app:workspace>"
+ + "</app:service>",
+ metadata);
+ }
+}
diff --git a/lib/server-tecsvc/pom.xml b/lib/server-tecsvc/pom.xml
index 3903811..655e756 100644
--- a/lib/server-tecsvc/pom.xml
+++ b/lib/server-tecsvc/pom.xml
@@ -143,6 +143,10 @@
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
@@ -160,7 +164,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <scope>test</scope>
</dependency>
</dependencies>
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/Encoder.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/Encoder.java
deleted file mode 100644
index 33956b5..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/Encoder.java
+++ /dev/null
@@ -1,132 +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.server.tecsvc;
-
-import java.io.UnsupportedEncodingException;
-
-/**
- * Encodes a Java String (in its internal UTF-16 encoding) into its
- * percent-encoded UTF-8 representation according to
- * <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>
- * (with consideration of its predecessor RFC 2396).
- *
- */
-public class Encoder {
-
- // TODO: Should we really copy this class?
-
- /**
- * Encodes a Java String (in its internal UTF-16 encoding) into its
- * percent-encoded UTF-8 representation according to
- * <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>,
- * suitable for parts of an OData path segment.
- * @param value the Java String
- * @return the encoded String
- */
- public static String encode(final String value) {
- return encoder.encodeInternal(value);
- }
-
- // OData has special handling for "'", so we allow that to remain unencoded.
- // Other sub-delims not used neither by JAX-RS nor by OData could be added
- // if the encoding is considered to be too aggressive.
- // RFC 3986 would also allow the gen-delims ":" and "@" to appear literally
- // in path-segment parts.
- private static final String ODATA_UNENCODED = "'";
-
- // Character classes from RFC 3986
- private final static String UNRESERVED = "-._~"; // + ALPHA + DIGIT
- // RFC 3986 says: "For consistency, URI producers and normalizers should
- // use uppercase hexadecimal digits for all percent-encodings."
- private final static String[] hex = { "%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07", "%08", "%09", "%0A",
- "%0B", "%0C", "%0D", "%0E", "%0F", "%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17", "%18", "%19", "%1A",
- "%1B", "%1C", "%1D", "%1E", "%1F", "%20", "%21", "%22", "%23", "%24", "%25", "%26", "%27", "%28", "%29", "%2A",
- "%2B", "%2C", "%2D", "%2E", "%2F", "%30", "%31", "%32", "%33", "%34", "%35", "%36", "%37", "%38", "%39", "%3A",
- "%3B", "%3C", "%3D", "%3E", "%3F", "%40", "%41", "%42", "%43", "%44", "%45", "%46", "%47", "%48", "%49", "%4A",
- "%4B", "%4C", "%4D", "%4E", "%4F", "%50", "%51", "%52", "%53", "%54", "%55", "%56", "%57", "%58", "%59", "%5A",
- "%5B", "%5C", "%5D", "%5E", "%5F", "%60", "%61", "%62", "%63", "%64", "%65", "%66", "%67", "%68", "%69", "%6A",
- "%6B", "%6C", "%6D", "%6E", "%6F", "%70", "%71", "%72", "%73", "%74", "%75", "%76", "%77", "%78", "%79", "%7A",
- "%7B", "%7C", "%7D", "%7E", "%7F", "%80", "%81", "%82", "%83", "%84", "%85", "%86", "%87", "%88",
- "%89", "%8A", "%8B", "%8C", "%8D", "%8E", "%8F", "%90", "%91", "%92", "%93", "%94", "%95", "%96", "%97", "%98",
- "%99", "%9A", "%9B", "%9C", "%9D", "%9E", "%9F", "%A0", "%A1", "%A2", "%A3", "%A4", "%A5", "%A6", "%A7", "%A8",
- "%A9", "%AA", "%AB", "%AC", "%AD", "%AE", "%AF", "%B0", "%B1", "%B2", "%B3", "%B4", "%B5", "%B6", "%B7", "%B8",
- "%B9", "%BA", "%BB", "%BC", "%BD", "%BE", "%BF", "%C0", "%C1", "%C2", "%C3", "%C4", "%C5", "%C6", "%C7", "%C8",
- "%C9", "%CA", "%CB", "%CC", "%CD", "%CE", "%CF", "%D0", "%D1", "%D2", "%D3", "%D4", "%D5", "%D6", "%D7", "%D8",
- "%D9", "%DA", "%DB", "%DC", "%DD", "%DE", "%DF", "%E0", "%E1", "%E2", "%E3", "%E4", "%E5", "%E6", "%E7", "%E8",
- "%E9", "%EA", "%EB", "%EC", "%ED", "%EE", "%EF", "%F0", "%F1", "%F2", "%F3", "%F4", "%F5", "%F6", "%F7", "%F8",
- "%F9", "%FA", "%FB", "%FC", "%FD", "%FE", "%FF" };
-
- private static final Encoder encoder = new Encoder(ODATA_UNENCODED);
-
- /** characters to remain unencoded in addition to {@link #UNRESERVED} */
- private final String unencoded;
-
- private Encoder(final String unencoded) {
- this.unencoded = unencoded == null ? "" : unencoded;
- }
-
- /**
- * <p>Returns the percent-encoded UTF-8 representation of a String.</p>
- * <p>In order to avoid producing percent-encoded CESU-8 (as described in
- * the Unicode Consortium's <a href="http://www.unicode.org/reports/tr26/">
- * Technical Report #26</a>), this is done in two steps:
- * <ol>
- * <li>Re-encode the characters from their Java-internal UTF-16 representations
- * into their UTF-8 representations.</li>
- * <li>Percent-encode each of the bytes in the UTF-8 representation.
- * This is possible on byte level because all characters that do not have
- * a <code>%xx</code> representation are represented in one byte in UTF-8.</li>
- * </ol></p>
- * @param input input String
- * @return encoded representation
- */
- private String encodeInternal(final String input) {
- StringBuilder resultStr = new StringBuilder();
-
- try {
- for (byte utf8Byte : input.getBytes("UTF-8")) {
- final char character = (char) utf8Byte;
- if (isUnreserved(character)) {
- resultStr.append(character);
- } else if (isUnencoded(character)) {
- resultStr.append(character);
- } else if (utf8Byte >= 0) {
- resultStr.append(hex[utf8Byte]);
- } else {
- // case UTF-8 continuation byte
- resultStr.append(hex[256 + utf8Byte]); // index adjusted for the usage of signed bytes
- }
- }
- } catch (final UnsupportedEncodingException e) { // should never happen; UTF-8 is always there
- return null;
- }
- return resultStr.toString();
- }
-
- private static boolean isUnreserved(final char character) {
- return 'A' <= character && character <= 'Z' // case A..Z
- || 'a' <= character && character <= 'z' // case a..z
- || '0' <= character && character <= '9' // case 0..9
- || UNRESERVED.indexOf(character) >= 0;
- }
-
- private boolean isUnencoded(final char character) {
- return unencoded.indexOf(character) >= 0;
- }
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java
index 9c1d502..5fcc8eb 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java
@@ -33,6 +33,7 @@
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ODataHttpHandler;
import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.debug.DefaultDebugSupport;
import org.apache.olingo.server.api.edmx.EdmxReference;
import org.apache.olingo.server.api.edmx.EdmxReferenceInclude;
import org.apache.olingo.server.tecsvc.data.DataProvider;
@@ -73,17 +74,21 @@
HttpSession session = request.getSession(true);
DataProvider dataProvider = (DataProvider) session.getAttribute(DataProvider.class.getName());
if (dataProvider == null) {
- dataProvider = new DataProvider();
+ dataProvider = new DataProvider(serviceMetadata.getEdm());
session.setAttribute(DataProvider.class.getName(), dataProvider);
LOG.info("Created new data provider.");
}
ODataHttpHandler handler = odata.createHandler(serviceMetadata);
+ // Register processors
handler.register(new TechnicalEntityProcessor(dataProvider, serviceMetadata));
handler.register(new TechnicalPrimitiveComplexProcessor(dataProvider, serviceMetadata));
handler.register(new TechnicalActionProcessor(dataProvider, serviceMetadata));
handler.register(new TechnicalBatchProcessor(dataProvider));
+ // Register Helper
handler.register(new ETagSupport());
+ handler.register(new DefaultDebugSupport());
+ // Process the request
handler.process(request, response);
} catch (final RuntimeException e) {
LOG.error("Server Error", e);
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServletContextListener.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServletContextListener.java
new file mode 100644
index 0000000..71aef57
--- /dev/null
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServletContextListener.java
@@ -0,0 +1,37 @@
+/*
+ * 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.tecsvc;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.apache.olingo.server.tecsvc.async.TechnicalAsyncService;
+
+/**
+ */
+public class TechnicalServletContextListener implements ServletContextListener {
+ @Override
+ public void contextInitialized(ServletContextEvent servletContextEvent) {
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent servletContextEvent) {
+ TechnicalAsyncService.getInstance().shutdownThreadPool();
+ }
+}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/async/AsyncProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/async/AsyncProcessor.java
new file mode 100644
index 0000000..4e07083
--- /dev/null
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/async/AsyncProcessor.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.tecsvc.async;
+
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataLibraryException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.processor.Processor;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Async processor "wraps" an Processor (or subclass of) to provide asynchronous support functionality
+ * in combination with the TechnicalAsyncService.
+ *
+ * @param <T> "wrapped" Processor
+ */
+public class AsyncProcessor<T extends Processor> {
+ private final ProcessorInvocationHandler handler;
+ private final TechnicalAsyncService service;
+ private final T proxyProcessor;
+ private String location;
+ private String preferHeader;
+
+ /**
+ * InvocationHandler which is used as proxy for the Processor method.
+ */
+ private static class ProcessorInvocationHandler implements InvocationHandler {
+ private final Object wrappedInstance;
+ private Method invokeMethod;
+ private Object[] invokeParameters;
+ private ODataRequest processRequest;
+ private ODataResponse processResponse;
+
+ public ProcessorInvocationHandler(Object wrappedInstance) {
+ this.wrappedInstance = wrappedInstance;
+ }
+
+ @Override
+ public Object invoke(Object o, Method method, Object[] objects) throws Throwable {
+ if (Processor.class.isAssignableFrom(method.getDeclaringClass())) {
+ invokeMethod = method;
+ invokeParameters = objects;
+ } else {
+ throw new ODataRuntimeException("Invalid class '" + method.getDeclaringClass() +
+ "' can not wrapped for asynchronous processing.");
+ }
+
+ return null;
+ }
+
+ /**
+ * Prepare the handler for the <code>process()</code> call (which is asynchronous and can be at any time in
+ * the future).
+ */
+ void prepareForAsync() {
+ processRequest = copyRequest(getParameter(ODataRequest.class));
+ processResponse = createODataResponse(getParameter(ODataResponse.class));
+ }
+
+ Object process() throws InvocationTargetException, IllegalAccessException {
+ if(processRequest == null || processResponse == null) {
+ throw new ODataRuntimeException("ProcessInvocationHandler was not correct prepared for async processsing.");
+ }
+ replaceInvokeParameter(processRequest);
+ replaceInvokeParameter(processResponse);
+ return invokeMethod.invoke(wrappedInstance, invokeParameters);
+ }
+
+ <P> void replaceInvokeParameter(P replacement) {
+ if (replacement == null) {
+ return;
+ }
+
+ List<Object> copy = new ArrayList<Object>();
+ for (Object parameter : invokeParameters) {
+ if (replacement.getClass() == parameter.getClass()) {
+ copy.add(replacement);
+ } else {
+ copy.add(parameter);
+ }
+ }
+ invokeParameters = copy.toArray();
+ }
+
+ /**
+ * Get the ODataResponse which is used when this ProcessorInvocationHandler
+ * is called (via its <code>process()</code> method)
+ *
+ * @return ODataResponse which is used when this ProcessorInvocationHandler is called
+ */
+ ODataResponse getProcessResponse() {
+ return processResponse;
+ }
+
+ Object getWrappedInstance() {
+ return this.wrappedInstance;
+ }
+
+ <P> P getParameter(Class<P> parameterClass) {
+ for (Object parameter : invokeParameters) {
+ if (parameter != null && parameterClass == parameter.getClass()) {
+ return parameterClass.cast(parameter);
+ }
+ }
+ return null;
+ }
+ }
+
+
+ public AsyncProcessor(T processor, Class<T> processorInterface, TechnicalAsyncService service) {
+ Class<? extends Processor> aClass = processor.getClass();
+ Class<?>[] interfaces = aClass.getInterfaces();
+ handler = new ProcessorInvocationHandler(processor);
+ Object proxyInstance = Proxy.newProxyInstance(aClass.getClassLoader(), interfaces, handler);
+ proxyProcessor = processorInterface.cast(proxyInstance);
+ this.service = service;
+ }
+
+ public T prepareFor() {
+ return proxyProcessor;
+ }
+
+ public ODataRequest getRequest() {
+ return handler.getParameter(ODataRequest.class);
+ }
+
+ public ODataResponse getResponse() {
+ return handler.getParameter(ODataResponse.class);
+ }
+
+ public ODataResponse getProcessResponse() {
+ return handler.getProcessResponse();
+ }
+
+ public String getPreferHeader() {
+ return preferHeader;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public Class<?> getProcessorClass() {
+ return handler.getWrappedInstance().getClass();
+ }
+
+ /**
+ * Start the asynchronous processing and returns the id for this process
+ *
+ * @return the id for this process
+ * @throws ODataApplicationException
+ * @throws ODataLibraryException
+ */
+ public String processAsync() throws ODataApplicationException, ODataLibraryException {
+ preferHeader = getRequest().getHeader(HttpHeader.PREFER);
+ handler.prepareForAsync();
+ return service.processAsynchronous(this);
+ }
+
+ private static ODataResponse createODataResponse(ODataResponse response) {
+ ODataResponse created = new ODataResponse();
+ for (Map.Entry<String, List<String>> header : response.getAllHeaders().entrySet()) {
+ created.addHeader(header.getKey(), header.getValue());
+ }
+ return created;
+ }
+
+ Object process() throws InvocationTargetException, IllegalAccessException {
+ return handler.process();
+ }
+
+ void setLocation(String loc) {
+ this.location = loc;
+ }
+
+ static ODataRequest copyRequest(ODataRequest request) {
+ ODataRequest req = new ODataRequest();
+ req.setBody(copyRequestBody(request));
+ req.setMethod(request.getMethod());
+ req.setRawBaseUri(request.getRawBaseUri());
+ req.setRawODataPath(request.getRawODataPath());
+ req.setRawQueryPath(request.getRawQueryPath());
+ req.setRawRequestUri(request.getRawRequestUri());
+ req.setRawServiceResolutionUri(request.getRawServiceResolutionUri());
+
+ for (Map.Entry<String, List<String>> header : request.getAllHeaders().entrySet()) {
+ if (!HttpHeader.PREFER.toLowerCase().equals(
+ header.getKey().toLowerCase())) {
+ req.addHeader(header.getKey(), header.getValue());
+ }
+ }
+
+ return req;
+ }
+
+ static InputStream copyRequestBody(ODataRequest request) {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ InputStream input = request.getBody();
+ if (input != null) {
+ try {
+ ByteBuffer inBuffer = ByteBuffer.allocate(8192);
+ ReadableByteChannel ic = Channels.newChannel(input);
+ WritableByteChannel oc = Channels.newChannel(buffer);
+ while (ic.read(inBuffer) > 0) {
+ inBuffer.flip();
+ oc.write(inBuffer);
+ inBuffer.rewind();
+ }
+ return new ByteArrayInputStream(buffer.toByteArray());
+ } catch (IOException e) {
+ throw new ODataRuntimeException("Error on reading request content");
+ }
+ }
+ return null;
+ }
+}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/async/TechnicalAsyncService.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/async/TechnicalAsyncService.java
new file mode 100644
index 0000000..ce08e52
--- /dev/null
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/async/TechnicalAsyncService.java
@@ -0,0 +1,295 @@
+/*
+ * 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.tecsvc.async;
+
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataLibraryException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.processor.Processor;
+import org.apache.olingo.server.api.serializer.SerializerException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * The TechnicalAsyncService provides asynchronous support for any Processor.
+ * To use it following steps are necessary:
+ * <ul>
+ * <li>Get the instance</li>
+ * <li>Create an instance of the Processor which should be wrapped for asynchronous support
+ * (do not forget to call the <code>init(...)</code> method on the processor)</li>
+ * <li>register the Processor instance via the <code>register(...)</code> method</li>
+ * <li>prepare the corresponding method with the request parameters via the
+ * <code>prepareFor()</code> method at the AsyncProcessor</li>
+ * <li>start the async processing via the <code>processAsync()</code> methods</li>
+ * </ul>
+ * A short code snippet is shown below:
+ * <p>
+ * <code>
+ * TechnicalAsyncService asyncService = TechnicalAsyncService.getInstance();
+ * TechnicalEntityProcessor processor = new TechnicalEntityProcessor(dataProvider, serviceMetadata);
+ * processor.init(odata, serviceMetadata);
+ * AsyncProcessor<EntityProcessor> asyncProcessor = asyncService.register(processor, EntityProcessor.class);
+ * asyncProcessor.prepareFor().readEntity(request, response, uriInfo, requestedFormat);
+ * String location = asyncProcessor.processAsync();
+ * </code>
+ * </p>
+ */
+public class TechnicalAsyncService {
+
+ public static final String TEC_ASYNC_SLEEP = "tec.sleep";
+ public static final String STATUS_MONITOR_TOKEN = "status";
+
+ private static final Map<String, AsyncRunner> LOCATION_2_ASYNC_RUNNER =
+ Collections.synchronizedMap(new HashMap<String, AsyncRunner>());
+ private static final ExecutorService ASYNC_REQUEST_EXECUTOR = Executors.newFixedThreadPool(10);
+ private static final AtomicInteger ID_GENERATOR = new AtomicInteger();
+
+ public <T extends Processor> AsyncProcessor<T> register(T processor, Class<T> processorInterface) {
+ return new AsyncProcessor<T>(processor, processorInterface, this);
+ }
+
+ public static void updateHeader(ODataResponse response, HttpStatusCode status, String location) {
+ response.setStatusCode(status.getStatusCode());
+ response.setHeader(HttpHeader.LOCATION, location);
+ response.setHeader(HttpHeader.PREFERENCE_APPLIED, "respond-async");
+
+ }
+
+ public static void acceptedResponse(ODataResponse response, String location) {
+ updateHeader(response, HttpStatusCode.ACCEPTED, location);
+ }
+
+ private static final class AsyncProcessorHolder {
+ private static final TechnicalAsyncService INSTANCE = new TechnicalAsyncService();
+ }
+
+ public static TechnicalAsyncService getInstance() {
+ return AsyncProcessorHolder.INSTANCE;
+ }
+
+ public void shutdownThreadPool() {
+ ASYNC_REQUEST_EXECUTOR.shutdown();
+ }
+
+ public boolean isStatusMonitorResource(HttpServletRequest request) {
+ return request.getRequestURL() != null && request.getRequestURL().toString().contains(STATUS_MONITOR_TOKEN);
+ }
+
+ String processAsynchronous(AsyncProcessor<?> dispatchedProcessor)
+ throws ODataApplicationException, ODataLibraryException {
+ // use executor thread pool
+ String location = createNewAsyncLocation(dispatchedProcessor.getRequest());
+ dispatchedProcessor.setLocation(location);
+ AsyncRunner run = new AsyncRunner(dispatchedProcessor);
+ LOCATION_2_ASYNC_RUNNER.put(location, run);
+ ASYNC_REQUEST_EXECUTOR.execute(run);
+ //
+ return location;
+ }
+
+ public void handle(HttpServletRequest request, HttpServletResponse response) throws SerializerException, IOException {
+ String location = getAsyncLocation(request);
+ AsyncRunner runner = LOCATION_2_ASYNC_RUNNER.get(location);
+
+ if(runner == null) {
+ response.setStatus(HttpStatusCode.NOT_FOUND.getStatusCode());
+ } else {
+ if(runner.isFinished()) {
+ ODataResponse wrapResult = runner.getDispatched().getProcessResponse();
+ wrapToAsyncHttpResponse(wrapResult, response);
+ LOCATION_2_ASYNC_RUNNER.remove(location);
+ } else {
+ response.setStatus(HttpStatusCode.ACCEPTED.getStatusCode());
+ response.setHeader(HttpHeader.LOCATION, location);
+ }
+ }
+ }
+
+ public void listQueue(HttpServletResponse response) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("<html><header/><body><h1>Queued requests</h1><ul>");
+ for (Map.Entry<String, AsyncRunner> entry : LOCATION_2_ASYNC_RUNNER.entrySet()) {
+ AsyncProcessor<?> asyncProcessor = entry.getValue().getDispatched();
+ sb.append("<li><b>ID: </b>").append(entry.getKey()).append("<br/>")
+ .append("<b>Location: </b><a href=\"")
+ .append(asyncProcessor.getLocation()).append("\">")
+ .append(asyncProcessor.getLocation()).append("</a><br/>")
+ .append("<b>Processor: </b>").append(asyncProcessor.getProcessorClass().getSimpleName()).append("<br/>")
+ .append("<b>Finished: </b>").append(entry.getValue().isFinished()).append("<br/>")
+ .append("</li>");
+ }
+ sb.append("</ul></body></html>");
+
+ writeToResponse(response, sb.toString());
+ }
+
+
+ private static void writeToResponse(HttpServletResponse response, InputStream input) throws IOException {
+ copy(input, response.getOutputStream());
+ }
+
+ private void writeToResponse(HttpServletResponse response, String content) {
+ writeToResponse(response, content.getBytes());
+ }
+
+ private static void writeToResponse(HttpServletResponse response, byte[] content) {
+ OutputStream output = null;
+ try {
+ output = response.getOutputStream();
+ output.write(content);
+ } catch (IOException e) {
+ throw new ODataRuntimeException(e);
+ } finally {
+ closeStream(output);
+ }
+ }
+
+ static void wrapToAsyncHttpResponse(final ODataResponse odResponse, final HttpServletResponse response)
+ throws SerializerException, IOException {
+ OData odata = OData.newInstance();
+ InputStream odResponseStream = odata.createFixedFormatSerializer().asyncResponse(odResponse);
+
+ response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_HTTP.toContentTypeString());
+ response.setHeader(HttpHeader.CONTENT_ENCODING, "binary");
+ response.setStatus(HttpStatusCode.OK.getStatusCode());
+
+ writeToResponse(response, odResponseStream);
+ }
+
+ static void copy(final InputStream input, final OutputStream output) {
+ if (output == null || input == null) {
+ return;
+ }
+
+ try {
+ ByteBuffer inBuffer = ByteBuffer.allocate(8192);
+ ReadableByteChannel ic = Channels.newChannel(input);
+ WritableByteChannel oc = Channels.newChannel(output);
+ while (ic.read(inBuffer) > 0) {
+ inBuffer.flip();
+ oc.write(inBuffer);
+ inBuffer.rewind();
+ }
+ } catch (IOException e) {
+ throw new ODataRuntimeException("Error on reading request content");
+ } finally {
+ closeStream(input);
+ closeStream(output);
+ }
+ }
+
+ private static void closeStream(final Closeable closeable) {
+ if (closeable != null) {
+ try {
+ closeable.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ private String createNewAsyncLocation(ODataRequest request) {
+ int pos = request.getRawBaseUri().lastIndexOf("/") + 1;
+ return request.getRawBaseUri().substring(0, pos) + STATUS_MONITOR_TOKEN + "/" + ID_GENERATOR.incrementAndGet();
+ }
+
+ private String getAsyncLocation(HttpServletRequest request) {
+ return request.getRequestURL().toString();
+ }
+
+ /**
+ * Runnable for the AsyncProcessor.
+ */
+ static class AsyncRunner implements Runnable {
+ private final AsyncProcessor<?> dispatched;
+ private int defaultSleepTimeInSeconds = 0;
+ private Exception exception;
+ boolean finished = false;
+
+ public AsyncRunner(AsyncProcessor<?> wrap) {
+ this(wrap, 0);
+ }
+
+ public AsyncRunner(AsyncProcessor<?> wrap, int defaultSleepTimeInSeconds) {
+ this.dispatched = wrap;
+ if(defaultSleepTimeInSeconds > 0) {
+ this.defaultSleepTimeInSeconds = defaultSleepTimeInSeconds;
+ }
+ }
+
+ @Override
+ public void run() {
+ try {
+ int sleep = getSleepTime(dispatched);
+ TimeUnit.SECONDS.sleep(sleep);
+ dispatched.process();
+ } catch (Exception e) {
+ exception = e;
+ }
+ finished = true;
+ }
+
+ private int getSleepTime(AsyncProcessor<?> wrap) {
+ String preferHeader = wrap.getPreferHeader();
+ Matcher matcher = Pattern.compile("(" + TEC_ASYNC_SLEEP +
+ "=)(\\d*)").matcher(preferHeader);
+ if (matcher.find()) {
+ String waitTimeAsString = matcher.group(2);
+ return Integer.parseInt(waitTimeAsString);
+ }
+ return defaultSleepTimeInSeconds;
+ }
+
+ public Exception getException() {
+ return exception;
+ }
+
+ public boolean isFinished() {
+ return finished;
+ }
+
+ public AsyncProcessor<?> getDispatched() {
+ return dispatched;
+ }
+ }
+}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/async/TechnicalStatusMonitorServlet.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/async/TechnicalStatusMonitorServlet.java
new file mode 100644
index 0000000..6ed3722
--- /dev/null
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/async/TechnicalStatusMonitorServlet.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.server.tecsvc.async;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class TechnicalStatusMonitorServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+ private static final Logger LOG = LoggerFactory.getLogger(TechnicalStatusMonitorServlet.class);
+
+ @Override
+ protected void service(final HttpServletRequest request, final HttpServletResponse response)
+ throws ServletException, IOException {
+ try {
+ TechnicalAsyncService asyncService = TechnicalAsyncService.getInstance();
+ if("/list".equals(request.getPathInfo())) {
+ asyncService.listQueue(response);
+ } else if(asyncService.isStatusMonitorResource(request)) {
+ asyncService.handle(request, response);
+ }
+ } catch (final Exception e) {
+ LOG.error("Server Error", e);
+ throw new ServletException(e);
+ }
+ }
+}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/ActionData.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/ActionData.java
index 4dd118e..65a56c7 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/ActionData.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/ActionData.java
@@ -20,7 +20,9 @@
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Calendar;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -35,7 +37,10 @@
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.edmx.EdmxReference;
import org.apache.olingo.server.tecsvc.data.DataProvider.DataProviderException;
+import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
public class ActionData {
@@ -52,9 +57,18 @@
if ("UARTCollStringTwoParam".equals(name)) {
Parameter paramInt16 = parameters.get("ParameterInt16");
Parameter paramDuration = parameters.get("ParameterDuration");
- if (paramInt16 == null || paramDuration == null) {
- throw new DataProviderException("Missing parameters for action: UARTCollStringTwoParam",
- HttpStatusCode.BAD_REQUEST);
+ if ((paramInt16 == null || paramInt16.isNull()) || (paramDuration == null || paramDuration.isNull())) {
+ try {
+ String param16String = valueAsString(paramInt16, EdmPrimitiveTypeKind.Int16);
+ String paramDurationString = valueAsString(paramDuration, EdmPrimitiveTypeKind.Duration);
+
+ return new Property(null, name, ValueType.COLLECTION_PRIMITIVE, Arrays.asList(new String[] {
+ name + " int16 value: " + param16String,
+ name + " duration value: " + paramDurationString
+ }));
+ } catch(EdmPrimitiveTypeException e) {
+ throw new DataProviderException("EdmPrimitiveTypeException", e);
+ }
}
short loopCount = (Short) paramInt16.asPrimitive();
BigDecimal duration = (BigDecimal) paramDuration.asPrimitive();
@@ -64,7 +78,7 @@
for (int i = 0; i < loopCount; i++) {
try {
String value = primDuration.valueToString(duration, false, null, null, null, null);
- collectionValues.add(value);
+ collectionValues.add(name + " duration value: " + value);
} catch (EdmPrimitiveTypeException e) {
throw new DataProviderException("EdmPrimitiveTypeException", e);
}
@@ -75,6 +89,13 @@
throw new DataProviderException("Action " + name + " is not yet implemented.");
}
+ private static <T> String valueAsString(final Parameter parameter, final EdmPrimitiveTypeKind kind)
+ throws EdmPrimitiveTypeException {
+ return parameter == null ? "null"
+ : OData.newInstance().createPrimitiveTypeInstance(kind)
+ .valueToString(parameter.asPrimitive(), null, null, null, null, null);
+ }
+
protected static Property complexAction(final String name, final Map<String, Parameter> parameters)
throws DataProviderException {
if ("UARTCTTwoPrimParam".equals(name)) {
@@ -134,6 +155,9 @@
protected static EntityActionResult entityAction(final String name, final Map<String, Parameter> parameters)
throws DataProviderException {
+ final ServiceMetadata metadata = OData.newInstance().createServiceMetadata(new EdmTechProvider(),
+ Collections.<EdmxReference> emptyList(),null);
+
if ("UARTETTwoKeyTwoPrimParam".equals(name)) {
Parameter parameter = parameters.get("ParameterInt16");
Short number;
@@ -143,7 +167,7 @@
number = (short) 0;
}
- EntityCollection entityCollection = new DataCreator().getData().get("ESTwoKeyTwoPrim");
+ EntityCollection entityCollection = new DataCreator(metadata.getEdm()).getData().get("ESTwoKeyTwoPrim");
for (Entity entity : entityCollection.getEntities()) {
Object asPrimitive = entity.getProperty("PropertyInt16").asPrimitive();
if (number.equals(asPrimitive)) {
@@ -154,7 +178,7 @@
throw new DataProviderException("Entity not found with key: " + number, HttpStatusCode.NOT_FOUND);
} else if ("UARTETAllPrimParam".equals(name)) {
Parameter paramDate = parameters.get("ParameterDate");
- EntityCollection entityCollection = new DataCreator().getData().get("ESAllPrim");
+ EntityCollection entityCollection = new DataCreator(metadata.getEdm()).getData().get("ESAllPrim");
if (paramDate != null) {
Calendar date = (Calendar) paramDate.asPrimitive();
boolean freeKey;
@@ -235,17 +259,19 @@
return new Entity()
.addProperty(DataCreator.createPrimitive("PropertyInt16", number))
.addProperty(DataCreator.createPrimitive("PropertyString", "UARTCollETKeyNavParam int16 value: " + number))
- .addProperty(
- DataCreator.createComplex("PropertyCompNav", DataCreator.createPrimitive("PropertyInt16", 0)))
- .addProperty(createKeyNavAllPrimComplexValue("PropertyCompAllPrim")).addProperty(
- DataCreator.createComplex("PropertyCompTwoPrim", DataCreator.createPrimitive("PropertyInt16", 0),
- DataCreator.createPrimitive("PropertyString", ""))).addProperty(
- DataCreator.createPrimitiveCollection("CollPropertyString"))
- .addProperty(DataCreator.createPrimitiveCollection("CollPropertyInt16")).addProperty(
- DataCreator.createComplexCollection("CollPropertyComp"))
- .addProperty(
- DataCreator.createComplex("PropertyCompCompNav", DataCreator.createPrimitive("PropertyString", ""),
- DataCreator.createComplex("PropertyCompNav", DataCreator.createPrimitive("PropertyInt16", 0))));
+ .addProperty(DataCreator.createComplex("PropertyCompNav",
+ DataCreator.createPrimitive("PropertyInt16", (short) 0)))
+ .addProperty(createKeyNavAllPrimComplexValue("PropertyCompAllPrim"))
+ .addProperty(DataCreator.createComplex("PropertyCompTwoPrim",
+ DataCreator.createPrimitive("PropertyInt16", (short) 0),
+ DataCreator.createPrimitive("PropertyString", ""))).addProperty(
+ DataCreator.createPrimitiveCollection("CollPropertyString"))
+ .addProperty(DataCreator.createPrimitiveCollection("CollPropertyInt16"))
+ .addProperty(DataCreator.createComplexCollection("CollPropertyComp"))
+ .addProperty(DataCreator.createComplex("PropertyCompCompNav",
+ DataCreator.createPrimitive("PropertyString", ""),
+ DataCreator.createComplex("PropertyCompNav",
+ DataCreator.createPrimitive("PropertyInt16", (short) 0))));
}
protected static Property createKeyNavAllPrimComplexValue(final String name) {
@@ -253,13 +279,13 @@
DataCreator.createPrimitive("PropertyString", ""),
DataCreator.createPrimitive("PropertyBinary", new byte[] {}),
DataCreator.createPrimitive("PropertyBoolean", false),
- DataCreator.createPrimitive("PropertyByte", 0),
+ DataCreator.createPrimitive("PropertyByte", (short) 0),
DataCreator.createPrimitive("PropertyDate", null),
DataCreator.createPrimitive("PropertyDateTimeOffset", null),
- DataCreator.createPrimitive("PropertyDecimal", 0),
- DataCreator.createPrimitive("PropertySingle", 0),
- DataCreator.createPrimitive("PropertyDouble", 0),
- DataCreator.createPrimitive("PropertyDuration", 0),
+ DataCreator.createPrimitive("PropertyDecimal", BigDecimal.valueOf(0)),
+ DataCreator.createPrimitive("PropertySingle", (float) 0),
+ DataCreator.createPrimitive("PropertyDouble", 0D),
+ DataCreator.createPrimitive("PropertyDuration", BigDecimal.valueOf(0)),
DataCreator.createPrimitive("PropertyGuid", null),
DataCreator.createPrimitive("PropertyInt16", null),
DataCreator.createPrimitive("PropertyInt32", null),
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java
index 6a2f658..ce5daf3 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java
@@ -18,6 +18,8 @@
*/
package org.apache.olingo.server.tecsvc.data;
+import java.math.BigDecimal;
+import java.net.URI;
import java.nio.charset.Charset;
import java.sql.Timestamp;
import java.util.ArrayList;
@@ -36,6 +38,10 @@
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
+import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider;
public class DataCreator {
@@ -43,28 +49,28 @@
private final Map<String, EntityCollection> data;
- public DataCreator() {
+ public DataCreator(Edm edm) {
data = new HashMap<String, EntityCollection>();
- data.put("ESTwoPrim", createESTwoPrim());
- data.put("ESAllPrim", createESAllPrim());
- data.put("ESCompAllPrim", createESCompAllPrim());
- data.put("ESCollAllPrim", createESCollAllPrim());
- data.put("ESMixPrimCollComp", createESMixPrimCollComp());
- data.put("ESAllKey", createESAllKey());
- data.put("ESCompComp", createESCompComp());
- data.put("ESMedia", createESMedia());
- data.put("ESKeyNav", createESKeyNav());
- data.put("ESTwoKeyNav", createESTwoKeyNav());
- data.put("ESCompCollComp", createESCompCollComp());
- data.put("ESServerSidePaging", createESServerSidePaging());
- data.put("ESTwoKeyTwoPrim", createESTwoKeyTwoPrim());
- data.put("ESAllNullable", createESAllNullable());
- data.put("ESTwoBase", createESTwoBase());
- data.put("ESBaseTwoKeyNav", createESBaseTwoKeyNav());
- data.put("ESCompCollAllPrim", createESCompCollAllPrim());
- data.put("ESFourKeyAlias", createESFourKeyAlias());
- data.put("ESBase", createESBase());
- data.put("ESCompMixPrimCollComp", createESCompMixPrimCollComp());
+ data.put("ESTwoPrim", createESTwoPrim(edm));
+ data.put("ESAllPrim", createESAllPrim(edm));
+ data.put("ESCompAllPrim", createESCompAllPrim(edm));
+ data.put("ESCollAllPrim", createESCollAllPrim(edm));
+ data.put("ESMixPrimCollComp", createESMixPrimCollComp(edm));
+ data.put("ESAllKey", createESAllKey(edm));
+ data.put("ESCompComp", createESCompComp(edm));
+ data.put("ESMedia", createESMedia(edm));
+ data.put("ESKeyNav", createESKeyNav(edm));
+ data.put("ESTwoKeyNav", createESTwoKeyNav(edm));
+ data.put("ESCompCollComp", createESCompCollComp(edm));
+ data.put("ESServerSidePaging", createESServerSidePaging(edm));
+ data.put("ESTwoKeyTwoPrim", createESTwoKeyTwoPrim(edm));
+ data.put("ESAllNullable", createESAllNullable(edm));
+ data.put("ESTwoBase", createESTwoBase(edm));
+ data.put("ESBaseTwoKeyNav", createESBaseTwoKeyNav(edm));
+ data.put("ESCompCollAllPrim", createESCompCollAllPrim(edm));
+ data.put("ESFourKeyAlias", createESFourKeyAlias(edm));
+ data.put("ESBase", createESBase(edm));
+ data.put("ESCompMixPrimCollComp", createESCompMixPrimCollComp(edm));
linkESTwoPrim(data);
linkESAllPrim(data);
@@ -72,153 +78,157 @@
linkESTwoKeyNav(data);
}
- @SuppressWarnings("unchecked")
- private EntityCollection createESCompMixPrimCollComp() {
+ private EntityCollection createESCompMixPrimCollComp(Edm edm) {
final EntityCollection entityCollection = new EntityCollection();
- entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", 1))
- .addProperty(createComplex("PropertyMixedPrimCollComp",
- createPrimitive("PropertyInt16", 1),
- createPrimitiveCollection("CollPropertyString",
- "Employee1@company.example",
- "Employee2@company.example",
- "Employee3@company.example"
- ),
- createComplex("PropertyComp",
- createPrimitive("PropertyInt16", 333),
- createPrimitive("PropertyString", "TEST123")
- ),
- createComplexCollection("CollPropertyComp",
- Arrays.asList(new Property[] {
- createPrimitive("PropertyInt16", 222),
- createPrimitive("PropertyString", "TEST9876")
- }),
- Arrays.asList(new Property[] {
- createPrimitive("PropertyInt16", 333),
- createPrimitive("PropertyString", "TEST123")
- })
- )
- ))
- );
-
- entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", 2))
- .addProperty(createComplex("PropertyMixedPrimCollComp",
- createPrimitive("PropertyInt16", 1),
- createPrimitiveCollection("CollPropertyString",
- "Employee1@company.example",
- "Employee2@company.example",
- "Employee3@company.example"
- ),
- createComplex("PropertyComp",
- createPrimitive("PropertyInt16", 333),
- createPrimitive("PropertyString", "TEST123")
- ),
- createComplexCollection("CollPropertyComp",
- Arrays.asList(new Property[] {
- createPrimitive("PropertyInt16", 222),
- createPrimitive("PropertyString", "TEST9876")
- }),
- Arrays.asList(new Property[] {
- createPrimitive("PropertyInt16", 333),
- createPrimitive("PropertyString", "TEST123")
- })
- )
- ))
- );
-
- entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", 3))
- .addProperty(createComplex("PropertyMixedPrimCollComp",
- createPrimitive("PropertyInt16", 1),
- createPrimitiveCollection("CollPropertyString",
- "Employee1@company.example",
- "Employee2@company.example",
- "Employee3@company.example"
- ),
- createComplex("PropertyComp",
- createPrimitive("PropertyInt16", 333),
- createPrimitive("PropertyString", "TEST123")
- ),
- createComplexCollection("CollPropertyComp",
- Arrays.asList(new Property[] {
- createPrimitive("PropertyInt16", 222),
- createPrimitive("PropertyString", "TEST9876")
- }),
- Arrays.asList(new Property[] {
- createPrimitive("PropertyInt16", 333),
- createPrimitive("PropertyString", "TEST123")
- })
- )
- ))
- );
+ entityCollection.getEntities().add(createETCompMixPrimCollComp((short) 1));
+ entityCollection.getEntities().add(createETCompMixPrimCollComp((short) 2));
+ entityCollection.getEntities().add(createETCompMixPrimCollComp((short) 3));
+
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETCompMixPrimCollComp);
+ setEntityType(entityCollection, type);
+ createEntityId("ESCompMixPrimCollComp", entityCollection, type.getKeyPropertyRefs());
return entityCollection;
}
-
- private EntityCollection createESBase() {
+
+ @SuppressWarnings("unchecked")
+ private Entity createETCompMixPrimCollComp(Short propertyInt16) {
+ return new Entity()
+ .addProperty(createPrimitive("PropertyInt16",(short) 1))
+ .addProperty(createComplex("PropertyMixedPrimCollComp",
+ createPrimitive("PropertyInt16",(short) 1),
+ createPrimitiveCollection("CollPropertyString",
+ "Employee1@company.example",
+ "Employee2@company.example",
+ "Employee3@company.example"
+ ),
+ createComplex("PropertyComp",
+ createPrimitive("PropertyInt16",(short) 333),
+ createPrimitive("PropertyString", "TEST123")
+ ),
+ createComplexCollection("CollPropertyComp",
+ Arrays.asList(new Property[] {
+ createPrimitive("PropertyInt16",(short) 222),
+ createPrimitive("PropertyString", "TEST9876")
+ }),
+ Arrays.asList(new Property[] {
+ createPrimitive("PropertyInt16",(short) 333),
+ createPrimitive("PropertyString", "TEST123")
+ })
+ )
+ ));
+ }
+
+ private EntityCollection createESBase(Edm edm) {
final EntityCollection entityCollection = new EntityCollection();
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", 111))
+ .addProperty(createPrimitive("PropertyInt16",(short) 111))
.addProperty(createPrimitive("PropertyString", "TEST A"))
.addProperty(createPrimitive("AdditionalPropertyString_5", "TEST A 0815")));
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", 222))
+ .addProperty(createPrimitive("PropertyInt16",(short) 222))
.addProperty(createPrimitive("PropertyString", "TEST B"))
.addProperty(createPrimitive("AdditionalPropertyString_5", "TEST C 0815")));
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", 333))
+ .addProperty(createPrimitive("PropertyInt16",(short) 333))
.addProperty(createPrimitive("PropertyString", "TEST C"))
.addProperty(createPrimitive("AdditionalPropertyString_5", "TEST E 0815")));
-
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETBase);
+ setEntityType(entityCollection, type);
+ createEntityId("ESBase", entityCollection, type.getKeyPropertyRefs());
+
return entityCollection;
}
- private EntityCollection createESFourKeyAlias() {
+ private EntityCollection createESFourKeyAlias(Edm edm) {
final EntityCollection entityCollection = new EntityCollection();
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", 1))
+ .addProperty(createPrimitive("PropertyInt16",(short) 1))
.addProperty(createComplex("PropertyComp",
- createPrimitive("PropertyInt16", 11),
+ createPrimitive("PropertyInt16",(short) 11),
createPrimitive("PropertyString", "Num11")
))
.addProperty(createComplex("PropertyCompComp",
createComplex("PropertyComp",
- createPrimitive("PropertyInt16", 111),
+ createPrimitive("PropertyInt16",(short) 111),
createPrimitive("PropertyString", "Num111")
)
))
);
-
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETFourKeyAlias);
+ setEntityType(entityCollection, type);
+ createEntityId("ESFourKeyAlias", entityCollection, type.getKeyPropertyRefs());
+
return entityCollection;
}
- private EntityCollection createESCompCollAllPrim() {
+ private EntityCollection createESCompCollAllPrim(Edm edm) {
final EntityCollection entityCollection = new EntityCollection();
- entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", 5678))
+
+ entityCollection.getEntities().add(createETCompCollAllPrim((short) 5678));
+ entityCollection.getEntities().add(createETCompCollAllPrim((short) 12326));
+
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETCompCollAllPrim);
+ setEntityType(entityCollection, type);
+ createEntityId("ESCompCollAllPrim", entityCollection, type.getKeyPropertyRefs());
+ return entityCollection;
+ }
+
+ private Entity createETCompCollAllPrim(short propertyInt16) {
+ return new Entity()
+ .addProperty(createPrimitive("PropertyInt16", propertyInt16))
.addProperty(createComplex("PropertyComp",
createPrimitiveCollection("CollPropertyString",
"Employee1@company.example",
"Employee2@company.example",
"Employee3@company.example"),
- createPrimitiveCollection("CollPropertyBoolean", true, false, true),
- createPrimitiveCollection("CollPropertyByte", 50, 200, 249),
- createPrimitiveCollection("CollPropertySByte", -120, 120, 126),
- createPrimitiveCollection("CollPropertyInt16", 1000, 2000, 30112),
- createPrimitiveCollection("CollPropertyInt32", 23232323, 11223355, 10000001),
- createPrimitiveCollection("CollPropertyInt64", 929292929292L, 333333333333L, 444444444444L),
- createPrimitiveCollection("CollPropertySingle", 1790, 26600, 3210),
- createPrimitiveCollection("CollPropertyDouble", -17900, -27800000, 3210),
- createPrimitiveCollection("CollPropertyDecimal", 12, -2, 1234),
- createPrimitiveCollection("CollPropertyByte", 50, 200, 249),
+ createPrimitiveCollection("CollPropertyBoolean",
+ true,
+ false,
+ true),
+ createPrimitiveCollection("CollPropertyByte",
+ (short) 50,
+ (short) 200,
+ (short) 249),
+ createPrimitiveCollection("CollPropertySByte",
+ (byte) -120,
+ (byte) 120,
+ (byte) 126),
+ createPrimitiveCollection("CollPropertyInt16",
+ (short) 1000,
+ (short) 2000,
+ (short) 30112),
+ createPrimitiveCollection("CollPropertyInt32",
+ 23232323,
+ 11223355,
+ 10000001),
+ createPrimitiveCollection("CollPropertyInt64",
+ 929292929292L,
+ 333333333333L,
+ 444444444444L),
+ createPrimitiveCollection("CollPropertySingle",
+ (float) 1790,
+ (float) 26600,
+ (float) 3210),
+ createPrimitiveCollection("CollPropertyDouble",
+ -17900D,
+ -27800000D,
+ 3210D),
+ createPrimitiveCollection("CollPropertyDecimal",
+ BigDecimal.valueOf(12),
+ BigDecimal.valueOf(-2),
+ BigDecimal.valueOf(1234)),
+ createPrimitiveCollection("CollPropertyByte",
+ (short) 50,
+ (short) 200,
+ (short) 249),
createPrimitiveCollection("CollPropertyBinary",
new byte[] { -85, -51, -17 },
new byte[] { 1, 35, 69 },
@@ -249,106 +259,66 @@
getTime(23, 59, 59),
getTime(1, 12, 33)
)
- ))
- );
-
- entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", 12326))
- .addProperty(createComplex("PropertyComp",
- createPrimitiveCollection("CollPropertyString",
- "Employee1@company.example",
- "Employee2@company.example",
- "Employee3@company.example"),
- createPrimitiveCollection("CollPropertyBoolean", true, false, true),
- createPrimitiveCollection("CollPropertyByte", 50, 200, 249),
- createPrimitiveCollection("CollPropertySByte", -120, 120, 126),
- createPrimitiveCollection("CollPropertyInt16", 1000, 2000, 30112),
- createPrimitiveCollection("CollPropertyInt32", 23232323, 11223355, 10000001),
- createPrimitiveCollection("CollPropertyInt64", 929292929292L, 333333333333L, 444444444444L),
- createPrimitiveCollection("CollPropertySingle", 1790, 26600, 3210),
- createPrimitiveCollection("CollPropertyDouble", -17900, -27800000, 3210),
- createPrimitiveCollection("CollPropertyDecimal", 12, -2, 1234),
- createPrimitiveCollection("CollPropertyByte", 50, 200, 249),
- createPrimitiveCollection("CollPropertyBinary",
- new byte[] { -85, -51, -17 },
- new byte[] { 1, 35, 69 },
- new byte[] { 84, 103, -119 }
- ),
- createPrimitiveCollection("CollPropertyDate",
- getDateTime(1958, 12, 3, 0, 0, 0),
- getDateTime(1999, 8, 5, 0, 0, 0),
- getDateTime(2013, 6, 25, 0, 0, 0)
- ),
- createPrimitiveCollection("CollPropertyDateTimeOffset",
- getDateTime(2015, 8, 12, 3, 8, 34),
- getDateTime(1970, 3, 28, 12, 11, 10),
- getDateTime(1948, 2, 17, 9, 9, 9)
- ),
- createPrimitiveCollection("CollPropertyDuration",
- getDurration(0, 0, 0, 13),
- getDurration(0, 5, 28, 20),
- getDurration(0, 1, 0, 0)
- ),
- createPrimitiveCollection("CollPropertyGuid",
- UUID.fromString("ffffff67-89ab-cdef-0123-456789aaaaaa"),
- UUID.fromString("eeeeee67-89ab-cdef-0123-456789bbbbbb"),
- UUID.fromString("cccccc67-89ab-cdef-0123-456789cccccc")
- ),
- createPrimitiveCollection("CollPropertyTimeOfDay",
- getTime(4, 14, 13),
- getTime(23, 59, 59),
- getTime(1, 12, 33)
- )
- ))
- );
-
- return entityCollection;
+ ));
}
-
- private EntityCollection createESBaseTwoKeyNav() {
+
+ private EntityCollection createESBaseTwoKeyNav(Edm edm) {
final EntityCollection entityCollection = new EntityCollection();
- entityCollection.getEntities().add(createESTwoKeyNavEntity(1, "1")
- .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
+ entityCollection.getEntities().add(
+ createESTwoKeyNavEntity((short) 1, "1")
+ .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
- entityCollection.getEntities().add(createESTwoKeyNavEntity(1, "2")
- .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
+ entityCollection.getEntities().add(
+ createESTwoKeyNavEntity((short) 1, "2")
+ .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
- entityCollection.getEntities().add(createESTwoKeyNavEntity(2, "1")
- .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
+ entityCollection.getEntities().add(
+ createESTwoKeyNavEntity((short) 2, "1")
+ .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
- entityCollection.getEntities().add(createESTwoKeyNavEntity(3, "1")
- .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
+ entityCollection.getEntities().add(
+ createESTwoKeyNavEntity((short) 3, "1")
+ .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
+
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav);
+ setEntityType(entityCollection, type);
+ createEntityId("ESBaseTwoKeyNav", entityCollection, type.getKeyPropertyRefs());
+
return entityCollection;
}
- private EntityCollection createESTwoBase() {
+ private EntityCollection createESTwoBase(Edm edm) {
final EntityCollection entityCollection = new EntityCollection();
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", 111))
+ .addProperty(createPrimitive("PropertyInt16",(short) 111))
.addProperty(createPrimitive("PropertyString", "TEST A"))
.addProperty(createPrimitive("AdditionalPropertyString_5", "TEST A 0815"))
.addProperty(createPrimitive("AdditionalPropertyString_6", "TEST B 0815")));
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", 222))
+ .addProperty(createPrimitive("PropertyInt16",(short) 222))
.addProperty(createPrimitive("PropertyString", "TEST B"))
.addProperty(createPrimitive("AdditionalPropertyString_5", "TEST C 0815"))
.addProperty(createPrimitive("AdditionalPropertyString_6", "TEST D 0815")));
entityCollection.getEntities().add(new Entity()
- .addProperty(createPrimitive("PropertyInt16", 333))
+ .addProperty(createPrimitive("PropertyInt16",(short) 333))
.addProperty(createPrimitive("PropertyString", "TEST C"))
.addProperty(createPrimitive("AdditionalPropertyString_5", "TEST E 0815"))
.addProperty(createPrimitive("AdditionalPropertyString_6", "TEST F 0815")));
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETTwoBase);
+ setEntityType(entityCollection, type);
+ createEntityId("ESTwoBase", entityCollection, type.getKeyPropertyRefs());
+
return entityCollection;
}
- private EntityCollection createESAllNullable() {
+ private EntityCollection createESAllNullable(Edm edm) {
final EntityCollection entityCollection = new EntityCollection();
entityCollection.getEntities().add(
new Entity()
- .addProperty(createPrimitive("PropertyKey", 1))
+ .addProperty(createPrimitive("PropertyKey",(short) 1))
.addProperty(createPrimitive("PropertyInt16", null))
.addProperty(createPrimitive("PropertyString", null))
.addProperty(createPrimitive("PropertyBoolean", null))
@@ -369,15 +339,42 @@
"spiderman@comic.com",
null,
"spidergirl@comic.com"))
- .addProperty(createPrimitiveCollection("CollPropertyBoolean", true, null, false))
- .addProperty(createPrimitiveCollection("CollPropertyByte", 50, null, 249))
- .addProperty(createPrimitiveCollection("CollPropertySByte", -120, null, 126))
- .addProperty(createPrimitiveCollection("CollPropertyInt16", 1000, null, 30112))
- .addProperty(createPrimitiveCollection("CollPropertyInt32", 23232323, null, 10000001))
- .addProperty(createPrimitiveCollection("CollPropertyInt64", 929292929292L, null, 444444444444L))
- .addProperty(createPrimitiveCollection("CollPropertySingle", 1790, null, 3210))
- .addProperty(createPrimitiveCollection("CollPropertyDouble", -17900, null, 3210))
- .addProperty(createPrimitiveCollection("CollPropertyDecimal", 12, null, 1234))
+ .addProperty(createPrimitiveCollection("CollPropertyBoolean",
+ true,
+ null,
+ false))
+ .addProperty(createPrimitiveCollection("CollPropertyByte",
+ (short) 50,
+ null,
+ (short) 249))
+ .addProperty(createPrimitiveCollection("CollPropertySByte",
+ (byte) -120,
+ null,
+ (byte) 126))
+ .addProperty(createPrimitiveCollection("CollPropertyInt16",
+ (short) 1000,
+ null,
+ (short) 30112))
+ .addProperty(createPrimitiveCollection("CollPropertyInt32",
+ 23232323,
+ null,
+ 10000001))
+ .addProperty(createPrimitiveCollection("CollPropertyInt64",
+ 929292929292L,
+ null,
+ 444444444444L))
+ .addProperty(createPrimitiveCollection("CollPropertySingle",
+ (float) 1790,
+ null,
+ (float) 3210))
+ .addProperty(createPrimitiveCollection("CollPropertyDouble",
+ -17900D,
+ null,
+ 3210D))
+ .addProperty(createPrimitiveCollection("CollPropertyDecimal",
+ BigDecimal.valueOf(12),
+ null,
+ BigDecimal.valueOf(1234)))
.addProperty(createPrimitiveCollection("CollPropertyBinary",
new byte[] { -85, -51, -17 },
null,
@@ -404,7 +401,9 @@
getTime(0, 37, 13))
));
-
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETAllNullable);
+ setEntityType(entityCollection, type);
+ createEntityId("ESAllNullable", entityCollection, type.getKeyPropertyRefs());
return entityCollection;
}
@@ -412,106 +411,155 @@
return data;
}
- private EntityCollection createESTwoKeyTwoPrim() {
+ private EntityCollection createESTwoKeyTwoPrim(Edm edm) {
EntityCollection entityCollection = new EntityCollection();
entityCollection.getEntities().add(createETTwoKeyTwoPrimEntity((short) 32767, "Test String1"));
entityCollection.getEntities().add(createETTwoKeyTwoPrimEntity((short) -365, "Test String2"));
entityCollection.getEntities().add(createETTwoKeyTwoPrimEntity((short) -32766, "Test String3"));
+
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETTwoKeyTwoPrim);
+ setEntityType(entityCollection, type);
+ createEntityId("ESTwoKeyTwoPrim", entityCollection, type.getKeyPropertyRefs());
+
return entityCollection;
}
private Entity createETTwoKeyTwoPrimEntity(final short propertyInt16, final String propertyString) {
- return new Entity().addProperty(createPrimitive("PropertyInt16", propertyInt16))
+ return new Entity()
+ .addProperty(createPrimitive("PropertyInt16", propertyInt16))
.addProperty(createPrimitive("PropertyString", propertyString));
}
- private EntityCollection createESServerSidePaging() {
+ private EntityCollection createESServerSidePaging(Edm edm) {
EntityCollection entityCollection = new EntityCollection();
- for (int i = 1; i <= 503; i++) {
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", i))
- .addProperty(createPrimitive("PropertyString", "Number:" + i)));
+ for (short i = 1; i <= 503; i++) {
+ entityCollection.getEntities().add(new Entity()
+ .addProperty(createPrimitive("PropertyInt16", i))
+ .addProperty(createPrimitive("PropertyString", "Number:" + i)));
}
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETServerSidePaging);
+ setEntityType(entityCollection, type);
+ createEntityId("ESServerSidePaging", entityCollection, type.getKeyPropertyRefs());
+
return entityCollection;
}
- private EntityCollection createESKeyNav() {
+ private EntityCollection createESKeyNav(Edm edm) {
final EntityCollection entityCollection = new EntityCollection();
- entityCollection.getEntities().add(createETKeyNavEntity(1, "I am String Property 1"));
- entityCollection.getEntities().add(createETKeyNavEntity(2, "I am String Property 2"));
- entityCollection.getEntities().add(createETKeyNavEntity(3, "I am String Property 3"));
+ entityCollection.getEntities().add(createETKeyNavEntity((short) 1, "I am String Property 1"));
+ entityCollection.getEntities().add(createETKeyNavEntity((short) 2, "I am String Property 2"));
+ entityCollection.getEntities().add(createETKeyNavEntity((short) 3, "I am String Property 3"));
+
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETKeyNav);
+ setEntityType(entityCollection, type);
+ createEntityId("ESKeyNav", entityCollection, type.getKeyPropertyRefs());
return entityCollection;
}
@SuppressWarnings("unchecked")
- private Entity createETKeyNavEntity(final int propertyInt16, final String propertyString) {
- return new Entity().addProperty(createPrimitive("PropertyInt16", propertyInt16))
+ private Entity createETKeyNavEntity(final short propertyInt16, final String propertyString) {
+ return new Entity()
+ .addProperty(createPrimitive("PropertyInt16", propertyInt16))
.addProperty(createPrimitive("PropertyString", propertyString))
- .addProperty(createComplex("PropertyCompNav", createPrimitive("PropertyInt16", 1)))
- .addProperty(createKeyNavAllPrimComplexValue("PropertyCompAllPrim")).addProperty(
- createComplex("PropertyCompTwoPrim", createPrimitive("PropertyInt16", 16),
- createPrimitive("PropertyString", "Test123"))).addProperty(
- createPrimitiveCollection("CollPropertyString", "Employee1@company.example", "Employee2@company.example",
- "Employee3@company.example"))
- .addProperty(createPrimitiveCollection("CollPropertyInt16", 1000, 2000, 30112)).addProperty(
- createComplexCollection("CollPropertyComp",
- Arrays.asList(createPrimitive("PropertyInt16", 1), createKeyNavAllPrimComplexValue("PropertyComp")),
- Arrays.asList(createPrimitive("PropertyInt16", 2), createKeyNavAllPrimComplexValue("PropertyComp")),
- Arrays.asList(createPrimitive("PropertyInt16", 3), createKeyNavAllPrimComplexValue("PropertyComp"))))
- .addProperty(createComplex("PropertyCompCompNav", createPrimitive("PropertyString", "1"),
- createComplex("PropertyCompNav", createPrimitive("PropertyInt16", 1))));
+ .addProperty(createComplex("PropertyCompNav",
+ createPrimitive("PropertyInt16", 1)))
+ .addProperty(createKeyNavAllPrimComplexValue("PropertyCompAllPrim"))
+ .addProperty(createComplex("PropertyCompTwoPrim",
+ createPrimitive("PropertyInt16",(short) 16),
+ createPrimitive("PropertyString", "Test123")))
+ .addProperty(createPrimitiveCollection("CollPropertyString",
+ "Employee1@company.example",
+ "Employee2@company.example",
+ "Employee3@company.example"))
+ .addProperty(createPrimitiveCollection("CollPropertyInt16",
+ (short) 1000,
+ (short) 2000,
+ (short) 30112))
+ .addProperty(createComplexCollection("CollPropertyComp",
+ Arrays.asList(
+ createPrimitive("PropertyInt16",(short) 1),
+ createKeyNavAllPrimComplexValue("PropertyComp")),
+ Arrays.asList(
+ createPrimitive("PropertyInt16",(short) 2),
+ createKeyNavAllPrimComplexValue("PropertyComp")),
+ Arrays.asList(
+ createPrimitive("PropertyInt16",(short) 3),
+ createKeyNavAllPrimComplexValue("PropertyComp"))))
+ .addProperty(createComplex("PropertyCompCompNav",
+ createPrimitive("PropertyString", "1"),
+ createComplex("PropertyCompNav",
+ createPrimitive("PropertyInt16",(short) 1))));
}
- private EntityCollection createESTwoKeyNav() {
+ private EntityCollection createESTwoKeyNav(Edm edm) {
final EntityCollection entityCollection = new EntityCollection();
- entityCollection.getEntities().add(createESTwoKeyNavEntity(1, "1"));
- entityCollection.getEntities().add(createESTwoKeyNavEntity(1, "2"));
- entityCollection.getEntities().add(createESTwoKeyNavEntity(2, "1"));
- entityCollection.getEntities().add(createESTwoKeyNavEntity(3, "1"));
+ entityCollection.getEntities().add(createESTwoKeyNavEntity((short) 1, "1"));
+ entityCollection.getEntities().add(createESTwoKeyNavEntity((short) 1, "2"));
+ entityCollection.getEntities().add(createESTwoKeyNavEntity((short) 2, "1"));
+ entityCollection.getEntities().add(createESTwoKeyNavEntity((short) 3, "1"));
+
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETTwoKeyNav);
+ setEntityType(entityCollection, type);
+ createEntityId("ESTwoKeyNav", entityCollection, type.getKeyPropertyRefs());
return entityCollection;
}
@SuppressWarnings("unchecked")
- private Entity createESTwoKeyNavEntity(final int propertyInt16, final String propertyString) {
+ private Entity createESTwoKeyNavEntity(final short propertyInt16, final String propertyString) {
return new Entity()
.addProperty(createPrimitive("PropertyInt16", propertyInt16))
.addProperty(createPrimitive("PropertyString", propertyString))
- .addProperty(
- createComplex("PropertyComp", createPrimitive("PropertyInt16", 11),
- createComplex("PropertyComp", createPrimitive("PropertyString", "StringValue"),
- createPrimitive("PropertyBinary", new byte[] { 1, 35, 69, 103, -119, -85, -51, -17 }),
- createPrimitive("PropertyBoolean", true), createPrimitive("PropertyByte", 255),
- createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 7, 16, 23)),
- createPrimitive("PropertyDecimal", 34), createPrimitive("PropertySingle", 179000000000000000000D),
- createPrimitive("PropertyDouble", -179000000000000000000D), createPrimitive("PropertyDuration", 6),
- createPrimitive("PropertyGuid", UUID.fromString("01234567-89ab-cdef-0123-456789abcdef")),
- createPrimitive("PropertyInt16", Short.MAX_VALUE),
- createPrimitive("PropertyInt32", Integer.MAX_VALUE),
- createPrimitive("PropertyInt64", Long.MAX_VALUE), createPrimitive("PropertySByte", Byte.MAX_VALUE),
- createPrimitive("PropertyTimeOfDay", getTime(21, 5, 59)))))
- .addProperty(
- createComplex("PropertyCompNav", createPrimitive("PropertyInt16", 1),
- createKeyNavAllPrimComplexValue("PropertyComp")))
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyInt16", 11),
+ createComplex("PropertyComp",
+ createPrimitive("PropertyString", "StringValue"),
+ createPrimitive("PropertyBinary", new byte[] { 1, 35, 69, 103, -119, -85, -51, -17 }),
+ createPrimitive("PropertyBoolean", true),
+ createPrimitive("PropertyByte", (short) 255),
+ createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 7, 16, 23)),
+ createPrimitive("PropertyDecimal", BigDecimal.valueOf(34)),
+ createPrimitive("PropertySingle", (float) 179000000000000000000D),
+ createPrimitive("PropertyDouble", -179000000000000000000D),
+ createPrimitive("PropertyDuration", BigDecimal.valueOf(6)),
+ createPrimitive("PropertyGuid", UUID.fromString("01234567-89ab-cdef-0123-456789abcdef")),
+ createPrimitive("PropertyInt16", Short.MAX_VALUE),
+ createPrimitive("PropertyInt32", Integer.MAX_VALUE),
+ createPrimitive("PropertyInt64", Long.MAX_VALUE),
+ createPrimitive("PropertySByte", Byte.MAX_VALUE),
+ createPrimitive("PropertyTimeOfDay", getTime(21, 5, 59)))))
+ .addProperty(createComplex("PropertyCompNav",
+ createPrimitive("PropertyInt16", (short) 1),
+ createKeyNavAllPrimComplexValue("PropertyComp")))
.addProperty(createComplexCollection("CollPropertyComp"))
- .addProperty(createComplexCollection("CollPropertyCompNav", Arrays.asList(createPrimitive("PropertyInt16", 1))))
- .addProperty(createPrimitiveCollection("CollPropertyString", 1, 2)).addProperty(
- createComplex("PropertyCompTwoPrim", createPrimitive("PropertyInt16", 11),
- createPrimitive("PropertyString", "11")));
+ .addProperty(createComplexCollection("CollPropertyCompNav",
+ Arrays.asList(
+ createPrimitive("PropertyInt16", (short) 1))))
+ .addProperty(createPrimitiveCollection("CollPropertyString",
+ "1",
+ "2"))
+ .addProperty(createComplex("PropertyCompTwoPrim",
+ createPrimitive("PropertyInt16", (short) 11),
+ createPrimitive("PropertyString", "11")));
}
protected Property createKeyNavAllPrimComplexValue(final String name) {
- return createComplex(name, createPrimitive("PropertyString", "First Resource - positive values"),
+ return createComplex(name,
+ createPrimitive("PropertyString", "First Resource - positive values"),
createPrimitive("PropertyBinary", new byte[] { 1, 35, 69, 103, -119, -85, -51, -17 }),
- createPrimitive("PropertyBoolean", true), createPrimitive("PropertyByte", 255),
+ createPrimitive("PropertyBoolean", true),
+ createPrimitive("PropertyByte", (short) 255),
createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 7, 16, 23)),
createPrimitive("PropertyDateTimeOffset", getTimestamp(2012, 12, 3, 7, 16, 23, 0)),
- createPrimitive("PropertyDecimal", 34), createPrimitive("PropertySingle", 179000000000000000000D),
- createPrimitive("PropertyDouble", -179000000000000000000D), createPrimitive("PropertyDuration", 6),
+ createPrimitive("PropertyDecimal", 34),
+ createPrimitive("PropertySingle", (float) 179000000000000000000D),
+ createPrimitive("PropertyDouble", -179000000000000000000D),
+ createPrimitive("PropertyDuration", BigDecimal.valueOf(6)),
createPrimitive("PropertyGuid", UUID.fromString("01234567-89ab-cdef-0123-456789abcdef")),
createPrimitive("PropertyInt16", Short.MAX_VALUE), createPrimitive("PropertyInt32", Integer.MAX_VALUE),
createPrimitive("PropertyInt64", Long.MAX_VALUE), createPrimitive("PropertySByte", Byte.MAX_VALUE),
@@ -519,303 +567,487 @@
}
@SuppressWarnings("unchecked")
- private EntityCollection createESCompCollComp() {
+ private EntityCollection createESCompCollComp(Edm edm) {
final EntityCollection entityCollection = new EntityCollection();
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
- .addProperty(createComplex("PropertyComp", createComplexCollection("CollPropertyComp", Arrays
- .asList(createPrimitive("PropertyInt16", 555),
- createPrimitive("PropertyString", "1 Test Complex in Complex Property")), Arrays
- .asList(createPrimitive("PropertyInt16", 666),
- createPrimitive("PropertyString", "2 Test Complex in Complex Property")), Arrays
- .asList(createPrimitive("PropertyInt16", 777),
- createPrimitive("PropertyString", "3 Test Complex in Complex Property"))))));
+ entityCollection.getEntities().add(new Entity()
+ .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
+ .addProperty(createComplex("PropertyComp",
+ createComplexCollection("CollPropertyComp",
+ Arrays.asList(
+ createPrimitive("PropertyInt16",(short) 555),
+ createPrimitive("PropertyString", "1 Test Complex in Complex Property")),
+ Arrays.asList(
+ createPrimitive("PropertyInt16",(short) 666),
+ createPrimitive("PropertyString", "2 Test Complex in Complex Property")),
+ Arrays.asList(
+ createPrimitive("PropertyInt16",(short) 777),
+ createPrimitive("PropertyString", "3 Test Complex in Complex Property"))))));
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", 12345)).addProperty(
- createComplex("PropertyComp", createComplexCollection("CollPropertyComp", Arrays
- .asList(createPrimitive("PropertyInt16", 888),
- createPrimitive("PropertyString", "11 Test Complex in Complex Property")), Arrays
- .asList(createPrimitive("PropertyInt16", 999),
- createPrimitive("PropertyString", "12 Test Complex in Complex Property")), Arrays
- .asList(createPrimitive("PropertyInt16", 0),
- createPrimitive("PropertyString", "13 Test Complex in Complex Property"))))));
+ entityCollection.getEntities().add(new Entity()
+ .addProperty(createPrimitive("PropertyInt16", 12345))
+ .addProperty(createComplex("PropertyComp",
+ createComplexCollection("CollPropertyComp",
+ Arrays.asList(
+ createPrimitive("PropertyInt16",(short) 888),
+ createPrimitive("PropertyString", "11 Test Complex in Complex Property")),
+ Arrays.asList(
+ createPrimitive("PropertyInt16",(short) 999),
+ createPrimitive("PropertyString", "12 Test Complex in Complex Property")),
+ Arrays.asList(
+ createPrimitive("PropertyInt16",(short) 0),
+ createPrimitive("PropertyString", "13 Test Complex in Complex Property"))))));
+
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETCompCollComp);
+ setEntityType(entityCollection, type);
+ createEntityId("ESCompCollComp", entityCollection, type.getKeyPropertyRefs());
return entityCollection;
}
- private EntityCollection createESTwoPrim() {
+ private EntityCollection createESTwoPrim(Edm edm) {
EntityCollection entityCollection = new EntityCollection();
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", 32766))
- .addProperty(createPrimitive("PropertyString", "Test String1")));
+ entityCollection.getEntities().add(new Entity()
+ .addProperty(createPrimitive("PropertyInt16", (short) 32766))
+ .addProperty(createPrimitive("PropertyString", "Test String1")));
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", -365))
- .addProperty(createPrimitive("PropertyString", "Test String2")));
+ entityCollection.getEntities().add(new Entity()
+ .addProperty(createPrimitive("PropertyInt16", (short) -365))
+ .addProperty(createPrimitive("PropertyString", "Test String2")));
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", -32766))
- .addProperty(createPrimitive("PropertyString", null)));
+ entityCollection.getEntities().add(new Entity()
+ .addProperty(createPrimitive("PropertyInt16", (short) -32766))
+ .addProperty(createPrimitive("PropertyString", null)));
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
- .addProperty(createPrimitive("PropertyString", "Test String4")));
+ entityCollection.getEntities().add(new Entity()
+ .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
+ .addProperty(createPrimitive("PropertyString", "Test String4")));
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETTwoPrim);
+ setEntityType(entityCollection, type);
+ createEntityId("ESTwoPrim", entityCollection, type.getKeyPropertyRefs());
return entityCollection;
}
- private EntityCollection createESAllPrim() {
+ private void setEntityType(EntityCollection entityCollection, EdmEntityType type) {
+ for (Entity entity:entityCollection.getEntities()) {
+ entity.setType(type.getFullQualifiedName().getFullQualifiedNameAsString());
+ }
+ }
+
+ private EntityCollection createESAllPrim(Edm edm) {
EntityCollection entityCollection = new EntityCollection();
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
- .addProperty(createPrimitive("PropertyString", "First Resource - positive values"))
- .addProperty(createPrimitive("PropertyBoolean", true)).addProperty(createPrimitive("PropertyByte", 255))
- .addProperty(createPrimitive("PropertySByte", Byte.MAX_VALUE))
- .addProperty(createPrimitive("PropertyInt32", Integer.MAX_VALUE))
- .addProperty(createPrimitive("PropertyInt64", Long.MAX_VALUE))
- .addProperty(createPrimitive("PropertySingle", 1.79000000E+20))
- .addProperty(createPrimitive("PropertyDouble", -1.7900000000000000E+19))
- .addProperty(createPrimitive("PropertyDecimal", 34)).addProperty(createPrimitive("PropertyBinary",
- new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }))
- .addProperty(createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 0, 0, 0)))
- .addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2012, 12, 3, 7, 16, 23)))
- .addProperty(createPrimitive("PropertyDuration", 6)).addProperty(createPrimitive("PropertyGuid", GUID))
- .addProperty(createPrimitive("PropertyTimeOfDay", getTime(3, 26, 5))));
+ entityCollection.getEntities().add(new Entity()
+ .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
+ .addProperty(createPrimitive("PropertyString", "First Resource - positive values"))
+ .addProperty(createPrimitive("PropertyBoolean", true))
+ .addProperty(createPrimitive("PropertyByte", (short) 255))
+ .addProperty(createPrimitive("PropertySByte", Byte.MAX_VALUE))
+ .addProperty(createPrimitive("PropertyInt32", Integer.MAX_VALUE))
+ .addProperty(createPrimitive("PropertyInt64", Long.MAX_VALUE))
+ .addProperty(createPrimitive("PropertySingle", (float) 1.79000000E+20))
+ .addProperty(createPrimitive("PropertyDouble", -1.7900000000000000E+19))
+ .addProperty(createPrimitive("PropertyDecimal", BigDecimal.valueOf(34)))
+ .addProperty(createPrimitive("PropertyBinary",
+ new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }))
+ .addProperty(createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 0, 0, 0)))
+ .addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2012, 12, 3, 7, 16, 23)))
+ .addProperty(createPrimitive("PropertyDuration", BigDecimal.valueOf(6)))
+ .addProperty(createPrimitive("PropertyGuid", GUID))
+ .addProperty(createPrimitive("PropertyTimeOfDay", getTime(3, 26, 5))));
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", Short.MIN_VALUE))
+ entityCollection.getEntities().add(new Entity()
+ .addProperty(createPrimitive("PropertyInt16", Short.MIN_VALUE))
.addProperty(createPrimitive("PropertyString", "Second Resource - negative values"))
- .addProperty(createPrimitive("PropertyBoolean", false)).addProperty(createPrimitive("PropertyByte", 0))
+ .addProperty(createPrimitive("PropertyBoolean", false))
+ .addProperty(createPrimitive("PropertyByte", (short) 0))
.addProperty(createPrimitive("PropertySByte", Byte.MIN_VALUE))
.addProperty(createPrimitive("PropertyInt32", Integer.MIN_VALUE))
.addProperty(createPrimitive("PropertyInt64", Long.MIN_VALUE))
- .addProperty(createPrimitive("PropertySingle", -1.79000000E+08))
+ .addProperty(createPrimitive("PropertySingle", (float) -1.79000000E+08))
.addProperty(createPrimitive("PropertyDouble", -1.7900000000000000E+05))
- .addProperty(createPrimitive("PropertyDecimal", -34)).addProperty(createPrimitive("PropertyBinary",
+ .addProperty(createPrimitive("PropertyDecimal", BigDecimal.valueOf(-34)))
+ .addProperty(createPrimitive("PropertyBinary",
new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }))
.addProperty(createPrimitive("PropertyDate", getDateTime(2015, 11, 5, 0, 0, 0)))
.addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2005, 12, 3, 7, 17, 8)))
- .addProperty(createPrimitive("PropertyDuration", 9))
+ .addProperty(createPrimitive("PropertyDuration", BigDecimal.valueOf(9)))
.addProperty(createPrimitive("PropertyGuid", UUID.fromString("76543201-23ab-cdef-0123-456789dddfff")))
.addProperty(createPrimitive("PropertyTimeOfDay", getTime(23, 49, 14))));
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", (short) 0))
- .addProperty(createPrimitive("PropertyString", "")).addProperty(createPrimitive("PropertyBoolean", false))
- .addProperty(createPrimitive("PropertyByte", 0)).addProperty(createPrimitive("PropertySByte", 0))
- .addProperty(createPrimitive("PropertyInt32", 0)).addProperty(createPrimitive("PropertyInt64", 0))
- .addProperty(createPrimitive("PropertySingle", 0)).addProperty(createPrimitive("PropertyDouble", 0))
- .addProperty(createPrimitive("PropertyDecimal", 0))
+ entityCollection.getEntities().add(new Entity()
+ .addProperty(createPrimitive("PropertyInt16", (short) 0))
+ .addProperty(createPrimitive("PropertyString", ""))
+ .addProperty(createPrimitive("PropertyBoolean", false))
+ .addProperty(createPrimitive("PropertyByte", (short) 0))
+ .addProperty(createPrimitive("PropertySByte", 0))
+ .addProperty(createPrimitive("PropertyInt32", 0))
+ .addProperty(createPrimitive("PropertyInt64", 0L))
+ .addProperty(createPrimitive("PropertySingle", (float) 0))
+ .addProperty(createPrimitive("PropertyDouble", 0D))
+ .addProperty(createPrimitive("PropertyDecimal", BigDecimal.valueOf(0)))
.addProperty(createPrimitive("PropertyBinary", new byte[] {}))
.addProperty(createPrimitive("PropertyDate", getDateTime(1970, 1, 1, 0, 0, 0)))
.addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2005, 12, 3, 0, 0, 0)))
- .addProperty(createPrimitive("PropertyDuration", 0))
+ .addProperty(createPrimitive("PropertyDuration", BigDecimal.valueOf(0)))
.addProperty(createPrimitive("PropertyGuid", UUID.fromString("76543201-23ab-cdef-0123-456789cccddd")))
.addProperty(createPrimitive("PropertyTimeOfDay", getTime(0, 1, 1))));
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETAllPrim);
+ setEntityType(entityCollection, type);
+ createEntityId("ESAllPrim", entityCollection, type.getKeyPropertyRefs());
+
return entityCollection;
}
- private EntityCollection createESCompAllPrim() {
+ private EntityCollection createESCompAllPrim(Edm edm) {
EntityCollection entityCollection = new EntityCollection();
- Entity entity = new Entity();
- entity.addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE));
- entity.addProperty(createComplex("PropertyComp", createPrimitive("PropertyString", "First Resource - first"),
- createPrimitive("PropertyBinary",
- new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }),
- createPrimitive("PropertyBoolean", true), createPrimitive("PropertyByte", 255),
- createPrimitive("PropertyDate", getDateTime(2012, 10, 3, 0, 0, 0)),
- createPrimitive("PropertyDateTimeOffset", getTimestamp(2012, 10, 3, 7, 16, 23, 123456700)),
- createPrimitive("PropertyDecimal", 34.27), createPrimitive("PropertySingle", 1.79000000E+20),
- createPrimitive("PropertyDouble", -1.7900000000000000E+19), createPrimitive("PropertyDuration", 6),
- createPrimitive("PropertyGuid", GUID), createPrimitive("PropertyInt16", Short.MAX_VALUE),
- createPrimitive("PropertyInt32", Integer.MAX_VALUE), createPrimitive("PropertyInt64", Long.MAX_VALUE),
- createPrimitive("PropertySByte", Byte.MAX_VALUE), createPrimitive("PropertyTimeOfDay", getTime(1, 0, 1))));
+ Entity entity = new Entity()
+ .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyString", "First Resource - first"),
+ createPrimitive("PropertyBinary",
+ new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }),
+ createPrimitive("PropertyBoolean", true),
+ createPrimitive("PropertyByte", (short) 255),
+ createPrimitive("PropertyDate", getDateTime(2012, 10, 3, 0, 0, 0)),
+ createPrimitive("PropertyDateTimeOffset", getTimestamp(2012, 10, 3, 7, 16, 23, 123456700)),
+ createPrimitive("PropertyDecimal", BigDecimal.valueOf(34.27)),
+ createPrimitive("PropertySingle", (float) 1.79000000E+20),
+ createPrimitive("PropertyDouble", -1.7900000000000000E+19),
+ createPrimitive("PropertyDuration", BigDecimal.valueOf(6)),
+ createPrimitive("PropertyGuid", GUID),
+ createPrimitive("PropertyInt16", Short.MAX_VALUE),
+ createPrimitive("PropertyInt32", Integer.MAX_VALUE),
+ createPrimitive("PropertyInt64", Long.MAX_VALUE),
+ createPrimitive("PropertySByte", Byte.MAX_VALUE),
+ createPrimitive("PropertyTimeOfDay", getTime(1, 0, 1))));
entity.setETag("W/\"" + Short.MAX_VALUE + '\"');
entityCollection.getEntities().add(entity);
- entity = new Entity();
- entity.addProperty(createPrimitive("PropertyInt16", 7));
- entity.addProperty(createComplex("PropertyComp", createPrimitive("PropertyString", "Second Resource - second"),
+ entity = new Entity()
+ .addProperty(createPrimitive("PropertyInt16",(short) 7))
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyString", "Second Resource - second"),
createPrimitive("PropertyBinary",
new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }),
- createPrimitive("PropertyBoolean", true), createPrimitive("PropertyByte", 255),
+ createPrimitive("PropertyBoolean", true),
+ createPrimitive("PropertyByte", (short) 255),
createPrimitive("PropertyDate", getDateTime(2013, 11, 4, 0, 0, 0)),
createPrimitive("PropertyDateTimeOffset", getDateTime(2013, 11, 4, 7, 16, 23)),
- createPrimitive("PropertyDecimal", 34.27), createPrimitive("PropertySingle", 1.79000000E+20),
- createPrimitive("PropertyDouble", -1.7900000000000000E+02), createPrimitive("PropertyDuration", 6),
- createPrimitive("PropertyGuid", GUID), createPrimitive("PropertyInt16", 25),
- createPrimitive("PropertyInt32", Integer.MAX_VALUE), createPrimitive("PropertyInt64", Long.MAX_VALUE),
+ createPrimitive("PropertyDecimal", BigDecimal.valueOf(34.27)),
+ createPrimitive("PropertySingle", (float) 1.79000000E+20),
+ createPrimitive("PropertyDouble", -1.7900000000000000E+02),
+ createPrimitive("PropertyDuration", BigDecimal.valueOf(6)),
+ createPrimitive("PropertyGuid", GUID),
+ createPrimitive("PropertyInt16", (short) 25),
+ createPrimitive("PropertyInt32", Integer.MAX_VALUE),
+ createPrimitive("PropertyInt64", Long.MAX_VALUE),
createPrimitive("PropertySByte", Byte.MAX_VALUE),
createPrimitive("PropertyTimeOfDay", getTimestamp(1, 1, 1, 7, 45, 12, 765432100))));
entity.setETag("W/\"7\"");
entityCollection.getEntities().add(entity);
- entity = new Entity();
- entity.addProperty(createPrimitive("PropertyInt16", 0));
- entity.addProperty(createComplex("PropertyComp", createPrimitive("PropertyString", "Third Resource - third"),
+ entity = new Entity()
+ .addProperty(createPrimitive("PropertyInt16", (short) 0))
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyString", "Third Resource - third"),
createPrimitive("PropertyBinary",
new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }),
- createPrimitive("PropertyBoolean", true), createPrimitive("PropertyByte", 255),
+ createPrimitive("PropertyBoolean", true),
+ createPrimitive("PropertyByte", (short) 255),
createPrimitive("PropertyDate", getDateTime(2014, 12, 5, 0, 0, 0)),
createPrimitive("PropertyDateTimeOffset", getTimestamp(2014, 12, 5, 8, 17, 45, 123456700)),
- createPrimitive("PropertyDecimal", 17.98), createPrimitive("PropertySingle", 1.79000000E+20),
- createPrimitive("PropertyDouble", -1.7900000000000000E+02), createPrimitive("PropertyDuration", 6),
- createPrimitive("PropertyGuid", GUID), createPrimitive("PropertyInt16", -25),
- createPrimitive("PropertyInt32", Integer.MAX_VALUE), createPrimitive("PropertyInt64", Long.MAX_VALUE),
- createPrimitive("PropertySByte", Byte.MAX_VALUE), createPrimitive("PropertyTimeOfDay", getTime(13, 27, 45))));
+ createPrimitive("PropertyDecimal", BigDecimal.valueOf(17.98)),
+ createPrimitive("PropertySingle", 1.79000000E+20),
+ createPrimitive("PropertyDouble", -1.7900000000000000E+02),
+ createPrimitive("PropertyDuration", BigDecimal.valueOf(6)),
+ createPrimitive("PropertyGuid", GUID),
+ createPrimitive("PropertyInt16", (short) -25),
+ createPrimitive("PropertyInt32", Integer.MAX_VALUE),
+ createPrimitive("PropertyInt64", Long.MAX_VALUE),
+ createPrimitive("PropertySByte", Byte.MAX_VALUE),
+ createPrimitive("PropertyTimeOfDay", getTime(13, 27, 45))));
entity.setETag("W/\"0\"");
entityCollection.getEntities().add(entity);
+
+ entity = new Entity()
+ .addProperty(createPrimitive("PropertyInt16", (short) -32768))
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyString", null),
+ createPrimitive("PropertyBinary", null),
+ createPrimitive("PropertyBoolean", null),
+ createPrimitive("PropertyByte", null),
+ createPrimitive("PropertyDate", null),
+ createPrimitive("PropertyDateTimeOffset", null),
+ createPrimitive("PropertyDecimal", null),
+ createPrimitive("PropertySingle", null),
+ createPrimitive("PropertyDouble", null),
+ createPrimitive("PropertyDuration", null),
+ createPrimitive("PropertyGuid", null),
+ createPrimitive("PropertyInt16", null),
+ createPrimitive("PropertyInt32", null),
+ createPrimitive("PropertyInt64", null),
+ createPrimitive("PropertySByte", null),
+ createPrimitive("PropertyTimeOfDay", null)));
+ entity.setETag("W/\"-32768\"");
+ entityCollection.getEntities().add(entity);
+
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETCompAllPrim);
+ setEntityType(entityCollection, type);
+ createEntityId("ESCompAllPrim", entityCollection, type.getKeyPropertyRefs());
return entityCollection;
}
- private EntityCollection createESCollAllPrim() {
+ private EntityCollection createESCollAllPrim(Edm edm) {
EntityCollection entityCollection = new EntityCollection();
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", 1)).addProperty(
- createPrimitiveCollection("CollPropertyString", "Employee1@company.example", "Employee2@company.example",
+ entityCollection.getEntities().add(createETCollAllPrim((short) 1));
+ entityCollection.getEntities().add(createETCollAllPrim((short) 2));
+ entityCollection.getEntities().add(createETCollAllPrim((short) 3));
+
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETCollAllPrim);
+ setEntityType(entityCollection, type);
+ createEntityId("ESCollAllPrim", entityCollection, type.getKeyPropertyRefs());
+
+ return entityCollection;
+ }
+
+ private Entity createETCollAllPrim(Short propertyInt16) {
+ return new Entity()
+ .addProperty(createPrimitive("PropertyInt16", propertyInt16))
+ .addProperty(createPrimitiveCollection("CollPropertyString",
+ "Employee1@company.example",
+ "Employee2@company.example",
+ "Employee3@company.example"))
+ .addProperty(createPrimitiveCollection("CollPropertyBoolean",
+ true,
+ false,
+ true))
+ .addProperty(createPrimitiveCollection("CollPropertyByte",
+ (short) 50,
+ (short) 200,
+ (short) 249))
+ .addProperty(createPrimitiveCollection("CollPropertySByte",
+ -120,
+ 120,
+ 126))
+ .addProperty(createPrimitiveCollection("CollPropertyInt16",
+ (short) 1000,
+ (short) 2000,
+ (short) 30112))
+ .addProperty(createPrimitiveCollection("CollPropertyInt32",
+ 23232323,
+ 11223355,
+ 10000001))
+ .addProperty(createPrimitiveCollection("CollPropertyInt64",
+ 929292929292L,
+ 333333333333L,
+ 444444444444L))
+ .addProperty(createPrimitiveCollection("CollPropertySingle",
+ 1.79000000E+03,
+ 2.66000000E+04,
+ 3.21000000E+03))
+ .addProperty(createPrimitiveCollection("CollPropertyDouble",
+ -1.7900000000000000E+04,
+ -2.7800000000000000E+07,
+ 3.2100000000000000E+03))
+ .addProperty(createPrimitiveCollection("CollPropertyDecimal",
+ BigDecimal.valueOf(12),
+ BigDecimal.valueOf(-2),
+ BigDecimal.valueOf(1234)))
+ .addProperty(createPrimitiveCollection("CollPropertyBinary",
+ new byte[] { (byte) 0xAB, (byte) 0xCD, (byte) 0xEF },
+ new byte[] { 0x01, 0x23, 0x45 },
+ new byte[] { 0x54, 0x67, (byte) 0x89 }))
+ .addProperty(createPrimitiveCollection("CollPropertyDate",
+ getDateTime(1958, 12, 3, 0, 0, 0),
+ getDateTime(1999, 8, 5, 0, 0, 0),
+ getDateTime(2013, 6, 25, 0, 0, 0)))
+ .addProperty(createPrimitiveCollection("CollPropertyDateTimeOffset",
+ getDateTime(2015, 8, 12, 3, 8, 34),
+ getDateTime(1970, 3, 28, 12, 11, 10),
+ getDateTime(1948, 2, 17, 9, 9, 9)))
+ .addProperty(createPrimitiveCollection("CollPropertyDuration",
+ BigDecimal.valueOf(13),
+ BigDecimal.valueOf(19680),
+ BigDecimal.valueOf(3600)))
+ .addProperty(createPrimitiveCollection("CollPropertyGuid",
+ UUID.fromString("ffffff67-89ab-cdef-0123-456789aaaaaa"),
+ UUID.fromString("eeeeee67-89ab-cdef-0123-456789bbbbbb"),
+ UUID.fromString("cccccc67-89ab-cdef-0123-456789cccccc")))
+ .addProperty(createPrimitiveCollection("CollPropertyTimeOfDay",
+ getTime(4, 14, 13),
+ getTime(23, 59, 59),
+ getTime(1, 12, 33)));
+ }
+
+ private EntityCollection createESMixPrimCollComp(Edm edm) {
+ EntityCollection entityCollection = new EntityCollection();
+
+ entityCollection.getEntities().add(new Entity()
+ .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
+ .addProperty(createPrimitiveCollection("CollPropertyString",
+ "Employee1@company.example",
+ "Employee2@company.example",
"Employee3@company.example"))
- .addProperty(createPrimitiveCollection("CollPropertyBoolean", true, false, true))
- .addProperty(createPrimitiveCollection("CollPropertyByte", 50, 200, 249))
- .addProperty(createPrimitiveCollection("CollPropertySByte", -120, 120, 126))
- .addProperty(createPrimitiveCollection("CollPropertyInt16", 1000, 2000, 30112))
- .addProperty(createPrimitiveCollection("CollPropertyInt32", 23232323, 11223355, 10000001))
- .addProperty(createPrimitiveCollection("CollPropertyInt64", 929292929292L, 333333333333L, 444444444444L))
- .addProperty(createPrimitiveCollection("CollPropertySingle", 1.79000000E+03, 2.66000000E+04, 3.21000000E+03))
- .addProperty(createPrimitiveCollection("CollPropertyDouble", -1.7900000000000000E+04, -2.7800000000000000E+07,
- 3.2100000000000000E+03)).addProperty(createPrimitiveCollection("CollPropertyDecimal", 12, -2, 1234))
- .addProperty(
- createPrimitiveCollection("CollPropertyBinary", new byte[] { (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }, new
- byte[] { 0x01, 0x23, 0x45 },
- new byte[] { 0x54, 0x67, (byte) 0x89 })).addProperty(
- createPrimitiveCollection("CollPropertyDate", getDateTime(1958, 12, 3, 0, 0, 0),
- getDateTime(1999, 8, 5, 0, 0, 0), getDateTime(2013, 6, 25, 0, 0, 0))).addProperty(
- createPrimitiveCollection("CollPropertyDateTimeOffset", getDateTime(2015, 8, 12, 3, 8, 34),
- getDateTime(1970, 3, 28, 12, 11, 10), getDateTime(1948, 2, 17, 9, 9, 9)))
- .addProperty(createPrimitiveCollection("CollPropertyDuration", 13, 19680, 3600)).addProperty(
- createPrimitiveCollection("CollPropertyGuid", UUID.fromString("ffffff67-89ab-cdef-0123-456789aaaaaa"),
- UUID.fromString("eeeeee67-89ab-cdef-0123-456789bbbbbb"),
- UUID.fromString("cccccc67-89ab-cdef-0123-456789cccccc"))).addProperty(
- createPrimitiveCollection("CollPropertyTimeOfDay", getTime(4, 14, 13), getTime(23, 59, 59),
- getTime(1, 12, 33))));
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyInt16", (short) 111),
+ createPrimitive("PropertyString", "TEST A")))
+ .addProperty(createColPropertyComp()));
- Entity entity = new Entity();
- entity.getProperties().addAll(entityCollection.getEntities().get(0).getProperties());
- entity.getProperties().set(0, createPrimitive("PropertyInt16", 2));
- entityCollection.getEntities().add(entity);
+ entityCollection.getEntities().add(new Entity()
+ .addProperty(createPrimitive("PropertyInt16", (short) 7))
+ .addProperty(createPrimitiveCollection("CollPropertyString",
+ "Employee1@company.example",
+ "Employee2@company.example",
+ "Employee3@company.example"))
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyInt16", (short) 222),
+ createPrimitive("PropertyString", "TEST B")))
+ .addProperty(createColPropertyComp()));
- entity = new Entity();
- entity.getProperties().addAll(entityCollection.getEntities().get(0).getProperties());
- entity.getProperties().set(0, createPrimitive("PropertyInt16", 3));
- entityCollection.getEntities().add(entity);
+ entityCollection.getEntities().add(new Entity()
+ .addProperty(createPrimitive("PropertyInt16", (short)0))
+ .addProperty(createPrimitiveCollection("CollPropertyString",
+ "Employee1@company.example",
+ "Employee2@company.example",
+ "Employee3@company.example"))
+ .addProperty(createComplex("PropertyComp",
+ createPrimitive("PropertyInt16", (short) 333),
+ createPrimitive("PropertyString", "TEST C")))
+ .addProperty(createColPropertyComp()));
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETMixPrimCollComp);
+ setEntityType(entityCollection, type);
+ createEntityId("ESMixPrimCollComp", entityCollection, type.getKeyPropertyRefs());
+
return entityCollection;
}
-
- private EntityCollection createESMixPrimCollComp() {
- @SuppressWarnings("unchecked")
- final Property complexCollection = createComplexCollection("CollPropertyComp",
- Arrays.asList(createPrimitive("PropertyInt16", 123), createPrimitive("PropertyString", "TEST 1")),
- Arrays.asList(createPrimitive("PropertyInt16", 456), createPrimitive("PropertyString", "TEST 2")),
- Arrays.asList(createPrimitive("PropertyInt16", 789), createPrimitive("PropertyString", "TEST 3")));
-
+
+ @SuppressWarnings("unchecked")
+ private Property createColPropertyComp() {
+ return createComplexCollection("CollPropertyComp",
+ Arrays.asList(
+ createPrimitive("PropertyInt16", (short) 123),
+ createPrimitive("PropertyString", "TEST 1")),
+ Arrays.asList(
+ createPrimitive("PropertyInt16", (short) 456),
+ createPrimitive("PropertyString", "TEST 2")),
+ Arrays.asList(
+ createPrimitive("PropertyInt16", (short) 789),
+ createPrimitive("PropertyString", "TEST 3")));
+ }
+
+ private EntityCollection createESAllKey(Edm edm) {
EntityCollection entityCollection = new EntityCollection();
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
- .addProperty(
- createPrimitiveCollection("CollPropertyString", "Employee1@company.example", "Employee2@company.example",
- "Employee3@company.example")).addProperty(
- createComplex("PropertyComp", createPrimitive("PropertyInt16", 111),
- createPrimitive("PropertyString", "TEST A"))).addProperty(complexCollection));
-
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", 7)).addProperty(
- createPrimitiveCollection("CollPropertyString", "Employee1@company.example", "Employee2@company.example",
- "Employee3@company.example")).addProperty(
- createComplex("PropertyComp", createPrimitive("PropertyInt16", 222),
- createPrimitive("PropertyString", "TEST B"))).addProperty(complexCollection));
-
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", 0)).addProperty(
- createPrimitiveCollection("CollPropertyString", "Employee1@company.example", "Employee2@company.example",
- "Employee3@company.example")).addProperty(
- createComplex("PropertyComp", createPrimitive("PropertyInt16", 333),
- createPrimitive("PropertyString", "TEST C"))).addProperty(complexCollection));
-
- return entityCollection;
- }
-
- private EntityCollection createESAllKey() {
- EntityCollection entityCollection = new EntityCollection();
-
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyString", "First"))
- .addProperty(createPrimitive("PropertyBoolean", true)).addProperty(createPrimitive("PropertyByte", 255))
+ entityCollection.getEntities().add(new Entity()
+ .addProperty(createPrimitive("PropertyString", "First"))
+ .addProperty(createPrimitive("PropertyBoolean", true))
+ .addProperty(createPrimitive("PropertyByte", (short) 255))
.addProperty(createPrimitive("PropertySByte", Byte.MAX_VALUE))
.addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
.addProperty(createPrimitive("PropertyInt32", Integer.MAX_VALUE))
.addProperty(createPrimitive("PropertyInt64", Long.MAX_VALUE))
- .addProperty(createPrimitive("PropertyDecimal", 34))
+ .addProperty(createPrimitive("PropertyDecimal", BigDecimal.valueOf(34)))
.addProperty(createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 0, 0, 0)))
.addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2012, 12, 3, 7, 16, 23)))
- .addProperty(createPrimitive("PropertyDuration", 6)).addProperty(createPrimitive("PropertyGuid", GUID))
+ .addProperty(createPrimitive("PropertyDuration", BigDecimal.valueOf(6)))
+ .addProperty(createPrimitive("PropertyGuid", GUID))
.addProperty(createPrimitive("PropertyTimeOfDay", getTime(2, 48, 21))));
- entityCollection.getEntities().add(new Entity().addProperty(createPrimitive("PropertyString", "Second"))
- .addProperty(createPrimitive("PropertyBoolean", true)).addProperty(createPrimitive("PropertyByte", 254))
- .addProperty(createPrimitive("PropertySByte", 124)).addProperty(createPrimitive("PropertyInt16", 32764))
+ entityCollection.getEntities().add(new Entity()
+ .addProperty(createPrimitive("PropertyString", "Second"))
+ .addProperty(createPrimitive("PropertyBoolean", true))
+ .addProperty(createPrimitive("PropertyByte", (short) 254))
+ .addProperty(createPrimitive("PropertySByte", (byte) 124))
+ .addProperty(createPrimitive("PropertyInt16", (short) 32764))
.addProperty(createPrimitive("PropertyInt32", 2147483644))
.addProperty(createPrimitive("PropertyInt64", 9223372036854775804L))
- .addProperty(createPrimitive("PropertyDecimal", 34))
+ .addProperty(createPrimitive("PropertyDecimal", BigDecimal.valueOf(34)))
.addProperty(createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 0, 0, 0)))
.addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2012, 12, 3, 7, 16, 23)))
- .addProperty(createPrimitive("PropertyDuration", 6)).addProperty(createPrimitive("PropertyGuid", GUID))
+ .addProperty(createPrimitive("PropertyDuration", BigDecimal.valueOf(6)))
+ .addProperty(createPrimitive("PropertyGuid", GUID))
.addProperty(createPrimitive("PropertyTimeOfDay", getTime(2, 48, 21))));
+
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETAllKey);
+ setEntityType(entityCollection, type);
+ createEntityId("ESAllKey", entityCollection, type.getKeyPropertyRefs());
return entityCollection;
}
- private EntityCollection createESCompComp() {
+ private EntityCollection createESCompComp(Edm edm) {
EntityCollection entityCollection = new EntityCollection();
Entity entity = new Entity();
- entity.addProperty(createPrimitive("PropertyInt16", 1));
+ entity.addProperty(createPrimitive("PropertyInt16", (short) 1));
entity.addProperty(createComplex("PropertyComp",
- createComplex("PropertyComp", createPrimitive("PropertyInt16", 123),
+ createComplex("PropertyComp",
+ createPrimitive("PropertyInt16", (short) 123),
createPrimitive("PropertyString", "String 1"))));
entityCollection.getEntities().add(entity);
entity = new Entity();
- entity.addProperty(createPrimitive("PropertyInt16", 2));
+ entity.addProperty(createPrimitive("PropertyInt16", (short) 2));
entity.addProperty(createComplex("PropertyComp",
- createComplex("PropertyComp", createPrimitive("PropertyInt16", 987),
+ createComplex("PropertyComp",
+ createPrimitive("PropertyInt16", (short) 987),
createPrimitive("PropertyString", "String 2"))));
entityCollection.getEntities().add(entity);
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETCompComp);
+ setEntityType(entityCollection, type);
+ createEntityId("ESCompComp", entityCollection, type.getKeyPropertyRefs());
+
return entityCollection;
}
- private EntityCollection createESMedia() {
+ private EntityCollection createESMedia(Edm edm) {
EntityCollection entityCollection = new EntityCollection();
- Entity entity = new Entity().addProperty(createPrimitive("PropertyInt16", 1))
- .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("darkturquoise")));
+ Entity entity = new Entity()
+ .addProperty(createPrimitive("PropertyInt16", (short) 1))
+ .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("darkturquoise")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"1\"");
+ entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(1)/$value"));
entityCollection.getEntities().add(entity);
- entity = new Entity().addProperty(createPrimitive("PropertyInt16", 2))
- .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("royalblue")));
+ entity = new Entity()
+ .addProperty(createPrimitive("PropertyInt16", (short) 2))
+ .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("royalblue")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"2\"");
+ entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(2)/$value"));
entityCollection.getEntities().add(entity);
- entity = new Entity().addProperty(createPrimitive("PropertyInt16", 3))
- .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("crimson")));
+ entity = new Entity()
+ .addProperty(createPrimitive("PropertyInt16", (short) 3))
+ .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("crimson")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"3\"");
+ entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(3)/$value"));
entityCollection.getEntities().add(entity);
- entity = new Entity().addProperty(createPrimitive("PropertyInt16", 4))
- .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("black")));
+ entity = new Entity()
+ .addProperty(createPrimitive("PropertyInt16", (short) 4))
+ .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("black")));
entity.setMediaContentType("image/svg+xml");
entity.setMediaETag("W/\"4\"");
+ entity.getMediaEditLinks().add(buildMediaLink("ESMedia", "ESMedia(4)/$value"));
entityCollection.getEntities().add(entity);
+ EdmEntityType type = edm.getEntityType(EntityTypeProvider.nameETMedia);
+ setEntityType(entityCollection, type);
+ createEntityId("ESMedia", entityCollection, type.getKeyPropertyRefs());
+
return entityCollection;
}
@@ -975,12 +1207,22 @@
return timestamp;
}
+ protected static Link buildMediaLink(String title, String href) {
+ Link link = new Link();
+ link.setRel("edit-media");
+ link.setTitle(title);
+ link.setHref(href);
+ return link;
+ }
+
protected static void setLink(final Entity entity, final String navigationPropertyName, final Entity target) {
Link link = entity.getNavigationLink(navigationPropertyName);
if (link == null) {
link = new Link();
+ link.setRel("http://docs.oasis-open.org/odata/ns/related/"+navigationPropertyName);
link.setType(Constants.ENTITY_NAVIGATION_LINK_TYPE);
link.setTitle(navigationPropertyName);
+ link.setHref(target.getId().toASCIIString());
entity.getNavigationLinks().add(link);
}
link.setInlineEntity(target);
@@ -990,14 +1232,42 @@
Link link = entity.getNavigationLink(navigationPropertyName);
if (link == null) {
link = new Link();
+ link.setRel("http://docs.oasis-open.org/odata/ns/related/"+navigationPropertyName);
link.setType(Constants.ENTITY_SET_NAVIGATION_LINK_TYPE);
link.setTitle(navigationPropertyName);
EntityCollection target = new EntityCollection();
target.getEntities().addAll(Arrays.asList(targets));
link.setInlineEntitySet(target);
+ link.setHref(entity.getId().toASCIIString()+"/"+navigationPropertyName);
entity.getNavigationLinks().add(link);
} else {
link.getInlineEntitySet().getEntities().addAll(Arrays.asList(targets));
}
}
+
+ protected static void createEntityId (String esName, EntityCollection entities, List<EdmKeyPropertyRef> keys) {
+ for (Entity entity:entities.getEntities()) {
+ createEntityId(esName, entity, keys);
+ }
+ }
+ protected static void createEntityId (String esName, Entity entity, List<EdmKeyPropertyRef> keys) {
+ try {
+ if(keys.size() == 1) {
+ entity.setId(URI.create(esName+"("+entity.getProperty(keys.get(0).getName()).asPrimitive()+")"));
+ } else {
+ StringBuilder sb = new StringBuilder();
+ sb.append(esName).append("(");
+ for (int i = 0; i < keys.size(); i++) {
+ if (i != 0) {
+ sb.append(",");
+ }
+ sb.append(keys.get(i)).append("=").append(entity.getProperty(keys.get(i).getName()).asPrimitive());
+ }
+ sb.append(")");
+ entity.setId(URI.create(sb.toString()));
+ }
+ } catch (Exception e) {
+ entity.setId(URI.create("id"));
+ }
+ }
}
\ No newline at end of file
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
index fe06a1c..0dd530e 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
@@ -28,6 +28,8 @@
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
import org.apache.olingo.commons.api.data.ComplexValue;
import org.apache.olingo.commons.api.data.Entity;
@@ -58,17 +60,18 @@
public class DataProvider {
protected static final String MEDIA_PROPERTY_NAME = "$value";
+ private AtomicInteger KEY_INT_16 = new AtomicInteger(0);
+ private AtomicInteger KEY_INT_32 = new AtomicInteger(0);
+ private AtomicLong KEY_INT_64 = new AtomicLong(0);
+ private AtomicLong KEY_STRING = new AtomicLong(0);
private Map<String, EntityCollection> data;
private Edm edm;
private OData odata;
- public DataProvider() {
- data = new DataCreator().getData();
- }
-
- public void setEdm(final Edm edm) {
+ public DataProvider(final Edm edm) {
this.edm = edm;
+ data = new DataCreator(edm).getData();
}
public void setOData(final OData odata) {
@@ -153,6 +156,7 @@
}
createProperties(edmEntityType, newEntity.getProperties());
+ DataCreator.createEntityId(edmEntitySet.getName(), newEntity, edmEntityType.getKeyPropertyRefs());
entities.add(newEntity);
return newEntity;
@@ -165,32 +169,40 @@
return data.get(edmEntitySet.getName());
}
-
+
private Map<String, Object> findFreeComposedKey(final List<Entity> entities, final EdmEntityType entityType)
throws DataProviderException {
// Weak key construction
final HashMap<String, Object> keys = new HashMap<String, Object>();
for (final String keyName : entityType.getKeyPredicateNames()) {
final FullQualifiedName typeName = entityType.getProperty(keyName).getType().getFullQualifiedName();
- Object newValue = null;
-
- if (EdmPrimitiveTypeKind.Int16.getFullQualifiedName().equals(typeName)
- || EdmPrimitiveTypeKind.Int32.getFullQualifiedName().equals(typeName)
- || EdmPrimitiveTypeKind.Int64.getFullQualifiedName().equals(typeName)) {
+ Object newValue;
+
+ if (EdmPrimitiveTypeKind.Int16.getFullQualifiedName().equals(typeName)) {
+ newValue = (short) KEY_INT_16.incrementAndGet();
+
+ while(!isFree(newValue, keyName, entities)) {
+ newValue = (short) KEY_INT_16.incrementAndGet();
+ }
+ } else if (EdmPrimitiveTypeKind.Int32.getFullQualifiedName().equals(typeName)) {
+ newValue = KEY_INT_32.incrementAndGet();
+
+ while(!isFree(newValue, keyName, entities)) {
+ newValue = KEY_INT_32.incrementAndGet();
+ }
+ } else if(EdmPrimitiveTypeKind.Int64.getFullQualifiedName().equals(typeName)) {
// Integer keys
- newValue = Integer.valueOf(1);
+ newValue = KEY_INT_64.incrementAndGet();
while (!isFree(newValue, keyName, entities)) {
- newValue = ((Integer) newValue) + 1;
+ newValue = KEY_INT_64.incrementAndGet();
}
} else if (EdmPrimitiveTypeKind.String.getFullQualifiedName().equals(typeName)) {
// String keys
- newValue = String.valueOf(1);
- int i = 0;
+ newValue = String.valueOf(KEY_STRING.incrementAndGet());
while (!isFree(newValue, keyName, entities)) {
- newValue = String.valueOf(i);
- i++;
+ newValue = String.valueOf(KEY_STRING.incrementAndGet());
}
} else {
throw new DataProviderException("Key type not supported", HttpStatusCode.NOT_IMPLEMENTED);
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/FunctionData.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/FunctionData.java
index 517c7df..65099dc 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/FunctionData.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/FunctionData.java
@@ -18,13 +18,17 @@
*/
package org.apache.olingo.server.tecsvc.data;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import org.apache.olingo.commons.api.data.ComplexValue;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.server.api.OData;
@@ -75,14 +79,14 @@
protected static Property primitiveComplexFunction(final String name, final List<UriParameter> parameters,
final Map<String, EntityCollection> data) throws DataProviderException {
if (name.equals("UFNRTInt16")) {
- return DataCreator.createPrimitive(name, 12345);
+ return DataCreator.createPrimitive(name, (short) 12345);
} else if (name.equals("UFCRTString")) {
return DataCreator.createPrimitive(name, "UFCRTString string value");
} else if (name.equals("UFCRTCollString")) {
return data.get("ESCollAllPrim").getEntities().get(0).getProperty("CollPropertyString");
} else if (name.equals("UFCRTCTTwoPrim")) {
return DataCreator.createComplex(name,
- DataCreator.createPrimitive("PropertyInt16", 16),
+ DataCreator.createPrimitive("PropertyInt16", (short) 16),
DataCreator.createPrimitive("PropertyString", "UFCRTCTTwoPrim string value"));
} else if (name.equals("UFCRTCTTwoPrimParam")) {
try {
@@ -102,12 +106,84 @@
}
} else if (name.equals("UFCRTCollCTTwoPrim")) {
return DataCreator.createComplexCollection(name,
- Arrays.asList(DataCreator.createPrimitive("PropertyInt16", 16),
+ Arrays.asList(DataCreator.createPrimitive("PropertyInt16", (short) 16),
DataCreator.createPrimitive("PropertyString", "Test123")),
Arrays.asList(DataCreator.createPrimitive("PropertyInt16", 17),
DataCreator.createPrimitive("PropertyString", "Test456")),
Arrays.asList(DataCreator.createPrimitive("PropertyInt16", 18),
DataCreator.createPrimitive("PropertyString", "Test678")));
+ } else if(name.equals("UFCRTStringTwoParam")) {
+ final String parameterStringRaw = getParameterText("ParameterString", parameters);
+ final String parameterInt16Raw = getParameterText("ParameterInt16", parameters);
+
+ // ParameterString is not provided
+ if(parameterStringRaw == null) {
+ return new Property(null, "value", ValueType.PRIMITIVE, null);
+ } else {
+ try {
+ EdmPrimitiveType edmInt16 = OData.newInstance().createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Int16);
+ EdmPrimitiveType edmString = OData.newInstance().createPrimitiveTypeInstance(EdmPrimitiveTypeKind.String);
+ Short parameterInt16 = edmInt16.valueOfString(parameterInt16Raw, null, null, null, null, null, Short.class);
+ String parameterString = edmString.fromUriLiteral(parameterStringRaw);
+ final StringBuilder builder = new StringBuilder();
+
+ // if parameterInt16 <= 0 return an empty string
+ for(short i = parameterInt16; i > 0; i--) {
+ if(builder.length() != 0) {
+ builder.append(',');
+ }
+ builder.append('"');
+ builder.append(parameterString);
+ builder.append('"');
+ }
+ return new Property(null, "value", ValueType.PRIMITIVE, builder.toString());
+ } catch (EdmPrimitiveTypeException e) {
+ throw new DataProviderException("Invalid function parameter.");
+ }
+ }
+ } else if(name.equals("UFCRTCollCTTwoPrimTwoParam")) {
+ String parameterStringRaw = getParameterText("ParameterString", parameters);
+ String parameteInt16Raw = getParameterText("ParameterInt16", parameters);
+ EdmPrimitiveType edmInt16 = OData.newInstance().createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Int16);
+ EdmPrimitiveType edmString = OData.newInstance().createPrimitiveTypeInstance(EdmPrimitiveTypeKind.String);
+ try {
+ Short parameterInt16 = edmInt16.valueOfString(parameteInt16Raw, null, null, null, null, null, Short.class);
+
+ if (parameterStringRaw == null) {
+ ComplexValue complexValue1 = new ComplexValue();
+ ComplexValue complexValue2 = new ComplexValue();
+
+ complexValue1.getValue().add(new Property(null, "PropertyInt16", ValueType.PRIMITIVE, 1));
+ complexValue1.getValue().add(new Property(null, "PropertyString", ValueType.PRIMITIVE,
+ name + " int16 value: " + parameterInt16));
+
+ complexValue2.getValue().add(new Property(null, "PropertyInt16", ValueType.PRIMITIVE, 2));
+ complexValue2.getValue().add(new Property(null, "PropertyString", ValueType.PRIMITIVE,
+ name + "string value: null"));
+
+
+ return new Property(null, "value", ValueType.COLLECTION_COMPLEX, Arrays.asList(new ComplexValue[] {
+ complexValue1, complexValue2
+ }));
+ } else {
+ String parameterString = edmString.fromUriLiteral(parameterStringRaw);
+ List<ComplexValue> complexValues = new ArrayList<ComplexValue>();
+ short counter = 1;
+
+ for(short i = parameterInt16; 0 < i; i--) {
+ ComplexValue complexValue = new ComplexValue();
+ complexValue.getValue().add(new Property(null, "PropertyInt16", ValueType.PRIMITIVE, counter++));
+ complexValue.getValue().add(new Property(null, "PropertyString", ValueType.PRIMITIVE,
+ name + " string value: " + parameterString));
+ complexValues.add(complexValue);
+ }
+
+ return new Property(null, "value", ValueType.COLLECTION_COMPLEX, complexValues);
+ }
+ } catch (EdmPrimitiveTypeException e) {
+ throw new DataProviderException("Invalid function parameter");
+ }
+
} else {
throw new DataProviderException("Function " + name + " is not yet implemented.");
}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java
index fbe21b5..baf2f40 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java
@@ -139,11 +139,13 @@
if (edmProperty.isCollection()) {
final EntityCollection inlineEntitySet = navigationLink.getInlineEntitySet();
- if (!isInsert && inlineEntitySet.getEntities().size() > 0) {
- throw new DataProvider.DataProviderException("Deep update is not allowed", HttpStatusCode.BAD_REQUEST);
- } else {
- for (final Entity entity : navigationLink.getInlineEntitySet().getEntities()) {
- validate(edmBindingTarget, entity);
+ if (inlineEntitySet != null) {
+ if (!isInsert && inlineEntitySet.getEntities().size() > 0) {
+ throw new DataProvider.DataProviderException("Deep update is not allowed", HttpStatusCode.BAD_REQUEST);
+ } else {
+ for (final Entity entity : navigationLink.getInlineEntitySet().getEntities()) {
+ validate(edmBindingTarget, entity);
+ }
}
}
} else {
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalActionProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalActionProcessor.java
index da8c5cc..9eb836c 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalActionProcessor.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalActionProcessor.java
@@ -31,7 +31,6 @@
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.ODataApplicationException;
@@ -40,6 +39,8 @@
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.deserializer.DeserializerResult;
+import org.apache.olingo.server.api.prefer.Preferences.Return;
+import org.apache.olingo.server.api.prefer.PreferencesApplied;
import org.apache.olingo.server.api.processor.ActionComplexCollectionProcessor;
import org.apache.olingo.server.api.processor.ActionComplexProcessor;
import org.apache.olingo.server.api.processor.ActionEntityCollectionProcessor;
@@ -58,7 +59,7 @@
import org.apache.olingo.server.tecsvc.data.EntityActionResult;
/**
- * Technical Processor for entity-related functionality.
+ * Technical Processor for action-related functionality.
*/
public class TechnicalActionProcessor extends TechnicalProcessor
implements ActionEntityCollectionProcessor, ActionEntityProcessor,
@@ -79,8 +80,7 @@
.getAction();
DeserializerResult deserializerResult =
- odata.createDeserializer(ODataFormat.fromContentType(requestFormat))
- .actionParameters(request.getBody(), action);
+ odata.createDeserializer(requestFormat).actionParameters(request.getBody(), action);
EntityCollection collection =
dataProvider.processActionEntityCollection(action.getName(), deserializerResult.getActionParameters());
@@ -92,16 +92,25 @@
throw new ODataApplicationException("The action could not be executed.",
HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ROOT);
}
- final EdmEntitySet edmEntitySet = getEdmEntitySet(uriInfo.asUriInfoResource());
- final EdmEntityType type = (EdmEntityType) action.getReturnType().getType();
- final ODataFormat format = ODataFormat.fromContentType(responseFormat);
- EntityCollectionSerializerOptions options = EntityCollectionSerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null : getContextUrl(edmEntitySet, type, false))
- .build();
- response.setContent(odata.createSerializer(format)
- .entityCollection(serviceMetadata, type, collection, options).getContent());
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+
+ final Return returnPreference = odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).getReturn();
+ if (returnPreference == null || returnPreference == Return.REPRESENTATION) {
+ final EdmEntitySet edmEntitySet = getEdmEntitySet(uriInfo.asUriInfoResource());
+ final EdmEntityType type = (EdmEntityType) action.getReturnType().getType();
+ final EntityCollectionSerializerOptions options = EntityCollectionSerializerOptions.with()
+ .contextURL(isODataMetadataNone(responseFormat) ? null : getContextUrl(edmEntitySet, type, false))
+ .build();
+ response.setContent(odata.createSerializer(responseFormat)
+ .entityCollection(serviceMetadata, type, collection, options).getContent());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ } else {
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+ if (returnPreference != null) {
+ response.setHeader(HttpHeader.PREFERENCE_APPLIED,
+ PreferencesApplied.with().returnRepresentation(returnPreference).build().toValueString());
+ }
}
@Override
@@ -115,8 +124,7 @@
final EdmEntityType type = (EdmEntityType) action.getReturnType().getType();
final DeserializerResult deserializerResult =
- odata.createDeserializer(ODataFormat.fromContentType(requestFormat))
- .actionParameters(request.getBody(), action);
+ odata.createDeserializer(requestFormat).actionParameters(request.getBody(), action);
final EntityActionResult entityResult =
dataProvider.processActionEntity(action.getName(), deserializerResult.getActionParameters());
@@ -129,18 +137,34 @@
HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ROOT);
}
} else {
- final ODataFormat format = ODataFormat.fromContentType(responseFormat);
- response.setContent(odata.createSerializer(format).entity(
- serviceMetadata,
- type,
- entityResult.getEntity(),
- EntitySerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null : getContextUrl(edmEntitySet, type, true))
- .build())
- .getContent());
- response.setStatusCode((entityResult.isCreated() ? HttpStatusCode.CREATED : HttpStatusCode.OK)
- .getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ final Return returnPreference = odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).getReturn();
+ if (returnPreference == null || returnPreference == Return.REPRESENTATION) {
+ response.setContent(odata.createSerializer(responseFormat).entity(
+ serviceMetadata,
+ type,
+ entityResult.getEntity(),
+ EntitySerializerOptions.with()
+ .contextURL(isODataMetadataNone(responseFormat) ? null : getContextUrl(edmEntitySet, type, true))
+ .build())
+ .getContent());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ response.setStatusCode((entityResult.isCreated() ? HttpStatusCode.CREATED : HttpStatusCode.OK)
+ .getStatusCode());
+ } else {
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+ if (returnPreference != null) {
+ response.setHeader(HttpHeader.PREFERENCE_APPLIED,
+ PreferencesApplied.with().returnRepresentation(returnPreference).build().toValueString());
+ }
+ if (entityResult.isCreated()) {
+ final String location = request.getRawBaseUri() + '/'
+ + odata.createUriHelper().buildCanonicalURL(edmEntitySet, entityResult.getEntity());
+ response.setHeader(HttpHeader.LOCATION, location);
+ if (returnPreference == Return.MINIMAL) {
+ response.setHeader(HttpHeader.ODATA_ENTITY_ID, location);
+ }
+ }
if (entityResult.getEntity().getETag() != null) {
response.setHeader(HttpHeader.ETAG, entityResult.getEntity().getETag());
}
@@ -155,8 +179,7 @@
final EdmAction action = ((UriResourceAction) uriInfo.asUriInfoResource().getUriResourceParts().get(0))
.getAction();
DeserializerResult deserializerResult =
- odata.createDeserializer(ODataFormat.fromContentType(requestFormat))
- .actionParameters(request.getBody(), action);
+ odata.createDeserializer(requestFormat).actionParameters(request.getBody(), action);
Property property =
dataProvider.processActionPrimitiveCollection(action.getName(), deserializerResult.getActionParameters());
@@ -170,17 +193,24 @@
throw new ODataApplicationException("The action could not be executed.",
HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ROOT);
}
- EdmPrimitiveType type = (EdmPrimitiveType) action.getReturnType().getType();
- ContextURL contextURL = ContextURL.with().type(type).asCollection().build();
- PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextURL).build();
- SerializerResult result =
- odata.createSerializer(ODataFormat.fromContentType(responseFormat))
- .primitiveCollection(serviceMetadata, type, property, options);
-
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setContent(result.getContent());
- response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ final Return returnPreference = odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).getReturn();
+ if (returnPreference == null || returnPreference == Return.REPRESENTATION) {
+ final EdmPrimitiveType type = (EdmPrimitiveType) action.getReturnType().getType();
+ final ContextURL contextURL = ContextURL.with().type(type).asCollection().build();
+ final PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextURL).build();
+ final SerializerResult result =
+ odata.createSerializer(responseFormat).primitiveCollection(serviceMetadata, type, property, options);
+ response.setContent(result.getContent());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ } else {
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+ if (returnPreference != null) {
+ response.setHeader(HttpHeader.PREFERENCE_APPLIED,
+ PreferencesApplied.with().returnRepresentation(returnPreference).build().toValueString());
+ }
}
@Override
@@ -191,8 +221,7 @@
final EdmAction action = ((UriResourceAction) uriInfo.asUriInfoResource().getUriResourceParts().get(0))
.getAction();
DeserializerResult deserializerResult =
- odata.createDeserializer(ODataFormat.fromContentType(requestFormat))
- .actionParameters(request.getBody(), action);
+ odata.createDeserializer(requestFormat).actionParameters(request.getBody(), action);
Property property = dataProvider.processActionPrimitive(action.getName(), deserializerResult.getActionParameters());
EdmPrimitiveType type = (EdmPrimitiveType) action.getReturnType().getType();
@@ -205,15 +234,22 @@
HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ROOT);
}
} else {
- ContextURL contextURL = ContextURL.with().type(type).build();
- PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextURL).build();
-
- SerializerResult result = odata.createSerializer(ODataFormat.fromContentType(responseFormat))
- .primitive(serviceMetadata, type, property, options);
-
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setContent(result.getContent());
- response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ final Return returnPreference = odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).getReturn();
+ if (returnPreference == null || returnPreference == Return.REPRESENTATION) {
+ final ContextURL contextURL = ContextURL.with().type(type).build();
+ final PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextURL).build();
+ final SerializerResult result = odata.createSerializer(responseFormat)
+ .primitive(serviceMetadata, type, property, options);
+ response.setContent(result.getContent());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ } else {
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+ if (returnPreference != null) {
+ response.setHeader(HttpHeader.PREFERENCE_APPLIED,
+ PreferencesApplied.with().returnRepresentation(returnPreference).build().toValueString());
+ }
}
}
@@ -225,8 +261,7 @@
final EdmAction action = ((UriResourceAction) uriInfo.asUriInfoResource().getUriResourceParts().get(0))
.getAction();
DeserializerResult deserializerResult =
- odata.createDeserializer(ODataFormat.fromContentType(requestFormat))
- .actionParameters(request.getBody(), action);
+ odata.createDeserializer(requestFormat).actionParameters(request.getBody(), action);
Property property =
dataProvider.processActionComplexCollection(action.getName(), deserializerResult.getActionParameters());
@@ -240,17 +275,23 @@
throw new ODataApplicationException("The action could not be executed.",
HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ROOT);
}
- EdmComplexType type = (EdmComplexType) action.getReturnType().getType();
- ContextURL contextURL = ContextURL.with().type(type).asCollection().build();
- ComplexSerializerOptions options = ComplexSerializerOptions.with().contextURL(contextURL).build();
-
- SerializerResult result =
- odata.createSerializer(ODataFormat.fromContentType(responseFormat)).complexCollection(serviceMetadata, type,
- property, options);
-
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setContent(result.getContent());
- response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ final Return returnPreference = odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).getReturn();
+ if (returnPreference == null || returnPreference == Return.REPRESENTATION) {
+ final EdmComplexType type = (EdmComplexType) action.getReturnType().getType();
+ final ContextURL contextURL = ContextURL.with().type(type).asCollection().build();
+ final ComplexSerializerOptions options = ComplexSerializerOptions.with().contextURL(contextURL).build();
+ final SerializerResult result =
+ odata.createSerializer(responseFormat).complexCollection(serviceMetadata, type, property, options);
+ response.setContent(result.getContent());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ } else {
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+ if (returnPreference != null) {
+ response.setHeader(HttpHeader.PREFERENCE_APPLIED,
+ PreferencesApplied.with().returnRepresentation(returnPreference).build().toValueString());
+ }
}
@Override
@@ -261,8 +302,7 @@
final EdmAction action = ((UriResourceAction) uriInfo.asUriInfoResource().getUriResourceParts().get(0))
.getAction();
DeserializerResult deserializerResult =
- odata.createDeserializer(ODataFormat.fromContentType(requestFormat))
- .actionParameters(request.getBody(), action);
+ odata.createDeserializer(requestFormat).actionParameters(request.getBody(), action);
Property property = dataProvider.processActionComplex(action.getName(), deserializerResult.getActionParameters());
EdmComplexType type = (EdmComplexType) action.getReturnType().getType();
@@ -275,16 +315,22 @@
HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ROOT);
}
} else {
- ContextURL contextURL = ContextURL.with().type(type).build();
- ComplexSerializerOptions options = ComplexSerializerOptions.with().contextURL(contextURL).build();
-
- SerializerResult result =
- odata.createSerializer(ODataFormat.fromContentType(responseFormat)).complex(serviceMetadata, type, property,
- options);
-
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setContent(result.getContent());
- response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ final Return returnPreference = odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).getReturn();
+ if (returnPreference == null || returnPreference == Return.REPRESENTATION) {
+ final ContextURL contextURL = ContextURL.with().type(type).build();
+ final ComplexSerializerOptions options = ComplexSerializerOptions.with().contextURL(contextURL).build();
+ final SerializerResult result =
+ odata.createSerializer(responseFormat).complex(serviceMetadata, type, property, options);
+ response.setContent(result.getContent());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ } else {
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+ if (returnPreference != null) {
+ response.setHeader(HttpHeader.PREFERENCE_APPLIED,
+ PreferencesApplied.with().returnRepresentation(returnPreference).build().toValueString());
+ }
}
}
@@ -296,8 +342,7 @@
final EdmAction action = resource.getAction();
if (action.getParameterNames().size() - (action.isBound() ? 1 : 0) > 0) {
checkRequestFormat(requestFormat);
- odata.createDeserializer(ODataFormat.fromContentType(requestFormat))
- .actionParameters(request.getBody(), action);
+ odata.createDeserializer(requestFormat).actionParameters(request.getBody(), action);
}
response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java
index b96ab82..6821c8f 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java
@@ -34,11 +34,13 @@
import org.apache.olingo.server.api.deserializer.batch.BatchOptions;
import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
+import org.apache.olingo.server.api.prefer.PreferencesApplied;
import org.apache.olingo.server.api.processor.BatchProcessor;
+import org.apache.olingo.server.tecsvc.async.AsyncProcessor;
+import org.apache.olingo.server.tecsvc.async.TechnicalAsyncService;
import org.apache.olingo.server.tecsvc.data.DataProvider;
public class TechnicalBatchProcessor extends TechnicalProcessor implements BatchProcessor {
- private static final String PREFERENCE_CONTINUE_ON_ERROR = "odata.continue-on-error";
public TechnicalBatchProcessor(final DataProvider dataProvider) {
super(dataProvider);
@@ -47,7 +49,23 @@
@Override
public void processBatch(final BatchFacade facade, final ODataRequest request, final ODataResponse response)
throws ODataApplicationException, ODataLibraryException {
- boolean continueOnError = isContinueOnError(request);
+ // only the first batch call (process batch) must be handled in a separate way for async support
+ // because a changeset has to be wrapped within a process batch call
+ if(odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).hasRespondAsync()) {
+ TechnicalAsyncService asyncService = TechnicalAsyncService.getInstance();
+ BatchProcessor processor = new TechnicalBatchProcessor(dataProvider);
+ processor.init(odata, serviceMetadata);
+ AsyncProcessor<BatchProcessor> asyncProcessor = asyncService.register(processor, BatchProcessor.class);
+ asyncProcessor.prepareFor().processBatch(facade, request, response);
+ String location = asyncProcessor.processAsync();
+ TechnicalAsyncService.acceptedResponse(response, location);
+ //
+ return;
+ }
+
+
+ final boolean continueOnError =
+ odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).hasContinueOnError();
final String boundary = facade.extractBoundaryFromContentType(request.getHeader(HttpHeader.CONTENT_TYPE));
final BatchOptions options = BatchOptions.with()
@@ -59,15 +77,15 @@
for (BatchRequestPart part : parts) {
final ODataResponsePart responsePart = facade.handleBatchRequest(part);
- responseParts.add(responsePart); // Also add failed responses
+ responseParts.add(responsePart); // Also add failed responses.
final int statusCode = responsePart.getResponses().get(0).getStatusCode();
if ((statusCode >= 400 && statusCode <= 600) && !continueOnError) {
- // Perform some additions actions
+ // Perform some additional actions.
// ...
- break; // Stop processing, but serialize all recent requests
+ break; // Stop processing, but serialize responses to all recent requests.
}
}
@@ -77,19 +95,10 @@
response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED + ";boundary=" + responseBoundary);
response.setContent(responseContent);
response.setStatusCode(HttpStatusCode.ACCEPTED.getStatusCode());
- }
-
- private boolean isContinueOnError(final ODataRequest request) {
- final List<String> preferValues = request.getHeaders(HttpHeader.PREFER);
-
- if (preferValues != null) {
- for (final String preference : preferValues) {
- if (PREFERENCE_CONTINUE_ON_ERROR.equals(preference)) {
- return true;
- }
- }
+ if (continueOnError) {
+ response.setHeader(HttpHeader.PREFERENCE_APPLIED,
+ PreferencesApplied.with().continueOnError().build().toValueString());
}
- return false;
}
@Override
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
index 575b914..315623f 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
@@ -28,7 +28,6 @@
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
@@ -40,6 +39,8 @@
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.deserializer.DeserializerResult;
import org.apache.olingo.server.api.deserializer.ODataDeserializer;
+import org.apache.olingo.server.api.prefer.Preferences.Return;
+import org.apache.olingo.server.api.prefer.PreferencesApplied;
import org.apache.olingo.server.api.processor.CountEntityCollectionProcessor;
import org.apache.olingo.server.api.processor.EntityCollectionProcessor;
import org.apache.olingo.server.api.processor.EntityProcessor;
@@ -48,15 +49,19 @@
import org.apache.olingo.server.api.processor.ReferenceProcessor;
import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
+import org.apache.olingo.server.api.serializer.ReferenceCollectionSerializerOptions;
+import org.apache.olingo.server.api.serializer.ReferenceSerializerOptions;
import org.apache.olingo.server.api.serializer.SerializerResult;
import org.apache.olingo.server.api.uri.UriInfo;
import org.apache.olingo.server.api.uri.UriResourceEntitySet;
-import org.apache.olingo.server.api.uri.UriResourceFunction;
import org.apache.olingo.server.api.uri.UriResourceNavigation;
+import org.apache.olingo.server.api.uri.UriResourcePartTyped;
import org.apache.olingo.server.api.uri.queryoption.CountOption;
import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
import org.apache.olingo.server.api.uri.queryoption.IdOption;
import org.apache.olingo.server.api.uri.queryoption.SelectOption;
+import org.apache.olingo.server.tecsvc.async.AsyncProcessor;
+import org.apache.olingo.server.tecsvc.async.TechnicalAsyncService;
import org.apache.olingo.server.tecsvc.data.DataProvider;
import org.apache.olingo.server.tecsvc.data.RequestValidator;
import org.apache.olingo.server.tecsvc.processor.queryoptions.ExpandSystemQueryOptionHandler;
@@ -140,6 +145,22 @@
HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
}
checkRequestFormat(requestFormat);
+
+ //
+ if (odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).hasRespondAsync()) {
+ TechnicalAsyncService asyncService = TechnicalAsyncService.getInstance();
+ TechnicalEntityProcessor processor = new TechnicalEntityProcessor(dataProvider, serviceMetadata);
+ processor.init(odata, serviceMetadata);
+ AsyncProcessor<EntityProcessor> asyncProcessor = asyncService.register(processor, EntityProcessor.class);
+ asyncProcessor.prepareFor().createEntity(request, response, uriInfo, requestFormat, responseFormat);
+ String location = asyncProcessor.processAsync();
+ //
+ TechnicalAsyncService.acceptedResponse(response, location);
+ //
+ return;
+ }
+ //
+
final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) uriInfo.getUriResourceParts().get(0);
final EdmEntitySet edmEntitySet = resourceEntitySet.getEntitySet();
final EdmEntityType edmEntityType = edmEntitySet.getEntityType();
@@ -152,8 +173,7 @@
requestFormat.toContentTypeString());
} else {
final DeserializerResult deserializerResult =
- odata.createDeserializer(ODataFormat.fromContentType(requestFormat))
- .entity(request.getBody(), edmEntityType);
+ odata.createDeserializer(requestFormat).entity(request.getBody(), edmEntityType);
new RequestValidator(dataProvider, request.getRawBaseUri())
.validate(edmEntitySet, deserializerResult.getEntity());
@@ -162,13 +182,23 @@
expand = deserializerResult.getExpandTree();
}
- final ODataFormat format = ODataFormat.fromContentType(responseFormat);
- response.setContent(serializeEntity(entity, edmEntitySet, edmEntityType, format, expand, null)
- .getContent());
- response.setStatusCode(HttpStatusCode.CREATED.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
- response.setHeader(HttpHeader.LOCATION,
- request.getRawBaseUri() + '/' + odata.createUriHelper().buildCanonicalURL(edmEntitySet, entity));
+ final String location = request.getRawBaseUri() + '/'
+ + odata.createUriHelper().buildCanonicalURL(edmEntitySet, entity);
+ final Return returnPreference = odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).getReturn();
+ if (returnPreference == null || returnPreference == Return.REPRESENTATION) {
+ response.setContent(serializeEntity(request, entity, edmEntitySet, edmEntityType, responseFormat, expand, null)
+ .getContent());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ response.setStatusCode(HttpStatusCode.CREATED.getStatusCode());
+ } else {
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ response.setHeader(HttpHeader.ODATA_ENTITY_ID, location);
+ }
+ if (returnPreference != null) {
+ response.setHeader(HttpHeader.PREFERENCE_APPLIED,
+ PreferencesApplied.with().returnRepresentation(returnPreference).build().toValueString());
+ }
+ response.setHeader(HttpHeader.LOCATION, location);
if (entity.getETag() != null) {
response.setHeader(HttpHeader.ETAG, entity.getETag());
}
@@ -198,7 +228,7 @@
request.getHeaders(HttpHeader.IF_MATCH),
request.getHeaders(HttpHeader.IF_NONE_MATCH));
checkRequestFormat(requestFormat);
- final ODataDeserializer deserializer = odata.createDeserializer(ODataFormat.fromContentType(requestFormat));
+ final ODataDeserializer deserializer = odata.createDeserializer(requestFormat);
final Entity changedEntity = deserializer.entity(request.getBody(), edmEntitySet.getEntityType()).getEntity();
new RequestValidator(dataProvider,
@@ -209,11 +239,19 @@
dataProvider.update(request.getRawBaseUri(), edmEntitySet, entity, changedEntity,
request.getMethod() == HttpMethod.PATCH, false);
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- final ODataFormat format = ODataFormat.fromContentType(responseFormat);
- response.setContent(serializeEntity(entity, edmEntitySet, edmEntityType, format, null, null)
- .getContent());
- response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ final Return returnPreference = odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).getReturn();
+ if (returnPreference == null || returnPreference == Return.REPRESENTATION) {
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setContent(serializeEntity(request, entity, edmEntitySet, edmEntityType, responseFormat)
+ .getContent());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ } else {
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+ if (returnPreference != null) {
+ response.setHeader(HttpHeader.PREFERENCE_APPLIED,
+ PreferencesApplied.with().returnRepresentation(returnPreference).build().toValueString());
+ }
if (entity.getETag() != null) {
response.setHeader(HttpHeader.ETAG, entity.getETag());
}
@@ -234,11 +272,19 @@
dataProvider.setMedia(entity, odata.createFixedFormatDeserializer().binary(request.getBody()),
requestFormat.toContentTypeString());
- final ODataFormat format = ODataFormat.fromContentType(responseFormat);
- response.setContent(serializeEntity(entity, edmEntitySet, edmEntityType, format, null, null)
- .getContent());
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ final Return returnPreference = odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).getReturn();
+ if (returnPreference == null || returnPreference == Return.REPRESENTATION) {
+ response.setContent(serializeEntity(request, entity, edmEntitySet, edmEntityType, responseFormat)
+ .getContent());
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ } else {
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+ if (returnPreference != null) {
+ response.setHeader(HttpHeader.PREFERENCE_APPLIED,
+ PreferencesApplied.with().returnRepresentation(returnPreference).build().toValueString());
+ }
if (entity.getETag() != null) {
response.setHeader(HttpHeader.ETAG, entity.getETag());
}
@@ -280,7 +326,7 @@
public void createReference(final ODataRequest request, final ODataResponse response, final UriInfo uriInfo,
final ContentType requestFormat) throws ODataApplicationException, ODataLibraryException {
- final ODataDeserializer deserializer = odata.createDeserializer(ODataFormat.fromContentType(requestFormat));
+ final ODataDeserializer deserializer = odata.createDeserializer(requestFormat);
final DeserializerResult references = deserializer.entityReferences(request.getBody());
if (references.getEntityReferences().size() != 1) {
@@ -290,6 +336,7 @@
final Entity entity = readEntity(uriInfo, true);
final UriResourceNavigation navigationProperty = getLastNavigation(uriInfo);
+ ensureNavigationPropertyNotNull(navigationProperty);
dataProvider.createReference(entity, navigationProperty.getProperty(), references.getEntityReferences().get(0),
request.getRawBaseUri());
@@ -300,7 +347,7 @@
public void updateReference(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
final ContentType requestFormat) throws ODataApplicationException, ODataLibraryException {
- final ODataDeserializer deserializer = odata.createDeserializer(ODataFormat.fromContentType(requestFormat));
+ final ODataDeserializer deserializer = odata.createDeserializer(requestFormat);
final DeserializerResult references = deserializer.entityReferences(request.getBody());
if (references.getEntityReferences().size() != 1) {
@@ -310,6 +357,7 @@
final Entity entity = readEntity(uriInfo, true);
final UriResourceNavigation navigationProperty = getLastNavigation(uriInfo);
+ ensureNavigationPropertyNotNull(navigationProperty);
dataProvider.createReference(entity, navigationProperty.getProperty(), references.getEntityReferences().get(0),
request.getRawBaseUri());
@@ -323,6 +371,7 @@
final UriResourceNavigation lastNavigation = getLastNavigation(uriInfo);
final IdOption idOption = uriInfo.getIdOption();
+ ensureNavigationPropertyNotNull(lastNavigation);
if (lastNavigation.isCollection() && idOption == null) {
throw new ODataApplicationException("Id system query option must be provided",
HttpStatusCode.BAD_REQUEST.getStatusCode(),
@@ -343,17 +392,32 @@
}
@Override
- public void readReferenceCollection(final ODataRequest request, final ODataResponse response, final UriInfo uriInfo,
- final ContentType requestedContentType) throws ODataApplicationException, ODataLibraryException {
+ public void readReferenceCollection(final ODataRequest request, final ODataResponse response,
+ final UriInfo uriInfo, final ContentType requestedContentType)
+ throws ODataApplicationException, ODataLibraryException {
readEntityCollection(request, response, uriInfo, requestedContentType, true);
}
private void readEntity(final ODataRequest request, final ODataResponse response, final UriInfo uriInfo,
- final ContentType requestedContentType, final boolean isReference)
+ final ContentType requestedFormat, final boolean isReference)
throws ODataApplicationException, ODataLibraryException {
+ //
+ if (odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).hasRespondAsync()) {
+ TechnicalAsyncService asyncService = TechnicalAsyncService.getInstance();
+ TechnicalEntityProcessor processor = new TechnicalEntityProcessor(dataProvider, serviceMetadata);
+ processor.init(odata, serviceMetadata);
+ AsyncProcessor<EntityProcessor> asyncProcessor = asyncService.register(processor, EntityProcessor.class);
+ asyncProcessor.prepareFor().readEntity(request, response, uriInfo, requestedFormat);
+ String location = asyncProcessor.processAsync();
+ TechnicalAsyncService.acceptedResponse(response, location);
+ //
+ return;
+ }
+ //
+
final EdmEntitySet edmEntitySet = getEdmEntitySet(uriInfo);
final EdmEntityType edmEntityType = edmEntitySet == null ?
- (EdmEntityType) ((UriResourceFunction) uriInfo.getUriResourceParts()
+ (EdmEntityType) ((UriResourcePartTyped) uriInfo.getUriResourceParts()
.get(uriInfo.getUriResourceParts().size() - 1)).getType() :
edmEntitySet.getEntityType();
@@ -367,7 +431,6 @@
return;
}
- final ODataFormat format = ODataFormat.fromContentType(requestedContentType);
final ExpandOption expand = uriInfo.getExpandOption();
final SelectOption select = uriInfo.getSelectOption();
@@ -376,23 +439,38 @@
expandHandler.applyExpandQueryOptions(entitySerialization, edmEntitySet, expand);
final SerializerResult serializerResult = isReference ?
- serializeReference(entity, edmEntitySet, format) :
- serializeEntity(entitySerialization, edmEntitySet, edmEntityType, format, expand, select);
+ serializeReference(entity, edmEntitySet, requestedFormat) :
+ serializeEntity(request, entitySerialization, edmEntitySet, edmEntityType, requestedFormat, expand, select);
if (entity.getETag() != null) {
response.setHeader(HttpHeader.ETAG, entity.getETag());
}
response.setContent(serializerResult.getContent());
response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
+ response.setHeader(HttpHeader.CONTENT_TYPE, requestedFormat.toContentTypeString());
}
private void readEntityCollection(final ODataRequest request, final ODataResponse response,
final UriInfo uriInfo, final ContentType requestedContentType, final boolean isReference)
throws ODataApplicationException, ODataLibraryException {
+ //
+ if (odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).hasRespondAsync()) {
+ TechnicalAsyncService asyncService = TechnicalAsyncService.getInstance();
+ TechnicalEntityProcessor processor = new TechnicalEntityProcessor(dataProvider, serviceMetadata);
+ processor.init(odata, serviceMetadata);
+ AsyncProcessor<EntityCollectionProcessor> asyncProcessor =
+ asyncService.register(processor, EntityCollectionProcessor.class);
+ asyncProcessor.prepareFor().readEntityCollection(request, response, uriInfo, requestedContentType);
+ String location = asyncProcessor.processAsync();
+ TechnicalAsyncService.acceptedResponse(response, location);
+ //
+ return;
+ }
+ //
+
final EdmEntitySet edmEntitySet = getEdmEntitySet(uriInfo.asUriInfoResource());
final EdmEntityType edmEntityType = edmEntitySet == null ?
- (EdmEntityType) ((UriResourceFunction) uriInfo.getUriResourceParts()
+ (EdmEntityType) ((UriResourcePartTyped) uriInfo.getUriResourceParts()
.get(uriInfo.getUriResourceParts().size() - 1)).getType() :
edmEntitySet.getEntityType();
@@ -414,13 +492,14 @@
SkipHandler.applySkipSystemQueryHandler(uriInfo.getSkipOption(), entitySet);
TopHandler.applyTopSystemQueryOption(uriInfo.getTopOption(), entitySet);
- ServerSidePagingHandler.applyServerSidePaging(uriInfo.getSkipTokenOption(),
+ final Integer pageSize = odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).getMaxPageSize();
+ final Integer serverPageSize = ServerSidePagingHandler.applyServerSidePaging(uriInfo.getSkipTokenOption(),
entitySet,
edmEntitySet,
- request.getRawRequestUri());
+ request.getRawRequestUri(),
+ pageSize);
// Apply expand system query option
- final ODataFormat format = ODataFormat.fromContentType(requestedContentType);
final ExpandOption expand = uriInfo.getExpandOption();
final SelectOption select = uriInfo.getSelectOption();
@@ -434,64 +513,88 @@
expandHandler.applyExpandQueryOptions(entitySetSerialization, edmEntitySet, expand);
final CountOption countOption = uriInfo.getCountOption();
+ final String id = request.getRawBaseUri() + edmEntitySet.getName();
// Serialize
- final SerializerResult serializerResult = isReference ?
- serializeReferenceCollection(entitySetSerialization, edmEntitySet, format) :
- serializeEntityCollection(entitySetSerialization, edmEntitySet, edmEntityType, format,
- expand, select, countOption);
-
+ final SerializerResult serializerResult = (isReference) ?
+ serializeReferenceCollection(entitySetSerialization, edmEntitySet, requestedContentType, countOption) :
+ serializeEntityCollection(request, entitySetSerialization, edmEntitySet, edmEntityType, requestedContentType,
+ expand, select, countOption, id);
response.setContent(serializerResult.getContent());
response.setStatusCode(HttpStatusCode.OK.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
+ if (pageSize != null) {
+ response.setHeader(HttpHeader.PREFERENCE_APPLIED,
+ PreferencesApplied.with().maxPageSize(serverPageSize).build().toValueString());
+ }
}
- private SerializerResult serializeEntityCollection(final EntityCollection entityCollection,
- final EdmEntitySet edmEntitySet, final EdmEntityType edmEntityType, final ODataFormat format,
- final ExpandOption expand, final SelectOption select, final CountOption countOption)
- throws ODataLibraryException {
- return odata.createSerializer(format).entityCollection(
+ private SerializerResult serializeEntityCollection(final ODataRequest request, final EntityCollection
+ entityCollection, final EdmEntitySet edmEntitySet, final EdmEntityType edmEntityType,
+ final ContentType requestedFormat, final ExpandOption expand, final SelectOption select,
+ final CountOption countOption, String id) throws ODataLibraryException {
+
+ return odata.createSerializer(requestedFormat).entityCollection(
serviceMetadata,
edmEntityType,
entityCollection,
EntityCollectionSerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null :
- getContextUrl(edmEntitySet, edmEntityType, false, expand, select))
+ .contextURL(isODataMetadataNone(requestedFormat) ? null :
+ getContextUrl(request.getRawODataPath(), edmEntitySet, edmEntityType, false, expand, select))
.count(countOption)
.expand(expand).select(select)
+ .setId(id)
.build());
}
private SerializerResult serializeReferenceCollection(final EntityCollection entityCollection,
- final EdmEntitySet edmEntitySet, final ODataFormat format) throws ODataLibraryException {
- return odata.createSerializer(format)
+ final EdmEntitySet edmEntitySet, final ContentType requestedFormat, final CountOption countOption)
+ throws ODataLibraryException {
+
+ return odata.createSerializer(requestedFormat)
.referenceCollection(serviceMetadata, edmEntitySet, entityCollection,
- ContextURL.with().asCollection().suffix(Suffix.REFERENCE).build());
+ ReferenceCollectionSerializerOptions.with()
+ .contextURL(ContextURL.with().asCollection().suffix(Suffix.REFERENCE).build())
+ .count(countOption).build());
}
private SerializerResult serializeReference(final Entity entity, final EdmEntitySet edmEntitySet,
- final ODataFormat format) throws ODataLibraryException {
- return odata.createSerializer(format)
- .reference(serviceMetadata, edmEntitySet, entity,
- ContextURL.with().suffix(Suffix.REFERENCE).build());
+ final ContentType requestedFormat) throws ODataLibraryException {
+ return odata.createSerializer(requestedFormat)
+ .reference(serviceMetadata, edmEntitySet, entity, ReferenceSerializerOptions.with()
+ .contextURL(ContextURL.with().suffix(Suffix.REFERENCE).build()).build());
+
}
- private SerializerResult serializeEntity(final Entity entity,
- final EdmEntitySet edmEntitySet, final EdmEntityType edmEntityType, final ODataFormat format,
- final ExpandOption expand, final SelectOption select) throws ODataLibraryException {
- return odata.createSerializer(format).entity(
+ private SerializerResult serializeEntity(final ODataRequest request, final Entity entity,
+ final EdmEntitySet edmEntitySet, final EdmEntityType edmEntityType,
+ final ContentType requestedFormat) throws ODataLibraryException {
+ return serializeEntity(request, entity, edmEntitySet, edmEntityType, requestedFormat, null, null);
+ }
+
+ private SerializerResult serializeEntity(final ODataRequest request, final Entity entity,
+ final EdmEntitySet edmEntitySet, final EdmEntityType edmEntityType,
+ final ContentType requestedFormat,
+ final ExpandOption expand, final SelectOption select)
+ throws ODataLibraryException {
+
+ ContextURL contextUrl = isODataMetadataNone(requestedFormat) ? null :
+ getContextUrl(request.getRawODataPath(), edmEntitySet, edmEntityType, true, expand, null);
+ return odata.createSerializer(requestedFormat).entity(
serviceMetadata,
edmEntityType,
entity,
EntitySerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null :
- getContextUrl(edmEntitySet, edmEntityType, true, expand, select))
+ .contextURL(contextUrl)
.expand(expand).select(select)
.build());
}
- private ContextURL getContextUrl(final EdmEntitySet entitySet, final EdmEntityType entityType,
- final boolean isSingleEntity, final ExpandOption expand, final SelectOption select) throws ODataLibraryException {
- Builder builder = ContextURL.with();
+ private ContextURL getContextUrl(String rawODataPath, final EdmEntitySet entitySet, final EdmEntityType entityType,
+ final boolean isSingleEntity, final ExpandOption expand, final SelectOption select)
+ throws ODataLibraryException {
+ //
+ //
+ Builder builder = ContextURL.with().oDataPath(rawODataPath);
builder = entitySet == null ?
isSingleEntity ? builder.type(entityType) : builder.asCollection().type(entityType) :
builder.entitySet(entitySet);
@@ -500,4 +603,12 @@
.suffix(isSingleEntity && entitySet != null ? Suffix.ENTITY : null);
return builder.build();
}
+
+ private void ensureNavigationPropertyNotNull(final UriResourceNavigation navigationProperty)
+ throws ODataApplicationException {
+ if (navigationProperty == null) {
+ throw new ODataApplicationException("Missing navigation segment", HttpStatusCode.BAD_REQUEST.getStatusCode(),
+ Locale.ROOT);
+ }
+ }
}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
index 1c0d049..cf4b38e 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
@@ -38,7 +38,6 @@
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.commons.api.http.HttpStatusCode;
@@ -48,6 +47,8 @@
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.deserializer.FixedFormatDeserializer;
+import org.apache.olingo.server.api.prefer.PreferencesApplied;
+import org.apache.olingo.server.api.prefer.Preferences.Return;
import org.apache.olingo.server.api.processor.ComplexCollectionProcessor;
import org.apache.olingo.server.api.processor.ComplexProcessor;
import org.apache.olingo.server.api.processor.CountComplexCollectionProcessor;
@@ -253,9 +254,8 @@
} else {
final ExpandOption expand = uriInfo.getExpandOption();
final SelectOption select = uriInfo.getSelectOption();
- final ODataFormat format = ODataFormat.fromContentType(contentType);
final SerializerResult result = serializeProperty(entity, edmEntitySet, path, property, edmProperty,
- type, returnType, representationType, format, expand, select);
+ type, returnType, representationType, contentType, expand, select);
response.setContent(result.getContent());
}
}
@@ -295,7 +295,7 @@
deserializer.primitiveValue(request.getBody(), edmProperty);
dataProvider.updatePropertyValue(property, value);
} else {
- final Property changedProperty = odata.createDeserializer(ODataFormat.fromContentType(requestFormat))
+ final Property changedProperty = odata.createDeserializer(requestFormat)
.property(request.getBody(), edmProperty).getProperty();
if (changedProperty.isNull() && !edmProperty.isNullable()) {
throw new ODataApplicationException("Not nullable.", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
@@ -305,17 +305,25 @@
dataProvider.updateETag(entity);
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- if (representationType == RepresentationType.VALUE) {
- response.setContent(
- serializePrimitiveValue(property, edmProperty, (EdmPrimitiveType) edmProperty.getType(), null));
+ final Return returnPreference = odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).getReturn();
+ if (returnPreference == null || returnPreference == Return.REPRESENTATION) {
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ if (representationType == RepresentationType.VALUE) {
+ response.setContent(
+ serializePrimitiveValue(property, edmProperty, (EdmPrimitiveType) edmProperty.getType(), null));
+ } else {
+ final SerializerResult result = serializeProperty(entity, edmEntitySet, path, property, edmProperty,
+ edmProperty.getType(), null, representationType, responseFormat, null, null);
+ response.setContent(result.getContent());
+ }
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
} else {
- final ODataFormat format = ODataFormat.fromContentType(responseFormat);
- final SerializerResult result = serializeProperty(entity, edmEntitySet, path, property, edmProperty,
- edmProperty.getType(), null, representationType, format, null, null);
- response.setContent(result.getContent());
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
}
- response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ if (returnPreference != null) {
+ response.setHeader(HttpHeader.PREFERENCE_APPLIED,
+ PreferencesApplied.with().returnRepresentation(returnPreference).build().toValueString());
+ }
if (entity.getETag() != null) {
response.setHeader(HttpHeader.ETAG, entity.getETag());
}
@@ -395,10 +403,10 @@
private SerializerResult serializeProperty(final Entity entity, final EdmEntitySet edmEntitySet,
final List<String> path, final Property property, final EdmProperty edmProperty,
final EdmType type, final EdmReturnType returnType,
- final RepresentationType representationType, final ODataFormat format,
+ final RepresentationType representationType, final ContentType responseFormat,
final ExpandOption expand, final SelectOption select) throws ODataLibraryException {
- ODataSerializer serializer = odata.createSerializer(format);
- final ContextURL contextURL = format == ODataFormat.JSON_NO_METADATA ? null :
+ ODataSerializer serializer = odata.createSerializer(responseFormat);
+ final ContextURL contextURL = isODataMetadataNone(responseFormat) ? null :
getContextUrl(edmEntitySet, entity, path, type, representationType, expand, select);
SerializerResult result = null;
switch (representationType) {
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java
index f3012d9..cb77b43 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java
@@ -50,12 +50,12 @@
*/
public abstract class TechnicalProcessor implements Processor {
+ protected final DataProvider dataProvider;
protected OData odata;
- protected DataProvider dataProvider;
protected ServiceMetadata serviceMetadata;
protected TechnicalProcessor(final DataProvider dataProvider) {
- this.dataProvider = dataProvider;
+ this(dataProvider, null);
}
protected TechnicalProcessor(final DataProvider dataProvider, final ServiceMetadata serviceMetadata) {
@@ -68,7 +68,6 @@
this.odata = odata;
this.serviceMetadata = serviceMetadata;
dataProvider.setOData(odata);
- dataProvider.setEdm(serviceMetadata.getEdm());
}
protected EdmEntitySet getEdmEntitySet(final UriInfoResource uriInfo) throws ODataApplicationException {
@@ -213,8 +212,9 @@
&& resourcePaths.get(navigationCount) instanceof UriResourceNavigation) {
navigationCount++;
}
-
- return (UriResourceNavigation) resourcePaths.get(--navigationCount);
+
+ final UriResource lastSegment = resourcePaths.get(--navigationCount);
+ return (lastSegment instanceof UriResourceNavigation) ? (UriResourceNavigation) lastSegment : null;
}
private void blockTypeFilters(final UriResource uriResource) throws ODataApplicationException {
@@ -255,4 +255,10 @@
HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
}
}
+
+ protected boolean isODataMetadataNone(final ContentType contentType) {
+ return contentType.isCompatible(ContentType.APPLICATION_JSON)
+ && ContentType.VALUE_ODATA_METADATA_NONE.equals(
+ contentType.getParameter(ContentType.PARAMETER_ODATA_METADATA));
+ }
}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/ExpandSystemQueryOptionHandler.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/ExpandSystemQueryOptionHandler.java
index c641516..e0faf41 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/ExpandSystemQueryOptionHandler.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/ExpandSystemQueryOptionHandler.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.server.tecsvc.processor.queryoptions;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
@@ -27,9 +28,11 @@
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.edm.EdmBindingTarget;
+import org.apache.olingo.commons.api.edm.EdmElement;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.uri.UriResource;
@@ -72,12 +75,36 @@
private void applyExpandOptionToEntity(final Entity entity, final EdmBindingTarget edmBindingTarget,
final ExpandOption expandOption) throws ODataApplicationException {
+
final EdmEntityType entityType = edmBindingTarget.getEntityType();
for (ExpandItem item : expandOption.getExpandItems()) {
- final List<UriResource> uriResourceParts = item.getResourcePath().getUriResourceParts();
- if (uriResourceParts.size() == 1 && uriResourceParts.get(0) instanceof UriResourceNavigation) {
- final String navPropertyName = ((UriResourceNavigation) uriResourceParts.get(0)).getProperty().getName();
+ if(item.getLevelsOption() != null) {
+ throw new ODataApplicationException("$levels is not implemented",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ List<EdmNavigationProperty> navigationProperties = new ArrayList<EdmNavigationProperty>();
+ if(item.isStar()) {
+ List<EdmNavigationPropertyBinding> bindings = edmBindingTarget.getNavigationPropertyBindings();
+ for (EdmNavigationPropertyBinding binding : bindings) {
+ EdmElement property = entityType.getProperty(binding.getPath());
+ if(property instanceof EdmNavigationProperty) {
+ navigationProperties.add((EdmNavigationProperty) property);
+ }
+ }
+ } else {
+ final List<UriResource> uriResourceParts = item.getResourcePath().getUriResourceParts();
+ if (uriResourceParts.size() == 1 && uriResourceParts.get(0) instanceof UriResourceNavigation) {
+ navigationProperties.add(((UriResourceNavigation) uriResourceParts.get(0)).getProperty());
+ } else {
+ throw new ODataApplicationException("Not supported resource part in expand system query option",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+ }
+
+ for(EdmNavigationProperty navigationProperty: navigationProperties) {
+ final String navPropertyName = navigationProperty.getName();
final EdmBindingTarget targetEdmEntitySet = edmBindingTarget.getRelatedBindingTarget(navPropertyName);
final Link link = entity.getNavigationLink(navPropertyName);
@@ -91,9 +118,6 @@
item.getTopOption(),
item.getExpandOption());
}
- } else {
- throw new ODataApplicationException("Not supported resource part in expand system query option",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
}
}
}
@@ -202,7 +226,7 @@
newLink.setTitle(link.getTitle());
newLink.setType(link.getType());
newLink.setRel(link.getRel());
-
+ newLink.setHref(link.getHref());
return newLink;
}
@@ -238,6 +262,10 @@
private ExpandOption getInnerExpandOption(final ExpandOption expand, final String propertyName) {
for (final ExpandItem item : expand.getExpandItems()) {
+ if(item.isStar()) {
+ return item.getExpandOption();
+ }
+
final UriResource resource = item.getResourcePath().getUriResourceParts().get(0);
if (resource instanceof UriResourceNavigation
&& propertyName.equals(((UriResourceNavigation) resource).getProperty().getName())) {
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/ExpressionVisitorImpl.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/ExpressionVisitorImpl.java
index 69ab34a..969a754 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/ExpressionVisitorImpl.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/ExpressionVisitorImpl.java
@@ -36,6 +36,7 @@
import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
+import org.apache.olingo.server.api.uri.queryoption.expression.Literal;
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.tecsvc.processor.queryoptions.expression.operand.TypedOperand;
@@ -167,9 +168,8 @@
}
@Override
- public VisitorOperand visitLiteral(final String literal) throws ExpressionVisitException, ODataApplicationException {
-
- return new UntypedOperand(literal);
+ public VisitorOperand visitLiteral(final Literal literal) throws ExpressionVisitException, ODataApplicationException {
+ return new UntypedOperand(literal.getText());
}
@Override
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/operand/TypedOperand.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/operand/TypedOperand.java
index 4eed3db..11cf3ab 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/operand/TypedOperand.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/operand/TypedOperand.java
@@ -75,7 +75,7 @@
// Use type conversion of EdmPrimitive types
try {
final String literal = getLiteral(value);
- newValue = tryCast(literal, (EdmPrimitiveType) type);
+ newValue = tryCast(literal, asType);
} catch (EdmPrimitiveTypeException e) {
// Nothing to do
}
@@ -86,14 +86,14 @@
}
}
- throw new ODataApplicationException("Cast failed ", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
+ throw new ODataApplicationException("Cast failed", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
}
public TypedOperand castToCommonType(final VisitorOperand otherOperand) throws ODataApplicationException {
final TypedOperand other = otherOperand.asTypedOperand();
final EdmType oType = other.getType();
-
- // Make sure that the EDM type is equals, check also the java type.
+
+ // In case of numberic values make sure that the EDM type is equals, check also the java type.
// So it is possible, that there is an conversation even if the same
// EdmType is provided.
// For example consider an Edm16 (internal Integer) and Edm16(internal
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/operation/BinaryOperator.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/operation/BinaryOperator.java
index 7465ab8..9ff1bc2 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/operation/BinaryOperator.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/operation/BinaryOperator.java
@@ -168,6 +168,7 @@
return new TypedOperand(result, primBoolean);
}
+ @SuppressWarnings({ "rawtypes", "unchecked" })
private boolean binaryComparison(final int... expect) {
int result;
@@ -179,10 +180,13 @@
result = left.getTypedValue(BigInteger.class).compareTo(right.getTypedValue(BigInteger.class));
} else if (left.isDecimalType()) {
result = left.getTypedValue(BigDecimal.class).compareTo(right.getTypedValue(BigDecimal.class));
+ } else if(left.getValue().getClass() == right.getValue().getClass() && left.getValue() instanceof Comparable) {
+ result = ((Comparable)left.getValue()).compareTo(right.getValue());
} else {
result = left.getValue().equals(right.getValue()) ? 0 : 1;
}
- }
+ }
+
for (int expectedValue : expect) {
if (expectedValue == result) {
return true;
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/FilterHandler.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/FilterHandler.java
index eb809af..5f5c9df 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/FilterHandler.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/FilterHandler.java
@@ -59,10 +59,14 @@
final VisitorOperand operand = filterOption.getExpression()
.accept(new ExpressionVisitorImpl(iter.next(), edmEntitySet));
final TypedOperand typedOperand = operand.asTypedOperand();
-
- if (!(typedOperand.is(primBoolean)
- && Boolean.TRUE.equals(typedOperand.getTypedValue(Boolean.class)))) {
- iter.remove();
+
+ if(typedOperand.is(primBoolean)) {
+ if(Boolean.FALSE.equals(typedOperand.getTypedValue(Boolean.class))) {
+ iter.remove();
+ }
+ } else {
+ throw new ODataApplicationException("Invalid filter expression. Filter expressions must return a value of "
+ + "type Edm.Boolean", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
}
}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/ServerSidePagingHandler.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/ServerSidePagingHandler.java
index 9c6b688..ad8b7dd 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/ServerSidePagingHandler.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/ServerSidePagingHandler.java
@@ -28,74 +28,71 @@
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.uri.queryoption.SkipTokenOption;
import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-import org.apache.olingo.server.tecsvc.Encoder;
public class ServerSidePagingHandler {
private static final int MAX_PAGE_SIZE = 10;
private static final String ES_SERVER_SIDE_PAGING = "ESServerSidePaging";
- public static void applyServerSidePaging(final SkipTokenOption skipTokenOption, final EntityCollection entitySet,
- final EdmEntitySet edmEntitySet, final String rawRequestUri) throws ODataApplicationException {
+ /**
+ * <p>Applies server-side paging to the given entity collection.</p>
+ * <p>The next link is constructed and set in the data. It must support client-specified
+ * page sizes. Therefore, the format <code>page*pageSize</code> (with a literal asterisk)
+ * has been chosen for the skiptoken.</p>
+ * @param skipTokenOption the current skiptoken option (from a previous response's next link)
+ * @param entityCollection the data
+ * @param edmEntitySet the EDM entity set to decide whether paging must be done
+ * @param rawRequestUri the request URI (used to construct the next link)
+ * @param preferredPageSize the client's preference for page size
+ * @return the chosen page size (or <code>null</code> if no paging has been done);
+ * could be used in the Preference-Applied HTTP header
+ * @throws ODataApplicationException
+ */
+ public static Integer applyServerSidePaging(final SkipTokenOption skipTokenOption, EntityCollection entityCollection,
+ final EdmEntitySet edmEntitySet, final String rawRequestUri, final Integer preferredPageSize)
+ throws ODataApplicationException {
if (edmEntitySet != null && shouldApplyServerSidePaging(edmEntitySet)) {
- final int maxPageSize = getMaxPageSize();
+ final int pageSize = getPageSize(getPageSize(skipTokenOption), preferredPageSize);
final int page = getPage(skipTokenOption);
- final int itemsToSkip = maxPageSize * page;
+ final int itemsToSkip = pageSize * page;
- if (itemsToSkip <= entitySet.getEntities().size()) {
- SkipHandler.popAtMost(entitySet, itemsToSkip);
- final int remainingItems = entitySet.getEntities().size();
- TopHandler.reduceToSize(entitySet, maxPageSize);
+ if (itemsToSkip <= entityCollection.getEntities().size()) {
+ SkipHandler.popAtMost(entityCollection, itemsToSkip);
+ final int remainingItems = entityCollection.getEntities().size();
+ TopHandler.reduceToSize(entityCollection, pageSize);
- // Determine if a new next Link has to be provided
- if (remainingItems > maxPageSize) {
- entitySet.setNext(createNextLink(rawRequestUri, page + 1));
+ // Determine if a new next Link has to be provided.
+ if (remainingItems > pageSize) {
+ entityCollection.setNext(createNextLink(rawRequestUri, page + 1, pageSize));
}
} else {
throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
}
+ return pageSize;
}
+ return null;
}
- private static URI createNextLink(final String rawRequestUri, final Integer page)
+ private static URI createNextLink(final String rawRequestUri, final int page, final int pageSize)
throws ODataApplicationException {
+ // Remove a maybe existing skiptoken, making sure that the query part is not empty.
+ String nextlink = rawRequestUri.contains("?") ?
+ rawRequestUri.replaceAll("(\\$|%24)skiptoken=.+&?", "").replaceAll("(\\?|&)$", "") :
+ rawRequestUri;
+
+ // Add a question mark or an ampersand, depending on the current query part.
+ nextlink += nextlink.contains("?") ? '&' : '?';
+
+ // Append the new skiptoken.
+ nextlink += SystemQueryOptionKind.SKIPTOKEN.toString().replace("$", "%24") // poor man's percent encoding
+ + '='
+ + page + "%2A" + pageSize; // "%2A" is a percent-encoded asterisk
try {
- // Remove skip token
- String nextlink = rawRequestUri;
-
- // Remove a may existing skiptoken, make sure that the query part is not empty
- if (rawRequestUri.contains("?")) {
- nextlink = rawRequestUri.replaceAll("(\\$|%24)skiptoken=.+&?", "").replaceAll("(\\?|&)$", "");
- }
-
- // Add a question mark or an ampersand, depending of the current query part
- if (!nextlink.contains("?")) {
- nextlink = nextlink + "?";
- } else {
- nextlink = nextlink + "&";
- }
-
- // Append the new nextlink
- return new URI(nextlink + Encoder.encode(SystemQueryOptionKind.SKIPTOKEN.toString()) + "="
- + Encoder.encode(page.toString()));
-
- } catch (URISyntaxException e) {
+ return new URI(nextlink);
+ } catch (final URISyntaxException e) {
throw new ODataApplicationException("Exception while constructing next link",
- HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ROOT);
- }
- }
-
- private static int getPage(final SkipTokenOption skipTokenOption) throws ODataApplicationException {
- if (skipTokenOption != null) {
- try {
- return Integer.parseInt(skipTokenOption.getValue());
- } catch (NumberFormatException e) {
- throw new ODataApplicationException("Invalid skip token", HttpStatusCode.BAD_REQUEST.getStatusCode(),
- Locale.ROOT);
- }
- } else {
- return 0;
+ HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ROOT, e);
}
}
@@ -103,8 +100,40 @@
return ES_SERVER_SIDE_PAGING.equals(edmEntitySet.getName());
}
- private static int getMaxPageSize() {
- // TODO Consider odata.maxpagesize preference?
- return MAX_PAGE_SIZE;
+ private static int getPageSize(final int skipTokenPageSize, final Integer preferredPageSize) {
+ return skipTokenPageSize > 0 ? skipTokenPageSize :
+ preferredPageSize == null || preferredPageSize >= MAX_PAGE_SIZE ?
+ MAX_PAGE_SIZE :
+ preferredPageSize;
+ }
+
+ private static int getPageSize(final SkipTokenOption skipTokenOption) throws ODataApplicationException {
+ if (skipTokenOption != null && skipTokenOption.getValue().length() >= 3
+ && skipTokenOption.getValue().contains("*")) {
+ final String value = skipTokenOption.getValue();
+ try {
+ return Integer.parseInt(value.substring(value.indexOf('*') + 1));
+ } catch (final NumberFormatException e) {
+ throw new ODataApplicationException("Invalid skip token", HttpStatusCode.BAD_REQUEST.getStatusCode(),
+ Locale.ROOT, e);
+ }
+ } else {
+ return 0;
+ }
+ }
+
+ private static int getPage(final SkipTokenOption skipTokenOption) throws ODataApplicationException {
+ if (skipTokenOption != null && skipTokenOption.getValue().length() >= 3
+ && skipTokenOption.getValue().contains("*")) {
+ final String value = skipTokenOption.getValue();
+ try {
+ return Integer.parseInt(value.substring(0, value.indexOf('*')));
+ } catch (final NumberFormatException e) {
+ throw new ODataApplicationException("Invalid skip token", HttpStatusCode.BAD_REQUEST.getStatusCode(),
+ Locale.ROOT, e);
+ }
+ } else {
+ return 0;
+ }
}
}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/SystemQueryOptionsRuntimeException.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/SystemQueryOptionsRuntimeException.java
index 57bb204..469052d 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/SystemQueryOptionsRuntimeException.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/SystemQueryOptionsRuntimeException.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.server.tecsvc.processor.queryoptions.options;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
public class SystemQueryOptionsRuntimeException extends ODataRuntimeException {
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java
index 1365a45..2227315 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java
@@ -22,7 +22,7 @@
import java.util.Collections;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlAction;
import org.apache.olingo.commons.api.edm.provider.CsdlParameter;
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
index 819c19f..b3b9864 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
@@ -21,7 +21,7 @@
import java.util.ArrayList;
import java.util.Arrays;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty;
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java
index 1f5bd03..ff53d09 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java
@@ -22,7 +22,7 @@
import java.util.Arrays;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlActionImport;
import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
@@ -142,12 +142,12 @@
functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollCTTwoPrim"));
functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTESMedia"));
functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollESMedia"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCTTwoPrimParam"));
+ functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCTTwoPrimTwoParam"));
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, "FICRTCollESTwoKeyNavParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollCTTwoPrimParam"));
+ functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollCTTwoPrimTwoParam"));
functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINRTCollCTNavFiveProp"));
functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollESKeyNavContParam"));
@@ -598,10 +598,10 @@
.setEntitySet(entityContainer.getFullQualifiedNameAsString() + "/ESMedia")
.setIncludeInServiceDocument(true);
- } else if (name.equals("FICRTCTTwoPrimParam")) {
+ } else if (name.equals("FICRTCTTwoPrimTwoParam")) {
return new CsdlFunctionImport()
.setName(name)
- .setFunction(FunctionProvider.nameUFCRTCTTwoPrimParam)
+ .setFunction(FunctionProvider.nameUFCRTCTTwoPrimTwoParam)
.setIncludeInServiceDocument(true);
} else if (name.equals("FICRTCTTwoPrim")) {
@@ -629,10 +629,10 @@
.setEntitySet(entityContainer.getFullQualifiedNameAsString() + "/ESTwoKeyNav")
.setIncludeInServiceDocument(true);
- } else if (name.equals("FICRTCollCTTwoPrimParam")) {
+ } else if (name.equals("FICRTCollCTTwoPrimTwoParam")) {
return new CsdlFunctionImport()
.setName(name)
- .setFunction(FunctionProvider.nameUFCRTCollCTTwoPrimParam)
+ .setFunction(FunctionProvider.nameUFCRTCollCTTwoPrimTwoParam)
.setIncludeInServiceDocument(true);
} else if (name.equals("FINRTCollCTNavFiveProp")) {
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EdmTechProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EdmTechProvider.java
index 37951a3..ffb1946 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EdmTechProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EdmTechProvider.java
@@ -22,7 +22,7 @@
import java.util.Collections;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
import org.apache.olingo.commons.api.edm.provider.CsdlAction;
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
index b9a8221..a1067ca 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
@@ -20,7 +20,7 @@
import java.util.Arrays;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty;
@@ -371,7 +371,7 @@
PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav,
PropertyProvider.navPropertyETTwoKeyNavOne_ETTwoKeyNav,
PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
- PropertyProvider.collectionNavPropertySINav));
+ PropertyProvider.navPropertySINav));
} else if (entityTypeName.equals(nameETBaseTwoKeyNav)) {
return new CsdlEntityType()
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EnumTypeProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EnumTypeProvider.java
index bc382cf..7479c28 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EnumTypeProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EnumTypeProvider.java
@@ -20,7 +20,7 @@
import java.util.Arrays;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlEnumMember;
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/FunctionProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/FunctionProvider.java
index 63dfec1..df4cfbd 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/FunctionProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/FunctionProvider.java
@@ -23,7 +23,7 @@
import java.util.Collections;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlFunction;
import org.apache.olingo.commons.api.edm.provider.CsdlParameter;
@@ -125,8 +125,8 @@
// 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 nameUFCRTCollCTTwoPrimTwoParam =
+ new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTCollCTTwoPrimTwoParam");
public static final FullQualifiedName nameUFCRTCollString = new FullQualifiedName(SchemaProvider.NAMESPACE,
"UFCRTCollString");
public static final FullQualifiedName nameUFCRTCollStringTwoParam =
@@ -135,8 +135,8 @@
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 nameUFCRTCTTwoPrimTwoParam =
+ new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTCTTwoPrimTwoParam");
public static final FullQualifiedName nameUFCRTESMixPrimCollCompTwoParam =
new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTESMixPrimCollCompTwoParam");
public static final FullQualifiedName nameUFCRTCollETTwoKeyNavParam =
@@ -243,7 +243,7 @@
.setNullable(false)))
.setComposable(true)
.setReturnType(
- new CsdlReturnType().setType(PropertyProvider.nameString).setNullable(false)),
+ new CsdlReturnType().setType(PropertyProvider.nameString).setNullable(true)),
new CsdlFunction()
.setName("UFCRTStringTwoParam")
.setParameters(Arrays.asList(
@@ -256,7 +256,7 @@
.setType(PropertyProvider.nameInt16)
.setNullable(false)))
.setComposable(true)
- .setReturnType(new CsdlReturnType().setType(PropertyProvider.nameString).setNullable(false))
+ .setReturnType(new CsdlReturnType().setType(PropertyProvider.nameString).setNullable(true))
);
@@ -360,10 +360,10 @@
.setNullable(false)
.setCollection(true))
);
- } else if (functionName.equals(nameUFCRTCTTwoPrimParam)) {
+ } else if (functionName.equals(nameUFCRTCTTwoPrimTwoParam)) {
return Arrays.asList(
new CsdlFunction()
- .setName("UFCRTCTTwoPrimParam")
+ .setName("UFCRTCTTwoPrimTwoParam")
.setParameters(
Arrays.asList(
new CsdlParameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(
@@ -374,10 +374,10 @@
.setReturnType(
new CsdlReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false))
);
- } else if (functionName.equals(nameUFCRTCollCTTwoPrimParam)) {
+ } else if (functionName.equals(nameUFCRTCollCTTwoPrimTwoParam)) {
return Arrays.asList(
new CsdlFunction()
- .setName("UFCRTCollCTTwoPrimParam")
+ .setName("UFCRTCollCTTwoPrimTwoParam")
.setParameters(
Arrays.asList(
new CsdlParameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
index 6efad33..690e1d3 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
@@ -687,9 +687,9 @@
.setType(EntityTypeProvider.nameETAllPrim)
.setCollection(true);
- public static final CsdlNavigationProperty collectionNavPropertySINav = new CsdlNavigationProperty()
+ public static final CsdlNavigationProperty navPropertySINav = new CsdlNavigationProperty()
.setName("NavPropertySINav")
- .setCollection(true)
+ .setCollection(false)
.setType(EntityTypeProvider.nameETTwoKeyNav);
public static final CsdlNavigationProperty collectionNavPropertyETKeyNavContMany_CT_ETKeyNav =
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java
index c8d299d..b07ae60 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java
@@ -21,7 +21,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.provider.CsdlAction;
import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
@@ -146,8 +146,8 @@
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.nameUFCRTCTTwoPrimTwoParam));
+ functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCollCTTwoPrimTwoParam));
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCTTwoPrim));
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCollCTTwoPrim));
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETMedia));
diff --git a/lib/server-tecsvc/src/main/webapp/WEB-INF/web.xml b/lib/server-tecsvc/src/main/webapp/WEB-INF/web.xml
index 3c68d16..d20194f 100644
--- a/lib/server-tecsvc/src/main/webapp/WEB-INF/web.xml
+++ b/lib/server-tecsvc/src/main/webapp/WEB-INF/web.xml
@@ -39,4 +39,18 @@
<url-pattern>/odata.svc/*</url-pattern>
</servlet-mapping>
+ <servlet>
+ <servlet-name>StatusMonitorServlet</servlet-name>
+ <servlet-class>org.apache.olingo.server.tecsvc.async.TechnicalStatusMonitorServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>StatusMonitorServlet</servlet-name>
+ <url-pattern>/status/*</url-pattern>
+ </servlet-mapping>
+
+ <listener>
+ <listener-class>org.apache.olingo.server.tecsvc.TechnicalServletContextListener</listener-class>
+ </listener>
</web-app>
diff --git a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java b/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java
index f3bfc4f..dab178c 100644
--- a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java
+++ b/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java
@@ -55,7 +55,7 @@
@Test
public void esAllPrimEntity() throws Exception {
- final DataProvider dataProvider = new DataProvider();
+ final DataProvider dataProvider = new DataProvider(edm);
final Entity entity = dataProvider.readAll(esAllPrim).getEntities().get(2);
Assert.assertEquals(16, entity.getProperties().size());
@@ -65,7 +65,7 @@
@Test
public void esAllKeyEntity() throws Exception {
- final DataProvider dataProvider = new DataProvider();
+ final DataProvider dataProvider = new DataProvider(edm);
final Entity entity = dataProvider.readAll(esAllKey).getEntities().get(0);
Assert.assertEquals(13, entity.getProperties().size());
@@ -87,7 +87,7 @@
@Test
public void esAllPrim() throws Exception {
- final DataProvider data = new DataProvider();
+ final DataProvider data = new DataProvider(edm);
EntityCollection outSet = data.readAll(esAllPrim);
Assert.assertEquals(3, outSet.getEntities().size());
@@ -107,7 +107,8 @@
@Test
public void esCollAllPrim() throws Exception {
- EntityCollection outSet = new DataProvider().readAll(esCollAllPrim);
+ final DataProvider dataProvider = new DataProvider(edm);
+ EntityCollection outSet = dataProvider.readAll(esCollAllPrim);
Assert.assertEquals(3, outSet.getEntities().size());
Assert.assertEquals(17, outSet.getEntities().get(0).getProperties().size());
@@ -120,9 +121,11 @@
@Test
public void esCompAllPrim() throws Exception {
- EntityCollection outSet = new DataProvider().readAll(esCompAllPrim);
+ final DataProvider dataProvider = new DataProvider(edm);
+
+ EntityCollection outSet = dataProvider.readAll(esCompAllPrim);
- Assert.assertEquals(3, outSet.getEntities().size());
+ Assert.assertEquals(4, outSet.getEntities().size());
Assert.assertEquals(2, outSet.getEntities().get(0).getProperties().size());
Property complex = outSet.getEntities().get(0).getProperties().get(1);
Assert.assertTrue(complex.isComplex());
@@ -133,7 +136,9 @@
@Test
public void esMixPrimCollComp() throws Exception {
- EntityCollection outSet = new DataProvider().readAll(esMixPrimCollComp);
+ final DataProvider dataProvider = new DataProvider(edm);
+
+ EntityCollection outSet = dataProvider.readAll(esMixPrimCollComp);
Assert.assertEquals(3, outSet.getEntities().size());
Assert.assertEquals(4, outSet.getEntities().get(0).getProperties().size());
@@ -148,7 +153,7 @@
Assert.assertEquals(2, linkedComplexValue.getValue().size());
Property lcProp = linkedComplexValue.getValue().get(0);
Assert.assertFalse(lcProp.isCollection());
- Assert.assertEquals(123, lcProp.getValue());
+ Assert.assertEquals((short) 123, lcProp.getValue());
//
Assert.assertEquals(4, outSet.getEntities().get(1).getProperties().size());
Assert.assertEquals(4, outSet.getEntities().get(2).getProperties().size());
@@ -156,13 +161,14 @@
@Test
public void esMedia() throws Exception {
- DataProvider dataProvider = new DataProvider();
+ DataProvider dataProvider = new DataProvider(edm);
+
Entity entity = dataProvider.read(esMedia, Arrays.asList(mockParameter("PropertyInt16", "3")));
Assert.assertNotNull(dataProvider.readMedia(entity));
dataProvider.delete(esMedia, entity);
Assert.assertEquals(3, dataProvider.readAll(esMedia).getEntities().size());
entity = dataProvider.create(esMedia);
- Assert.assertEquals(3, entity.getProperty("PropertyInt16").getValue());
+ Assert.assertEquals((short) 3, entity.getProperty("PropertyInt16").getValue());
dataProvider.setMedia(entity, new byte[] { 1, 2, 3, 4 }, "x/y");
Assert.assertArrayEquals(new byte[] { 1, 2, 3, 4 }, dataProvider.readMedia(entity));
Assert.assertEquals("x/y", entity.getMediaContentType());
diff --git a/lib/server-test/pom.xml b/lib/server-test/pom.xml
index d715698..2b75475 100644
--- a/lib/server-test/pom.xml
+++ b/lib/server-test/pom.xml
@@ -66,8 +66,12 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -91,6 +95,7 @@
<goal>unpack-dependencies</goal>
</goals>
<configuration>
+ <skip>${cobertura.skip}</skip>
<!--<includes>**/olingo/**/*.class</includes>-->
<!--<excludes>**/*.properties</excludes>-->
<includeGroupIds>${project.groupId}</includeGroupIds>
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
index 755c4f1..b6c6a81 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this 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
@@ -29,31 +29,27 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
-import java.util.Arrays;
import java.util.Collections;
-import java.util.List;
import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.server.api.ODataServerError;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ODataServerError;
import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.batch.BatchFacade;
import org.apache.olingo.server.api.edmx.EdmxReference;
import org.apache.olingo.server.api.processor.ActionComplexCollectionProcessor;
import org.apache.olingo.server.api.processor.ActionComplexProcessor;
@@ -81,6 +77,7 @@
import org.apache.olingo.server.api.processor.ReferenceProcessor;
import org.apache.olingo.server.api.processor.ServiceDocumentProcessor;
import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.core.debug.ServerCoreDebugger;
import org.apache.olingo.server.tecsvc.provider.ContainerProvider;
import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
import org.junit.Test;
@@ -109,22 +106,22 @@
final ODataResponse response = dispatch(HttpMethod.GET, "/", null);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
- String ct = response.getHeaders().get(HttpHeader.CONTENT_TYPE);
+ String ct = response.getHeader(HttpHeader.CONTENT_TYPE);
assertThat(ct, containsString("application/json"));
assertThat(ct, containsString("odata.metadata=minimal"));
assertNotNull(response.getContent());
String doc = IOUtils.toString(response.getContent());
- assertThat(doc, containsString("\"@odata.context\" : \"$metadata\""));
- assertThat(doc, containsString("\"value\" :"));
+ assertThat(doc, containsString("\"@odata.context\":\"$metadata\""));
+ assertThat(doc, containsString("\"value\":"));
}
@Test
public void serviceDocumentRedirect() throws Exception {
final ODataResponse response = dispatch(HttpMethod.GET, "", null);
assertEquals(HttpStatusCode.TEMPORARY_REDIRECT.getStatusCode(), response.getStatusCode());
- assertEquals(BASE_URI + "/", response.getHeaders().get(HttpHeader.LOCATION));
+ assertEquals(BASE_URI + "/", response.getHeader(HttpHeader.LOCATION));
}
@Test
@@ -146,7 +143,7 @@
public void metadataDefault() throws Exception {
final ODataResponse response = dispatch(HttpMethod.GET, "$metadata", null);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
- assertEquals(HttpContentType.APPLICATION_XML, response.getHeaders().get(HttpHeader.CONTENT_TYPE));
+ assertEquals(HttpContentType.APPLICATION_XML, response.getHeader(HttpHeader.CONTENT_TYPE));
assertNotNull(response.getContent());
assertThat(IOUtils.toString(response.getContent()),
@@ -156,14 +153,14 @@
@Test
public void maxVersionNone() {
final ODataResponse response = dispatch(HttpMethod.GET, "$metadata", null);
- assertEquals(ODataServiceVersion.V40.toString(), response.getHeaders().get(HttpHeader.ODATA_VERSION));
+ assertEquals(ODataServiceVersion.V40.toString(), response.getHeader(HttpHeader.ODATA_VERSION));
}
@Test
public void maxVersionSupported() {
final ODataResponse response = dispatch(HttpMethod.GET, "$metadata", null,
HttpHeader.ODATA_MAX_VERSION, ODataServiceVersion.V40.toString(), null);
- assertEquals(ODataServiceVersion.V40.toString(), response.getHeaders().get(HttpHeader.ODATA_VERSION));
+ assertEquals(ODataServiceVersion.V40.toString(), response.getHeader(HttpHeader.ODATA_VERSION));
}
@Test
@@ -171,7 +168,7 @@
final ODataResponse response = dispatch(HttpMethod.GET, "$metadata", null,
HttpHeader.ODATA_MAX_VERSION, ODataServiceVersion.V30.toString(), null);
- assertEquals(ODataServiceVersion.V40.toString(), response.getHeaders().get(HttpHeader.ODATA_VERSION));
+ assertEquals(ODataServiceVersion.V40.toString(), response.getHeader(HttpHeader.ODATA_VERSION));
assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), response.getStatusCode());
}
@@ -237,7 +234,8 @@
request.setMethod(HttpMethod.GET);
request.setRawODataPath("EdmException");
- final ODataResponse response = new ODataHandler(odata, serviceMetadata).process(request);
+ final ODataResponse response =
+ new ODataHandler(odata, serviceMetadata, new ServerCoreDebugger(odata)).process(request);
assertNotNull(response);
assertEquals(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode());
}
@@ -247,8 +245,9 @@
final String uri = "$batch";
final BatchProcessor processor = mock(BatchProcessor.class);
- dispatch(HttpMethod.POST, uri, processor);
- // TODO: Verify that batch processing has been called.
+ dispatch(HttpMethod.POST, uri, null, HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED.toContentTypeString(),
+ processor);
+ verify(processor).processBatch(any(BatchFacade.class), any(ODataRequest.class), any(ODataResponse.class));
dispatchMethodNotAllowed(HttpMethod.GET, uri, processor);
dispatchMethodNotAllowed(HttpMethod.PATCH, uri, processor);
@@ -650,7 +649,7 @@
@Test
public void dispatchReference() throws Exception {
final String uri = "ESAllPrim(0)/NavPropertyETTwoPrimOne/$ref";
- final String uriDeleteMany = "ESAllPrim(0)/NavPropertyETTwoPrimMany/$ref";
+ final String uriMany = "ESAllPrim(0)/NavPropertyETTwoPrimMany/$ref";
final ReferenceProcessor processor = mock(ReferenceProcessor.class);
dispatch(HttpMethod.GET, uri, processor);
@@ -665,29 +664,25 @@
verify(processor, times(2)).updateReference(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
any(ContentType.class));
- dispatch(HttpMethod.POST, uri.replace("One", "Many"), processor);
+ dispatchMethodNotAllowed(HttpMethod.POST, uri, processor);
+
+ dispatch(HttpMethod.POST, uriMany, processor);
verify(processor).createReference(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
any(ContentType.class));
-
- dispatch(HttpMethod.DELETE, uriDeleteMany, "$id=ESTwoPrim(1)", null, Arrays.asList(new Processor[] { processor }));
+
+ dispatch(HttpMethod.DELETE, uriMany, "$id=ESTwoPrim(1)", null, null, processor);
verify(processor).deleteReference(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class));
-
- dispatchMethodNotAllowed(HttpMethod.POST, uri, processor);
}
-
+
@Test
public void dispatchReferenceCollection() throws Exception {
final String uri = "ESAllPrim(0)/NavPropertyETTwoPrimMany/$ref";
final ReferenceCollectionProcessor processor = mock(ReferenceCollectionProcessor.class);
- final ReferenceProcessor singleProcessor = mock(ReferenceProcessor.class);
-
+
dispatch(HttpMethod.GET, uri, processor);
verify(processor).readReferenceCollection(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
any(ContentType.class));
- dispatch(HttpMethod.DELETE, uri, singleProcessor);
- verify(singleProcessor).deleteReference(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class));
-
dispatchMethodNotAllowed(HttpMethod.PATCH, uri, processor);
dispatchMethodNotAllowed(HttpMethod.PUT, uri, processor);
}
@@ -696,7 +691,7 @@
public void unsupportedRequestContentType() throws Exception {
EntityProcessor processor = mock(EntityProcessor.class);
ErrorProcessor errorProcessor = mock(ErrorProcessor.class);
- dispatch(HttpMethod.POST, "ESAllPrim", "", HttpHeader.CONTENT_TYPE, "some/unsupported", errorProcessor);
+ dispatch(HttpMethod.POST, "ESAllPrim", null, HttpHeader.CONTENT_TYPE, "some/unsupported", errorProcessor);
verifyZeroInteractions(processor);
verify(errorProcessor).processError(any(ODataRequest.class), any(ODataResponse.class),
any(ODataServerError.class),
@@ -705,19 +700,6 @@
private ODataResponse dispatch(final HttpMethod method, final String path, final String query,
final String headerName, final String headerValue, final Processor processor) {
- Map<String, List<String>> headers = null;
- if (headerName != null) {
- headers = Collections.singletonMap(headerName, Collections.singletonList(headerValue));
- }
- List<Processor> processors = null;
- if (processor != null) {
- processors = Collections.singletonList(processor);
- }
- return dispatch(method, path, query, headers, processors);
- }
-
- private ODataResponse dispatch(final HttpMethod method, final String path, final String query,
- final Map<String, List<String>> headers, final List<Processor> processors) {
ODataRequest request = new ODataRequest();
request.setMethod(method);
request.setRawBaseUri(BASE_URI);
@@ -727,28 +709,23 @@
request.setRawODataPath(path);
request.setRawQueryPath(query);
- if (headers != null) {
- Set<Map.Entry<String, List<String>>> headerSet = headers.entrySet();
- for (Map.Entry<String, List<String>> headerItem : headerSet) {
- request.addHeader(headerItem.getKey(), headerItem.getValue());
- }
+ if (headerName != null) {
+ request.addHeader(headerName, Collections.singletonList(headerValue));
}
- if (request.getHeaders(HttpHeader.CONTENT_TYPE) == null) {
+ if (headerName != HttpHeader.CONTENT_TYPE) {
request.addHeader(HttpHeader.CONTENT_TYPE, Collections.singletonList(
- ODataFormat.JSON.getContentType().toContentTypeString()));
+ ContentType.JSON.toContentTypeString()));
}
final OData odata = OData.newInstance();
final ServiceMetadata metadata = odata.createServiceMetadata(
new EdmTechProvider(), Collections.<EdmxReference> emptyList());
- ODataHandler handler = new ODataHandler(odata, metadata);
+ ODataHandler handler = new ODataHandler(odata, metadata, new ServerCoreDebugger(odata));
- if (processors != null && !processors.isEmpty()) {
- for (Processor p : processors) {
- handler.register(p);
- }
+ if (processor != null) {
+ handler.register(processor);
}
final ODataResponse response = handler.process(request);
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/PreconditionsValidatorTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/PreconditionsValidatorTest.java
index acd578c..e2fe3ac 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/PreconditionsValidatorTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/PreconditionsValidatorTest.java
@@ -19,246 +19,197 @@
package org.apache.olingo.server.core;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.List;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmBindingTarget;
-import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.apache.olingo.server.api.etag.CustomETagSupport;
import org.apache.olingo.server.api.etag.PreconditionException;
import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.server.api.uri.UriResourceValue;
import org.apache.olingo.server.core.etag.PreconditionsValidator;
import org.apache.olingo.server.core.uri.parser.Parser;
import org.apache.olingo.server.core.uri.parser.UriParserException;
import org.apache.olingo.server.core.uri.parser.UriParserSemanticException;
-import org.apache.olingo.server.core.uri.validator.UriValidator;
import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
-import org.junit.Ignore;
import org.junit.Test;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
public class PreconditionsValidatorTest {
+ private static final Edm edm = new EdmProviderImpl(new EdmTechProvider());
+
// -------------- POSITIVE TESTS --------------------------------------------------------------------------------
@Test
public void simpleEntity() throws Exception {
- UriInfo uriInfo = new Parser().parseUri("ESAllPrim(1)", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport(), uriInfo, "*", "*").validatePreconditions(false);
+ assertTrue(mustValidate("ESAllPrim(1)", "ESAllPrim"));
}
@Test
public void simpleEntityValue() throws Exception {
- UriInfo uriInfo = new Parser().parseUri("ESMedia(1)/$value", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport(), uriInfo, "*", "*").validatePreconditions(true);
+ assertTrue(mustValidate("ESMedia(1)/$value", "ESMedia"));
+ }
+
+ @Test
+ public void property() throws Exception {
+ assertTrue(mustValidate("ESAllPrim(1)/PropertyInt16", "ESAllPrim"));
+ assertTrue(mustValidate("ESMixPrimCollComp(0)/PropertyComp", "ESMixPrimCollComp"));
+ assertTrue(mustValidate("ESMixPrimCollComp(0)/PropertyComp/PropertyString", "ESMixPrimCollComp"));
+ }
+
+ @Test
+ public void propertyValue() throws Exception {
+ assertTrue(mustValidate("ESAllPrim(1)/PropertyInt16/$value", "ESAllPrim"));
+ assertTrue(mustValidate("ESMixPrimCollComp(0)/PropertyComp/PropertyString/$value", "ESMixPrimCollComp"));
}
@Test
public void EntityAndToOneNavigation() throws Exception {
- UriInfo uriInfo = new Parser().parseUri("ESAllPrim(1)/NavPropertyETTwoPrimOne", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport("ESTwoPrim"), uriInfo, "*", "*").validatePreconditions(false);
+ assertTrue(mustValidate("ESAllPrim(1)/NavPropertyETTwoPrimOne", "ESTwoPrim"));
}
@Test
public void EntityAndToManyNavigationWithKey() throws Exception {
- UriInfo uriInfo = new Parser().parseUri("ESAllPrim(1)/NavPropertyETTwoPrimMany(1)", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport("ESTwoPrim"), uriInfo, "*", "*").validatePreconditions(false);
+ assertTrue(mustValidate("ESAllPrim(1)/NavPropertyETTwoPrimMany(1)", "ESTwoPrim"));
}
@Test
public void EntityAndToOneNavigationValue() throws Exception {
- UriInfo uriInfo = new Parser().parseUri("ESKeyNav(1)/NavPropertyETMediaOne/$value", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport("ESMedia"), uriInfo, "*", "*").validatePreconditions(true);
+ assertTrue(mustValidate("ESKeyNav(1)/NavPropertyETMediaOne/$value", "ESMedia"));
+ }
+
+ @Test
+ public void navigationOnProperty() throws Exception {
+ assertTrue(mustValidate("ESAllPrim(1)/NavPropertyETTwoPrimOne/PropertyInt16", "ESTwoPrim"));
+ }
+
+ @Test
+ public void navigationOnFunction() throws Exception {
+ assertTrue(mustValidate("FICRTESTwoKeyNav()(PropertyInt16=1,PropertyString='1')/NavPropertySINav", "SINav"));
}
@Test
public void boundActionOnEsKeyNav() throws Exception {
- UriInfo uriInfo =
- new Parser().parseUri("ESKeyNav(1)/Namespace1_Alias.BAETTwoKeyNavRTETTwoKeyNav", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport("ESKeyNav"), uriInfo, "*", "*").validatePreconditions(false);
+ assertTrue(mustValidate("ESKeyNav(1)/Namespace1_Alias.BAETTwoKeyNavRTETTwoKeyNav", "ESKeyNav"));
}
@Test
public void boundActionOnEsKeyNavWithNavigation() throws Exception {
- UriInfo uriInfo =
- new Parser().parseUri("ESKeyNav(1)/NavPropertyETKeyNavOne/Namespace1_Alias.BAETTwoKeyNavRTETTwoKeyNav", null,
- null, getEdm());
- new PreconditionsValidator(new ETagSupport("ESKeyNav"), uriInfo, "*", "*").validatePreconditions(false);
+ assertTrue(
+ mustValidate("ESKeyNav(1)/NavPropertyETKeyNavOne/Namespace1_Alias.BAETTwoKeyNavRTETTwoKeyNav", "ESKeyNav"));
}
@Test
public void singleton() throws Exception {
- UriInfo uriInfo = new Parser().parseUri("SI", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport("SI"), uriInfo, "*", "*").validatePreconditions(false);
+ assertTrue(mustValidate("SI", "SI"));
}
@Test
public void singletonWithNavigation() throws Exception {
- UriInfo uriInfo = new Parser().parseUri("SINav/NavPropertyETKeyNavOne", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport("ESKeyNav"), uriInfo, "*", "*").validatePreconditions(false);
+ assertTrue(mustValidate("SINav/NavPropertyETKeyNavOne", "ESKeyNav"));
}
@Test
public void singletonWithNavigationValue() throws Exception {
- UriInfo uriInfo =
- new Parser().parseUri("SINav/NavPropertyETKeyNavOne/NavPropertyETMediaOne/$value", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport("ESMedia"), uriInfo, "*", "*").validatePreconditions(false);
+ assertTrue(mustValidate("SINav/NavPropertyETKeyNavOne/NavPropertyETMediaOne/$value", "ESMedia"));
}
@Test
public void singletonWithAction() throws Exception {
- UriInfo uriInfo = new Parser().parseUri("SINav/Namespace1_Alias.BAETTwoKeyNavRTETTwoKeyNav", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport("SINav"), uriInfo, "*", "*").validatePreconditions(false);
+ assertTrue(mustValidate("SINav/Namespace1_Alias.BAETTwoKeyNavRTETTwoKeyNav", "SINav"));
}
@Test
public void singletonWithActionAndNavigation() throws Exception {
- UriInfo uriInfo =
- new Parser().parseUri("SINav/NavPropertyETKeyNavOne/Namespace1_Alias.BAETTwoKeyNavRTETTwoKeyNav", null, null,
- getEdm());
- new PreconditionsValidator(new ETagSupport("ESKeyNav"), uriInfo, "*", "*").validatePreconditions(false);
+ assertTrue(mustValidate("SINav/NavPropertyETKeyNavOne/Namespace1_Alias.BAETTwoKeyNavRTETTwoKeyNav", "ESKeyNav"));
}
@Test
public void simpleEntityValueValidationNotActiveForMedia() throws Exception {
- UriInfo uriInfo = new Parser().parseUri("ESMedia(1)/$value", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport(true, false), uriInfo, null, null).validatePreconditions(true);
+ final UriInfo uriInfo = new Parser().parseUri("ESMedia(1)/$value", null, null, edm);
+
+ CustomETagSupport support = mock(CustomETagSupport.class);
+ when(support.hasETag(any(EdmBindingTarget.class))).thenReturn(true);
+ when(support.hasMediaETag(any(EdmBindingTarget.class))).thenReturn(false);
+
+ assertFalse(new PreconditionsValidator(uriInfo).mustValidatePreconditions(support, true));
}
// -------------- IGNORE VALIDATION TESTS -----------------------------------------------------------------------
@Test
- public void entitySetMustNotLeadToException() throws Exception {
- UriInfo uriInfo = new Parser().parseUri("ESAllPrim", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport(), uriInfo, null, null).validatePreconditions(false);
+ public void entitySetMustBeIgnored() throws Exception {
+ assertFalse(mustValidate("ESAllPrim", "ESAllPrim"));
}
@Test
- public void propertyMustNotLeadToException() throws Exception {
- UriInfo uriInfo = new Parser().parseUri("ESAllPrim(1)/PropertyInt16", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport(), uriInfo, null, null).validatePreconditions(false);
+ public void navigationToManyMustBeIgnored() throws Exception {
+ assertFalse(mustValidate("ESAllPrim(1)/NavPropertyETTwoPrimMany", "ESTwoPrim"));
}
@Test
- public void propertyValueMustNotLeadToException() throws Exception {
- UriInfo uriInfo = new Parser().parseUri("ESAllPrim(1)/PropertyInt16/$value", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport(), uriInfo, null, null).validatePreconditions(true);
+ public void navigationOnFunctionWithoutEntitySetMustBeIgnored() throws Exception {
+ assertFalse(mustValidate("FICRTETTwoKeyNavParam(ParameterInt16=1)/NavPropertyETKeyNavOne", null));
}
@Test
- public void navigationToManyMustNotLeadToException() throws Exception {
- UriInfo uriInfo = new Parser().parseUri("ESAllPrim(1)/NavPropertyETTwoPrimMany", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport(), uriInfo, null, null).validatePreconditions(false);
+ public void navigationToManyToActionMustBeIgnored() throws Exception {
+ assertFalse(mustValidate("ESTwoPrim(1)/NavPropertyETAllPrimMany/Namespace1_Alias.BAESAllPrimRTETAllPrim", null));
}
@Test
- public void navigationOnPropertyMustNotLeadToException() throws Exception {
- UriInfo uriInfo = new Parser().parseUri("ESAllPrim(1)/NavPropertyETTwoPrimOne/PropertyInt16", null, null, getEdm());
- new PreconditionsValidator(new ETagSupport(), uriInfo, null, null).validatePreconditions(false);
+ public void navigationWithoutBindingMustBeIgnored() throws Exception {
+ assertFalse(mustValidate("ESTwoBaseTwoKeyNav(PropertyInt16=1,PropertyString='test')"
+ + "/NavPropertyETBaseTwoKeyNavMany(PropertyInt16=1,PropertyString='test')",
+ null));
}
@Test
- public void navigationToManyOnActionMustNotLeadToException() throws Exception {
- UriInfo uriInfo =
- new Parser().parseUri("ESTwoPrim(1)/NavPropertyETAllPrimMany/Namespace1_Alias.BAESAllPrimRTETAllPrim", null,
- null, getEdm());
- new PreconditionsValidator(new ETagSupport(), uriInfo, null, null).validatePreconditions(false);
+ public void referencesMustBeIgnored() throws Exception {
+ assertFalse(mustValidate("ESAllPrim(1)/NavPropertyETTwoPrimOne/$ref", "ESTwoPrim"));
+ assertFalse(mustValidate("ESAllPrim(1)/NavPropertyETTwoPrimMany(1)/$ref", "ESTwoPrim"));
+ assertFalse(mustValidate("SINav/NavPropertyETKeyNavOne/$ref", "ESKeyNav"));
}
- @Test
- public void navigationWithoutBindingMustNotLeadToAnException() throws Exception {
- UriInfo uriInfo =
- new Parser()
- .parseUri(
- "ESTwoBaseTwoKeyNav(PropertyInt16=1,PropertyString='test')"
- + "/NavPropertyETBaseTwoKeyNavMany(PropertyInt16=1,PropertyString='test')",
- null, null, getEdm());
- new PreconditionsValidator(new ETagSupport(), uriInfo, null, null).validatePreconditions(false);
- }
-
- // -------------- NEGATIVE TESTS --------------------------------------------------------------------------------
-
- @Test
- public void positiveTestsMustLeadToAnExceptionIfNoHeaderIsPresent() throws Exception {
- runException("ESAllPrim(1)", null);
- runException("ESMedia(1)/$value", null);
- runException("ESAllPrim(1)/NavPropertyETTwoPrimOne", null);
- runException("ESAllPrim(1)/NavPropertyETTwoPrimMany(1)", null);
- runException("ESKeyNav(1)/NavPropertyETMediaOne/$value", null);
- runException("ESKeyNav(1)/Namespace1_Alias.BAETTwoKeyNavRTETTwoKeyNav", null);
- runException("ESKeyNav(1)/NavPropertyETKeyNavOne/Namespace1_Alias.BAETTwoKeyNavRTETTwoKeyNav", null);
-
- runException("SI", null);
- runException("SINav/NavPropertyETKeyNavOne", null);
- runException("SINav/NavPropertyETKeyNavOne/NavPropertyETMediaOne/$value", null);
- runException("SINav/Namespace1_Alias.BAETTwoKeyNavRTETTwoKeyNav", null);
- runException("SINav/NavPropertyETKeyNavOne/Namespace1_Alias.BAETTwoKeyNavRTETTwoKeyNav", null);
- }
-
- @Ignore
- @Test
+ @Test(expected = UriParserSemanticException.class)
public void resourceSegmentAfterActionMustLeadToUriParserException() throws Exception {
- // TODO: Check with URI Parser
- UriInfo uriInfo =
- new Parser().parseUri("ESKeyNav(1)/Namespace1_Alias.BAETTwoKeyNavRTETTwoKeyNav/PropertyInt16", null, null,
- getEdm());
- new UriValidator().validate(uriInfo, HttpMethod.GET);
- new PreconditionsValidator(new ETagSupport("ESKeyNav"), uriInfo, "*", "*").validatePreconditions(false);
+ mustValidate("ESKeyNav(1)/Namespace1_Alias.BAETTwoKeyNavRTETTwoKeyNav/PropertyInt16", "ESKeyNav");
}
@Test(expected = UriParserSemanticException.class)
public void valueMustBeLastSegment() throws Exception {
- new Parser().parseUri("ESMedia(1)/$value/PropertyInt16", null, null, getEdm());
+ mustValidate("ESMedia(1)/$value/PropertyInt16", "ESMedia");
}
- private void runException(String uri, String expectedEntitySet) throws UriParserException {
- UriInfo uriInfo = new Parser().parseUri(uri, null, null, getEdm());
- try {
- CustomETagSupport etagSupport =
- expectedEntitySet == null ? new ETagSupport() : new ETagSupport(expectedEntitySet);
- boolean isMedia = uri.endsWith("$value");
- new PreconditionsValidator(etagSupport, uriInfo, null, null).validatePreconditions(isMedia);
- fail("Expected a PreconditionRequiredException but was not thrown");
- } catch (PreconditionException e) {
- assertEquals(PreconditionException.MessageKeys.MISSING_HEADER, e.getMessageKey());
- }
- }
+ private boolean mustValidate(final String uri, final String entitySetName)
+ throws UriParserException, PreconditionException {
+ final UriInfo uriInfo = new Parser().parseUri(uri, null, null, edm);
+ final List<UriResource> parts = uriInfo.getUriResourceParts();
+ final boolean isMedia = parts.get(parts.size() - 1) instanceof UriResourceValue
+ && parts.get(parts.size() - 2) instanceof UriResourceEntitySet;
- private Edm getEdm() {
- return new EdmProviderImpl(new EdmTechProvider());
- }
+ CustomETagSupport support = mock(CustomETagSupport.class);
+ final Answer<Boolean> answer = new Answer<Boolean>() {
+ public Boolean answer(final InvocationOnMock invocation) throws Throwable {
+ if (entitySetName != null) {
+ assertEquals(entitySetName, ((EdmBindingTarget) invocation.getArguments()[0]).getName());
+ }
+ return true;
+ }};
+ when(support.hasETag(any(EdmBindingTarget.class))).thenAnswer(answer);
+ when(support.hasMediaETag(any(EdmBindingTarget.class))).thenAnswer(answer);
- public class ETagSupport implements CustomETagSupport {
-
- private boolean eTag = true;
- private boolean mediaETag = true;
- private String entitySetName;
-
- public ETagSupport() {}
-
- public ETagSupport(String entitySetName) {
- this.entitySetName = entitySetName;
- }
-
- public ETagSupport(boolean eTag, boolean mediaETag) {
- this.eTag = eTag;
- this.mediaETag = mediaETag;
- }
-
- @Override
- public boolean hasETag(EdmBindingTarget entitySetOrSingeton) {
- if (this.entitySetName != null) {
- assertEquals(this.entitySetName, entitySetOrSingeton.getName());
- }
- return eTag;
- }
-
- @Override
- public boolean hasMediaETag(EdmBindingTarget entitySetOrSingelton) {
- if (this.entitySetName != null) {
- assertEquals(this.entitySetName, entitySetOrSingelton.getName());
- }
- return mediaETag;
- }
+ return new PreconditionsValidator(uriInfo).mustValidatePreconditions(support, isMedia);
}
}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/AbstractODataDeserializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/AbstractODataDeserializerTest.java
index 89b7318..c0e188a 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/AbstractODataDeserializerTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/AbstractODataDeserializerTest.java
@@ -23,12 +23,16 @@
import java.util.Collections;
import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.edmx.EdmxReference;
import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
public class AbstractODataDeserializerTest {
-
+ protected static final ContentType CONTENT_TYPE_JSON = ContentType.JSON;
+ protected static final ContentType CONTENT_TYPE_JSON_IEEE754Compatible =
+ ContentType.parse("application/json;odata.format=minimal;IEEE754Compatible=true");
+
protected static final Edm edm = OData.newInstance().createServiceMetadata(
new EdmTechProvider(), Collections.<EdmxReference> emptyList()).getEdm();
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerDeepInsertTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerDeepInsertTest.java
index 010ec06..7bae022 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerDeepInsertTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerDeepInsertTest.java
@@ -30,18 +30,16 @@
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.junit.Test;
public class ODataDeserializerDeepInsertTest extends AbstractODataDeserializerTest {
-
@Test
public void esAllPrimExpandedToOne() throws Exception {
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
InputStream stream = getFileAsStream("EntityESAllPrimExpandedNavPropertyETTwoPrimOne.json");
- Entity entity = OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType).getEntity();
+ Entity entity = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entity(stream, edmEntityType).getEntity();
Link navigationLink = entity.getNavigationLink("NavPropertyETTwoPrimOne");
assertNotNull(navigationLink);
@@ -55,14 +53,14 @@
public void esAllPrimExpandedToOneWithODataAnnotations() throws Exception {
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
InputStream stream = getFileAsStream("EntityESAllPrimExpandedNavPropertyETTwoPrimOneWithODataAnnotations.json");
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entity(stream, edmEntityType);
}
@Test
public void esAllPrimExpandedToMany() throws Exception {
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
InputStream stream = getFileAsStream("EntityESAllPrimExpandedNavPropertyETTwoPrimMany.json");
- Entity entity = OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType).getEntity();
+ Entity entity = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entity(stream, edmEntityType).getEntity();
Link navigationLink = entity.getNavigationLink("NavPropertyETTwoPrimMany");
assertNotNull(navigationLink);
@@ -78,7 +76,7 @@
public void esAllPrimExpandedToManyWithODataAnnotations() throws Exception {
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
InputStream stream = getFileAsStream("EntityESAllPrimExpandedNavPropertyETTwoPrimManyWithODataAnnotations.json");
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entity(stream, edmEntityType);
}
@Test(expected = DeserializerException.class)
@@ -86,7 +84,7 @@
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
InputStream stream = getFileAsStream("EntityESAllPrimExpandedNavPropertyETTwoPrimOneWithCustomAnnotations.json");
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entity(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.NOT_IMPLEMENTED, e.getMessageKey());
throw e;
@@ -98,7 +96,7 @@
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
InputStream stream = getFileAsStream("EntityESAllPrimExpandedNavPropertyETTwoPrimManyWithCustomAnnotations.json");
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entity(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.NOT_IMPLEMENTED, e.getMessageKey());
throw e;
@@ -114,7 +112,7 @@
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entity(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, e.getMessageKey());
throw e;
@@ -129,7 +127,7 @@
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETTwoPrim"));
- final Entity entity = OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType)
+ final Entity entity = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entity(stream, edmEntityType)
.getEntity();
assertEquals(1, entity.getNavigationLinks().size());
@@ -149,7 +147,7 @@
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entity(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.INVALID_VALUE_FOR_NAVIGATION_PROPERTY, e.getMessageKey());
throw e;
@@ -165,7 +163,7 @@
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entity(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, e.getMessageKey());
throw e;
@@ -181,7 +179,7 @@
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entity(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.INVALID_VALUE_FOR_NAVIGATION_PROPERTY, e.getMessageKey());
throw e;
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerEntityCollectionTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerEntityCollectionTest.java
index c2294dd..375fafb 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerEntityCollectionTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerEntityCollectionTest.java
@@ -32,7 +32,6 @@
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.junit.Test;
@@ -44,7 +43,7 @@
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
InputStream stream = getFileAsStream("ESAllPrim.json");
EntityCollection entitySet =
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType)
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entityCollection(stream, edmEntityType)
.getEntityCollection();
assertNotNull(entitySet);
@@ -79,7 +78,7 @@
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETCompCollComp"));
InputStream stream = getFileAsStream("ESCompCollComp.json");
EntityCollection entitySet =
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType)
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entityCollection(stream, edmEntityType)
.getEntityCollection();
assertNotNull(entitySet);
@@ -92,7 +91,7 @@
public void esAllPrimODataAnnotationsAreIgnored() throws Exception {
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
InputStream stream = getFileAsStream("ESAllPrimWithODataAnnotations.json");
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entityCollection(stream, edmEntityType);
}
@Test
@@ -101,7 +100,7 @@
InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
EntityCollection entityCollection =
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType)
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entityCollection(stream, edmEntityType)
.getEntityCollection();
assertNotNull(entityCollection.getEntities());
assertTrue(entityCollection.getEntities().isEmpty());
@@ -112,7 +111,7 @@
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
InputStream stream = getFileAsStream("ESAllPrimWithCustomAnnotations.json");
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entityCollection(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.NOT_IMPLEMENTED, e.getMessageKey());
throw e;
@@ -124,7 +123,7 @@
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
InputStream stream = getFileAsStream("ESAllPrimWithDoubleKey.json");
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entityCollection(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.DUPLICATE_JSON_PROPERTY, e.getMessageKey());
throw e;
@@ -137,7 +136,7 @@
InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entityCollection(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.VALUE_TAG_MUST_BE_AN_ARRAY, e.getMessageKey());
throw e;
@@ -150,7 +149,7 @@
InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entityCollection(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.VALUE_TAG_MUST_BE_AN_ARRAY, e.getMessageKey());
throw e;
@@ -163,7 +162,7 @@
InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entityCollection(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.VALUE_TAG_MUST_BE_AN_ARRAY, e.getMessageKey());
throw e;
@@ -176,7 +175,7 @@
InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entityCollection(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.VALUE_ARRAY_NOT_PRESENT, e.getMessageKey());
throw e;
@@ -189,7 +188,7 @@
InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entityCollection(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.INVALID_ENTITY, e.getMessageKey());
throw e;
@@ -202,7 +201,7 @@
InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entityCollection(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.INVALID_ENTITY, e.getMessageKey());
throw e;
@@ -215,7 +214,7 @@
InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entityCollection(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.JSON_SYNTAX_EXCEPTION, e.getMessageKey());
throw e;
@@ -230,7 +229,7 @@
InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entityCollection(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.UNKNOWN_CONTENT, e.getMessageKey());
throw e;
@@ -245,7 +244,7 @@
InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
+ OData.newInstance().createDeserializer(CONTENT_TYPE_JSON).entityCollection(stream, edmEntityType);
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.NOT_IMPLEMENTED, e.getMessageKey());
throw e;
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerActionParametersTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerActionParametersTest.java
index 00918db..3ed9f89 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerActionParametersTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerActionParametersTest.java
@@ -28,7 +28,6 @@
import org.apache.olingo.commons.api.data.Parameter;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.junit.Test;
@@ -80,7 +79,21 @@
assertNotNull(parameter);
assertEquals(BigDecimal.valueOf(3669753), parameter.getValue());
}
-
+
+ @Test
+ public void testParameterWithNullLiteral() throws Exception {
+ final Map<String, Parameter> parameters = deserialize("{\"ParameterInt16\":1,\"ParameterDuration\":null}",
+ "UARTCollStringTwoParam");
+ assertNotNull(parameters);
+ assertEquals(2, parameters.size());
+ Parameter parameter = parameters.get("ParameterInt16");
+ assertNotNull(parameter);
+ assertEquals((short) 1, parameter.getValue());
+ parameter = parameters.get("ParameterDuration");
+ assertNotNull(parameter);
+ assertEquals(null, parameter.getValue());
+ }
+
@Test(expected = DeserializerException.class)
public void bindingParameter() throws Exception {
deserialize("{\"ParameterETAllPrim\":{\"PropertyInt16\":42}}", "BAETAllPrimRT", "ETAllPrim");
@@ -110,16 +123,16 @@
public void wrongType() throws Exception {
deserialize("{\"ParameterInt16\":\"42\"}", "UARTParam");
}
-
+
private Map<String, Parameter> deserialize(final String input, final String actionName) throws DeserializerException {
- return OData.newInstance().createDeserializer(ODataFormat.JSON)
+ return OData.newInstance().createDeserializer(CONTENT_TYPE_JSON)
.actionParameters(new ByteArrayInputStream(input.getBytes()),
edm.getUnboundAction(new FullQualifiedName("Namespace1_Alias", actionName))).getActionParameters();
}
private Map<String, Parameter> deserialize(final String input, final String actionName, final String typeName)
throws DeserializerException {
- return OData.newInstance().createDeserializer(ODataFormat.JSON)
+ return OData.newInstance().createDeserializer(CONTENT_TYPE_JSON)
.actionParameters(new ByteArrayInputStream(input.getBytes()),
edm.getBoundAction(new FullQualifiedName("Namespace1_Alias", actionName),
new FullQualifiedName("Namespace1_Alias", typeName), false)).getActionParameters();
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
index 0956c91..5388b40 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
@@ -45,7 +45,6 @@
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlMapping;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDate;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
import org.apache.olingo.server.api.OData;
@@ -61,7 +60,7 @@
public void emptyEntity() throws Exception {
String entityString = "{}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity =
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")))
.getEntity();
@@ -91,7 +90,7 @@
"\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
"\"PropertyTimeOfDay\":\"03:26:05\"}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity =
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")))
.getEntity();
@@ -138,7 +137,7 @@
"\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
"\"PropertyTimeOfDay\":\"03:26:05\"}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity =
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")))
.getEntity();
@@ -159,7 +158,7 @@
"\"PropertyString\":\"First Resource - positive values\"" +
"}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity =
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")))
.getEntity();
@@ -189,7 +188,7 @@
"\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
"\"PropertyTimeOfDay\":\"03:26:05\"}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity =
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")))
.getEntity();
@@ -224,7 +223,7 @@
"\"PropertySByte\":127," +
"\"PropertyTimeOfDay\":\"01:00:01\"}}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity =
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETCompAllPrim")))
.getEntity();
@@ -266,7 +265,7 @@
+ "\"CollPropertyTimeOfDay\":[\"04:14:13\",\"23:59:59\",\"01:12:33\"]"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity =
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETCollAllPrim")))
.getEntity();
@@ -304,7 +303,7 @@
+ "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity =
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")))
.getEntity();
@@ -337,7 +336,7 @@
+ "{\"PropertyInt16\":789}]}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity =
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")))
.getEntity();
@@ -386,7 +385,7 @@
"\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
"\"PropertyTimeOfDay\":\"03:26:05\"}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity =
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")))
.getEntity();
@@ -404,7 +403,7 @@
+ "\"PropertyString\":\"First Resource - positive values\""
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
}
@@ -423,7 +422,7 @@
+ "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
}
@@ -444,7 +443,7 @@
+ "\"PropertyString\":\"First Resource - positive values\""
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity =
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")))
.getEntity();
@@ -463,7 +462,7 @@
+ "\"NavPropertyETTwoPrimMany@odata.bind\":[\"ESTwoPrim(2)\",\"ESTwoPrim(3)\"]"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity =
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")))
.getEntity();
@@ -497,7 +496,7 @@
+ "\"NavPropertyETTwoPrimMany@odata.bind\":[]"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity =
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")))
.getEntity();
@@ -509,7 +508,7 @@
@Test
public void eTMixEnumDefCollCompTest() throws Exception {
InputStream stream = getFileAsStream("EntityETMixEnumDefCollComp.json");
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity =
deserializer.entity(stream, edm
.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixEnumDefCollComp")))
@@ -556,7 +555,7 @@
+ "\"CollPropertyTimeOfDay\":[\"04:14:13\",\"23:59:59\",\"01:12:33\"]"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity e = deserializer.entity(stream, edm.getEntityType(
new FullQualifiedName("Namespace1_Alias", "ETCollAllPrim"))).getEntity();
@@ -571,7 +570,7 @@
+ "\"PropertyComp\":null"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity = deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias",
"ETMixPrimCollComp"))).getEntity();
@@ -585,7 +584,7 @@
+ "null,"
+ "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity = deserializer.entity(stream, edm.getEntityType(
new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp"))).getEntity();
@@ -602,7 +601,7 @@
+ "\"PropertyComp\":{\"PropertyString\":\"TEST A\",\"PropertyInt16\":null}"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity = deserializer.entity(stream, edm.getEntityType(
new FullQualifiedName("Namespace1_Alias", "ETCompAllPrim"))).getEntity();
@@ -619,7 +618,7 @@
+ "}}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity e = deserializer.entity(stream, edm.getEntityType(
new FullQualifiedName("Namespace1_Alias", "ETMixEnumDefCollComp"))).getEntity();
@@ -635,7 +634,7 @@
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity e = deserializer.entity(stream, edm.getEntityType(
new FullQualifiedName("Namespace1_Alias", "ETMixEnumDefCollComp"))).getEntity();
@@ -671,7 +670,7 @@
"{\"PropertyDate\":\"2012-12-03\","
+ "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\"}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
Entity entity =
deserializer.entity(stream, entityType).getEntity();
assertNotNull(entity);
@@ -708,7 +707,7 @@
"\"PropertyTimeOfDay\":\"03:26:05\"}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, e.getMessageKey());
@@ -723,7 +722,7 @@
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETTwoPrim")));
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.DUPLICATE_PROPERTY, e.getMessageKey());
@@ -746,7 +745,7 @@
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.DUPLICATE_PROPERTY, e.getMessageKey());
@@ -773,7 +772,7 @@
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.DUPLICATE_PROPERTY, e.getMessageKey());
@@ -797,7 +796,7 @@
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.DUPLICATE_PROPERTY, e.getMessageKey());
@@ -820,7 +819,7 @@
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.NOT_IMPLEMENTED, e.getMessageKey());
@@ -843,7 +842,7 @@
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.NOT_IMPLEMENTED, e.getMessageKey());
@@ -865,7 +864,7 @@
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.NOT_IMPLEMENTED, e.getMessageKey());
@@ -888,7 +887,7 @@
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.UNKNOWN_CONTENT, e.getMessageKey());
@@ -910,7 +909,7 @@
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.UNKNOWN_CONTENT, e.getMessageKey());
@@ -932,7 +931,7 @@
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
} catch (DeserializerException e) {
assertEquals(DeserializerException.MessageKeys.UNKNOWN_CONTENT, e.getMessageKey());
@@ -1044,7 +1043,7 @@
+ "\"NavPropertyETTwoPrimOne@odata.bind\":[\"ESTwoPrim(2)\"]"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
} catch (DeserializerException e) {
@@ -1061,7 +1060,7 @@
+ "\"NavPropertyETTwoPrimMany@odata.bind\":\"ESTwoPrim(2)\""
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
} catch (DeserializerException e) {
@@ -1078,7 +1077,7 @@
+ "\"NavPropertyETTwoPrimMany@odata.bind\":[123,456]"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
} catch (DeserializerException e) {
@@ -1095,7 +1094,7 @@
+ "\"@odata.bind\":\"ESTwoPrim(2)\""
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
} catch (DeserializerException e) {
@@ -1112,7 +1111,7 @@
+ "\"NavPropertyETTwoPrimOne@odata.bind\":null"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
} catch (DeserializerException e) {
@@ -1129,7 +1128,7 @@
+ "\"NavPropertyETTwoPrimMany@odata.bind\":null"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
} catch (DeserializerException e) {
@@ -1146,7 +1145,7 @@
+ "\"NavPropertyETTwoPrimMany@odata.bind\":[null]"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
} catch (DeserializerException e) {
@@ -1160,7 +1159,7 @@
String entityString =
"{\"PropertyInt16\":32767,}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
} catch (DeserializerException e) {
@@ -1174,7 +1173,7 @@
String entityString =
"{\"PropertyInt16\":[]}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
} catch (DeserializerException e) {
@@ -1188,7 +1187,7 @@
String entityString =
"{\"PropertyInt16\":{}}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
} catch (DeserializerException e) {
@@ -1204,7 +1203,7 @@
+ "{\"Employee1@company.example\":1234}"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
} catch (DeserializerException e) {
@@ -1219,7 +1218,7 @@
+ "\"PropertyComp\":\"InvalidString\""
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
} catch (DeserializerException e) {
@@ -1234,7 +1233,7 @@
+ "\"PropertyComp\":null"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETTwoKeyNav")));
} catch (DeserializerException e) {
@@ -1251,7 +1250,7 @@
+ "\"PropertyComp\": {\"PropertyString\":\"StringValue\"}}"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETTwoKeyNav")));
} catch (DeserializerException e) {
@@ -1267,7 +1266,7 @@
+ "\"PropertyCompTwoPrim\":{\"PropertyInt16\": null, \"PropertyString\":\"StringValue\"}"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETKeyNav")));
} catch (DeserializerException e) {
@@ -1283,7 +1282,7 @@
+ "null,"
+ "\"StringValue_1\",\"TEST 3\"]}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETCollAllPrim")));
} catch (DeserializerException e) {
@@ -1298,7 +1297,7 @@
+ "\"CollPropertyInt16\":[123,\"null\",4711]"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETCollAllPrim")));
} catch (DeserializerException e) {
@@ -1313,7 +1312,7 @@
+ "\"PropertyInt16\":32767000000000000000000000000000000000000"
+ "}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
} catch (DeserializerException e) {
@@ -1331,7 +1330,7 @@
+ "}}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(
new FullQualifiedName("Namespace1_Alias", "ETMixEnumDefCollComp")));
@@ -1350,7 +1349,7 @@
+ "}}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixEnumDefCollComp")));
} catch (DeserializerException e) {
@@ -1368,7 +1367,7 @@
+ "}}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixEnumDefCollComp")));
} catch (DeserializerException e) {
@@ -1386,7 +1385,7 @@
+ "}}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixEnumDefCollComp")));
} catch (DeserializerException e) {
@@ -1404,7 +1403,7 @@
+ "}}";
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixEnumDefCollComp")));
} catch (DeserializerException e) {
@@ -1413,9 +1412,167 @@
}
}
+ @Test
+ public void ieee754Compatible() throws Exception {
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON_IEEE754Compatible);
+ String entityString =
+ "{\"PropertyInt16\":32767," +
+ "\"PropertyString\":\"First Resource - positive values\"," +
+ "\"PropertyBoolean\":null," +
+ "\"PropertyByte\":255," +
+ "\"PropertySByte\":127," +
+ "\"PropertyInt32\":2147483647," +
+ "\"PropertyInt64\":\"9223372036854775807\"," +
+ "\"PropertySingle\":1.79E20," +
+ "\"PropertyDouble\":-1.79E19," +
+ "\"PropertyDecimal\":\"34\"," +
+ "\"PropertyBinary\":\"ASNFZ4mrze8=\"," +
+ "\"PropertyDate\":null," +
+ "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\"," +
+ "\"PropertyDuration\":\"PT6S\"," +
+ "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
+ "\"PropertyTimeOfDay\":\"03:26:05\"}";
+
+ final InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ final Entity entity = deserializer
+ .entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"))).getEntity();
+
+ assertEquals(9223372036854775807L, entity.getProperty("PropertyInt64").asPrimitive());
+ assertEquals(BigDecimal.valueOf(34), entity.getProperty("PropertyDecimal").asPrimitive());
+ }
+
+ @Test
+ public void ieee754CompatibleNull() throws Exception {
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON_IEEE754Compatible);
+ String entityString =
+ "{\"PropertyInt16\":32767," +
+ "\"PropertyString\":\"First Resource - positive values\"," +
+ "\"PropertyBoolean\":null," +
+ "\"PropertyByte\":255," +
+ "\"PropertySByte\":127," +
+ "\"PropertyInt32\":2147483647," +
+ "\"PropertyInt64\":null," +
+ "\"PropertySingle\":1.79E20," +
+ "\"PropertyDouble\":-1.79E19," +
+ "\"PropertyDecimal\":null," +
+ "\"PropertyBinary\":\"ASNFZ4mrze8=\"," +
+ "\"PropertyDate\":null," +
+ "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\"," +
+ "\"PropertyDuration\":\"PT6S\"," +
+ "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
+ "\"PropertyTimeOfDay\":\"03:26:05\"}";
+
+ final InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ final Entity entity = deserializer
+ .entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"))).getEntity();
+
+ assertTrue(entity.getProperty("PropertyInt64").isNull());
+ assertTrue(entity.getProperty("PropertyDecimal").isNull());
+ }
+
+ @Test(expected = DeserializerException.class)
+ public void ieee754CompatibleEmptyString() throws Exception {
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON_IEEE754Compatible);
+ String entityString =
+ "{\"PropertyInt16\":32767," +
+ "\"PropertyString\":\"First Resource - positive values\"," +
+ "\"PropertyBoolean\":null," +
+ "\"PropertyByte\":255," +
+ "\"PropertySByte\":127," +
+ "\"PropertyInt32\":2147483647," +
+ "\"PropertyInt64\":\"\"," +
+ "\"PropertySingle\":1.79E20," +
+ "\"PropertyDouble\":-1.79E19," +
+ "\"PropertyDecimal\":\" \"," +
+ "\"PropertyBinary\":\"ASNFZ4mrze8=\"," +
+ "\"PropertyDate\":null," +
+ "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\"," +
+ "\"PropertyDuration\":\"PT6S\"," +
+ "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
+ "\"PropertyTimeOfDay\":\"03:26:05\"}";
+
+ final InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"))).getEntity();
+ }
+
+ @Test(expected = DeserializerException.class)
+ public void ieee754CompatibleNullAsString() throws Exception {
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON_IEEE754Compatible);
+ String entityString =
+ "{\"PropertyInt16\":32767," +
+ "\"PropertyString\":\"First Resource - positive values\"," +
+ "\"PropertyBoolean\":null," +
+ "\"PropertyByte\":255," +
+ "\"PropertySByte\":127," +
+ "\"PropertyInt32\":2147483647," +
+ "\"PropertyInt64\":\"null\"," +
+ "\"PropertySingle\":1.79E20," +
+ "\"PropertyDouble\":-1.79E19," +
+ "\"PropertyDecimal\":\"null\"," +
+ "\"PropertyBinary\":\"ASNFZ4mrze8=\"," +
+ "\"PropertyDate\":null," +
+ "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\"," +
+ "\"PropertyDuration\":\"PT6S\"," +
+ "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
+ "\"PropertyTimeOfDay\":\"03:26:05\"}";
+
+ final InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"))).getEntity();
+ }
+
+ @Test(expected = DeserializerException.class)
+ public void ieee754CompatibleAsNumber() throws Exception {
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON_IEEE754Compatible);
+ String entityString =
+ "{\"PropertyInt16\":32767," +
+ "\"PropertyString\":\"First Resource - positive values\"," +
+ "\"PropertyBoolean\":null," +
+ "\"PropertyByte\":255," +
+ "\"PropertySByte\":127," +
+ "\"PropertyInt32\":2147483647," +
+ "\"PropertyInt64\":123," +
+ "\"PropertySingle\":1.79E20," +
+ "\"PropertyDouble\":-1.79E19," +
+ "\"PropertyDecimal\":\"null\"," +
+ "\"PropertyBinary\":\"ASNFZ4mrze8=\"," +
+ "\"PropertyDate\":null," +
+ "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\"," +
+ "\"PropertyDuration\":\"PT6S\"," +
+ "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
+ "\"PropertyTimeOfDay\":\"03:26:05\"}";
+
+ final InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"))).getEntity();
+ }
+
+ @Test(expected = DeserializerException.class)
+ public void ieee754NotCompatibleAsString() throws Exception {
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
+ String entityString =
+ "{\"PropertyInt16\":32767," +
+ "\"PropertyString\":\"First Resource - positive values\"," +
+ "\"PropertyBoolean\":null," +
+ "\"PropertyByte\":255," +
+ "\"PropertySByte\":127," +
+ "\"PropertyInt32\":2147483647," +
+ "\"PropertyInt64\":\"123\"," +
+ "\"PropertySingle\":1.79E20," +
+ "\"PropertyDouble\":-1.79E19," +
+ "\"PropertyDecimal\":\"null\"," +
+ "\"PropertyBinary\":\"ASNFZ4mrze8=\"," +
+ "\"PropertyDate\":null," +
+ "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\"," +
+ "\"PropertyDuration\":\"PT6S\"," +
+ "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
+ "\"PropertyTimeOfDay\":\"03:26:05\"}";
+
+ final InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"))).getEntity();
+ }
+
private void checkPropertyJsonType(final String entityString) throws DeserializerException {
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(CONTENT_TYPE_JSON);
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
fail("Expected an exception but was not thrown: " + this.getClass().getName());
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
index c9cfde9..572e71a 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
@@ -36,7 +36,7 @@
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.edmx.EdmxReference;
import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
@@ -44,6 +44,8 @@
import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
import org.apache.olingo.server.api.serializer.ODataSerializer;
import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
+import org.apache.olingo.server.api.serializer.ReferenceCollectionSerializerOptions;
+import org.apache.olingo.server.api.serializer.ReferenceSerializerOptions;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.serializer.SerializerResult;
import org.apache.olingo.server.api.uri.UriHelper;
@@ -67,8 +69,11 @@
private static final ServiceMetadata metadata = new ServiceMetadataImpl(
new EdmTechProvider(), Collections.<EdmxReference> emptyList(), new MetadataETagSupport("W/\"metadataETag\""));
private static final EdmEntityContainer entityContainer = metadata.getEdm().getEntityContainer();
- private final DataProvider data = new DataProvider();
- private final ODataSerializer serializer = new ODataJsonSerializer(ODataFormat.JSON);
+ private final DataProvider data = new DataProvider(metadata.getEdm());
+ private final ODataSerializer serializer = new ODataJsonSerializer(ContentType.JSON);
+ private final ODataSerializer serializerNoMetadata = new ODataJsonSerializer(ContentType.JSON_NO_METADATA);
+ private final ODataSerializer serializerIEEECompatible =
+ new ODataJsonSerializer(ContentType.create(ContentType.JSON, ContentType.PARAMETER_IEEE754_COMPATIBLE, "true"));
private final UriHelper helper = new UriHelperImpl();
@Test
@@ -174,9 +179,9 @@
Assert.assertThat(resultString, CoreMatchers.startsWith("{"
+ "\"@odata.context\":\"$metadata#ESCompAllPrim\","
+ "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
- + "\"@odata.count\":3,\"value\":["
+ + "\"@odata.count\":4,\"value\":["
+ "{\"@odata.etag\":\"W/\\\"32767\\\"\","));
- Assert.assertThat(resultString, CoreMatchers.endsWith("\"}}],"
+ Assert.assertThat(resultString, CoreMatchers.endsWith("}}],"
+ "\"@odata.nextLink\":\"/next\"}"));
int count = 0;
@@ -184,7 +189,7 @@
while ((index = resultString.indexOf("PropertyInt16\":", ++index)) > 0) {
count++;
}
- Assert.assertEquals(6, count);
+ Assert.assertEquals(8, count);
}
@Test
@@ -302,9 +307,8 @@
public void entityTwoPrimNoMetadata() throws Exception {
final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
- InputStream result = new ODataJsonSerializer(ODataFormat.JSON_NO_METADATA)
- .entity(metadata, edmEntitySet.getEntityType(), entity, null).getContent();
- final String resultString = IOUtils.toString(result);
+ final String resultString = IOUtils.toString(serializerNoMetadata
+ .entity(metadata, edmEntitySet.getEntityType(), entity, null).getContent());
final String expectedResult = "{\"PropertyInt16\":32766,\"PropertyString\":\"Test String1\"}";
Assert.assertEquals(expectedResult, resultString);
}
@@ -313,11 +317,11 @@
public void entitySetTwoPrimNoMetadata() throws Exception {
final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
final EntityCollection entitySet = data.readAll(edmEntitySet);
- InputStream result = new ODataJsonSerializer(ODataFormat.JSON_NO_METADATA)
+ final String resultString = IOUtils.toString(serializerNoMetadata
.entityCollection(metadata, edmEntitySet.getEntityType(), entitySet,
EntityCollectionSerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet).build()).build()).getContent();
- final String resultString = IOUtils.toString(result);
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).build())
+ .build()).getContent());
final String expectedResult = "{\"value\":["
+ "{\"PropertyInt16\":32766,\"PropertyString\":\"Test String1\"},"
+ "{\"PropertyInt16\":-365,\"PropertyString\":\"Test String2\"},"
@@ -337,7 +341,9 @@
.build()).getContent());
final String expectedResult = "{\"@odata.context\":\"$metadata#ESMedia/$entity\","
+ "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
- + "\"@odata.mediaEtag\":\"W/\\\"1\\\"\",\"@odata.mediaContentType\":\"image/svg+xml\","
+ + "\"@odata.mediaEtag\":\"W/\\\"1\\\"\","
+ + "\"@odata.mediaContentType\":\"image/svg+xml\","
+ + "\"@odata.mediaEditLink\":\"ESMedia(1)/$value\","
+ "\"PropertyInt16\":1}";
Assert.assertEquals(expectedResult, resultString);
}
@@ -353,10 +359,14 @@
final String expectedResult = "{\"@odata.context\":\"$metadata#ESMedia\","
+ "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
+ "\"value\":["
- + "{\"@odata.mediaEtag\":\"W/\\\"1\\\"\",\"@odata.mediaContentType\":\"image/svg+xml\",\"PropertyInt16\":1},"
- + "{\"@odata.mediaEtag\":\"W/\\\"2\\\"\",\"@odata.mediaContentType\":\"image/svg+xml\",\"PropertyInt16\":2},"
- + "{\"@odata.mediaEtag\":\"W/\\\"3\\\"\",\"@odata.mediaContentType\":\"image/svg+xml\",\"PropertyInt16\":3},"
- + "{\"@odata.mediaEtag\":\"W/\\\"4\\\"\",\"@odata.mediaContentType\":\"image/svg+xml\",\"PropertyInt16\":4}]}";
+ + "{\"@odata.mediaEtag\":\"W/\\\"1\\\"\",\"@odata.mediaContentType\":\"image/svg+xml\","
+ + "\"@odata.mediaEditLink\":\"ESMedia(1)/$value\",\"PropertyInt16\":1},"
+ + "{\"@odata.mediaEtag\":\"W/\\\"2\\\"\",\"@odata.mediaContentType\":\"image/svg+xml\","
+ + "\"@odata.mediaEditLink\":\"ESMedia(2)/$value\",\"PropertyInt16\":2},"
+ + "{\"@odata.mediaEtag\":\"W/\\\"3\\\"\",\"@odata.mediaContentType\":\"image/svg+xml\","
+ + "\"@odata.mediaEditLink\":\"ESMedia(3)/$value\",\"PropertyInt16\":3},"
+ + "{\"@odata.mediaEtag\":\"W/\\\"4\\\"\",\"@odata.mediaContentType\":\"image/svg+xml\","
+ + "\"@odata.mediaEditLink\":\"ESMedia(4)/$value\",\"PropertyInt16\":4}]}";
Assert.assertEquals(expectedResult, resultString);
}
@@ -380,7 +390,8 @@
+ "\"CollPropertyBoolean\":[true,null,false],\"CollPropertyByte\":[50,null,249],"
+ "\"CollPropertySByte\":[-120,null,126],\"CollPropertyInt16\":[1000,null,30112],"
+ "\"CollPropertyInt32\":[23232323,null,10000001],\"CollPropertyInt64\":[929292929292,null,444444444444],"
- + "\"CollPropertySingle\":[1790,null,3210],\"CollPropertyDouble\":[-17900,null,3210],\"CollPropertyDecimal\":"
+ + "\"CollPropertySingle\":[1790.0,null,3210.0],\"CollPropertyDouble\":[-17900.0,null,3210.0],"
+ + "\"CollPropertyDecimal\":"
+ "[12,null,1234],\"CollPropertyBinary\":[\"q83v\",null,\"VGeJ\"],\"CollPropertyDate\":"
+ "[\"1958-12-03\",null,\"2013-06-25\"],\"CollPropertyDateTimeOffset\":[\"2015-08-12T03:08:34Z\",null,"
+ "\"1948-02-17T09:09:09Z\"],\"CollPropertyDuration\":[\"PT13S\",null,\"PT1H0S\"],\"CollPropertyGuid\":"
@@ -659,6 +670,16 @@
resultString);
}
+ @Test
+ public void primitivePropertyNoMetadata() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyString");
+ final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty(edmProperty.getName());
+ final String resultString = IOUtils.toString(serializerNoMetadata
+ .primitive(metadata, (EdmPrimitiveType) edmProperty.getType(), property, null).getContent());
+ Assert.assertEquals("{\"value\":\"First Resource - positive values\"}", resultString);
+ }
+
@Test(expected = SerializerException.class)
public void primitivePropertyNull() throws Exception {
final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
@@ -693,6 +714,18 @@
}
@Test
+ public void primitiveCollectionNoMetadata() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCollAllPrim");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("CollPropertyString");
+ final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty(edmProperty.getName());
+ final String resultString = IOUtils.toString(serializerNoMetadata
+ .primitiveCollection(metadata, (EdmPrimitiveType) edmProperty.getType(), property, null).getContent());
+ Assert.assertEquals("{\"value\":[\"Employee1@company.example\","
+ + "\"Employee2@company.example\",\"Employee3@company.example\"]}",
+ resultString);
+ }
+
+ @Test
public void complexProperty() throws Exception {
final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyComp");
@@ -713,6 +746,16 @@
}
@Test
+ public void complexPropertyNoMetadata() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyComp");
+ final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty("PropertyComp");
+ final String resultString = IOUtils.toString(serializerNoMetadata
+ .complex(metadata, (EdmComplexType) edmProperty.getType(), property, null).getContent());
+ Assert.assertEquals("{\"PropertyInt16\":111,\"PropertyString\":\"TEST A\"}", resultString);
+ }
+
+ @Test
public void complexCollectionProperty() throws Exception {
final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("CollPropertyComp");
@@ -735,21 +778,42 @@
}
@Test
+ public void complexCollectionPropertyNoMetadata() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("CollPropertyComp");
+ final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty(edmProperty.getName());
+ final String resultString = IOUtils.toString(serializerNoMetadata
+ .complexCollection(metadata, (EdmComplexType) edmProperty.getType(), property, null).getContent());
+ Assert.assertEquals("{\"value\":[{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
+ + "{\"PropertyInt16\":456,\"PropertyString\":\"TEST 2\"},"
+ + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}",
+ resultString);
+ }
+
+ @Test
public void entityReference() throws Exception {
final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
final SerializerResult serializerResult = serializer.reference(metadata, edmEntitySet, entity,
- ContextURL.with().suffix(Suffix.REFERENCE).build());
+ ReferenceSerializerOptions.with().contextURL(ContextURL.with().suffix(Suffix.REFERENCE).build()).build());
final String resultString = IOUtils.toString(serializerResult.getContent());
Assert.assertEquals("{\"@odata.context\":\"$metadata#$ref\","
- + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
+ "\"@odata.id\":\"ESAllPrim(32767)\"}",
resultString);
}
@Test
+ public void entityReferenceNoMetadata() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ final String resultString = IOUtils.toString(
+ serializerNoMetadata.reference(metadata, edmEntitySet, entity, null).getContent());
+ Assert.assertEquals("{\"@odata.id\":\"ESAllPrim(32767)\"}", resultString);
+ }
+
+ @Test
public void entityCollectionReference() throws Exception {
final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
final EntityCollection entityCollection = data.readAll(edmEntitySet);
@@ -757,12 +821,13 @@
final SerializerResult serializerResult = serializer.referenceCollection(metadata,
edmEntitySet,
entityCollection,
- ContextURL.with().asCollection().suffix(Suffix.REFERENCE).build());
+ ReferenceCollectionSerializerOptions.with()
+ .contextURL(ContextURL.with().asCollection().suffix(Suffix.REFERENCE).build())
+ .build());
final String resultString = IOUtils.toString(serializerResult.getContent());
Assert.assertEquals("{\"@odata.context\":\"$metadata#Collection($ref)\","
- + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
+ "\"value\":[{\"@odata.id\":\"ESAllPrim(32767)\"},"
+ "{\"@odata.id\":\"ESAllPrim(-32768)\"},"
+ "{\"@odata.id\":\"ESAllPrim(0)\"}]}",
@@ -775,14 +840,225 @@
final EntityCollection entityCollection = new EntityCollection();
final SerializerResult serializerResult = serializer.referenceCollection(metadata,
- edmEntitySet,
- entityCollection,
- ContextURL.with().asCollection().suffix(Suffix.REFERENCE).build());
+ edmEntitySet, entityCollection,
+ ReferenceCollectionSerializerOptions.with()
+ .contextURL(ContextURL.with().asCollection().suffix(Suffix.REFERENCE).build())
+ .build());
final String resultString = IOUtils.toString(serializerResult.getContent());
Assert.assertEquals("{\"@odata.context\":\"$metadata#Collection($ref)\","
- + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
+ "\"value\":[]}", resultString);
}
+
+ @Test
+ public void entityCollectionReferenceEmptyNoMetadata() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final EntityCollection entityCollection = new EntityCollection();
+ final String resultString = IOUtils.toString(serializerNoMetadata
+ .referenceCollection(metadata, edmEntitySet, entityCollection, null).getContent());
+ Assert.assertEquals("{\"value\":[]}", resultString);
+ }
+
+ @Test
+ public void entityIEE754Compatible() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ InputStream result = serializerIEEECompatible.entity(metadata, edmEntitySet.getEntityType(), entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
+ .build()).getContent();
+ final String resultString = IOUtils.toString(result);
+ final String expectedResult = "{"
+ + "\"@odata.context\":\"$metadata#ESAllPrim/$entity\","
+ + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
+ + "\"PropertyInt16\":32767,"
+ + "\"PropertyString\":\"First Resource - positive values\","
+ + "\"PropertyBoolean\":true,"
+ + "\"PropertyByte\":255,"
+ + "\"PropertySByte\":127,"
+ + "\"PropertyInt32\":2147483647,"
+ + "\"PropertyInt64\":\"" + Long.MAX_VALUE + "\","
+ + "\"PropertySingle\":1.79E20,"
+ + "\"PropertyDouble\":-1.79E19,"
+ + "\"PropertyDecimal\":\"34\","
+ + "\"PropertyBinary\":\"ASNFZ4mrze8=\","
+ + "\"PropertyDate\":\"2012-12-03\","
+ + "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\","
+ + "\"PropertyDuration\":\"PT6S\","
+ + "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\","
+ + "\"PropertyTimeOfDay\":\"03:26:05\""
+ + "}";
+ Assert.assertEquals(expectedResult, resultString);
+ }
+
+ @Test
+ public void entityCollAllPrimIEEE754Compatible() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCollAllPrim");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ InputStream result = serializerIEEECompatible.entity(metadata, edmEntitySet.getEntityType(), entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().serviceRoot(URI.create("http://host/service/"))
+ .entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
+ .build()).getContent();
+ final String resultString = IOUtils.toString(result);
+ final String expectedResult = "{"
+ + "\"@odata.context\":\"http://host/service/$metadata#ESCollAllPrim/$entity\","
+ + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
+ + "\"PropertyInt16\":1,"
+ + "\"CollPropertyString\":"
+ + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
+ + "\"CollPropertyBoolean\":[true,false,true],"
+ + "\"CollPropertyByte\":[50,200,249],"
+ + "\"CollPropertySByte\":[-120,120,126],"
+ + "\"CollPropertyInt16\":[1000,2000,30112],"
+ + "\"CollPropertyInt32\":[23232323,11223355,10000001],"
+ + "\"CollPropertyInt64\":[\"929292929292\",\"333333333333\",\"444444444444\"],"
+ + "\"CollPropertySingle\":[1790.0,26600.0,3210.0],"
+ + "\"CollPropertyDouble\":[-17900.0,-2.78E7,3210.0],"
+ + "\"CollPropertyDecimal\":[\"12\",\"-2\",\"1234\"],"
+ + "\"CollPropertyBinary\":[\"q83v\",\"ASNF\",\"VGeJ\"],"
+ + "\"CollPropertyDate\":[\"1958-12-03\",\"1999-08-05\",\"2013-06-25\"],"
+ + "\"CollPropertyDateTimeOffset\":[\"2015-08-12T03:08:34Z\",\"1970-03-28T12:11:10Z\","
+ + "\"1948-02-17T09:09:09Z\"],"
+ + "\"CollPropertyDuration\":[\"PT13S\",\"PT5H28M0S\",\"PT1H0S\"],"
+ + "\"CollPropertyGuid\":[\"ffffff67-89ab-cdef-0123-456789aaaaaa\",\"eeeeee67-89ab-cdef-0123-456789bbbbbb\","
+ + "\"cccccc67-89ab-cdef-0123-456789cccccc\"],"
+ + "\"CollPropertyTimeOfDay\":[\"04:14:13\",\"23:59:59\",\"01:12:33\"]"
+ + "}";
+ Assert.assertEquals(expectedResult, resultString);
+ }
+
+ @Test
+ public void primitiveCollectionPropertyIEEE754CompatibleInt64() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCollAllPrim");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("CollPropertyInt64");
+ final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty(edmProperty.getName());
+
+ final String resultString = IOUtils.toString(serializerIEEECompatible
+ .primitiveCollection(metadata, (EdmPrimitiveType) edmProperty.getType(), property,
+ PrimitiveSerializerOptions.with()
+ .contextURL(ContextURL.with()
+ .entitySet(edmEntitySet).keyPath("1").navOrPropertyPath(edmProperty.getName()).build())
+ .build()).getContent());
+ Assert.assertEquals("{"
+ + "\"@odata.context\":\"$metadata#ESCollAllPrim(1)/CollPropertyInt64\","
+ + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
+ + "\"value\":[\"929292929292\",\"333333333333\",\"444444444444\"]}",
+ resultString);
+ }
+
+ @Test
+ public void primitiveCollectionPropertyIEEE754CompatibleDecimal() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCollAllPrim");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("CollPropertyDecimal");
+ final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty(edmProperty.getName());
+
+ final String resultString = IOUtils.toString(serializerIEEECompatible
+ .primitiveCollection(metadata, (EdmPrimitiveType) edmProperty.getType(), property,
+ PrimitiveSerializerOptions.with()
+ .contextURL(ContextURL.with()
+ .entitySet(edmEntitySet).keyPath("1").navOrPropertyPath(edmProperty.getName()).build())
+ .build()).getContent());
+ Assert.assertEquals("{"
+ + "\"@odata.context\":\"$metadata#ESCollAllPrim(1)/CollPropertyDecimal\","
+ + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
+ + "\"value\":[\"12\",\"-2\",\"1234\"]}",
+ resultString);
+ }
+
+ @Test
+ public void primitivePropertyIEEE754CompatibleInt64() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyInt64");
+ final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty(edmProperty.getName());
+ final String resultString = IOUtils.toString(serializerIEEECompatible
+ .primitive(metadata, (EdmPrimitiveType) edmProperty.getType(), property,
+ PrimitiveSerializerOptions.with()
+ .contextURL(ContextURL.with()
+ .entitySet(edmEntitySet).keyPath("32767").navOrPropertyPath(edmProperty.getName()).build())
+ .build()).getContent());
+ Assert.assertEquals("{"
+ + "\"@odata.context\":\"$metadata#ESAllPrim(32767)/PropertyInt64\","
+ + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
+ + "\"value\":\"" + Long.MAX_VALUE + "\"}",
+ resultString);
+ }
+
+ @Test
+ public void primitivePropertyIEEE754CompatibleDecimal() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyDecimal");
+ final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty(edmProperty.getName());
+ final String resultString = IOUtils.toString(serializerIEEECompatible
+ .primitive(metadata, (EdmPrimitiveType) edmProperty.getType(), property,
+ PrimitiveSerializerOptions.with()
+ .contextURL(ContextURL.with()
+ .entitySet(edmEntitySet).keyPath("32767").navOrPropertyPath(edmProperty.getName()).build())
+ .build()).getContent());
+ Assert.assertEquals("{"
+ + "\"@odata.context\":\"$metadata#ESAllPrim(32767)/PropertyDecimal\","
+ + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
+ + "\"value\":\"34\"}",
+ resultString);
+ }
+
+ @Test
+ public void entitySetAllPrimIEEE754CompatibleCount() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ EntityCollection entitySet = data.readAll(edmEntitySet);
+ entitySet.setCount(entitySet.getEntities().size());
+ entitySet.setNext(URI.create("/next"));
+ CountOption countOption = Mockito.mock(CountOption.class);
+ Mockito.when(countOption.getValue()).thenReturn(true);
+ InputStream result = serializerIEEECompatible.entityCollection(metadata, edmEntitySet.getEntityType(), entitySet,
+ EntityCollectionSerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).build())
+ .count(countOption)
+ .build()).getContent();
+ final String resultString = IOUtils.toString(result);
+
+ Assert.assertThat(resultString, CoreMatchers.startsWith("{"
+ + "\"@odata.context\":\"$metadata#ESAllPrim\","
+ + "\"@odata.metadataEtag\":\"W/\\\"metadataETag\\\"\","
+ + "\"@odata.count\":\"3\",\"value\":["));
+ Assert.assertThat(resultString, CoreMatchers.endsWith("],"
+ + "\"@odata.nextLink\":\"/next\"}"));
+
+ int count = 0;
+ int index = -1;
+ while ((index = resultString.indexOf("PropertyInt16\":", ++index)) > 0) {
+ count++;
+ }
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void entitySetAllPrimReferenceIEEE754CompatibleCount() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ EntityCollection entitySet = data.readAll(edmEntitySet);
+ entitySet.setCount(entitySet.getEntities().size());
+ entitySet.setNext(URI.create("/next"));
+ CountOption countOption = Mockito.mock(CountOption.class);
+ Mockito.when(countOption.getValue()).thenReturn(true);
+ InputStream result = serializerIEEECompatible.referenceCollection(metadata, edmEntitySet, entitySet,
+ ReferenceCollectionSerializerOptions.with()
+ .contextURL(ContextURL.with().asCollection().suffix(Suffix.REFERENCE).build())
+ .count(countOption)
+ .build()).getContent();
+ final String resultString = IOUtils.toString(result);
+
+ Assert.assertThat(resultString, CoreMatchers.startsWith("{"
+ + "\"@odata.context\":\"$metadata#Collection($ref)\","
+ + "\"@odata.count\":\"3\",\"value\":["));
+ Assert.assertThat(resultString, CoreMatchers.endsWith("],"
+ + "\"@odata.nextLink\":\"/next\"}"));
+
+ int count = 0;
+ int index = -1;
+ while ((index = resultString.indexOf("ESAllPrim(", ++index)) > 0) {
+ count++;
+ }
+ Assert.assertEquals(3, count);
+ }
}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java
index ae9e314..066103c 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java
@@ -26,7 +26,7 @@
import java.util.Collections;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.edmx.EdmxReference;
@@ -47,7 +47,7 @@
OData server = OData.newInstance();
assertNotNull(server);
- ODataSerializer serializer = server.createSerializer(ODataFormat.JSON);
+ ODataSerializer serializer = server.createSerializer(ContentType.JSON);
assertNotNull(serializer);
InputStream result = serializer.serviceDocument(metadata, serviceRoot).getContent();
@@ -72,4 +72,15 @@
assertTrue(jsonString.contains("SIMedia"));
assertTrue(jsonString.contains("Singleton"));
}
+
+ @Test
+ public void serviceDocumentNoMetadata() throws Exception {
+ final String serviceRoot = "http://localhost:8080/odata.svc";
+ final String result = IOUtils.toString(
+ OData.newInstance().createSerializer(ContentType.JSON_NO_METADATA)
+ .serviceDocument(metadata, serviceRoot).getContent());
+ assertFalse(result.contains("odata.context"));
+ assertFalse(result.contains("odata.metadata"));
+ assertTrue(result.contains("ESAllPrim"));
+ }
}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLHelperTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLHelperTest.java
index 2416fbe..fe86896 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLHelperTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLHelperTest.java
@@ -95,6 +95,76 @@
ContextURLBuilder.create(contextURL).toASCIIString());
}
+
+ @Test
+ public void buildEntity() throws Exception {
+ final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoPrim");
+ final ContextURL contextURL = ContextURL.with().entitySet(entitySet).suffix(ContextURL.Suffix.ENTITY).build();
+ assertEquals("$metadata#ESTwoPrim/$entity", ContextURLBuilder.create(contextURL).toASCIIString());
+ }
+
+ // /odata.svc/ESAllPrim(32767)/NavPropertyETTwoPrimOne/NavPropertyETAllPrimOne/
+ // NavPropertyETTwoPrimOne/NavPropertyETAllPrimOne/NavPropertyETTwoPrimOne
+ // @odata.context: "../../../../../$metadata#ESTwoPrim/$entity"
+ @Test
+ public void buildRelativeFiveNavigation() throws Exception {
+ final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoPrim");
+ String odataPath = "ESAllPrim(32767)/NavPropertyETTwoPrimOne/NavPropertyETAllPrimOne/" +
+ "NavPropertyETTwoPrimOne/NavPropertyETAllPrimOne/NavPropertyETTwoPrimOne";
+ ContextURL contextURL = ContextURL.with()
+ .oDataPath("/" + odataPath)
+ .entitySet(entitySet).suffix(ContextURL.Suffix.ENTITY).build();
+ assertEquals("../../../../../$metadata#ESTwoPrim/$entity", ContextURLBuilder.create(contextURL).toASCIIString());
+
+ // removed leading '/'
+ contextURL = ContextURL.with()
+ .oDataPath(odataPath)
+ .entitySet(entitySet).suffix(ContextURL.Suffix.ENTITY).build();
+ assertEquals("../../../../../$metadata#ESTwoPrim/$entity", ContextURLBuilder.create(contextURL).toASCIIString());
+ }
+
+ // odata.svc/ESAllPrim(32767)/NavPropertyETTwoPrimOne
+ // @odata.context: "$metadata#ESTwoPrim/$entity",
+ @Test
+ public void buildRelativeNavigation() throws Exception {
+ final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoPrim");
+ final String oDataPath = "ESAllPrim(32767)/NavPropertyETTwoPrimOne";
+ ContextURL contextURL = ContextURL.with().oDataPath("/" + oDataPath)
+ .entitySet(entitySet).suffix(ContextURL.Suffix.ENTITY).build();
+ assertEquals("../$metadata#ESTwoPrim/$entity", ContextURLBuilder.create(contextURL).toASCIIString());
+
+ // without leading '/'
+ contextURL = ContextURL.with().oDataPath(oDataPath)
+ .entitySet(entitySet).suffix(ContextURL.Suffix.ENTITY).build();
+ assertEquals("../$metadata#ESTwoPrim/$entity", ContextURLBuilder.create(contextURL).toASCIIString());
+ }
+
+ // /odata.svc/ESAllPrim(32767)/NavPropertyETTwoPrimOne/NavPropertyETAllPrimOne
+ // @odata.context: "$metadata#ESAllPrim/$entity",
+ @Test
+ public void buildRelativeTwoNavigation() throws Exception {
+ final EdmEntitySet entitySet = entityContainer.getEntitySet("ESAllPrim");
+ String oDataPath = "ESAllPrim(32767)/NavPropertyETTwoPrimOne/NavPropertyETAllPrimOne";
+ ContextURL contextURL = ContextURL.with()
+ .oDataPath("/" + oDataPath)
+ .entitySet(entitySet).suffix(ContextURL.Suffix.ENTITY).build();
+ assertEquals("../../$metadata#ESAllPrim/$entity", ContextURLBuilder.create(contextURL).toASCIIString());
+
+ // without leading '/'
+ contextURL = ContextURL.with().oDataPath(oDataPath)
+ .entitySet(entitySet).suffix(ContextURL.Suffix.ENTITY).build();
+ assertEquals("../../$metadata#ESAllPrim/$entity", ContextURLBuilder.create(contextURL).toASCIIString());
+
+ // without unnecessary '///'
+ contextURL = ContextURL.with().oDataPath("///" + oDataPath)
+ .entitySet(entitySet).suffix(ContextURL.Suffix.ENTITY).build();
+ assertEquals("../../$metadata#ESAllPrim/$entity", ContextURLBuilder.create(contextURL).toASCIIString());
+ // without unnecessary '///' between
+ contextURL = ContextURL.with().oDataPath(oDataPath.replace("/", "///"))
+ .entitySet(entitySet).suffix(ContextURL.Suffix.ENTITY).build();
+ assertEquals("../../$metadata#ESAllPrim/$entity", ContextURLBuilder.create(contextURL).toASCIIString());
+ }
+
@Test
public void buildExpandAll() throws Exception {
final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoPrim");
@@ -117,6 +187,22 @@
}
@Test
+ public void buildExpandWithNavigationProperty() throws Exception {
+ final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoPrim");
+ final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(
+ ExpandSelectMock.mockExpandItem(entitySet, "NavPropertyETAllPrimOne", "PropertyString")));
+ final SelectItem selectItem1 = ExpandSelectMock.mockSelectItem(entitySet, "PropertyInt16");
+ final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
+ selectItem1));
+
+ final ContextURL contextURL = ContextURL.with().entitySet(entitySet)
+ .selectList(ContextURLHelper.buildSelectList(entitySet.getEntityType(), expand, select)).build();
+ assertEquals("$metadata#ESTwoPrim(PropertyInt16,NavPropertyETAllPrimOne/PropertyString)",
+ ContextURLBuilder.create(contextURL).toASCIIString());
+ }
+
+
+ @Test
public void buildExpandSelect() throws Exception {
final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoPrim");
final ExpandItem expandItem1 = ExpandSelectMock.mockExpandItem(entitySet, "NavPropertyETAllPrimOne");
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
index a8619b3..ef27e24 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
@@ -27,7 +27,7 @@
import java.util.List;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.edmx.EdmxReference;
@@ -48,7 +48,7 @@
new EdmTechProvider(references), references);
final String metadata = IOUtils.toString(
- odata.createSerializer(ODataFormat.XML).metadataDocument(serviceMetadata).getContent());
+ odata.createSerializer(ContentType.APPLICATION_XML).metadataDocument(serviceMetadata).getContent());
assertNotNull(metadata);
assertThat(metadata,
containsString("<edmx:Reference Uri=\"" + CORE_VOCABULARY + "\">"
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlDeserializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlDeserializerTest.java
new file mode 100644
index 0000000..ac24bad
--- /dev/null
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlDeserializerTest.java
@@ -0,0 +1,631 @@
+/*
+ * 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.io.ByteArrayInputStream;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Property;
+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.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
+import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
+import org.apache.olingo.commons.core.edm.EdmComplexTypeImpl;
+import org.apache.olingo.commons.core.edm.EdmPropertyImpl;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmBinary;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmByte;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDate;
+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.EdmGuid;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmInt16;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmInt32;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmInt64;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmSByte;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmSingle;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmTimeOfDay;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.deserializer.ODataDeserializer;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.apache.olingo.server.core.ServiceMetadataImpl;
+import org.apache.olingo.server.core.deserializer.xml.ODataXmlDeserializer;
+import org.apache.olingo.server.tecsvc.MetadataETagSupport;
+import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+public class ODataXmlDeserializerTest {
+
+ private static final ServiceMetadata metadata = new ServiceMetadataImpl(
+ new EdmTechProvider(), Collections.<EdmxReference> emptyList(), new MetadataETagSupport("WmetadataETag"));
+ private static final EdmEntityContainer entityContainer = metadata.getEdm().getEntityContainer();
+ private final ODataDeserializer serializer = new ODataXmlDeserializer();
+
+ @BeforeClass
+ public static void setup() {
+ XMLUnit.setIgnoreComments(true);
+ XMLUnit.setIgnoreAttributeOrder(true);
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLUnit.setNormalizeWhitespace(true);
+ XMLUnit.setCompareUnmatched(false);
+ }
+
+ protected Object edmInt16(String value) throws EdmPrimitiveTypeException {
+ return EdmInt16.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmInt16.getInstance().getDefaultType());
+ }
+ protected Object edmInt32(String value) throws EdmPrimitiveTypeException {
+ return EdmInt32.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmInt32.getInstance().getDefaultType());
+ }
+ protected Object edmInt64(String value) throws EdmPrimitiveTypeException {
+ return EdmInt64.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmInt64.getInstance().getDefaultType());
+ }
+ protected Object edmSingle(String value) throws EdmPrimitiveTypeException {
+ return EdmSingle.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmSingle.getInstance().getDefaultType());
+ }
+ protected Object edmDouble(String value) throws EdmPrimitiveTypeException {
+ return EdmDouble.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmDouble.getInstance().getDefaultType());
+ }
+ protected Object edmSByte(String value) throws EdmPrimitiveTypeException {
+ return EdmSByte.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmSByte.getInstance().getDefaultType());
+ }
+ protected Object edmByte(String value) throws EdmPrimitiveTypeException {
+ return EdmByte.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmByte.getInstance().getDefaultType());
+ }
+ protected Object edmDecimal(String value) throws EdmPrimitiveTypeException {
+ return EdmDecimal.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmDecimal.getInstance().getDefaultType());
+ }
+ protected Object edmBinary(String value) throws EdmPrimitiveTypeException {
+ return EdmBinary.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmBinary.getInstance().getDefaultType());
+ }
+ protected Object edmDate(String value) throws EdmPrimitiveTypeException {
+ return EdmDate.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmDate.getInstance().getDefaultType());
+ }
+ protected Object edmDateTimeOffset(String value) throws EdmPrimitiveTypeException {
+ return EdmDateTimeOffset.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmDateTimeOffset.getInstance().getDefaultType());
+ }
+ protected Object edmDuration(String value) throws EdmPrimitiveTypeException {
+ return EdmDuration.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmDuration.getInstance().getDefaultType());
+ }
+ protected Object edmGUID(String value) throws EdmPrimitiveTypeException {
+ return EdmGuid.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmGuid.getInstance().getDefaultType());
+ }
+ protected Object edmTimeOfDay(String value) throws EdmPrimitiveTypeException {
+ return EdmTimeOfDay.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmTimeOfDay.getInstance().getDefaultType());
+ }
+
+ @Test
+ public void entitySimple() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+
+ String payload = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\"> " +
+ " <atom:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
+ " href=\"id\" />\n" +
+ " <atom:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETTwoPrimOne\"\n" +
+ " href=\"id\" />\n" +
+ " <atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
+ " <atom:content type=\"application/xml\">\n" +
+ " <metadata:properties>\n" +
+ " <data:PropertyInt16>32767</data:PropertyInt16>\n" +
+ " <data:PropertyString>First Resource - positive values</data:PropertyString>\n" +
+ " <data:PropertyBoolean>true</data:PropertyBoolean>\n" +
+ " <data:PropertyByte>255</data:PropertyByte>\n" +
+ " <data:PropertySByte>127</data:PropertySByte>\n" +
+ " <data:PropertyInt32>2147483647</data:PropertyInt32>\n" +
+ " <data:PropertyInt64>9223372036854775807</data:PropertyInt64>\n" +
+ " <data:PropertySingle>1.79E20</data:PropertySingle>\n" +
+ " <data:PropertyDouble>-1.79E19</data:PropertyDouble>\n" +
+ " <data:PropertyDecimal>34</data:PropertyDecimal>\n" +
+ " <data:PropertyBinary>ASNFZ4mrze8=</data:PropertyBinary>\n" +
+ " <data:PropertyDate>2012-12-03</data:PropertyDate>\n" +
+ " <data:PropertyDateTimeOffset>2012-12-03T07:16:23Z</data:PropertyDateTimeOffset>\n" +
+ " <data:PropertyDuration>PT6S</data:PropertyDuration>\n" +
+ " <data:PropertyGuid>01234567-89ab-cdef-0123-456789abcdef</data:PropertyGuid>\n" +
+ " <data:PropertyTimeOfDay>03:26:05</data:PropertyTimeOfDay>\n" +
+ " </metadata:properties>\n" +
+ " </atom:content>\n" +
+ "</atom:entry>\n";
+
+ Entity result = serializer.entity(new ByteArrayInputStream(payload.getBytes()),
+ edmEntitySet.getEntityType()).getEntity();
+
+ Assert.assertEquals(16, result.getProperties().size());
+ Assert.assertEquals(2, result.getNavigationBindings().size());
+
+ Assert.assertEquals(edmInt16("32767"), result.getProperty("PropertyInt16").asPrimitive());
+ Assert.assertEquals("First Resource - positive values", result.getProperty("PropertyString").asPrimitive());
+ Assert.assertEquals(edmByte("255"), result.getProperty("PropertyByte").asPrimitive());
+ Assert.assertEquals(edmSByte("127"), result.getProperty("PropertySByte").asPrimitive());
+ Assert.assertEquals(edmInt32("2147483647"), result.getProperty("PropertyInt32").asPrimitive());
+ Assert.assertEquals(edmInt64("9223372036854775807"), result.getProperty("PropertyInt64").asPrimitive());
+ Assert.assertEquals(edmSingle("1.79E20"), result.getProperty("PropertySingle").asPrimitive());
+ Assert.assertEquals(edmDouble("-1.79E19"), result.getProperty("PropertyDouble").asPrimitive());
+ Assert.assertEquals(edmDecimal("34"), result.getProperty("PropertyDecimal").asPrimitive());
+// Assert.assertEquals(edmBinary("ASNFZ4mrze8="), result.getProperty("PropertyBinary").asPrimitive());
+ Assert.assertEquals(edmDate("2012-12-03"), result.getProperty("PropertyDate").asPrimitive());
+ Assert.assertEquals(edmDateTimeOffset("2012-12-03T07:16:23Z"), result.getProperty("PropertyDateTimeOffset")
+ .asPrimitive());
+ Assert.assertEquals(edmDuration("PT6S"), result.getProperty("PropertyDuration")
+ .asPrimitive());
+ Assert.assertEquals(edmGUID("01234567-89ab-cdef-0123-456789abcdef"), result.getProperty("PropertyGuid")
+ .asPrimitive());
+ Assert.assertEquals(edmTimeOfDay("03:26:05"), result.getProperty("PropertyTimeOfDay").asPrimitive());
+ }
+
+ @Test
+ public void entitySimpleWithTypes() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+
+ String payload = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\"> " +
+ " <atom:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
+ " href=\"id\" />\n" +
+ " <atom:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETTwoPrimOne\"\n" +
+ " href=\"id\" />\n" +
+ " <atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
+ " <atom:content type=\"application/xml\">\n" +
+ " <metadata:properties>\n" +
+ " <data:PropertyInt16 metadata:type=\"Int16\">32767</data:PropertyInt16>\n" +
+ " <data:PropertyString>First Resource - positive values</data:PropertyString>\n" +
+ " <data:PropertyBoolean metadata:type=\"Boolean\">true</data:PropertyBoolean>\n" +
+ " <data:PropertyByte metadata:type=\"Byte\">255</data:PropertyByte>\n" +
+ " <data:PropertySByte metadata:type=\"SByte\">127</data:PropertySByte>\n" +
+ " <data:PropertyInt32 metadata:type=\"Int32\">2147483647</data:PropertyInt32>\n" +
+ " <data:PropertyInt64 metadata:type=\"Int64\">9223372036854775807</data:PropertyInt64>\n" +
+ " <data:PropertySingle metadata:type=\"Single\">1.79E20</data:PropertySingle>\n" +
+ " <data:PropertyDouble metadata:type=\"Double\">-1.79E19</data:PropertyDouble>\n" +
+ " <data:PropertyDecimal metadata:type=\"Decimal\">34</data:PropertyDecimal>\n" +
+ " <data:PropertyBinary metadata:type=\"Binary\">ASNFZ4mrze8=</data:PropertyBinary>\n" +
+ " <data:PropertyDate metadata:type=\"Date\">2012-12-03</data:PropertyDate>\n" +
+ " <data:PropertyDateTimeOffset metadata:type=\"DateTimeOffset\">2012-12-03T07:16:23Z"
+ + "</data:PropertyDateTimeOffset>\n" +
+ " <data:PropertyDuration metadata:type=\"Duration\">PT6S</data:PropertyDuration>\n" +
+ " <data:PropertyGuid metadata:type=\"GUID\">01234567-89ab-cdef-0123-456789abcdef"
+ + "</data:PropertyGuid>\n" +
+ " <data:PropertyTimeOfDay metadata:type=\"TimeOfDay\">03:26:05</data:PropertyTimeOfDay>\n" +
+ " </metadata:properties>\n" +
+ " </atom:content>\n" +
+ "</atom:entry>\n";
+
+ Entity result = serializer.entity(new ByteArrayInputStream(payload.getBytes()),
+ edmEntitySet.getEntityType()).getEntity();
+
+ Assert.assertEquals(16, result.getProperties().size());
+ Assert.assertEquals(2, result.getNavigationBindings().size());
+
+ Assert.assertEquals(edmInt16("32767"), result.getProperty("PropertyInt16").asPrimitive());
+ Assert.assertEquals("First Resource - positive values", result.getProperty("PropertyString").asPrimitive());
+ Assert.assertEquals(edmByte("255"), result.getProperty("PropertyByte").asPrimitive());
+ Assert.assertEquals(edmSByte("127"), result.getProperty("PropertySByte").asPrimitive());
+ Assert.assertEquals(edmInt32("2147483647"), result.getProperty("PropertyInt32").asPrimitive());
+ Assert.assertEquals(edmInt64("9223372036854775807"), result.getProperty("PropertyInt64").asPrimitive());
+ Assert.assertEquals(edmSingle("1.79E20"), result.getProperty("PropertySingle").asPrimitive());
+ Assert.assertEquals(edmDouble("-1.79E19"), result.getProperty("PropertyDouble").asPrimitive());
+ Assert.assertEquals(edmDecimal("34"), result.getProperty("PropertyDecimal").asPrimitive());
+// Assert.assertEquals(edmBinary("ASNFZ4mrze8="), result.getProperty("PropertyBinary").asPrimitive());
+ Assert.assertEquals(edmDate("2012-12-03"), result.getProperty("PropertyDate").asPrimitive());
+ Assert.assertEquals(edmDateTimeOffset("2012-12-03T07:16:23Z"), result.getProperty("PropertyDateTimeOffset")
+ .asPrimitive());
+ Assert.assertEquals(edmDuration("PT6S"), result.getProperty("PropertyDuration")
+ .asPrimitive());
+ Assert.assertEquals(edmGUID("01234567-89ab-cdef-0123-456789abcdef"), result.getProperty("PropertyGuid")
+ .asPrimitive());
+ Assert.assertEquals(edmTimeOfDay("03:26:05"), result.getProperty("PropertyTimeOfDay").asPrimitive());
+ }
+
+ @Test
+ public void entityCompAllPrim() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompAllPrim");
+
+ String payload = "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
+ + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "metadata:etag=\"W/"32767"\">"
+ + "<atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" "
+ + "term=\"#olingo.odata.test1.ETCompAllPrim\"/>"
+ + "<atom:content type=\"application/xml\">"
+ + "<metadata:properties>"
+ + "<data:PropertyInt16>32767</data:PropertyInt16>"
+ + "<data:PropertyComp metadata:type=\"#olingo.odata.test1.CTAllPrim\">"
+ + "<data:PropertyString>First Resource - first</data:PropertyString>"
+ + "<data:PropertyBinary>ASNFZ4mrze8=</data:PropertyBinary>"
+ + "<data:PropertyBoolean>true</data:PropertyBoolean>"
+ + "<data:PropertyByte>255</data:PropertyByte>"
+ + "<data:PropertyDate>2012-10-03</data:PropertyDate>"
+ + "<data:PropertyDateTimeOffset>2012-10-03T07:16:23.1234567Z</data:PropertyDateTimeOffset>"
+ + "<data:PropertyDecimal>34.27</data:PropertyDecimal>"
+ + "<data:PropertySingle>1.79E20</data:PropertySingle>"
+ + "<data:PropertyDouble>-1.79E19</data:PropertyDouble>"
+ + "<data:PropertyDuration>PT6S</data:PropertyDuration>"
+ + "<data:PropertyGuid>01234567-89ab-cdef-0123-456789abcdef</data:PropertyGuid>"
+ + "<data:PropertyInt16>32767</data:PropertyInt16>"
+ + "<data:PropertyInt32>2147483647</data:PropertyInt32>"
+ + "<data:PropertyInt64>9223372036854775807</data:PropertyInt64>"
+ + "<data:PropertySByte>127</data:PropertySByte>"
+ + "<data:PropertyTimeOfDay>01:00:01</data:PropertyTimeOfDay>"
+ + "</data:PropertyComp>"
+ + "</metadata:properties>"
+ + "</atom:content>"
+ + "</atom:entry>";
+
+ Entity result = serializer.entity(new ByteArrayInputStream(payload.getBytes()),
+ edmEntitySet.getEntityType()).getEntity();
+
+ Assert.assertEquals("olingo.odata.test1.ETCompAllPrim",result.getType());
+
+ Assert.assertEquals(2, result.getProperties().size());
+ Assert.assertEquals(0, result.getNavigationLinks().size());
+
+ Assert.assertEquals(edmInt16("32767"), result.getProperty("PropertyInt16").asPrimitive());
+
+ Assert.assertNotNull(result.getProperty("PropertyComp"));
+ Property comp = result.getProperty("PropertyComp");
+ Assert.assertEquals("olingo.odata.test1.CTAllPrim", comp.getType());
+ ComplexValue cv = (ComplexValue)comp.getValue();
+
+ Assert.assertEquals(16, cv.getValue().size());
+
+ Assert.assertEquals(edmInt16("32767"), getCVProperty(cv, "PropertyInt16").asPrimitive());
+ Assert.assertEquals("First Resource - first", getCVProperty(cv, "PropertyString").asPrimitive());
+ Assert.assertEquals(edmByte("255"), getCVProperty(cv, "PropertyByte").asPrimitive());
+ Assert.assertEquals(edmSByte("127"), getCVProperty(cv, "PropertySByte").asPrimitive());
+ Assert.assertEquals(edmInt32("2147483647"), getCVProperty(cv, "PropertyInt32").asPrimitive());
+ Assert.assertEquals(edmInt64("9223372036854775807"), getCVProperty(cv, "PropertyInt64").asPrimitive());
+ }
+
+ private Property getCVProperty(ComplexValue cv, String name) {
+ for (Property p:cv.getValue()) {
+ if (p.getName().equals(name)) {
+ return p;
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void entityMixPrimCollComp() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
+ final String payload = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" \n" +
+ " metadata:metadata-etag=\"WmetadataETag\">\n" +
+ " <atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETMixPrimCollComp\" />\n" +
+ " <atom:content type=\"application/xml\">\n" +
+ " <metadata:properties>\n" +
+ " <data:PropertyInt16>32767</data:PropertyInt16>\n" +
+ " <data:CollPropertyString type=\"#Collection(String)\">\n" +
+ " <metadata:element>Employee1@company.example</metadata:element>\n" +
+ " <metadata:element>Employee2@company.example</metadata:element>\n" +
+ " <metadata:element>Employee3@company.example</metadata:element>\n" +
+ " </data:CollPropertyString>\n" +
+ " <data:PropertyComp metadata:type=\"#olingo.odata.test1.CTTwoPrim\">\n" +
+ " <data:PropertyInt16>111</data:PropertyInt16>\n" +
+ " <data:PropertyString>TEST A</data:PropertyString>\n" +
+ " </data:PropertyComp>\n" +
+ " <data:CollPropertyComp metadata:type=\"#Collection(olingo.odata.test1.CTTwoPrim)\">\n" +
+ " <metadata:element>\n" +
+ " <data:PropertyInt16>123</data:PropertyInt16>\n" +
+ " <data:PropertyString>TEST 1</data:PropertyString>\n" +
+ " </metadata:element>\n" +
+ " <metadata:element>\n" +
+ " <data:PropertyInt16>456</data:PropertyInt16>\n" +
+ " <data:PropertyString>TEST 2</data:PropertyString>\n" +
+ " </metadata:element>\n" +
+ " <metadata:element>\n" +
+ " <data:PropertyInt16>789</data:PropertyInt16>\n" +
+ " <data:PropertyString>TEST 3</data:PropertyString>\n" +
+ " </metadata:element>\n" +
+ " </data:CollPropertyComp>\n" +
+ " </metadata:properties>\n" +
+ " </atom:content>\n" +
+ "</atom:entry>\n";
+
+ Entity result = serializer.entity(new ByteArrayInputStream(payload.getBytes()),
+ edmEntitySet.getEntityType()).getEntity();
+
+ Assert.assertEquals(4, result.getProperties().size());
+ Assert.assertEquals(0, result.getNavigationLinks().size());
+
+ Assert.assertEquals(Arrays.asList("Employee1@company.example", "Employee2@company.example",
+ "Employee3@company.example"), result.getProperty("CollPropertyString").getValue());
+
+ Property comp = result.getProperty("PropertyComp");
+ Assert.assertEquals("olingo.odata.test1.CTTwoPrim", comp.getType());
+ ComplexValue cv = (ComplexValue)comp.getValue();
+
+ Assert.assertEquals(2, cv.getValue().size());
+ Assert.assertEquals(edmInt16("111"), getCVProperty(cv, "PropertyInt16").asPrimitive());
+ Assert.assertEquals("TEST A", getCVProperty(cv, "PropertyString").asPrimitive());
+
+ comp = result.getProperty("CollPropertyComp");
+ Assert.assertEquals("Collection(olingo.odata.test1.CTTwoPrim)", comp.getType());
+ List<ComplexValue> properties = (List<ComplexValue>)comp.getValue();
+
+ Assert.assertEquals(3, properties.size());
+
+ Assert.assertEquals(edmInt16("123"), getCVProperty(properties.get(0), "PropertyInt16")
+ .asPrimitive());
+ Assert.assertEquals("TEST 1", getCVProperty(properties.get(0), "PropertyString")
+ .asPrimitive());
+
+ Assert.assertEquals(edmInt16("789"), getCVProperty(properties.get(2), "PropertyInt16")
+ .asPrimitive());
+ Assert.assertEquals("TEST 3", getCVProperty(properties.get(2), "PropertyString")
+ .asPrimitive());
+ }
+
+ @Test
+ public void entityWithNavigation() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
+
+ final String payload = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\">" +
+ " <atom:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETAllPrimOne\"\n" +
+ " href=\"id\">\n" +
+ " <metadata:inline>\n" +
+ " <atom:entry>\n" +
+ " <atom:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
+ " href=\"id\" />\n" +
+ " <atom:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETTwoPrimOne\"\n" +
+ " href=\"id\" />\n" +
+ " <atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
+ " <atom:content type=\"application/xml\">\n" +
+ " <metadata:properties>\n" +
+ " <data:PropertyDate>2012-12-03</data:PropertyDate>\n" +
+ " </metadata:properties>\n" +
+ " </atom:content>\n" +
+ " </atom:entry>\n" +
+ " </metadata:inline>\n" +
+ " </atom:link>\n" +
+ " <atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETTwoPrim\" />\n" +
+ " <atom:content type=\"application/xml\">\n" +
+ " <metadata:properties>\n" +
+ " <data:PropertyInt16>32767</data:PropertyInt16>\n" +
+ " <data:PropertyString>Test String4</data:PropertyString>\n" +
+ " </metadata:properties>\n" +
+ " </atom:content>\n" +
+ "</atom:entry>\n" +
+ "";
+
+ Entity result = serializer.entity(new ByteArrayInputStream(payload.getBytes()),
+ edmEntitySet.getEntityType()).getEntity();
+
+ Assert.assertEquals(2, result.getProperties().size());
+ Assert.assertEquals(1, result.getNavigationLinks().size());
+
+ Assert.assertEquals(edmInt16("32767"), result.getProperty("PropertyInt16").asPrimitive());
+ Assert.assertEquals("Test String4", result.getProperty("PropertyString").asPrimitive());
+
+ Assert.assertEquals(1, result.getNavigationLinks().size());
+ Link navLink = result.getNavigationLinks().get(0);
+ Assert.assertEquals("http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimOne", navLink.getRel());
+ Assert.assertEquals("id", navLink.getBindingLink());
+ Assert.assertEquals("NavPropertyETAllPrimOne", navLink.getTitle());
+
+ Entity inline = navLink.getInlineEntity();
+ Assert.assertEquals(1, inline.getProperties().size());
+ Assert.assertEquals(2, inline.getNavigationBindings().size());
+ Assert.assertEquals(edmDate("2012-12-03"), inline.getProperty("PropertyDate").asPrimitive());
+ }
+
+ @Test
+ public void primitiveProperty() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyInt16");
+
+ String payload = "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<metadata:value xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">"
+ + "234</metadata:value>";
+
+ Property result = serializer.property(new ByteArrayInputStream(payload.getBytes()), edmProperty).getProperty();
+ Assert.assertEquals(edmInt16("234"), result.getValue());
+ }
+
+ @Test
+ public void primitivePropertyNull() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyString");
+ String payload = "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<metadata:value xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
+ + "metadata:null=\"true\"/>";
+
+ Property result = serializer.property(new ByteArrayInputStream(payload.getBytes()), edmProperty).getProperty();
+ Assert.assertNull(result.getValue());
+ }
+
+ @Test
+ public void primitiveCollectionProperty() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCollAllPrim");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("CollPropertyString");
+ String payload = "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<metadata:value xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"> "
+ + "<metadata:element>Employee1@company.example</metadata:element>"
+ + "<metadata:element>Employee2@company.example</metadata:element>"
+ + "<metadata:element>Employee3@company.example</metadata:element>"
+ + "</metadata:value>";
+ Property result = serializer.property(new ByteArrayInputStream(payload.getBytes()), edmProperty).getProperty();
+ Assert.assertEquals(Arrays.asList("Employee1@company.example", "Employee2@company.example",
+ "Employee3@company.example"), result.getValue());
+
+ }
+
+ @Test
+ public void complexProperty() throws Exception {
+ Edm edm = Mockito.mock(Edm.class);
+
+ CsdlProperty street = new CsdlProperty().setName("Street")
+ .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+ CsdlProperty city = new CsdlProperty().setName("City")
+ .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+ CsdlProperty region = new CsdlProperty().setName("Region")
+ .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+ CsdlProperty postalcode = new CsdlProperty().setName("PostalCode")
+ .setType(EdmPrimitiveTypeKind.Int64.getFullQualifiedName());
+
+ CsdlComplexType ct = new CsdlComplexType()
+ .setName("Model.Address")
+ .setProperties(Arrays.asList(street, city, region, postalcode));
+ EdmComplexTypeImpl complexType = new EdmComplexTypeImpl(edm, new FullQualifiedName("Model.Address"), ct);
+
+ Mockito.stub(edm.getComplexType(new FullQualifiedName("Model.Address"))).toReturn(complexType);
+
+ CsdlProperty prop = new CsdlProperty();
+ prop.setName("ShipTo");
+ prop.setType(new FullQualifiedName("Model.Address"));
+ EdmPropertyImpl edmProperty = new EdmPropertyImpl(edm, null, prop);
+
+ String payload = "<data:ShipTo xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" " +
+ " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " metadata:type=\"#Model.Address\">\n" +
+ " <data:Street>Obere Str. 57</data:Street>\n" +
+ " <data:City>Berlin</data:City>\n" +
+ " <data:Region metadata:null=\"true\"/>\n" +
+ " <data:PostalCode>12209</data:PostalCode>\n" +
+ "</data:ShipTo>";
+
+ Property result = serializer.property(new ByteArrayInputStream(payload.getBytes()), edmProperty).getProperty();
+
+ Assert.assertEquals("ShipTo", result.getName());
+ Assert.assertTrue(result.getValue() instanceof ComplexValue);
+ ComplexValue cv = (ComplexValue)result.getValue();
+ Assert.assertEquals("Model.Address", result.getType());
+ Assert.assertEquals("Berlin", getCVProperty(cv, "City").asPrimitive());
+ Assert.assertEquals("Obere Str. 57", getCVProperty(cv, "Street").asPrimitive());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void complexCollectionProperty() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("CollPropertyComp");
+ String payload = "<metadata:value xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "metadata:type=\"#Collection(olingo.odata.test1.CTTwoPrim)\">\n"+
+ " <metadata:element>\n" +
+ " <data:PropertyInt16>123</data:PropertyInt16>\n" +
+ " <data:PropertyString>TEST 1</data:PropertyString>\n" +
+ " </metadata:element>\n" +
+ " <metadata:element>\n" +
+ " <data:PropertyInt16>456</data:PropertyInt16>\n" +
+ " <data:PropertyString>TEST 2</data:PropertyString>\n" +
+ " </metadata:element>\n" +
+ " <metadata:element>\n" +
+ " <data:PropertyInt16>789</data:PropertyInt16>\n" +
+ " <data:PropertyString>TEST 3</data:PropertyString>\n" +
+ " </metadata:element>\n" +
+ "</metadata:value>";
+ Property result = serializer.property(new ByteArrayInputStream(payload.getBytes()), edmProperty).getProperty();
+
+ List<ComplexValue> complex = (List<ComplexValue>)result.getValue();
+
+ Assert.assertEquals(3, complex.size());
+ Assert.assertEquals("Collection(olingo.odata.test1.CTTwoPrim)", result.getType());
+ Assert.assertEquals(edmInt16("123"), getCVProperty(complex.get(0), "PropertyInt16").asPrimitive());
+ Assert.assertEquals("TEST 1", getCVProperty(complex.get(0), "PropertyString").asPrimitive());
+ Assert.assertEquals(edmInt16("789"), getCVProperty(complex.get(2), "PropertyInt16").asPrimitive());
+ Assert.assertEquals("TEST 3", getCVProperty(complex.get(2), "PropertyString").asPrimitive());
+ }
+
+ @Test
+ public void entityReference() throws Exception {
+ String payload = "<metadata:ref xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " metadata:context=\"http://host/service/$metadata#$ref\"\n" +
+ " xmlns=\"http://www.w3.org/2005/Atom\" "+
+ " id=\"http://host/service/Orders(10643)\" />";
+
+ List<URI> result = serializer.entityReferences(new ByteArrayInputStream(payload.getBytes()))
+ .getEntityReferences();
+ Assert.assertEquals(1, result.size());
+ Assert.assertEquals("http://host/service/Orders(10643)", result.get(0).toASCIIString());
+ }
+
+ @Test
+ public void entityReferences() throws Exception {
+ String payload = "<feed xmlns=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " metadata:context=\"http://host/service/$metadata#Collection($ref)\" >\n" +
+ " <metadata:ref id=\"http://host/service/Orders(10643)\" />\n" +
+ " <metadata:ref id=\"http://host/service/Orders(10759)\" />\n" +
+ "</feed>";
+
+ List<URI> result = serializer.entityReferences(new ByteArrayInputStream(payload.getBytes()))
+ .getEntityReferences();
+ Assert.assertEquals(2, result.size());
+ Assert.assertEquals("http://host/service/Orders(10643)", result.get(0).toASCIIString());
+ Assert.assertEquals("http://host/service/Orders(10759)", result.get(1).toASCIIString());
+ }
+}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java
new file mode 100644
index 0000000..32ca425
--- /dev/null
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java
@@ -0,0 +1,1872 @@
+/*
+ * 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.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.ContextURL.Suffix;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ValueType;
+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.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
+import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
+import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
+import org.apache.olingo.server.api.serializer.ReferenceCollectionSerializerOptions;
+import org.apache.olingo.server.api.serializer.ReferenceSerializerOptions;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriHelper;
+import org.apache.olingo.server.api.uri.queryoption.CountOption;
+import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
+import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
+import org.apache.olingo.server.api.uri.queryoption.SelectItem;
+import org.apache.olingo.server.api.uri.queryoption.SelectOption;
+import org.apache.olingo.server.core.ServiceMetadataImpl;
+import org.apache.olingo.server.core.serializer.ExpandSelectMock;
+import org.apache.olingo.server.core.serializer.json.ODataJsonSerializer;
+import org.apache.olingo.server.core.uri.UriHelperImpl;
+import org.apache.olingo.server.tecsvc.MetadataETagSupport;
+import org.apache.olingo.server.tecsvc.data.DataProvider;
+import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.Difference;
+import org.custommonkey.xmlunit.DifferenceListener;
+import org.custommonkey.xmlunit.XMLAssert;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.hamcrest.CoreMatchers;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+public class ODataXmlSerializerTest {
+ private static final ServiceMetadata metadata = new ServiceMetadataImpl(
+ new EdmTechProvider(), Collections.<EdmxReference> emptyList(), new MetadataETagSupport("WmetadataETag"));
+ private static final EdmEntityContainer entityContainer = metadata.getEdm().getEntityContainer();
+ private static final DifferenceListener DIFFERENCE_LISTENER = new CustomDifferenceListener();
+ private static final int MAX_ALLOWED_UPDATED_DIFFERENCE = 2000;
+ private static final String UPDATED_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
+
+ private final DataProvider data = new DataProvider(metadata.getEdm());
+ private final ODataSerializer serializer = new ODataXmlSerializer();
+ private final UriHelper helper = new UriHelperImpl();
+
+ @BeforeClass
+ public static void setup() {
+ XMLUnit.setIgnoreComments(true);
+ XMLUnit.setIgnoreAttributeOrder(true);
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLUnit.setNormalizeWhitespace(true);
+ XMLUnit.setCompareUnmatched(false);
+ }
+
+ @Test
+ public void entitySimple() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream result = serializer.entity(metadata, edmEntitySet.getEntityType(), entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
+ .build()).getContent();
+ final String resultString = IOUtils.toString(result);
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:entry xmlns:a=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "m:context=\"$metadata#ESAllPrim/$entity\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>ESAllPrim(32767)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESAllPrim(32767)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETTwoPrimOne\"\n" +
+ " href=\"ESTwoPrim(32767)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
+ " href=\"ESAllPrim(32767)/NavPropertyETTwoPrimMany\" />\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">32767</d:PropertyInt16>\n" +
+ " <d:PropertyString>First Resource - positive values</d:PropertyString>\n" +
+ " <d:PropertyBoolean m:type=\"Boolean\">true</d:PropertyBoolean>\n" +
+ " <d:PropertyByte m:type=\"Byte\">255</d:PropertyByte>\n" +
+ " <d:PropertySByte m:type=\"SByte\">127</d:PropertySByte>\n" +
+ " <d:PropertyInt32 m:type=\"Int32\">2147483647</d:PropertyInt32>\n" +
+ " <d:PropertyInt64 m:type=\"Int64\">9223372036854775807\n" +
+ " </d:PropertyInt64>\n" +
+ " <d:PropertySingle m:type=\"Single\">1.79E20</d:PropertySingle>\n" +
+ " <d:PropertyDouble m:type=\"Double\">-1.79E19</d:PropertyDouble>\n" +
+ " <d:PropertyDecimal m:type=\"Decimal\">34</d:PropertyDecimal>\n" +
+ " <d:PropertyBinary m:type=\"Binary\">ASNFZ4mrze8=\n" +
+ " </d:PropertyBinary>\n" +
+ " <d:PropertyDate m:type=\"Date\">2012-12-03</d:PropertyDate>\n" +
+ " <d:PropertyDateTimeOffset m:type=\"DateTimeOffset\">2012-12-03T07:16:23Z\n" +
+ " </d:PropertyDateTimeOffset>\n" +
+ " <d:PropertyDuration m:type=\"Duration\">PT6S\n" +
+ " </d:PropertyDuration>\n" +
+ " <d:PropertyGuid m:type=\"Guid\">01234567-89ab-cdef-0123-456789abcdef\n" +
+ " </d:PropertyGuid>\n" +
+ " <d:PropertyTimeOfDay m:type=\"TimeOfDay\">03:26:05\n" +
+ " </d:PropertyTimeOfDay>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ "</a:entry>";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void entityAllPrimAllNull() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ entity.getProperties().retainAll(Arrays.asList(entity.getProperties().get(0)));
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream content = serializer.entity(metadata, edmEntitySet.getEntityType(),
+ entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
+ .build()).getContent();
+ final String resultString = IOUtils.toString(content);
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:entry xmlns:a=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" " +
+ "m:context=\"$metadata#ESAllPrim/$entity\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>ESAllPrim(32767)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESAllPrim(32767)\"/>\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETTwoPrimOne\"\n" +
+ " href=\"ESTwoPrim(32767)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
+ " href=\"ESAllPrim(32767)/NavPropertyETTwoPrimMany\" />\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">32767</d:PropertyInt16>\n" +
+ " <d:PropertyString m:null=\"true\" />\n" +
+ " <d:PropertyBoolean m:null=\"true\" />\n" +
+ " <d:PropertyByte m:null=\"true\" />\n" +
+ " <d:PropertySByte m:null=\"true\" />\n" +
+ " <d:PropertyInt32 m:null=\"true\" />\n" +
+ " <d:PropertyInt64 m:null=\"true\" />\n" +
+ " <d:PropertySingle m:null=\"true\" />\n" +
+ " <d:PropertyDouble m:null=\"true\" />\n" +
+ " <d:PropertyDecimal m:null=\"true\" />\n" +
+ " <d:PropertyBinary m:null=\"true\" />\n" +
+ " <d:PropertyDate m:null=\"true\" />\n" +
+ " <d:PropertyDateTimeOffset\n" +
+ " m:null=\"true\" />\n" +
+ " <d:PropertyDuration m:null=\"true\" />\n" +
+ " <d:PropertyGuid m:null=\"true\" />\n" +
+ " <d:PropertyTimeOfDay m:null=\"true\" />\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ "</a:entry>\n" +
+ "";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test(expected = SerializerException.class)
+ public void entityAllPrimKeyNull() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ entity.getProperties().clear();
+ serializer.entity(metadata, edmEntitySet.getEntityType(), entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
+ .build());
+ }
+
+ @Test
+ public void entityWrongData() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ entity.getProperties().get(0).setValue(ValueType.PRIMITIVE, false);
+ try {
+ serializer.entity(metadata, edmEntitySet.getEntityType(), entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
+ .build());
+ Assert.fail("Expected exception not thrown!");
+ } catch (final SerializerException e) {
+ Assert.assertEquals(SerializerException.MessageKeys.WRONG_PROPERTY_VALUE, e.getMessageKey());
+ final String message = e.getLocalizedMessage();
+ Assert.assertThat(message, CoreMatchers.containsString("PropertyInt16"));
+ Assert.assertThat(message, CoreMatchers.containsString("false"));
+ }
+ }
+
+ @Test
+ public void entitySetCompAllPrim() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompAllPrim");
+ EntityCollection entitySet = data.readAll(edmEntitySet);
+ entitySet.setCount(entitySet.getEntities().size());
+ entitySet.setNext(URI.create("/next"));
+ CountOption countOption = Mockito.mock(CountOption.class);
+ Mockito.when(countOption.getValue()).thenReturn(true);
+ InputStream result = serializer.entityCollection(metadata, edmEntitySet.getEntityType(), entitySet,
+ EntityCollectionSerializerOptions.with()
+ .contextURL(ContextURL.with().serviceRoot(new URI("http://host:port"))
+ .entitySet(edmEntitySet).build())
+ .setId("http://host/svc/ESCompAllPrim")
+ .count(countOption)
+ .build()).getContent();
+ final String resultString = IOUtils.toString(result);
+ String prefix = "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<a:feed xmlns:a=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\" "
+ + "xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "m:context=\"http://host:port$metadata#ESCompAllPrim\" "
+ + "m:metadata-etag=\"WmetadataETag\">"
+ + "<a:id>http://host/svc/ESCompAllPrim</a:id>"
+ + "<m:count>4</m:count>"
+ + "<a:link rel=\"next\" href=\"/next\"/>"
+ + "<a:entry m:etag=\"W/"32767"\">"
+ + "<a:id>ESCompAllPrim(32767)</a:id><a:title/><a:summary/>";
+ Assert.assertTrue(resultString.startsWith(prefix));
+ }
+
+ @Test
+ public void entityCollAllPrim() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCollAllPrim");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream result = serializer.entity(metadata, edmEntitySet.getEntityType(), entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().serviceRoot(URI.create("http://host/service/"))
+ .entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
+ .build()).getContent();
+ final String resultString = IOUtils.toString(result);
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:entry xmlns:a=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "m:context=\"http://host/service/$metadata#ESCollAllPrim/$entity\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>ESCollAllPrim(1)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ "<a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESCollAllPrim(1)\" />\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETCollAllPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">1</d:PropertyInt16>\n" +
+ " <d:CollPropertyString m:type=\"#Collection(String)\">\n" +
+ " <m:element>Employee1@company.example</m:element>\n" +
+ " <m:element>Employee2@company.example</m:element>\n" +
+ " <m:element>Employee3@company.example</m:element>\n" +
+ " </d:CollPropertyString>\n" +
+ " <d:CollPropertyBoolean m:type=\"#Collection(Boolean)\">\n" +
+ " <m:element>true</m:element>\n" +
+ " <m:element>false</m:element>\n" +
+ " <m:element>true</m:element>\n" +
+ " </d:CollPropertyBoolean>\n" +
+ " <d:CollPropertyByte m:type=\"#Collection(Byte)\">\n" +
+ " <m:element>50</m:element>\n" +
+ " <m:element>200</m:element>\n" +
+ " <m:element>249</m:element>\n" +
+ " </d:CollPropertyByte>\n" +
+ " <d:CollPropertySByte m:type=\"#Collection(SByte)\">\n" +
+ " <m:element>-120</m:element>\n" +
+ " <m:element>120</m:element>\n" +
+ " <m:element>126</m:element>\n" +
+ " </d:CollPropertySByte>\n" +
+ " <d:CollPropertyInt16 m:type=\"#Collection(Int16)\">\n" +
+ " <m:element>1000</m:element>\n" +
+ " <m:element>2000</m:element>\n" +
+ " <m:element>30112</m:element>\n" +
+ " </d:CollPropertyInt16>\n" +
+ " <d:CollPropertyInt32 m:type=\"#Collection(Int32)\">\n" +
+ " <m:element>23232323</m:element>\n" +
+ " <m:element>11223355</m:element>\n" +
+ " <m:element>10000001</m:element>\n" +
+ " </d:CollPropertyInt32>\n" +
+ " <d:CollPropertyInt64 m:type=\"#Collection(Int64)\">\n" +
+ " <m:element>929292929292</m:element>\n" +
+ " <m:element>333333333333</m:element>\n" +
+ " <m:element>444444444444</m:element>\n" +
+ " </d:CollPropertyInt64>\n" +
+ " <d:CollPropertySingle m:type=\"#Collection(Single)\">\n" +
+ " <m:element>1790.0</m:element>\n" +
+ " <m:element>26600.0</m:element>\n" +
+ " <m:element>3210.0</m:element>\n" +
+ " </d:CollPropertySingle>\n" +
+ " <d:CollPropertyDouble m:type=\"#Collection(Double)\">\n" +
+ " <m:element>-17900.0</m:element>\n" +
+ " <m:element>-2.78E7</m:element>\n" +
+ " <m:element>3210.0</m:element>\n" +
+ " </d:CollPropertyDouble>\n" +
+ " <d:CollPropertyDecimal m:type=\"#Collection(Decimal)\">\n" +
+ " <m:element>12</m:element>\n" +
+ " <m:element>-2</m:element>\n" +
+ " <m:element>1234</m:element>\n" +
+ " </d:CollPropertyDecimal>\n" +
+ " <d:CollPropertyBinary m:type=\"#Collection(Binary)\">\n" +
+ " <m:element>q83v</m:element>\n" +
+ " <m:element>ASNF</m:element>\n" +
+ " <m:element>VGeJ</m:element>\n" +
+ " </d:CollPropertyBinary>\n" +
+ " <d:CollPropertyDate m:type=\"#Collection(Date)\">\n" +
+ " <m:element>1958-12-03</m:element>\n" +
+ " <m:element>1999-08-05</m:element>\n" +
+ " <m:element>2013-06-25</m:element>\n" +
+ " </d:CollPropertyDate>\n" +
+ " <d:CollPropertyDateTimeOffset m:type=\"#Collection(DateTimeOffset)\">\n" +
+ " <m:element>2015-08-12T03:08:34Z</m:element>\n" +
+ " <m:element>1970-03-28T12:11:10Z</m:element>\n" +
+ " <m:element>1948-02-17T09:09:09Z</m:element>\n" +
+ " </d:CollPropertyDateTimeOffset>\n" +
+ " <d:CollPropertyDuration m:type=\"#Collection(Duration)\">\n" +
+ " <m:element>PT13S</m:element>\n" +
+ " <m:element>PT5H28M0S</m:element>\n" +
+ " <m:element>PT1H0S</m:element>\n" +
+ " </d:CollPropertyDuration>\n" +
+ " <d:CollPropertyGuid m:type=\"#Collection(Guid)\">\n" +
+ " <m:element>ffffff67-89ab-cdef-0123-456789aaaaaa</m:element>\n" +
+ " <m:element>eeeeee67-89ab-cdef-0123-456789bbbbbb</m:element>\n" +
+ " <m:element>cccccc67-89ab-cdef-0123-456789cccccc</m:element>\n" +
+ " </d:CollPropertyGuid>\n" +
+ " <d:CollPropertyTimeOfDay m:type=\"#Collection(TimeOfDay)\">\n" +
+ " <m:element>04:14:13</m:element>\n" +
+ " <m:element>23:59:59</m:element>\n" +
+ " <m:element>01:12:33</m:element>\n" +
+ " </d:CollPropertyTimeOfDay>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ "</a:entry>";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void entityCompAllPrim() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompAllPrim");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream result = serializer.entity(metadata, edmEntitySet.getEntityType(), entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
+ .build()).getContent();
+
+ final String resultString = IOUtils.toString(result);
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:entry xmlns:a=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "m:context=\"$metadata#ESCompAllPrim/$entity\"\n" +
+ " m:metadata-etag=\"WmetadataETag\" m:etag=\"W/"32767"\">\n" +
+ " <a:id>ESCompAllPrim(32767)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ "<a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESCompAllPrim(32767)\" />\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETCompAllPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">32767</d:PropertyInt16>\n" +
+ " <d:PropertyComp m:type=\"#olingo.odata.test1.CTAllPrim\">\n" +
+ " <d:PropertyString>First Resource - first</d:PropertyString>\n" +
+ " <d:PropertyBinary m:type=\"Binary\">ASNFZ4mrze8=</d:PropertyBinary>\n" +
+ " <d:PropertyBoolean m:type=\"Boolean\">true</d:PropertyBoolean>\n" +
+ " <d:PropertyByte m:type=\"Byte\">255</d:PropertyByte>\n" +
+ " <d:PropertyDate m:type=\"Date\">2012-10-03</d:PropertyDate>\n" +
+ " <d:PropertyDateTimeOffset m:type=\"DateTimeOffset\">2012-10-03T07:16:23.1234567Z"
+ + "</d:PropertyDateTimeOffset>\n" +
+ " <d:PropertyDecimal m:type=\"Decimal\">34.27</d:PropertyDecimal>\n" +
+ " <d:PropertySingle m:type=\"Single\">1.79E20</d:PropertySingle>\n" +
+ " <d:PropertyDouble m:type=\"Double\">-1.79E19</d:PropertyDouble>\n" +
+ " <d:PropertyDuration m:type=\"Duration\">PT6S</d:PropertyDuration>\n" +
+ " <d:PropertyGuid m:type=\"Guid\">01234567-89ab-cdef-0123-456789abcdef</d:PropertyGuid>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">32767</d:PropertyInt16>\n" +
+ " <d:PropertyInt32 m:type=\"Int32\">2147483647</d:PropertyInt32>\n" +
+ " <d:PropertyInt64 m:type=\"Int64\">9223372036854775807</d:PropertyInt64>\n" +
+ " <d:PropertySByte m:type=\"SByte\">127</d:PropertySByte>\n" +
+ " <d:PropertyTimeOfDay m:type=\"TimeOfDay\">01:00:01</d:PropertyTimeOfDay>\n" +
+ " </d:PropertyComp>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ "</a:entry>";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void entityMixPrimCollComp() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream result = serializer.entity(metadata, edmEntitySet.getEntityType(), entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
+ .build()).getContent();
+ final String resultString = IOUtils.toString(result);
+ final String expectedResult = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:entry xmlns:a=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" \n" +
+ " m:context=\"$metadata#ESMixPrimCollComp/$entity\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>ESMixPrimCollComp(32767)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESMixPrimCollComp(32767)\"/>\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETMixPrimCollComp\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">32767</d:PropertyInt16>\n" +
+ " <d:CollPropertyString m:type=\"#Collection(String)\">\n" +
+ " <m:element>Employee1@company.example</m:element>\n" +
+ " <m:element>Employee2@company.example</m:element>\n" +
+ " <m:element>Employee3@company.example</m:element>\n" +
+ " </d:CollPropertyString>\n" +
+ " <d:PropertyComp m:type=\"#olingo.odata.test1.CTTwoPrim\">\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">111</d:PropertyInt16>\n" +
+ " <d:PropertyString>TEST A</d:PropertyString>\n" +
+ " </d:PropertyComp>\n" +
+ " <d:CollPropertyComp m:type=\"#Collection(olingo.odata.test1.CTTwoPrim)\">\n" +
+ " <m:element>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">123</d:PropertyInt16>\n" +
+ " <d:PropertyString>TEST 1</d:PropertyString>\n" +
+ " </m:element>\n" +
+ " <m:element>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">456</d:PropertyInt16>\n" +
+ " <d:PropertyString>TEST 2</d:PropertyString>\n" +
+ " </m:element>\n" +
+ " <m:element>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">789</d:PropertyInt16>\n" +
+ " <d:PropertyString>TEST 3</d:PropertyString>\n" +
+ " </m:element>\n" +
+ " </d:CollPropertyComp>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ "</a:entry>\n";
+ checkXMLEqual(expectedResult, resultString);
+ }
+
+ @Test
+ public void entityMixPrimCollCompAllNull() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
+ Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ entity.getProperties().retainAll(Arrays.asList(entity.getProperties().get(0)));
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream content = serializer.entity(metadata, edmEntitySet.getEntityType(),
+ entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
+ .build()).getContent();
+ final String resultString = IOUtils.toString(content);
+ final String expectedResult = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:entry xmlns:a=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "m:context=\"$metadata#ESMixPrimCollComp/$entity\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>ESMixPrimCollComp(32767)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESMixPrimCollComp(32767)\"/>\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETMixPrimCollComp\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">32767</d:PropertyInt16>\n" +
+ " <d:CollPropertyString m:null=\"true\" />\n" +
+ " <d:PropertyComp m:null=\"true\" />\n" +
+ " <d:CollPropertyComp m:null=\"true\" />\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ "</a:entry>";
+ checkXMLEqual(expectedResult, resultString);
+ }
+
+ @Test
+ public void entityTwoPrimNoMetadata() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ InputStream result = new ODataJsonSerializer(ContentType.JSON_NO_METADATA)
+ .entity(metadata, edmEntitySet.getEntityType(), entity, null).getContent();
+ final String resultString = IOUtils.toString(result);
+ final String expectedResult = "{\"PropertyInt16\":32766,\"PropertyString\":\"Test String1\"}";
+ Assert.assertEquals(expectedResult, resultString);
+ }
+
+ @Test
+ public void entitySetTwoPrimNoMetadata() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
+ final EntityCollection entitySet = data.readAll(edmEntitySet);
+ InputStream result = new ODataJsonSerializer(ContentType.JSON_NO_METADATA)
+ .entityCollection(metadata, edmEntitySet.getEntityType(), entitySet,
+ EntityCollectionSerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).build()).build()).getContent();
+ final String resultString = IOUtils.toString(result);
+ final String expectedResult = "{\"value\":["
+ + "{\"PropertyInt16\":32766,\"PropertyString\":\"Test String1\"},"
+ + "{\"PropertyInt16\":-365,\"PropertyString\":\"Test String2\"},"
+ + "{\"PropertyInt16\":-32766,\"PropertyString\":null},"
+ + "{\"PropertyInt16\":32767,\"PropertyString\":\"Test String4\"}]}";
+ Assert.assertEquals(expectedResult, resultString);
+ }
+
+ @Test
+ public void entityMedia() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMedia");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream content = serializer.entity(metadata, edmEntitySet.getEntityType(),
+ entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
+ .build()).getContent();
+ final String resultString = IOUtils.toString(content);
+ final String expectedResult = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:entry xmlns:a=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" " +
+ " m:context=\"$metadata#ESMedia/$entity\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>ESMedia(1)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESMedia(1)\"/>\n" +
+ " <a:content type=\"image/svg+xml\" src=\"ESMedia(1)/$value\" />\n" +
+ " <a:link rel=\"edit-media\" title=\"ESMedia\" href=\"ESMedia(1)/$value\"/>\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETMedia\" />\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">1</d:PropertyInt16>\n" +
+ " </m:properties>\n" +
+ "</a:entry>";
+ checkXMLEqual(expectedResult, resultString);
+ }
+
+ @Test
+ public void entitySetMedia() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMedia");
+ final EntityCollection entitySet = data.readAll(edmEntitySet);
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream content = serializer.entityCollection(metadata,
+ edmEntitySet.getEntityType(), entitySet,
+ EntityCollectionSerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).build())
+ .setId("http://host/svc/ESMedia")
+ .build()).getContent();
+ final String resultString = IOUtils.toString(content);
+
+ final String expectedResult = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:feed xmlns:a=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" m:context=\"$metadata#ESMedia\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>http://host/svc/ESMedia</a:id>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESMedia(1)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESMedia(1)\"/>\n" +
+ " <a:content type=\"image/svg+xml\" src=\"ESMedia(1)/$value\" />\n" +
+ " <a:link rel=\"edit-media\" title=\"ESMedia\" href=\"ESMedia(1)/$value\"/>\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETMedia\" />\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">1</d:PropertyInt16>\n" +
+ " </m:properties>\n" +
+ " </a:entry>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESMedia(2)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESMedia(2)\"/>\n" +
+ " <a:content type=\"image/svg+xml\" src=\"ESMedia(2)/$value\" />\n" +
+ " <a:link rel=\"edit-media\" title=\"ESMedia\" href=\"ESMedia(2)/$value\"/>\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETMedia\" />\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">2</d:PropertyInt16>\n" +
+ " </m:properties>\n" +
+ " </a:entry>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESMedia(3)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESMedia(3)\"/>\n" +
+ " <a:content type=\"image/svg+xml\" src=\"ESMedia(3)/$value\" />\n" +
+ " <a:link rel=\"edit-media\" title=\"ESMedia\" href=\"ESMedia(3)/$value\"/>\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETMedia\" />\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">3</d:PropertyInt16>\n" +
+ " </m:properties>\n" +
+ " </a:entry>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESMedia(4)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESMedia(4)\"/>\n" +
+ " <a:content type=\"image/svg+xml\" src=\"ESMedia(4)/$value\" />\n" +
+ " <a:link rel=\"edit-media\" title=\"ESMedia\" href=\"ESMedia(4)/$value\"/>\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETMedia\" />\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">4</d:PropertyInt16>\n" +
+ " </m:properties>\n" +
+ " </a:entry>\n" +
+ "</a:feed>\n" +
+ "";
+ checkXMLEqual(expectedResult, resultString);
+ }
+
+ @Test
+ public void primitiveValuesAllNull() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllNullable");
+ final EntityCollection entitySet = data.readAll(edmEntitySet);
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream content = serializer.entityCollection(metadata,
+ edmEntitySet.getEntityType(), entitySet,
+ EntityCollectionSerializerOptions.with()
+ .contextURL(ContextURL.with().serviceRoot(URI.create("http://host/svc"))
+ .entitySet(edmEntitySet).build())
+ .setId("http://host/svc/ESAllNullable")
+ .build()).getContent();
+ final String resultString = IOUtils.toString(content);
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:feed xmlns:a=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "m:context=\"http://host/svc$metadata#ESAllNullable\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>http://host/svc/ESAllNullable</a:id>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESAllNullable(1)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESAllNullable(1)\" />\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllNullable\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyKey m:type=\"Int16\">1</d:PropertyKey>\n" +
+ " <d:PropertyInt16 m:null=\"true\" />\n" +
+ " <d:PropertyString m:null=\"true\" />\n" +
+ " <d:PropertyBoolean m:null=\"true\" />\n" +
+ " <d:PropertyByte m:null=\"true\" />\n" +
+ " <d:PropertySByte m:null=\"true\" />\n" +
+ " <d:PropertyInt32 m:null=\"true\" />\n" +
+ " <d:PropertyInt64 m:null=\"true\" />\n" +
+ " <d:PropertySingle m:null=\"true\" />\n" +
+ " <d:PropertyDouble m:null=\"true\" />\n" +
+ " <d:PropertyDecimal m:null=\"true\" />\n" +
+ " <d:PropertyBinary m:null=\"true\" />\n" +
+ " <d:PropertyDate m:null=\"true\" />\n" +
+ " <d:PropertyDateTimeOffset m:null=\"true\" />\n" +
+ " <d:PropertyDuration m:null=\"true\" />\n" +
+ " <d:PropertyGuid m:null=\"true\" />\n" +
+ " <d:PropertyTimeOfDay m:null=\"true\" />\n" +
+ " <d:CollPropertyString m:type=\"#Collection(String)\">\n" +
+ " <m:element>spiderman@comic.com</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>spidergirl@comic.com</m:element>\n" +
+ " </d:CollPropertyString>\n" +
+ " <d:CollPropertyBoolean m:type=\"#Collection(Boolean)\">\n" +
+ " <m:element>true</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>false</m:element>\n" +
+ " </d:CollPropertyBoolean>\n" +
+ " <d:CollPropertyByte m:type=\"#Collection(Byte)\">\n" +
+ " <m:element>50</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>249</m:element>\n" +
+ " </d:CollPropertyByte>\n" +
+ " <d:CollPropertySByte m:type=\"#Collection(SByte)\">\n" +
+ " <m:element>-120</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>126</m:element>\n" +
+ " </d:CollPropertySByte>\n" +
+ " <d:CollPropertyInt16 m:type=\"#Collection(Int16)\">\n" +
+ " <m:element>1000</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>30112</m:element>\n" +
+ " </d:CollPropertyInt16>\n" +
+ " <d:CollPropertyInt32 m:type=\"#Collection(Int32)\">\n" +
+ " <m:element>23232323</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>10000001</m:element>\n" +
+ " </d:CollPropertyInt32>\n" +
+ " <d:CollPropertyInt64 m:type=\"#Collection(Int64)\">\n" +
+ " <m:element>929292929292</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>444444444444</m:element>\n" +
+ " </d:CollPropertyInt64>\n" +
+ " <d:CollPropertySingle m:type=\"#Collection(Single)\">\n" +
+ " <m:element>1790.0</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>3210.0</m:element>\n" +
+ " </d:CollPropertySingle>\n" +
+ " <d:CollPropertyDouble m:type=\"#Collection(Double)\">\n" +
+ " <m:element>-17900.0</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>3210.0</m:element>\n" +
+ " </d:CollPropertyDouble>\n" +
+ " <d:CollPropertyDecimal m:type=\"#Collection(Decimal)\">\n" +
+ " <m:element>12</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>1234</m:element>\n" +
+ " </d:CollPropertyDecimal>\n" +
+ " <d:CollPropertyBinary m:type=\"#Collection(Binary)\">\n" +
+ " <m:element>q83v</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>VGeJ</m:element>\n" +
+ " </d:CollPropertyBinary>\n" +
+ " <d:CollPropertyDate m:type=\"#Collection(Date)\">\n" +
+ " <m:element>1958-12-03</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>2013-06-25</m:element>\n" +
+ " </d:CollPropertyDate>\n" +
+ " <d:CollPropertyDateTimeOffset m:type=\"#Collection(DateTimeOffset)\">\n" +
+ " <m:element>2015-08-12T03:08:34Z</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>1948-02-17T09:09:09Z</m:element>\n" +
+ " </d:CollPropertyDateTimeOffset>\n" +
+ " <d:CollPropertyDuration m:type=\"#Collection(Duration)\">\n" +
+ " <m:element>PT13S</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>PT1H0S</m:element>\n" +
+ " </d:CollPropertyDuration>\n" +
+ " <d:CollPropertyGuid m:type=\"#Collection(Guid)\">\n" +
+ " <m:element>ffffff67-89ab-cdef-0123-456789aaaaaa</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>cccccc67-89ab-cdef-0123-456789cccccc</m:element>\n" +
+ " </d:CollPropertyGuid>\n" +
+ " <d:CollPropertyTimeOfDay m:type=\"#Collection(TimeOfDay)\">\n" +
+ " <m:element>04:14:13</m:element>\n" +
+ " <m:element d:null=\"true\" />\n" +
+ " <m:element>00:37:13</m:element>\n" +
+ " </d:CollPropertyTimeOfDay>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ " </a:entry>\n" +
+ "</a:feed>";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void select() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final EdmEntityType entityType = edmEntitySet.getEntityType();
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ final SelectItem selectItem1 = ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyDate");
+ final SelectItem selectItem2 = ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyBoolean");
+ final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
+ selectItem1, selectItem2, selectItem2));
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream result = serializer
+ .entity(metadata, entityType, entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet)
+ .selectList(helper.buildContextURLSelectList(entityType, null, select))
+ .suffix(Suffix.ENTITY).build())
+ .select(select)
+ .build()).getContent();
+ final String resultString = IOUtils.toString(result);
+ final String expectedResult = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:entry xmlns:a=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" " +
+ " m:context=\"$metadata#ESAllPrim(PropertyBoolean,PropertyDate)/$entity\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>ESAllPrim(32767)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESAllPrim(32767)\"/>\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETTwoPrimOne\"\n" +
+ " href=\"ESTwoPrim(32767)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
+ " href=\"ESAllPrim(32767)/NavPropertyETTwoPrimMany\" />\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyBoolean m:type=\"Boolean\">true</d:PropertyBoolean>\n" +
+ " <d:PropertyDate m:type=\"Date\">2012-12-03</d:PropertyDate>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ "</a:entry>";
+ checkXMLEqual(expectedResult, resultString);
+ }
+
+ @Test
+ public void selectComplex() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompComp");
+ final EdmEntityType entityType = edmEntitySet.getEntityType();
+ final EntityCollection entitySet = data.readAll(edmEntitySet);
+ final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
+ ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyComp", "PropertyComp", "PropertyString")));
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream result = serializer
+ .entityCollection(metadata, entityType, entitySet,
+ EntityCollectionSerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet)
+ .selectList(helper.buildContextURLSelectList(entityType, null, select))
+ .build())
+ .setId("http://host/svc/ESCompComp")
+ .select(select)
+ .build()).getContent();
+ final String resultString = IOUtils.toString(result);
+ final String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:feed xmlns:a=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\"\n" +
+ " m:context=\"$metadata#ESCompComp(PropertyComp/PropertyComp/PropertyString)\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>http://host/svc/ESCompComp</a:id>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESCompComp(1)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ "<a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESCompComp(1)\"/>\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETCompComp\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyComp m:type=\"#olingo.odata.test1.CTCompComp\">\n" +
+ " <d:PropertyComp m:type=\"#olingo.odata.test1.CTTwoPrim\">\n" +
+ " <d:PropertyString>String 1</d:PropertyString>\n" +
+ " </d:PropertyComp>\n" +
+ " </d:PropertyComp>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ " </a:entry>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESCompComp(2)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ "<a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESCompComp(2)\"/>\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETCompComp\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyComp m:type=\"#olingo.odata.test1.CTCompComp\">\n" +
+ " <d:PropertyComp m:type=\"#olingo.odata.test1.CTTwoPrim\">\n" +
+ " <d:PropertyString>String 2</d:PropertyString>\n" +
+ " </d:PropertyComp>\n" +
+ " </d:PropertyComp>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ " </a:entry>\n" +
+ "</a:feed>\n";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void selectComplexTwice() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompComp");
+ final EdmEntityType entityType = edmEntitySet.getEntityType();
+ final EntityCollection entitySet = data.readAll(edmEntitySet);
+ final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
+ ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyComp", "PropertyComp", "PropertyString"),
+ ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyComp", "PropertyComp")));
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream inputStream = serializer
+ .entityCollection(metadata, entityType, entitySet,
+ EntityCollectionSerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet)
+ .selectList(helper.buildContextURLSelectList(entityType, null, select))
+ .build())
+ .setId("http://host/svc/ESCompComp")
+ .select(select)
+ .build()).getContent();
+ final String resultString = IOUtils.toString(inputStream);
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:feed xmlns:a=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" \n" +
+ " m:context=\"$metadata#ESCompComp(PropertyComp/PropertyComp)\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>http://host/svc/ESCompComp</a:id>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESCompComp(1)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESCompComp(1)\"/>\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETCompComp\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyComp m:type=\"#olingo.odata.test1.CTCompComp\">\n" +
+ " <d:PropertyComp m:type=\"#olingo.odata.test1.CTTwoPrim\">\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">123</d:PropertyInt16>\n" +
+ " <d:PropertyString>String 1</d:PropertyString>\n" +
+ " </d:PropertyComp>\n" +
+ " </d:PropertyComp>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ " </a:entry>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESCompComp(2)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESCompComp(2)\"/>\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETCompComp\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyComp m:type=\"#olingo.odata.test1.CTCompComp\">\n" +
+ " <d:PropertyComp m:type=\"#olingo.odata.test1.CTTwoPrim\">\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">987</d:PropertyInt16>\n" +
+ " <d:PropertyString>String 2</d:PropertyString>\n" +
+ " </d:PropertyComp>\n" +
+ " </d:PropertyComp>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ " </a:entry>\n" +
+ "</a:feed>\n";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void expand() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(3);
+ final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(
+ ExpandSelectMock.mockExpandItem(edmEntitySet, "NavPropertyETAllPrimOne")));
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream result = serializer.entity(metadata, edmEntitySet.getEntityType(), entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
+ .expand(expand)
+ .build()).getContent();
+ final String resultString = IOUtils.toString(result);
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:entry xmlns:a=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" m:context=\"$metadata#ESTwoPrim/$entity\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>ESTwoPrim(32767)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESTwoPrim(32767)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETAllPrimOne\"\n" +
+ " href=\"ESAllPrim(32767)\">\n" +
+ " <m:inline>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESAllPrim(32767)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESAllPrim(32767)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETTwoPrimOne\"\n" +
+ " href=\"ESTwoPrim(32767)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
+ " href=\"ESAllPrim(32767)/NavPropertyETTwoPrimMany\" />\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">32767</d:PropertyInt16>\n" +
+ " <d:PropertyString>First Resource - positive values\n" +
+ " </d:PropertyString>\n" +
+ " <d:PropertyBoolean m:type=\"Boolean\">true\n" +
+ " </d:PropertyBoolean>\n" +
+ " <d:PropertyByte m:type=\"Byte\">255</d:PropertyByte>\n" +
+ " <d:PropertySByte m:type=\"SByte\">127</d:PropertySByte>\n" +
+ " <d:PropertyInt32 m:type=\"Int32\">2147483647\n" +
+ " </d:PropertyInt32>\n" +
+ " <d:PropertyInt64 m:type=\"Int64\">9223372036854775807\n" +
+ " </d:PropertyInt64>\n" +
+ " <d:PropertySingle m:type=\"Single\">1.79E20\n" +
+ " </d:PropertySingle>\n" +
+ " <d:PropertyDouble m:type=\"Double\">-1.79E19\n" +
+ " </d:PropertyDouble>\n" +
+ " <d:PropertyDecimal m:type=\"Decimal\">34</d:PropertyDecimal>\n" +
+ " <d:PropertyBinary m:type=\"Binary\">ASNFZ4mrze8=\n" +
+ " </d:PropertyBinary>\n" +
+ " <d:PropertyDate m:type=\"Date\">2012-12-03</d:PropertyDate>\n" +
+ " <d:PropertyDateTimeOffset m:type=\"DateTimeOffset\">2012-12-03T07:16:23Z\n" +
+ " </d:PropertyDateTimeOffset>\n" +
+ " <d:PropertyDuration m:type=\"Duration\">PT6S\n" +
+ " </d:PropertyDuration>\n" +
+ " <d:PropertyGuid m:type=\"Guid\">01234567-89ab-cdef-0123-456789abcdef\n" +
+ " </d:PropertyGuid>\n" +
+ " <d:PropertyTimeOfDay m:type=\"TimeOfDay\">03:26:05\n" +
+ " </d:PropertyTimeOfDay>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ " </a:entry>\n" +
+ " </m:inline>\n" +
+ " </a:link>\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETAllPrimMany\"\n" +
+ " href=\"ESTwoPrim(32767)/NavPropertyETAllPrimMany\" />" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETTwoPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">32767</d:PropertyInt16>\n" +
+ " <d:PropertyString>Test String4</d:PropertyString>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ "</a:entry>\n" +
+ "";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void expandSelect() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
+ final EdmEntityType entityType = edmEntitySet.getEntityType();
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(3);
+ final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
+ ExpandSelectMock.mockSelectItem(entityContainer.getEntitySet("ESAllPrim"), "PropertyDate")));
+ ExpandItem expandItem = ExpandSelectMock.mockExpandItem(edmEntitySet, "NavPropertyETAllPrimOne");
+ Mockito.when(expandItem.getSelectOption()).thenReturn(select);
+ final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(expandItem));
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream inputStream = serializer
+ .entity(metadata, entityType, entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet)
+ .selectList(helper.buildContextURLSelectList(entityType, expand, select))
+ .suffix(Suffix.ENTITY).build())
+ .expand(expand)
+ .build()).getContent();
+ final String resultString = IOUtils.toString(inputStream);
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:entry xmlns:a=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\"\n" +
+ " m:context=\"$metadata#ESTwoPrim(NavPropertyETAllPrimOne(PropertyDate))/$entity\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>ESTwoPrim(32767)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESTwoPrim(32767)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETAllPrimOne\"\n" +
+ " href=\"ESAllPrim(32767)\">\n" +
+ " <m:inline>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESAllPrim(32767)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESAllPrim(32767)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETTwoPrimOne\"\n" +
+ " href=\"ESTwoPrim(32767)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
+ " href=\"ESAllPrim(32767)/NavPropertyETTwoPrimMany\" />\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyDate m:type=\"Date\">2012-12-03</d:PropertyDate>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ " </a:entry>\n" +
+ " </m:inline>\n" +
+ " </a:link>\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETAllPrimMany\"\n" +
+ " href=\"ESTwoPrim(32767)/NavPropertyETAllPrimMany\" />" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETTwoPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">32767</d:PropertyInt16>\n" +
+ " <d:PropertyString>Test String4</d:PropertyString>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ "</a:entry>";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void expandAll() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final EdmEntityType entityType = edmEntitySet.getEntityType();
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ final ExpandItem expandItem = ExpandSelectMock.mockExpandItem(edmEntitySet, "NavPropertyETTwoPrimOne");
+ ExpandItem expandItemAll = Mockito.mock(ExpandItem.class);
+ Mockito.when(expandItemAll.isStar()).thenReturn(true);
+ final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(
+ expandItem, expandItem, expandItemAll));
+ final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
+ ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertySByte")));
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream inputStream = serializer
+ .entity(metadata, entityType, entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet)
+ .selectList(helper.buildContextURLSelectList(entityType, expand, select))
+ .suffix(Suffix.ENTITY).build())
+ .expand(expand)
+ .select(select)
+ .build()).getContent();
+ final String resultString = IOUtils.toString(inputStream);
+ final String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:entry xmlns:a=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "m:context=\"$metadata#ESAllPrim(PropertySByte)/$entity\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>ESAllPrim(32767)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESAllPrim(32767)\"/>\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETTwoPrimOne\"\n" +
+ " href=\"ESTwoPrim(32767)\">\n" +
+ " <m:inline>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESTwoPrim(32767)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESTwoPrim(32767)\"/>\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETAllPrimOne\"\n" +
+ " href=\"ESAllPrim(32767)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETAllPrimMany\"\n" +
+ " href=\"ESTwoPrim(32767)/NavPropertyETAllPrimMany\" />" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETTwoPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">32767</d:PropertyInt16>\n" +
+ " <d:PropertyString>Test String4</d:PropertyString>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ " </a:entry>\n" +
+ " </m:inline>\n" +
+ " </a:link>\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
+ " href=\"ESAllPrim(32767)/NavPropertyETTwoPrimMany\">\n" +
+ " <m:inline>\n" +
+ " <a:feed>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESTwoPrim(-365)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESTwoPrim(-365)\"/>\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimOne\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETAllPrimOne\"\n" +
+ " href=\"ESTwoPrim(-365)/NavPropertyETAllPrimOne\" />" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETAllPrimMany\"\n" +
+ " href=\"ESTwoPrim(-365)/NavPropertyETAllPrimMany\" />\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETTwoPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">-365</d:PropertyInt16>\n" +
+ " <d:PropertyString>Test String2</d:PropertyString>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ " </a:entry>\n" +
+ " </a:feed>\n" +
+ " </m:inline>\n" +
+ " </a:link>\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertySByte m:type=\"SByte\">127</d:PropertySByte>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ "</a:entry>\n" +
+ "";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void expandNoData() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final EdmEntityType entityType = edmEntitySet.getEntityType();
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(1);
+ ExpandItem expandItemAll = Mockito.mock(ExpandItem.class);
+ Mockito.when(expandItemAll.isStar()).thenReturn(true);
+ final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(expandItemAll));
+ final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
+ ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyTimeOfDay")));
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream result = serializer
+ .entity(metadata, entityType, entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet)
+ .selectList(helper.buildContextURLSelectList(entityType, expand, select))
+ .suffix(Suffix.ENTITY).build())
+ .expand(expand)
+ .select(select)
+ .build()).getContent();
+ final String resultString = IOUtils.toString(result);
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:entry xmlns:a=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "m:context=\"$metadata#ESAllPrim(PropertyTimeOfDay)/$entity\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>ESAllPrim(-32768)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESAllPrim(-32768)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimOne\"\n" +
+ " href=\"ESAllPrim(-32768)/NavPropertyETTwoPrimOne\">\n" +
+ " <m:inline />\n" +
+ " </a:link>\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
+ " href=\"ESAllPrim(-32768)/NavPropertyETTwoPrimMany\">\n" +
+ " <m:inline>\n" +
+ " <a:feed />\n" +
+ " </m:inline>\n" +
+ " </a:link>" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyTimeOfDay m:type=\"TimeOfDay\">23:49:14\n" +
+ " </d:PropertyTimeOfDay>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ "</a:entry>";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void expandTwoLevels() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
+ final EdmEntityType entityType = edmEntitySet.getEntityType();
+ final EdmEntitySet innerEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(1);
+ ExpandItem expandItemSecond = Mockito.mock(ExpandItem.class);
+ Mockito.when(expandItemSecond.isStar()).thenReturn(true);
+ final ExpandOption expandInner = ExpandSelectMock.mockExpandOption(Arrays.asList(expandItemSecond));
+ ExpandItem expandItemFirst = ExpandSelectMock.mockExpandItem(edmEntitySet, "NavPropertyETAllPrimMany");
+ Mockito.when(expandItemFirst.getExpandOption()).thenReturn(expandInner);
+ final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
+ ExpandSelectMock.mockSelectItem(innerEntitySet, "PropertyInt32")));
+ Mockito.when(expandItemFirst.getSelectOption()).thenReturn(select);
+ final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(expandItemFirst));
+ long currentTimeMillis = System.currentTimeMillis();
+ InputStream result = serializer
+ .entity(metadata, entityType, entity,
+ EntitySerializerOptions.with()
+ .contextURL(ContextURL.with().entitySet(edmEntitySet)
+ .selectList(helper.buildContextURLSelectList(entityType, expand, select))
+ .suffix(Suffix.ENTITY).build())
+ .expand(expand)
+ .build()).getContent();
+ final String resultString = IOUtils.toString(result);
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:entry xmlns:a=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\"\n" +
+ " m:context=\"$metadata#ESTwoPrim(NavPropertyETAllPrimMany(PropertyInt32))/$entity\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <a:id>ESTwoPrim(-365)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESTwoPrim(-365)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimOne\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETAllPrimOne\"\n" +
+ " href=\"ESTwoPrim(-365)/NavPropertyETAllPrimOne\" />" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETAllPrimMany\"\n" +
+ " href=\"ESTwoPrim(-365)/NavPropertyETAllPrimMany\">\n" +
+ " <m:inline>\n" +
+ " <a:feed>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESAllPrim(-32768)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESAllPrim(-32768)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimOne\"\n" +
+ " href=\"ESAllPrim(-32768)/NavPropertyETTwoPrimOne\">\n" +
+ " <m:inline />\n" +
+ " </a:link>\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
+ " href=\"ESAllPrim(-32768)/NavPropertyETTwoPrimMany\">\n" +
+ " <m:inline>\n" +
+ " <a:feed />\n" +
+ " </m:inline>\n" +
+ " </a:link>" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt32 m:type=\"Int32\">-2147483648</d:PropertyInt32>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ " </a:entry>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESAllPrim(0)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESAllPrim(0)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimOne\"\n" +
+ " href=\"ESAllPrim(0)/NavPropertyETTwoPrimOne\">\n" +
+ " <m:inline />\n" +
+ " </a:link>" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
+ " href=\"ESAllPrim(0)/NavPropertyETTwoPrimMany\">\n" +
+ " <m:inline>\n" +
+ " <a:feed>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESTwoPrim(32766)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESTwoPrim(32766)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimOne\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETAllPrimOne\"\n" +
+ " href=\"ESTwoPrim(32766)/NavPropertyETAllPrimOne\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETAllPrimMany\"\n" +
+ " href=\"ESTwoPrim(32766)/NavPropertyETAllPrimMany\" />" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETTwoPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">32766</d:PropertyInt16>\n" +
+ " <d:PropertyString>Test String1</d:PropertyString>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ " </a:entry>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESTwoPrim(-32766)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESTwoPrim(-32766)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimOne\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETAllPrimOne\"\n" +
+ " href=\"ESTwoPrim(-32766)/NavPropertyETAllPrimOne\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETAllPrimMany\"\n" +
+ " href=\"ESTwoPrim(-32766)/NavPropertyETAllPrimMany\" />" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETTwoPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">-32766</d:PropertyInt16>\n" +
+ " <d:PropertyString m:null=\"true\" />\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ " </a:entry>\n" +
+ " <a:entry>\n" +
+ " <a:id>ESTwoPrim(32767)</a:id>\n" +
+ " <a:title />\n" +
+ " <a:summary />\n" +
+ " <a:updated>" + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
+ .format(new Date(currentTimeMillis)) + "</a:updated>" +
+ " <a:author>\n" +
+ " <a:name />\n" +
+ " </a:author>\n" +
+ " <a:link rel=\"edit\" href=\"ESTwoPrim(32767)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETAllPrimOne\"\n" +
+ " href=\"ESAllPrim(32767)\" />\n" +
+ " <a:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETAllPrimMany\"\n" +
+ " href=\"ESTwoPrim(32767)/NavPropertyETAllPrimMany\" />" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETTwoPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">32767</d:PropertyInt16>\n" +
+ " <d:PropertyString>Test String4</d:PropertyString>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ " </a:entry>\n" +
+ " </a:feed>\n" +
+ " </m:inline>\n" +
+ " </a:link>\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt32 m:type=\"Int32\">0</d:PropertyInt32>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ " </a:entry>\n" +
+ " </a:feed>\n" +
+ " </m:inline>\n" +
+ " </a:link>\n" +
+ " <a:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETTwoPrim\" />\n" +
+ " <a:content type=\"application/xml\">\n" +
+ " <m:properties>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">-365</d:PropertyInt16>\n" +
+ " <d:PropertyString>Test String2</d:PropertyString>\n" +
+ " </m:properties>\n" +
+ " </a:content>\n" +
+ "</a:entry>";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void primitiveProperty() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyString");
+ final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty(edmProperty.getName());
+ final String resultString = IOUtils.toString(serializer
+ .primitive(metadata, (EdmPrimitiveType) edmProperty.getType(), property,
+ PrimitiveSerializerOptions.with()
+ .contextURL(ContextURL.with()
+ .entitySet(edmEntitySet).keyPath("32767").navOrPropertyPath(edmProperty.getName())
+ .build())
+ .build()).getContent());
+
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<m:value xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\" "
+ + "m:context=\"$metadata#ESAllPrim(32767)/PropertyString\" "
+ + "m:metadata-etag=\"WmetadataETag\">"
+ + "First Resource - positive values</m:value>";
+ Assert.assertEquals(expected, resultString);
+ }
+
+ @Test
+ public void primitivePropertyNull() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyString");
+ final Property property = new Property("Edm.String", edmProperty.getName(), ValueType.PRIMITIVE, null);
+ String response = IOUtils.toString(serializer.primitive(metadata, (EdmPrimitiveType) edmProperty.getType(),
+ property,
+ PrimitiveSerializerOptions.with()
+ .contextURL(ContextURL.with()
+ .entitySet(edmEntitySet).keyPath("4242").navOrPropertyPath(edmProperty.getName())
+ .build())
+ .build()).getContent());
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<m:value xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\" "
+ + "m:context=\"$metadata#ESAllPrim(4242)/PropertyString\" "
+ + "m:metadata-etag=\"WmetadataETag\" "
+ + "m:null=\"true\"/>";
+ Assert.assertEquals(expected, response);
+ }
+
+ @Test
+ public void primitiveCollectionProperty() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCollAllPrim");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("CollPropertyString");
+ final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty(edmProperty.getName());
+
+ final String resultString = IOUtils.toString(serializer
+ .primitiveCollection(metadata, (EdmPrimitiveType) edmProperty.getType(), property,
+ PrimitiveSerializerOptions.with()
+ .contextURL(ContextURL.with()
+ .entitySet(edmEntitySet).keyPath("1").navOrPropertyPath(edmProperty.getName())
+ .build())
+ .build()).getContent());
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<m:value xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\" "
+ + "m:context=\"$metadata#ESCollAllPrim(1)/CollPropertyString\" "
+ + "m:metadata-etag=\"WmetadataETag\" m:type=\"#Collection(String)\">"
+ + "<m:element>Employee1@company.example</m:element>"
+ + "<m:element>Employee2@company.example</m:element>"
+ + "<m:element>Employee3@company.example</m:element>"
+ + "</m:value>";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void complexProperty() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyComp");
+ final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty("PropertyComp");
+
+ final String resultString = IOUtils.toString(serializer
+ .complex(metadata, (EdmComplexType) edmProperty.getType(), property,
+ ComplexSerializerOptions.with()
+ .contextURL(ContextURL.with()
+ .entitySet(edmEntitySet).keyPath("32767").navOrPropertyPath(edmProperty.getName())
+ .build())
+ .build()).getContent());
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<m:value xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\" "
+ + "xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "m:type=\"#olingo.odata.test1.CTTwoPrim\" "
+ + "m:context=\"$metadata#ESMixPrimCollComp(32767)/PropertyComp\" "
+ + "m:metadata-etag=\"WmetadataETag\">"
+ + "<d:PropertyInt16 m:type=\"Int16\">111</d:PropertyInt16>"
+ + "<d:PropertyString>TEST A</d:PropertyString>"
+ + "</m:value>";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void complexCollectionProperty() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("CollPropertyComp");
+ final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty(edmProperty.getName());
+
+ final String resultString = IOUtils.toString(serializer
+ .complexCollection(metadata, (EdmComplexType) edmProperty.getType(), property,
+ ComplexSerializerOptions.with()
+ .contextURL(ContextURL.with()
+ .entitySet(edmEntitySet).keyPath("32767").navOrPropertyPath(edmProperty.getName())
+ .build())
+ .build()).getContent());
+ String expected = "<m:value xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:d=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "m:type=\"#Collection(olingo.odata.test1.CTTwoPrim)\"\n" +
+ " m:context=\"$metadata#ESMixPrimCollComp(32767)/CollPropertyComp\"\n" +
+ " m:metadata-etag=\"WmetadataETag\">\n" +
+ " <m:element>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">123</d:PropertyInt16>\n" +
+ " <d:PropertyString>TEST 1</d:PropertyString>\n" +
+ " </m:element>\n" +
+ " <m:element>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">456</d:PropertyInt16>\n" +
+ " <d:PropertyString>TEST 2</d:PropertyString>\n" +
+ " </m:element>\n" +
+ " <m:element>\n" +
+ " <d:PropertyInt16 m:type=\"Int16\">789</d:PropertyInt16>\n" +
+ " <d:PropertyString>TEST 3</d:PropertyString>\n" +
+ " </m:element>\n" +
+ "</m:value>";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void entityReference() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+
+ ReferenceSerializerOptions options = ReferenceSerializerOptions.with()
+ .contextURL(ContextURL.with().suffix(Suffix.REFERENCE).build()).build();
+
+ final SerializerResult serializerResult = serializer.reference(metadata, edmEntitySet, entity, options);
+ final String resultString = IOUtils.toString(serializerResult.getContent());
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<m:ref xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " m:context=\"$metadata#$ref\" id=\"ESAllPrim(32767)\" />";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void entityCollectionReference() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final EntityCollection entityCollection = data.readAll(edmEntitySet);
+
+ ReferenceCollectionSerializerOptions options = ReferenceCollectionSerializerOptions.with()
+ .contextURL(ContextURL.with().asCollection().suffix(Suffix.REFERENCE).build()).build();
+
+ final SerializerResult serializerResult = serializer.referenceCollection(metadata,
+ edmEntitySet,
+ entityCollection, options);
+
+ final String resultString = IOUtils.toString(serializerResult.getContent());
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:feed xmlns:a=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " m:context=\"$metadata#Collection($ref)\">\n" +
+ " <m:ref id=\"ESAllPrim(32767)\" />\n" +
+ " <m:ref id=\"ESAllPrim(-32768)\" />\n" +
+ " <m:ref id=\"ESAllPrim(0)\" />\n" +
+ "</a:feed>";
+ checkXMLEqual(expected, resultString);
+ }
+
+ @Test
+ public void entityCollectionReferenceEmpty() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final EntityCollection entityCollection = new EntityCollection();
+
+ ReferenceCollectionSerializerOptions options = ReferenceCollectionSerializerOptions.with()
+ .contextURL(ContextURL.with().asCollection().suffix(Suffix.REFERENCE).build()).build();
+
+ final SerializerResult serializerResult = serializer.referenceCollection(metadata,
+ edmEntitySet,
+ entityCollection, options);
+
+ final String resultString = IOUtils.toString(serializerResult.getContent());
+
+ String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<a:feed xmlns:a=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:m=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " m:context=\"$metadata#Collection($ref)\">\n" +
+ "</a:feed>";
+ checkXMLEqual(expected, resultString);
+ }
+
+ private void checkXMLEqual(String resultString, String expected) throws SAXException, IOException {
+ Diff diff = XMLUnit.compareXML(expected, resultString);
+ diff.overrideDifferenceListener(DIFFERENCE_LISTENER);
+ XMLAssert.assertXMLEqual(diff, true);
+ }
+
+ private static class CustomDifferenceListener implements DifferenceListener {
+
+
+ @Override
+ public int differenceFound(Difference difference) {
+ final String xpath = "/updated[1]/text()[1]";
+ if(difference.getControlNodeDetail().getXpathLocation().endsWith(xpath)) {
+ String controlValue = difference.getControlNodeDetail().getValue();
+ String testValue = difference.getTestNodeDetail().getValue();
+ // allow a difference from two seconds
+ SimpleDateFormat sdf = new SimpleDateFormat(UPDATED_FORMAT);
+ try {
+ long controlTime = sdf.parse(controlValue).getTime();
+ long testTime = sdf.parse(testValue).getTime();
+ long diff = controlTime - testTime;
+ if(diff < 0) {
+ diff = diff * -1;
+ }
+ if(diff <= MAX_ALLOWED_UPDATED_DIFFERENCE) {
+ // allow a difference from 2 seconds
+ return DifferenceListener.RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR;
+ }
+ } catch (ParseException e) {
+ throw new RuntimeException("Parse exception for updated value (see difference '" + difference + "').");
+ }
+ }
+ //Yes it is a difference so throw an exception
+ return DifferenceListener.RETURN_ACCEPT_DIFFERENCE;
+ }
+
+ @Override
+ public void skippedComparison(Node control, Node test) { }
+ };
+
+}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java
deleted file mode 100644
index 8945376..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java
+++ /dev/null
@@ -1,151 +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.server.core.uri;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.server.core.uri.parser.RawUri;
-import org.apache.olingo.server.core.uri.parser.UriDecoder;
-import org.apache.olingo.server.core.uri.parser.UriParserSyntaxException;
-import org.junit.Test;
-
-public class RawUriTest {
-
- private RawUri runRawParser(final String path, final String query, final int skipSegments)
- throws UriParserSyntaxException {
- return UriDecoder.decodeUri(path, query, null, skipSegments);
- }
-
- @Test
- public void testOption() throws Exception {
- RawUri rawUri;
- rawUri = runRawParser("", "", 0);
- checkOptionCount(rawUri, 0);
-
- rawUri = runRawParser("", "a", 0);
- checkOption(rawUri, 0, "a", "");
-
- rawUri = runRawParser("", "a=b", 0);
- checkOption(rawUri, 0, "a", "b");
-
- rawUri = runRawParser("", "=", 0);
- checkOption(rawUri, 0, "", "");
-
- rawUri = runRawParser("", "=b", 0);
- checkOption(rawUri, 0, "", "b");
-
- rawUri = runRawParser("", "a&c", 0);
- checkOption(rawUri, 0, "a", "");
- checkOption(rawUri, 1, "c", "");
-
- rawUri = runRawParser("", "a=b&c", 0);
- checkOption(rawUri, 0, "a", "b");
- checkOption(rawUri, 1, "c", "");
-
- rawUri = runRawParser("", "a=b&c=d", 0);
- checkOption(rawUri, 0, "a", "b");
- checkOption(rawUri, 1, "c", "d");
-
- rawUri = runRawParser("", "=&=", 0);
- checkOption(rawUri, 0, "", "");
- checkOption(rawUri, 1, "", "");
-
- rawUri = runRawParser("", "=&c=d", 0);
- checkOption(rawUri, 0, "", "");
- checkOption(rawUri, 1, "c", "d");
- }
-
- private void checkOption(final RawUri rawUri, final int index, final String name, final String value) {
- RawUri.QueryOption option = rawUri.queryOptionListDecoded.get(index);
-
- assertEquals(name, option.name);
- assertEquals(value, option.value);
- }
-
- private void checkOptionCount(final RawUri rawUri, final int count) {
- assertEquals(count, rawUri.queryOptionListDecoded.size());
- }
-
- @Test
- public void testPath() throws Exception {
- RawUri rawUri;
-
- rawUri = runRawParser("", null, 0);
- checkPath(rawUri, "", Collections.<String> emptyList());
-
- rawUri = runRawParser("/", null, 0);
- checkPath(rawUri, "/", Collections.<String> emptyList());
-
- rawUri = runRawParser("/entitySet", null, 0);
- checkPath(rawUri, "/entitySet", Arrays.asList("entitySet"));
-
- rawUri = runRawParser("//entitySet", null, 0);
- checkPath(rawUri, "//entitySet", Arrays.asList("entitySet"));
-
- rawUri = runRawParser("entitySet", null, 0);
- checkPath(rawUri, "entitySet", Arrays.asList("entitySet"));
-
- rawUri = runRawParser("/nonServiceSegment/entitySet", null, 0);
- checkPath(rawUri, "/nonServiceSegment/entitySet", Arrays.asList("nonServiceSegment", "entitySet"));
-
- rawUri = runRawParser("/nonServiceSegment/entitySet", null, 1);
- checkPath(rawUri, "/nonServiceSegment/entitySet", Arrays.asList("entitySet"));
-
- rawUri = runRawParser("nonServiceSegment/entitySet", null, 0);
- checkPath(rawUri, "nonServiceSegment/entitySet", Arrays.asList("nonServiceSegment", "entitySet"));
-
- rawUri = runRawParser("nonServiceSegment/entitySet", null, 1);
- checkPath(rawUri, "nonServiceSegment/entitySet", Arrays.asList("entitySet"));
-
- rawUri = runRawParser("non//Service/Segment///entitySet/", null, 3);
- checkPath(rawUri, "non//Service/Segment///entitySet/", Arrays.asList("entitySet"));
-
- rawUri = runRawParser("/a", "abc=xx+yz", 0);
- checkPath(rawUri, "/a", Arrays.asList("a"));
- }
-
- @Test
- public void testSplit() {
- UriDecoder.split("", '/');
- UriDecoder.split("/", '/');
- UriDecoder.split("a", '/');
- UriDecoder.split("a/", '/');
- UriDecoder.split("/a", '/');
- UriDecoder.split("a/a", '/');
- }
-
- private void checkPath(final RawUri rawUri, final String path, final List<String> list) {
- assertEquals(path, rawUri.path);
-
- assertEquals(list.size(), rawUri.pathSegmentListDecoded.size());
-
- for (int i = 0; i < list.size(); i++) {
- assertEquals(list.get(i), rawUri.pathSegmentListDecoded.get(i));
- }
- }
-
- @Test(expected = UriParserSyntaxException.class)
- public void wrongPercentEncoding() throws Exception {
- runRawParser("%wrong", null, 0);
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriHelperTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriHelperTest.java
index 82653e9..d15c40d 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriHelperTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriHelperTest.java
@@ -42,7 +42,7 @@
private static final EdmEntityContainer container = edm.getEntityContainer(
new FullQualifiedName("olingo.odata.test1", "Container"));
private static final UriHelper helper = new UriHelperImpl();
- private final DataProvider data = new DataProvider();
+ private final DataProvider data = new DataProvider(edm);
@Test
public void canonicalURL() throws Exception {
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java
index 5687035..9448b40 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java
@@ -24,7 +24,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.core.edm.EdmProviderImpl;
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
index 1945fe5..cad1458 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
@@ -125,7 +125,7 @@
assertEquals(false, impl.isCollection());
assertEquals(expression, impl.getExpression());
- assertEquals("A", impl.getLamdaVariable());
+ assertEquals("A", impl.getLambdaVariable());
assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean), impl.getType());
assertEquals("any", impl.toString());
}
@@ -267,6 +267,11 @@
@Override
public String toString() {
+ return getSegmentValue();
+ }
+
+ @Override
+ public String getSegmentValue() {
return "mock";
}
}
@@ -342,10 +347,15 @@
this.type = type;
return this;
}
+
+ @Override
+ public String getSegmentValue() {
+ return "mock";
+ }
@Override
public String toString() {
- return "mock";
+ return getSegmentValue();
}
}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
index f5e625a..6a17d4b 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
@@ -25,6 +25,21 @@
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.core.Encoder;
import org.apache.olingo.commons.core.edm.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmBinary;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmBoolean;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmByte;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDate;
+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.EdmGuid;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmInt16;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmInt32;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmInt64;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmSByte;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmString;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmTimeOfDay;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.uri.UriInfoKind;
import org.apache.olingo.server.api.uri.UriResourceKind;
@@ -38,6 +53,7 @@
import org.apache.olingo.server.core.uri.testutil.FilterValidator;
import org.apache.olingo.server.core.uri.testutil.ResourceValidator;
import org.apache.olingo.server.core.uri.testutil.TestUriValidator;
+import org.apache.olingo.server.core.uri.validator.UriValidationException;
import org.apache.olingo.server.tecsvc.provider.ComplexTypeProvider;
import org.apache.olingo.server.tecsvc.provider.ContainerProvider;
import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider;
@@ -247,8 +263,8 @@
.isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey");
testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/olingo.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()"
- + "/olingo.odata.test1.ETTwoBaseTwoKeyNav")
+ + "/olingo.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()"
+ + "/olingo.odata.test1.ETTwoBaseTwoKeyNav")
.isKind(UriInfoKind.resource).goPath()
.first()
.isEntitySet("ESTwoKeyNav")
@@ -1473,7 +1489,7 @@
.isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETKeyNavMany(3)")
+ + "/NavPropertyETKeyNavMany(3)")
.isKind(UriInfoKind.resource).goPath()
.first()
.isEntitySet("ESTwoKeyNav")
@@ -1704,6 +1720,14 @@
.isKeyPredicate(1, "PropertyString", "'3'")
.n()
.isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav");
+
+ testUri.run("FICRTCollCTTwoPrimTwoParam(ParameterInt16=1,ParameterString=null)")
+ .isKind(UriInfoKind.resource).goPath()
+ .first()
+ .isFunctionImport("FICRTCollCTTwoPrimTwoParam")
+ .isFunction("UFCRTCollCTTwoPrimTwoParam")
+ .isParameter(0, "ParameterInt16", "1")
+ .isParameter(1, "ParameterString", null);
}
@Test
@@ -1757,7 +1781,7 @@
.isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=2,PropertyString='3')"
- + "/olingo.odata.test1.ETBaseTwoKeyNav")
+ + "/olingo.odata.test1.ETBaseTwoKeyNav")
.isKind(UriInfoKind.resource).goPath()
.first()
.isFunctionImport("FICRTETTwoKeyNavParam")
@@ -1816,11 +1840,11 @@
@Test
public void runFunctionImpError() {
- testUri.runEx("FICRTCollCTTwoPrimParam")
+ testUri.runEx("FICRTCollCTTwoPrimTwoParam")
.isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testUri.runEx("FICRTCollCTTwoPrimParam()")
+ testUri.runEx("FICRTCollCTTwoPrimTwoParam()")
.isExSemantic(UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND);
- testUri.runEx("FICRTCollCTTwoPrimParam(invalidParam=2)")
+ testUri.runEx("FICRTCollCTTwoPrimTwoParam(invalidParam=2)")
.isExSemantic(UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND);
}
@@ -2353,9 +2377,6 @@
.goExpand().first()
.isExpandStartType(EntityTypeProvider.nameETBaseTwoKeyNav)
.goPath().first()
- // .isType(EntityTypeProvider.nameETTwoKeyNav)
- // .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- // .n()
.isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='Hugo')",
@@ -2517,6 +2538,40 @@
}
@Test
+ public void runDuplicatedSystemQueryOptionsInExpand() throws UriParserException, UriValidationException {
+ testUri.runEx("ESKeyNav", "$expand=NavPropertyETKeyNavOne($select=PropertyInt16;$select=PropertyInt16)")
+ .isExSyntax(UriParserSyntaxException.MessageKeys.DOUBLE_SYSTEM_QUERY_OPTION);
+
+ testUri.runEx("ESKeyNav", "$expand=NavPropertyETKeyNavOne($filter=true;$filter=true)")
+ .isExSyntax(UriParserSyntaxException.MessageKeys.DOUBLE_SYSTEM_QUERY_OPTION);
+
+ testUri.runEx("ESKeyNav", "$expand=NavPropertyETKeyNavOne($orderby=PropertyInt16;$orderby=PropertyInt16)")
+ .isExSyntax(UriParserSyntaxException.MessageKeys.DOUBLE_SYSTEM_QUERY_OPTION);
+
+ testUri.runEx("ESKeyNav", "$expand=NavPropertyETKeyNavOne($levels=2;$levels=3)")
+ .isExSyntax(UriParserSyntaxException.MessageKeys.DOUBLE_SYSTEM_QUERY_OPTION);
+
+ testUri.runEx("ESKeyNav", "$expand=NavPropertyETKeyNavOne($expand=*;$expand=*)")
+ .isExSyntax(UriParserSyntaxException.MessageKeys.DOUBLE_SYSTEM_QUERY_OPTION);
+
+ testUri.runEx("ESKeyNav", "$expand=NavPropertyETKeyNavOne($count=true;$count=true)")
+ .isExSyntax(UriParserSyntaxException.MessageKeys.DOUBLE_SYSTEM_QUERY_OPTION);
+
+ testUri.runEx("ESKeyNav", "$expand=NavPropertyETKeyNavOne($top=1;$top=1)")
+ .isExSyntax(UriParserSyntaxException.MessageKeys.DOUBLE_SYSTEM_QUERY_OPTION);
+
+ testUri.runEx("ESKeyNav", "$expand=NavPropertyETKeyNavOne($skip=2;$skip=2)")
+ .isExSyntax(UriParserSyntaxException.MessageKeys.DOUBLE_SYSTEM_QUERY_OPTION);
+ }
+
+ @Test
+ @Ignore("$search currently not implemented")
+ public void runDuplicatedSearchExpand() throws UriParserException, UriValidationException {
+ testUri.runEx("ESKeyNav", "$expand=NavPropertyETKeyNavOne($search=Test;$search=Test)")
+ .isExSyntax(UriParserSyntaxException.MessageKeys.DOUBLE_SYSTEM_QUERY_OPTION);
+ }
+
+ @Test
public void runTop() throws Exception {
// top
testUri.run("ESKeyNav", "$top=1")
@@ -4605,11 +4660,11 @@
.goParameter(0).isLiteral("'Walldorf'")
.root().left().goParameter(1).isLiteral("'Wall'");
- testFilter.runOnETAllPrim("olingo.odata.test1.UFCRTCTTwoPrimParam(ParameterInt16=null,ParameterString=null)")
+ testFilter.runOnETAllPrim("olingo.odata.test1.UFCRTCTTwoPrimTwoParam(ParameterInt16=null,ParameterString=null)")
.goPath()
- .isFunction("UFCRTCTTwoPrimParam")
- .isParameter(0, "ParameterInt16", "null")
- .isParameter(1, "ParameterString", "null");
+ .isFunction("UFCRTCTTwoPrimTwoParam")
+ .isParameter(0, "ParameterInt16", null)
+ .isParameter(1, "ParameterString", null);
testFilter.runOnETAllPrim("PropertyBoolean eq true")
.is("<<PropertyBoolean> eq <true>>")
@@ -5179,12 +5234,12 @@
.isExSemantic(UriParserSemanticException.MessageKeys.INCOMPATIBLE_TYPE_FILTER);
// type filter for complex double on entry
- testUri.runEx("FICRTCTTwoPrimParam(ParameterInt16=1,ParameterString='2')"
+ testUri.runEx("FICRTCTTwoPrimTwoParam(ParameterInt16=1,ParameterString='2')"
+ "/olingo.odata.test1.CTBase/olingo.odata.test1.CTBase")
.isExSemantic(UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE);
// type filter for complex double on collection
- testUri.runEx("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')"
+ testUri.runEx("FICRTCollCTTwoPrimTwoParam(ParameterInt16=1,ParameterString='2')"
+ "/olingo.odata.test1.CTBase/olingo.odata.test1.CTBase")
.isExSemantic(UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE);
@@ -5201,6 +5256,17 @@
.isExSemantic(UriParserSemanticException.MessageKeys.ONLY_FOR_ENTITY_TYPES);
testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyCompTwoPrim/$count")
.isExSemantic(UriParserSemanticException.MessageKeys.ONLY_FOR_COLLECTIONS);
+
+ // Actions must not be followed by anything.
+ testUri.runEx(ContainerProvider.AIRT_STRING + "/$value")
+ .isExValidation(UriValidationException.MessageKeys.UNALLOWED_KIND_BEFORE_VALUE);
+ testUri.runEx(ContainerProvider.AIRTCT_TWO_PRIM_PARAM + "/PropertyInt16")
+ .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_PART_ONLY_FOR_TYPED_PARTS);
+ testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/"
+ + "olingo.odata.test1.BAETTwoKeyNavRTETTwoKeyNav/olingo.odata.test1.ETTwoKeyNav")
+ .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_PART_ONLY_FOR_TYPED_PARTS);
+ testUri.runEx("ESTwoKeyNav/olingo.odata.test1.BAESTwoKeyNavRTESTwoKeyNav/$count")
+ .isExValidation(UriValidationException.MessageKeys.UNALLOWED_KIND_BEFORE_COUNT);
}
@Test
@@ -5212,7 +5278,153 @@
.goUpUriValidator()
.isCustomParameter(0, "@A", "'2'");
}
-
+
+ @Test(expected=UriParserException.class)
+ public void testDoublePercentDecoding() throws Exception {
+ testUri.run("ESAllPrim%252832767%29");
+ }
+
+ @Test(expected=UriParserException.class)
+ public void testMultipleKeysInResourcePath() throws Exception {
+ // See OLINGO-730
+ testUri.run("ESAllPrim(32767)(1)(2)");
+ }
+
+ @Test(expected=UriParserException.class)
+ public void testSimpleKeyInExpandSystemQueryOption() throws Exception {
+ testUri.run("ESAllPrim(0)", "$expand=NavPropertyETTwoPrimMany(-365)($filter=PropertyString eq 'Test String1')");
+ }
+
+ @Test(expected=UriParserException.class)
+ public void testCompountKeyInExpandSystemQueryOption() throws Exception {
+ testUri.run("ESAllPrim(0)", "$expand=NavPropertyETTwoPrimMany(PropertyInt16=1,PropertyString=2)"
+ + "($filter=PropertyString eq 'Test String1')");
+ }
+
+ @Test
+ public void testKeyPredicatesInExpandFilter() throws Exception {
+ testUri.run("ESKeyNav(0)", "$expand=NavPropertyETTwoKeyNavMany($filter=NavPropertyETTwoKeyNavMany"
+ + "(PropertyInt16=1,PropertyString='2')/PropertyInt16 eq 1)").goPath().goExpand()
+ .first().goPath().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
+ .goUpExpandValidator()
+ .isFilterSerialized("<<NavPropertyETTwoKeyNavMany/PropertyInt16> eq <1>>");
+ }
+
+ @Test
+ public void testKeyPredicatesInDoubleExpandedFilter() throws Exception {
+ testUri.run("ESKeyNav(0)", "$expand=NavPropertyETTwoKeyNavMany($expand=NavPropertyETTwoKeyNavMany"
+ + "($filter=NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')/PropertyInt16 eq 1))")
+ .goPath().goExpand()
+ .first().goPath().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
+ .goUpExpandValidator().goExpand()
+ .first().goPath().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
+ .goUpExpandValidator()
+ .isFilterSerialized("<<NavPropertyETTwoKeyNavMany/PropertyInt16> eq <1>>");
+ }
+
+ @Test(expected=UriParserException.class)
+ public void testFilterSystemQueryOptionAnyWithKeyAny() throws Exception {
+ testUri.run("ESAllPrim", "$filter=NavPropertyETTwoPrimMany(1)"
+ + "/any(d:d/PropertyInt16 eq 0)");
+ }
+
+ @Test(expected=UriParserException.class)
+ public void testFilterSystemQueryOptionAnyWithKeyAll() throws Exception {
+ testUri.run("ESAllPrim", "$filter=NavPropertyETTwoPrimMany(1)"
+ + "/all(d:d/PropertyInt16 eq 0)");
+ }
+
+ @Test
+ public void testNavigationPropertyWithCount() throws Exception {
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany/$count")
+ .goPath().at(0).isEntitySet("ESKeyNav").isKeyPredicate(0, "PropertyInt16", "1")
+ .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
+ .at(2).isCount();
+ }
+
+ @Test(expected=UriParserException.class)
+ public void testNavigationWithMoreThanOneKey() throws Exception {
+ testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt=1,PropertyString='2')"
+ + "(PropertyInt=1,PropertyString='2')");
+ }
+
+ @Test
+ public void testFilterLiteralTypes() throws Exception {
+ testUri.run("ESAllPrim", "$filter='1' eq 42")
+ .goFilter().isBinary(BinaryOperatorKind.EQ)
+ .left().isLiteral("'1'").isLiteralType(EdmString.getInstance())
+ .root()
+ .right().isLiteral("42").isLiteralType(EdmSByte.getInstance());
+
+ testUri.run("ESAllPrim", "$filter=127 eq 128")
+ .goFilter().isBinary(BinaryOperatorKind.EQ)
+ .left().isLiteral("127").isLiteralType(EdmSByte.getInstance())
+ .root()
+ .right().isLiteral("128").isLiteralType(EdmByte.getInstance());
+
+ testUri.run("ESAllPrim", "$filter=null eq 42.1")
+ .goFilter().isBinary(BinaryOperatorKind.EQ)
+ .left().isLiteral("null").isNullLiteralType()
+ .root()
+ .right().isLiteral("42.1").isLiteralType(EdmDecimal.getInstance());
+
+ testUri.run("ESAllPrim", "$filter=15.6E300 eq 3.4E37")
+ .goFilter().isBinary(BinaryOperatorKind.EQ)
+ .left().isLiteral("15.6E300")
+ .isLiteralType(EdmDouble.getInstance())
+ .root()
+ .right().isLiteral("3.4E37").isLiteralType(EdmDouble.getInstance());
+
+ testUri.run("ESAllPrim", "$filter=15.55555555555555555555555555555555555555555555 eq 3.1")
+ .goFilter().isBinary(BinaryOperatorKind.EQ)
+ .left().isLiteral("15.55555555555555555555555555555555555555555555")
+ .isLiteralType(EdmDecimal.getInstance())
+ .root()
+ .right().isLiteral("3.1").isLiteralType(EdmDecimal.getInstance());
+
+ testUri.run("ESAllPrim", "$filter=duration'PT1H2S' eq 2012-12-03")
+ .goFilter().isBinary(BinaryOperatorKind.EQ)
+ .left().isLiteral("duration'PT1H2S'").isLiteralType(EdmDuration.getInstance())
+ .root()
+ .right().isLiteral("2012-12-03").isLiteralType(EdmDate.getInstance());
+
+ testUri.run("ESAllPrim", "$filter=true eq 2012-12-03T07:16:23Z")
+ .goFilter().isBinary(BinaryOperatorKind.EQ)
+ .left().isLiteral("true").isLiteralType(EdmBoolean.getInstance())
+ .root()
+ .right().isLiteral("2012-12-03T07:16:23Z").isLiteralType(EdmDateTimeOffset.getInstance());
+
+ testUri.run("ESAllPrim", "$filter=07:59:59.999 eq 01234567-89ab-cdef-0123-456789abcdef")
+ .goFilter().isBinary(BinaryOperatorKind.EQ)
+ .left().isLiteral("07:59:59.999").isLiteralType(EdmTimeOfDay.getInstance())
+ .root()
+ .right().isLiteral("01234567-89ab-cdef-0123-456789abcdef").isLiteralType(EdmGuid.getInstance());
+
+ testUri.run("ESAllPrim", "$filter=binary'0FAB7B' eq true")
+ .goFilter().isBinary(BinaryOperatorKind.EQ)
+ .left().isLiteral("binary'0FAB7B'").isLiteralType(EdmBinary.getInstance())
+ .root()
+ .right().isLiteral("true").isLiteralType(EdmBoolean.getInstance());
+
+ testUri.run("ESAllPrim", "$filter=" + Short.MIN_VALUE + " eq " + Short.MAX_VALUE)
+ .goFilter().isBinary(BinaryOperatorKind.EQ)
+ .left().isLiteral("" + Short.MIN_VALUE).isLiteralType(EdmInt16.getInstance())
+ .root()
+ .right().isLiteral("" + Short.MAX_VALUE).isLiteralType(EdmInt16.getInstance());
+
+ testUri.run("ESAllPrim", "$filter=" + Integer.MIN_VALUE + " eq " + Integer.MAX_VALUE)
+ .goFilter().isBinary(BinaryOperatorKind.EQ)
+ .left().isLiteral("" + Integer.MIN_VALUE).isLiteralType(EdmInt32.getInstance())
+ .root()
+ .right().isLiteral("" + Integer.MAX_VALUE).isLiteralType(EdmInt32.getInstance());
+
+ testUri.run("ESAllPrim", "$filter=" + Long.MIN_VALUE + " eq " + Long.MAX_VALUE)
+ .goFilter().isBinary(BinaryOperatorKind.EQ)
+ .left().isLiteral("" + Long.MIN_VALUE).isLiteralType(EdmInt64.getInstance())
+ .root()
+ .right().isLiteral("" + Long.MAX_VALUE).isLiteralType(EdmInt64.getInstance());
+ }
+
public static String encode(final String decoded) throws UnsupportedEncodingException {
return Encoder.encode(decoded);
}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java
index 4b32be5..6df6759 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java
@@ -69,9 +69,9 @@
public void testQueryOptionsTokens() {
test.globalMode(UriLexer.MODE_QUERY);
- test.run("$skip=1").isAllText("$skip=1").isType(UriLexer.SKIP);
- test.run("$skip=2").isAllText("$skip=2").isType(UriLexer.SKIP);
- test.run("$skip=123").isAllText("$skip=123").isType(UriLexer.SKIP);
+ test.run("$skip=1").isAllText("$skip=1").isType(UriLexer.SKIP_QO);
+ test.run("$skip=2").isAllText("$skip=2").isType(UriLexer.SKIP_QO);
+ test.run("$skip=123").isAllText("$skip=123").isType(UriLexer.SKIP_QO);
test.run("$top=1").isAllText("$top=1").isType(UriLexer.TOP);
test.run("$top=2").isAllText("$top=2").isType(UriLexer.TOP);
@@ -96,8 +96,58 @@
test.run("$search=\"ABC\"").isAllText("$search=\"ABC\"").isType(UriLexer.SEARCH);
test.run("$search=ABC").isAllText("$search=ABC").isType(UriLexer.SEARCH);
test.run("$search=\"A%20B%20C\"").isAllText("$search=\"A%20B%20C\"").isType(UriLexer.SEARCH);
+ test.run("$search=Test Test").isAllText("$search=Test Test").isType(UriLexer.SEARCH);
+ test.run("$search=Test&$filter=ABC eq 1").isAllText("$search=Test&$filter=ABC eq 1").isType(UriLexer.SEARCH);
}
-
+
+ @Test
+ public void testQueryOptionsDefaultMode() {
+ // First set query mode, than use expand(switches to default mode) and use nested system query options
+ test.globalMode(UriLexer.MODE_QUERY);
+ test.run("$expand=ABC($skip=1)").isAllText("$expand=ABC($skip=1)").at(4).isType(UriLexer.SKIP_QO);
+ test.run("$expand=ABC($skip=2)").isAllText("$expand=ABC($skip=2)").at(4).isType(UriLexer.SKIP_QO);
+ test.run("$expand=ABC($skip=123)").isAllText("$expand=ABC($skip=123)").at(4).isType(UriLexer.SKIP_QO);
+ test.run("$expand=ABC($search=abc)").isAllText("$expand=ABC($search=abc)").at(4).isType(UriLexer.SEARCH_INLINE);
+ test.run("$expand=ABC($search=\"123\")").isAllText("$expand=ABC($search=\"123\")")
+ .at(4).isType(UriLexer.SEARCH_INLINE)
+ .at(6).isType(UriLexer.SEARCHPHRASE);
+ test.run("$expand=ABC($top=1)").isAllText("$expand=ABC($top=1)").at(4).isType(UriLexer.TOP);
+ test.run("$expand=ABC($top=2)").isAllText("$expand=ABC($top=2)").at(4).isType(UriLexer.TOP);
+ test.run("$expand=ABC($top=123)").isAllText("$expand=ABC($top=123)").at(4).isType(UriLexer.TOP);
+
+ test.run("$expand=ABC($expand=DEF($skip=1))").isAllText("$expand=ABC($expand=DEF($skip=1))")
+ .at(8).isType(UriLexer.SKIP_QO);
+ test.run("$expand=ABC($expand=DEF($skip=2))").isAllText("$expand=ABC($expand=DEF($skip=2))")
+ .at(8).isType(UriLexer.SKIP_QO);
+ test.run("$expand=ABC($expand=DEF($skip=123))").isAllText("$expand=ABC($expand=DEF($skip=123))")
+ .at(8).isType(UriLexer.SKIP_QO);
+
+ test.run("$expand=ABC($expand=DEF($top=1))").isAllText("$expand=ABC($expand=DEF($top=1))")
+ .at(8).isType(UriLexer.TOP);
+ test.run("$expand=ABC($expand=DEF($top=2))").isAllText("$expand=ABC($expand=DEF($top=2))")
+ .at(8).isType(UriLexer.TOP);
+ test.run("$expand=ABC($expand=DEF($top=123))").isAllText("$expand=ABC($expand=DEF($top=123))")
+ .at(8).isType(UriLexer.TOP);
+ test.run("$expand=ABC($expand=DEF($search=Test Test))").isAllText("$expand=ABC($expand=DEF($search=Test Test))")
+ .at(8).isType(UriLexer.SEARCH_INLINE)
+ .at(10).isType(UriLexer.SEARCHWORD)
+ .at(12).isType(UriLexer.SEARCHWORD);
+ test.run("$expand=ABC($expand=DEF($search=\"Test\" \"Test\"))")
+ .isAllText("$expand=ABC($expand=DEF($search=\"Test\" \"Test\"))")
+ .at(8).isType(UriLexer.SEARCH_INLINE)
+ .at(10).isType(UriLexer.SEARCHPHRASE)
+ .at(12).isType(UriLexer.SEARCHPHRASE);
+ test.run("$expand=ABC($expand=DEF($search=\"Test\" \"Test\";$filter=PropertyInt16 eq 0;$orderby=PropertyInt16))")
+ .isAllText("$expand=ABC($expand=DEF($search=\"Test\" \"Test\";$filter=PropertyInt16 " +
+ "eq 0;$orderby=PropertyInt16))")
+ .at(8).isType(UriLexer.SEARCH_INLINE)
+ .at(10).isType(UriLexer.SEARCHPHRASE)
+ .at(12).isType(UriLexer.SEARCHPHRASE)
+ .at(13).isType(UriLexer.SEMI)
+ .at(14).isType(UriLexer.FILTER)
+ .at(22).isType(UriLexer.ORDERBY);
+ }
+
// ;------------------------------------------------------------------------------
// ; 4. Expressions
// ;------------------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
index 068edd7..9f79a84 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
@@ -193,7 +193,7 @@
.isType(EntityTypeProvider.nameETTwoKeyTwoPrim, false);
testUri.runEx(ContainerProvider.AIRT_STRING + "/invalidElement")
- .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_PART_MUST_BE_PRECEDED_BY_STRUCTURAL_TYPE);
+ .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_PART_ONLY_FOR_TYPED_PARTS);
}
@Test
@@ -1018,7 +1018,7 @@
@Test(expected = UriValidationException.class)
public void testMemberStartingWithCastFailOnValidation2() throws Exception {
- testUri.run("FICRTCTTwoPrimParam(ParameterInt16=1,ParameterString='2')",
+ testUri.run("FICRTCTTwoPrimTwoParam(ParameterInt16=1,ParameterString='2')",
"$filter=olingo.odata.test1.CTBase/AdditionalPropString")
.goFilter().root().isMember()
.isMemberStartType(ComplexTypeProvider.nameCTBase).goPath()
@@ -1043,7 +1043,7 @@
.at(0).isType(PropertyProvider.nameDate);
// on Complex collection
- testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')",
+ testUri.run("FICRTCollCTTwoPrimTwoParam(ParameterInt16=1,ParameterString='2')",
"$filter=olingo.odata.test1.CTBase/AdditionalPropString")
.goFilter().root().isMember()
.isMemberStartType(ComplexTypeProvider.nameCTBase).goPath()
@@ -1057,7 +1057,7 @@
@Test
public void testComplexTypeCastFollowingAsCollection() throws Exception {
- testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')/olingo.odata.test1.CTBase");
+ testUri.run("FICRTCollCTTwoPrimTwoParam(ParameterInt16=1,ParameterString='2')/olingo.odata.test1.CTBase");
}
@Test
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/ParserTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/ParserTest.java
new file mode 100644
index 0000000..c9c0907
--- /dev/null
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/ParserTest.java
@@ -0,0 +1,127 @@
+/*
+ * 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.uri.parser;
+
+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.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.server.api.uri.UriInfoKind;
+import org.apache.olingo.server.core.uri.testutil.TestUriValidator;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * All Tests which involves the <code>Parser</code> implementation
+ * (and with that also the <code>UriParseTreeVisitor</code>).
+ */
+public class ParserTest {
+
+ /**
+ * Test for EntitySet and NavigationProperty with same name defined in metadata.
+ * (related to Olingo issue OLINGO-741)
+ */
+ @Test
+ public void parseEntitySetAndNavigationPropertyWithSameName() throws Exception {
+ TestUriValidator testUri = new TestUriValidator();
+
+ Edm mockEdm = Mockito.mock(Edm.class);
+ EdmEntitySet esCategory = Mockito.mock(EdmEntitySet.class);
+ EdmEntitySet esProduct = Mockito.mock(EdmEntitySet.class);
+ EdmEntityType typeCategory = Mockito.mock(EdmEntityType.class);
+ EdmEntityContainer container = Mockito.mock(EdmEntityContainer.class);
+ EdmNavigationProperty productsNavigation = Mockito.mock(EdmNavigationProperty.class);
+ EdmEntityType productsType = Mockito.mock(EdmEntityType.class);
+
+ Mockito.when(mockEdm.getEntityContainer(null)).thenReturn(container);
+ Mockito.when(typeCategory.getName()).thenReturn("Category");
+ Mockito.when(typeCategory.getNamespace()).thenReturn("NS");
+ Mockito.when(esCategory.getEntityType()).thenReturn(typeCategory);
+ Mockito.when(productsNavigation.getName()).thenReturn("Products");
+ Mockito.when(typeCategory.getProperty("Products")).thenReturn(productsNavigation);
+ Mockito.when(container.getEntitySet("Category")).thenReturn(esCategory);
+ Mockito.when(container.getEntitySet("Products")).thenReturn(esProduct);
+ Mockito.when(productsType.getName()).thenReturn("Products");
+ Mockito.when(productsType.getNamespace()).thenReturn("NS");
+ Mockito.when(productsNavigation.getType()).thenReturn(productsType);
+
+ // test and verify
+ testUri.setEdm(mockEdm)
+ .run("Category", "$expand=Products")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isNavProperty("Products", new FullQualifiedName("NS", "Products"), false)
+ .isType(new FullQualifiedName("NS", "Products"), false);
+ Mockito.verifyZeroInteractions(esProduct);
+ }
+
+ /**
+ * Test for EntitySet with navigation to an not existing NavigationProperty (name)
+ * but with another EntitySet with this name defined in metadata.
+ * (related to Olingo issue OLINGO-755)
+ */
+ @Test
+ public void entitySetWoNavigationButWithEntitySetWithSameName() throws Exception {
+ TestUriValidator testUri = new TestUriValidator();
+
+ Edm mockEdm = Mockito.mock(Edm.class);
+ EdmEntitySet esCategory = Mockito.mock(EdmEntitySet.class);
+ EdmEntitySet esProduct = Mockito.mock(EdmEntitySet.class);
+ EdmEntityType typeCategory = Mockito.mock(EdmEntityType.class);
+ FullQualifiedName fqnCategory = new FullQualifiedName("NS", "Category");
+ EdmEntityContainer container = Mockito.mock(EdmEntityContainer.class);
+ EdmNavigationProperty productsNavigation = Mockito.mock(EdmNavigationProperty.class);
+ EdmEntityType typeProduct = Mockito.mock(EdmEntityType.class);
+ FullQualifiedName fqnProduct = new FullQualifiedName("NS", "Products");
+
+ Mockito.when(mockEdm.getEntityContainer(null)).thenReturn(container);
+ Mockito.when(typeCategory.getName()).thenReturn(fqnCategory.getName());
+ Mockito.when(typeCategory.getNamespace()).thenReturn(fqnCategory.getNamespace());
+ Mockito.when(typeCategory.getFullQualifiedName()).thenReturn(fqnCategory);
+ Mockito.when(esCategory.getEntityType()).thenReturn(typeCategory);
+ Mockito.when(esProduct.getEntityType()).thenReturn(typeProduct);
+ Mockito.when(productsNavigation.getName()).thenReturn("Products");
+ Mockito.when(typeCategory.getProperty("Products")).thenReturn(productsNavigation);
+ Mockito.when(container.getEntitySet("Category")).thenReturn(esCategory);
+ Mockito.when(container.getEntitySet("Products")).thenReturn(esProduct);
+ Mockito.when(typeProduct.getName()).thenReturn(fqnProduct.getName());
+ Mockito.when(typeProduct.getNamespace()).thenReturn(fqnProduct.getNamespace());
+ Mockito.when(typeProduct.getFullQualifiedName()).thenReturn(fqnProduct);
+ Mockito.when(productsNavigation.getType()).thenReturn(typeProduct);
+
+ try {
+ // test and verify
+ testUri.setEdm(mockEdm)
+ .run("Products", "$expand=Category")
+ .isKind(UriInfoKind.resource).goPath().goExpand()
+ .first()
+ .goPath().first()
+ .isType(new FullQualifiedName("NS", "Category"), false);
+ fail("Expected exception was not thrown.");
+ } catch (Exception e) {
+ assertEquals("NavigationProperty 'Category' not found in type 'NS.Products'", e.getMessage());
+ }
+ }
+}
\ No newline at end of file
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/RawUriTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/RawUriTest.java
new file mode 100644
index 0000000..c897400
--- /dev/null
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/RawUriTest.java
@@ -0,0 +1,150 @@
+/*
+ * 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.uri.parser;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.Test;
+
+public class RawUriTest {
+
+ private RawUri runRawParser(final String path, final String query, final int skipSegments)
+ throws UriParserSyntaxException {
+ return UriDecoder.decodeUri(path, query, null, skipSegments);
+ }
+
+ @Test
+ public void testOption() throws Exception {
+ RawUri rawUri;
+ rawUri = runRawParser("", "", 0);
+ checkOptionCount(rawUri, 0);
+
+ rawUri = runRawParser("", "a", 0);
+ checkOption(rawUri, 0, "a", "");
+
+ rawUri = runRawParser("", "a=b", 0);
+ checkOption(rawUri, 0, "a", "b");
+
+ rawUri = runRawParser("", "=", 0);
+ checkOption(rawUri, 0, "", "");
+
+ rawUri = runRawParser("", "=b", 0);
+ checkOption(rawUri, 0, "", "b");
+
+ rawUri = runRawParser("", "a&c", 0);
+ checkOption(rawUri, 0, "a", "");
+ checkOption(rawUri, 1, "c", "");
+
+ rawUri = runRawParser("", "a=b&c", 0);
+ checkOption(rawUri, 0, "a", "b");
+ checkOption(rawUri, 1, "c", "");
+
+ rawUri = runRawParser("", "a=b&c=d", 0);
+ checkOption(rawUri, 0, "a", "b");
+ checkOption(rawUri, 1, "c", "d");
+
+ rawUri = runRawParser("", "=&=", 0);
+ checkOption(rawUri, 0, "", "");
+ checkOption(rawUri, 1, "", "");
+
+ rawUri = runRawParser("", "=&c=d", 0);
+ checkOption(rawUri, 0, "", "");
+ checkOption(rawUri, 1, "c", "d");
+ }
+
+ private void checkOption(final RawUri rawUri, final int index, final String name, final String value) {
+ RawUri.QueryOption option = rawUri.queryOptionListDecoded.get(index);
+
+ assertEquals(name, option.name);
+ assertEquals(value, option.value);
+ }
+
+ private void checkOptionCount(final RawUri rawUri, final int count) {
+ assertEquals(count, rawUri.queryOptionListDecoded.size());
+ }
+
+ @Test
+ public void testPath() throws Exception {
+ RawUri rawUri;
+
+ rawUri = runRawParser("", null, 0);
+ checkPath(rawUri, "", Collections.<String> emptyList());
+
+ rawUri = runRawParser("/", null, 0);
+ checkPath(rawUri, "/", Collections.<String> emptyList());
+
+ rawUri = runRawParser("/entitySet", null, 0);
+ checkPath(rawUri, "/entitySet", Arrays.asList("entitySet"));
+
+ rawUri = runRawParser("//entitySet", null, 0);
+ checkPath(rawUri, "//entitySet", Arrays.asList("entitySet"));
+
+ rawUri = runRawParser("entitySet", null, 0);
+ checkPath(rawUri, "entitySet", Arrays.asList("entitySet"));
+
+ rawUri = runRawParser("/nonServiceSegment/entitySet", null, 0);
+ checkPath(rawUri, "/nonServiceSegment/entitySet", Arrays.asList("nonServiceSegment", "entitySet"));
+
+ rawUri = runRawParser("/nonServiceSegment/entitySet", null, 1);
+ checkPath(rawUri, "/nonServiceSegment/entitySet", Arrays.asList("entitySet"));
+
+ rawUri = runRawParser("nonServiceSegment/entitySet", null, 0);
+ checkPath(rawUri, "nonServiceSegment/entitySet", Arrays.asList("nonServiceSegment", "entitySet"));
+
+ rawUri = runRawParser("nonServiceSegment/entitySet", null, 1);
+ checkPath(rawUri, "nonServiceSegment/entitySet", Arrays.asList("entitySet"));
+
+ rawUri = runRawParser("non//Service/Segment///entitySet/", null, 3);
+ checkPath(rawUri, "non//Service/Segment///entitySet/", Arrays.asList("entitySet"));
+
+ rawUri = runRawParser("/a", "abc=xx+yz", 0);
+ checkPath(rawUri, "/a", Arrays.asList("a"));
+ }
+
+ @Test
+ public void testSplit() {
+ assertTrue(UriDecoder.splitSkipEmpty("", '/').isEmpty());
+ assertTrue(UriDecoder.splitSkipEmpty("/", '/').isEmpty());
+ assertEquals(Arrays.asList("a"), UriDecoder.splitSkipEmpty("a", '/'));
+ assertEquals(Arrays.asList("a"), UriDecoder.splitSkipEmpty("a/", '/'));
+ assertEquals(Arrays.asList("a"), UriDecoder.splitSkipEmpty("/a", '/'));
+ assertEquals(Arrays.asList("a", "a"), UriDecoder.splitSkipEmpty("a/a", '/'));
+ assertEquals(Arrays.asList("a", "a"), UriDecoder.splitSkipEmpty("/a/a", '/'));
+ }
+
+ private void checkPath(final RawUri rawUri, final String path, final List<String> list) {
+ assertEquals(path, rawUri.path);
+
+ assertEquals(list.size(), rawUri.pathSegmentListDecoded.size());
+
+ for (int i = 0; i < list.size(); i++) {
+ assertEquals(list.get(i), rawUri.pathSegmentListDecoded.get(i));
+ }
+ }
+
+ @Test(expected = UriParserSyntaxException.class)
+ public void wrongPercentEncoding() throws Exception {
+ runRawParser("%wrong", null, 0);
+ }
+}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java
index e466f2d..98abf20 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java
@@ -19,7 +19,9 @@
package org.apache.olingo.server.core.uri.queryoption.expression;
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.util.Arrays;
@@ -134,7 +136,7 @@
MemberImpl expression = new MemberImpl();
EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETKeyNav);
- // UriResourceImplTyped
+ // UriResourceImpl
EdmAction action = edm.getUnboundAction(ActionProvider.nameUARTString);
UriInfoResource uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
new UriResourceActionImpl().setAction(action)).asUriInfoResource();
@@ -146,24 +148,24 @@
assertEquals("<UARTString>", expression.accept(new FilterTreeToText()));
// UriResourceImplTyped check collection = false case
- assertEquals(false, expression.isCollection());
+ assertFalse(expression.isCollection());
// UriResourceImplTyped check collection = true case
action = edm.getUnboundAction(ActionProvider.nameUARTCollStringTwoParam);
- expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
- new UriResourceActionImpl().setAction(action))
+ expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource)
+ .addResourcePart(new UriResourceActionImpl().setAction(action))
.asUriInfoResource());
- assertEquals(true, expression.isCollection());
+ assertTrue(expression.isCollection());
// UriResourceImplTyped with filter
- action = edm.getUnboundAction(ActionProvider.nameUARTString);
+ EdmFunction function = edm.getUnboundFunction(FunctionProvider.nameUFCRTETKeyNav, null);
expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
- new UriResourceActionImpl().setAction(action).setTypeFilter(entityType))
+ new UriResourceFunctionImpl().setFunction(function).setEntryTypeFilter(entityType))
.asUriInfoResource());
assertEquals(entityType, expression.getType());
// UriResourceImplKeyPred
- EdmFunction function = edm.getUnboundFunction(FunctionProvider.nameUFCRTETKeyNav, null);
+ function = edm.getUnboundFunction(FunctionProvider.nameUFCRTETKeyNav, null);
expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
new UriResourceFunctionImpl().setFunction(function))
.asUriInfoResource());
@@ -192,7 +194,7 @@
assertEquals(null, expression.getType());
// no typed collection else case
- assertEquals(false, expression.isCollection());
+ assertFalse(expression.isCollection());
}
@Test
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/EdmTechTestProvider.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/EdmTechTestProvider.java
index e3a5eb3..e3250ea 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/EdmTechTestProvider.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/EdmTechTestProvider.java
@@ -21,7 +21,7 @@
import java.util.Arrays;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java
index d24c77f..14ddbc6 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java
@@ -33,6 +33,7 @@
import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
+import org.apache.olingo.server.api.uri.queryoption.expression.Literal;
import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind;
import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind;
@@ -82,8 +83,8 @@
}
@Override
- public String visitLiteral(final String literal) throws ExpressionVisitException {
- return "<" + literal + ">";
+ public String visitLiteral(final Literal literal) throws ExpressionVisitException {
+ return "<" + literal.getText() + ">";
}
@Override
@@ -97,7 +98,7 @@
tmp = visitLambdaExpression("ALL", all.getLambdaVariable(), all.getExpression());
} else if (item instanceof UriResourceLambdaAny) {
UriResourceLambdaAny any = (UriResourceLambdaAny) item;
- tmp = visitLambdaExpression("ANY", any.getLamdaVariable(), any.getExpression());
+ tmp = visitLambdaExpression("ANY", any.getLambdaVariable(), any.getExpression());
} else if (item instanceof UriResourcePartTyped) {
UriResourcePartTyped typed = (UriResourcePartTyped) item;
tmp = typed.toString(true);
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java
index 5752208..02cf29e 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java
@@ -19,6 +19,8 @@
package org.apache.olingo.server.core.uri.testutil;
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.util.List;
@@ -362,7 +364,30 @@
return this;
}
-
+
+ public FilterValidator isLiteralType(EdmType edmType) {
+ if(!(curExpression instanceof LiteralImpl)) {
+ fail("Current expression is nit a literal");
+ }
+
+ final EdmType type = ((LiteralImpl) curExpression).getType();
+ assertNotNull(type);
+ assertEquals(edmType.getClass(), type.getClass());
+
+ return this;
+ }
+
+ public FilterValidator isNullLiteralType() {
+ if(!(curExpression instanceof LiteralImpl)) {
+ fail("Current expression is nit a literal");
+ }
+
+ final EdmType type = ((LiteralImpl) curExpression).getType();
+ assertNull(type);
+
+ return this;
+ }
+
public FilterValidator isMethod(final MethodKind methodKind, final int parameterCount) {
if (!(curExpression instanceof MethodImpl)) {
fail("Current expression is not a methodCall");
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
index 817602a..f6c9937 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
@@ -224,7 +224,7 @@
if (uriPathInfo.getKind() == UriResourceKind.lambdaAll) {
actualVar = ((UriResourceLambdaAllImpl) uriPathInfo).getLambdaVariable();
} else if (uriPathInfo.getKind() == UriResourceKind.lambdaAny) {
- actualVar = ((UriResourceLambdaAnyImpl) uriPathInfo).getLamdaVariable();
+ actualVar = ((UriResourceLambdaAnyImpl) uriPathInfo).getLambdaVariable();
} else {
fail("invalid resource kind: " + uriPathInfo.getKind().toString());
}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java
index 7d6604f..76b0d38 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java
@@ -92,7 +92,7 @@
String lexerTokenName = "";
try {
- lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
+ lexerTokenName = UriLexer.VOCABULARY.getDisplayName(e.getOffendingToken().getType());
} catch (ArrayIndexOutOfBoundsException es) {
lexerTokenName = "token error";
}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java
index 596f0d4..3ec6229 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java
@@ -145,7 +145,7 @@
}
public TokenValidator isType(final int expected) {
- assertEquals(UriLexer.tokenNames[expected], UriLexer.tokenNames[curToken.getType()]);
+ assertEquals(UriLexer.VOCABULARY.getDisplayName(expected), UriLexer.VOCABULARY.getDisplayName(curToken.getType()));
return this;
}
@@ -180,7 +180,7 @@
}
int index = token.getType();
if (index != -1) {
- out += "\"" + token.getText() + "\"" + " " + UriLexer.tokenNames[index] + nL;
+ out += "\"" + token.getText() + "\"" + " " + UriLexer.VOCABULARY.getDisplayName(index) + nL;
} else {
out += "\"" + token.getText() + "\"" + " " + index + nL;
}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java
index 3d4cb0f..c067394 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java
@@ -45,7 +45,7 @@
if (tokenType == -1) {
out += "-1/EOF";
} else {
- out += UriLexer.tokenNames[tokenType];
+ out += UriLexer.VOCABULARY.getDisplayName(tokenType);
}
System.out.println("Lexer.emit(...):" + out);
}
diff --git a/pom.xml b/pom.xml
index 84ae718..6b2359b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,21 +80,28 @@
<velocity.version>1.7</velocity.version>
<maven.plugin.api.version>3.2.2</maven.plugin.api.version>
<maven.plugin.tools.version>3.3</maven.plugin.tools.version>
- <maven.bundle.plugin.version>2.3.4</maven.bundle.plugin.version>
+ <maven.bundle.plugin.version>2.5.4</maven.bundle.plugin.version>
<hc.client.version>4.2.6</hc.client.version>
+ <hc.core.version>4.2.5</hc.core.version>
<jackson.version>2.4.2</jackson.version>
<aalto-xml.version>0.9.10</aalto-xml.version>
- <antlr.version>4.1</antlr.version>
+ <antlr.version>4.5</antlr.version>
<android.platform.version>4.1.1.4</android.platform.version>
<stax.api.version>1.0-2</stax.api.version>
+ <woodstox.stax2-api.version>3.1.4</woodstox.stax2-api.version>
<sl4j.version>1.7.7</sl4j.version>
<tomcat.servlet.port>9080</tomcat.servlet.port>
<tomcat.version>7.0.55</tomcat.version>
+ <!-- for osgi integration testing -->
+ <osgi.version>4.2.0</osgi.version>
+ <karaf.version>3.0.3</karaf.version>
+ <pax.exam.version>3.4.0</pax.exam.version>
+
<!-- Project build settings -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.source>1.6</project.build.source>
@@ -246,11 +253,6 @@
<artifactId>tomcat-jasper</artifactId>
<version>${tomcat.version}</version>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>${sl4j.version}</version>
- </dependency>
<!-- Pojogen Maven Plugin depenencies -->
<dependency>
@@ -396,6 +398,14 @@
</plugin>
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
+ <version>1.5</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-filtering</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
<executions>
<execution>
<goals>
@@ -481,6 +491,7 @@
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
+ <useProjectReferences>false</useProjectReferences>
<addGroupIdToProjectName>true</addGroupIdToProjectName>
<addVersionToProjectName>true</addVersionToProjectName>
<wtpversion>2.0</wtpversion>
@@ -515,13 +526,9 @@
<failOnViolation>true</failOnViolation>
<violationSeverity>warning</violationSeverity>
<!-- fit autogenerated (via pojogen plugin) resources -->
- <excludes>**/fit/proxy/v4/staticservice/**/*.java,
- **/fit/proxy/v3/staticservice/**/*.java,
- **/fit/proxy/v3/actionoverloading/**/*.java,
- **/fit/proxy/v3/primitivekeys/**/*.java,
- **/fit/proxy/v3/opentype/**/*.java,
- **/fit/proxy/v4/opentype/**/*.java,
- **/fit/proxy/v4/demo/**/*.java</excludes>
+ <excludes>**/fit/proxy/staticservice/**/*.java,
+ **/fit/proxy/opentype/**/*.java,
+ **/fit/proxy/demo/**/*.java</excludes>
</configuration>
</plugin>
<plugin>
@@ -530,6 +537,7 @@
<configuration>
<instrumentation>
<excludes>
+ <exclude>org/apache/olingo/**/sample/**/*.class</exclude>
<exclude>org/apache/olingo/**/tecsvc/**/*.class</exclude>
<exclude>org/apache/olingo/**/fit/**/*.class</exclude>
<exclude>org/apache/olingo/**/testutil/**/*.class</exclude>
@@ -546,12 +554,13 @@
<executions>
<execution>
<id>rat-check</id>
- <phase>test</phase>
+ <phase>install</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<excludes>
+ <exclude>**/target/**</exclude>
<exclude>**/META-INF/**</exclude>
<exclude>**/*.txt</exclude>
<exclude>**/*.ini</exclude>
diff --git a/samples/client/pom.xml b/samples/client/pom.xml
index b55a1ae..7e4c7ff 100644
--- a/samples/client/pom.xml
+++ b/samples/client/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-samples</artifactId>
- <version>4.0.0-beta-03-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/SocketFactoryHttpClientFactory.java b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/SocketFactoryHttpClientFactory.java
index 65521e1..538e119 100644
--- a/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/SocketFactoryHttpClientFactory.java
+++ b/samples/client/src/main/java/org/apache/olingo/samples/client/core/http/SocketFactoryHttpClientFactory.java
@@ -30,7 +30,7 @@
import org.apache.http.params.CoreProtocolPNames;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.client.core.http.AbstractHttpClientFactory;
-import org.apache.olingo.commons.api.ODataRuntimeException;
+import org.apache.olingo.commons.api.ex.ODataRuntimeException;
/**
* Shows how to customize the way how the underlying network socket are managed by the HTTP component; the specific
diff --git a/samples/osgi/server/README.txt b/samples/osgi/server/README.txt
new file mode 100644
index 0000000..3c5d61d
--- /dev/null
+++ b/samples/osgi/server/README.txt
@@ -0,0 +1,183 @@
+#
+# 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.
+#
+
+Apache Olingo OData Cars service on OSGi
+=================================================
+
+This demo is an OSGi version of the Olingo Cars demo.
+
+Building
+--------
+From the base directory of this sample, the pom.xml file
+is used to build and run the standalone unit test.
+
+```
+ mvn clean install
+```
+
+Running the demo in OSGi
+------------------------
+After building the sample, install the bundle to your Karaf
+container.
+
+If you do not have Karaf installed, download apache-karaf-3.0.3.tar.gz from one of the [mirror sites](http://www.apache.org/dyn/closer.cgi/karaf/3.0.3/apache-karaf-3.0.3.tar.gz) and unpack the archive.
+
+```
+$ wget -N http://ftp.halifax.rwth-aachen.de/apache/karaf/3.0.3/apache-karaf-3.0.3.tar.gz
+$ tar -zxf apache-karaf-3.0.3.tar.gz
+$ cd apache-karaf-3.0.3
+```
+
+#### Starting Karaf
+
+```
+$ bin/karaf
+ __ __ ____
+ / //_/____ __________ _/ __/
+ / ,< / __ `/ ___/ __ `/ /_
+ / /| |/ /_/ / / / /_/ / __/
+ /_/ |_|\__,_/_/ \__,_/_/
+
+ Apache Karaf (3.0.3)
+
+Hit '<tab>' for a list of available commands
+and '[cmd] --help' for help on a specific command.
+Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.
+
+karaf@root()>
+```
+
+#### Note on using Karaf behind a firewall
+
+If you do not have a direct access to the maven central repositories, you need to set Karaf's property
+org.ops4j.pax.url.mvn.repositories to point to your local repository
+
+To use your local repository http://nexus.mycorp.com:8081/nexus/content/groups/build.milestone, run the following commands.
+
+```
+config:edit org.ops4j.pax.url.mvn
+config:property-set org.ops4j.pax.url.mvn.repositories http://nexus.mycorp.com:8081/nexus/content/groups/build.milestone
+config:update
+```
+
+Alternatively, you can edit this property in file etc/org.ops4j.pax.url.mvn.cfg.
+
+For further details, please refer to [Karaf User Guide](http://karaf.apache.org/manual/latest/users-guide/index.html).
+
+#### Install Olingo libs and other depdenent libs
+
+For now, we install the individual bundles one by one. We can define feature olingo-server to install all the bundles at once in the future.
+
+First, to install the depending bundles of olingo, run the following karaf console commands.
+
+```
+feature:install war
+bundle:install -s mvn:commons-codec/commons-codec/1.9
+bundle:install -s mvn:org.apache.commons/commons-lang3/3.3.2
+bundle:install -s mvn:org.codehaus.woodstox/stax2-api/3.1.4
+bundle:install -s mvn:com.fasterxml/aalto-xml/0.9.10
+bundle:install -s 'wrap:mvn:org.antlr/antlr4-runtime/4.1/$Bundle-SymbolicName=antlr4-runtime&Bundle-Version=4.1&Export-Package=org.antlr.v4.runtime*'
+bundle:install -s mvn:com.fasterxml.jackson.core/jackson-core/2.4.1
+bundle:install -s mvn:com.fasterxml.jackson.core/jackson-annotations/2.4.1
+bundle:install -s mvn:com.fasterxml.jackson.core/jackson-databind/2.4.1
+```
+
+Now, install the olingo bundles by running the following commands. Note that
+we assume we are using the patched version regarding OLINGO-632.
+
+```
+bundle:install -s mvn:org.apache.olingo/odata-commons-api/4.0.0-SNAPSHOT
+bundle:install -s mvn:org.apache.olingo/odata-commons-core/4.0.0-SNAPSHOT
+bundle:install -s mvn:org.apache.olingo/odata-server-api/4.0.0-SNAPSHOT
+bundle:install -s mvn:org.apache.olingo/odata-server-core/4.0.0-SNAPSHOT
+```
+
+#### Install this sample bundle
+
+To install this sample bundle, run the karaf console command.
+
+```
+bundle:install -s mvn:org.apache.olingo/odata-server-osgi-sample/4.0.0-SNAPSHOT
+```
+
+Shown below is the output from running the above Karaf console commands.
+
+```
+karaf@root()> feature:install war
+karaf@root()> bundle:install -s mvn:commons-codec/commons-codec/1.9
+Bundle ID: 97
+karaf@root()> bundle:install -s mvn:org.apache.commons/commons-lang3/3.3.2
+Bundle ID: 98
+karaf@root()> bundle:install -s mvn:org.codehaus.woodstox/stax2-api/3.1.4
+Bundle ID: 99
+karaf@root()> bundle:install -s mvn:com.fasterxml/aalto-xml/0.9.10
+Bundle ID: 100
+karaf@root()> bundle:install -s 'wrap:mvn:org.antlr/antlr4-runtime/4.1/$Bundle-SymbolicName=antlr4-runtime&Bundle-Version=4.1&Export-Package=org.antlr.v4.runtime*'
+Bundle ID: 101
+karaf@root()> bundle:install -s mvn:com.fasterxml.jackson.core/jackson-core/2.4.1
+Bundle ID: 102
+karaf@root()> bundle:install -s mvn:com.fasterxml.jackson.core/jackson-annotations/2.4.1
+Bundle ID: 103
+karaf@root()> bundle:install -s mvn:com.fasterxml.jackson.core/jackson-databind/2.4.1
+Bundle ID: 104
+karaf@root()> bundle:install -s mvn:org.apache.olingo/odata-commons-api/4.0.0-SNAPSHOT
+Bundle ID: 105
+karaf@root()> bundle:install -s mvn:org.apache.olingo/odata-commons-core/4.0.0-SNAPSHOT
+Bundle ID: 106
+karaf@root()> bundle:install -s mvn:org.apache.olingo/odata-server-api/4.0.0-SNAPSHOT
+Bundle ID: 107
+karaf@root()> bundle:install -s mvn:org.apache.olingo/odata-server-core/4.0.0-SNAPSHOT
+Bundle ID: 108
+karaf@root()> bundle:install -s mvn:org.apache.olingo/odata-server-osgi-sample/4.0.0-SNAPSHOT
+Bundle ID: 109
+karaf@root()>
+```
+
+To verify if the sample is correctly installed and running, use list and web:list to see its bundle status and its web context is registered.
+
+```
+karaf@root()> list
+START LEVEL 100 , List Threshold: 50
+ ID | State | Lvl | Version | Name
+--------------------------------------------------------------
+ 97 | Active | 80 | 1.9.0 | Apache Commons Codec
+ 98 | Active | 80 | 3.3.2 | Apache Commons Lang
+ 99 | Active | 80 | 3.1.4 | Stax2 API
+100 | Active | 80 | 0.9.10 | aalto-xml
+101 | Active | 80 | 4.1 | antlr4-runtime
+102 | Active | 80 | 2.4.1 | Jackson-core
+103 | Active | 80 | 2.4.1 | Jackson-annotations
+104 | Active | 80 | 2.4.1 | jackson-databind
+105 | Active | 80 | 4.0.0.SNAPSHOT | odata-commons-api
+106 | Active | 80 | 4.0.0.SNAPSHOT | odata-commons-core
+107 | Active | 80 | 4.0.0.SNAPSHOT | odata-server-api
+108 | Active | 80 | 4.0.0.SNAPSHOT | odata-server-core
+109 | Active | 80 | 4.0.0.SNAPSHOT | odata-server-osgi-sample
+karaf@root()> web:list
+ID | State | Web-State | Level | Web-ContextPath | Name
+-----------------------------------------------------------------------------------------------------
+109 | Active | Deployed | 80 | /olingo-cars | odata-server-osgi-sample (4.0.0.SNAPSHOT)
+karaf@root()>
+```
+
+#### Test this sample
+
+Using Browser, open [http://localhost:8181/olingo-cars](http://localhost:8181/olingo-cars) to access the default page and see some available
+queries. You can invoke these queries by clicking on those links or directly typing
+in the queries in Browser's URL field.
diff --git a/samples/osgi/server/pom.xml b/samples/osgi/server/pom.xml
new file mode 100644
index 0000000..0e17fea
--- /dev/null
+++ b/samples/osgi/server/pom.xml
@@ -0,0 +1,117 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>odata-server-osgi-sample</artifactId>
+ <packaging>bundle</packaging>
+ <name>${project.artifactId}</name>
+
+ <parent>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-samples</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.7</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${basedir}/../../server/src/main</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ </Export-Package>
+ <Import-Package>
+ org.apache.olingo.server.api*,
+ org.apache.catalina;resolution:=optional,
+ org.apache.catalina.comet;resolution:=optional,
+ org.eclipse.jetty.continuation;resolution:=optional,
+ org.eclipse.jetty.server;resolution:=optional,
+ org.eclipse.jetty.util.ssl;resolution:=optional,
+ *
+ </Import-Package>
+ <_wab>${basedir}/../../server/src/main/webapp/</_wab>
+ <Web-ContextPath>olingo-cars</Web-ContextPath>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/samples/pom.xml b/samples/pom.xml
index a4c1e14..74c1775 100644
--- a/samples/pom.xml
+++ b/samples/pom.xml
@@ -23,7 +23,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.olingo</groupId>
<artifactId>odata-samples</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
@@ -38,4 +37,20 @@
<modules>
<module>server</module>
</modules>
+
+ <profiles>
+ <profile>
+ <id>samples</id>
+ <modules>
+ <module>osgi/server</module>
+ <module>client</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>tutorials</id>
+ <modules>
+ <module>tutorials</module>
+ </modules>
+ </profile>
+ </profiles>
</project>
diff --git a/samples/server/pom.xml b/samples/server/pom.xml
index 03c5f25..301290b 100644
--- a/samples/server/pom.xml
+++ b/samples/server/pom.xml
@@ -27,12 +27,16 @@
<packaging>war</packaging>
<name>${project.artifactId}</name>
- <parent>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-samples</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
+ <parent>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-samples</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <properties>
+ <version.slf4j>1.7.7</version.slf4j>
+ </properties>
<build>
<plugins>
@@ -79,8 +83,14 @@
<dependency>
<groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${version.slf4j}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
- <version>1.7.7</version>
+ <version>${version.slf4j}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
diff --git a/samples/server/src/main/java/org/apache/olingo/server/sample/data/DataProvider.java b/samples/server/src/main/java/org/apache/olingo/server/sample/data/DataProvider.java
index 69a4530..d360856 100644
--- a/samples/server/src/main/java/org/apache/olingo/server/sample/data/DataProvider.java
+++ b/samples/server/src/main/java/org/apache/olingo/server/sample/data/DataProvider.java
@@ -21,7 +21,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Property;
diff --git a/samples/server/src/main/java/org/apache/olingo/server/sample/edmprovider/CarsEdmProvider.java b/samples/server/src/main/java/org/apache/olingo/server/sample/edmprovider/CarsEdmProvider.java
index 4d3ba9d..628ad7d 100644
--- a/samples/server/src/main/java/org/apache/olingo/server/sample/edmprovider/CarsEdmProvider.java
+++ b/samples/server/src/main/java/org/apache/olingo/server/sample/edmprovider/CarsEdmProvider.java
@@ -22,7 +22,7 @@
import java.util.Arrays;
import java.util.List;
-import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
diff --git a/samples/server/src/main/java/org/apache/olingo/server/sample/processor/CarsProcessor.java b/samples/server/src/main/java/org/apache/olingo/server/sample/processor/CarsProcessor.java
index caffcd5..0b1917f 100644
--- a/samples/server/src/main/java/org/apache/olingo/server/sample/processor/CarsProcessor.java
+++ b/samples/server/src/main/java/org/apache/olingo/server/sample/processor/CarsProcessor.java
@@ -34,7 +34,6 @@
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
@@ -102,15 +101,14 @@
// Next we create a serializer based on the requested format. This could also be a custom format but we do not
// support them in this example
- final ODataFormat format = ODataFormat.fromContentType(requestedContentType);
- ODataSerializer serializer = odata.createSerializer(format);
+ ODataSerializer serializer = odata.createSerializer(requestedContentType);
// Now the content is serialized using the serializer.
final ExpandOption expand = uriInfo.getExpandOption();
final SelectOption select = uriInfo.getSelectOption();
InputStream serializedContent = serializer.entityCollection(edm, edmEntitySet.getEntityType(), entitySet,
EntityCollectionSerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null :
+ .contextURL(isODataMetadataNone(requestedContentType) ? null :
getContextUrl(edmEntitySet, false, expand, select, null))
.count(uriInfo.getCountOption())
.expand(expand).select(select)
@@ -142,13 +140,12 @@
.getStatusCode(), Locale.ENGLISH);
} else {
// If an entity was found we proceed by serializing it and sending it to the client.
- final ODataFormat format = ODataFormat.fromContentType(requestedContentType);
- ODataSerializer serializer = odata.createSerializer(format);
+ ODataSerializer serializer = odata.createSerializer(requestedContentType);
final ExpandOption expand = uriInfo.getExpandOption();
final SelectOption select = uriInfo.getSelectOption();
InputStream serializedContent = serializer.entity(edm, edmEntitySet.getEntityType(), entity,
EntitySerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null :
+ .contextURL(isODataMetadataNone(requestedContentType) ? null :
getContextUrl(edmEntitySet, true, expand, select, null))
.expand(expand).select(select)
.build()).getContent();
@@ -254,9 +251,8 @@
if (property.getValue() == null) {
response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
} else {
- final ODataFormat format = ODataFormat.fromContentType(contentType);
- ODataSerializer serializer = odata.createSerializer(format);
- final ContextURL contextURL = format == ODataFormat.JSON_NO_METADATA ? null :
+ ODataSerializer serializer = odata.createSerializer(contentType);
+ final ContextURL contextURL = isODataMetadataNone(contentType) ? null :
getContextUrl(edmEntitySet, true, null, null, edmProperty.getName());
InputStream serializerContent = complex ?
serializer.complex(edm, (EdmComplexType) edmProperty.getType(), property,
@@ -368,4 +364,9 @@
throw new ODataApplicationException("Entity update is not supported yet.",
HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
}
+
+ public static boolean isODataMetadataNone(final ContentType contentType) {
+ return contentType.isCompatible(ContentType.APPLICATION_JSON)
+ && ContentType.VALUE_ODATA_METADATA_NONE.equals(contentType.getParameter(ContentType.PARAMETER_ODATA_METADATA));
+ }
}
\ No newline at end of file
diff --git a/samples/tutorials/p1_read/pom.xml b/samples/tutorials/p1_read/pom.xml
new file mode 100755
index 0000000..7f212c5
--- /dev/null
+++ b/samples/tutorials/p1_read/pom.xml
@@ -0,0 +1,79 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>my.group.id</groupId>
+ <artifactId>DemoService-Read</artifactId>
+ <packaging>war</packaging>
+ <version>0.0.1</version>
+
+ <name>${project.artifactId}-Webapp</name>
+
+ <build>
+ <finalName>DemoService</finalName>
+ </build>
+
+ <properties>
+ <javax.version>2.5</javax.version>
+ <odata.version>4.0.0-beta-03</odata.version>
+ <slf4j.version>1.7.7</slf4j.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${javax.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-api</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-core</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-api</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-core</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java b/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
new file mode 100755
index 0000000..dd46e86
--- /dev/null
+++ b/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
@@ -0,0 +1,153 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
+import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
+import org.apache.olingo.commons.api.edm.provider.CsdlPropertyRef;
+import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
+
+/**
+ * this class is supposed to declare the metadata of the OData service
+ * it is invoked by the Olingo framework e.g. when the metadata document of the service is invoked
+ * e.g. http://localhost:8080/ExampleService1/ExampleService1.svc/$metadata
+ */
+public class DemoEdmProvider extends CsdlAbstractEdmProvider {
+
+ // Service Namespace
+ public static final String NAMESPACE = "OData.Demo";
+
+ // EDM Container
+ public static final String CONTAINER_NAME = "Container";
+ public static final FullQualifiedName CONTAINER = new FullQualifiedName(NAMESPACE, CONTAINER_NAME);
+
+ // Entity Types Names
+ public static final String ET_PRODUCT_NAME = "Product";
+ public static final FullQualifiedName ET_PRODUCT_FQN = new FullQualifiedName(NAMESPACE, ET_PRODUCT_NAME);
+
+ // Entity Set Names
+ public static final String ES_PRODUCTS_NAME = "Products";
+
+
+ @Override
+ public List<CsdlSchema> getSchemas() throws ODataException {
+
+ // create Schema
+ CsdlSchema schema = new CsdlSchema();
+ schema.setNamespace(NAMESPACE);
+
+ // add EntityTypes
+ List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
+ entityTypes.add(getEntityType(ET_PRODUCT_FQN));
+ schema.setEntityTypes(entityTypes);
+
+ // add EntityContainer
+ schema.setEntityContainer(getEntityContainer());
+
+ // finally
+ List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
+ schemas.add(schema);
+
+ return schemas;
+ }
+
+
+ @Override
+ public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) throws ODataException {
+
+ // this method is called for one of the EntityTypes that are configured in the Schema
+ if(entityTypeName.equals(ET_PRODUCT_FQN)){
+
+ //create EntityType properties
+ CsdlProperty id = new CsdlProperty().setName("ID").setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
+ CsdlProperty name = new CsdlProperty().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+ CsdlProperty description = new CsdlProperty().setName("Description").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+
+ // create CsdlPropertyRef for Key element
+ CsdlPropertyRef propertyRef = new CsdlPropertyRef();
+ propertyRef.setName("ID");
+
+ // configure EntityType
+ CsdlEntityType entityType = new CsdlEntityType();
+ entityType.setName(ET_PRODUCT_NAME);
+ entityType.setProperties(Arrays.asList(id, name , description));
+ entityType.setKey(Collections.singletonList(propertyRef));
+
+ return entityType;
+ }
+
+ return null;
+ }
+
+ @Override
+ public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) throws ODataException {
+
+ if(entityContainer.equals(CONTAINER)){
+ if(entitySetName.equals(ES_PRODUCTS_NAME)){
+ CsdlEntitySet entitySet = new CsdlEntitySet();
+ entitySet.setName(ES_PRODUCTS_NAME);
+ entitySet.setType(ET_PRODUCT_FQN);
+
+ return entitySet;
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public CsdlEntityContainer getEntityContainer() throws ODataException {
+
+ // create EntitySets
+ List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
+ entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
+
+ // create EntityContainer
+ CsdlEntityContainer entityContainer = new CsdlEntityContainer();
+ entityContainer.setName(CONTAINER_NAME);
+ entityContainer.setEntitySets(entitySets);
+
+ return entityContainer;
+ }
+
+ @Override
+ public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) throws ODataException {
+
+ // This method is invoked when displaying the service document at e.g. http://localhost:8080/DemoService/DemoService.svc
+ if(entityContainerName == null || entityContainerName.equals(CONTAINER)){
+ CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
+ entityContainerInfo.setContainerName(CONTAINER);
+ return entityContainerInfo;
+ }
+
+ return null;
+ }
+}
diff --git a/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
new file mode 100755
index 0000000..e82a3ca
--- /dev/null
+++ b/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
@@ -0,0 +1,129 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.util.List;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.processor.EntityCollectionProcessor;
+import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+
+/**
+ * This class is invoked by the Olingo framework when the the OData service is invoked order to display a list/collection of data (entities).
+ * This is the case if an EntitySet is requested by the user.
+ * Such an example URL would be:
+ * http://localhost:8080/ExampleService1/ExampleService1.svc/Products
+ */
+public class DemoEntityCollectionProcessor implements EntityCollectionProcessor {
+
+ private OData odata;
+ private ServiceMetadata serviceMetadata;
+
+ // our processor is initialized with the OData context object
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+ this.serviceMetadata = serviceMetadata;
+ }
+
+
+ // the only method that is declared in the EntityCollectionProcessor interface
+ // this method is called, when the user fires a request to an EntitySet
+ // in our example, the URL would be:
+ // http://localhost:8080/ExampleService1/ExampleServlet1.svc/Products
+ public void readEntityCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat) throws ODataApplicationException, SerializerException {
+
+ // 1st we have retrieve the requested EntitySet from the uriInfo object (representation of the parsed service URI)
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0); // in our example, the first segment is the EntitySet
+ EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
+
+ // 2nd: fetch the data from backend for this requested EntitySetName // it has to be delivered as EntitySet object
+ EntityCollection entitySet = getData(edmEntitySet);
+
+ // 3rd: create a serializer based on the requested format (json)
+ ODataFormat format = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = odata.createSerializer(format);
+
+ // 4th: Now serialize the content: transform from the EntitySet object to InputStream
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).build();
+
+ EntityCollectionSerializerOptions opts = EntityCollectionSerializerOptions.with().contextURL(contextUrl).build();
+ SerializerResult serializedContent = serializer.entityCollection(serviceMetadata, edmEntityType, entitySet, opts);
+
+ // Finally: configure the response object: set the body, headers and status code
+ response.setContent(serializedContent.getContent());
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ }
+
+
+ /**
+ * Helper method for providing some sample data
+ * @param edmEntitySet for which the data is requested
+ * @return data of requested entity set
+ */
+ private EntityCollection getData(EdmEntitySet edmEntitySet){
+
+ EntityCollection entityCollection = new EntityCollection();
+ // check for which EdmEntitySet the data is requested
+ if(DemoEdmProvider.ES_PRODUCTS_NAME.equals(edmEntitySet.getName())) {
+ List<Entity> entityList = entityCollection.getEntities();
+
+ // add some sample product entities
+ entityList.add(new Entity()
+ .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 1))
+ .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Notebook Basic 15"))
+ .addProperty(new Property(null, "Description", ValueType.PRIMITIVE, "Notebook Basic, 1.7GHz - 15 XGA - 1024MB DDR2 SDRAM - 40GB")));
+
+ entityList.add(new Entity()
+ .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 2))
+ .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "1UMTS PDA"))
+ .addProperty(new Property(null, "Description", ValueType.PRIMITIVE, "Ultrafast 3G UMTS/HSDPA Pocket PC, supports GSM network")));
+
+ entityList.add(new Entity()
+ .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 3))
+ .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Ergo Screen"))
+ .addProperty(new Property(null, "Description", ValueType.PRIMITIVE, "17 Optimum Resolution 1024 x 768 @ 85Hz, resolution 1280 x 960")));
+ }
+
+ return entityCollection;
+ }
+}
diff --git a/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/web/DemoServlet.java b/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/web/DemoServlet.java
new file mode 100755
index 0000000..486770c
--- /dev/null
+++ b/samples/tutorials/p1_read/src/main/java/myservice/mynamespace/web/DemoServlet.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 myservice.mynamespace.web;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import myservice.mynamespace.service.DemoEdmProvider;
+import myservice.mynamespace.service.DemoEntityCollectionProcessor;
+
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataHttpHandler;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class represents a standard HttpServlet implementation.
+ * It is used as main entry point for the web application that carries the OData service.
+ * The implementation of this HttpServlet simply delegates the user requests to the ODataHttpHandler
+ */
+public class DemoServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+ private static final Logger LOG = LoggerFactory.getLogger(DemoServlet.class);
+
+ @Override
+ protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
+
+ try {
+ // create odata handler and configure it with EdmProvider and Processor
+ OData odata = OData.newInstance();
+ ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>());
+ ODataHttpHandler handler = odata.createHandler(edm);
+ handler.register(new DemoEntityCollectionProcessor());
+
+ // let the handler do the work
+ handler.process(req, resp);
+
+ } catch (RuntimeException e) {
+ LOG.error("Server Error occurred in ExampleServlet", e);
+ throw new ServletException(e);
+ }
+ }
+}
diff --git a/samples/tutorials/p1_read/src/main/webapp/WEB-INF/web.xml b/samples/tutorials/p1_read/src/main/webapp/WEB-INF/web.xml
new file mode 100755
index 0000000..21de52a
--- /dev/null
+++ b/samples/tutorials/p1_read/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,40 @@
+<?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.
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ id="WebApp_ID" version="2.5">
+
+ <!-- Register the HttpServlet implementation -->
+ <servlet>
+ <servlet-name>DemoServlet</servlet-name>
+ <servlet-class>myservice.mynamespace.web.DemoServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!--
+ Our OData service can be invoked at
+ http://localhost:8080/DemoService/DemoService.svc
+ -->
+ <servlet-mapping>
+ <servlet-name>DemoServlet</servlet-name>
+ <url-pattern>/DemoService.svc/*</url-pattern>
+ </servlet-mapping>
+</web-app>
\ No newline at end of file
diff --git a/samples/tutorials/p1_read/src/main/webapp/index.jsp b/samples/tutorials/p1_read/src/main/webapp/index.jsp
new file mode 100755
index 0000000..7ffb4ba
--- /dev/null
+++ b/samples/tutorials/p1_read/src/main/webapp/index.jsp
@@ -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.
+
+-->
+<html>
+<body>
+<h2>Hello World!</h2>
+<a href="DemoService.svc/">OData Olingo V4 Demo Service</a>
+</body>
+</html>
diff --git a/samples/tutorials/p2_readep/pom.xml b/samples/tutorials/p2_readep/pom.xml
new file mode 100755
index 0000000..9a47d1c
--- /dev/null
+++ b/samples/tutorials/p2_readep/pom.xml
@@ -0,0 +1,79 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>my.group.id</groupId>
+ <artifactId>DemoService-ReadEp</artifactId>
+ <packaging>war</packaging>
+ <version>0.0.1</version>
+
+ <name>${project.artifactId}-Webapp</name>
+
+ <build>
+ <finalName>DemoService</finalName>
+ </build>
+
+ <properties>
+ <javax.version>2.5</javax.version>
+ <odata.version>4.0.0-beta-03</odata.version>
+ <slf4j.version>1.7.7</slf4j.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${javax.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-api</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-core</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-api</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-core</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/data/Storage.java b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/data/Storage.java
new file mode 100755
index 0000000..d5d16c2
--- /dev/null
+++ b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/data/Storage.java
@@ -0,0 +1,125 @@
+/*
+ * 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 myservice.mynamespace.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.service.DemoEdmProvider;
+import myservice.mynamespace.util.Util;
+
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.uri.UriParameter;
+
+public class Storage {
+
+ private List<Entity> productList;
+
+ public Storage() {
+ productList = new ArrayList<Entity>();
+ initSampleData();
+ }
+
+ /* PUBLIC FACADE */
+
+ public EntityCollection readEntitySetData(EdmEntitySet edmEntitySet)throws ODataApplicationException{
+
+ // actually, this is only required if we have more than one Entity Sets
+ if(edmEntitySet.getName().equals(DemoEdmProvider.ES_PRODUCTS_NAME)){
+ return getProducts();
+ }
+
+ return null;
+ }
+
+ public Entity readEntityData(EdmEntitySet edmEntitySet, List<UriParameter> keyParams) throws ODataApplicationException{
+
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+ // actually, this is only required if we have more than one Entity Type
+ if(edmEntityType.getName().equals(DemoEdmProvider.ET_PRODUCT_NAME)){
+ return getProduct(edmEntityType, keyParams);
+ }
+
+ return null;
+ }
+
+
+
+ /* INTERNAL */
+
+ private EntityCollection getProducts(){
+ EntityCollection retEntitySet = new EntityCollection();
+
+ for(Entity productEntity : this.productList){
+ retEntitySet.getEntities().add(productEntity);
+ }
+
+ return retEntitySet;
+ }
+
+
+ private Entity getProduct(EdmEntityType edmEntityType, List<UriParameter> keyParams) throws ODataApplicationException{
+
+ // the list of entities at runtime
+ EntityCollection entitySet = getProducts();
+
+ /* generic approach to find the requested entity */
+ Entity requestedEntity = Util.findEntity(edmEntityType, entitySet, keyParams);
+
+ if(requestedEntity == null){
+ // this variable is null if our data doesn't contain an entity for the requested key
+ // Throw suitable exception
+ throw new ODataApplicationException("Entity for requested key doesn't exist",
+ HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ return requestedEntity;
+ }
+
+ /* HELPER */
+
+ private void initSampleData(){
+
+ // add some sample product entities
+ productList.add(new Entity()
+ .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 1))
+ .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Notebook Basic 15"))
+ .addProperty(new Property(null, "Description", ValueType.PRIMITIVE, "Notebook Basic, 1.7GHz - 15 XGA - 1024MB DDR2 SDRAM - 40GB")));
+
+ productList.add(new Entity()
+ .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 2))
+ .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "1UMTS PDA"))
+ .addProperty(new Property(null, "Description", ValueType.PRIMITIVE, "Ultrafast 3G UMTS/HSDPA Pocket PC, supports GSM network")));
+
+ productList.add(new Entity()
+ .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 3))
+ .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Ergo Screen"))
+ .addProperty(new Property(null, "Description", ValueType.PRIMITIVE, "19 Optimum Resolution 1024 x 768 @ 85Hz, resolution 1280 x 960")));
+
+ }
+}
diff --git a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
new file mode 100755
index 0000000..15140e1
--- /dev/null
+++ b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
@@ -0,0 +1,153 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
+import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
+import org.apache.olingo.commons.api.edm.provider.CsdlPropertyRef;
+import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
+
+public class DemoEdmProvider extends CsdlAbstractEdmProvider {
+
+ // Service Namespace
+ public static final String NAMESPACE = "OData.Demo";
+
+ // EDM Container
+ public static final String CONTAINER_NAME = "Container";
+ public static final FullQualifiedName CONTAINER = new FullQualifiedName(NAMESPACE, CONTAINER_NAME);
+
+ // Entity Types Names
+ public static final String ET_PRODUCT_NAME = "Product";
+ public static final FullQualifiedName ET_PRODUCT_FQN = new FullQualifiedName(NAMESPACE, ET_PRODUCT_NAME);
+
+ // Entity Set Names
+ public static final String ES_PRODUCTS_NAME = "Products";
+
+
+ @Override
+ public CsdlEntityType getEntityType(FullQualifiedName entityTypeName)
+ throws ODataException {
+ // this method is called for one of the EntityTypes that are configured in the Schema
+ if(ET_PRODUCT_FQN.equals(entityTypeName)){
+
+ //create EntityType properties
+ CsdlProperty id = new CsdlProperty().setName("ID").setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
+ CsdlProperty name = new CsdlProperty().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+ CsdlProperty description = new CsdlProperty().setName("Description").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+
+ // create PropertyRef for Key element
+ CsdlPropertyRef propertyRef = new CsdlPropertyRef();
+ propertyRef.setName("ID");
+
+ // configure EntityType
+ CsdlEntityType entityType = new CsdlEntityType();
+ entityType.setName(ET_PRODUCT_NAME);
+ entityType.setProperties(Arrays.asList(id, name, description));
+ entityType.setKey(Collections.singletonList(propertyRef));
+
+ return entityType;
+ }
+
+ return null;
+
+ }
+
+ @Override
+ public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer,
+ String entitySetName) throws ODataException {
+ if(entityContainer.equals(CONTAINER)){
+ if(entitySetName.equals(ES_PRODUCTS_NAME)){
+ CsdlEntitySet entitySet = new CsdlEntitySet();
+ entitySet.setName(ES_PRODUCTS_NAME);
+ entitySet.setType(ET_PRODUCT_FQN);
+
+ return entitySet;
+ }
+ }
+
+ return null;
+
+ }
+
+ @Override
+ public CsdlEntityContainerInfo getEntityContainerInfo(
+ FullQualifiedName entityContainerName) throws ODataException {
+ // This method is invoked when displaying the service document at e.g. http://localhost:8080/DemoService/DemoService.svc
+ if(entityContainerName == null || entityContainerName.equals(CONTAINER)){
+ CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
+ entityContainerInfo.setContainerName(CONTAINER);
+ return entityContainerInfo;
+ }
+
+ return null;
+
+ }
+
+ @Override
+ public List<CsdlSchema> getSchemas() throws ODataException {
+ // create Schema
+ CsdlSchema schema = new CsdlSchema();
+ schema.setNamespace(NAMESPACE);
+
+ // add EntityTypes
+ List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
+ entityTypes.add(getEntityType(ET_PRODUCT_FQN));
+ schema.setEntityTypes(entityTypes);
+
+ // add EntityContainer
+ schema.setEntityContainer(getEntityContainer());
+
+ // finally
+ List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
+ schemas.add(schema);
+
+ return schemas;
+
+ }
+
+ @Override
+ public CsdlEntityContainer getEntityContainer() throws ODataException {
+ // create EntitySets
+ List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
+ entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
+
+ // create EntityContainer
+ CsdlEntityContainer entityContainer = new CsdlEntityContainer();
+ entityContainer.setName(CONTAINER_NAME);
+ entityContainer.setEntitySets(entitySets);
+
+ return entityContainer;
+
+ }
+
+
+
+}
diff --git a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
new file mode 100755
index 0000000..d69d529
--- /dev/null
+++ b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package myservice.mynamespace.service;
+
+import java.io.InputStream;
+import java.util.List;
+
+import myservice.mynamespace.data.Storage;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.processor.EntityCollectionProcessor;
+import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+
+public class DemoEntityCollectionProcessor implements EntityCollectionProcessor {
+
+ private OData odata;
+ private ServiceMetadata serviceMetadata;
+ private Storage storage;
+
+ public DemoEntityCollectionProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+ this.serviceMetadata = serviceMetadata;
+ }
+
+ public void readEntityCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat) throws ODataApplicationException, SerializerException {
+
+ // 1st retrieve the requested EntitySet from the uriInfo (representation of the parsed URI)
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0); // in our example, the first segment is the EntitySet
+ EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
+
+ // 2nd: fetch the data from backend for this requested EntitySetName and deliver as EntitySet
+ EntityCollection entityCollection = storage.readEntitySetData(edmEntitySet);
+
+ // 3rd: create a serializer based on the requested format (json)
+ ODataFormat format = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = odata.createSerializer(format);
+
+ // and serialize the content: transform from the EntitySet object to InputStream
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).build();
+
+ EntityCollectionSerializerOptions opts = EntityCollectionSerializerOptions.with().contextURL(contextUrl).build();
+ SerializerResult serializerResult = serializer.entityCollection(serviceMetadata, edmEntityType, entityCollection, opts);
+ InputStream serializedContent = serializerResult.getContent();
+
+ // 4th: configure the response object: set the body, headers and status code
+ response.setContent(serializedContent);
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ }
+}
diff --git a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
new file mode 100755
index 0000000..e3c8767
--- /dev/null
+++ b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
@@ -0,0 +1,126 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.data.Storage;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.processor.EntityProcessor;
+import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+
+public class DemoEntityProcessor implements EntityProcessor {
+
+
+ private OData odata;
+ private ServiceMetadata serviceMetadata;
+ private Storage storage;
+
+
+
+ public DemoEntityProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+ this.serviceMetadata = serviceMetadata;
+ }
+
+
+ public void readEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
+ throws ODataApplicationException, SerializerException {
+
+ // 1. retrieve the Entity Type
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ // Note: only in our example we can assume that the first segment is the EntitySet
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
+ EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
+
+ // 2. retrieve the data from backend
+ List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
+ Entity entity = storage.readEntityData(edmEntitySet, keyPredicates);
+
+ // 3. serialize
+ EdmEntityType entityType = edmEntitySet.getEntityType();
+
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).suffix(ContextURL.Suffix.ENTITY).build();
+ // expand and select currently not supported
+ EntitySerializerOptions options = EntitySerializerOptions.with().contextURL(contextUrl).build();
+
+ ODataFormat oDataFormat = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = this.odata.createSerializer(oDataFormat);
+ SerializerResult serializerResult = serializer.entity(serviceMetadata, entityType, entity, options);
+ InputStream entityStream = serializerResult.getContent();
+
+ //4. configure the response object
+ response.setContent(entityStream);
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ }
+
+
+
+
+ /*
+ * These processor methods are not handled in this tutorial
+ * */
+
+
+ public void createEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat, ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+
+ public void updateEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat, ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+
+ public void deleteEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo) throws ODataApplicationException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+}
diff --git a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
new file mode 100755
index 0000000..1ba0c75
--- /dev/null
+++ b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.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 myservice.mynamespace.service;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.data.Storage;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.processor.PrimitiveProcessor;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.server.api.uri.UriResourceProperty;
+
+public class DemoPrimitiveProcessor implements PrimitiveProcessor {
+
+ private OData odata;
+ private Storage storage;
+
+ public DemoPrimitiveProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+
+ }
+
+ /*
+ * In our example, the URL would be: http://localhost:8080/DemoService/DemoService.svc/Products(1)/Name
+ * and the response:
+ * {
+ * @odata.context: "$metadata#Products/Name",
+ * value: "Notebook Basic 15"
+ * }
+ * */
+ public void readPrimitive(ODataRequest request, ODataResponse response,
+ UriInfo uriInfo, ContentType responseFormat)
+ throws ODataApplicationException, SerializerException {
+
+ // 1. Retrieve info from URI
+ // 1.1. retrieve the info about the requested entity set
+ List<UriResource> resourceParts = uriInfo.getUriResourceParts();
+ // Note: only in our example we can rely that the first segment is the EntitySet
+ UriResourceEntitySet uriEntityset = (UriResourceEntitySet) resourceParts.get(0);
+ EdmEntitySet edmEntitySet = uriEntityset.getEntitySet();
+ // the key for the entity
+ List<UriParameter> keyPredicates = uriEntityset.getKeyPredicates();
+
+ // 1.2. retrieve the requested (Edm) property
+ UriResourceProperty uriProperty = (UriResourceProperty)resourceParts.get(resourceParts.size() -1); // the last segment is the Property
+ EdmProperty edmProperty = uriProperty.getProperty();
+ String edmPropertyName = edmProperty.getName();
+ // in our example, we know we have only primitive types in our model
+ EdmPrimitiveType edmPropertyType = (EdmPrimitiveType) edmProperty.getType();
+
+
+ // 2. retrieve data from backend
+ // 2.1. retrieve the entity data, for which the property has to be read
+ Entity entity = storage.readEntityData(edmEntitySet, keyPredicates);
+ if (entity == null) { // Bad request
+ throw new ODataApplicationException("Entity not found", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ // 2.2. retrieve the property data from the entity
+ Property property = entity.getProperty(edmPropertyName);
+ if (property == null) {
+ throw new ODataApplicationException("Property not found", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ // 3. serialize
+ Object value = property.getValue();
+ if (value != null) {
+ // 3.1. configure the serializer
+ ODataFormat format = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = odata.createSerializer(format);
+
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).navOrPropertyPath(edmPropertyName).build();
+ PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextUrl).build();
+ // 3.2. serialize
+ SerializerResult serializerResult = serializer.primitive(edmPropertyType, property, options);
+ InputStream propertyStream = serializerResult.getContent();
+
+ //4. configure the response object
+ response.setContent(propertyStream);
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ } else {
+ // in case there's no value for the property, we can skip the serialization
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+ }
+
+
+
+ /*
+ * These processor methods are not handled in this tutorial
+ * */
+
+ public void updatePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat, ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ public void deletePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo) throws ODataApplicationException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+}
diff --git a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/util/Util.java b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/util/Util.java
new file mode 100755
index 0000000..c21d352
--- /dev/null
+++ b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/util/Util.java
@@ -0,0 +1,105 @@
+/*
+ * 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 myservice.mynamespace.util;
+
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.uri.UriInfoResource;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+
+public class Util {
+
+ public static Entity findEntity(EdmEntityType edmEntityType, EntityCollection entitySet,
+ List<UriParameter> keyParams) throws ODataApplicationException {
+
+ List<Entity> entityList = entitySet.getEntities();
+
+ // loop over all entities in order to find that one that matches all keys in request
+ // e.g. contacts(ContactID=1, CompanyID=1)
+ for (Entity entity: entityList) {
+ boolean foundEntity = entityMatchesAllKeys(edmEntityType, entity, keyParams);
+ if (foundEntity) {
+ return entity;
+ }
+ }
+
+ return null;
+ }
+
+ public static boolean entityMatchesAllKeys(EdmEntityType edmEntityType, Entity entity, List<UriParameter> keyParams)
+ throws ODataApplicationException {
+
+ // loop over all keys
+ for (final UriParameter key : keyParams) {
+ // key
+ String keyName = key.getName();
+ String keyText = key.getText();
+
+ // Edm: we need this info for the comparison below
+ EdmProperty edmKeyProperty = (EdmProperty) edmEntityType.getProperty(keyName);
+ Boolean isNullable = edmKeyProperty.isNullable();
+ Integer maxLength = edmKeyProperty.getMaxLength();
+ Integer precision = edmKeyProperty.getPrecision();
+ Boolean isUnicode = edmKeyProperty.isUnicode();
+ Integer scale = edmKeyProperty.getScale();
+ // get the EdmType in order to compare
+ EdmType edmType = edmKeyProperty.getType();
+ EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) edmType;
+
+ // Runtime data: the value of the current entity
+ // don't need to check for null, this is done in olingo library
+ Object valueObject = entity.getProperty(keyName).getValue();
+
+ // now need to compare the valueObject with the keyText String
+ // this is done using the type.valueToString
+ String valueAsString;
+ try {
+ valueAsString = edmPrimitiveType.valueToString(valueObject, isNullable, maxLength, precision, scale, isUnicode);
+ } catch (EdmPrimitiveTypeException e) {
+ throw new ODataApplicationException("Failed to retrieve String value", HttpStatusCode.INTERNAL_SERVER_ERROR
+ .getStatusCode(), Locale.ENGLISH, e);
+ }
+
+ if (valueAsString == null) {
+ return false;
+ }
+
+ boolean matches = valueAsString.equals(keyText);
+ if (!matches) {
+ // if any of the key properties is not found in the entity, we don't need to search further
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/web/DemoServlet.java b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/web/DemoServlet.java
new file mode 100755
index 0000000..fe5cdbb
--- /dev/null
+++ b/samples/tutorials/p2_readep/src/main/java/myservice/mynamespace/web/DemoServlet.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 myservice.mynamespace.web;
+
+import java.io.IOException;
+import java.lang.Override;import java.lang.RuntimeException;import java.util.ArrayList;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import myservice.mynamespace.data.Storage;
+import myservice.mynamespace.service.DemoEdmProvider;
+import myservice.mynamespace.service.DemoEntityCollectionProcessor;
+import myservice.mynamespace.service.DemoEntityProcessor;
+import myservice.mynamespace.service.DemoPrimitiveProcessor;
+
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataHttpHandler;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DemoServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+ private static final Logger LOG = LoggerFactory.getLogger(DemoServlet.class);
+
+
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ try {
+ HttpSession session = req.getSession(true);
+ Storage storage = (Storage) session.getAttribute(Storage.class.getName());
+ if (storage == null) {
+ storage = new Storage();
+ session.setAttribute(Storage.class.getName(), storage);
+ }
+
+ // create odata handler and configure it with EdmProvider and Processor
+ OData odata = OData.newInstance();
+ ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>());
+ ODataHttpHandler handler = odata.createHandler(edm);
+ handler.register(new DemoEntityCollectionProcessor(storage));
+ handler.register(new DemoEntityProcessor(storage));
+ handler.register(new DemoPrimitiveProcessor(storage));
+
+ // let the handler do the work
+ handler.process(req, resp);
+ } catch (RuntimeException e) {
+ LOG.error("Server Error occurred in ExampleServlet", e);
+ throw new ServletException(e);
+ }
+
+ }
+
+}
diff --git a/samples/tutorials/p2_readep/src/main/webapp/WEB-INF/web.xml b/samples/tutorials/p2_readep/src/main/webapp/WEB-INF/web.xml
new file mode 100755
index 0000000..21de52a
--- /dev/null
+++ b/samples/tutorials/p2_readep/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,40 @@
+<?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.
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ id="WebApp_ID" version="2.5">
+
+ <!-- Register the HttpServlet implementation -->
+ <servlet>
+ <servlet-name>DemoServlet</servlet-name>
+ <servlet-class>myservice.mynamespace.web.DemoServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!--
+ Our OData service can be invoked at
+ http://localhost:8080/DemoService/DemoService.svc
+ -->
+ <servlet-mapping>
+ <servlet-name>DemoServlet</servlet-name>
+ <url-pattern>/DemoService.svc/*</url-pattern>
+ </servlet-mapping>
+</web-app>
\ No newline at end of file
diff --git a/samples/tutorials/p2_readep/src/main/webapp/index.jsp b/samples/tutorials/p2_readep/src/main/webapp/index.jsp
new file mode 100755
index 0000000..7ffb4ba
--- /dev/null
+++ b/samples/tutorials/p2_readep/src/main/webapp/index.jsp
@@ -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.
+
+-->
+<html>
+<body>
+<h2>Hello World!</h2>
+<a href="DemoService.svc/">OData Olingo V4 Demo Service</a>
+</body>
+</html>
diff --git a/samples/tutorials/p3_write/pom.xml b/samples/tutorials/p3_write/pom.xml
new file mode 100755
index 0000000..dc9ba69
--- /dev/null
+++ b/samples/tutorials/p3_write/pom.xml
@@ -0,0 +1,79 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>my.group.id</groupId>
+ <artifactId>DemoService-Write</artifactId>
+ <packaging>war</packaging>
+ <version>0.0.1</version>
+
+ <name>${project.artifactId}-Webapp</name>
+
+ <build>
+ <finalName>DemoService</finalName>
+ </build>
+
+ <properties>
+ <javax.version>2.5</javax.version>
+ <odata.version>4.0.0-beta-03</odata.version>
+ <slf4j.version>1.7.7</slf4j.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${javax.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-api</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-core</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-api</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-core</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/data/Storage.java b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/data/Storage.java
new file mode 100755
index 0000000..ad5dd71
--- /dev/null
+++ b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/data/Storage.java
@@ -0,0 +1,263 @@
+/*
+ * 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 myservice.mynamespace.data;
+
+import myservice.mynamespace.service.DemoEdmProvider;
+import myservice.mynamespace.util.Util;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
+import org.apache.olingo.commons.api.http.HttpMethod;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.uri.UriParameter;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+public class Storage {
+
+ private List<Entity> productList;
+
+ public Storage() {
+ productList = new ArrayList<Entity>();
+ initSampleData();
+ }
+
+ /* PUBLIC FACADE */
+
+ public EntityCollection readEntitySetData(EdmEntitySet edmEntitySet) throws ODataApplicationException {
+
+ // actually, this is only required if we have more than one Entity Sets
+ if (edmEntitySet.getName().equals(DemoEdmProvider.ES_PRODUCTS_NAME)) {
+ return getProducts();
+ }
+
+ return null;
+ }
+
+ public Entity readEntityData(EdmEntitySet edmEntitySet, List<UriParameter> keyParams)
+ throws ODataApplicationException {
+
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+ // actually, this is only required if we have more than one Entity Type
+ if (edmEntityType.getName().equals(DemoEdmProvider.ET_PRODUCT_NAME)) {
+ return getProduct(edmEntityType, keyParams);
+ }
+
+ return null;
+ }
+
+ public Entity createEntityData(EdmEntitySet edmEntitySet, Entity entityToCreate) {
+
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+ // actually, this is only required if we have more than one Entity Type
+ if (edmEntityType.getName().equals(DemoEdmProvider.ET_PRODUCT_NAME)) {
+ return createProduct(edmEntityType, entityToCreate);
+ }
+
+ return null;
+ }
+
+ /**
+ * This method is invoked for PATCH or PUT requests
+ * */
+ public void updateEntityData(EdmEntitySet edmEntitySet, List<UriParameter> keyParams, Entity updateEntity,
+ HttpMethod httpMethod) throws ODataApplicationException {
+
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+ // actually, this is only required if we have more than one Entity Type
+ if (edmEntityType.getName().equals(DemoEdmProvider.ET_PRODUCT_NAME)) {
+ updateProduct(edmEntityType, keyParams, updateEntity, httpMethod);
+ }
+ }
+
+ public void deleteEntityData(EdmEntitySet edmEntitySet, List<UriParameter> keyParams)
+ throws ODataApplicationException {
+
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+ // actually, this is only required if we have more than one Entity Type
+ if (edmEntityType.getName().equals(DemoEdmProvider.ET_PRODUCT_NAME)) {
+ deleteProduct(edmEntityType, keyParams);
+ }
+ }
+
+ /* INTERNAL */
+
+ private EntityCollection getProducts() {
+ EntityCollection retEntitySet = new EntityCollection();
+
+ for (Entity productEntity : this.productList) {
+ retEntitySet.getEntities().add(productEntity);
+ }
+
+ return retEntitySet;
+ }
+
+ private Entity getProduct(EdmEntityType edmEntityType, List<UriParameter> keyParams)
+ throws ODataApplicationException {
+
+ // the list of entities at runtime
+ EntityCollection entitySet = getProducts();
+
+ /* generic approach to find the requested entity */
+ Entity requestedEntity = Util.findEntity(edmEntityType, entitySet, keyParams);
+
+ if (requestedEntity == null) {
+ // this variable is null if our data doesn't contain an entity for the requested key
+ // Throw suitable exception
+ throw new ODataApplicationException("Entity for requested key doesn't exist",
+ HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ return requestedEntity;
+ }
+
+ private Entity createProduct(EdmEntityType edmEntityType, Entity entity) {
+
+ // the ID of the newly created product entity is generated automatically
+ int newId = 1;
+ while (productIdExists(newId)) {
+ newId++;
+ }
+
+ Property idProperty = entity.getProperty("ID");
+ if (idProperty != null) {
+ idProperty.setValue(ValueType.PRIMITIVE, new Integer(newId));
+ } else {
+ // as of OData v4 spec, the key property can be omitted from the POST request body
+ entity.getProperties().add(new Property(null, "ID", ValueType.PRIMITIVE, newId));
+ }
+
+ this.productList.add(entity);
+
+ return entity;
+
+ }
+
+ private boolean productIdExists(int id) {
+
+ for (Entity entity : this.productList) {
+ Integer existingID = (Integer) entity.getProperty("ID").getValue();
+ if (existingID.intValue() == id) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private void updateProduct(EdmEntityType edmEntityType, List<UriParameter> keyParams, Entity entity,
+ HttpMethod httpMethod) throws ODataApplicationException {
+
+ Entity productEntity = getProduct(edmEntityType, keyParams);
+ if (productEntity == null) {
+ throw new ODataApplicationException("Entity not found", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ // loop over all properties and replace the values with the values of the given payload
+ // Note: ignoring ComplexType, as we don't have it in our odata model
+ List<Property> existingProperties = productEntity.getProperties();
+ for (Property existingProp : existingProperties) {
+ String propName = existingProp.getName();
+
+ // ignore the key properties, they aren't updateable
+ if (isKey(edmEntityType, propName)) {
+ continue;
+ }
+
+ Property updateProperty = entity.getProperty(propName);
+ // the request payload might not consider ALL properties, so it can be null
+ if (updateProperty == null) {
+ // if a property has NOT been added to the request payload
+ // depending on the HttpMethod, our behavior is different
+ if (httpMethod.equals(HttpMethod.PATCH)) {
+ // as of the OData spec, in case of PATCH, the existing property is not touched
+ continue; // do nothing
+ } else if (httpMethod.equals(HttpMethod.PUT)) {
+ // as of the OData spec, in case of PUT, the existing property is set to null (or to default value)
+ existingProp.setValue(existingProp.getValueType(), null);
+ continue;
+ }
+ }
+
+ // change the value of the properties
+ existingProp.setValue(existingProp.getValueType(), updateProperty.getValue());
+ }
+ }
+
+ private void deleteProduct(EdmEntityType edmEntityType, List<UriParameter> keyParams)
+ throws ODataApplicationException {
+
+ Entity productEntity = getProduct(edmEntityType, keyParams);
+ if (productEntity == null) {
+ throw new ODataApplicationException("Entity not found", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ this.productList.remove(productEntity);
+ }
+
+ /* HELPER */
+
+ private boolean isKey(EdmEntityType edmEntityType, String propertyName) {
+ List<EdmKeyPropertyRef> keyPropertyRefs = edmEntityType.getKeyPropertyRefs();
+ for (EdmKeyPropertyRef propRef : keyPropertyRefs) {
+ String keyPropertyName = propRef.getName();
+ if (keyPropertyName.equals(propertyName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void initSampleData() {
+
+ // add some sample product entities
+ productList.add(new Entity()
+ .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 1))
+ .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Notebook Basic 15"))
+ .addProperty(
+ new Property(null, "Description", ValueType.PRIMITIVE,
+ "Notebook Basic, 1.7GHz - 15 XGA - 1024MB DDR2 SDRAM - 40GB")));
+
+ productList.add(new Entity()
+ .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 2))
+ .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "1UMTS PDA"))
+ .addProperty(
+ new Property(null, "Description", ValueType.PRIMITIVE,
+ "Ultrafast 3G UMTS/HSDPA Pocket PC, supports GSM network")));
+
+ productList.add(new Entity()
+ .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 3))
+ .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Ergo Screen"))
+ .addProperty(
+ new Property(null, "Description", ValueType.PRIMITIVE,
+ "19 Optimum Resolution 1024 x 768 @ 85Hz, resolution 1280 x 960")));
+
+ }
+}
diff --git a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
new file mode 100755
index 0000000..f842af8
--- /dev/null
+++ b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
@@ -0,0 +1,157 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
+import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
+import org.apache.olingo.commons.api.edm.provider.CsdlPropertyRef;
+import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
+
+/*
+ * this class is supposed to declare the metadata of the OData service
+ * it is invoked by the Olingo framework e.g. when the metadata document of the service is invoked
+ * e.g. http://localhost:8080/ExampleService1/ExampleService1.svc/$metadata
+ */
+public class DemoEdmProvider extends CsdlAbstractEdmProvider {
+
+ // Service Namespace
+ public static final String NAMESPACE = "OData.Demo";
+
+ // EDM Container
+ public static final String CONTAINER_NAME = "Container";
+ public static final FullQualifiedName CONTAINER = new FullQualifiedName(NAMESPACE, CONTAINER_NAME);
+
+ // Entity Types Names
+ public static final String ET_PRODUCT_NAME = "Product";
+ public static final FullQualifiedName ET_PRODUCT_FQN = new FullQualifiedName(NAMESPACE, ET_PRODUCT_NAME);
+
+ // Entity Set Names
+ public static final String ES_PRODUCTS_NAME = "Products";
+
+
+ @Override
+ public List<CsdlSchema> getSchemas() throws ODataException {
+
+ // create Schema
+ CsdlSchema schema = new CsdlSchema();
+ schema.setNamespace(NAMESPACE);
+
+ // add EntityTypes
+ List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
+ entityTypes.add(getEntityType(ET_PRODUCT_FQN));
+ schema.setEntityTypes(entityTypes);
+
+ // add EntityContainer
+ schema.setEntityContainer(getEntityContainer());
+
+ // finally
+ List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
+ schemas.add(schema);
+
+ return schemas;
+ }
+
+
+ @Override
+ public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) throws ODataException {
+ // this method is called for one of the EntityTypes that are configured in the Schema
+ if(entityTypeName.equals(ET_PRODUCT_FQN)){
+
+ //create EntityType properties
+ CsdlProperty id = new CsdlProperty().setName("ID")
+ .setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
+ CsdlProperty name = new CsdlProperty().setName("Name")
+ .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+ CsdlProperty description = new CsdlProperty().setName("Description")
+ .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+
+ // create CsdlPropertyRef for Key element
+ CsdlPropertyRef propertyRef = new CsdlPropertyRef();
+ propertyRef.setName("ID");
+
+ // configure EntityType
+ CsdlEntityType entityType = new CsdlEntityType();
+ entityType.setName(ET_PRODUCT_NAME);
+ entityType.setProperties(Arrays.asList(id, name, description));
+ entityType.setKey(Collections.singletonList(propertyRef));
+
+ return entityType;
+ }
+
+ return null;
+
+ }
+
+ @Override
+ public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) throws ODataException {
+
+ if(entityContainer.equals(CONTAINER)){
+ if(entitySetName.equals(ES_PRODUCTS_NAME)){
+ CsdlEntitySet entitySet = new CsdlEntitySet();
+ entitySet.setName(ES_PRODUCTS_NAME);
+ entitySet.setType(ET_PRODUCT_FQN);
+
+ return entitySet;
+ }
+ }
+
+ return null;
+
+ }
+
+
+ public CsdlEntityContainer getEntityContainer() throws ODataException {
+ // create EntitySets
+ List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
+ entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
+
+ // create EntityContainer
+ CsdlEntityContainer entityContainer = new CsdlEntityContainer();
+ entityContainer.setName(CONTAINER_NAME);
+ entityContainer.setEntitySets(entitySets);
+
+ return entityContainer;
+
+ }
+
+ @Override
+ public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) throws ODataException {
+
+ // This method is invoked when displaying the service document at
+ // e.g. http://localhost:8080/DemoService/DemoService.svc
+ if (entityContainerName == null || entityContainerName.equals(CONTAINER)) {
+ CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
+ entityContainerInfo.setContainerName(CONTAINER);
+ return entityContainerInfo;
+ }
+ return null;
+ }
+}
diff --git a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
new file mode 100755
index 0000000..53470cb
--- /dev/null
+++ b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.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 myservice.mynamespace.service;
+
+import java.util.List;
+
+import myservice.mynamespace.data.Storage;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.processor.EntityCollectionProcessor;
+import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+
+public class DemoEntityCollectionProcessor implements EntityCollectionProcessor {
+
+ private OData odata;
+ private Storage storage;
+ private ServiceMetadata serviceMetadata;
+
+
+ public DemoEntityCollectionProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+ this.serviceMetadata = serviceMetadata;
+ }
+
+ public void readEntityCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo,
+ ContentType responseFormat) throws ODataApplicationException, SerializerException {
+
+ // 1st retrieve the requested EntitySet from the uriInfo (representation of the parsed URI)
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ // in our example, the first segment is the EntitySet
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
+ EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
+
+ // 2nd: fetch the data from backend for this requested EntitySetName
+ // it has to be delivered as EntitySet object
+ EntityCollection entitySet = storage.readEntitySetData(edmEntitySet);
+
+ // 3rd: create a serializer based on the requested format (json)
+ ODataFormat format = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = odata.createSerializer(format);
+
+ // and serialize the content: transform from the EntitySet object to InputStream
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).build();
+
+ EntityCollectionSerializerOptions opts = EntityCollectionSerializerOptions.with().contextURL(contextUrl).build();
+ SerializerResult serializedContent = serializer.entityCollection(serviceMetadata, edmEntityType, entitySet, opts);
+
+ // Finally: configure the response object: set the body, headers and status code
+ response.setContent(serializedContent.getContent());
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ }
+}
diff --git a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
new file mode 100755
index 0000000..35d4203
--- /dev/null
+++ b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
@@ -0,0 +1,190 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.io.InputStream;
+import java.util.List;
+
+import myservice.mynamespace.data.Storage;
+import myservice.mynamespace.util.Util;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpMethod;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.deserializer.DeserializerResult;
+import org.apache.olingo.server.api.deserializer.ODataDeserializer;
+import org.apache.olingo.server.api.processor.EntityProcessor;
+import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+
+public class DemoEntityProcessor implements EntityProcessor {
+
+ private OData odata;
+ private Storage storage;
+ private ServiceMetadata serviceMetadata;
+
+ public DemoEntityProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+ this.serviceMetadata = serviceMetadata;
+ }
+
+
+ public void readEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
+ throws ODataApplicationException, SerializerException {
+
+ // 1. retrieve the Entity Type
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ // Note: only in our example we can assume that the first segment is the EntitySet
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
+ EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
+
+ // 2. retrieve the data from backend
+ List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
+ Entity entity = storage.readEntityData(edmEntitySet, keyPredicates);
+
+ // 3. serialize
+ EdmEntityType entityType = edmEntitySet.getEntityType();
+
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).suffix(ContextURL.Suffix.ENTITY).build();
+ // expand and select currently not supported
+ EntitySerializerOptions options = EntitySerializerOptions.with().contextURL(contextUrl).build();
+
+ ODataFormat oDataFormat = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = this.odata.createSerializer(oDataFormat);
+ SerializerResult result = serializer.entity(serviceMetadata, entityType, entity, options);
+
+ //4. configure the response object
+ response.setContent(result.getContent());
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ }
+
+ /*
+ * Example request:
+ *
+ * POST URL: http://localhost:8080/DemoService/DemoService.svc/Products
+ * Header: Content-Type: application/json; odata.metadata=minimal
+ * Request body:
+ {
+ "ID":3,
+ "Name":"Ergo Screen",
+ "Description":"17 Optimum Resolution 1024 x 768 @ 85Hz, resolution 1280 x 960"
+ }
+ * */
+ public void createEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo,
+ ContentType requestFormat, ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+
+ // 1. Retrieve the entity type from the URI
+ EdmEntitySet edmEntitySet = Util.getEdmEntitySet(uriInfo);
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+ // 2. create the data in backend
+ // 2.1. retrieve the payload from the POST request for the entity to create and deserialize it
+ InputStream requestInputStream = request.getBody();
+ ODataFormat requestODataFormat = ODataFormat.fromContentType(requestFormat);
+ ODataDeserializer deserializer = this.odata.createDeserializer(requestODataFormat);
+ DeserializerResult result = deserializer.entity(requestInputStream, edmEntityType);
+ Entity requestEntity = result.getEntity();
+ // 2.2 do the creation in backend, which returns the newly created entity
+ Entity createdEntity = storage.createEntityData(edmEntitySet, requestEntity);
+
+ // 3. serialize the response (we have to return the created entity)
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).build();
+ EntitySerializerOptions options = EntitySerializerOptions.with().contextURL(contextUrl).build(); // expand and select currently not supported
+
+ ODataFormat oDataFormat = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = this.odata.createSerializer(oDataFormat);
+ SerializerResult serializedResponse = serializer.entity(serviceMetadata, edmEntityType, createdEntity, options);
+
+ //4. configure the response object
+ response.setContent(serializedResponse.getContent());
+ response.setStatusCode(HttpStatusCode.CREATED.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ }
+
+
+ public void updateEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo,
+ ContentType requestFormat, ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+
+ // 1. Retrieve the entity set which belongs to the requested entity
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ // Note: only in our example we can assume that the first segment is the EntitySet
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
+ EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+ // 2. update the data in backend
+ // 2.1. retrieve the payload from the PUT request for the entity to be updated
+ InputStream requestInputStream = request.getBody();
+ ODataFormat requestODataFormat = ODataFormat.fromContentType(requestFormat);
+ ODataDeserializer deserializer = this.odata.createDeserializer(requestODataFormat);
+ DeserializerResult result = deserializer.entity(requestInputStream, edmEntityType);
+ Entity requestEntity = result.getEntity();
+ // 2.2 do the modification in backend
+ List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
+ // Note that this updateEntity()-method is invoked for both PUT or PATCH operations
+ HttpMethod httpMethod = request.getMethod();
+ storage.updateEntityData(edmEntitySet, keyPredicates, requestEntity, httpMethod);
+
+ //3. configure the response object
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+
+
+ public void deleteEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo)
+ throws ODataApplicationException {
+
+ // 1. Retrieve the entity set which belongs to the requested entity
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ // Note: only in our example we can assume that the first segment is the EntitySet
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
+ EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
+
+ // 2. delete the data in backend
+ List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
+ storage.deleteEntityData(edmEntitySet, keyPredicates);
+
+ //3. configure the response object
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+}
diff --git a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
new file mode 100755
index 0000000..ccf6d2b
--- /dev/null
+++ b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
@@ -0,0 +1,146 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.data.Storage;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.processor.PrimitiveProcessor;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.server.api.uri.UriResourceProperty;
+
+public class DemoPrimitiveProcessor implements PrimitiveProcessor {
+
+ private OData odata;
+ private Storage storage;
+
+ public DemoPrimitiveProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+ }
+
+ /*
+ * In our example, the URL would be: http://localhost:8080/DemoService/DemoService.svc/Products(1)/Name
+ * and the response:
+ * {
+ * @odata.context: "$metadata#Products/Name",
+ * value: "Notebook Basic 15"
+ * }
+ * */
+ public void readPrimitive(ODataRequest request, ODataResponse response,
+ UriInfo uriInfo, ContentType responseFormat)
+ throws ODataApplicationException, SerializerException {
+
+ // 1. Retrieve info from URI
+ // 1.1. retrieve the info about the requested entity set
+ List<UriResource> resourceParts = uriInfo.getUriResourceParts();
+ // Note: only in our example we can rely that the first segment is the EntitySet
+ UriResourceEntitySet uriEntityset = (UriResourceEntitySet) resourceParts.get(0);
+ EdmEntitySet edmEntitySet = uriEntityset.getEntitySet();
+ // the key for the entity
+ List<UriParameter> keyPredicates = uriEntityset.getKeyPredicates();
+
+ // 1.2. retrieve the requested (Edm) property
+ UriResourceProperty uriProperty = (UriResourceProperty)resourceParts.get(resourceParts.size() -1); // the last segment is the Property
+ EdmProperty edmProperty = uriProperty.getProperty();
+ String edmPropertyName = edmProperty.getName();
+ // in our example, we know we have only primitive types in our model
+ EdmPrimitiveType edmPropertyType = (EdmPrimitiveType) edmProperty.getType();
+
+
+ // 2. retrieve data from backend
+ // 2.1. retrieve the entity data, for which the property has to be read
+ Entity entity = storage.readEntityData(edmEntitySet, keyPredicates);
+ if (entity == null) { // Bad request
+ throw new ODataApplicationException("Entity not found",
+ HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ // 2.2. retrieve the property data from the entity
+ Property property = entity.getProperty(edmPropertyName);
+ if (property == null) {
+ throw new ODataApplicationException("Property not found",
+ HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ // 3. serialize
+ Object value = property.getValue();
+ if (value != null) {
+ // 3.1. configure the serializer
+ ODataFormat format = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = odata.createSerializer(format);
+
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).navOrPropertyPath(edmPropertyName).build();
+ PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextUrl).build();
+ // 3.2. serialize
+ SerializerResult result = serializer.primitive(edmPropertyType, property, options);
+
+ //4. configure the response object
+ response.setContent(result.getContent());
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ }else{
+ // in case there's no value for the property, we can skip the serialization
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+ }
+
+ /*
+ * These processor methods are not handled in this tutorial
+ *
+ * */
+ public void updatePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo,
+ ContentType requestFormat, ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ public void deletePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo)
+ throws ODataApplicationException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+}
diff --git a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/util/Util.java b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/util/Util.java
new file mode 100755
index 0000000..035cc7b
--- /dev/null
+++ b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/util/Util.java
@@ -0,0 +1,121 @@
+/*
+ * 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 myservice.mynamespace.util;
+
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.uri.UriInfoResource;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+
+public class Util {
+
+ public static EdmEntitySet getEdmEntitySet(UriInfoResource uriInfo) throws ODataApplicationException {
+
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ // To get the entity set we have to interpret all URI segments
+ if (!(resourcePaths.get(0) instanceof UriResourceEntitySet)) {
+ // Here we should interpret the whole URI but in this example we do not support navigation so we throw an
+ // exception
+ throw new ODataApplicationException("Invalid resource type for first segment.", HttpStatusCode.NOT_IMPLEMENTED
+ .getStatusCode(), Locale.ENGLISH);
+ }
+
+ UriResourceEntitySet uriResource = (UriResourceEntitySet) resourcePaths.get(0);
+
+ return uriResource.getEntitySet();
+ }
+
+ public static Entity findEntity(EdmEntityType edmEntityType, EntityCollection entitySet,
+ List<UriParameter> keyParams) throws ODataApplicationException {
+
+ List<Entity> entityList = entitySet.getEntities();
+
+ // loop over all entities in order to find that one that matches all keys in request
+ // e.g. contacts(ContactID=1, CompanyID=1)
+ for (Entity entity: entityList) {
+ boolean foundEntity = entityMatchesAllKeys(edmEntityType, entity, keyParams);
+ if (foundEntity) {
+ return entity;
+ }
+ }
+
+ return null;
+ }
+
+ public static boolean entityMatchesAllKeys(EdmEntityType edmEntityType, Entity entity, List<UriParameter> keyParams)
+ throws ODataApplicationException {
+
+ // loop over all keys
+ for (final UriParameter key : keyParams) {
+ // key
+ String keyName = key.getName();
+ String keyText = key.getText();
+
+ // Edm: we need this info for the comparison below
+ EdmProperty edmKeyProperty = (EdmProperty) edmEntityType.getProperty(keyName);
+ Boolean isNullable = edmKeyProperty.isNullable();
+ Integer maxLength = edmKeyProperty.getMaxLength();
+ Integer precision = edmKeyProperty.getPrecision();
+ Boolean isUnicode = edmKeyProperty.isUnicode();
+ Integer scale = edmKeyProperty.getScale();
+ // get the EdmType in order to compare
+ EdmType edmType = edmKeyProperty.getType();
+ EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) edmType;
+
+ // Runtime data: the value of the current entity
+ // don't need to check for null, this is done in olingo library
+ Object valueObject = entity.getProperty(keyName).getValue();
+
+ // now need to compare the valueObject with the keyText String
+ // this is done using the type.valueToString //
+ String valueAsString = null;
+ try {
+ valueAsString = edmPrimitiveType.valueToString(valueObject, isNullable, maxLength, precision, scale, isUnicode);
+ } catch (EdmPrimitiveTypeException e) {
+ throw new ODataApplicationException("Failed to retrieve String value", HttpStatusCode.INTERNAL_SERVER_ERROR
+ .getStatusCode(), Locale.ENGLISH, e);
+ }
+
+ if (valueAsString == null) {
+ return false;
+ }
+
+ boolean matches = valueAsString.equals(keyText);
+ if (!matches) {
+ // if any of the key properties is not found in the entity, we don't need to search further
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/web/DemoServlet.java b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/web/DemoServlet.java
new file mode 100755
index 0000000..2e7b65f
--- /dev/null
+++ b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/web/DemoServlet.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 myservice.mynamespace.web;
+
+import java.io.IOException;
+import java.lang.Override;import java.lang.RuntimeException;import java.util.ArrayList;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import myservice.mynamespace.data.Storage;
+import myservice.mynamespace.service.DemoEdmProvider;
+import myservice.mynamespace.service.DemoEntityCollectionProcessor;
+import myservice.mynamespace.service.DemoEntityProcessor;
+import myservice.mynamespace.service.DemoPrimitiveProcessor;
+
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataHttpHandler;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DemoServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+ private static final Logger LOG = LoggerFactory.getLogger(DemoServlet.class);
+
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ try {
+ HttpSession session = req.getSession(true);
+ Storage storage = (Storage) session.getAttribute(Storage.class.getName());
+ if (storage == null) {
+ storage = new Storage();
+ session.setAttribute(Storage.class.getName(), storage);
+ }
+
+ // create odata handler and configure it with EdmProvider and Processor
+ OData odata = OData.newInstance();
+ ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>());
+ ODataHttpHandler handler = odata.createHandler(edm);
+ handler.register(new DemoEntityCollectionProcessor(storage));
+ handler.register(new DemoEntityProcessor(storage));
+ handler.register(new DemoPrimitiveProcessor(storage));
+
+ // let the handler do the work
+ handler.process(req, resp);
+ } catch (RuntimeException e) {
+ LOG.error("Server Error occurred in ExampleServlet", e);
+ throw new ServletException(e);
+ }
+ }
+}
diff --git a/samples/tutorials/p3_write/src/main/webapp/WEB-INF/web.xml b/samples/tutorials/p3_write/src/main/webapp/WEB-INF/web.xml
new file mode 100755
index 0000000..21de52a
--- /dev/null
+++ b/samples/tutorials/p3_write/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,40 @@
+<?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.
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ id="WebApp_ID" version="2.5">
+
+ <!-- Register the HttpServlet implementation -->
+ <servlet>
+ <servlet-name>DemoServlet</servlet-name>
+ <servlet-class>myservice.mynamespace.web.DemoServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!--
+ Our OData service can be invoked at
+ http://localhost:8080/DemoService/DemoService.svc
+ -->
+ <servlet-mapping>
+ <servlet-name>DemoServlet</servlet-name>
+ <url-pattern>/DemoService.svc/*</url-pattern>
+ </servlet-mapping>
+</web-app>
\ No newline at end of file
diff --git a/samples/tutorials/p3_write/src/main/webapp/index.jsp b/samples/tutorials/p3_write/src/main/webapp/index.jsp
new file mode 100755
index 0000000..7ffb4ba
--- /dev/null
+++ b/samples/tutorials/p3_write/src/main/webapp/index.jsp
@@ -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.
+
+-->
+<html>
+<body>
+<h2>Hello World!</h2>
+<a href="DemoService.svc/">OData Olingo V4 Demo Service</a>
+</body>
+</html>
diff --git a/samples/tutorials/p4_navigation/pom.xml b/samples/tutorials/p4_navigation/pom.xml
new file mode 100755
index 0000000..e24efea
--- /dev/null
+++ b/samples/tutorials/p4_navigation/pom.xml
@@ -0,0 +1,80 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>my.group.id</groupId>
+ <artifactId>DemoService-Navigation</artifactId>
+ <packaging>war</packaging>
+ <version>0.0.1</version>
+
+ <name>${project.artifactId}-Webapp</name>
+
+ <build>
+ <finalName>DemoService</finalName>
+ </build>
+
+ <properties>
+ <javax.version>2.5</javax.version>
+ <odata.version>4.0.0-beta-03</odata.version>
+ <slf4j.version>1.7.7</slf4j.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${javax.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-api</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-core</artifactId>
+ <version>${odata.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-api</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-core</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/data/Storage.java b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/data/Storage.java
new file mode 100755
index 0000000..2034fe6
--- /dev/null
+++ b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/data/Storage.java
@@ -0,0 +1,252 @@
+/*
+ * 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 myservice.mynamespace.data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import myservice.mynamespace.service.DemoEdmProvider;
+import myservice.mynamespace.util.Util;
+
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.server.api.uri.UriParameter;
+
+public class Storage {
+
+ // represent our database
+ private List<Entity> productList;
+ private List<Entity> categoryList;
+
+ public Storage() {
+
+ productList = new ArrayList<Entity>();
+ categoryList = new ArrayList<Entity>();
+
+ // creating some sample data
+ initProductSampleData();
+ initCategorySampleData();
+ }
+
+ /* PUBLIC FACADE */
+
+ public EntityCollection readEntitySetData(EdmEntitySet edmEntitySet) {
+ EntityCollection entitySet = null;
+
+ if (edmEntitySet.getName().equals(DemoEdmProvider.ES_PRODUCTS_NAME)) {
+ entitySet = getProducts();
+ } else if (edmEntitySet.getName().equals(DemoEdmProvider.ES_CATEGORIES_NAME)) {
+ entitySet = getCategories();
+ }
+
+ return entitySet;
+ }
+
+ public Entity readEntityData(EdmEntitySet edmEntitySet, List<UriParameter> keyParams) {
+ Entity entity = null;
+
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+ if (edmEntityType.getName().equals(DemoEdmProvider.ET_PRODUCT_NAME)) {
+ entity = getProduct(edmEntityType, keyParams);
+ } else if (edmEntityType.getName().equals(DemoEdmProvider.ET_CATEGORY_NAME)) {
+ entity = getCategory(edmEntityType, keyParams);
+ }
+
+ return entity;
+ }
+
+ // Navigation
+
+ public Entity getRelatedEntity(Entity entity, EdmEntityType relatedEntityType) {
+ EntityCollection collection = getRelatedEntityCollection(entity, relatedEntityType);
+ if (collection.getEntities().isEmpty()) {
+ return null;
+ }
+ return collection.getEntities().get(0);
+ }
+
+ public Entity getRelatedEntity(Entity entity, EdmEntityType relatedEntityType, List<UriParameter> keyPredicates) {
+
+ EntityCollection relatedEntities = getRelatedEntityCollection(entity, relatedEntityType);
+ return Util.findEntity(relatedEntityType, relatedEntities, keyPredicates);
+ }
+
+ public EntityCollection getRelatedEntityCollection(Entity sourceEntity, EdmEntityType targetEntityType) {
+ EntityCollection navigationTargetEntityCollection = new EntityCollection();
+
+ FullQualifiedName relatedEntityFqn = targetEntityType.getFullQualifiedName();
+ String sourceEntityFqn = sourceEntity.getType();
+
+ if (sourceEntityFqn.equals(DemoEdmProvider.ET_PRODUCT_FQN.getFullQualifiedNameAsString())
+ && relatedEntityFqn.equals(DemoEdmProvider.ET_CATEGORY_FQN)) {
+ // relation Products->Category (result all categories)
+ int productID = (Integer) sourceEntity.getProperty("ID").getValue();
+ if (productID == 1 || productID == 2) {
+ navigationTargetEntityCollection.getEntities().add(categoryList.get(0));
+ } else if (productID == 3 || productID == 4) {
+ navigationTargetEntityCollection.getEntities().add(categoryList.get(1));
+ } else if (productID == 5 || productID == 6) {
+ navigationTargetEntityCollection.getEntities().add(categoryList.get(2));
+ }
+ } else if (sourceEntityFqn.equals(DemoEdmProvider.ET_CATEGORY_FQN.getFullQualifiedNameAsString())
+ && relatedEntityFqn.equals(DemoEdmProvider.ET_PRODUCT_FQN)) {
+ // relation Category->Products (result all products)
+ int categoryID = (Integer) sourceEntity.getProperty("ID").getValue();
+ if (categoryID == 1) {
+ // the first 2 products are notebooks
+ navigationTargetEntityCollection.getEntities().addAll(productList.subList(0, 2));
+ } else if (categoryID == 2) {
+ // the next 2 products are organizers
+ navigationTargetEntityCollection.getEntities().addAll(productList.subList(2, 4));
+ } else if (categoryID == 3) {
+ // the first 2 products are monitors
+ navigationTargetEntityCollection.getEntities().addAll(productList.subList(4, 6));
+ }
+ }
+
+ if (navigationTargetEntityCollection.getEntities().isEmpty()) {
+ return null;
+ }
+
+ return navigationTargetEntityCollection;
+ }
+
+ /* INTERNAL */
+
+ private EntityCollection getProducts() {
+ EntityCollection retEntitySet = new EntityCollection();
+
+ for (Entity productEntity : this.productList) {
+ retEntitySet.getEntities().add(productEntity);
+ }
+
+ return retEntitySet;
+ }
+
+ private Entity getProduct(EdmEntityType edmEntityType, List<UriParameter> keyParams) {
+
+ // the list of entities at runtime
+ EntityCollection entityCollection = getProducts();
+
+ /* generic approach to find the requested entity */
+ return Util.findEntity(edmEntityType, entityCollection, keyParams);
+ }
+
+ private EntityCollection getCategories() {
+ EntityCollection entitySet = new EntityCollection();
+
+ for (Entity categoryEntity : this.categoryList) {
+ entitySet.getEntities().add(categoryEntity);
+ }
+
+ return entitySet;
+ }
+
+ private Entity getCategory(EdmEntityType edmEntityType, List<UriParameter> keyParams) {
+
+ // the list of entities at runtime
+ EntityCollection entitySet = getCategories();
+
+ /* generic approach to find the requested entity */
+ return Util.findEntity(edmEntityType, entitySet, keyParams);
+ }
+
+ /* HELPER */
+
+ private void initProductSampleData() {
+
+ Entity entity = new Entity();
+
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 1));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Notebook Basic 15"));
+ entity.addProperty(new Property(null, "Description", ValueType.PRIMITIVE,
+ "Notebook Basic, 1.7GHz - 15 XGA - 1024MB DDR2 SDRAM - 40GB"));
+ entity.setType(DemoEdmProvider.ET_PRODUCT_FQN.getFullQualifiedNameAsString());
+ productList.add(entity);
+
+ entity = new Entity();
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 2));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Notebook Professional 17"));
+ entity.addProperty(new Property(null, "Description", ValueType.PRIMITIVE,
+ "Notebook Professional, 2.8GHz - 15 XGA - 8GB DDR3 RAM - 500GB"));
+ entity.setType(DemoEdmProvider.ET_PRODUCT_FQN.getFullQualifiedNameAsString());
+ productList.add(entity);
+
+ entity = new Entity();
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 3));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "1UMTS PDA"));
+ entity.addProperty(new Property(null, "Description", ValueType.PRIMITIVE,
+ "Ultrafast 3G UMTS/HSDPA Pocket PC, supports GSM network"));
+ entity.setType(DemoEdmProvider.ET_PRODUCT_FQN.getFullQualifiedNameAsString());
+ productList.add(entity);
+
+ entity = new Entity();
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 4));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Comfort Easy"));
+ entity.addProperty(new Property(null, "Description", ValueType.PRIMITIVE,
+ "32 GB Digital Assitant with high-resolution color screen"));
+ entity.setType(DemoEdmProvider.ET_PRODUCT_FQN.getFullQualifiedNameAsString());
+ productList.add(entity);
+
+ entity = new Entity();
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 5));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Ergo Screen"));
+ entity.addProperty(new Property(null, "Description", ValueType.PRIMITIVE,
+ "19 Optimum Resolution 1024 x 768 @ 85Hz, resolution 1280 x 960"));
+ entity.setType(DemoEdmProvider.ET_PRODUCT_FQN.getFullQualifiedNameAsString());
+ productList.add(entity);
+
+ entity = new Entity();
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 6));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Flat Basic"));
+ entity.addProperty(new Property(null, "Description", ValueType.PRIMITIVE,
+ "Optimum Hi-Resolution max. 1600 x 1200 @ 85Hz, Dot Pitch: 0.24mm"));
+ entity.setType(DemoEdmProvider.ET_PRODUCT_FQN.getFullQualifiedNameAsString());
+ productList.add(entity);
+ }
+
+ private void initCategorySampleData() {
+
+ Entity entity = new Entity();
+
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 1));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Notebooks"));
+ entity.setType(DemoEdmProvider.ET_CATEGORY_FQN.getFullQualifiedNameAsString());
+ categoryList.add(entity);
+
+ entity = new Entity();
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 2));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Organizers"));
+ entity.setType(DemoEdmProvider.ET_CATEGORY_FQN.getFullQualifiedNameAsString());
+ categoryList.add(entity);
+
+ entity = new Entity();
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 3));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Monitors"));
+ entity.setType(DemoEdmProvider.ET_CATEGORY_FQN.getFullQualifiedNameAsString());
+ categoryList.add(entity);
+ }
+
+}
diff --git a/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
new file mode 100755
index 0000000..7b1fef8
--- /dev/null
+++ b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
@@ -0,0 +1,211 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+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.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
+import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty;
+import org.apache.olingo.commons.api.edm.provider.CsdlNavigationPropertyBinding;
+import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
+import org.apache.olingo.commons.api.edm.provider.CsdlPropertyRef;
+import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
+
+public class DemoEdmProvider extends CsdlAbstractEdmProvider {
+
+ // Service Namespace
+ public static final String NAMESPACE = "OData.Demo";
+
+ // EDM Container
+ public static final String CONTAINER_NAME = "Container";
+ public static final FullQualifiedName CONTAINER = new FullQualifiedName(NAMESPACE, CONTAINER_NAME);
+
+ // Entity Types Names
+ public static final String ET_PRODUCT_NAME = "Product";
+ public static final FullQualifiedName ET_PRODUCT_FQN = new FullQualifiedName(NAMESPACE, ET_PRODUCT_NAME);
+
+ public static final String ET_CATEGORY_NAME = "Category";
+ public static final FullQualifiedName ET_CATEGORY_FQN = new FullQualifiedName(NAMESPACE, ET_CATEGORY_NAME);
+
+ // Entity Set Names
+ public static final String ES_PRODUCTS_NAME = "Products";
+ public static final String ES_CATEGORIES_NAME = "Categories";
+
+ @Override
+ public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) throws ODataException {
+
+ // this method is called for each EntityType that are configured in the Schema
+ CsdlEntityType entityType = null;
+
+ if (entityTypeName.equals(ET_PRODUCT_FQN)) {
+ // create EntityType properties
+ CsdlProperty id = new CsdlProperty().setName("ID")
+ .setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
+ CsdlProperty name = new CsdlProperty().setName("Name")
+ .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+ CsdlProperty description = new CsdlProperty().setName("Description")
+ .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+
+ // create PropertyRef for Key element
+ CsdlPropertyRef propertyRef = new CsdlPropertyRef();
+ propertyRef.setName("ID");
+
+ // navigation property: many-to-one, null not allowed (product must have a category)
+ CsdlNavigationProperty navProp = new CsdlNavigationProperty().setName("Category")
+ .setType(ET_CATEGORY_FQN).setNullable(false).setPartner("Products");
+ List<CsdlNavigationProperty> navPropList = new ArrayList<CsdlNavigationProperty>();
+ navPropList.add(navProp);
+
+ // configure EntityType
+ entityType = new CsdlEntityType();
+ entityType.setName(ET_PRODUCT_NAME);
+ entityType.setProperties(Arrays.asList(id, name, description));
+ entityType.setKey(Arrays.asList(propertyRef));
+ entityType.setNavigationProperties(navPropList);
+
+ } else if (entityTypeName.equals(ET_CATEGORY_FQN)) {
+ // create EntityType properties
+ CsdlProperty id = new CsdlProperty().setName("ID")
+ .setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
+ CsdlProperty name = new CsdlProperty().setName("Name")
+ .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+
+ // create PropertyRef for Key element
+ CsdlPropertyRef propertyRef = new CsdlPropertyRef();
+ propertyRef.setName("ID");
+
+ // navigation property: one-to-many
+ CsdlNavigationProperty navProp = new CsdlNavigationProperty().setName("Products")
+ .setType(ET_PRODUCT_FQN).setCollection(true).setPartner("Category");
+ List<CsdlNavigationProperty> navPropList = new ArrayList<CsdlNavigationProperty>();
+ navPropList.add(navProp);
+
+ // configure EntityType
+ entityType = new CsdlEntityType();
+ entityType.setName(ET_CATEGORY_NAME);
+ entityType.setProperties(Arrays.asList(id, name));
+ entityType.setKey(Arrays.asList(propertyRef));
+ entityType.setNavigationProperties(navPropList);
+ }
+
+ return entityType;
+
+ }
+
+ @Override
+ public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) throws ODataException {
+
+ CsdlEntitySet entitySet = null;
+
+ if (entityContainer.equals(CONTAINER)) {
+
+ if (entitySetName.equals(ES_PRODUCTS_NAME)) {
+
+ entitySet = new CsdlEntitySet();
+ entitySet.setName(ES_PRODUCTS_NAME);
+ entitySet.setType(ET_PRODUCT_FQN);
+
+ // navigation
+ CsdlNavigationPropertyBinding navPropBinding = new CsdlNavigationPropertyBinding();
+ navPropBinding.setTarget("Categories"); // the target entity set, where the navigation property points to
+ navPropBinding.setPath("Category"); // the path from entity type to navigation property
+ List<CsdlNavigationPropertyBinding> navPropBindingList = new ArrayList<CsdlNavigationPropertyBinding>();
+ navPropBindingList.add(navPropBinding);
+ entitySet.setNavigationPropertyBindings(navPropBindingList);
+
+ } else if (entitySetName.equals(ES_CATEGORIES_NAME)) {
+
+ entitySet = new CsdlEntitySet();
+ entitySet.setName(ES_CATEGORIES_NAME);
+ entitySet.setType(ET_CATEGORY_FQN);
+
+ // navigation
+ CsdlNavigationPropertyBinding navPropBinding = new CsdlNavigationPropertyBinding();
+ navPropBinding.setTarget("Products"); // the target entity set, where the navigation property points to
+ navPropBinding.setPath("Products"); // the path from entity type to navigation property
+ List<CsdlNavigationPropertyBinding> navPropBindingList = new ArrayList<CsdlNavigationPropertyBinding>();
+ navPropBindingList.add(navPropBinding);
+ entitySet.setNavigationPropertyBindings(navPropBindingList);
+ }
+ }
+
+ return entitySet;
+ }
+
+ @Override
+ public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) throws ODataException {
+
+ // This method is invoked when displaying the service document at
+ // e.g. http://localhost:8080/DemoService/DemoService.svc
+ if (entityContainerName == null || entityContainerName.equals(CONTAINER)) {
+ CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
+ entityContainerInfo.setContainerName(CONTAINER);
+ return entityContainerInfo;
+ }
+
+ return null;
+ }
+
+ @Override
+ public List<CsdlSchema> getSchemas() throws ODataException {
+ // create Schema
+ CsdlSchema schema = new CsdlSchema();
+ schema.setNamespace(NAMESPACE);
+
+ // add EntityTypes
+ List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
+ entityTypes.add(getEntityType(ET_PRODUCT_FQN));
+ entityTypes.add(getEntityType(ET_CATEGORY_FQN));
+ schema.setEntityTypes(entityTypes);
+
+ // add EntityContainer
+ schema.setEntityContainer(getEntityContainer());
+
+ // finally
+ List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
+ schemas.add(schema);
+
+ return schemas;
+ }
+
+ @Override
+ public CsdlEntityContainer getEntityContainer() throws ODataException {
+
+ // create EntitySets
+ List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
+ entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
+ entitySets.add(getEntitySet(CONTAINER, ES_CATEGORIES_NAME));
+
+ // create EntityContainer
+ CsdlEntityContainer entityContainer = new CsdlEntityContainer();
+ entityContainer.setName(CONTAINER_NAME);
+ entityContainer.setEntitySets(entitySets);
+
+ return entityContainer;
+ }
+}
diff --git a/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
new file mode 100755
index 0000000..9f281bb
--- /dev/null
+++ b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
@@ -0,0 +1,149 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.data.Storage;
+import myservice.mynamespace.util.Util;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.processor.EntityCollectionProcessor;
+import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.server.api.uri.UriResourceNavigation;
+
+public class DemoEntityCollectionProcessor implements EntityCollectionProcessor {
+
+ private OData odata;
+ private ServiceMetadata srvMetadata;
+ // our database-mock
+ private Storage storage;
+
+ public DemoEntityCollectionProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+ this.srvMetadata = serviceMetadata;
+ }
+
+ /*
+ * This method is invoked when a collection of entities has to be read.
+ * In our example, this can be either a "normal" read operation, or a navigation:
+ *
+ * Example for "normal" read entity set operation:
+ * http://localhost:8080/DemoService/DemoService.svc/Categories
+ *
+ * Example for navigation
+ * http://localhost:8080/DemoService/DemoService.svc/Categories(3)/Products
+ */
+ public void readEntityCollection(ODataRequest request, ODataResponse response,
+ UriInfo uriInfo, ContentType responseFormat)
+ throws ODataApplicationException, SerializerException {
+
+ EdmEntitySet responseEdmEntitySet = null; // we'll need this to build the ContextURL
+ EntityCollection responseEntityCollection = null; // we'll need this to set the response body
+
+ // 1st retrieve the requested EntitySet from the uriInfo (representation of the parsed URI)
+ List<UriResource> resourceParts = uriInfo.getUriResourceParts();
+ int segmentCount = resourceParts.size();
+
+ UriResource uriResource = resourceParts.get(0); // in our example, the first segment is the EntitySet
+ if (!(uriResource instanceof UriResourceEntitySet)) {
+ throw new ODataApplicationException("Only EntitySet is supported",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) uriResource;
+ EdmEntitySet startEdmEntitySet = uriResourceEntitySet.getEntitySet();
+
+ if (segmentCount == 1) { // this is the case for: DemoService/DemoService.svc/Categories
+ responseEdmEntitySet = startEdmEntitySet; // the response body is built from the first (and only) entitySet
+
+ // 2nd: fetch the data from backend for this requested EntitySetName and deliver as EntitySet
+ responseEntityCollection = storage.readEntitySetData(startEdmEntitySet);
+ } else if (segmentCount == 2) { // in case of navigation: DemoService.svc/Categories(3)/Products
+
+ UriResource lastSegment = resourceParts.get(1); // in our example we don't support more complex URIs
+ if (lastSegment instanceof UriResourceNavigation) {
+ UriResourceNavigation uriResourceNavigation = (UriResourceNavigation) lastSegment;
+ EdmNavigationProperty edmNavigationProperty = uriResourceNavigation.getProperty();
+ EdmEntityType targetEntityType = edmNavigationProperty.getType();
+ // from Categories(1) to Products
+ responseEdmEntitySet = Util.getNavigationTargetEntitySet(startEdmEntitySet, edmNavigationProperty);
+
+ // 2nd: fetch the data from backend
+ // first fetch the entity where the first segment of the URI points to
+ List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
+ // e.g. for Categories(3)/Products we have to find the single entity: Category with ID 3
+ Entity sourceEntity = storage.readEntityData(startEdmEntitySet, keyPredicates);
+ // error handling for e.g. DemoService.svc/Categories(99)/Products
+ if (sourceEntity == null) {
+ throw new ODataApplicationException("Entity not found.",
+ HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
+ }
+ // then fetch the entity collection where the entity navigates to
+ // note: we don't need to check uriResourceNavigation.isCollection(),
+ // because we are the EntityCollectionProcessor
+ responseEntityCollection = storage.getRelatedEntityCollection(sourceEntity, targetEntityType);
+ }
+ } else { // this would be the case for e.g. Products(1)/Category/Products
+ throw new ODataApplicationException("Not supported",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ // 3rd: create and configure a serializer
+ ContextURL contextUrl = ContextURL.with().entitySet(responseEdmEntitySet).build();
+ EntityCollectionSerializerOptions opts = EntityCollectionSerializerOptions.with().contextURL(contextUrl).build();
+ EdmEntityType edmEntityType = responseEdmEntitySet.getEntityType();
+
+ ODataSerializer serializer = odata.createSerializer(ODataFormat.fromContentType(responseFormat));
+ SerializerResult serializerResult = serializer.entityCollection(this.srvMetadata, edmEntityType,
+ responseEntityCollection, opts);
+
+ // 4th: configure the response object: set the body, headers and status code
+ response.setContent(serializerResult.getContent());
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ }
+
+}
diff --git a/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
new file mode 100755
index 0000000..a2cf344
--- /dev/null
+++ b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package myservice.mynamespace.service;
+
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.data.Storage;
+import myservice.mynamespace.util.Util;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.ContextURL.Suffix;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.processor.EntityProcessor;
+import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.server.api.uri.UriResourceNavigation;
+
+public class DemoEntityProcessor implements EntityProcessor {
+
+ private OData odata;
+ private ServiceMetadata srvMetadata;
+ private Storage storage;
+
+ public DemoEntityProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+ this.srvMetadata = serviceMetadata;
+ }
+
+ /**
+ * This method is invoked when a single entity has to be read.
+ * In our example, this can be either a "normal" read operation, or a navigation:
+ *
+ * Example for "normal" read operation:
+ * http://localhost:8080/DemoService/DemoService.svc/Products(1)
+ *
+ * Example for navigation
+ * http://localhost:8080/DemoService/DemoService.svc/Products(1)/Category
+ */
+ public void readEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
+ throws ODataApplicationException, SerializerException {
+
+ EdmEntityType responseEdmEntityType = null; // we'll need this to build the ContextURL
+ Entity responseEntity = null; // required for serialization of the response body
+ EdmEntitySet responseEdmEntitySet = null; // we need this for building the contextUrl
+
+ // 1st step: retrieve the requested Entity: can be "normal" read operation, or navigation (to-one)
+ List<UriResource> resourceParts = uriInfo.getUriResourceParts();
+ int segmentCount = resourceParts.size();
+
+ UriResource uriResource = resourceParts.get(0); // in our example, the first segment is the EntitySet
+ if (!(uriResource instanceof UriResourceEntitySet)) {
+ throw new ODataApplicationException("Only EntitySet is supported",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
+ }
+
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) uriResource;
+ EdmEntitySet startEdmEntitySet = uriResourceEntitySet.getEntitySet();
+
+ // Analyze the URI segments
+ if (segmentCount == 1) { // no navigation
+ responseEdmEntityType = startEdmEntitySet.getEntityType();
+ responseEdmEntitySet = startEdmEntitySet; // since we have only one segment
+
+ // 2. step: retrieve the data from backend
+ List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
+ responseEntity = storage.readEntityData(startEdmEntitySet, keyPredicates);
+ } else if (segmentCount == 2) { // navigation
+ UriResource navSegment = resourceParts.get(1); // in our example we don't support more complex URIs
+ if (navSegment instanceof UriResourceNavigation) {
+ UriResourceNavigation uriResourceNavigation = (UriResourceNavigation) navSegment;
+ EdmNavigationProperty edmNavigationProperty = uriResourceNavigation.getProperty();
+ responseEdmEntityType = edmNavigationProperty.getType();
+ // contextURL displays the last segment
+ responseEdmEntitySet = Util.getNavigationTargetEntitySet(startEdmEntitySet, edmNavigationProperty);
+
+ // 2nd: fetch the data from backend.
+ // e.g. for the URI: Products(1)/Category we have to find the correct Category entity
+ List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
+ // e.g. for Products(1)/Category we have to find first the Products(1)
+ Entity sourceEntity = storage.readEntityData(startEdmEntitySet, keyPredicates);
+
+ // now we have to check if the navigation is
+ // a) to-one: e.g. Products(1)/Category
+ // b) to-many with key: e.g. Categories(3)/Products(5)
+ // the key for nav is used in this case: Categories(3)/Products(5)
+ List<UriParameter> navKeyPredicates = uriResourceNavigation.getKeyPredicates();
+
+ if (navKeyPredicates.isEmpty()) { // e.g. DemoService.svc/Products(1)/Category
+ responseEntity = storage.getRelatedEntity(sourceEntity, responseEdmEntityType);
+ } else { // e.g. DemoService.svc/Categories(3)/Products(5)
+ responseEntity = storage.getRelatedEntity(sourceEntity, responseEdmEntityType, navKeyPredicates);
+ }
+ }
+ } else {
+ // this would be the case for e.g. Products(1)/Category/Products(1)/Category
+ throw new ODataApplicationException("Not supported", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ if (responseEntity == null) {
+ // this is the case for e.g. DemoService.svc/Categories(4) or DemoService.svc/Categories(3)/Products(999)
+ throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
+ }
+
+ // 3. serialize
+ ContextURL contextUrl = ContextURL.with().entitySet(responseEdmEntitySet).suffix(Suffix.ENTITY).build();
+ EntitySerializerOptions opts = EntitySerializerOptions.with().contextURL(contextUrl).build();
+
+ ODataFormat oDataFormat = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = this.odata.createSerializer(oDataFormat);
+ SerializerResult serializerResult = serializer.entity(this.srvMetadata,
+ responseEdmEntityType, responseEntity, opts);
+
+ // 4. configure the response object
+ response.setContent(serializerResult.getContent());
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ }
+
+ /*
+ * These processor methods are not handled in this tutorial
+ */
+
+ public void createEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo,
+ ContentType requestFormat, ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ public void updateEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo,
+ ContentType requestFormat, ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ public void deleteEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo)
+ throws ODataApplicationException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+}
diff --git a/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
new file mode 100755
index 0000000..c32c5c2
--- /dev/null
+++ b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
@@ -0,0 +1,150 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.data.Storage;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.processor.PrimitiveProcessor;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.server.api.uri.UriResourceProperty;
+
+public class DemoPrimitiveProcessor implements PrimitiveProcessor {
+
+ private OData odata;
+ private Storage storage;
+
+ public DemoPrimitiveProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+
+ }
+
+ /*
+ * In our example, the URL would be: http://localhost:8080/DemoService/DemoService.svc/Products(1)/Name
+ * and the response:
+ * {
+ *
+ * @odata.context: "$metadata#Products/Name",
+ * value: "Notebook Basic 15"
+ * }
+ */
+ public void readPrimitive(ODataRequest request, ODataResponse response,
+ UriInfo uriInfo, ContentType responseFormat)
+ throws ODataApplicationException, SerializerException {
+
+ // 1. Retrieve info from URI
+ // 1.1. retrieve the info about the requested entity set
+ List<UriResource> resourceParts = uriInfo.getUriResourceParts();
+ // Note: only in our example we can rely that the first segment is the EntitySet
+ UriResourceEntitySet uriEntityset = (UriResourceEntitySet) resourceParts.get(0);
+ EdmEntitySet edmEntitySet = uriEntityset.getEntitySet();
+ // the key for the entity
+ List<UriParameter> keyPredicates = uriEntityset.getKeyPredicates();
+
+ // 1.2. retrieve the requested (Edm) property
+ // the last segment is the Property
+ UriResourceProperty uriProperty = (UriResourceProperty) resourceParts.get(resourceParts.size() - 1);
+ EdmProperty edmProperty = uriProperty.getProperty();
+ String edmPropertyName = edmProperty.getName();
+ // in our example, we know we have only primitive types in our model
+ EdmPrimitiveType edmPropertyType = (EdmPrimitiveType) edmProperty.getType();
+
+ // 2. retrieve data from backend
+ // 2.1. retrieve the entity data, for which the property has to be read
+ Entity entity = storage.readEntityData(edmEntitySet, keyPredicates);
+ if (entity == null) { // Bad request
+ throw new ODataApplicationException("Entity not found",
+ HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ // 2.2. retrieve the property data from the entity
+ Property property = entity.getProperty(edmPropertyName);
+ if (property == null) {
+ throw new ODataApplicationException("Property not found",
+ HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ // 3. serialize
+ Object value = property.getValue();
+ if (value != null) {
+ // 3.1. configure the serializer
+ ODataFormat format = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = odata.createSerializer(format);
+
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).navOrPropertyPath(edmPropertyName).build();
+ PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextUrl).build();
+ // 3.2. serialize
+ SerializerResult serializerResult = serializer.primitive(edmPropertyType, property, options);
+ InputStream propertyStream = serializerResult.getContent();
+
+ // 4. configure the response object
+ response.setContent(propertyStream);
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ } else {
+ // in case there's no value for the property, we can skip the serialization
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+ }
+
+ /*
+ * These processor methods are not handled in this tutorial
+ */
+
+ public void updatePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat,
+ ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ public void deletePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo)
+ throws ODataApplicationException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+}
diff --git a/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/util/Util.java b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/util/Util.java
new file mode 100755
index 0000000..3320760
--- /dev/null
+++ b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/util/Util.java
@@ -0,0 +1,151 @@
+/*
+ * 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 myservice.mynamespace.util;
+
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.edm.EdmBindingTarget;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.uri.UriParameter;
+
+public class Util {
+
+ public static Entity findEntity(EdmEntityType edmEntityType, EntityCollection entitySet,
+ List<UriParameter> keyParams) {
+
+ List<Entity> entityList = entitySet.getEntities();
+
+ // loop over all entities in order to find that one that matches
+ // all keys in request e.g. contacts(ContactID=1, CompanyID=1)
+ for (Entity entity : entityList) {
+ boolean foundEntity = entityMatchesAllKeys(edmEntityType, entity, keyParams);
+ if (foundEntity) {
+ return entity;
+ }
+ }
+
+ return null;
+ }
+
+ public static boolean entityMatchesAllKeys(EdmEntityType edmEntityType, Entity rt_entity,
+ List<UriParameter> keyParams) {
+
+ // loop over all keys
+ for (final UriParameter key : keyParams) {
+ // key
+ String keyName = key.getName();
+ String keyText = key.getText();
+
+ // note: below line doesn't consider: keyProp can be part of a complexType in V4
+ // in such case, it would be required to access it via getKeyPropertyRef()
+ // but since this isn't the case in our model, we ignore it in our implementation
+ EdmProperty edmKeyProperty = (EdmProperty) edmEntityType.getProperty(keyName);
+ // Edm: we need this info for the comparison below
+ Boolean isNullable = edmKeyProperty.isNullable();
+ Integer maxLength = edmKeyProperty.getMaxLength();
+ Integer precision = edmKeyProperty.getPrecision();
+ Boolean isUnicode = edmKeyProperty.isUnicode();
+ Integer scale = edmKeyProperty.getScale();
+ // get the EdmType in order to compare
+ EdmType edmType = edmKeyProperty.getType();
+ // if(EdmType instanceof EdmPrimitiveType) // do we need this?
+ EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) edmType;
+
+ // Runtime data: the value of the current entity
+ // don't need to check for null, this is done in FWK
+ Object valueObject = rt_entity.getProperty(keyName).getValue();
+ // TODO if the property is a complex type
+
+ // now need to compare the valueObject with the keyText String
+ // this is done using the type.valueToString
+ String valueAsString = null;
+ try {
+ valueAsString = edmPrimitiveType.valueToString(valueObject, isNullable,
+ maxLength, precision, scale, isUnicode);
+ } catch (EdmPrimitiveTypeException e) {
+ return false; // TODO proper Exception handling
+ }
+
+ if (valueAsString == null) {
+ return false;
+ }
+
+ boolean matches = valueAsString.equals(keyText);
+ if (matches) {
+ // if the given key value is found in the current entity, continue with the next key
+ continue;
+ } else {
+ // if any of the key properties is not found in the entity, we don't need to search further
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Example:
+ * For the following navigation: DemoService.svc/Categories(1)/Products
+ * we need the EdmEntitySet for the navigation property "Products"
+ *
+ * This is defined as follows in the metadata:
+ * <code>
+ *
+ * <EntitySet Name="Categories" EntityType="OData.Demo.Category">
+ * <NavigationPropertyBinding Path="Products" Target="Products"/>
+ * </EntitySet>
+ * </code>
+ * The "Target" attribute specifies the target EntitySet
+ * Therefore we need the startEntitySet "Categories" in order to retrieve the target EntitySet "Products"
+ */
+ public static EdmEntitySet getNavigationTargetEntitySet(EdmEntitySet startEntitySet,
+ EdmNavigationProperty edmNavigationProperty)
+ throws ODataApplicationException {
+
+ EdmEntitySet navigationTargetEntitySet = null;
+
+ String navPropName = edmNavigationProperty.getName();
+ EdmBindingTarget edmBindingTarget = startEntitySet.getRelatedBindingTarget(navPropName);
+ if (edmBindingTarget == null) {
+ throw new ODataApplicationException("Not supported.",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ if (edmBindingTarget instanceof EdmEntitySet) {
+ navigationTargetEntitySet = (EdmEntitySet) edmBindingTarget;
+ } else {
+ throw new ODataApplicationException("Not supported.",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ return navigationTargetEntitySet;
+ }
+
+}
diff --git a/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/web/DemoServlet.java b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/web/DemoServlet.java
new file mode 100755
index 0000000..5c828e5
--- /dev/null
+++ b/samples/tutorials/p4_navigation/src/main/java/myservice/mynamespace/web/DemoServlet.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package myservice.mynamespace.web;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import myservice.mynamespace.data.Storage;
+import myservice.mynamespace.service.DemoEdmProvider;
+import myservice.mynamespace.service.DemoEntityCollectionProcessor;
+import myservice.mynamespace.service.DemoEntityProcessor;
+import myservice.mynamespace.service.DemoPrimitiveProcessor;
+
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataHttpHandler;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DemoServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+ private static final Logger LOG = LoggerFactory.getLogger(DemoServlet.class);
+
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ try {
+ HttpSession session = req.getSession(true);
+ Storage storage = (Storage) session.getAttribute(Storage.class.getName());
+ if (storage == null) {
+ storage = new Storage();
+ session.setAttribute(Storage.class.getName(), storage);
+ }
+
+ // create odata handler and configure it with EdmProvider and Processor
+ OData odata = OData.newInstance();
+ ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>());
+ ODataHttpHandler handler = odata.createHandler(edm);
+ handler.register(new DemoEntityCollectionProcessor(storage));
+ handler.register(new DemoEntityProcessor(storage));
+ handler.register(new DemoPrimitiveProcessor(storage));
+
+ // let the handler do the work
+ handler.process(req, resp);
+ } catch (RuntimeException e) {
+ LOG.error("Server Error occurred in DemoServlet", e);
+ throw new ServletException(e);
+ }
+
+ }
+
+}
diff --git a/samples/tutorials/p4_navigation/src/main/webapp/WEB-INF/web.xml b/samples/tutorials/p4_navigation/src/main/webapp/WEB-INF/web.xml
new file mode 100755
index 0000000..bc216cb
--- /dev/null
+++ b/samples/tutorials/p4_navigation/src/main/webapp/WEB-INF/web.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.
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
+
+ <servlet>
+ <servlet-name>DemoServlet</servlet-name>
+ <servlet-class> myservice.mynamespace.web.DemoServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>DemoServlet</servlet-name>
+ <url-pattern>/DemoService.svc/*</url-pattern>
+ </servlet-mapping>
+</web-app>
diff --git a/samples/tutorials/p4_navigation/src/main/webapp/index.jsp b/samples/tutorials/p4_navigation/src/main/webapp/index.jsp
new file mode 100755
index 0000000..9ec4bc3
--- /dev/null
+++ b/samples/tutorials/p4_navigation/src/main/webapp/index.jsp
@@ -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.
+
+-->
+<html>
+<body>
+<h2>Hello World!</h2>
+<a href="DemoService.svc/">OData Olingo V4 Demo Service - Navigation</a>
+</body>
+</html>
diff --git a/samples/tutorials/p5_queryoptions-tcs/pom.xml b/samples/tutorials/p5_queryoptions-tcs/pom.xml
new file mode 100755
index 0000000..d9b463e
--- /dev/null
+++ b/samples/tutorials/p5_queryoptions-tcs/pom.xml
@@ -0,0 +1,79 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>my.group.id</groupId>
+ <artifactId>DemoService-QueryOptions-TCS</artifactId>
+ <packaging>war</packaging>
+ <version>0.0.1</version>
+
+ <name>${project.artifactId}-Webapp</name>
+
+ <build>
+ <finalName>DemoService</finalName>
+ </build>
+
+ <properties>
+ <javax.version>2.5</javax.version>
+ <odata.version>4.0.0-beta-03</odata.version>
+ <slf4j.version>1.7.7</slf4j.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${javax.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-api</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-core</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-api</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-core</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/data/Storage.java b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/data/Storage.java
new file mode 100755
index 0000000..2aa9fac
--- /dev/null
+++ b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/data/Storage.java
@@ -0,0 +1,130 @@
+/*
+ * 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 myservice.mynamespace.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.service.DemoEdmProvider;
+import myservice.mynamespace.util.Util;
+
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.uri.UriParameter;
+
+public class Storage {
+
+ private List<Entity> productList;
+
+ public Storage() {
+ productList = new ArrayList<Entity>();
+ initSampleData();
+ }
+
+ /* PUBLIC FACADE */
+
+ public EntityCollection readEntitySetData(EdmEntitySet edmEntitySet)throws ODataApplicationException{
+
+ // actually, this is only required if we have more than one Entity Sets
+ if(edmEntitySet.getName().equals(DemoEdmProvider.ES_PRODUCTS_NAME)){
+ return getProducts();
+ }
+
+ return null;
+ }
+
+ public Entity readEntityData(EdmEntitySet edmEntitySet, List<UriParameter> keyParams)
+ throws ODataApplicationException{
+
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+ // actually, this is only required if we have more than one Entity Type
+ if(edmEntityType.getName().equals(DemoEdmProvider.ET_PRODUCT_NAME)){
+ return getProduct(edmEntityType, keyParams);
+ }
+
+ return null;
+ }
+
+
+
+ /* INTERNAL */
+
+ private EntityCollection getProducts(){
+ EntityCollection retEntitySet = new EntityCollection();
+
+ for(Entity productEntity : this.productList){
+ retEntitySet.getEntities().add(productEntity);
+ }
+
+ return retEntitySet;
+ }
+
+
+ private Entity getProduct(EdmEntityType edmEntityType, List<UriParameter> keyParams)
+ throws ODataApplicationException{
+
+ // the list of entities at runtime
+ EntityCollection entitySet = getProducts();
+
+ /* generic approach to find the requested entity */
+ Entity requestedEntity = Util.findEntity(edmEntityType, entitySet, keyParams);
+
+ if(requestedEntity == null){
+ // this variable is null if our data doesn't contain an entity for the requested key
+ // Throw suitable exception
+ throw new ODataApplicationException("Entity for requested key doesn't exist",
+ HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ return requestedEntity;
+ }
+
+ /* HELPER */
+
+ private void initSampleData(){
+
+ // add some sample product entities
+ productList.add(new Entity()
+ .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 1))
+ .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Notebook Basic 15"))
+ .addProperty(new Property(null, "Description", ValueType.PRIMITIVE,
+ "Notebook Basic, 1.7GHz - 15 XGA - 1024MB DDR2 SDRAM - 40GB")));
+
+ productList.add(new Entity()
+ .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 2))
+ .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "1UMTS PDA"))
+ .addProperty(new Property(null, "Description", ValueType.PRIMITIVE,
+ "Ultrafast 3G UMTS/HSDPA Pocket PC, supports GSM network")));
+
+ productList.add(new Entity()
+ .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 3))
+ .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Ergo Screen"))
+ .addProperty(new Property(null, "Description", ValueType.PRIMITIVE,
+ "19 Optimum Resolution 1024 x 768 @ 85Hz, resolution 1280 x 960")));
+
+ }
+}
diff --git a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
new file mode 100755
index 0000000..3c28a21
--- /dev/null
+++ b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package myservice.mynamespace.service;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
+import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
+import org.apache.olingo.commons.api.edm.provider.CsdlPropertyRef;
+import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
+
+public class DemoEdmProvider extends CsdlAbstractEdmProvider {
+
+ // Service Namespace
+ public static final String NAMESPACE = "OData.Demo";
+
+ // EDM Container
+ public static final String CONTAINER_NAME = "Container";
+ public static final FullQualifiedName CONTAINER = new FullQualifiedName(NAMESPACE, CONTAINER_NAME);
+
+ // Entity Types Names
+ public static final String ET_PRODUCT_NAME = "Product";
+ public static final FullQualifiedName ET_PRODUCT_FQN = new FullQualifiedName(NAMESPACE, ET_PRODUCT_NAME);
+
+ // Entity Set Names
+ public static final String ES_PRODUCTS_NAME = "Products";
+
+ @Override
+ public CsdlEntityType getEntityType(FullQualifiedName entityTypeName)
+ throws ODataException {
+ // this method is called for one of the EntityTypes that are configured in the Schema
+ if (ET_PRODUCT_FQN.equals(entityTypeName)) {
+
+ // create EntityType properties
+ CsdlProperty id = new CsdlProperty().setName("ID").setType(
+ EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
+ CsdlProperty name = new CsdlProperty().setName("Name").setType(
+ EdmPrimitiveTypeKind.String.getFullQualifiedName());
+ CsdlProperty description = new CsdlProperty().setName("Description").setType(
+ EdmPrimitiveTypeKind.String.getFullQualifiedName());
+
+ // create PropertyRef for Key element
+ CsdlPropertyRef propertyRef = new CsdlPropertyRef();
+ propertyRef.setName("ID");
+
+ // configure EntityType
+ CsdlEntityType entityType = new CsdlEntityType();
+ entityType.setName(ET_PRODUCT_NAME);
+ entityType.setProperties(Arrays.asList(id, name, description));
+ entityType.setKey(Collections.singletonList(propertyRef));
+
+ return entityType;
+ }
+
+ return null;
+
+ }
+
+ @Override
+ public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer,
+ String entitySetName) throws ODataException {
+ if (entityContainer.equals(CONTAINER)) {
+ if (entitySetName.equals(ES_PRODUCTS_NAME)) {
+ CsdlEntitySet entitySet = new CsdlEntitySet();
+ entitySet.setName(ES_PRODUCTS_NAME);
+ entitySet.setType(ET_PRODUCT_FQN);
+
+ return entitySet;
+ }
+ }
+
+ return null;
+
+ }
+
+ @Override
+ public CsdlEntityContainerInfo getEntityContainerInfo(
+ FullQualifiedName entityContainerName) throws ODataException {
+ // This method is invoked when displaying the service document at
+ // e.g. http://localhost:8080/DemoService/DemoService.svc
+ if (entityContainerName == null || entityContainerName.equals(CONTAINER)) {
+ CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
+ entityContainerInfo.setContainerName(CONTAINER);
+ return entityContainerInfo;
+ }
+
+ return null;
+
+ }
+
+ @Override
+ public List<CsdlSchema> getSchemas() throws ODataException {
+ // create Schema
+ CsdlSchema schema = new CsdlSchema();
+ schema.setNamespace(NAMESPACE);
+
+ // add EntityTypes
+ List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
+ entityTypes.add(getEntityType(ET_PRODUCT_FQN));
+ schema.setEntityTypes(entityTypes);
+
+ // add EntityContainer
+ schema.setEntityContainer(getEntityContainer());
+
+ // finally
+ List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
+ schemas.add(schema);
+
+ return schemas;
+
+ }
+
+ @Override
+ public CsdlEntityContainer getEntityContainer() throws ODataException {
+ // create EntitySets
+ List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
+ entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
+
+ // create EntityContainer
+ CsdlEntityContainer entityContainer = new CsdlEntityContainer();
+ entityContainer.setName(CONTAINER_NAME);
+ entityContainer.setEntitySets(entitySets);
+
+ return entityContainer;
+
+ }
+
+}
diff --git a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
new file mode 100755
index 0000000..fc58c23
--- /dev/null
+++ b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
@@ -0,0 +1,142 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.data.Storage;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.processor.EntityCollectionProcessor;
+import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.server.api.uri.queryoption.CountOption;
+import org.apache.olingo.server.api.uri.queryoption.SkipOption;
+import org.apache.olingo.server.api.uri.queryoption.TopOption;
+
+public class DemoEntityCollectionProcessor implements EntityCollectionProcessor {
+
+ private OData odata;
+ private ServiceMetadata serviceMetadata;
+ private Storage storage;
+
+ public DemoEntityCollectionProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+ this.serviceMetadata = serviceMetadata;
+ }
+
+ public void readEntityCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo,
+ ContentType responseFormat) throws ODataApplicationException, SerializerException {
+
+ // 1st retrieve the requested EntitySet from the uriInfo (representation of the parsed URI)
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ // in our example, the first segment is the EntitySet
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
+ EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
+
+ // 2nd: fetch the data from backend for this requested EntitySetName and deliver as EntitySet
+ EntityCollection entityCollection = storage.readEntitySetData(edmEntitySet);
+
+ // 3rd: apply System Query Options
+ // modify the result set according to the query options, specified by the end user
+ List<Entity> entityList = entityCollection.getEntities();
+ EntityCollection returnEntityCollection = new EntityCollection();
+
+ // handle $count: always return the original number of entities, without considering $top and $skip
+ CountOption countOption = uriInfo.getCountOption();
+ if (countOption != null) {
+ boolean isCount = countOption.getValue();
+ if (isCount) {
+ returnEntityCollection.setCount(entityList.size());
+ }
+ }
+
+ // handle $skip
+ SkipOption skipOption = uriInfo.getSkipOption();
+ if (skipOption != null) {
+ int skipNumber = skipOption.getValue();
+ if (skipNumber >= 0 && skipNumber <= entityList.size()) {
+ entityList = entityList.subList(skipNumber, entityList.size());
+ } else {
+ throw new ODataApplicationException("Invalid value for $skip", HttpStatusCode.BAD_REQUEST.getStatusCode(),
+ Locale.ROOT);
+ }
+ }
+
+ // handle $top
+ TopOption topOption = uriInfo.getTopOption();
+ if (topOption != null) {
+ int topNumber = topOption.getValue();
+ if (topNumber >= 0 && topNumber <= entityList.size()) {
+ entityList = entityList.subList(0, topNumber);
+ } else {
+ throw new ODataApplicationException("Invalid value for $top", HttpStatusCode.BAD_REQUEST.getStatusCode(),
+ Locale.ROOT);
+ }
+ }
+
+ // after applying the system query options, create the EntityCollection based on the reduced list
+ for (Entity entity : entityList) {
+ returnEntityCollection.getEntities().add(entity);
+ }
+
+ // 4th: create a serializer based on the requested format (json)
+ ODataFormat format = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = odata.createSerializer(format);
+
+ // and serialize the content: transform from the EntitySet object to InputStream
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).build();
+
+ EntityCollectionSerializerOptions opts =
+ EntityCollectionSerializerOptions.with().contextURL(contextUrl).count(countOption).build();
+ SerializerResult serializerResult =
+ serializer.entityCollection(serviceMetadata, edmEntityType, returnEntityCollection, opts);
+ InputStream serializedContent = serializerResult.getContent();
+
+ // 5th: configure the response object: set the body, headers and status code
+ response.setContent(serializedContent);
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ }
+}
diff --git a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
new file mode 100755
index 0000000..81453a0
--- /dev/null
+++ b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
@@ -0,0 +1,118 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.data.Storage;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.processor.EntityProcessor;
+import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+
+public class DemoEntityProcessor implements EntityProcessor {
+
+ private OData odata;
+ private ServiceMetadata serviceMetadata;
+ private Storage storage;
+
+ public DemoEntityProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+ this.serviceMetadata = serviceMetadata;
+ }
+
+ public void readEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
+ throws ODataApplicationException, SerializerException {
+
+ // 1. retrieve the Entity Type
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ // Note: only in our example we can assume that the first segment is the EntitySet
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
+ EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
+
+ // 2. retrieve the data from backend
+ List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
+ Entity entity = storage.readEntityData(edmEntitySet, keyPredicates);
+
+ // 3. serialize
+ EdmEntityType entityType = edmEntitySet.getEntityType();
+
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).suffix(ContextURL.Suffix.ENTITY).build();
+ // expand and select currently not supported
+ EntitySerializerOptions options = EntitySerializerOptions.with().contextURL(contextUrl).build();
+
+ ODataFormat oDataFormat = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = this.odata.createSerializer(oDataFormat);
+ SerializerResult serializerResult = serializer.entity(serviceMetadata, entityType, entity, options);
+ InputStream entityStream = serializerResult.getContent();
+
+ // 4. configure the response object
+ response.setContent(entityStream);
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ }
+
+ /*
+ * These processor methods are not handled in this tutorial
+ */
+
+ public void createEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat,
+ ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ public void updateEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat,
+ ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ public void deleteEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo)
+ throws ODataApplicationException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+}
diff --git a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
new file mode 100755
index 0000000..64f7949
--- /dev/null
+++ b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
@@ -0,0 +1,150 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.data.Storage;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.processor.PrimitiveProcessor;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.server.api.uri.UriResourceProperty;
+
+public class DemoPrimitiveProcessor implements PrimitiveProcessor {
+
+ private OData odata;
+ private Storage storage;
+
+ public DemoPrimitiveProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+
+ }
+
+ /*
+ * In our example, the URL would be: http://localhost:8080/DemoService/DemoService.svc/Products(1)/Name
+ * and the response:
+ * {
+ * @odata.context: "$metadata#Products/Name",
+ * value: "Notebook Basic 15"
+ * }
+ * */
+ public void readPrimitive(ODataRequest request, ODataResponse response,
+ UriInfo uriInfo, ContentType responseFormat)
+ throws ODataApplicationException, SerializerException {
+
+ // 1. Retrieve info from URI
+ // 1.1. retrieve the info about the requested entity set
+ List<UriResource> resourceParts = uriInfo.getUriResourceParts();
+ // Note: only in our example we can rely that the first segment is the EntitySet
+ UriResourceEntitySet uriEntityset = (UriResourceEntitySet) resourceParts.get(0);
+ EdmEntitySet edmEntitySet = uriEntityset.getEntitySet();
+ // the key for the entity
+ List<UriParameter> keyPredicates = uriEntityset.getKeyPredicates();
+
+ // 1.2. retrieve the requested (Edm) property
+ // the last segment is the Property
+ UriResourceProperty uriProperty = (UriResourceProperty)resourceParts.get(resourceParts.size() -1);
+ EdmProperty edmProperty = uriProperty.getProperty();
+ String edmPropertyName = edmProperty.getName();
+ // in our example, we know we have only primitive types in our model
+ EdmPrimitiveType edmPropertyType = (EdmPrimitiveType) edmProperty.getType();
+
+
+ // 2. retrieve data from backend
+ // 2.1. retrieve the entity data, for which the property has to be read
+ Entity entity = storage.readEntityData(edmEntitySet, keyPredicates);
+ if (entity == null) { // Bad request
+ throw new ODataApplicationException("Entity not found", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
+ }
+
+ // 2.2. retrieve the property data from the entity
+ Property property = entity.getProperty(edmPropertyName);
+ if (property == null) {
+ throw new ODataApplicationException("Property not found", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
+ }
+
+ // 3. serialize
+ Object value = property.getValue();
+ if (value != null) {
+ // 3.1. configure the serializer
+ ODataFormat format = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = odata.createSerializer(format);
+
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).navOrPropertyPath(edmPropertyName).build();
+ PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextUrl).build();
+ // 3.2. serialize
+ SerializerResult serializerResult = serializer.primitive(edmPropertyType, property, options);
+ InputStream propertyStream = serializerResult.getContent();
+
+ //4. configure the response object
+ response.setContent(propertyStream);
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ } else {
+ // in case there's no value for the property, we can skip the serialization
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+ }
+
+
+
+ /*
+ * These processor methods are not handled in this tutorial
+ * */
+
+ public void updatePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo,
+ ContentType requestFormat, ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ public void deletePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo)
+ throws ODataApplicationException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+}
diff --git a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/util/Util.java b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/util/Util.java
new file mode 100755
index 0000000..c21d352
--- /dev/null
+++ b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/util/Util.java
@@ -0,0 +1,105 @@
+/*
+ * 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 myservice.mynamespace.util;
+
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.uri.UriInfoResource;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+
+public class Util {
+
+ public static Entity findEntity(EdmEntityType edmEntityType, EntityCollection entitySet,
+ List<UriParameter> keyParams) throws ODataApplicationException {
+
+ List<Entity> entityList = entitySet.getEntities();
+
+ // loop over all entities in order to find that one that matches all keys in request
+ // e.g. contacts(ContactID=1, CompanyID=1)
+ for (Entity entity: entityList) {
+ boolean foundEntity = entityMatchesAllKeys(edmEntityType, entity, keyParams);
+ if (foundEntity) {
+ return entity;
+ }
+ }
+
+ return null;
+ }
+
+ public static boolean entityMatchesAllKeys(EdmEntityType edmEntityType, Entity entity, List<UriParameter> keyParams)
+ throws ODataApplicationException {
+
+ // loop over all keys
+ for (final UriParameter key : keyParams) {
+ // key
+ String keyName = key.getName();
+ String keyText = key.getText();
+
+ // Edm: we need this info for the comparison below
+ EdmProperty edmKeyProperty = (EdmProperty) edmEntityType.getProperty(keyName);
+ Boolean isNullable = edmKeyProperty.isNullable();
+ Integer maxLength = edmKeyProperty.getMaxLength();
+ Integer precision = edmKeyProperty.getPrecision();
+ Boolean isUnicode = edmKeyProperty.isUnicode();
+ Integer scale = edmKeyProperty.getScale();
+ // get the EdmType in order to compare
+ EdmType edmType = edmKeyProperty.getType();
+ EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) edmType;
+
+ // Runtime data: the value of the current entity
+ // don't need to check for null, this is done in olingo library
+ Object valueObject = entity.getProperty(keyName).getValue();
+
+ // now need to compare the valueObject with the keyText String
+ // this is done using the type.valueToString
+ String valueAsString;
+ try {
+ valueAsString = edmPrimitiveType.valueToString(valueObject, isNullable, maxLength, precision, scale, isUnicode);
+ } catch (EdmPrimitiveTypeException e) {
+ throw new ODataApplicationException("Failed to retrieve String value", HttpStatusCode.INTERNAL_SERVER_ERROR
+ .getStatusCode(), Locale.ENGLISH, e);
+ }
+
+ if (valueAsString == null) {
+ return false;
+ }
+
+ boolean matches = valueAsString.equals(keyText);
+ if (!matches) {
+ // if any of the key properties is not found in the entity, we don't need to search further
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/web/DemoServlet.java b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/web/DemoServlet.java
new file mode 100755
index 0000000..fe5cdbb
--- /dev/null
+++ b/samples/tutorials/p5_queryoptions-tcs/src/main/java/myservice/mynamespace/web/DemoServlet.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 myservice.mynamespace.web;
+
+import java.io.IOException;
+import java.lang.Override;import java.lang.RuntimeException;import java.util.ArrayList;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import myservice.mynamespace.data.Storage;
+import myservice.mynamespace.service.DemoEdmProvider;
+import myservice.mynamespace.service.DemoEntityCollectionProcessor;
+import myservice.mynamespace.service.DemoEntityProcessor;
+import myservice.mynamespace.service.DemoPrimitiveProcessor;
+
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataHttpHandler;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DemoServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+ private static final Logger LOG = LoggerFactory.getLogger(DemoServlet.class);
+
+
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ try {
+ HttpSession session = req.getSession(true);
+ Storage storage = (Storage) session.getAttribute(Storage.class.getName());
+ if (storage == null) {
+ storage = new Storage();
+ session.setAttribute(Storage.class.getName(), storage);
+ }
+
+ // create odata handler and configure it with EdmProvider and Processor
+ OData odata = OData.newInstance();
+ ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>());
+ ODataHttpHandler handler = odata.createHandler(edm);
+ handler.register(new DemoEntityCollectionProcessor(storage));
+ handler.register(new DemoEntityProcessor(storage));
+ handler.register(new DemoPrimitiveProcessor(storage));
+
+ // let the handler do the work
+ handler.process(req, resp);
+ } catch (RuntimeException e) {
+ LOG.error("Server Error occurred in ExampleServlet", e);
+ throw new ServletException(e);
+ }
+
+ }
+
+}
diff --git a/samples/tutorials/p5_queryoptions-tcs/src/main/webapp/WEB-INF/web.xml b/samples/tutorials/p5_queryoptions-tcs/src/main/webapp/WEB-INF/web.xml
new file mode 100755
index 0000000..21de52a
--- /dev/null
+++ b/samples/tutorials/p5_queryoptions-tcs/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,40 @@
+<?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.
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ id="WebApp_ID" version="2.5">
+
+ <!-- Register the HttpServlet implementation -->
+ <servlet>
+ <servlet-name>DemoServlet</servlet-name>
+ <servlet-class>myservice.mynamespace.web.DemoServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!--
+ Our OData service can be invoked at
+ http://localhost:8080/DemoService/DemoService.svc
+ -->
+ <servlet-mapping>
+ <servlet-name>DemoServlet</servlet-name>
+ <url-pattern>/DemoService.svc/*</url-pattern>
+ </servlet-mapping>
+</web-app>
\ No newline at end of file
diff --git a/samples/tutorials/p5_queryoptions-tcs/src/main/webapp/index.jsp b/samples/tutorials/p5_queryoptions-tcs/src/main/webapp/index.jsp
new file mode 100755
index 0000000..7ffb4ba
--- /dev/null
+++ b/samples/tutorials/p5_queryoptions-tcs/src/main/webapp/index.jsp
@@ -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.
+
+-->
+<html>
+<body>
+<h2>Hello World!</h2>
+<a href="DemoService.svc/">OData Olingo V4 Demo Service</a>
+</body>
+</html>
diff --git a/samples/tutorials/p6_queryoptions-es/pom.xml b/samples/tutorials/p6_queryoptions-es/pom.xml
new file mode 100755
index 0000000..bb095ad
--- /dev/null
+++ b/samples/tutorials/p6_queryoptions-es/pom.xml
@@ -0,0 +1,80 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>my.group.id</groupId>
+ <artifactId>DemoService-QueryOptions-ES</artifactId>
+ <packaging>war</packaging>
+ <version>0.0.1</version>
+
+ <name>${project.artifactId}-Webapp</name>
+
+ <build>
+ <finalName>DemoService</finalName>
+ </build>
+
+ <properties>
+ <javax.version>2.5</javax.version>
+ <odata.version>4.0.0-beta-03</odata.version>
+ <slf4j.version>1.7.7</slf4j.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${javax.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-api</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-core</artifactId>
+ <version>${odata.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-api</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-core</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/data/Storage.java b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/data/Storage.java
new file mode 100755
index 0000000..2034fe6
--- /dev/null
+++ b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/data/Storage.java
@@ -0,0 +1,252 @@
+/*
+ * 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 myservice.mynamespace.data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import myservice.mynamespace.service.DemoEdmProvider;
+import myservice.mynamespace.util.Util;
+
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.server.api.uri.UriParameter;
+
+public class Storage {
+
+ // represent our database
+ private List<Entity> productList;
+ private List<Entity> categoryList;
+
+ public Storage() {
+
+ productList = new ArrayList<Entity>();
+ categoryList = new ArrayList<Entity>();
+
+ // creating some sample data
+ initProductSampleData();
+ initCategorySampleData();
+ }
+
+ /* PUBLIC FACADE */
+
+ public EntityCollection readEntitySetData(EdmEntitySet edmEntitySet) {
+ EntityCollection entitySet = null;
+
+ if (edmEntitySet.getName().equals(DemoEdmProvider.ES_PRODUCTS_NAME)) {
+ entitySet = getProducts();
+ } else if (edmEntitySet.getName().equals(DemoEdmProvider.ES_CATEGORIES_NAME)) {
+ entitySet = getCategories();
+ }
+
+ return entitySet;
+ }
+
+ public Entity readEntityData(EdmEntitySet edmEntitySet, List<UriParameter> keyParams) {
+ Entity entity = null;
+
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+ if (edmEntityType.getName().equals(DemoEdmProvider.ET_PRODUCT_NAME)) {
+ entity = getProduct(edmEntityType, keyParams);
+ } else if (edmEntityType.getName().equals(DemoEdmProvider.ET_CATEGORY_NAME)) {
+ entity = getCategory(edmEntityType, keyParams);
+ }
+
+ return entity;
+ }
+
+ // Navigation
+
+ public Entity getRelatedEntity(Entity entity, EdmEntityType relatedEntityType) {
+ EntityCollection collection = getRelatedEntityCollection(entity, relatedEntityType);
+ if (collection.getEntities().isEmpty()) {
+ return null;
+ }
+ return collection.getEntities().get(0);
+ }
+
+ public Entity getRelatedEntity(Entity entity, EdmEntityType relatedEntityType, List<UriParameter> keyPredicates) {
+
+ EntityCollection relatedEntities = getRelatedEntityCollection(entity, relatedEntityType);
+ return Util.findEntity(relatedEntityType, relatedEntities, keyPredicates);
+ }
+
+ public EntityCollection getRelatedEntityCollection(Entity sourceEntity, EdmEntityType targetEntityType) {
+ EntityCollection navigationTargetEntityCollection = new EntityCollection();
+
+ FullQualifiedName relatedEntityFqn = targetEntityType.getFullQualifiedName();
+ String sourceEntityFqn = sourceEntity.getType();
+
+ if (sourceEntityFqn.equals(DemoEdmProvider.ET_PRODUCT_FQN.getFullQualifiedNameAsString())
+ && relatedEntityFqn.equals(DemoEdmProvider.ET_CATEGORY_FQN)) {
+ // relation Products->Category (result all categories)
+ int productID = (Integer) sourceEntity.getProperty("ID").getValue();
+ if (productID == 1 || productID == 2) {
+ navigationTargetEntityCollection.getEntities().add(categoryList.get(0));
+ } else if (productID == 3 || productID == 4) {
+ navigationTargetEntityCollection.getEntities().add(categoryList.get(1));
+ } else if (productID == 5 || productID == 6) {
+ navigationTargetEntityCollection.getEntities().add(categoryList.get(2));
+ }
+ } else if (sourceEntityFqn.equals(DemoEdmProvider.ET_CATEGORY_FQN.getFullQualifiedNameAsString())
+ && relatedEntityFqn.equals(DemoEdmProvider.ET_PRODUCT_FQN)) {
+ // relation Category->Products (result all products)
+ int categoryID = (Integer) sourceEntity.getProperty("ID").getValue();
+ if (categoryID == 1) {
+ // the first 2 products are notebooks
+ navigationTargetEntityCollection.getEntities().addAll(productList.subList(0, 2));
+ } else if (categoryID == 2) {
+ // the next 2 products are organizers
+ navigationTargetEntityCollection.getEntities().addAll(productList.subList(2, 4));
+ } else if (categoryID == 3) {
+ // the first 2 products are monitors
+ navigationTargetEntityCollection.getEntities().addAll(productList.subList(4, 6));
+ }
+ }
+
+ if (navigationTargetEntityCollection.getEntities().isEmpty()) {
+ return null;
+ }
+
+ return navigationTargetEntityCollection;
+ }
+
+ /* INTERNAL */
+
+ private EntityCollection getProducts() {
+ EntityCollection retEntitySet = new EntityCollection();
+
+ for (Entity productEntity : this.productList) {
+ retEntitySet.getEntities().add(productEntity);
+ }
+
+ return retEntitySet;
+ }
+
+ private Entity getProduct(EdmEntityType edmEntityType, List<UriParameter> keyParams) {
+
+ // the list of entities at runtime
+ EntityCollection entityCollection = getProducts();
+
+ /* generic approach to find the requested entity */
+ return Util.findEntity(edmEntityType, entityCollection, keyParams);
+ }
+
+ private EntityCollection getCategories() {
+ EntityCollection entitySet = new EntityCollection();
+
+ for (Entity categoryEntity : this.categoryList) {
+ entitySet.getEntities().add(categoryEntity);
+ }
+
+ return entitySet;
+ }
+
+ private Entity getCategory(EdmEntityType edmEntityType, List<UriParameter> keyParams) {
+
+ // the list of entities at runtime
+ EntityCollection entitySet = getCategories();
+
+ /* generic approach to find the requested entity */
+ return Util.findEntity(edmEntityType, entitySet, keyParams);
+ }
+
+ /* HELPER */
+
+ private void initProductSampleData() {
+
+ Entity entity = new Entity();
+
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 1));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Notebook Basic 15"));
+ entity.addProperty(new Property(null, "Description", ValueType.PRIMITIVE,
+ "Notebook Basic, 1.7GHz - 15 XGA - 1024MB DDR2 SDRAM - 40GB"));
+ entity.setType(DemoEdmProvider.ET_PRODUCT_FQN.getFullQualifiedNameAsString());
+ productList.add(entity);
+
+ entity = new Entity();
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 2));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Notebook Professional 17"));
+ entity.addProperty(new Property(null, "Description", ValueType.PRIMITIVE,
+ "Notebook Professional, 2.8GHz - 15 XGA - 8GB DDR3 RAM - 500GB"));
+ entity.setType(DemoEdmProvider.ET_PRODUCT_FQN.getFullQualifiedNameAsString());
+ productList.add(entity);
+
+ entity = new Entity();
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 3));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "1UMTS PDA"));
+ entity.addProperty(new Property(null, "Description", ValueType.PRIMITIVE,
+ "Ultrafast 3G UMTS/HSDPA Pocket PC, supports GSM network"));
+ entity.setType(DemoEdmProvider.ET_PRODUCT_FQN.getFullQualifiedNameAsString());
+ productList.add(entity);
+
+ entity = new Entity();
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 4));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Comfort Easy"));
+ entity.addProperty(new Property(null, "Description", ValueType.PRIMITIVE,
+ "32 GB Digital Assitant with high-resolution color screen"));
+ entity.setType(DemoEdmProvider.ET_PRODUCT_FQN.getFullQualifiedNameAsString());
+ productList.add(entity);
+
+ entity = new Entity();
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 5));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Ergo Screen"));
+ entity.addProperty(new Property(null, "Description", ValueType.PRIMITIVE,
+ "19 Optimum Resolution 1024 x 768 @ 85Hz, resolution 1280 x 960"));
+ entity.setType(DemoEdmProvider.ET_PRODUCT_FQN.getFullQualifiedNameAsString());
+ productList.add(entity);
+
+ entity = new Entity();
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 6));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Flat Basic"));
+ entity.addProperty(new Property(null, "Description", ValueType.PRIMITIVE,
+ "Optimum Hi-Resolution max. 1600 x 1200 @ 85Hz, Dot Pitch: 0.24mm"));
+ entity.setType(DemoEdmProvider.ET_PRODUCT_FQN.getFullQualifiedNameAsString());
+ productList.add(entity);
+ }
+
+ private void initCategorySampleData() {
+
+ Entity entity = new Entity();
+
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 1));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Notebooks"));
+ entity.setType(DemoEdmProvider.ET_CATEGORY_FQN.getFullQualifiedNameAsString());
+ categoryList.add(entity);
+
+ entity = new Entity();
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 2));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Organizers"));
+ entity.setType(DemoEdmProvider.ET_CATEGORY_FQN.getFullQualifiedNameAsString());
+ categoryList.add(entity);
+
+ entity = new Entity();
+ entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 3));
+ entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Monitors"));
+ entity.setType(DemoEdmProvider.ET_CATEGORY_FQN.getFullQualifiedNameAsString());
+ categoryList.add(entity);
+ }
+
+}
diff --git a/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
new file mode 100755
index 0000000..7b1fef8
--- /dev/null
+++ b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
@@ -0,0 +1,211 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+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.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
+import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty;
+import org.apache.olingo.commons.api.edm.provider.CsdlNavigationPropertyBinding;
+import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
+import org.apache.olingo.commons.api.edm.provider.CsdlPropertyRef;
+import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
+
+public class DemoEdmProvider extends CsdlAbstractEdmProvider {
+
+ // Service Namespace
+ public static final String NAMESPACE = "OData.Demo";
+
+ // EDM Container
+ public static final String CONTAINER_NAME = "Container";
+ public static final FullQualifiedName CONTAINER = new FullQualifiedName(NAMESPACE, CONTAINER_NAME);
+
+ // Entity Types Names
+ public static final String ET_PRODUCT_NAME = "Product";
+ public static final FullQualifiedName ET_PRODUCT_FQN = new FullQualifiedName(NAMESPACE, ET_PRODUCT_NAME);
+
+ public static final String ET_CATEGORY_NAME = "Category";
+ public static final FullQualifiedName ET_CATEGORY_FQN = new FullQualifiedName(NAMESPACE, ET_CATEGORY_NAME);
+
+ // Entity Set Names
+ public static final String ES_PRODUCTS_NAME = "Products";
+ public static final String ES_CATEGORIES_NAME = "Categories";
+
+ @Override
+ public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) throws ODataException {
+
+ // this method is called for each EntityType that are configured in the Schema
+ CsdlEntityType entityType = null;
+
+ if (entityTypeName.equals(ET_PRODUCT_FQN)) {
+ // create EntityType properties
+ CsdlProperty id = new CsdlProperty().setName("ID")
+ .setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
+ CsdlProperty name = new CsdlProperty().setName("Name")
+ .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+ CsdlProperty description = new CsdlProperty().setName("Description")
+ .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+
+ // create PropertyRef for Key element
+ CsdlPropertyRef propertyRef = new CsdlPropertyRef();
+ propertyRef.setName("ID");
+
+ // navigation property: many-to-one, null not allowed (product must have a category)
+ CsdlNavigationProperty navProp = new CsdlNavigationProperty().setName("Category")
+ .setType(ET_CATEGORY_FQN).setNullable(false).setPartner("Products");
+ List<CsdlNavigationProperty> navPropList = new ArrayList<CsdlNavigationProperty>();
+ navPropList.add(navProp);
+
+ // configure EntityType
+ entityType = new CsdlEntityType();
+ entityType.setName(ET_PRODUCT_NAME);
+ entityType.setProperties(Arrays.asList(id, name, description));
+ entityType.setKey(Arrays.asList(propertyRef));
+ entityType.setNavigationProperties(navPropList);
+
+ } else if (entityTypeName.equals(ET_CATEGORY_FQN)) {
+ // create EntityType properties
+ CsdlProperty id = new CsdlProperty().setName("ID")
+ .setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
+ CsdlProperty name = new CsdlProperty().setName("Name")
+ .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+
+ // create PropertyRef for Key element
+ CsdlPropertyRef propertyRef = new CsdlPropertyRef();
+ propertyRef.setName("ID");
+
+ // navigation property: one-to-many
+ CsdlNavigationProperty navProp = new CsdlNavigationProperty().setName("Products")
+ .setType(ET_PRODUCT_FQN).setCollection(true).setPartner("Category");
+ List<CsdlNavigationProperty> navPropList = new ArrayList<CsdlNavigationProperty>();
+ navPropList.add(navProp);
+
+ // configure EntityType
+ entityType = new CsdlEntityType();
+ entityType.setName(ET_CATEGORY_NAME);
+ entityType.setProperties(Arrays.asList(id, name));
+ entityType.setKey(Arrays.asList(propertyRef));
+ entityType.setNavigationProperties(navPropList);
+ }
+
+ return entityType;
+
+ }
+
+ @Override
+ public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) throws ODataException {
+
+ CsdlEntitySet entitySet = null;
+
+ if (entityContainer.equals(CONTAINER)) {
+
+ if (entitySetName.equals(ES_PRODUCTS_NAME)) {
+
+ entitySet = new CsdlEntitySet();
+ entitySet.setName(ES_PRODUCTS_NAME);
+ entitySet.setType(ET_PRODUCT_FQN);
+
+ // navigation
+ CsdlNavigationPropertyBinding navPropBinding = new CsdlNavigationPropertyBinding();
+ navPropBinding.setTarget("Categories"); // the target entity set, where the navigation property points to
+ navPropBinding.setPath("Category"); // the path from entity type to navigation property
+ List<CsdlNavigationPropertyBinding> navPropBindingList = new ArrayList<CsdlNavigationPropertyBinding>();
+ navPropBindingList.add(navPropBinding);
+ entitySet.setNavigationPropertyBindings(navPropBindingList);
+
+ } else if (entitySetName.equals(ES_CATEGORIES_NAME)) {
+
+ entitySet = new CsdlEntitySet();
+ entitySet.setName(ES_CATEGORIES_NAME);
+ entitySet.setType(ET_CATEGORY_FQN);
+
+ // navigation
+ CsdlNavigationPropertyBinding navPropBinding = new CsdlNavigationPropertyBinding();
+ navPropBinding.setTarget("Products"); // the target entity set, where the navigation property points to
+ navPropBinding.setPath("Products"); // the path from entity type to navigation property
+ List<CsdlNavigationPropertyBinding> navPropBindingList = new ArrayList<CsdlNavigationPropertyBinding>();
+ navPropBindingList.add(navPropBinding);
+ entitySet.setNavigationPropertyBindings(navPropBindingList);
+ }
+ }
+
+ return entitySet;
+ }
+
+ @Override
+ public CsdlEntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName) throws ODataException {
+
+ // This method is invoked when displaying the service document at
+ // e.g. http://localhost:8080/DemoService/DemoService.svc
+ if (entityContainerName == null || entityContainerName.equals(CONTAINER)) {
+ CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
+ entityContainerInfo.setContainerName(CONTAINER);
+ return entityContainerInfo;
+ }
+
+ return null;
+ }
+
+ @Override
+ public List<CsdlSchema> getSchemas() throws ODataException {
+ // create Schema
+ CsdlSchema schema = new CsdlSchema();
+ schema.setNamespace(NAMESPACE);
+
+ // add EntityTypes
+ List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
+ entityTypes.add(getEntityType(ET_PRODUCT_FQN));
+ entityTypes.add(getEntityType(ET_CATEGORY_FQN));
+ schema.setEntityTypes(entityTypes);
+
+ // add EntityContainer
+ schema.setEntityContainer(getEntityContainer());
+
+ // finally
+ List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
+ schemas.add(schema);
+
+ return schemas;
+ }
+
+ @Override
+ public CsdlEntityContainer getEntityContainer() throws ODataException {
+
+ // create EntitySets
+ List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
+ entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
+ entitySets.add(getEntitySet(CONTAINER, ES_CATEGORIES_NAME));
+
+ // create EntityContainer
+ CsdlEntityContainer entityContainer = new CsdlEntityContainer();
+ entityContainer.setName(CONTAINER_NAME);
+ entityContainer.setEntitySets(entitySets);
+
+ return entityContainer;
+ }
+}
diff --git a/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
new file mode 100755
index 0000000..83dd676
--- /dev/null
+++ b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
@@ -0,0 +1,182 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.util.List;
+
+import myservice.mynamespace.data.Storage;
+
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.edm.EdmElement;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.processor.EntityCollectionProcessor;
+import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.server.api.uri.UriResourceNavigation;
+import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
+import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
+import org.apache.olingo.server.api.uri.queryoption.SelectOption;
+
+public class DemoEntityCollectionProcessor implements EntityCollectionProcessor {
+
+ private OData odata;
+ private ServiceMetadata srvMetadata;
+ // our database-mock
+ private Storage storage;
+
+ public DemoEntityCollectionProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+ this.srvMetadata = serviceMetadata;
+ }
+
+ /*
+ * This method is invoked when a collection of entities has to be read. In
+ * our example, this can be either a "normal" read operation, or a
+ * navigation:
+ *
+ * Example for "normal" read entity set operation:
+ * http://localhost:8080/DemoService/DemoService.svc/Categories
+ *
+ * Example for navigation
+ * http://localhost:8080/DemoService/DemoService.svc/Categories(3)/Products
+ */
+ public void readEntityCollection(ODataRequest request,
+ ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
+ throws ODataApplicationException, SerializerException {
+
+ // 1st retrieve the requested EdmEntitySet from the uriInfo
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ // in our example, the first segment is the EntitySet
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
+ EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
+
+ // 2nd: fetch the data from backend for this requested EntitySetName
+ EntityCollection entityCollection = storage.readEntitySetData(edmEntitySet);
+
+ // 3rd: apply system query options
+ SelectOption selectOption = uriInfo.getSelectOption();
+ ExpandOption expandOption = uriInfo.getExpandOption();
+
+ // handle $expand
+ // in our example: http://localhost:8080/DemoService/DemoService.svc/Categories/$expand=Products
+ // or http://localhost:8080/DemoService/DemoService.svc/Products?$expand=Category
+ if (expandOption != null) {
+ // retrieve the EdmNavigationProperty from the expand expression
+ // Note: in our example, we have only one NavigationProperty, so we can directly access it
+ EdmNavigationProperty edmNavigationProperty = null;
+ ExpandItem expandItem = expandOption.getExpandItems().get(0);
+ if(expandItem.isStar()) {
+ List<EdmNavigationPropertyBinding> bindings = edmEntitySet.getNavigationPropertyBindings();
+ // we know that there are navigation bindings
+ // however normally in this case a check if navigation bindings exists is done
+ if(!bindings.isEmpty()) {
+ // can in our case only be 'Category' or 'Products', so we can take the first
+ EdmNavigationPropertyBinding binding = bindings.get(0);
+ EdmElement property = edmEntitySet.getEntityType().getProperty(binding.getPath());
+ // we don't need to handle error cases, as it is done in the Olingo library
+ if(property instanceof EdmNavigationProperty) {
+ edmNavigationProperty = (EdmNavigationProperty) property;
+ }
+ }
+ } else {
+ // can be 'Category' or 'Products', no path supported
+ UriResource uriResource = expandItem.getResourcePath().getUriResourceParts().get(0);
+ // we don't need to handle error cases, as it is done in the Olingo library
+ if(uriResource instanceof UriResourceNavigation) {
+ edmNavigationProperty = ((UriResourceNavigation) uriResource).getProperty();
+ }
+ }
+
+ // can be 'Category' or 'Products', no path supported
+ // we don't need to handle error cases, as it is done in the Olingo library
+ if(edmNavigationProperty != null) {
+ String navPropName = edmNavigationProperty.getName();
+ EdmEntityType expandEdmEntityType = edmNavigationProperty.getType();
+
+ List<Entity> entityList = entityCollection.getEntities();
+ for (Entity entity : entityList) {
+ Link link = new Link();
+ link.setTitle(navPropName);
+ link.setType(Constants.ENTITY_NAVIGATION_LINK_TYPE);
+
+ if (edmNavigationProperty.isCollection()) { // in case of Categories/$expand=Products
+ // fetch the data for the $expand (to-many navigation) from backend
+ EntityCollection expandEntityCollection = storage.getRelatedEntityCollection(entity, expandEdmEntityType);
+ link.setInlineEntitySet(expandEntityCollection);
+ } else { // in case of Products?$expand=Category
+ // fetch the data for the $expand (to-one navigation) from backend
+ // here we get the data for the expand
+ Entity expandEntity = storage.getRelatedEntity(entity, expandEdmEntityType);
+ link.setInlineEntity(expandEntity);
+ }
+
+ // set the link - containing the expanded data - to the current entity
+ entity.getNavigationLinks().add(link);
+ }
+ }
+ }
+
+ // 4th: serialize
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+ // we need the property names of the $select, in order to build the context URL
+ String selectList = odata.createUriHelper().buildContextURLSelectList(edmEntityType, expandOption, selectOption);
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).selectList(selectList).build();
+
+ // adding the selectOption to the serializerOpts will actually tell the lib to do the job
+ EntityCollectionSerializerOptions opts = EntityCollectionSerializerOptions.with()
+ .contextURL(contextUrl)
+ .select(selectOption)
+ .expand(expandOption)
+ .build();
+
+ ODataSerializer serializer = odata.createSerializer(ODataFormat.fromContentType(responseFormat));
+ SerializerResult serializerResult = serializer.entityCollection(srvMetadata, edmEntityType, entityCollection, opts);
+
+ // 5th: configure the response object: set the body, headers and status code
+ response.setContent(serializerResult.getContent());
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ }
+
+}
diff --git a/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
new file mode 100755
index 0000000..281fdbe
--- /dev/null
+++ b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
@@ -0,0 +1,203 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.data.Storage;
+
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.ContextURL.Suffix;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.edm.EdmElement;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.processor.EntityProcessor;
+import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.server.api.uri.UriResourceNavigation;
+import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
+import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
+import org.apache.olingo.server.api.uri.queryoption.SelectOption;
+
+public class DemoEntityProcessor implements EntityProcessor {
+
+ private OData odata;
+ private ServiceMetadata srvMetadata;
+ private Storage storage;
+
+ public DemoEntityProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+ this.srvMetadata = serviceMetadata;
+ }
+
+ public void readEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
+ throws ODataApplicationException, SerializerException {
+
+ // 1. retrieve the Entity Type
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ // Note: only in our example we can assume that the first segment is the EntitySet
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
+ EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
+
+ // 2. retrieve the data from backend
+ List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
+ Entity entity = storage.readEntityData(edmEntitySet, keyPredicates);
+
+ // 3. apply system query options
+
+ // handle $select
+ SelectOption selectOption = uriInfo.getSelectOption();
+ // in our example, we don't have performance issues, so we can rely upon the handling in the Olingo lib
+ // nothing else to be done
+
+ // handle $expand
+ ExpandOption expandOption = uriInfo.getExpandOption();
+ // in our example: http://localhost:8080/DemoService/DemoService.svc/Categories(1)/$expand=Products
+ // or http://localhost:8080/DemoService/DemoService.svc/Products(1)?$expand=Category
+ if(expandOption != null) {
+ // retrieve the EdmNavigationProperty from the expand expression
+ // Note: in our example, we have only one NavigationProperty, so we can directly access it
+ EdmNavigationProperty edmNavigationProperty = null;
+ ExpandItem expandItem = expandOption.getExpandItems().get(0);
+ if(expandItem.isStar()) {
+ List<EdmNavigationPropertyBinding> bindings = edmEntitySet.getNavigationPropertyBindings();
+ // we know that there are navigation bindings
+ // however normally in this case a check if navigation bindings exists is done
+ if(!bindings.isEmpty()) {
+ // can in our case only be 'Category' or 'Products', so we can take the first
+ EdmNavigationPropertyBinding binding = bindings.get(0);
+ EdmElement property = edmEntitySet.getEntityType().getProperty(binding.getPath());
+ // we don't need to handle error cases, as it is done in the Olingo library
+ if(property instanceof EdmNavigationProperty) {
+ edmNavigationProperty = (EdmNavigationProperty) property;
+ }
+ }
+ } else {
+ // can be 'Category' or 'Products', no path supported
+ UriResource uriResource = expandItem.getResourcePath().getUriResourceParts().get(0);
+ // we don't need to handle error cases, as it is done in the Olingo library
+ if(uriResource instanceof UriResourceNavigation) {
+ edmNavigationProperty = ((UriResourceNavigation) uriResource).getProperty();
+ }
+ }
+
+ // can be 'Category' or 'Products', no path supported
+ // we don't need to handle error cases, as it is done in the Olingo library
+ if(edmNavigationProperty != null) {
+ EdmEntityType expandEdmEntityType = edmNavigationProperty.getType();
+ String navPropName = edmNavigationProperty.getName();
+
+ // build the inline data
+ Link link = new Link();
+ link.setTitle(navPropName);
+ link.setType(Constants.ENTITY_NAVIGATION_LINK_TYPE);
+
+ if(edmNavigationProperty.isCollection()){ // in case of Categories(1)/$expand=Products
+ // fetch the data for the $expand (to-many navigation) from backend
+ // here we get the data for the expand
+ EntityCollection expandEntityCollection = storage.getRelatedEntityCollection(entity, expandEdmEntityType);
+ link.setInlineEntitySet(expandEntityCollection);
+ } else { // in case of Products(1)?$expand=Category
+ // fetch the data for the $expand (to-one navigation) from backend
+ // here we get the data for the expand
+ Entity expandEntity = storage.getRelatedEntity(entity, expandEdmEntityType);
+ link.setInlineEntity(expandEntity);
+ }
+
+ // set the link - containing the expanded data - to the current entity
+ entity.getNavigationLinks().add(link);
+ }
+ }
+
+
+ // 4. serialize
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+ // we need the property names of the $select, in order to build the context URL
+ String selectList = odata.createUriHelper().buildContextURLSelectList(edmEntityType, expandOption, selectOption);
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet)
+ .selectList(selectList)
+ .suffix(Suffix.ENTITY).build();
+
+ // make sure that $expand and $select are considered by the serializer
+ // adding the selectOption to the serializerOpts will actually tell the lib to do the job
+ EntitySerializerOptions opts = EntitySerializerOptions.with()
+ .contextURL(contextUrl)
+ .select(selectOption)
+ .expand(expandOption)
+ .build();
+
+ ODataSerializer serializer = this.odata.createSerializer(ODataFormat.fromContentType(responseFormat));
+ SerializerResult serializerResult = serializer.entity(srvMetadata, edmEntityType, entity, opts);
+
+ // 5. configure the response object
+ response.setContent(serializerResult.getContent());
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ }
+
+
+
+ /*
+ * These processor methods are not handled in this tutorial
+ */
+
+ public void createEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo,
+ ContentType requestFormat, ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ public void updateEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo,
+ ContentType requestFormat, ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ public void deleteEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo)
+ throws ODataApplicationException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+}
diff --git a/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
new file mode 100755
index 0000000..c32c5c2
--- /dev/null
+++ b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
@@ -0,0 +1,150 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.data.Storage;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.processor.PrimitiveProcessor;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.server.api.uri.UriResourceProperty;
+
+public class DemoPrimitiveProcessor implements PrimitiveProcessor {
+
+ private OData odata;
+ private Storage storage;
+
+ public DemoPrimitiveProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+
+ }
+
+ /*
+ * In our example, the URL would be: http://localhost:8080/DemoService/DemoService.svc/Products(1)/Name
+ * and the response:
+ * {
+ *
+ * @odata.context: "$metadata#Products/Name",
+ * value: "Notebook Basic 15"
+ * }
+ */
+ public void readPrimitive(ODataRequest request, ODataResponse response,
+ UriInfo uriInfo, ContentType responseFormat)
+ throws ODataApplicationException, SerializerException {
+
+ // 1. Retrieve info from URI
+ // 1.1. retrieve the info about the requested entity set
+ List<UriResource> resourceParts = uriInfo.getUriResourceParts();
+ // Note: only in our example we can rely that the first segment is the EntitySet
+ UriResourceEntitySet uriEntityset = (UriResourceEntitySet) resourceParts.get(0);
+ EdmEntitySet edmEntitySet = uriEntityset.getEntitySet();
+ // the key for the entity
+ List<UriParameter> keyPredicates = uriEntityset.getKeyPredicates();
+
+ // 1.2. retrieve the requested (Edm) property
+ // the last segment is the Property
+ UriResourceProperty uriProperty = (UriResourceProperty) resourceParts.get(resourceParts.size() - 1);
+ EdmProperty edmProperty = uriProperty.getProperty();
+ String edmPropertyName = edmProperty.getName();
+ // in our example, we know we have only primitive types in our model
+ EdmPrimitiveType edmPropertyType = (EdmPrimitiveType) edmProperty.getType();
+
+ // 2. retrieve data from backend
+ // 2.1. retrieve the entity data, for which the property has to be read
+ Entity entity = storage.readEntityData(edmEntitySet, keyPredicates);
+ if (entity == null) { // Bad request
+ throw new ODataApplicationException("Entity not found",
+ HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ // 2.2. retrieve the property data from the entity
+ Property property = entity.getProperty(edmPropertyName);
+ if (property == null) {
+ throw new ODataApplicationException("Property not found",
+ HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ // 3. serialize
+ Object value = property.getValue();
+ if (value != null) {
+ // 3.1. configure the serializer
+ ODataFormat format = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = odata.createSerializer(format);
+
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).navOrPropertyPath(edmPropertyName).build();
+ PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextUrl).build();
+ // 3.2. serialize
+ SerializerResult serializerResult = serializer.primitive(edmPropertyType, property, options);
+ InputStream propertyStream = serializerResult.getContent();
+
+ // 4. configure the response object
+ response.setContent(propertyStream);
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ } else {
+ // in case there's no value for the property, we can skip the serialization
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+ }
+
+ /*
+ * These processor methods are not handled in this tutorial
+ */
+
+ public void updatePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat,
+ ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ public void deletePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo)
+ throws ODataApplicationException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+}
diff --git a/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/util/Util.java b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/util/Util.java
new file mode 100755
index 0000000..f16360f
--- /dev/null
+++ b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/util/Util.java
@@ -0,0 +1,149 @@
+/*
+ * 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 myservice.mynamespace.util;
+
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.edm.EdmBindingTarget;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.uri.UriParameter;
+
+public class Util {
+
+ public static Entity findEntity(EdmEntityType edmEntityType, EntityCollection entitySet,
+ List<UriParameter> keyParams) {
+
+ List<Entity> entityList = entitySet.getEntities();
+
+ // loop over all entities in order to find that one that matches
+ // all keys in request e.g. contacts(ContactID=1, CompanyID=1)
+ for (Entity entity : entityList) {
+ boolean foundEntity = entityMatchesAllKeys(edmEntityType, entity, keyParams);
+ if (foundEntity) {
+ return entity;
+ }
+ }
+
+ return null;
+ }
+
+ public static boolean entityMatchesAllKeys(EdmEntityType edmEntityType, Entity rt_entity,
+ List<UriParameter> keyParams) {
+
+ // loop over all keys
+ for (final UriParameter key : keyParams) {
+ // key
+ String keyName = key.getName();
+ String keyText = key.getText();
+
+ // note: below line doesn't consider: keyProp can be part of a complexType in V4
+ // in such case, it would be required to access it via getKeyPropertyRef()
+ // but since this isn't the case in our model, we ignore it in our implementation
+ EdmProperty edmKeyProperty = (EdmProperty) edmEntityType.getProperty(keyName);
+ // Edm: we need this info for the comparison below
+ Boolean isNullable = edmKeyProperty.isNullable();
+ Integer maxLength = edmKeyProperty.getMaxLength();
+ Integer precision = edmKeyProperty.getPrecision();
+ Boolean isUnicode = edmKeyProperty.isUnicode();
+ Integer scale = edmKeyProperty.getScale();
+ // get the EdmType in order to compare
+ EdmType edmType = edmKeyProperty.getType();
+ // if(EdmType instanceof EdmPrimitiveType) // do we need this?
+ EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) edmType;
+
+ // Runtime data: the value of the current entity
+ // don't need to check for null, this is done in FWK
+ Object valueObject = rt_entity.getProperty(keyName).getValue();
+ // TODO if the property is a complex type
+
+ // now need to compare the valueObject with the keyText String
+ // this is done using the type.valueToString
+ String valueAsString = null;
+ try {
+ valueAsString = edmPrimitiveType.valueToString(valueObject, isNullable,
+ maxLength, precision, scale, isUnicode);
+ } catch (EdmPrimitiveTypeException e) {
+ return false; // TODO proper Exception handling
+ }
+
+ if (valueAsString == null) {
+ return false;
+ }
+
+ boolean matches = valueAsString.equals(keyText);
+ // if any of the key properties is not found in the entity, we don't need to search further
+ if (!matches) {
+ return false;
+ }
+ // if the given key value is found in the current entity, continue with the next key
+ }
+
+ return true;
+ }
+
+ /**
+ * Example:
+ * For the following navigation: DemoService.svc/Categories(1)/Products
+ * we need the EdmEntitySet for the navigation property "Products"
+ *
+ * This is defined as follows in the metadata:
+ * <code>
+ *
+ * <EntitySet Name="Categories" EntityType="OData.Demo.Category">
+ * <NavigationPropertyBinding Path="Products" Target="Products"/>
+ * </EntitySet>
+ * </code>
+ * The "Target" attribute specifies the target EntitySet
+ * Therefore we need the startEntitySet "Categories" in order to retrieve the target EntitySet "Products"
+ */
+ public static EdmEntitySet getNavigationTargetEntitySet(EdmEntitySet startEntitySet,
+ EdmNavigationProperty edmNavigationProperty)
+ throws ODataApplicationException {
+
+ EdmEntitySet navigationTargetEntitySet = null;
+
+ String navPropName = edmNavigationProperty.getName();
+ EdmBindingTarget edmBindingTarget = startEntitySet.getRelatedBindingTarget(navPropName);
+ if (edmBindingTarget == null) {
+ throw new ODataApplicationException("Not supported.",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ if (edmBindingTarget instanceof EdmEntitySet) {
+ navigationTargetEntitySet = (EdmEntitySet) edmBindingTarget;
+ } else {
+ throw new ODataApplicationException("Not supported.",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ return navigationTargetEntitySet;
+ }
+
+}
diff --git a/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/web/DemoServlet.java b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/web/DemoServlet.java
new file mode 100755
index 0000000..5c828e5
--- /dev/null
+++ b/samples/tutorials/p6_queryoptions-es/src/main/java/myservice/mynamespace/web/DemoServlet.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package myservice.mynamespace.web;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import myservice.mynamespace.data.Storage;
+import myservice.mynamespace.service.DemoEdmProvider;
+import myservice.mynamespace.service.DemoEntityCollectionProcessor;
+import myservice.mynamespace.service.DemoEntityProcessor;
+import myservice.mynamespace.service.DemoPrimitiveProcessor;
+
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataHttpHandler;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DemoServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+ private static final Logger LOG = LoggerFactory.getLogger(DemoServlet.class);
+
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ try {
+ HttpSession session = req.getSession(true);
+ Storage storage = (Storage) session.getAttribute(Storage.class.getName());
+ if (storage == null) {
+ storage = new Storage();
+ session.setAttribute(Storage.class.getName(), storage);
+ }
+
+ // create odata handler and configure it with EdmProvider and Processor
+ OData odata = OData.newInstance();
+ ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>());
+ ODataHttpHandler handler = odata.createHandler(edm);
+ handler.register(new DemoEntityCollectionProcessor(storage));
+ handler.register(new DemoEntityProcessor(storage));
+ handler.register(new DemoPrimitiveProcessor(storage));
+
+ // let the handler do the work
+ handler.process(req, resp);
+ } catch (RuntimeException e) {
+ LOG.error("Server Error occurred in DemoServlet", e);
+ throw new ServletException(e);
+ }
+
+ }
+
+}
diff --git a/samples/tutorials/p6_queryoptions-es/src/main/webapp/WEB-INF/web.xml b/samples/tutorials/p6_queryoptions-es/src/main/webapp/WEB-INF/web.xml
new file mode 100755
index 0000000..bc216cb
--- /dev/null
+++ b/samples/tutorials/p6_queryoptions-es/src/main/webapp/WEB-INF/web.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.
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
+
+ <servlet>
+ <servlet-name>DemoServlet</servlet-name>
+ <servlet-class> myservice.mynamespace.web.DemoServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>DemoServlet</servlet-name>
+ <url-pattern>/DemoService.svc/*</url-pattern>
+ </servlet-mapping>
+</web-app>
diff --git a/samples/tutorials/p6_queryoptions-es/src/main/webapp/index.jsp b/samples/tutorials/p6_queryoptions-es/src/main/webapp/index.jsp
new file mode 100755
index 0000000..5ee033f
--- /dev/null
+++ b/samples/tutorials/p6_queryoptions-es/src/main/webapp/index.jsp
@@ -0,0 +1,49 @@
+<!--
+
+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.
+
+-->
+<html>
+<body>
+<h2>Hello World!</h2>
+<a href="DemoService.svc/">OData Olingo V4 Demo Service - Expand and Select</a>
+<h3>Sample Links</h3>
+<ul>
+ <li>
+ <a href="DemoService.svc/Products(1)/?$expand=Category">Expand - /Products(1)/?$expand=Category</a>
+ </li>
+ <li>
+ <a href="DemoService.svc/Products/?$expand=Category">Expand - /Products/?$expand=Category</a>
+ </li>
+ <li>
+ <a href="DemoService.svc/Products(1)/?$expand=*">Expand - /Products(1)/?$expand=*</a>
+ </li>
+ <li>
+ <a href="DemoService.svc/Categories(1)/?$expand=Products">Expand - /Categories(1)/?$expand=Products</a>
+ </li>
+ <li>
+ <a href="DemoService.svc/Categories/?$expand=Products">Expand - /Categories/?$expand=Products</a>
+ </li>
+ <li>
+ <a href="DemoService.svc/Categories/?$expand=*">Expand - /Categories/?$expand=*</a>
+ </li>
+</ul>
+
+
+</body>
+</html>
diff --git a/samples/tutorials/p7_queryoptions-f/pom.xml b/samples/tutorials/p7_queryoptions-f/pom.xml
new file mode 100644
index 0000000..439a37c
--- /dev/null
+++ b/samples/tutorials/p7_queryoptions-f/pom.xml
@@ -0,0 +1,80 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>my.group.id</groupId>
+ <artifactId>DemoService-QueryOptions-F</artifactId>
+ <packaging>war</packaging>
+ <version>0.0.1</version>
+
+ <name>${project.artifactId} Webapp</name>
+
+ <build>
+ <finalName>DemoService</finalName>
+ </build>
+
+ <properties>
+ <javax.version>2.5</javax.version>
+ <odata.version>4.0.0-beta-03</odata.version>
+ <slf4j.version>1.7.7</slf4j.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${javax.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-api</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-server-core</artifactId>
+ <version>${odata.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-api</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-commons-core</artifactId>
+ <version>${odata.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/data/Storage.java b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/data/Storage.java
new file mode 100644
index 0000000..d5d16c2
--- /dev/null
+++ b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/data/Storage.java
@@ -0,0 +1,125 @@
+/*
+ * 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 myservice.mynamespace.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.service.DemoEdmProvider;
+import myservice.mynamespace.util.Util;
+
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.uri.UriParameter;
+
+public class Storage {
+
+ private List<Entity> productList;
+
+ public Storage() {
+ productList = new ArrayList<Entity>();
+ initSampleData();
+ }
+
+ /* PUBLIC FACADE */
+
+ public EntityCollection readEntitySetData(EdmEntitySet edmEntitySet)throws ODataApplicationException{
+
+ // actually, this is only required if we have more than one Entity Sets
+ if(edmEntitySet.getName().equals(DemoEdmProvider.ES_PRODUCTS_NAME)){
+ return getProducts();
+ }
+
+ return null;
+ }
+
+ public Entity readEntityData(EdmEntitySet edmEntitySet, List<UriParameter> keyParams) throws ODataApplicationException{
+
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+
+ // actually, this is only required if we have more than one Entity Type
+ if(edmEntityType.getName().equals(DemoEdmProvider.ET_PRODUCT_NAME)){
+ return getProduct(edmEntityType, keyParams);
+ }
+
+ return null;
+ }
+
+
+
+ /* INTERNAL */
+
+ private EntityCollection getProducts(){
+ EntityCollection retEntitySet = new EntityCollection();
+
+ for(Entity productEntity : this.productList){
+ retEntitySet.getEntities().add(productEntity);
+ }
+
+ return retEntitySet;
+ }
+
+
+ private Entity getProduct(EdmEntityType edmEntityType, List<UriParameter> keyParams) throws ODataApplicationException{
+
+ // the list of entities at runtime
+ EntityCollection entitySet = getProducts();
+
+ /* generic approach to find the requested entity */
+ Entity requestedEntity = Util.findEntity(edmEntityType, entitySet, keyParams);
+
+ if(requestedEntity == null){
+ // this variable is null if our data doesn't contain an entity for the requested key
+ // Throw suitable exception
+ throw new ODataApplicationException("Entity for requested key doesn't exist",
+ HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ return requestedEntity;
+ }
+
+ /* HELPER */
+
+ private void initSampleData(){
+
+ // add some sample product entities
+ productList.add(new Entity()
+ .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 1))
+ .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Notebook Basic 15"))
+ .addProperty(new Property(null, "Description", ValueType.PRIMITIVE, "Notebook Basic, 1.7GHz - 15 XGA - 1024MB DDR2 SDRAM - 40GB")));
+
+ productList.add(new Entity()
+ .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 2))
+ .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "1UMTS PDA"))
+ .addProperty(new Property(null, "Description", ValueType.PRIMITIVE, "Ultrafast 3G UMTS/HSDPA Pocket PC, supports GSM network")));
+
+ productList.add(new Entity()
+ .addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 3))
+ .addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Ergo Screen"))
+ .addProperty(new Property(null, "Description", ValueType.PRIMITIVE, "19 Optimum Resolution 1024 x 768 @ 85Hz, resolution 1280 x 960")));
+
+ }
+}
diff --git a/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
new file mode 100644
index 0000000..15140e1
--- /dev/null
+++ b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEdmProvider.java
@@ -0,0 +1,153 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
+import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
+import org.apache.olingo.commons.api.edm.provider.CsdlPropertyRef;
+import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
+
+public class DemoEdmProvider extends CsdlAbstractEdmProvider {
+
+ // Service Namespace
+ public static final String NAMESPACE = "OData.Demo";
+
+ // EDM Container
+ public static final String CONTAINER_NAME = "Container";
+ public static final FullQualifiedName CONTAINER = new FullQualifiedName(NAMESPACE, CONTAINER_NAME);
+
+ // Entity Types Names
+ public static final String ET_PRODUCT_NAME = "Product";
+ public static final FullQualifiedName ET_PRODUCT_FQN = new FullQualifiedName(NAMESPACE, ET_PRODUCT_NAME);
+
+ // Entity Set Names
+ public static final String ES_PRODUCTS_NAME = "Products";
+
+
+ @Override
+ public CsdlEntityType getEntityType(FullQualifiedName entityTypeName)
+ throws ODataException {
+ // this method is called for one of the EntityTypes that are configured in the Schema
+ if(ET_PRODUCT_FQN.equals(entityTypeName)){
+
+ //create EntityType properties
+ CsdlProperty id = new CsdlProperty().setName("ID").setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
+ CsdlProperty name = new CsdlProperty().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+ CsdlProperty description = new CsdlProperty().setName("Description").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+
+ // create PropertyRef for Key element
+ CsdlPropertyRef propertyRef = new CsdlPropertyRef();
+ propertyRef.setName("ID");
+
+ // configure EntityType
+ CsdlEntityType entityType = new CsdlEntityType();
+ entityType.setName(ET_PRODUCT_NAME);
+ entityType.setProperties(Arrays.asList(id, name, description));
+ entityType.setKey(Collections.singletonList(propertyRef));
+
+ return entityType;
+ }
+
+ return null;
+
+ }
+
+ @Override
+ public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer,
+ String entitySetName) throws ODataException {
+ if(entityContainer.equals(CONTAINER)){
+ if(entitySetName.equals(ES_PRODUCTS_NAME)){
+ CsdlEntitySet entitySet = new CsdlEntitySet();
+ entitySet.setName(ES_PRODUCTS_NAME);
+ entitySet.setType(ET_PRODUCT_FQN);
+
+ return entitySet;
+ }
+ }
+
+ return null;
+
+ }
+
+ @Override
+ public CsdlEntityContainerInfo getEntityContainerInfo(
+ FullQualifiedName entityContainerName) throws ODataException {
+ // This method is invoked when displaying the service document at e.g. http://localhost:8080/DemoService/DemoService.svc
+ if(entityContainerName == null || entityContainerName.equals(CONTAINER)){
+ CsdlEntityContainerInfo entityContainerInfo = new CsdlEntityContainerInfo();
+ entityContainerInfo.setContainerName(CONTAINER);
+ return entityContainerInfo;
+ }
+
+ return null;
+
+ }
+
+ @Override
+ public List<CsdlSchema> getSchemas() throws ODataException {
+ // create Schema
+ CsdlSchema schema = new CsdlSchema();
+ schema.setNamespace(NAMESPACE);
+
+ // add EntityTypes
+ List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
+ entityTypes.add(getEntityType(ET_PRODUCT_FQN));
+ schema.setEntityTypes(entityTypes);
+
+ // add EntityContainer
+ schema.setEntityContainer(getEntityContainer());
+
+ // finally
+ List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
+ schemas.add(schema);
+
+ return schemas;
+
+ }
+
+ @Override
+ public CsdlEntityContainer getEntityContainer() throws ODataException {
+ // create EntitySets
+ List<CsdlEntitySet> entitySets = new ArrayList<CsdlEntitySet>();
+ entitySets.add(getEntitySet(CONTAINER, ES_PRODUCTS_NAME));
+
+ // create EntityContainer
+ CsdlEntityContainer entityContainer = new CsdlEntityContainer();
+ entityContainer.setName(CONTAINER_NAME);
+ entityContainer.setEntitySets(entitySets);
+
+ return entityContainer;
+
+ }
+
+
+
+}
diff --git a/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
new file mode 100644
index 0000000..292a0c4
--- /dev/null
+++ b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java
@@ -0,0 +1,134 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.data.Storage;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.processor.EntityCollectionProcessor;
+import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.server.api.uri.queryoption.FilterOption;
+import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
+
+public class DemoEntityCollectionProcessor implements EntityCollectionProcessor {
+
+ private OData odata;
+ private ServiceMetadata serviceMetadata;
+ private Storage storage;
+
+ public DemoEntityCollectionProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+ this.serviceMetadata = serviceMetadata;
+ }
+
+ public void readEntityCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat) throws ODataApplicationException, SerializerException {
+
+ // 1st: retrieve the requested EntitySet from the uriInfo (representation of the parsed URI)
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0); // in our example, the first segment is the EntitySet
+ EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
+
+ // 2nd: fetch the data from backend for this requested EntitySetName and deliver as EntitySet
+ EntityCollection entityCollection = storage.readEntitySetData(edmEntitySet);
+
+ // 3rd: Check if filter system query option is provided and apply the expression if necessary
+ FilterOption filterOption = uriInfo.getFilterOption();
+ if(filterOption != null) {
+ // Apply $filter system query option
+ try {
+ List<Entity> entityList = entityCollection.getEntities();
+ Iterator<Entity> entityIterator = entityList.iterator();
+
+ // Evaluate the expression for each entity
+ // If the expression is evaluated to "true", keep the entity otherwise remove it from the entityList
+ while (entityIterator.hasNext()) {
+ // To evaluate the the expression, create an instance of the Filter Expression Visitor and pass
+ // the current entity to the constructor
+ Entity currentEntity = entityIterator.next();
+ Expression filterExpression = filterOption.getExpression();
+ FilterExpressionVisitor expressionVisitor = new FilterExpressionVisitor(currentEntity);
+
+ // Start evaluating the expression
+ Object visitorResult = filterExpression.accept(expressionVisitor);
+
+ // The result of the filter expression must be of type Edm.Boolean
+ if(visitorResult instanceof Boolean) {
+ if(visitorResult != null && Boolean.FALSE.equals(visitorResult)) {
+ // The expression evaluated to false, so we have to remove the currentEntity from entityList
+ entityIterator.remove();
+ }
+ } else {
+ throw new ODataApplicationException("A filter expression must evaulate to type Edm.Boolean",
+ HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ENGLISH);
+ }
+ }
+
+ } catch (ExpressionVisitException e) {
+ throw new ODataApplicationException("Exception in filter evaluation",
+ HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ENGLISH);
+ }
+ }
+
+ // 4th: create a serializer based on the requested format (json)
+ ODataFormat format = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = odata.createSerializer(format);
+
+ // and serialize the content: transform from the EntitySet object to InputStream
+ EdmEntityType edmEntityType = edmEntitySet.getEntityType();
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).build();
+
+ EntityCollectionSerializerOptions opts = EntityCollectionSerializerOptions.with().contextURL(contextUrl).build();
+ SerializerResult serializerResult = serializer.entityCollection(serviceMetadata, edmEntityType, entityCollection, opts);
+ InputStream serializedContent = serializerResult.getContent();
+
+ // 5th: configure the response object: set the body, headers and status code
+ response.setContent(serializedContent);
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ }
+}
diff --git a/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
new file mode 100644
index 0000000..e3c8767
--- /dev/null
+++ b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEntityProcessor.java
@@ -0,0 +1,126 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.data.Storage;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.processor.EntityProcessor;
+import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+
+public class DemoEntityProcessor implements EntityProcessor {
+
+
+ private OData odata;
+ private ServiceMetadata serviceMetadata;
+ private Storage storage;
+
+
+
+ public DemoEntityProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+ this.serviceMetadata = serviceMetadata;
+ }
+
+
+ public void readEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
+ throws ODataApplicationException, SerializerException {
+
+ // 1. retrieve the Entity Type
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ // Note: only in our example we can assume that the first segment is the EntitySet
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
+ EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
+
+ // 2. retrieve the data from backend
+ List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
+ Entity entity = storage.readEntityData(edmEntitySet, keyPredicates);
+
+ // 3. serialize
+ EdmEntityType entityType = edmEntitySet.getEntityType();
+
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).suffix(ContextURL.Suffix.ENTITY).build();
+ // expand and select currently not supported
+ EntitySerializerOptions options = EntitySerializerOptions.with().contextURL(contextUrl).build();
+
+ ODataFormat oDataFormat = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = this.odata.createSerializer(oDataFormat);
+ SerializerResult serializerResult = serializer.entity(serviceMetadata, entityType, entity, options);
+ InputStream entityStream = serializerResult.getContent();
+
+ //4. configure the response object
+ response.setContent(entityStream);
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ }
+
+
+
+
+ /*
+ * These processor methods are not handled in this tutorial
+ * */
+
+
+ public void createEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat, ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+
+ public void updateEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat, ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+
+ public void deleteEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo) throws ODataApplicationException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+}
diff --git a/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.java
new file mode 100644
index 0000000..1ba0c75
--- /dev/null
+++ b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoPrimitiveProcessor.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 myservice.mynamespace.service;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Locale;
+
+import myservice.mynamespace.data.Storage;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.ODataRequest;
+import org.apache.olingo.server.api.ODataResponse;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.processor.PrimitiveProcessor;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
+import org.apache.olingo.server.api.serializer.SerializerException;
+import org.apache.olingo.server.api.serializer.SerializerResult;
+import org.apache.olingo.server.api.uri.UriInfo;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+import org.apache.olingo.server.api.uri.UriResourceProperty;
+
+public class DemoPrimitiveProcessor implements PrimitiveProcessor {
+
+ private OData odata;
+ private Storage storage;
+
+ public DemoPrimitiveProcessor(Storage storage) {
+ this.storage = storage;
+ }
+
+ public void init(OData odata, ServiceMetadata serviceMetadata) {
+ this.odata = odata;
+
+ }
+
+ /*
+ * In our example, the URL would be: http://localhost:8080/DemoService/DemoService.svc/Products(1)/Name
+ * and the response:
+ * {
+ * @odata.context: "$metadata#Products/Name",
+ * value: "Notebook Basic 15"
+ * }
+ * */
+ public void readPrimitive(ODataRequest request, ODataResponse response,
+ UriInfo uriInfo, ContentType responseFormat)
+ throws ODataApplicationException, SerializerException {
+
+ // 1. Retrieve info from URI
+ // 1.1. retrieve the info about the requested entity set
+ List<UriResource> resourceParts = uriInfo.getUriResourceParts();
+ // Note: only in our example we can rely that the first segment is the EntitySet
+ UriResourceEntitySet uriEntityset = (UriResourceEntitySet) resourceParts.get(0);
+ EdmEntitySet edmEntitySet = uriEntityset.getEntitySet();
+ // the key for the entity
+ List<UriParameter> keyPredicates = uriEntityset.getKeyPredicates();
+
+ // 1.2. retrieve the requested (Edm) property
+ UriResourceProperty uriProperty = (UriResourceProperty)resourceParts.get(resourceParts.size() -1); // the last segment is the Property
+ EdmProperty edmProperty = uriProperty.getProperty();
+ String edmPropertyName = edmProperty.getName();
+ // in our example, we know we have only primitive types in our model
+ EdmPrimitiveType edmPropertyType = (EdmPrimitiveType) edmProperty.getType();
+
+
+ // 2. retrieve data from backend
+ // 2.1. retrieve the entity data, for which the property has to be read
+ Entity entity = storage.readEntityData(edmEntitySet, keyPredicates);
+ if (entity == null) { // Bad request
+ throw new ODataApplicationException("Entity not found", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ // 2.2. retrieve the property data from the entity
+ Property property = entity.getProperty(edmPropertyName);
+ if (property == null) {
+ throw new ODataApplicationException("Property not found", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
+ }
+
+ // 3. serialize
+ Object value = property.getValue();
+ if (value != null) {
+ // 3.1. configure the serializer
+ ODataFormat format = ODataFormat.fromContentType(responseFormat);
+ ODataSerializer serializer = odata.createSerializer(format);
+
+ ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).navOrPropertyPath(edmPropertyName).build();
+ PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextUrl).build();
+ // 3.2. serialize
+ SerializerResult serializerResult = serializer.primitive(edmPropertyType, property, options);
+ InputStream propertyStream = serializerResult.getContent();
+
+ //4. configure the response object
+ response.setContent(propertyStream);
+ response.setStatusCode(HttpStatusCode.OK.getStatusCode());
+ response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
+ } else {
+ // in case there's no value for the property, we can skip the serialization
+ response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
+ }
+ }
+
+
+
+ /*
+ * These processor methods are not handled in this tutorial
+ * */
+
+ public void updatePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat, ContentType responseFormat)
+ throws ODataApplicationException, DeserializerException, SerializerException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+
+ public void deletePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo) throws ODataApplicationException {
+ throw new ODataApplicationException("Not supported.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
+ }
+}
diff --git a/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/FilterExpressionVisitor.java b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/FilterExpressionVisitor.java
new file mode 100644
index 0000000..615c384
--- /dev/null
+++ b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/service/FilterExpressionVisitor.java
@@ -0,0 +1,300 @@
+/*
+ * 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 myservice.mynamespace.service;
+
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.uri.UriInfoResource;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty;
+import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind;
+import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
+import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
+import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind;
+import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind;
+
+public class FilterExpressionVisitor implements ExpressionVisitor<Object> {
+
+ private Entity currentEntity;
+
+ public FilterExpressionVisitor(Entity currentEntity) {
+ this.currentEntity = currentEntity;
+ }
+
+ @Override
+ public Object visitMember(UriInfoResource member) throws ExpressionVisitException, ODataApplicationException {
+ // To keeps things simple, this tutorial allows only primitive properties.
+ // We have faith that the java type of Edm.Int32 is Integer
+
+ final List<UriResource> uriResourceParts = member.getUriResourceParts();
+
+ // Make sure that the resource path of the property contains only a single segment and a primitive property
+ // has been addressed. We can be sure, that the property exists because the UriParser checks if the
+ // property has been defined in service metadata document.
+
+ if(uriResourceParts.size() == 1 && uriResourceParts.get(0) instanceof UriResourcePrimitiveProperty) {
+ UriResourcePrimitiveProperty uriResourceProperty = (UriResourcePrimitiveProperty) uriResourceParts.get(0);
+ return currentEntity.getProperty(uriResourceProperty.getProperty().getName()).getValue();
+ } else {
+ // The OData specification allows in addition complex properties and navigation properties
+ // with a target cardinality 0..1 or 1.
+ // This means any combination can occur e.g. Supplier/Address/City
+ // -> Navigation properties Supplier
+ // -> Complex Property Address
+ // -> Primitive Property City
+ // For such cases the resource path returns a list of UriResourceParts
+ throw new ODataApplicationException("Only primitive properties are implemented in filter expressions",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
+ }
+ }
+
+ @Override
+ public Object visitLiteral(String literal) throws ExpressionVisitException, ODataApplicationException {
+ // To keep this tutorial simple, our filter expression visitor supports only Edm.Int32 and Edm.String
+ // In real world scenarios it can be difficult to guess the type of an literal.
+ // We can be sure, that the literal is a valid OData literal because the URI Parser checks
+ // the lexicographical structure
+
+ // String literals start and end with an single quotation mark
+ if(literal.startsWith("'") && literal.endsWith("'")) {
+ String stringLiteral = "";
+ if(literal.length() > 2) {
+ stringLiteral = literal.substring(1, literal.length() - 1);
+ }
+
+ return stringLiteral;
+ } else {
+ // Try to convert the literal into an Java Integer
+ try {
+ return Integer.parseInt(literal);
+ } catch(NumberFormatException e) {
+ throw new ODataApplicationException("Only Edm.Int32 and Edm.String literals are implemented",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
+ }
+ }
+ }
+
+ @Override
+ public Object visitUnaryOperator(UnaryOperatorKind operator, Object operand)
+ throws ExpressionVisitException, ODataApplicationException {
+ // OData allows two different unary operators. We have to take care, that the type of the operand fits to
+ // operand
+
+ if(operator == UnaryOperatorKind.NOT && operand instanceof Boolean) {
+ // 1.) boolean negation
+ return !(Boolean) operand;
+ } else if(operator == UnaryOperatorKind.MINUS && operand instanceof Integer){
+ // 2.) arithmetic minus
+ return -(Integer) operand;
+ }
+
+ // Operation not processed, throw an exception
+ throw new ODataApplicationException("Invalid type for unary operator",
+ HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ENGLISH);
+ }
+
+ @Override
+ public Object visitBinaryOperator(BinaryOperatorKind operator, Object left, Object right)
+ throws ExpressionVisitException, ODataApplicationException {
+
+ // Binary Operators are split up in three different kinds. Up to the kind of the operator it can be applied
+ // to different types
+ // - Arithmetic operations like add, minus, modulo, etc. are allowed on numeric types like Edm.Int32
+ // - Logical operations are allowed on numeric types and also Edm.String
+ // - Boolean operations like and, or are allowed on Edm.Boolean
+ // A detailed explanation can be found in OData Version 4.0 Part 2: URL Conventions
+
+ if (operator == BinaryOperatorKind.ADD
+ || operator == BinaryOperatorKind.MOD
+ || operator == BinaryOperatorKind.MUL
+ || operator == BinaryOperatorKind.DIV
+ || operator == BinaryOperatorKind.SUB) {
+ return evaluateArithmeticOperation(operator, left, right);
+ } else if (operator == BinaryOperatorKind.EQ
+ || operator == BinaryOperatorKind.NE
+ || operator == BinaryOperatorKind.GE
+ || operator == BinaryOperatorKind.GT
+ || operator == BinaryOperatorKind.LE
+ || operator == BinaryOperatorKind.LT) {
+ return evaluateComparisonOperation(operator, left, right);
+ } else if (operator == BinaryOperatorKind.AND
+ || operator == BinaryOperatorKind.OR) {
+ return evaluateBooleanOperation(operator, left, right);
+ } else {
+ throw new ODataApplicationException("Binary operation " + operator.name() + " is not implemented",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
+ }
+ }
+
+ private Object evaluateBooleanOperation(BinaryOperatorKind operator, Object left, Object right)
+ throws ODataApplicationException {
+
+ // First check that both operands are of type Boolean
+ if(left instanceof Boolean && right instanceof Boolean) {
+ Boolean valueLeft = (Boolean) left;
+ Boolean valueRight = (Boolean) right;
+
+ // Than calculate the result value
+ if(operator == BinaryOperatorKind.AND) {
+ return valueLeft && valueRight;
+ } else {
+ // OR
+ return valueLeft || valueRight;
+ }
+ } else {
+ throw new ODataApplicationException("Boolean operations needs two numeric operands",
+ HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ENGLISH);
+ }
+ }
+
+ private Object evaluateComparisonOperation(BinaryOperatorKind operator, Object left, Object right)
+ throws ODataApplicationException {
+
+ // All types in our tutorial supports all logical operations, but we have to make sure that the types are equals
+ if(left.getClass().equals(right.getClass()) && left instanceof Comparable) {
+ // Luckily all used types String, Boolean and also Integer support the interface Comparable
+ int result;
+ if(left instanceof Integer) {
+ result = ((Comparable<Integer>) (Integer)left).compareTo((Integer) right);
+ } else if(left instanceof String) {
+ result = ((Comparable<String>) (String)left).compareTo((String) right);
+ } else if(left instanceof Boolean) {
+ result = ((Comparable<Boolean>) (Boolean)left).compareTo((Boolean) right);
+ } else {
+ throw new ODataApplicationException("Class " + left.getClass().getCanonicalName() + " not expected",
+ HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ENGLISH);
+ }
+
+ if (operator == BinaryOperatorKind.EQ) {
+ return result == 0;
+ } else if (operator == BinaryOperatorKind.NE) {
+ return result != 0;
+ } else if (operator == BinaryOperatorKind.GE) {
+ return result >= 0;
+ } else if (operator == BinaryOperatorKind.GT) {
+ return result > 0;
+ } else if (operator == BinaryOperatorKind.LE) {
+ return result <= 0;
+ } else {
+ // BinaryOperatorKind.LT
+ return result < 0;
+ }
+
+ } else {
+ throw new ODataApplicationException("Comparision needs two equal types",
+ HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ENGLISH);
+ }
+ }
+
+ private Object evaluateArithmeticOperation(BinaryOperatorKind operator, Object left,
+ Object right) throws ODataApplicationException {
+
+ // First check if the type of both operands is numerical
+ if(left instanceof Integer && right instanceof Integer) {
+ Integer valueLeft = (Integer) left;
+ Integer valueRight = (Integer) right;
+
+ // Than calculate the result value
+ if(operator == BinaryOperatorKind.ADD) {
+ return valueLeft + valueRight;
+ } else if(operator == BinaryOperatorKind.SUB) {
+ return valueLeft - valueRight;
+ } else if(operator == BinaryOperatorKind.MUL) {
+ return valueLeft * valueRight;
+ } else if(operator == BinaryOperatorKind.DIV) {
+ return valueLeft / valueRight;
+ } else {
+ // BinaryOperatorKind,MOD
+ return valueLeft % valueRight;
+ }
+ } else {
+ throw new ODataApplicationException("Arithmetic operations needs two numeric operands",
+ HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ENGLISH);
+ }
+ }
+
+ @Override
+ public Object visitMethodCall(MethodKind methodCall, List<Object> parameters)
+ throws ExpressionVisitException, ODataApplicationException {
+
+ // To keep this tutorial small and simple, we implement only one method call
+ if(methodCall == MethodKind.CONTAINS) {
+ // "Contains" gets two parameters, both have to be of type String
+ // e.g. /Products?$filter=contains(Description, '1024 MB')
+ //
+ // First the method visistMember is called, which returns the current String value of the property.
+ // After that the method visitLiteral is called with the string literal '1024 MB',
+ // which returns a String
+ //
+ // Both String values are passed to visitMethodCall.
+ if(parameters.get(0) instanceof String && parameters.get(1) instanceof String) {
+ String valueParam1 = (String) parameters.get(0);
+ String valueParam2 = (String) parameters.get(1);
+
+ return valueParam1.contains(valueParam2);
+ } else {
+ throw new ODataApplicationException("Contains needs two parametes of type Edm.String",
+ HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ENGLISH);
+ }
+ } else {
+ throw new ODataApplicationException("Method call " + methodCall + " not implemented",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
+ }
+ }
+
+ @Override
+ public Object visitTypeLiteral(EdmType type) throws ExpressionVisitException, ODataApplicationException {
+ throw new ODataApplicationException("Type literals are not implemented",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
+ }
+
+ @Override
+ public Object visitAlias(String aliasName) throws ExpressionVisitException, ODataApplicationException {
+ throw new ODataApplicationException("Aliases are not implemented",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
+ }
+
+ @Override
+ public Object visitEnum(EdmEnumType type, List<String> enumValues)
+ throws ExpressionVisitException, ODataApplicationException {
+ throw new ODataApplicationException("Enums are not implemented",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
+ }
+
+ @Override
+ public Object visitLambdaExpression(String lambdaFunction, String lambdaVariable, Expression expression)
+ throws ExpressionVisitException, ODataApplicationException {
+ throw new ODataApplicationException("Lamdba expressions are not implemented",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
+ }
+
+ @Override
+ public Object visitLambdaReference(String variableName)
+ throws ExpressionVisitException, ODataApplicationException {
+ throw new ODataApplicationException("Lamdba references are not implemented",
+ HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
+ }
+}
diff --git a/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/util/Util.java b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/util/Util.java
new file mode 100644
index 0000000..16c7745
--- /dev/null
+++ b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/util/Util.java
@@ -0,0 +1,120 @@
+/*
+ * 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 myservice.mynamespace.util;
+
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntityCollection;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.http.HttpStatusCode;
+import org.apache.olingo.server.api.ODataApplicationException;
+import org.apache.olingo.server.api.uri.UriInfoResource;
+import org.apache.olingo.server.api.uri.UriParameter;
+import org.apache.olingo.server.api.uri.UriResource;
+import org.apache.olingo.server.api.uri.UriResourceEntitySet;
+
+public class Util {
+
+ public static EdmEntitySet getEdmEntitySet(UriInfoResource uriInfo) throws ODataApplicationException {
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ // To get the entity set we have to interpret all URI segments
+ if (!(resourcePaths.get(0) instanceof UriResourceEntitySet)) {
+ // Here we should interpret the whole URI but in this example we do not support navigation so we throw an exception
+ throw new ODataApplicationException("Invalid resource type for first segment.", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(),Locale.ENGLISH);
+ }
+
+ UriResourceEntitySet uriResource = (UriResourceEntitySet) resourcePaths.get(0);
+
+ return uriResource.getEntitySet();
+ }
+
+
+ public static Entity findEntity(EdmEntityType edmEntityType, EntityCollection entitySet, List<UriParameter> keyParams) throws ODataApplicationException {
+
+ List<Entity> entityList = entitySet.getEntities();
+
+ // loop over all entities in order to find that one that matches all keys in request e.g. contacts(ContactID=1, CompanyID=1)
+ for(Entity entity : entityList){
+ boolean foundEntity = entityMatchesAllKeys(edmEntityType, entity, keyParams);
+ if(foundEntity) {
+ return entity;
+ }
+ }
+
+ return null;
+ }
+
+
+ public static boolean
+ entityMatchesAllKeys(EdmEntityType edmEntityType, Entity rt_entity, List<UriParameter> keyParams)
+ throws ODataApplicationException {
+
+ // loop over all keys
+ for (final UriParameter key : keyParams) {
+ // key
+ String keyName = key.getName();
+ String keyText = key.getText();
+
+ // Edm: we need this info for the comparison below
+ EdmProperty edmKeyProperty = (EdmProperty) edmEntityType.getProperty(keyName);
+ Boolean isNullable = edmKeyProperty.isNullable();
+ Integer maxLength = edmKeyProperty.getMaxLength();
+ Integer precision = edmKeyProperty.getPrecision();
+ Boolean isUnicode = edmKeyProperty.isUnicode();
+ Integer scale = edmKeyProperty.getScale();
+ // get the EdmType in order to compare
+ EdmType edmType = edmKeyProperty.getType();
+ // if(EdmType instanceof EdmPrimitiveType) // do we need this?
+ EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) edmType;
+
+ // Runtime data: the value of the current entity
+ // don't need to check for null, this is done in olingo library
+ Object valueObject = rt_entity.getProperty(keyName).getValue();
+
+ // now need to compare the valueObject with the keyText String
+ // this is done using type.valueToString
+ String valueAsString = null;
+ try {
+ valueAsString = edmPrimitiveType.valueToString(valueObject, isNullable, maxLength, precision, scale, isUnicode);
+ } catch (EdmPrimitiveTypeException e) {
+ throw new ODataApplicationException("Failed to retrieve String value",
+ HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ENGLISH, e);
+ }
+
+ if (valueAsString == null) {
+ return false;
+ }
+
+ boolean matches = valueAsString.equals(keyText);
+ if (!matches) {
+ // if any of the key properties is not found in the entity, we don't need to search further
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/web/DemoServlet.java b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/web/DemoServlet.java
new file mode 100644
index 0000000..fe5cdbb
--- /dev/null
+++ b/samples/tutorials/p7_queryoptions-f/src/main/java/myservice/mynamespace/web/DemoServlet.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 myservice.mynamespace.web;
+
+import java.io.IOException;
+import java.lang.Override;import java.lang.RuntimeException;import java.util.ArrayList;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import myservice.mynamespace.data.Storage;
+import myservice.mynamespace.service.DemoEdmProvider;
+import myservice.mynamespace.service.DemoEntityCollectionProcessor;
+import myservice.mynamespace.service.DemoEntityProcessor;
+import myservice.mynamespace.service.DemoPrimitiveProcessor;
+
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.ODataHttpHandler;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DemoServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+ private static final Logger LOG = LoggerFactory.getLogger(DemoServlet.class);
+
+
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ try {
+ HttpSession session = req.getSession(true);
+ Storage storage = (Storage) session.getAttribute(Storage.class.getName());
+ if (storage == null) {
+ storage = new Storage();
+ session.setAttribute(Storage.class.getName(), storage);
+ }
+
+ // create odata handler and configure it with EdmProvider and Processor
+ OData odata = OData.newInstance();
+ ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>());
+ ODataHttpHandler handler = odata.createHandler(edm);
+ handler.register(new DemoEntityCollectionProcessor(storage));
+ handler.register(new DemoEntityProcessor(storage));
+ handler.register(new DemoPrimitiveProcessor(storage));
+
+ // let the handler do the work
+ handler.process(req, resp);
+ } catch (RuntimeException e) {
+ LOG.error("Server Error occurred in ExampleServlet", e);
+ throw new ServletException(e);
+ }
+
+ }
+
+}
diff --git a/samples/tutorials/p7_queryoptions-f/src/main/webapp/WEB-INF/web.xml b/samples/tutorials/p7_queryoptions-f/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..21de52a
--- /dev/null
+++ b/samples/tutorials/p7_queryoptions-f/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,40 @@
+<?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.
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ id="WebApp_ID" version="2.5">
+
+ <!-- Register the HttpServlet implementation -->
+ <servlet>
+ <servlet-name>DemoServlet</servlet-name>
+ <servlet-class>myservice.mynamespace.web.DemoServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!--
+ Our OData service can be invoked at
+ http://localhost:8080/DemoService/DemoService.svc
+ -->
+ <servlet-mapping>
+ <servlet-name>DemoServlet</servlet-name>
+ <url-pattern>/DemoService.svc/*</url-pattern>
+ </servlet-mapping>
+</web-app>
\ No newline at end of file
diff --git a/samples/tutorials/p7_queryoptions-f/src/main/webapp/index.jsp b/samples/tutorials/p7_queryoptions-f/src/main/webapp/index.jsp
new file mode 100644
index 0000000..c0fe23e
--- /dev/null
+++ b/samples/tutorials/p7_queryoptions-f/src/main/webapp/index.jsp
@@ -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.
+ */
+<html>
+<body>
+<h2>Hello World!</h2>
+<a href="DemoService.svc/">OData Olingo V4 Demo Service</a>
+</body>
+</html>
diff --git a/samples/tutorials/pom.xml b/samples/tutorials/pom.xml
new file mode 100644
index 0000000..c4244dd
--- /dev/null
+++ b/samples/tutorials/pom.xml
@@ -0,0 +1,58 @@
+<?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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>odata-tutorials</artifactId>
+ <packaging>pom</packaging>
+ <name>${project.artifactId}</name>
+
+ <parent>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>odata-samples</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <modules>
+ <module>p1_read</module>
+ <module>p2_readep</module>
+ <module>p3_write</module>
+ <module>p4_navigation</module>
+ <module>p5_queryoptions-tcs</module>
+ <module>p6_queryoptions-es</module>
+ <module>p7_queryoptions-f</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>