http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/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 b21c45c..882f0f6 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 @@ -40,22 +40,22 @@ import org.apache.commons.lang3.StringUtils; import org.apache.olingo.client.api.EdmEnabledODataClient; import org.apache.olingo.client.api.uri.URIBuilder; import org.apache.olingo.client.core.uri.URIUtils; -import org.apache.olingo.commons.api.domain.ODataAnnotatable; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataLink; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientAnnotatable; +import org.apache.olingo.commons.api.domain.ClientAnnotation; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEnumValue; +import org.apache.olingo.commons.api.domain.ClientLink; +import org.apache.olingo.commons.api.domain.ClientPrimitiveValue; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; 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.EdmTerm; import org.apache.olingo.commons.api.edm.EdmType; import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.core.domain.ODataAnnotationImpl; +import org.apache.olingo.commons.core.domain.ClientAnnotationImpl; import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; import org.apache.olingo.commons.core.edm.EdmTypeInfo; import org.apache.olingo.ext.proxy.AbstractService; @@ -88,10 +88,10 @@ public final class CoreUtils { // Empty private constructor for static utility classes } - public static ODataValue getODataValue( + public static ClientValue getODataValue( final EdmEnabledODataClient client, final EdmTypeInfo type, final Object obj) { - final ODataValue value; + final ClientValue value; if (type.isCollection()) { value = client.getObjectFactory().newCollectionValue(type.getFullQualifiedName().toString()); @@ -144,7 +144,7 @@ public final class CoreUtils { return value; } - private static ODataProperty getODataEntityProperty( + private static ClientProperty getODataEntityProperty( final EdmEnabledODataClient client, final FullQualifiedName entity, final String property, @@ -154,7 +154,7 @@ public final class CoreUtils { return getODataProperty(client, edmProperty, property, obj); } - private static ODataProperty getODataComplexProperty( + private static ClientProperty getODataComplexProperty( final EdmEnabledODataClient client, final FullQualifiedName complex, final String property, @@ -164,7 +164,7 @@ public final class CoreUtils { return getODataProperty(client, edmProperty, property, obj); } - private static ODataProperty getODataProperty( + private static ClientProperty getODataProperty( final EdmEnabledODataClient client, final EdmElement edmProperty, final String property, @@ -186,29 +186,29 @@ public final class CoreUtils { return getODataProperty(client, property, type, obj); } - public static ODataAnnotation getODataAnnotation( + public static ClientAnnotation getODataAnnotation( final EdmEnabledODataClient client, final String term, final EdmType type, final Object obj) { - ODataAnnotation annotation; + ClientAnnotation annotation; if (obj == null) { - annotation = new ODataAnnotationImpl(term, null); + annotation = new ClientAnnotationImpl(term, null); } else { final EdmTypeInfo valueType = type == null ? guessTypeFromObject(client, obj) : new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()). setTypeExpression(type.getFullQualifiedName().toString()).build(); - annotation = new ODataAnnotationImpl(term, getODataValue(client, valueType, obj)); + annotation = new ClientAnnotationImpl(term, getODataValue(client, valueType, obj)); } return annotation; } - public static ODataProperty getODataProperty( + public static ClientProperty getODataProperty( final EdmEnabledODataClient client, final String name, final EdmTypeInfo type, final Object obj) { - ODataProperty property; + ClientProperty property; try { if (obj == null) { @@ -217,7 +217,7 @@ public final class CoreUtils { final EdmTypeInfo valueType = type == null ? guessTypeFromObject(client, obj) : type; - final ODataValue value = getODataValue(client, valueType, obj); + final ClientValue value = getODataValue(client, valueType, obj); if (valueType.isCollection()) { property = client.getObjectFactory().newCollectionProperty(name, value.asCollection()); @@ -287,7 +287,7 @@ public final class CoreUtils { public static void addProperties( final EdmEnabledODataClient client, final Map<String, Object> changes, - final ODataEntity entity) { + final ClientEntity entity) { for (Map.Entry<String, Object> entry : changes.entrySet()) { entity.getProperties() @@ -298,7 +298,7 @@ public final class CoreUtils { public static void addProperties( final EdmEnabledODataClient client, final Map<String, Object> changes, - final ODataComplexValue entity) { + final ClientComplexValue entity) { for (Map.Entry<String, Object> entry : changes.entrySet()) { entity.add(getODataComplexProperty( @@ -312,7 +312,7 @@ public final class CoreUtils { public static void addAnnotations( final EdmEnabledODataClient client, final Map<Class<? extends AbstractTerm>, Object> annotations, - final ODataAnnotatable annotatable) { + final ClientAnnotatable annotatable) { for (Map.Entry<Class<? extends AbstractTerm>, Object> entry : annotations.entrySet()) { final Namespace nsAnn = entry.getKey().getAnnotation(Namespace.class); @@ -329,7 +329,7 @@ public final class CoreUtils { } @SuppressWarnings({ "unchecked", "rawtypes" }) - private static Enum<?> enumValueToObject(final ODataEnumValue value, final Class<?> reference) { + private static Enum<?> enumValueToObject(final ClientEnumValue value, final Class<?> reference) { final Namespace namespace = reference.getAnnotation(Namespace.class); final EnumType enumType = reference.getAnnotation(EnumType.class); if (value.getTypeName().equals(namespace.value() + "." + enumType.name())) { @@ -339,7 +339,7 @@ public final class CoreUtils { return null; } - private static Object primitiveValueToObject(final ODataPrimitiveValue value, final Class<?> reference) { + private static Object primitiveValueToObject(final ClientPrimitiveValue value, final Class<?> reference) { Object obj; try { @@ -378,7 +378,7 @@ public final class CoreUtils { public static URIBuilder buildEditLink( final EdmEnabledODataClient client, final String entitySetURI, - final ODataEntity entity, + final ClientEntity entity, final Object key) { if (key == null) { @@ -428,14 +428,14 @@ public final class CoreUtils { final EdmEnabledODataClient client, final EntityInvocationHandler typeHandler, final Class<?> entityTypeRef, - final ODataEntity entity) { + final ClientEntity entity) { Object res = null; if (!entity.getProperties().isEmpty()) { final Class<?> keyRef = ClassUtils.getCompoundKeyRef(entityTypeRef); if (keyRef == null) { - final ODataProperty property = entity.getProperty(firstValidEntityKey(entityTypeRef)); + final ClientProperty property = entity.getProperty(firstValidEntityKey(entityTypeRef)); if (property != null && property.hasPrimitiveValue()) { res = primitiveValueToObject( property.getPrimitiveValue(), getPropertyClass(entityTypeRef, property.getName())); @@ -459,7 +459,7 @@ public final class CoreUtils { final EntityInvocationHandler typeHandler, final Object bean, final Class<? extends Annotation> getterAnn, - final Iterator<? extends ODataProperty> propItor) { + final Iterator<? extends ClientProperty> propItor) { if (bean != null) { final Class<?> typeRef; @@ -484,11 +484,11 @@ public final class CoreUtils { final Object bean, final Class<?> typeRef, final Class<? extends Annotation> getterAnn, - final Iterator<? extends ODataProperty> propItor) { + final Iterator<? extends ClientProperty> propItor) { if (bean != null) { while (propItor.hasNext()) { - final ODataProperty property = propItor.next(); + final ClientProperty property = propItor.next(); final Method getter = ClassUtils.findGetterByAnnotatedName(typeRef, getterAnn, property.getName()); @@ -520,9 +520,9 @@ public final class CoreUtils { setPropertyValue(bean, getter, collection); } - final Iterator<ODataValue> collPropItor = property.getValue().asCollection().iterator(); + final Iterator<ClientValue> collPropItor = property.getValue().asCollection().iterator(); while (collPropItor.hasNext()) { - final ODataValue value = collPropItor.next(); + final ClientValue value = collPropItor.next(); if (value.isPrimitive()) { collection.add(primitiveValueToObject( value.asPrimitive(), getPropertyClass(typeRef, property.getName()))); @@ -546,7 +546,7 @@ public final class CoreUtils { } public static Object getObjectFromODataValue( - final ODataValue value, + final ClientValue value, final Type typeRef, final AbstractService<?> service) throws InstantiationException, IllegalAccessException { @@ -566,7 +566,7 @@ public final class CoreUtils { } public static Object getObjectFromODataValue( - final ODataValue value, + final ClientValue value, final Class<?> ref, final AbstractService<?> service) throws InstantiationException, IllegalAccessException { @@ -585,9 +585,9 @@ public final class CoreUtils { } else if (value.isCollection()) { final ArrayList<Object> collection = new ArrayList<Object>(); - final Iterator<ODataValue> collPropItor = value.asCollection().iterator(); + final Iterator<ClientValue> collPropItor = value.asCollection().iterator(); while (collPropItor.hasNext()) { - final ODataValue itemValue = collPropItor.next(); + final ClientValue itemValue = collPropItor.next(); if (itemValue.isPrimitive()) { collection.add(CoreUtils.primitiveValueToObject(itemValue.asPrimitive(), ref)); } else if (itemValue.isComplex()) { @@ -602,8 +602,8 @@ public final class CoreUtils { } res = collection; - } else if (value instanceof ODataEnumValue) { - res = enumValueToObject((ODataEnumValue) value, ref == null ? getEnumTypeRef(service, value) : ref); + } else if (value instanceof ClientEnumValue) { + res = enumValueToObject((ClientEnumValue) value, ref == null ? getEnumTypeRef(service, value) : ref); } else { res = primitiveValueToObject(value.asPrimitive(), ref); } @@ -612,11 +612,11 @@ public final class CoreUtils { } public static Collection<Class<? extends AbstractTerm>> getAnnotationTerms( - final AbstractService<?> service, final List<ODataAnnotation> annotations) { + final AbstractService<?> service, final List<ClientAnnotation> annotations) { final List<Class<? extends AbstractTerm>> res = new ArrayList<Class<? extends AbstractTerm>>(); - for (ODataAnnotation annotation : annotations) { + for (ClientAnnotation annotation : annotations) { final Class<? extends AbstractTerm> clazz = service.getTermClass(annotation.getTerm()); if (clazz != null) { res.add(clazz); @@ -626,11 +626,11 @@ public final class CoreUtils { return res; } - private static Class<?> getEnumTypeRef(final AbstractService<?> service, final ODataValue value) { + private static Class<?> getEnumTypeRef(final AbstractService<?> service, final ClientValue value) { return service.getEnumTypeClass(value.getTypeName().replaceAll("^Collection\\(", "").replaceAll("\\)$", "")); } - public static Class<?> getComplexTypeRef(final AbstractService<?> service, final ODataValue value) { + public static Class<?> getComplexTypeRef(final AbstractService<?> service, final ClientValue value) { return service.getComplexTypeClass(value.getTypeName().replaceAll("^Collection\\(", "").replaceAll("\\)$", "")); } @@ -646,8 +646,8 @@ public final class CoreUtils { return null; } - public static URI getMediaEditLink(final String name, final ODataEntity entity) { - final ODataLink mediaEditLink = entity.getMediaEditLink(name); + public static URI getMediaEditLink(final String name, final ClientEntity entity) { + final ClientLink mediaEditLink = entity.getMediaEditLink(name); return mediaEditLink == null ? URIUtils.getURI(entity.getEditLink(), name) : mediaEditLink.getLink(); }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/ProxyUtils.java ---------------------------------------------------------------------- diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/ProxyUtils.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/ProxyUtils.java index 4ff910f..cb17b14 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/ProxyUtils.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/ProxyUtils.java @@ -22,9 +22,9 @@ import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.olingo.client.api.uri.URIBuilder; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.ext.proxy.AbstractService; import org.apache.olingo.ext.proxy.commons.ComplexInvocationHandler; import org.apache.olingo.ext.proxy.commons.EntityCollectionInvocationHandler; @@ -39,14 +39,14 @@ public class ProxyUtils { final Class<?> typeRef, final Class<?> typeCollectionRef, final URI targetEntitySetURI, - final ODataEntitySet entitySet, + final ClientEntitySet entitySet, final URI uri, final boolean checkInTheContext) { final List<Object> items = new ArrayList<Object>(); if (entitySet != null) { - for (ODataEntity entityFromSet : entitySet.getEntities()) { + for (ClientEntity entityFromSet : entitySet.getEntities()) { items.add(getEntityProxy(service, entityFromSet, uri, typeRef, null, checkInTheContext)); } } @@ -71,7 +71,7 @@ public class ProxyUtils { public static Object getEntityProxy( final AbstractService<?> service, - final ODataEntity entity, + final ClientEntity entity, final URI entitySetURI, final Class<?> type, final String eTag, @@ -98,7 +98,7 @@ public class ProxyUtils { public static Object getComplexProxy( final AbstractService<?> service, final String name, - final ODataValue value, + final ClientValue value, final Class<?> ref, final EntityInvocationHandler handler, final URI baseURI, http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java ---------------------------------------------------------------------- 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 e915f3f..da0e742 100644 --- a/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java @@ -32,9 +32,9 @@ import org.apache.commons.io.IOUtils; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.EntityCollection; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.api.serialization.ODataSerializerException; import org.apache.olingo.fit.server.TomcatTestServer; @@ -94,15 +94,15 @@ public abstract class AbstractBaseTestITCase { } } - protected void debugODataProperty(final ODataProperty property, final String message) { + protected void debugODataProperty(final ClientProperty property, final String message) { LOG.debug(message + "\n{}", property.toString()); } - protected void debugODataValue(final ODataValue value, final String message) { + protected void debugODataValue(final ClientValue value, final String message) { LOG.debug(message + "\n{}", value.toString()); } - protected void debugODataEntity(final ODataEntity entity, final String message) { + protected void debugODataEntity(final ClientEntity entity, final String message) { if (LOG.isDebugEnabled()) { StringWriter writer = new StringWriter(); try { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java ---------------------------------------------------------------------- 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 49502bd..9f6c183 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 @@ -34,12 +34,12 @@ import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.response.ODataInvokeResponse; import org.apache.olingo.client.core.ODataClientFactory; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEntity; -import org.apache.olingo.commons.api.domain.ODataEntitySet; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientCollectionValue; +import org.apache.olingo.commons.api.domain.ClientComplexValue; +import org.apache.olingo.commons.api.domain.ClientEntity; +import org.apache.olingo.commons.api.domain.ClientEntitySet; +import org.apache.olingo.commons.api.domain.ClientProperty; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.fit.AbstractBaseTestITCase; @@ -52,20 +52,20 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void primitveAction() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTString").build(); - ODataInvokeResponse<ODataProperty> response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataProperty.class).execute(); + ODataInvokeResponse<ClientProperty> response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class).execute(); assertEquals(200, response.getStatusCode()); assertEquals("UARTString string value", response.getBody().getPrimitiveValue().toValue()); } @Test public void primitveActionInvalidParameters() throws Exception { - Map<String, ODataValue> parameters = new HashMap<String, ODataValue>(); + 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(); try { - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataProperty.class, parameters) + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters) .execute(); fail("Expected an ODataClientErrorException"); } catch (ODataClientErrorException e) { @@ -77,17 +77,17 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void primitveCollectionAction() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollStringTwoParam").build(); - Map<String, ODataValue> parameters = new HashMap<String, ODataValue>(); + 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()); - ODataInvokeResponse<ODataProperty> response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataProperty.class, parameters) + ODataInvokeResponse<ClientProperty> response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataCollectionValue<ODataValue> valueArray = response.getBody().getCollectionValue(); + ClientCollectionValue<ClientValue> valueArray = response.getBody().getCollectionValue(); assertEquals(3, valueArray.size()); - Iterator<ODataValue> iterator = valueArray.iterator(); + Iterator<ClientValue> iterator = valueArray.iterator(); assertEquals("PT1S", iterator.next().asPrimitive().toValue()); assertEquals("PT2S", iterator.next().asPrimitive().toValue()); assertEquals("PT3S", iterator.next().asPrimitive().toValue()); @@ -97,17 +97,17 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void complexAction() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCTTwoPrimParam").build(); - Map<String, ODataValue> parameters = new HashMap<String, ODataValue>(); + Map<String, ClientValue> parameters = new HashMap<String, ClientValue>(); parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3)); - ODataInvokeResponse<ODataProperty> response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataProperty.class, parameters) + ODataInvokeResponse<ClientProperty> response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataComplexValue complexValue = response.getBody().getComplexValue(); - ODataProperty propInt16 = complexValue.get("PropertyInt16"); + ClientComplexValue complexValue = response.getBody().getComplexValue(); + ClientProperty propInt16 = complexValue.get("PropertyInt16"); assertNotNull(propInt16); assertEquals(3, propInt16.getPrimitiveValue().toValue()); - ODataProperty propString = complexValue.get("PropertyString"); + ClientProperty propString = complexValue.get("PropertyString"); assertNotNull(propString); assertEquals("UARTCTTwoPrimParam string value", propString.getPrimitiveValue().toValue()); } @@ -116,13 +116,13 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void complexCollectionActionNoContent() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollCTTwoPrimParam").build(); - Map<String, ODataValue> parameters = new HashMap<String, ODataValue>(); + Map<String, ClientValue> parameters = new HashMap<String, ClientValue>(); parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 0)); - ODataInvokeResponse<ODataProperty> response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataProperty.class, parameters) + ODataInvokeResponse<ClientProperty> response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataCollectionValue<ODataValue> complexValueCollection = response.getBody().getCollectionValue(); + ClientCollectionValue<ClientValue> complexValueCollection = response.getBody().getCollectionValue(); assertEquals(0, complexValueCollection.size()); } @@ -130,17 +130,17 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void complexCollectionActionSubContent() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollCTTwoPrimParam").build(); - Map<String, ODataValue> parameters = new HashMap<String, ODataValue>(); + Map<String, ClientValue> parameters = new HashMap<String, ClientValue>(); parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 1)); - ODataInvokeResponse<ODataProperty> response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataProperty.class, parameters) + ODataInvokeResponse<ClientProperty> response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataCollectionValue<ODataValue> complexValueCollection = response.getBody().getCollectionValue(); + ClientCollectionValue<ClientValue> complexValueCollection = response.getBody().getCollectionValue(); assertEquals(1, complexValueCollection.size()); - Iterator<ODataValue> iterator = complexValueCollection.iterator(); + Iterator<ClientValue> iterator = complexValueCollection.iterator(); - ODataComplexValue next = iterator.next().asComplex(); + ClientComplexValue next = iterator.next().asComplex(); assertEquals(16, next.get("PropertyInt16").getPrimitiveValue().toValue()); assertEquals("Test123", next.get("PropertyString").getPrimitiveValue().toValue()); } @@ -149,17 +149,17 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void complexCollectionActionAllContent() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollCTTwoPrimParam").build(); - Map<String, ODataValue> parameters = new HashMap<String, ODataValue>(); + Map<String, ClientValue> parameters = new HashMap<String, ClientValue>(); parameters.put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3)); - ODataInvokeResponse<ODataProperty> response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataProperty.class, parameters) + ODataInvokeResponse<ClientProperty> response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientProperty.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataCollectionValue<ODataValue> complexValueCollection = response.getBody().getCollectionValue(); + ClientCollectionValue<ClientValue> complexValueCollection = response.getBody().getCollectionValue(); assertEquals(3, complexValueCollection.size()); - Iterator<ODataValue> iterator = complexValueCollection.iterator(); + Iterator<ClientValue> iterator = complexValueCollection.iterator(); - ODataComplexValue next = iterator.next().asComplex(); + ClientComplexValue next = iterator.next().asComplex(); assertEquals(16, next.get("PropertyInt16").getPrimitiveValue().toValue()); assertEquals("Test123", next.get("PropertyString").getPrimitiveValue().toValue()); @@ -176,18 +176,18 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void entityActionETTwoKeyTwoPrim() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTETTwoKeyTwoPrimParam").build(); - Map<String, ODataValue> parameters = new HashMap<String, ODataValue>(); + Map<String, ClientValue> parameters = new HashMap<String, ClientValue>(); parameters .put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) -365)); - ODataInvokeResponse<ODataEntity> response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataEntity.class, parameters) + ODataInvokeResponse<ClientEntity> response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntity.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataEntity entity = response.getBody(); - ODataProperty propInt16 = entity.getProperty("PropertyInt16"); + ClientEntity entity = response.getBody(); + ClientProperty propInt16 = entity.getProperty("PropertyInt16"); assertNotNull(propInt16); assertEquals(-365, propInt16.getPrimitiveValue().toValue()); - ODataProperty propString = entity.getProperty("PropertyString"); + ClientProperty propString = entity.getProperty("PropertyString"); assertNotNull(propString); assertEquals("Test String2", propString.getPrimitiveValue().toValue()); } @@ -196,17 +196,17 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void entityCollectionActionETKeyNav() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollETKeyNavParam").build(); - Map<String, ODataValue> parameters = new HashMap<String, ODataValue>(); + Map<String, ClientValue> parameters = new HashMap<String, ClientValue>(); parameters .put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 3)); - ODataInvokeResponse<ODataEntitySet> response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataEntitySet.class, parameters) + ODataInvokeResponse<ClientEntitySet> response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataEntitySet entitySet = response.getBody(); + ClientEntitySet entitySet = response.getBody(); assertEquals(3, entitySet.getEntities().size()); Integer key = 1; - for (ODataEntity entity : entitySet.getEntities()) { + for (ClientEntity entity : entitySet.getEntities()) { assertEquals(key, entity.getProperty("PropertyInt16").getPrimitiveValue().toValue()); key++; } @@ -216,14 +216,14 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void entityCollectionActionETKeyNavEmptyCollection() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollETKeyNavParam").build(); - Map<String, ODataValue> parameters = new HashMap<String, ODataValue>(); + Map<String, ClientValue> parameters = new HashMap<String, ClientValue>(); parameters .put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 0)); - ODataInvokeResponse<ODataEntitySet> response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataEntitySet.class, parameters) + ODataInvokeResponse<ClientEntitySet> response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataEntitySet entitySet = response.getBody(); + ClientEntitySet entitySet = response.getBody(); assertEquals(0, entitySet.getEntities().size()); } @@ -231,14 +231,14 @@ public class ActionImportITCase extends AbstractBaseTestITCase { public void entityCollectionActionETKeyNavNegativeParam() throws Exception { URI actionURI = getClient().newURIBuilder(TecSvcConst.BASE_URI).appendActionCallSegment("AIRTCollETKeyNavParam").build(); - Map<String, ODataValue> parameters = new HashMap<String, ODataValue>(); + Map<String, ClientValue> parameters = new HashMap<String, ClientValue>(); parameters .put("ParameterInt16", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) -10)); - ODataInvokeResponse<ODataEntitySet> response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataEntitySet.class, parameters) + ODataInvokeResponse<ClientEntitySet> response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataEntitySet entitySet = response.getBody(); + ClientEntitySet entitySet = response.getBody(); assertEquals(0, entitySet.getEntities().size()); } @@ -251,18 +251,18 @@ public class ActionImportITCase extends AbstractBaseTestITCase { time.set(Calendar.HOUR_OF_DAY, 3); time.set(Calendar.MINUTE, 0); time.set(Calendar.SECOND, 0); - Map<String, ODataValue> parameters = new HashMap<String, ODataValue>(); + Map<String, ClientValue> parameters = new HashMap<String, ClientValue>(); parameters .put("ParameterTimeOfDay", getClient().getObjectFactory().newPrimitiveValueBuilder().setType( EdmPrimitiveTypeKind.TimeOfDay).setValue(time).build()); - ODataInvokeResponse<ODataEntitySet> response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataEntitySet.class, parameters) + ODataInvokeResponse<ClientEntitySet> response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntitySet.class, parameters) .execute(); assertEquals(200, response.getStatusCode()); - ODataEntitySet entitySet = response.getBody(); + ClientEntitySet entitySet = response.getBody(); assertEquals(3, entitySet.getEntities().size()); Integer key = 1; - for (ODataEntity entity : entitySet.getEntities()) { + for (ClientEntity entity : entitySet.getEntities()) { assertEquals(key, entity.getProperty("PropertyInt16").getPrimitiveValue().toValue()); key++; } @@ -275,12 +275,12 @@ public class ActionImportITCase extends AbstractBaseTestITCase { Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT")); dateTime.clear(); dateTime.set(1012, 2, 0, 0, 0, 0); - Map<String, ODataValue> parameters = new HashMap<String, ODataValue>(); + Map<String, ClientValue> parameters = new HashMap<String, ClientValue>(); parameters .put("ParameterDate", getClient().getObjectFactory().newPrimitiveValueBuilder().setType( EdmPrimitiveTypeKind.Date).setValue(dateTime).build()); - ODataInvokeResponse<ODataEntity> response = - getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ODataEntity.class, parameters) + ODataInvokeResponse<ClientEntity> response = + getClient().getInvokeRequestFactory().getActionInvokeRequest(actionURI, ClientEntity.class, parameters) .execute(); // Check 201 assertEquals(201, response.getStatusCode()); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicHttpExceptionHandlingITCase.java ---------------------------------------------------------------------- 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 17eb334..c283395 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 @@ -34,7 +34,7 @@ public class BasicHttpExceptionHandlingITCase extends AbstractBaseTestITCase { private static final String SERVICE_URI = TecSvcConst.BASE_URI + "/"; @Test - public void ambigiousXHTTPMethod() throws Exception{ + public void ambigiousXHTTPMethod() throws Exception { URL url = new URL(SERVICE_URI + "?$format=json"); HttpURLConnection connection = (HttpURLConnection) url.openConnection();
