You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by fm...@apache.org on 2014/05/14 19:43:33 UTC
[6/6] git commit: [OLINGO-260] partially provided opentype support on
proxy
[OLINGO-260] partially provided opentype support on proxy
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/4bdc9195
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/4bdc9195
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/4bdc9195
Branch: refs/heads/master
Commit: 4bdc91951aa64405d2192bc32ae1b711864b5b19
Parents: 12a1284
Author: fmartelli <fa...@gmail.com>
Authored: Wed May 14 19:43:12 2014 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Wed May 14 19:43:12 2014 +0200
----------------------------------------------------------------------
.../commons/AbstractTypeInvocationHandler.java | 36 ++-
.../commons/ComplexTypeInvocationHandler.java | 8 +-
.../EntityContainerInvocationHandler.java | 7 +
.../commons/EntityTypeInvocationHandler.java | 24 ++
.../proxy/commons/FactoryInvocationHandler.java | 25 +-
.../olingo/ext/proxy/utils/CoreUtils.java | 120 +++++++--
.../olingo/ext/pojogen/AbstractPOJOGenMojo.java | 6 +
.../src/main/resources/container.vm | 15 ++
fit/src/it/openTypeV3/pom.xml | 93 +++++++
fit/src/it/openTypeV3/verify.groovy | 20 ++
fit/src/it/openTypeV4/pom.xml | 93 +++++++
fit/src/it/openTypeV4/verify.groovy | 20 ++
.../java/org/apache/olingo/fit/V3OpenType.java | 23 +-
.../java/org/apache/olingo/fit/V4OpenType.java | 23 +-
.../olingo/fit/proxy/v3/AbstractTestITCase.java | 1 +
.../olingo/fit/proxy/v3/OpenTypeTestITCase.java | 134 ++++++++++
.../fit/proxy/v3/PrimitiveKeysTestITCase.java | 6 +-
.../AllGeoCollectionTypesSet.java | 1 +
.../astoriadefaultservice/AllGeoTypesSet.java | 1 +
.../services/astoriadefaultservice/Car.java | 1 +
.../astoriadefaultservice/Computer.java | 1 +
.../astoriadefaultservice/ComputerDetail.java | 1 +
.../astoriadefaultservice/Customer.java | 1 +
.../astoriadefaultservice/CustomerInfo.java | 1 +
.../astoriadefaultservice/DefaultContainer.java | 37 ++-
.../services/astoriadefaultservice/Driver.java | 1 +
.../astoriadefaultservice/LastLogin.java | 1 +
.../services/astoriadefaultservice/License.java | 1 +
.../services/astoriadefaultservice/Login.java | 1 +
.../astoriadefaultservice/MappedEntityType.java | 1 +
.../services/astoriadefaultservice/Message.java | 1 +
.../MessageAttachment.java | 1 +
.../services/astoriadefaultservice/Order.java | 1 +
.../astoriadefaultservice/OrderLine.java | 1 +
.../astoriadefaultservice/PageView.java | 1 +
.../services/astoriadefaultservice/Person.java | 1 +
.../astoriadefaultservice/PersonMetadata.java | 1 +
.../services/astoriadefaultservice/Product.java | 1 +
.../astoriadefaultservice/ProductDetail.java | 1 +
.../astoriadefaultservice/ProductPhoto.java | 1 +
.../astoriadefaultservice/ProductReview.java | 1 +
.../astoriadefaultservice/RSAToken.java | 1 +
.../astoriadefaultservice/package-info.java | 1 +
.../astoriadefaultservice/types/Aliases.java | 1 +
.../types/AllSpatialCollectionTypes.java | 1 +
.../AllSpatialCollectionTypesCollection.java | 1 +
.../types/AllSpatialCollectionTypes_Simple.java | 1 +
...SpatialCollectionTypes_SimpleCollection.java | 1 +
.../types/AllSpatialTypes.java | 1 +
.../types/AllSpatialTypesCollection.java | 1 +
.../astoriadefaultservice/types/AuditInfo.java | 1 +
.../types/BackOrderLine.java | 1 +
.../types/BackOrderLine2.java | 1 +
.../types/BackOrderLine2Collection.java | 1 +
.../types/BackOrderLineCollection.java | 1 +
.../astoriadefaultservice/types/Car.java | 1 +
.../types/CarCollection.java | 1 +
.../types/ComplexToCategory.java | 1 +
.../astoriadefaultservice/types/Computer.java | 1 +
.../types/ComputerCollection.java | 1 +
.../types/ComputerDetail.java | 1 +
.../types/ComputerDetailCollection.java | 1 +
.../types/ConcurrencyInfo.java | 1 +
.../types/ContactDetails.java | 1 +
.../astoriadefaultservice/types/Contractor.java | 1 +
.../types/ContractorCollection.java | 1 +
.../astoriadefaultservice/types/Customer.java | 1 +
.../types/CustomerCollection.java | 1 +
.../types/CustomerInfo.java | 1 +
.../types/CustomerInfoCollection.java | 1 +
.../astoriadefaultservice/types/Dimensions.java | 1 +
.../types/DiscontinuedProduct.java | 1 +
.../types/DiscontinuedProductCollection.java | 1 +
.../astoriadefaultservice/types/Driver.java | 1 +
.../types/DriverCollection.java | 1 +
.../astoriadefaultservice/types/Employee.java | 1 +
.../types/EmployeeCollection.java | 1 +
.../astoriadefaultservice/types/LastLogin.java | 5 +-
.../types/LastLoginCollection.java | 1 +
.../astoriadefaultservice/types/License.java | 1 +
.../types/LicenseCollection.java | 1 +
.../astoriadefaultservice/types/Login.java | 1 +
.../types/LoginCollection.java | 1 +
.../types/MappedEntityType.java | 1 +
.../types/MappedEntityTypeCollection.java | 1 +
.../astoriadefaultservice/types/Message.java | 1 +
.../types/MessageAttachment.java | 1 +
.../types/MessageAttachmentCollection.java | 1 +
.../types/MessageCollection.java | 1 +
.../astoriadefaultservice/types/MessageKey.java | 1 +
.../astoriadefaultservice/types/Order.java | 1 +
.../types/OrderCollection.java | 1 +
.../astoriadefaultservice/types/OrderLine.java | 1 +
.../types/OrderLineCollection.java | 1 +
.../types/OrderLineKey.java | 1 +
.../astoriadefaultservice/types/PageView.java | 5 +-
.../types/PageViewCollection.java | 1 +
.../astoriadefaultservice/types/Person.java | 1 +
.../types/PersonCollection.java | 1 +
.../types/PersonMetadata.java | 1 +
.../types/PersonMetadataCollection.java | 1 +
.../astoriadefaultservice/types/Phone.java | 1 +
.../astoriadefaultservice/types/Product.java | 1 +
.../types/ProductCollection.java | 1 +
.../types/ProductDetail.java | 1 +
.../types/ProductDetailCollection.java | 1 +
.../types/ProductPageView.java | 5 +-
.../types/ProductPageViewCollection.java | 1 +
.../types/ProductPhoto.java | 1 +
.../types/ProductPhotoCollection.java | 1 +
.../types/ProductPhotoKey.java | 1 +
.../types/ProductReview.java | 1 +
.../types/ProductReviewCollection.java | 1 +
.../types/ProductReviewKey.java | 1 +
.../astoriadefaultservice/types/RSAToken.java | 1 +
.../types/RSATokenCollection.java | 1 +
.../types/SpecialEmployee.java | 1 +
.../types/SpecialEmployeeCollection.java | 1 +
.../types/package-info.java | 1 +
.../opentypesservice/DefaultContainer.java | 77 ++++++
.../odata/services/opentypesservice/Row.java | 55 ++++
.../services/opentypesservice/RowIndex.java | 53 ++++
.../services/opentypesservice/package-info.java | 21 ++
.../opentypesservice/types/ContactDetails.java | 136 ++++++++++
.../opentypesservice/types/IndexedRow.java | 92 +++++++
.../types/IndexedRowCollection.java | 47 ++++
.../services/opentypesservice/types/Row.java | 91 +++++++
.../opentypesservice/types/RowCollection.java | 47 ++++
.../opentypesservice/types/RowIndex.java | 101 ++++++++
.../types/RowIndexCollection.java | 47 ++++
.../opentypesservice/types/package-info.java | 21 ++
.../primitivekeysservice/TestContext.java | 4 +-
.../AllGeoCollectionTypesSet.java | 1 +
.../astoriadefaultservice/AllGeoTypesSet.java | 1 +
.../services/astoriadefaultservice/Car.java | 1 +
.../astoriadefaultservice/Computer.java | 1 +
.../astoriadefaultservice/ComputerDetail.java | 1 +
.../astoriadefaultservice/Customer.java | 1 +
.../astoriadefaultservice/CustomerInfo.java | 1 +
.../astoriadefaultservice/DefaultContainer.java | 41 ++-
.../services/astoriadefaultservice/Driver.java | 1 +
.../astoriadefaultservice/LastLogin.java | 1 +
.../services/astoriadefaultservice/License.java | 1 +
.../services/astoriadefaultservice/Login.java | 1 +
.../astoriadefaultservice/MappedEntityType.java | 1 +
.../services/astoriadefaultservice/Message.java | 1 +
.../MessageAttachment.java | 1 +
.../services/astoriadefaultservice/Order.java | 1 +
.../astoriadefaultservice/OrderLine.java | 1 +
.../astoriadefaultservice/PageView.java | 1 +
.../services/astoriadefaultservice/Person.java | 1 +
.../astoriadefaultservice/PersonMetadata.java | 1 +
.../services/astoriadefaultservice/Product.java | 1 +
.../astoriadefaultservice/ProductDetail.java | 1 +
.../astoriadefaultservice/ProductPhoto.java | 1 +
.../astoriadefaultservice/ProductReview.java | 1 +
.../astoriadefaultservice/RSAToken.java | 1 +
.../astoriadefaultservice/package-info.java | 1 +
.../astoriadefaultservice/types/Aliases.java | 1 +
.../types/AllSpatialCollectionTypes.java | 1 +
.../AllSpatialCollectionTypesCollection.java | 1 +
.../types/AllSpatialCollectionTypes_Simple.java | 1 +
...SpatialCollectionTypes_SimpleCollection.java | 1 +
.../types/AllSpatialTypes.java | 1 +
.../types/AllSpatialTypesCollection.java | 1 +
.../astoriadefaultservice/types/AuditInfo.java | 1 +
.../types/BackOrderLine.java | 1 +
.../types/BackOrderLine2.java | 1 +
.../types/BackOrderLine2Collection.java | 1 +
.../types/BackOrderLineCollection.java | 1 +
.../astoriadefaultservice/types/Car.java | 1 +
.../types/CarCollection.java | 1 +
.../types/ComplexToCategory.java | 1 +
.../types/ComplexWithAllPrimitiveTypes.java | 1 +
.../astoriadefaultservice/types/Computer.java | 1 +
.../types/ComputerCollection.java | 1 +
.../types/ComputerDetail.java | 1 +
.../types/ComputerDetailCollection.java | 1 +
.../types/ConcurrencyInfo.java | 1 +
.../types/ContactDetails.java | 1 +
.../astoriadefaultservice/types/Contractor.java | 1 +
.../types/ContractorCollection.java | 1 +
.../astoriadefaultservice/types/Customer.java | 1 +
.../types/CustomerCollection.java | 1 +
.../types/CustomerInfo.java | 1 +
.../types/CustomerInfoCollection.java | 1 +
.../astoriadefaultservice/types/Dimensions.java | 1 +
.../types/DiscontinuedProduct.java | 1 +
.../types/DiscontinuedProductCollection.java | 1 +
.../astoriadefaultservice/types/Driver.java | 1 +
.../types/DriverCollection.java | 1 +
.../astoriadefaultservice/types/Employee.java | 1 +
.../types/EmployeeCollection.java | 1 +
.../astoriadefaultservice/types/LastLogin.java | 5 +-
.../types/LastLoginCollection.java | 1 +
.../astoriadefaultservice/types/License.java | 1 +
.../types/LicenseCollection.java | 1 +
.../astoriadefaultservice/types/Login.java | 1 +
.../types/LoginCollection.java | 1 +
.../types/MappedEntityType.java | 1 +
.../types/MappedEntityTypeCollection.java | 1 +
.../astoriadefaultservice/types/Message.java | 1 +
.../types/MessageAttachment.java | 1 +
.../types/MessageAttachmentCollection.java | 1 +
.../types/MessageCollection.java | 1 +
.../astoriadefaultservice/types/MessageKey.java | 1 +
.../astoriadefaultservice/types/Order.java | 1 +
.../types/OrderCollection.java | 1 +
.../astoriadefaultservice/types/OrderLine.java | 1 +
.../types/OrderLineCollection.java | 1 +
.../types/OrderLineKey.java | 1 +
.../astoriadefaultservice/types/PageView.java | 5 +-
.../types/PageViewCollection.java | 1 +
.../astoriadefaultservice/types/Person.java | 1 +
.../types/PersonCollection.java | 1 +
.../types/PersonMetadata.java | 1 +
.../types/PersonMetadataCollection.java | 1 +
.../astoriadefaultservice/types/Phone.java | 1 +
.../astoriadefaultservice/types/Product.java | 1 +
.../types/ProductCollection.java | 1 +
.../types/ProductDetail.java | 1 +
.../types/ProductDetailCollection.java | 1 +
.../types/ProductPageView.java | 5 +-
.../types/ProductPageViewCollection.java | 1 +
.../types/ProductPhoto.java | 1 +
.../types/ProductPhotoCollection.java | 1 +
.../types/ProductPhotoKey.java | 1 +
.../types/ProductReview.java | 1 +
.../types/ProductReviewCollection.java | 1 +
.../types/ProductReviewKey.java | 1 +
.../astoriadefaultservice/types/RSAToken.java | 1 +
.../types/RSATokenCollection.java | 1 +
.../types/SpecialEmployee.java | 1 +
.../types/SpecialEmployeeCollection.java | 1 +
.../types/package-info.java | 1 +
.../olingo/fit/proxy/v4/AbstractTestITCase.java | 1 +
.../opentypesservice/DefaultContainer.java | 76 ++++++
.../odata/services/opentypesservice/Row.java | 55 ++++
.../services/opentypesservice/RowIndex.java | 53 ++++
.../services/opentypesservice/package-info.java | 21 ++
.../services/opentypesservice/types/Color.java | 45 ++++
.../opentypesservice/types/ContactDetails.java | 259 +++++++++++++++++++
.../opentypesservice/types/IndexedRow.java | 92 +++++++
.../types/IndexedRowCollection.java | 47 ++++
.../services/opentypesservice/types/Row.java | 91 +++++++
.../opentypesservice/types/RowCollection.java | 47 ++++
.../opentypesservice/types/RowIndex.java | 101 ++++++++
.../types/RowIndexCollection.java | 47 ++++
.../opentypesservice/types/package-info.java | 21 ++
.../services/odatawcfservice/Accounts.java | 1 +
.../odata/services/odatawcfservice/Boss.java | 1 +
.../odata/services/odatawcfservice/Company.java | 1 +
.../services/odatawcfservice/Customers.java | 1 +
.../odatawcfservice/DefaultStoredPI.java | 1 +
.../services/odatawcfservice/Departments.java | 1 +
.../services/odatawcfservice/Employees.java | 1 +
.../odatawcfservice/InMemoryEntities.java | 25 +-
.../services/odatawcfservice/LabourUnion.java | 1 +
.../services/odatawcfservice/OrderDetails.java | 1 +
.../odata/services/odatawcfservice/Orders.java | 1 +
.../odata/services/odatawcfservice/People.java | 1 +
.../odatawcfservice/ProductDetails.java | 1 +
.../odatawcfservice/ProductReviews.java | 1 +
.../services/odatawcfservice/Products.java | 1 +
.../services/odatawcfservice/PublicCompany.java | 1 +
.../services/odatawcfservice/StoredPIs.java | 1 +
.../odatawcfservice/SubscriptionTemplates.java | 1 +
.../services/odatawcfservice/VipCustomer.java | 1 +
.../services/odatawcfservice/package-info.java | 1 +
.../odatawcfservice/types/AccessLevel.java | 1 +
.../services/odatawcfservice/types/Account.java | 1 +
.../types/AccountCollection.java | 1 +
.../odatawcfservice/types/AccountInfo.java | 1 +
.../services/odatawcfservice/types/Address.java | 1 +
.../services/odatawcfservice/types/Asset.java | 1 +
.../odatawcfservice/types/AssetCollection.java | 1 +
.../services/odatawcfservice/types/Club.java | 1 +
.../odatawcfservice/types/ClubCollection.java | 1 +
.../services/odatawcfservice/types/Color.java | 1 +
.../services/odatawcfservice/types/Company.java | 1 +
.../odatawcfservice/types/CompanyAddress.java | 1 +
.../odatawcfservice/types/CompanyCategory.java | 1 +
.../types/CompanyCollection.java | 1 +
.../odatawcfservice/types/CreditCardPI.java | 1 +
.../types/CreditCardPICollection.java | 1 +
.../odatawcfservice/types/CreditRecord.java | 1 +
.../types/CreditRecordCollection.java | 1 +
.../odatawcfservice/types/Customer.java | 1 +
.../types/CustomerCollection.java | 1 +
.../odatawcfservice/types/Department.java | 1 +
.../types/DepartmentCollection.java | 1 +
.../odatawcfservice/types/Employee.java | 1 +
.../types/EmployeeCollection.java | 1 +
.../odatawcfservice/types/GiftCard.java | 1 +
.../types/GiftCardCollection.java | 1 +
.../odatawcfservice/types/HomeAddress.java | 1 +
.../odatawcfservice/types/LabourUnion.java | 1 +
.../types/LabourUnionCollection.java | 1 +
.../services/odatawcfservice/types/Order.java | 1 +
.../odatawcfservice/types/OrderCollection.java | 1 +
.../odatawcfservice/types/OrderDetail.java | 1 +
.../types/OrderDetailCollection.java | 1 +
.../odatawcfservice/types/OrderDetailKey.java | 1 +
.../types/PaymentInstrument.java | 1 +
.../types/PaymentInstrumentCollection.java | 1 +
.../services/odatawcfservice/types/Person.java | 1 +
.../odatawcfservice/types/PersonCollection.java | 1 +
.../services/odatawcfservice/types/Product.java | 1 +
.../types/ProductCollection.java | 1 +
.../odatawcfservice/types/ProductDetail.java | 1 +
.../types/ProductDetailCollection.java | 1 +
.../odatawcfservice/types/ProductDetailKey.java | 1 +
.../odatawcfservice/types/ProductReview.java | 1 +
.../types/ProductReviewCollection.java | 1 +
.../odatawcfservice/types/ProductReviewKey.java | 1 +
.../odatawcfservice/types/PublicCompany.java | 1 +
.../types/PublicCompanyCollection.java | 1 +
.../odatawcfservice/types/Statement.java | 1 +
.../types/StatementCollection.java | 1 +
.../odatawcfservice/types/StoredPI.java | 1 +
.../types/StoredPICollection.java | 1 +
.../odatawcfservice/types/Subscription.java | 1 +
.../types/SubscriptionCollection.java | 1 +
.../odatawcfservice/types/package-info.java | 1 +
pom.xml | 2 +-
325 files changed, 2713 insertions(+), 95 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractTypeInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractTypeInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractTypeInvocationHandler.java
index 4fd5a7e..a61e853 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractTypeInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractTypeInvocationHandler.java
@@ -60,7 +60,7 @@ public abstract class AbstractTypeInvocationHandler extends AbstractInvocationHa
protected final EntityContext entityContext = EntityContainerFactory.getContext().entityContext();
- protected final EntityTypeInvocationHandler targetHandler;
+ protected EntityTypeInvocationHandler entityHandler;
protected Object internal;
@@ -73,19 +73,27 @@ public abstract class AbstractTypeInvocationHandler extends AbstractInvocationHa
super(client, containerHandler);
this.internal = internal;
this.typeRef = typeRef;
- this.targetHandler = EntityTypeInvocationHandler.class.cast(this);
+ this.entityHandler = EntityTypeInvocationHandler.class.cast(this);
}
protected AbstractTypeInvocationHandler(
final CommonEdmEnabledODataClient<?> client,
final Class<?> typeRef,
final Object internal,
- final EntityTypeInvocationHandler targetHandler) {
+ final EntityTypeInvocationHandler entityHandler) {
- super(client, targetHandler == null ? null : targetHandler.containerHandler);
+ super(client, entityHandler == null ? null : entityHandler.containerHandler);
this.internal = internal;
this.typeRef = typeRef;
- this.targetHandler = targetHandler;
+ this.entityHandler = entityHandler;
+ }
+
+ public EntityTypeInvocationHandler getEntityHandler() {
+ return entityHandler;
+ }
+
+ public void setEntityHandler(EntityTypeInvocationHandler entityHandler) {
+ this.entityHandler = entityHandler;
}
public abstract FullQualifiedName getName();
@@ -104,14 +112,14 @@ public abstract class AbstractTypeInvocationHandler extends AbstractInvocationHa
return Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {returnType},
- OperationInvocationHandler.getInstance(targetHandler));
+ OperationInvocationHandler.getInstance(entityHandler));
} else if ("factory".equals(method.getName()) && ArrayUtils.isEmpty(args)) {
final Class<?> returnType = method.getReturnType();
return Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {returnType},
- FactoryInvocationHandler.getInstance(targetHandler, this));
+ FactoryInvocationHandler.getInstance(entityHandler, this));
} else if (method.getName().startsWith("get")) {
// Assumption: for each getter will always exist a setter and viceversa.
// get method annotation and check if it exists as expected
@@ -165,8 +173,8 @@ public abstract class AbstractTypeInvocationHandler extends AbstractInvocationHa
}
protected void attach() {
- if (targetHandler != null && !entityContext.isAttached(targetHandler)) {
- entityContext.attach(targetHandler, AttachedEntityStatus.ATTACHED);
+ if (entityHandler != null && !entityContext.isAttached(entityHandler)) {
+ entityContext.attach(entityHandler, AttachedEntityStatus.ATTACHED);
}
}
@@ -175,12 +183,12 @@ public abstract class AbstractTypeInvocationHandler extends AbstractInvocationHa
}
protected void attach(final AttachedEntityStatus status, final boolean override) {
- if (entityContext.isAttached(targetHandler)) {
+ if (entityContext.isAttached(entityHandler)) {
if (override) {
- entityContext.setStatus(targetHandler, status);
+ entityContext.setStatus(entityHandler, status);
}
} else {
- entityContext.attach(targetHandler, status);
+ entityContext.attach(entityHandler, status);
}
}
@@ -266,8 +274,8 @@ public abstract class AbstractTypeInvocationHandler extends AbstractInvocationHa
private void setNavigationPropertyValue(final NavigationProperty property, final Object value) {
// 1) attach source entity
- if (!entityContext.isAttached(targetHandler)) {
- entityContext.attach(targetHandler, AttachedEntityStatus.CHANGED);
+ if (!entityContext.isAttached(entityHandler)) {
+ entityContext.attach(entityHandler, AttachedEntityStatus.CHANGED);
}
// 2) attach the target entity handlers
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexTypeInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexTypeInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexTypeInvocationHandler.java
index 69de2ea..ed6cd6d 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexTypeInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexTypeInvocationHandler.java
@@ -108,7 +108,7 @@ public class ComplexTypeInvocationHandler extends AbstractTypeInvocationHandler
@Override
protected Object getPropertyValue(final String name, final Type type) {
try {
- return CoreUtils.getValueFromProperty(client, getComplex().get(name), type, targetHandler);
+ return CoreUtils.getValueFromProperty(client, getComplex().get(name), type, entityHandler);
} catch (Exception e) {
throw new IllegalArgumentException("Error getting value for property '" + name + "'", e);
}
@@ -166,8 +166,8 @@ public class ComplexTypeInvocationHandler extends AbstractTypeInvocationHandler
client.getBinder().add(
getComplex(), CoreUtils.getODataProperty(client, property.name(), type, toBeAdded));
- if (targetHandler != null && !entityContext.isAttached(targetHandler)) {
- entityContext.attach(targetHandler, AttachedEntityStatus.CHANGED);
+ if (entityHandler != null && !entityContext.isAttached(entityHandler)) {
+ entityContext.attach(entityHandler, AttachedEntityStatus.CHANGED);
}
}
@@ -192,6 +192,6 @@ public class ComplexTypeInvocationHandler extends AbstractTypeInvocationHandler
@Override
public boolean isChanged() {
- return targetHandler == null ? false : targetHandler.isChanged();
+ return entityHandler == null ? false : entityHandler.isChanged();
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java
----------------------------------------------------------------------
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 e6b1bfe..afd86b4 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
@@ -96,6 +96,13 @@ public final class EntityContainerInvocationHandler extends AbstractInvocationHa
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {returnType},
OperationInvocationHandler.getInstance(this));
+ } else if ("complexFactory".equals(method.getName()) && ArrayUtils.isEmpty(args)) {
+ final Class<?> returnType = method.getReturnType();
+
+ return Proxy.newProxyInstance(
+ Thread.currentThread().getContextClassLoader(),
+ new Class<?>[] {returnType},
+ FactoryInvocationHandler.getInstance(getClient(), this, null, null));
} else {
final Class<?> returnType = method.getReturnType();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityTypeInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityTypeInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityTypeInvocationHandler.java
index 884fb1c..9e7db30 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityTypeInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityTypeInvocationHandler.java
@@ -20,10 +20,13 @@ package org.apache.olingo.ext.proxy.commons;
import java.io.InputStream;
import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
import java.lang.reflect.Type;
import java.net.URI;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -225,12 +228,33 @@ public class EntityTypeInvocationHandler extends AbstractTypeInvocationHandler {
}
@Override
+ @SuppressWarnings("unchecked")
protected void setPropertyValue(final Property property, final Object value) {
if (property.type().equalsIgnoreCase(EdmPrimitiveTypeKind.Stream.toString())) {
setStreamedProperty(property, (InputStream) value);
} else {
addPropertyChanges(property.name(), value);
+
+ if (value != null) {
+ final Collection<?> coll;
+ if (Collection.class.isAssignableFrom(value.getClass())) {
+ coll = Collection.class.cast(value);
+ } else {
+ coll = Collections.singleton(value);
+ }
+
+ for (Object item : coll) {
+ if (item instanceof Proxy) {
+ final InvocationHandler handler = Proxy.getInvocationHandler(item);
+ if ((handler instanceof ComplexTypeInvocationHandler)
+ && ((ComplexTypeInvocationHandler) handler).getEntityHandler() == null) {
+ ((ComplexTypeInvocationHandler) handler).setEntityHandler(this);
+ }
+ }
+ }
+ }
}
+
attach(AttachedEntityStatus.CHANGED);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/FactoryInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/FactoryInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/FactoryInvocationHandler.java
index 150b59d..a477ac0 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/FactoryInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/FactoryInvocationHandler.java
@@ -20,6 +20,7 @@ package org.apache.olingo.ext.proxy.commons;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
+import org.apache.olingo.client.api.CommonEdmEnabledODataClient;
import org.apache.olingo.ext.proxy.api.OperationExecutor;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.utils.ClassUtils;
@@ -32,18 +33,33 @@ class FactoryInvocationHandler extends AbstractInvocationHandler implements Oper
private final AbstractTypeInvocationHandler invokerHandler;
+ @SuppressWarnings({"rawtypes", "unchecked"})
static FactoryInvocationHandler getInstance(
+ final CommonEdmEnabledODataClient<?> client,
+ final EntityContainerInvocationHandler containerHandler,
final EntityTypeInvocationHandler entityHandler,
final AbstractTypeInvocationHandler targetHandler) {
+ return new FactoryInvocationHandler(client, containerHandler, entityHandler, targetHandler);
+ }
- return new FactoryInvocationHandler(entityHandler, targetHandler);
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ static FactoryInvocationHandler getInstance(
+ final EntityTypeInvocationHandler entityHandler,
+ final AbstractTypeInvocationHandler targetHandler) {
+ return new FactoryInvocationHandler(
+ entityHandler == null ? null : entityHandler.containerHandler.client,
+ targetHandler == null
+ ? entityHandler == null ? null : entityHandler.containerHandler : targetHandler.containerHandler,
+ entityHandler,
+ targetHandler);
}
private FactoryInvocationHandler(
+ final CommonEdmEnabledODataClient<?> client,
+ final EntityContainerInvocationHandler containerHandler,
final EntityTypeInvocationHandler entityHandler,
final AbstractTypeInvocationHandler targetHandler) {
-
- super(targetHandler.containerHandler.getClient(), targetHandler.containerHandler);
+ super(client, containerHandler);
this.invokerHandler = targetHandler;
this.entityHandler = entityHandler;
}
@@ -53,8 +69,7 @@ class FactoryInvocationHandler extends AbstractInvocationHandler implements Oper
if (isSelfMethod(method, args)) {
return invokeSelfMethod(method, args);
} else if (method.getName().startsWith("new")) {
- final String getterName = method.getName().replaceFirst("new", "get");
- final Method getter = invokerHandler.getTypeRef().getMethod(getterName);
+ final Method getter = proxy.getClass().getInterfaces()[0].getMethod(method.getName());
final Property property = ClassUtils.getAnnotation(Property.class, getter);
if (property == null) {
throw new UnsupportedOperationException("Unsupported method " + method.getName());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
index 9f35182..498e58c 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
@@ -45,10 +45,13 @@ import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmElement;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+import org.apache.olingo.ext.proxy.api.annotations.ComplexType;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
import org.apache.olingo.ext.proxy.api.annotations.EnumType;
import org.apache.olingo.ext.proxy.api.annotations.Key;
@@ -174,12 +177,18 @@ public final class CoreUtils {
final String property,
final Object obj) {
- final EdmType edmType = edmProperty.getType();
+ final EdmTypeInfo type;
+ if (edmProperty == null) {
+ // maybe opentype ...
+ type = null;
+ } else {
+ final EdmType edmType = edmProperty.getType();
- final EdmTypeInfo type = new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()).setTypeExpression(
- edmProperty.isCollection()
- ? "Collection(" + edmType.getFullQualifiedName().toString() + ")"
- : edmType.getFullQualifiedName().toString()).build();
+ type = new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()).setTypeExpression(
+ edmProperty.isCollection()
+ ? "Collection(" + edmType.getFullQualifiedName().toString() + ")"
+ : edmType.getFullQualifiedName().toString()).build();
+ }
return getODataProperty(client, property, type, obj);
}
@@ -190,28 +199,40 @@ public final class CoreUtils {
CommonODataProperty oprop;
try {
- if (type == null || obj == null) {
+ if (obj == null) {
oprop = client.getObjectFactory().newPrimitiveProperty(name, null);
- } else if (type.isCollection()) {
- // create collection property
- oprop = client.getObjectFactory().newCollectionProperty(name, getODataValue(client, type, obj).asCollection());
- } else if (type.isPrimitiveType()) {
- // create a primitive property
- oprop = client.getObjectFactory().newPrimitiveProperty(name, getODataValue(client, type, obj).asPrimitive());
- } else if (type.isComplexType()) {
- // create a complex property
- oprop = client.getObjectFactory().newComplexProperty(name, getODataValue(client, type, obj).asComplex());
- } else if (type.isEnumType()) {
- if (client.getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0) {
- throw new UnsupportedInV3Exception();
+ } else {
+ final EdmTypeInfo valueType;
+ if (type == null) {
+ valueType = guessTypeFromObject(client, obj);
} else {
- oprop = ((org.apache.olingo.commons.api.domain.v4.ODataObjectFactory) client.getObjectFactory()).
- newEnumProperty(name,
- ((org.apache.olingo.commons.api.domain.v4.ODataValue) getODataValue(client, type, obj)).
- asEnum());
+ valueType = type;
+ }
+
+ if (valueType.isCollection()) {
+ // create collection property
+ oprop = client.getObjectFactory().newCollectionProperty(name, getODataValue(client, valueType, obj).
+ asCollection());
+ } else if (valueType.isPrimitiveType()) {
+ // create a primitive property
+ oprop = client.getObjectFactory().newPrimitiveProperty(name, getODataValue(client, valueType, obj).
+ asPrimitive());
+ } else if (valueType.isComplexType()) {
+ // create a complex property
+ oprop = client.getObjectFactory().newComplexProperty(name, getODataValue(client, valueType, obj).
+ asComplex());
+ } else if (valueType.isEnumType()) {
+ if (client.getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0) {
+ throw new UnsupportedInV3Exception();
+ } else {
+ oprop = ((org.apache.olingo.commons.api.domain.v4.ODataObjectFactory) client.getObjectFactory()).
+ newEnumProperty(name,
+ ((org.apache.olingo.commons.api.domain.v4.ODataValue) getODataValue(client, valueType, obj)).
+ asEnum());
+ }
+ } else {
+ throw new UnsupportedOperationException("Usupported object type " + valueType.getFullQualifiedName());
}
- } else {
- throw new UnsupportedOperationException("Usupported object type " + type.getFullQualifiedName());
}
return oprop;
@@ -220,6 +241,48 @@ public final class CoreUtils {
}
}
+ private static EdmTypeInfo guessTypeFromObject(
+ final CommonEdmEnabledODataClient<?> client, final Object obj) {
+
+ final EdmTypeInfo.Builder edmTypeInfo = new EdmTypeInfo.Builder().setEdm(client.getCachedEdm());
+
+ if (Collection.class.isAssignableFrom(obj.getClass())) {
+ final EdmTypeInfo type = guessPrimitiveType(client, ClassUtils.extractTypeArg(obj.getClass()));
+ return edmTypeInfo.setTypeExpression(
+ "Collection(" + type.getFullQualifiedName() + ")").build();
+ } else if (obj instanceof Proxy) {
+ final Class<?> typeRef = obj.getClass().getInterfaces()[0];
+ final String ns = typeRef.getAnnotation(Namespace.class).value();
+ final String name = typeRef.getAnnotation(ComplexType.class).name();
+ return edmTypeInfo.setTypeExpression(new FullQualifiedName(ns, name).toString()).build();
+ } else {
+ return guessPrimitiveType(client, obj.getClass());
+ }
+ }
+
+ private static EdmTypeInfo guessPrimitiveType(
+ final CommonEdmEnabledODataClient<?> client, final Class<?> clazz) {
+ EdmPrimitiveTypeKind bckCandidate = null;
+
+ for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
+ if (kind.getSupportedVersions().contains(client.getServiceVersion())) {
+ final Class<?> target = EdmPrimitiveTypeFactory.getInstance(kind).getDefaultType();
+
+ if (clazz.equals(target)) {
+ return new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()).setTypeExpression(kind.toString()).build();
+ } else if (target.isAssignableFrom(clazz)) {
+ bckCandidate = kind;
+ }
+ }
+ }
+
+ if (bckCandidate == null) {
+ throw new IllegalArgumentException(clazz.getSimpleName() + " is not a simple type");
+ } else {
+ return new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()).setTypeExpression(bckCandidate.toString()).build();
+ }
+ }
+
@SuppressWarnings("unchecked")
public static void addProperties(
final CommonEdmEnabledODataClient<?> client,
@@ -365,7 +428,7 @@ public final class CoreUtils {
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {getter.getReturnType()},
ComplexTypeInvocationHandler.getInstance(
- client, property.getName(), getter.getReturnType(), null));
+ client, property.getName(), getter.getReturnType(), null));
populate(client, complex, Property.class, property.getValue().asComplex().iterator());
setPropertyValue(bean, getter, complex);
@@ -390,7 +453,7 @@ public final class CoreUtils {
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {collItemClass},
ComplexTypeInvocationHandler.getInstance(
- client, property.getName(), collItemClass, null));
+ client, property.getName(), collItemClass, null));
populate(client, collItem, Property.class, value.asComplex().iterator());
collection.add(collItem);
@@ -429,11 +492,12 @@ public final class CoreUtils {
if (property == null || property.hasNullValue()) {
res = null;
} else if (property.hasComplexValue()) {
+
res = Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {internalRef},
ComplexTypeInvocationHandler.getInstance(
- client, property.getValue().asComplex(), internalRef, entityHandler));
+ client, property.getValue().asComplex(), internalRef, entityHandler));
} else if (property.hasCollectionValue()) {
final ArrayList<Object> collection = new ArrayList<Object>();
@@ -447,7 +511,7 @@ public final class CoreUtils {
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {internalRef},
ComplexTypeInvocationHandler.getInstance(
- client, value.asComplex(), internalRef, entityHandler));
+ client, value.asComplex(), internalRef, entityHandler));
collection.add(collItem);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
index 250cf53..2b718ca 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
@@ -23,9 +23,11 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.io.IOUtils;
@@ -248,7 +250,10 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
parseObj(typesBaseDir, typesPkg, "enumType", className + ".java", objs);
}
+ final List<EdmComplexType> complexes = new ArrayList<EdmComplexType>();
+
for (EdmComplexType complex : schema.getComplexTypes()) {
+ complexes.add(complex);
final String className = utility.capitalize(complex.getName());
objs.clear();
objs.put("complexType", complex);
@@ -297,6 +302,7 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
objs.clear();
objs.put("container", container);
objs.put("namespace", schema.getNamespace());
+ objs.put("complexes", complexes);
parseObj(base, pkg, "container",
utility.capitalize(container.getName()) + ".java", objs);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/ext/pojogen-maven-plugin/src/main/resources/container.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/container.vm b/ext/pojogen-maven-plugin/src/main/resources/container.vm
index 0692ad6..18d383d 100644
--- a/ext/pojogen-maven-plugin/src/main/resources/container.vm
+++ b/ext/pojogen-maven-plugin/src/main/resources/container.vm
@@ -24,6 +24,7 @@ import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.EntityContainer;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.Container;
import org.apache.olingo.ext.proxy.api.OperationType;
#foreach($ns in $namespaces)
@@ -104,4 +105,18 @@ public interface $utility.capitalize($container.Name) extends Container {
#end
#end
}
+
+ #if( $complexes.size() > 0 )
+ ComplexFactory complexFactory();
+
+ interface ComplexFactory {
+ #foreach($complex in $complexes)
+ #set( $type = "${namespace}.${complex.Name}" )
+ @Property(name = "$complex.Name",
+ type = "$type")
+ $utility.getJavaType($type) new$utility.capitalize($complex.Name)();
+
+ #end
+ }
+ #end
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/it/openTypeV3/pom.xml
----------------------------------------------------------------------
diff --git a/fit/src/it/openTypeV3/pom.xml b/fit/src/it/openTypeV3/pom.xml
new file mode 100644
index 0000000..92fbfa3
--- /dev/null
+++ b/fit/src/it/openTypeV3/pom.xml
@@ -0,0 +1,93 @@
+<?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>pojogen-maven-plugin-v3test</artifactId>
+ <groupId>org.apache.olingo</groupId>
+ <version>@project.version@</version>
+ <name>${project.artifactId}</name>
+ <description>A simple IT verifying the basic use case of pojogen-man-plugin.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <artifactId>pojogen-maven-plugin</artifactId>
+ <groupId>org.apache.olingo</groupId>
+ <version>@project.version@</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <artifactId>olingo-client-proxy</artifactId>
+ <groupId>org.apache.olingo</groupId>
+ <version>@project.version@</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>pojogen-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <configuration>
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ <serviceRootURL>http://localhost:9080/stub/StaticService/V30/OpenType.svc</serviceRootURL>
+ <basePackage>org.apache.olingo.fit.proxy.v3.opentype</basePackage>
+ </configuration>
+ <id>v3pojoGen</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>v3pojoGen</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/it/openTypeV3/verify.groovy
----------------------------------------------------------------------
diff --git a/fit/src/it/openTypeV3/verify.groovy b/fit/src/it/openTypeV3/verify.groovy
new file mode 100644
index 0000000..9b74ad2
--- /dev/null
+++ b/fit/src/it/openTypeV3/verify.groovy
@@ -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.
+ */
+File basepkg = new File( basedir, "target/generated-sources/ojc-plugin/org/apache/olingo/fit/proxy/v3" );
+assert basepkg.isDirectory() && basepkg.listFiles().length>0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/it/openTypeV4/pom.xml
----------------------------------------------------------------------
diff --git a/fit/src/it/openTypeV4/pom.xml b/fit/src/it/openTypeV4/pom.xml
new file mode 100644
index 0000000..c945aa9
--- /dev/null
+++ b/fit/src/it/openTypeV4/pom.xml
@@ -0,0 +1,93 @@
+<?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>pojogen-maven-plugin-v4test</artifactId>
+ <groupId>org.apache.olingo</groupId>
+ <version>@project.version@</version>
+ <name>${project.artifactId}</name>
+ <description>A simple IT verifying the basic use case of pojogen-man-plugin.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <artifactId>pojogen-maven-plugin</artifactId>
+ <groupId>org.apache.olingo</groupId>
+ <version>@project.version@</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <artifactId>olingo-client-proxy</artifactId>
+ <groupId>org.apache.olingo</groupId>
+ <version>@project.version@</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>pojogen-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <configuration>
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ <serviceRootURL>http://localhost:9080/stub/StaticService/V40/OpenType.svc</serviceRootURL>
+ <basePackage>org.apache.olingo.fit.proxy.v4.opentype</basePackage>
+ </configuration>
+ <id>v4pojoGen</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>v4pojoGen</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/it/openTypeV4/verify.groovy
----------------------------------------------------------------------
diff --git a/fit/src/it/openTypeV4/verify.groovy b/fit/src/it/openTypeV4/verify.groovy
new file mode 100644
index 0000000..02f0407
--- /dev/null
+++ b/fit/src/it/openTypeV4/verify.groovy
@@ -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.
+ */
+File basepkg = new File( basedir, "target/generated-sources/ojc-plugin/org/apache/olingo/fit/proxy/v4" );
+assert basepkg.isDirectory() && basepkg.listFiles().length>0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/main/java/org/apache/olingo/fit/V3OpenType.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V3OpenType.java b/fit/src/main/java/org/apache/olingo/fit/V3OpenType.java
index e669478..c112b99 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V3OpenType.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V3OpenType.java
@@ -49,19 +49,14 @@ import org.springframework.stereotype.Service;
@Service
@Path("/V30/OpenType.svc")
-public class V3OpenType {
+public class V3OpenType extends V3Services {
private static final Pattern GUID = Pattern.compile("guid'(.*)'");
- private final V3Services services;
-
- private final Metadata openMetadata;
-
public V3OpenType() throws Exception {
- this.openMetadata = new Metadata(FSManager.instance(ODataServiceVersion.V30).
+ super(new Metadata(FSManager.instance(ODataServiceVersion.V30).
readFile("openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)),
- Accept.XML), ODataServiceVersion.V30);
- this.services = new V3Services(this.openMetadata);
+ Accept.XML), ODataServiceVersion.V30));
}
private Response replaceServiceName(final Response response) {
@@ -98,13 +93,15 @@ public class V3OpenType {
@GET
@Path("/$metadata")
@Produces(MediaType.APPLICATION_XML)
+ @Override
public Response getMetadata() {
- return services.getMetadata("openType" + StringUtils.capitalize(
+ return super.getMetadata("openType" + StringUtils.capitalize(
Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)));
}
@GET
@Path("/{entitySetName}({entityId})")
+ @Override
public Response getEntity(
@Context UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@@ -115,7 +112,7 @@ public class V3OpenType {
@QueryParam("$select") @DefaultValue(StringUtils.EMPTY) String select) {
final Matcher matcher = GUID.matcher(entityId);
- return replaceServiceName(services.getEntityInternal(
+ return replaceServiceName(super.getEntityInternal(
uriInfo.getRequestUri().toASCIIString(), accept, entitySetName,
matcher.matches() ? matcher.group(1) : entityId, format, expand, select, false));
}
@@ -124,6 +121,7 @@ public class V3OpenType {
@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 UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@@ -132,17 +130,18 @@ public class V3OpenType {
@PathParam("entitySetName") final String entitySetName,
final String entity) {
- return replaceServiceName(services.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
+ return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
}
@DELETE
@Path("/{entitySetName}({entityId})")
+ @Override
public Response removeEntity(
@PathParam("entitySetName") String entitySetName,
@PathParam("entityId") String entityId) {
final Matcher matcher = GUID.matcher(entityId);
- return replaceServiceName(services.removeEntity(entitySetName,
+ return replaceServiceName(super.removeEntity(entitySetName,
matcher.matches() ? matcher.group(1) : entityId));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/main/java/org/apache/olingo/fit/V4OpenType.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4OpenType.java b/fit/src/main/java/org/apache/olingo/fit/V4OpenType.java
index 9e8f050..fd29039 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4OpenType.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4OpenType.java
@@ -47,17 +47,12 @@ import org.springframework.stereotype.Service;
@Service
@Path("/V40/OpenType.svc")
-public class V4OpenType {
-
- private final V4Services services;
-
- private final Metadata openMetadata;
+public class V4OpenType extends V4Services {
public V4OpenType() throws Exception {
- this.openMetadata = new Metadata(FSManager.instance(ODataServiceVersion.V40).
+ super(new Metadata(FSManager.instance(ODataServiceVersion.V40).
readFile("openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)),
- Accept.XML), ODataServiceVersion.V40);
- this.services = new V4Services(openMetadata);
+ Accept.XML), ODataServiceVersion.V40));
}
private Response replaceServiceName(final Response response) {
@@ -94,13 +89,15 @@ public class V4OpenType {
@GET
@Path("/$metadata")
@Produces(MediaType.APPLICATION_XML)
+ @Override
public Response getMetadata() {
- return services.getMetadata("openType" + StringUtils.capitalize(
+ return super.getMetadata("openType" + StringUtils.capitalize(
Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)));
}
@GET
@Path("/{entitySetName}({entityId})")
+ @Override
public Response getEntity(
@Context UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@@ -110,7 +107,7 @@ public class V4OpenType {
@QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) String expand,
@QueryParam("$select") @DefaultValue(StringUtils.EMPTY) String select) {
- return replaceServiceName(services.getEntityInternal(
+ return replaceServiceName(super.getEntityInternal(
uriInfo.getRequestUri().toASCIIString(), accept, entitySetName, entityId, format, expand, select, false));
}
@@ -118,6 +115,7 @@ public class V4OpenType {
@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 UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@@ -126,15 +124,16 @@ public class V4OpenType {
@PathParam("entitySetName") final String entitySetName,
final String entity) {
- return replaceServiceName(services.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
+ return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
}
@DELETE
@Path("/{entitySetName}({entityId})")
+ @Override
public Response removeEntity(
@PathParam("entitySetName") String entitySetName,
@PathParam("entityId") String entityId) {
- return replaceServiceName(services.removeEntity(entitySetName, entityId));
+ return replaceServiceName(super.removeEntity(entitySetName, entityId));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
index 73d5c32..987ecb5 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
@@ -87,6 +87,7 @@ public abstract class AbstractTestITCase {
containerFactory.getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
container = containerFactory.getEntityContainer(DefaultContainer.class);
assertNotNull(container);
+ EntityContainerFactory.getContext().detachAll();
}
protected Customer getSampleCustomerProfile(
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java
new file mode 100644
index 0000000..853a1b7
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.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.fit.proxy.v3;
+
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.UUID;
+
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.ext.proxy.EntityContainerFactory;
+import org.apache.olingo.ext.proxy.api.annotations.EntityType;
+import org.apache.olingo.fit.proxy.v3.opentype.microsoft.test.odata.services.opentypesservice.DefaultContainer;
+import org.apache.olingo.fit.proxy.v3.opentype.microsoft.test.odata.services.opentypesservice.types.ContactDetails;
+import org.apache.olingo.fit.proxy.v3.opentype.microsoft.test.odata.services.opentypesservice.types.Row;
+import org.apache.olingo.fit.proxy.v3.opentype.microsoft.test.odata.services.opentypesservice.types.RowIndex;
+import org.junit.BeforeClass;
+
+import org.junit.Test;
+
+/**
+ * This is the unit test class to check actions overloading.
+ */
+public class OpenTypeTestITCase extends AbstractTestITCase {
+
+ private static DefaultContainer otcontainer;
+
+ @BeforeClass
+ public static void initContainer() {
+ final EntityContainerFactory otcontainerFactory = EntityContainerFactory.getV3(testOpenTypeServiceRootURL);
+ otcontainerFactory.getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ otcontainer = otcontainerFactory.getEntityContainer(DefaultContainer.class);
+ assertNotNull(otcontainer);
+ }
+
+ @Test
+ public void checkOpenTypeEntityTypesExist() {
+ assertTrue(otcontainer.getRow().newRow().getClass().getInterfaces()[0].
+ getAnnotation(EntityType.class).openType());
+ assertTrue(otcontainer.getRowIndex().newRowIndex().getClass().getInterfaces()[0].
+ getAnnotation(EntityType.class).openType());
+ assertTrue(otcontainer.getRow().newIndexedRow().getClass().getInterfaces()[0].
+ getAnnotation(EntityType.class).openType());
+ entityContext.detachAll();
+ }
+
+ @Test
+ public void read() {
+ Row row = otcontainer.getRow().get(UUID.fromString("71f7d0dc-ede4-45eb-b421-555a2aa1e58f"));
+ assertEquals(Double.class, row.getAdditionalProperty("Double").getClass());
+ assertEquals("71f7d0dc-ede4-45eb-b421-555a2aa1e58f", row.getId().toString());
+
+ row = otcontainer.getRow().get(UUID.fromString("672b8250-1e6e-4785-80cf-b94b572e42b3"));
+ assertEquals(BigDecimal.class, row.getAdditionalProperty("Decimal").getClass());
+ }
+
+ @Test
+ public void cud() throws ParseException {
+ final Integer id = 1426;
+
+ RowIndex rowIndex = otcontainer.getRowIndex().newRowIndex();
+ 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.complexFactory().newContactDetails();
+ contact.setFirstContacted("text".getBytes());
+
+ Calendar cal = Calendar.getInstance();
+ cal.clear();
+ cal.setTime(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX").parse("2001-04-05T05:05:05.001+00:01"));
+
+ contact.setLastContacted(cal);
+
+ 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(BigDecimal.ONE);
+ 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);
+
+ otcontainer.flush();
+
+ rowIndex = otcontainer.getRowIndex().get(id);
+ assertEquals(String.class, rowIndex.getAdditionalProperty("aString").getClass());
+ assertEquals(Boolean.class, rowIndex.getAdditionalProperty("aBoolean").getClass());
+ assertEquals(Double.class, rowIndex.getAdditionalProperty("aDouble").getClass());
+// assertEquals(Short.class, rowIndex.getAdditionalProperty("aByte").getClass()); // trova integer
+// assertEquals(Byte.MAX_VALUE, rowIndex.getAdditionalProperty("aByte"));
+// assertEquals(Calendar.class, rowIndex.getAdditionalProperty("aDate").getClass()); // trova stringa
+// assertEquals(ContactDetails.class, rowIndex.getAdditionalProperty("aContact").getClass().getInterfaces()[0]);
+
+ entityContext.detachAll();
+
+ otcontainer.getRowIndex().delete(id);
+ otcontainer.flush();
+
+ assertNull(otcontainer.getRowIndex().get(id));
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/test/java/org/apache/olingo/fit/proxy/v3/PrimitiveKeysTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/PrimitiveKeysTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/PrimitiveKeysTestITCase.java
index ed33ef7..a99a583 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/PrimitiveKeysTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/PrimitiveKeysTestITCase.java
@@ -45,9 +45,9 @@ public class PrimitiveKeysTestITCase extends AbstractTestITCase {
@Test
public void readPrimitiveKeys() {
- containerFactory = EntityContainerFactory.getV3(testPrimitiveKeysServiceRootURL);
- containerFactory.getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
- final TestContext testContainer = containerFactory.getEntityContainer(TestContext.class);
+ final EntityContainerFactory testContainerFactory = EntityContainerFactory.getV3(testPrimitiveKeysServiceRootURL);
+ testContainerFactory.getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
+ final TestContext testContainer = testContainerFactory.getEntityContainer(TestContext.class);
assertNotNull(testContainer);
final EdmBoolean edmBooleanSet = testContainer.getEdmBooleanSet().get(Boolean.TRUE);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/AllGeoCollectionTypesSet.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/AllGeoCollectionTypesSet.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/AllGeoCollectionTypesSet.java
index c4ee886..8c39f4b 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/AllGeoCollectionTypesSet.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/AllGeoCollectionTypesSet.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/AllGeoTypesSet.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/AllGeoTypesSet.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/AllGeoTypesSet.java
index 4d0a22c..af714bc 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/AllGeoTypesSet.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/AllGeoTypesSet.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Car.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Car.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Car.java
index c27dadc..ba2b520 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Car.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Car.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Computer.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Computer.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Computer.java
index 61404ca..f8f061a 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Computer.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Computer.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/ComputerDetail.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/ComputerDetail.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/ComputerDetail.java
index 0773048..b7bc7b0 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/ComputerDetail.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/ComputerDetail.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Customer.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Customer.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Customer.java
index 3a3007f..5ce41d6 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Customer.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Customer.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/CustomerInfo.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/CustomerInfo.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/CustomerInfo.java
index e8f665e..d1724dd 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/CustomerInfo.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/CustomerInfo.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/DefaultContainer.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/DefaultContainer.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/DefaultContainer.java
index d25c382..a89563e 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/DefaultContainer.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/DefaultContainer.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice;
import org.apache.olingo.client.api.http.HttpMethod;
@@ -23,6 +24,7 @@ import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.EntityContainer;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.api.Container;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.*;
@@ -118,4 +120,37 @@ public interface DefaultContainer extends Container {
);
}
-}
+
+ ComplexFactory complexFactory();
+
+ interface ComplexFactory {
+ @Property(name = "ContactDetails",
+ type = "Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails")
+ org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetails newContactDetails();
+
+ @Property(name = "Aliases",
+ type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases")
+ org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Aliases newAliases();
+
+ @Property(name = "Phone",
+ type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone")
+ org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Phone newPhone();
+
+ @Property(name = "AuditInfo",
+ type = "Microsoft.Test.OData.Services.AstoriaDefaultService.AuditInfo")
+ org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AuditInfo newAuditInfo();
+
+ @Property(name = "ConcurrencyInfo",
+ type = "Microsoft.Test.OData.Services.AstoriaDefaultService.ConcurrencyInfo")
+ org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ConcurrencyInfo newConcurrencyInfo();
+
+ @Property(name = "Dimensions",
+ type = "Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions")
+ org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Dimensions newDimensions();
+
+ @Property(name = "ComplexToCategory",
+ type = "Microsoft.Test.OData.Services.AstoriaDefaultService.ComplexToCategory")
+ org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComplexToCategory newComplexToCategory();
+
+ }
+ }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Driver.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Driver.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Driver.java
index eb73d76..8e5d22b 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Driver.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Driver.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/LastLogin.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/LastLogin.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/LastLogin.java
index 0bbd7c6..dfd2ada 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/LastLogin.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/LastLogin.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/License.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/License.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/License.java
index 20ef235..1f93e23 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/License.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/License.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4bdc9195/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Login.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Login.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Login.java
index 4c1159c..b30303c 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Login.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/microsoft/test/odata/services/astoriadefaultservice/Login.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice;
import org.apache.olingo.ext.proxy.api.AbstractEntitySet;