http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git 
a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
 
b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
index 6c97cdb..17436e9 100644
--- 
a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
+++ 
b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
@@ -25,24 +25,24 @@ import java.util.Map;
 import org.apache.commons.io.IOUtils;
 import org.apache.olingo.client.api.ODataClient;
 import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
 import org.apache.olingo.client.api.domain.ClientEntitySetIterator;
+import org.apache.olingo.client.api.domain.ClientProperty;
+import org.apache.olingo.client.api.domain.ClientServiceDocument;
+import org.apache.olingo.client.api.domain.ClientValue;
 import org.apache.olingo.client.api.edm.xml.XMLMetadata;
 import org.apache.olingo.client.api.serialization.ODataReader;
 import org.apache.olingo.client.core.edm.ClientCsdlEdmProvider;
+import org.apache.olingo.commons.api.ODataError;
 import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.EntityCollection;
 import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.commons.api.ODataError;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.domain.ClientServiceDocument;
-import org.apache.olingo.client.api.domain.ClientValue;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
 import org.apache.olingo.commons.core.edm.EdmProviderImpl;
 import org.slf4j.Logger;
@@ -63,7 +63,7 @@ public class ODataReaderImpl implements ODataReader {
 
   @Override
   public Edm readMetadata(final InputStream input) {
-    return 
readMetadata(client.getDeserializer(ODataFormat.XML).toMetadata(input).getSchemaByNsOrAlias());
+    return 
readMetadata(client.getDeserializer(ContentType.APPLICATION_XML).toMetadata(input).getSchemaByNsOrAlias());
   }
 
   @Override
@@ -73,16 +73,16 @@ public class ODataReaderImpl implements ODataReader {
   }
 
   @Override
-  public ClientServiceDocument readServiceDocument(final InputStream input, 
final ODataFormat format)
+  public ClientServiceDocument readServiceDocument(final InputStream input, 
final ContentType contentType)
       throws ODataDeserializerException {
     return client.getBinder().getODataServiceDocument(
-        client.getDeserializer(format).toServiceDocument(input).getPayload());
+        
client.getDeserializer(contentType).toServiceDocument(input).getPayload());
   }
 
   @Override
-  public ODataError readError(final InputStream inputStream, final ODataFormat 
format)
+  public ODataError readError(final InputStream inputStream, final ContentType 
contentType)
       throws ODataDeserializerException {
-    return client.getDeserializer(format).toError(inputStream);
+    return client.getDeserializer(contentType).toError(inputStream);
   }
 
   @Override
@@ -96,22 +96,22 @@ public class ODataReaderImpl implements ODataReader {
             (URI) null,
             null,
             reference.cast(new ClientEntitySetIterator<ClientEntitySet, 
ClientEntity>(
-                client, src, ODataFormat.fromString(format))));
+                client, src, ContentType.parse(format))));
       } else if (ClientEntitySet.class.isAssignableFrom(reference)) {
-        final ResWrap<EntityCollection> resource = 
client.getDeserializer(ODataFormat.fromString(format))
+        final ResWrap<EntityCollection> resource = 
client.getDeserializer(ContentType.parse(format))
             .toEntitySet(src);
         res = new ResWrap<T>(
             resource.getContextURL(),
             resource.getMetadataETag(),
             reference.cast(client.getBinder().getODataEntitySet(resource)));
       } else if (ClientEntity.class.isAssignableFrom(reference)) {
-        final ResWrap<Entity> container = 
client.getDeserializer(ODataFormat.fromString(format)).toEntity(src);
+        final ResWrap<Entity> container = 
client.getDeserializer(ContentType.parse(format)).toEntity(src);
         res = new ResWrap<T>(
             container.getContextURL(),
             container.getMetadataETag(),
             reference.cast(client.getBinder().getODataEntity(container)));
       } else if (ClientProperty.class.isAssignableFrom(reference)) {
-        final ResWrap<Property> container = 
client.getDeserializer(ODataFormat.fromString(format)).toProperty(src);
+        final ResWrap<Property> container = 
client.getDeserializer(ContentType.parse(format)).toProperty(src);
         res = new ResWrap<T>(
             container.getContextURL(),
             container.getMetadataETag(),
@@ -121,7 +121,7 @@ public class ODataReaderImpl implements ODataReader {
             (URI) null,
             null,
             
reference.cast(client.getObjectFactory().newPrimitiveValueBuilder().
-                setType(ODataFormat.fromString(format) == 
ODataFormat.TEXT_PLAIN
+                
setType(ContentType.parse(format).equals(ContentType.TEXT_PLAIN)
                     ? EdmPrimitiveTypeKind.String : 
EdmPrimitiveTypeKind.Stream).
                 setValue(IOUtils.toString(src)) // TODO: set correct value
                 .build()));
@@ -132,7 +132,7 @@ public class ODataReaderImpl implements ODataReader {
             reference.cast(readMetadata(src)));
       } else if (ClientServiceDocument.class.isAssignableFrom(reference)) {
         final ResWrap<ServiceDocument> resource =
-            
client.getDeserializer(ODataFormat.fromString(format)).toServiceDocument(src);
+            
client.getDeserializer(ContentType.parse(format)).toServiceDocument(src);
         res = new ResWrap<T>(
             resource.getContextURL(),
             resource.getMetadataETag(),
@@ -141,7 +141,7 @@ public class ODataReaderImpl implements ODataReader {
         res = new ResWrap<T>(
             (URI) null,
             null,
-            reference.cast(readError(src, ODataFormat.fromString(format))));
+            reference.cast(readError(src, ContentType.parse(format))));
       } else {
         throw new IllegalArgumentException("Invalid reference type " + 
reference);
       }
@@ -158,20 +158,20 @@ public class ODataReaderImpl implements ODataReader {
   }
 
   @Override
-  public ClientEntitySet readEntitySet(final InputStream input, final 
ODataFormat format)
+  public ClientEntitySet readEntitySet(final InputStream input, final 
ContentType contentType)
       throws ODataDeserializerException {
-    return 
client.getBinder().getODataEntitySet(client.getDeserializer(format).toEntitySet(input));
+    return 
client.getBinder().getODataEntitySet(client.getDeserializer(contentType).toEntitySet(input));
   }
 
   @Override
-  public ClientEntity readEntity(final InputStream input, final ODataFormat 
format)
+  public ClientEntity readEntity(final InputStream input, final ContentType 
contentType)
       throws ODataDeserializerException {
-    return 
client.getBinder().getODataEntity(client.getDeserializer(format).toEntity(input));
+    return 
client.getBinder().getODataEntity(client.getDeserializer(contentType).toEntity(input));
   }
 
   @Override
-  public ClientProperty readProperty(final InputStream input, final 
ODataFormat format)
+  public ClientProperty readProperty(final InputStream input, final 
ContentType contentType)
       throws ODataDeserializerException {
-    return 
client.getBinder().getODataProperty(client.getDeserializer(format).toProperty(input));
+    return 
client.getBinder().getODataProperty(client.getDeserializer(contentType).toProperty(input));
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java
----------------------------------------------------------------------
diff --git 
a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java
 
b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java
index c891f1e..fe93cb1 100644
--- 
a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java
+++ 
b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataWriterImpl.java
@@ -29,13 +29,13 @@ import java.util.Collections;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.serialization.ODataWriter;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.client.api.domain.ClientEntity;
 import org.apache.olingo.client.api.domain.ClientLink;
 import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.client.api.serialization.ODataWriter;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.commons.api.serialization.ODataSerializerException;
 
 public class ODataWriterImpl implements ODataWriter {
@@ -47,7 +47,7 @@ public class ODataWriterImpl implements ODataWriter {
   }
 
   @Override
-  public InputStream writeEntities(final Collection<ClientEntity> entities, 
final ODataFormat format)
+  public InputStream writeEntities(final Collection<ClientEntity> entities, 
final ContentType contentType)
       throws ODataSerializerException {
     ByteArrayOutputStream output = new ByteArrayOutputStream();
     OutputStreamWriter writer;
@@ -58,7 +58,7 @@ public class ODataWriterImpl implements ODataWriter {
     }
     try {
       for (ClientEntity entity : entities) {
-        client.getSerializer(format).write(writer, 
client.getBinder().getEntity(entity));
+        client.getSerializer(contentType).write(writer, 
client.getBinder().getEntity(entity));
       }
 
       return new ByteArrayInputStream(output.toByteArray());
@@ -68,13 +68,13 @@ public class ODataWriterImpl implements ODataWriter {
   }
 
   @Override
-  public InputStream writeEntity(final ClientEntity entity, final ODataFormat 
format)
+  public InputStream writeEntity(final ClientEntity entity, final ContentType 
contentType)
       throws ODataSerializerException {
-    return writeEntities(Collections.<ClientEntity>singleton(entity), format);
+    return writeEntities(Collections.<ClientEntity>singleton(entity), 
contentType);
   }
 
   @Override
-  public InputStream writeProperty(final ClientProperty property, final 
ODataFormat format)
+  public InputStream writeProperty(final ClientProperty property, final 
ContentType contentType)
       throws ODataSerializerException {
     final ByteArrayOutputStream output = new ByteArrayOutputStream();
     OutputStreamWriter writer;
@@ -84,7 +84,7 @@ public class ODataWriterImpl implements ODataWriter {
       writer = null;
     }
     try {
-      client.getSerializer(format).write(writer, 
client.getBinder().getProperty(property));
+      client.getSerializer(contentType).write(writer, 
client.getBinder().getProperty(property));
 
       return new ByteArrayInputStream(output.toByteArray());
     } finally {
@@ -93,7 +93,7 @@ public class ODataWriterImpl implements ODataWriter {
   }
 
   @Override
-  public InputStream writeLink(final ClientLink link, final ODataFormat 
format) throws ODataSerializerException {
+  public InputStream writeLink(final ClientLink link, final ContentType 
contentType) throws ODataSerializerException {
     final ByteArrayOutputStream output = new ByteArrayOutputStream();
     OutputStreamWriter writer;
     try {
@@ -102,7 +102,7 @@ public class ODataWriterImpl implements ODataWriter {
       writer = null;
     }
     try {
-      client.getSerializer(format).write(writer, 
client.getBinder().getLink(link));
+      client.getSerializer(contentType).write(writer, 
client.getBinder().getLink(link));
 
       return new ByteArrayInputStream(output.toByteArray());
     } finally {
@@ -111,7 +111,7 @@ public class ODataWriterImpl implements ODataWriter {
   }
 
   @Override
-  public InputStream writeReference(ResWrap<URI> reference, ODataFormat 
format) throws ODataSerializerException {
+  public InputStream writeReference(ResWrap<URI> reference, ContentType 
contenType) throws ODataSerializerException {
     final ByteArrayOutputStream output = new ByteArrayOutputStream();
     OutputStreamWriter writer;
     
@@ -122,7 +122,7 @@ public class ODataWriterImpl implements ODataWriter {
     }
     
     try {
-      client.getSerializer(format).write(writer, reference);
+      client.getSerializer(contenType).write(writer, reference);
 
       return new ByteArrayInputStream(output.toByteArray());
     } finally {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
----------------------------------------------------------------------
diff --git 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
index c0a346a..ed21e24 100644
--- 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
+++ 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
@@ -19,7 +19,8 @@
 package org.apache.olingo.client.core;
 
 import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.Format;
 import org.custommonkey.xmlunit.XMLUnit;
 import org.junit.BeforeClass;
 
@@ -43,7 +44,8 @@ public abstract class AbstractTest {
     v4Client = ODataClientFactory.getClient();
   }
 
-  protected String getSuffix(final ODataFormat format) {
-    return format == ODataFormat.ATOM || format == ODataFormat.XML ? "xml" : 
"json";
+  protected String getSuffix(final ContentType contentType) {
+    return contentType.getODataFormat() == Format.ATOM 
+        || contentType.getODataFormat() == Format.XML ? "xml" : "json";
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java
----------------------------------------------------------------------
diff --git 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java
index 3d445d8..4618d3b 100644
--- 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java
+++ 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java
@@ -20,11 +20,8 @@ package org.apache.olingo.client.core.v4;
 
 import static org.junit.Assert.assertTrue;
 
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.core.AtomLinksQualifier;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.custommonkey.xmlunit.Diff;
+import java.io.ByteArrayInputStream;
+import java.io.StringWriter;
 
 import javax.xml.transform.Source;
 import javax.xml.transform.Transformer;
@@ -32,8 +29,11 @@ import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
-import java.io.ByteArrayInputStream;
-import java.io.StringWriter;
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.core.AtomLinksQualifier;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.custommonkey.xmlunit.Diff;
 
 public class AtomTest extends JSONTest {
 
@@ -43,13 +43,13 @@ public class AtomTest extends JSONTest {
   }
 
   @Override
-  protected ODataFormat getODataPubFormat() {
-    return ODataFormat.ATOM;
+  protected ContentType getODataPubFormat() {
+    return ContentType.APPLICATION_ATOM_XML;
   }
 
   @Override
-  protected ODataFormat getODataFormat() {
-    return ODataFormat.XML;
+  protected ContentType getODataFormat() {
+    return ContentType.APPLICATION_XML;
   }
 
   private String cleanup(final String input) throws Exception {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
----------------------------------------------------------------------
diff --git 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
index 5395472..e64d158 100644
--- 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
+++ 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
@@ -18,24 +18,24 @@
  */
 package org.apache.olingo.client.core.v4;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
 import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.domain.ClientEntity;
+import org.apache.olingo.client.api.domain.ClientEntitySet;
 import org.apache.olingo.client.core.AbstractTest;
 import org.apache.olingo.commons.api.data.EntityCollection;
 import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
 import org.junit.Test;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
 public class EntitySetTest extends AbstractTest {
 
   @Override
@@ -43,10 +43,10 @@ public class EntitySetTest extends AbstractTest {
     return v4Client;
   }
 
-  private void read(final ODataFormat format) throws IOException, 
ODataDeserializerException {
-    final InputStream input = getClass().getResourceAsStream("Customers." + 
getSuffix(format));
+  private void read(final ContentType contentType) throws IOException, 
ODataDeserializerException {
+    final InputStream input = getClass().getResourceAsStream("Customers." + 
getSuffix(contentType));
     final ClientEntitySet entitySet = 
getClient().getBinder().getODataEntitySet(
-        getClient().getDeserializer(format).toEntitySet(input));
+        getClient().getDeserializer(contentType).toEntitySet(input));
     assertNotNull(entitySet);
 
     assertEquals(2, entitySet.getEntities().size());
@@ -60,18 +60,18 @@ public class EntitySetTest extends AbstractTest {
 
   @Test
   public void fromAtom() throws Exception {
-    read(ODataFormat.ATOM);
+    read(ContentType.APPLICATION_ATOM_XML);
   }
 
   @Test
   public void fromJSON() throws Exception {
-    read(ODataFormat.JSON);
+    read(ContentType.JSON);
   }
 
-  private void ref(final ODataFormat format) throws ODataDeserializerException 
{
-    final InputStream input = 
getClass().getResourceAsStream("collectionOfEntityReferences." + 
getSuffix(format));
+  private void ref(final ContentType contentType) throws 
ODataDeserializerException {
+    final InputStream input = 
getClass().getResourceAsStream("collectionOfEntityReferences." + 
getSuffix(contentType));
     final ClientEntitySet entitySet = 
getClient().getBinder().getODataEntitySet(
-        getClient().getDeserializer(format).toEntitySet(input));
+        getClient().getDeserializer(contentType).toEntitySet(input));
     assertNotNull(entitySet);
 
     for (ClientEntity entity : entitySet.getEntities()) {
@@ -87,11 +87,11 @@ public class EntitySetTest extends AbstractTest {
 
   @Test
   public void atomRef() throws Exception {
-    ref(ODataFormat.ATOM);
+    ref(ContentType.APPLICATION_ATOM_XML);
   }
 
   @Test
   public void jsonRef() throws Exception {
-    ref(ODataFormat.JSON);
+    ref(ContentType.JSON);
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
----------------------------------------------------------------------
diff --git 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
index 7373da6..98ba7f9 100644
--- 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
+++ 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
@@ -29,10 +29,6 @@ import java.util.Iterator;
 
 import org.apache.olingo.client.api.EdmEnabledODataClient;
 import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.EdmEnabledODataClientImpl;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.client.api.domain.ClientAnnotation;
 import org.apache.olingo.client.api.domain.ClientComplexValue;
 import org.apache.olingo.client.api.domain.ClientEntity;
@@ -42,9 +38,14 @@ import org.apache.olingo.client.api.domain.ClientLinkType;
 import org.apache.olingo.client.api.domain.ClientProperty;
 import org.apache.olingo.client.api.domain.ClientValuable;
 import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.client.core.EdmEnabledODataClientImpl;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.Format;
 import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
 import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration;
 import org.junit.Ignore;
@@ -78,10 +79,10 @@ public class EntityTest extends AbstractTest {
     };
   }
 
-  private void singleton(final ODataFormat format) throws Exception {
-    final InputStream input = getClass().getResourceAsStream("VipCustomer." + 
getSuffix(format));
+  private void singleton(final ContentType contentType) throws Exception {
+    final InputStream input = getClass().getResourceAsStream("VipCustomer." + 
getSuffix(contentType));
     final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(format).toEntity(input));
+        getClient().getDeserializer(contentType).toEntity(input));
     assertNotNull(entity);
 
     assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", 
entity.getTypeName().toString());
@@ -102,7 +103,7 @@ public class EntityTest extends AbstractTest {
       }
       if ("Orders".equals(link.getName())) {
         checked++;
-        if (format == ODataFormat.ATOM) {
+        if (contentType.getODataFormat() == Format.ATOM) {
           assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, link.getType());
         }
       }
@@ -129,18 +130,18 @@ public class EntityTest extends AbstractTest {
 
   @Test
   public void atomSingleton() throws Exception {
-    singleton(ODataFormat.ATOM);
+    singleton(ContentType.APPLICATION_ATOM_XML);
   }
 
   @Test
   public void jsonSingleton() throws Exception {
-    singleton(ODataFormat.JSON_FULL_METADATA);
+    singleton(ContentType.JSON_FULL_METADATA);
   }
 
-  private void withEnums(final ODataFormat format) throws Exception {
-    final InputStream input = getClass().getResourceAsStream("Products_5." + 
getSuffix(format));
+  private void withEnums(final ContentType contentType) throws Exception {
+    final InputStream input = getClass().getResourceAsStream("Products_5." + 
getSuffix(contentType));
     final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(format).toEntity(input));
+        getClient().getDeserializer(contentType).toEntity(input));
     assertNotNull(entity);
 
     final ClientProperty skinColor = entity.getProperty("SkinColor");
@@ -165,19 +166,19 @@ public class EntityTest extends AbstractTest {
 
   @Test
   public void atomWithEnums() throws Exception {
-    withEnums(ODataFormat.ATOM);
+    withEnums(ContentType.APPLICATION_ATOM_XML);
   }
 
   @Test
   public void jsonWithEnums() throws Exception {
-    withEnums(ODataFormat.JSON_FULL_METADATA);
+    withEnums(ContentType.JSON_FULL_METADATA);
   }
 
-  private void withInlineEntitySet(final ODataFormat format) throws Exception {
+  private void withInlineEntitySet(final ContentType contentType) throws 
Exception {
     final InputStream input = getClass().getResourceAsStream(
-        "Accounts_101_expand_MyPaymentInstruments." + getSuffix(format));
+        "Accounts_101_expand_MyPaymentInstruments." + getSuffix(contentType));
     final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(format).toEntity(input));
+        getClient().getDeserializer(contentType).toEntity(input));
     assertNotNull(entity);
 
     final ClientLink instruments = 
entity.getNavigationLink("MyPaymentInstruments");
@@ -200,19 +201,19 @@ public class EntityTest extends AbstractTest {
 
   @Test
   public void atomWithInlineEntitySet() throws Exception {
-    withInlineEntitySet(ODataFormat.ATOM);
+    withInlineEntitySet(ContentType.APPLICATION_ATOM_XML);
   }
 
   @Test
   public void jsonWithInlineEntitySet() throws Exception {
-    withInlineEntitySet(ODataFormat.JSON_FULL_METADATA);
+    withInlineEntitySet(ContentType.JSON_FULL_METADATA);
   }
 
-  private void mediaEntity(final ODataFormat format) throws Exception {
+  private void mediaEntity(final ContentType contentType) throws Exception {
     final InputStream input = getClass().getResourceAsStream(
-        "Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7." + 
getSuffix(format));
+        "Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7." + 
getSuffix(contentType));
     final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(format).toEntity(input));
+        getClient().getDeserializer(contentType).toEntity(input));
     assertNotNull(entity);
 
     assertTrue(entity.isMediaEntity());
@@ -227,18 +228,18 @@ public class EntityTest extends AbstractTest {
 
   @Test
   public void atomMediaEntity() throws Exception {
-    mediaEntity(ODataFormat.ATOM);
+    mediaEntity(ContentType.APPLICATION_ATOM_XML);
   }
 
   @Test
   public void jsonMediaEntity() throws Exception {
-    mediaEntity(ODataFormat.JSON_FULL_METADATA);
+    mediaEntity(ContentType.JSON_FULL_METADATA);
   }
 
-  private void withStream(final ODataFormat format) throws Exception {
-    final InputStream input = 
getClass().getResourceAsStream("PersonDetails_1." + getSuffix(format));
+  private void withStream(final ContentType contentType) throws Exception {
+    final InputStream input = 
getClass().getResourceAsStream("PersonDetails_1." + getSuffix(contentType));
     final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(format).toEntity(input));
+        getClient().getDeserializer(contentType).toEntity(input));
     assertNotNull(entity);
 
     assertFalse(entity.isMediaEntity());
@@ -254,18 +255,18 @@ public class EntityTest extends AbstractTest {
 
   @Test
   public void atomWithStream() throws Exception {
-    withStream(ODataFormat.ATOM);
+    withStream(ContentType.APPLICATION_ATOM_XML);
   }
 
   @Test
   public void jsonWithStream() throws Exception {
-    withStream(ODataFormat.JSON_FULL_METADATA);
+    withStream(ContentType.JSON_FULL_METADATA);
   }
 
-  private void ref(final ODataFormat format) throws Exception {
-    final InputStream input = 
getClass().getResourceAsStream("entityReference." + getSuffix(format));
+  private void ref(final ContentType contentType) throws Exception {
+    final InputStream input = 
getClass().getResourceAsStream("entityReference." + getSuffix(contentType));
     final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(format).toEntity(input));
+        getClient().getDeserializer(contentType).toEntity(input));
     assertNotNull(entity);
 
     assertNotNull(entity.getId());
@@ -278,18 +279,18 @@ public class EntityTest extends AbstractTest {
 
   @Test
   public void atomRef() throws Exception {
-    ref(ODataFormat.ATOM);
+    ref(ContentType.APPLICATION_ATOM_XML);
   }
 
   @Test
   public void jsonRef() throws Exception {
-    ref(ODataFormat.JSON);
+    ref(ContentType.JSON);
   }
 
-  private void complexNavigationProperties(final ODataFormat format) throws 
Exception {
-    final InputStream input = 
getClass().getResourceAsStream("entity.withcomplexnavigation." + 
getSuffix(format));
+  private void complexNavigationProperties(final ContentType contentType) 
throws Exception {
+    final InputStream input = 
getClass().getResourceAsStream("entity.withcomplexnavigation." + 
getSuffix(contentType));
     final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(format).toEntity(input));
+        getClient().getDeserializer(contentType).toEntity(input));
     assertNotNull(entity);
 
     final ClientComplexValue addressValue = 
entity.getProperty("Address").getComplexValue();
@@ -306,18 +307,18 @@ public class EntityTest extends AbstractTest {
 
   @Test
   public void atomComplexNavigationProperties() throws Exception {
-    complexNavigationProperties(ODataFormat.ATOM);
+    complexNavigationProperties(ContentType.APPLICATION_ATOM_XML);
   }
 
   @Test
   public void jsonComplexNavigationProperties() throws Exception {
-    complexNavigationProperties(ODataFormat.JSON);
+    complexNavigationProperties(ContentType.JSON);
   }
 
-  private void annotated(final ODataFormat format) throws 
EdmPrimitiveTypeException, Exception {
-    final InputStream input = getClass().getResourceAsStream("annotated." + 
getSuffix(format));
+  private void annotated(final ContentType contentType) throws 
EdmPrimitiveTypeException, Exception {
+    final InputStream input = getClass().getResourceAsStream("annotated." + 
getSuffix(contentType));
     final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(format).toEntity(input));
+        getClient().getDeserializer(contentType).toEntity(input));
     assertNotNull(entity);
 
     assertFalse(entity.getAnnotations().isEmpty());
@@ -353,18 +354,18 @@ public class EntityTest extends AbstractTest {
   @Test
   @Ignore
   public void atomAnnotated() throws Exception {
-    annotated(ODataFormat.ATOM);
+    annotated(ContentType.APPLICATION_ATOM_XML);
   }
 
   @Test
   @Ignore
   public void jsonAnnotated() throws Exception {
-    annotated(ODataFormat.JSON);
+    annotated(ContentType.JSON);
   }
 
-  private void derived(final ODataClient client, final ODataFormat format) 
throws Exception {
-    final InputStream input = getClass().getResourceAsStream("Customer." + 
getSuffix(format));
-    final ClientEntity entity = 
client.getBinder().getODataEntity(client.getDeserializer(format).toEntity(input));
+  private void derived(final ODataClient client, final ContentType 
contentType) throws Exception {
+    final InputStream input = getClass().getResourceAsStream("Customer." + 
getSuffix(contentType));
+    final ClientEntity entity = 
client.getBinder().getODataEntity(client.getDeserializer(contentType).toEntity(input));
     assertNotNull(entity);
 
     assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", 
entity.getTypeName().toString());
@@ -375,16 +376,16 @@ public class EntityTest extends AbstractTest {
 
   @Test
   public void derivedFromAtom() throws Exception {
-    derived(getClient(), ODataFormat.ATOM);
+    derived(getClient(), ContentType.APPLICATION_ATOM_XML);
   }
 
   @Test
   public void derivedFromJSON() throws Exception {
-    derived(getEdmEnabledClient(), ODataFormat.JSON);
+    derived(getEdmEnabledClient(), ContentType.JSON);
   }
 
   @Test
   public void derivedFromFullJSON() throws Exception {
-    derived(getClient(), ODataFormat.JSON_FULL_METADATA);
+    derived(getClient(), ContentType.JSON_FULL_METADATA);
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
----------------------------------------------------------------------
diff --git 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
index 057c0de..7fd7c45 100644
--- 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
+++ 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
@@ -18,16 +18,16 @@
  */
 package org.apache.olingo.client.core.v4;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import org.apache.olingo.client.api.ODataClient;
 import org.apache.olingo.client.core.AbstractTest;
 import org.apache.olingo.commons.api.ODataError;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
 public class ErrorTest extends AbstractTest {
 
   @Override
@@ -35,15 +35,15 @@ public class ErrorTest extends AbstractTest {
     return v4Client;
   }
 
-  private ODataError error(final String name, final ODataFormat format) throws 
ODataDeserializerException {
-    final ODataError error = getClient().getDeserializer(format).toError(
-            getClass().getResourceAsStream(name + "." + getSuffix(format)));
+  private ODataError error(final String name, final ContentType contentType) 
throws ODataDeserializerException {
+    final ODataError error = getClient().getDeserializer(contentType).toError(
+            getClass().getResourceAsStream(name + "." + 
getSuffix(contentType)));
     assertNotNull(error);
     return error;
   }
 
-  private void simple(final ODataFormat format) throws 
ODataDeserializerException {
-    final ODataError error = error("error", format);
+  private void simple(final ContentType contentType) throws 
ODataDeserializerException {
+    final ODataError error = error("error", contentType);
     assertEquals("501", error.getCode());
     assertEquals("Unsupported functionality", error.getMessage());
     assertEquals("query", error.getTarget());
@@ -51,12 +51,12 @@ public class ErrorTest extends AbstractTest {
 
   @Test
   public void jsonSimple() throws Exception {
-    simple(ODataFormat.JSON);
+    simple(ContentType.JSON);
   }
 
   @Test
   public void atomSimple() throws Exception {
-    simple(ODataFormat.ATOM);
+    simple(ContentType.APPLICATION_ATOM_XML);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
----------------------------------------------------------------------
diff --git 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
index 83c495c..87edec1 100644
--- 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
+++ 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
@@ -31,16 +31,16 @@ import java.util.Map;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Delta;
-import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.client.api.domain.ClientCollectionValue;
 import org.apache.olingo.client.api.domain.ClientComplexValue;
 import org.apache.olingo.client.api.domain.ClientEntity;
 import org.apache.olingo.client.api.domain.ClientValue;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Delta;
+import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
 import org.junit.Test;
 
 import com.fasterxml.jackson.databind.JsonNode;
@@ -56,12 +56,12 @@ public class JSONTest extends AbstractTest {
     return v4Client;
   }
 
-  protected ODataFormat getODataPubFormat() {
-    return ODataFormat.JSON;
+  protected ContentType getODataPubFormat() {
+    return ContentType.JSON;
   }
 
-  protected ODataFormat getODataFormat() {
-    return ODataFormat.JSON;
+  protected ContentType getODataFormat() {
+    return ContentType.JSON;
   }
 
   private void cleanup(final ObjectNode node) {
@@ -128,12 +128,12 @@ public class JSONTest extends AbstractTest {
     assertEquals(expected, actualNode);
   }
 
-  protected void entitySet(final String filename, final ODataFormat format) 
throws Exception {
+  protected void entitySet(final String filename, final ContentType 
contentType) throws Exception {
     final StringWriter writer = new StringWriter();
-    getClient().getSerializer(format).write(writer, 
getClient().getDeserializer(format).toEntitySet(
-        getClass().getResourceAsStream(filename + "." + 
getSuffix(format))).getPayload());
+    getClient().getSerializer(contentType).write(writer, 
getClient().getDeserializer(contentType).toEntitySet(
+        getClass().getResourceAsStream(filename + "." + 
getSuffix(contentType))).getPayload());
 
-    assertSimilar(filename + "." + getSuffix(format), writer.toString());
+    assertSimilar(filename + "." + getSuffix(contentType), writer.toString());
   }
 
   @Test
@@ -142,12 +142,12 @@ public class JSONTest extends AbstractTest {
     entitySet("collectionOfEntityReferences", getODataPubFormat());
   }
 
-  protected void entity(final String filename, final ODataFormat format) 
throws Exception {
+  protected void entity(final String filename, final ContentType contentType) 
throws Exception {
     final StringWriter writer = new StringWriter();
-    getClient().getSerializer(format).write(writer, 
getClient().getDeserializer(format).toEntity(
-        getClass().getResourceAsStream(filename + "." + 
getSuffix(format))).getPayload());
+    getClient().getSerializer(contentType).write(writer, 
getClient().getDeserializer(contentType).toEntity(
+        getClass().getResourceAsStream(filename + "." + 
getSuffix(contentType))).getPayload());
     
-    assertSimilar(filename + "." + getSuffix(format), writer.toString());
+    assertSimilar(filename + "." + getSuffix(contentType), writer.toString());
   }
 
   @Test
@@ -169,12 +169,12 @@ public class JSONTest extends AbstractTest {
     entity("annotated", getODataPubFormat());
   }
 
-  protected void property(final String filename, final ODataFormat format) 
throws Exception {
+  protected void property(final String filename, final ContentType 
contentType) throws Exception {
     final StringWriter writer = new StringWriter();
-    getClient().getSerializer(format).write(writer, 
getClient().getDeserializer(format).
-        toProperty(getClass().getResourceAsStream(filename + "." + 
getSuffix(format))).getPayload());
+    getClient().getSerializer(contentType).write(writer, 
getClient().getDeserializer(contentType).
+        toProperty(getClass().getResourceAsStream(filename + "." + 
getSuffix(contentType))).getPayload());
 
-    assertSimilar(filename + "." + getSuffix(format), writer.toString());
+    assertSimilar(filename + "." + getSuffix(contentType), writer.toString());
   }
 
   @Test
@@ -187,13 +187,13 @@ public class JSONTest extends AbstractTest {
 
   @Test
   public void crossjoin() throws Exception {
-    
assertNotNull(getClient().getDeserializer(ODataFormat.JSON_FULL_METADATA).toEntitySet(
+    
assertNotNull(getClient().getDeserializer(ContentType.JSON_FULL_METADATA).toEntitySet(
         getClass().getResourceAsStream("crossjoin.json")));
   }
 
-  protected void delta(final String filename, final ODataFormat format) throws 
Exception {
-    final Delta delta = getClient().getDeserializer(format).toDelta(
-        getClass().getResourceAsStream(filename + "." + 
getSuffix(format))).getPayload();
+  protected void delta(final String filename, final ContentType contentType) 
throws Exception {
+    final Delta delta = getClient().getDeserializer(contentType).toDelta(
+        getClass().getResourceAsStream(filename + "." + 
getSuffix(contentType))).getPayload();
     assertNotNull(delta);
     assertNotNull(delta.getDeltaLink());
     assertEquals(5, delta.getCount(), 0);
@@ -248,7 +248,7 @@ public class JSONTest extends AbstractTest {
         
getClient().getObjectFactory().newEnumValue("Microsoft.Exchange.Services.OData.Model.BodyType",
 "text")));
     
message.getProperties().add(getClient().getObjectFactory().newComplexProperty("Body",
 body));
 
-    final String actual = 
IOUtils.toString(getClient().getWriter().writeEntity(message, 
ODataFormat.JSON));
+    final String actual = 
IOUtils.toString(getClient().getWriter().writeEntity(message, 
ContentType.JSON));
     final JsonNode expected =
         
OBJECT_MAPPER.readTree(IOUtils.toString(getClass().getResourceAsStream("olingo390.json")).
             replace(Constants.JSON_NAVIGATION_LINK, 
Constants.JSON_BIND_LINK_SUFFIX));

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
----------------------------------------------------------------------
diff --git 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
index 562a255..1f603ad 100644
--- 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
+++ 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
@@ -64,7 +64,7 @@ import 
org.apache.olingo.commons.api.edm.provider.annotation.ConstantAnnotationE
 import org.apache.olingo.commons.api.edm.provider.annotation.Path;
 import 
org.apache.olingo.commons.api.edm.provider.annotation.TwoParamsOpDynamicAnnotationExpression;
 import org.apache.olingo.commons.api.edm.provider.annotation.UrlRef;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.commons.core.edm.primitivetype.EdmDecimal;
 import org.apache.olingo.commons.core.edm.primitivetype.EdmInt32;
 import 
org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
@@ -140,7 +140,7 @@ public class MetadataTest extends AbstractTest {
 
   @Test
   public void demo() {
-    final XMLMetadata metadata = getClient().getDeserializer(ODataFormat.XML).
+    final XMLMetadata metadata = 
getClient().getDeserializer(ContentType.APPLICATION_XML).
         toMetadata(getClass().getResourceAsStream("demo-metadata.xml"));
     assertNotNull(metadata);
 
@@ -181,7 +181,7 @@ public class MetadataTest extends AbstractTest {
 
   @Test
   public void multipleSchemas() {
-    final XMLMetadata metadata = getClient().getDeserializer(ODataFormat.XML).
+    final XMLMetadata metadata = 
getClient().getDeserializer(ContentType.APPLICATION_XML).
         toMetadata(getClass().getResourceAsStream("northwind-metadata.xml"));
     assertNotNull(metadata);
 
@@ -201,7 +201,7 @@ public class MetadataTest extends AbstractTest {
    */
   @Test
   public void fromdoc1() {
-    final XMLMetadata metadata = getClient().getDeserializer(ODataFormat.XML).
+    final XMLMetadata metadata = 
getClient().getDeserializer(ContentType.APPLICATION_XML).
         toMetadata(getClass().getResourceAsStream("fromdoc1-metadata.xml"));
     assertNotNull(metadata);
 
@@ -281,7 +281,7 @@ public class MetadataTest extends AbstractTest {
    */
   @Test
   public void fromdoc2() {
-    final XMLMetadata metadata = getClient().getDeserializer(ODataFormat.XML)
+    final XMLMetadata metadata = 
getClient().getDeserializer(ContentType.APPLICATION_XML)
         .toMetadata(getClass().getResourceAsStream("fromdoc2-metadata.xml"));
     assertNotNull(metadata);
 
@@ -343,7 +343,7 @@ public class MetadataTest extends AbstractTest {
    */
   @Test
   public void fromdoc4() {
-    final XMLMetadata metadata = getClient().getDeserializer(ODataFormat.XML).
+    final XMLMetadata metadata = 
getClient().getDeserializer(ContentType.APPLICATION_XML).
         toMetadata(getClass().getResourceAsStream("fromdoc4-metadata.xml"));
     assertNotNull(metadata);
 
@@ -399,7 +399,7 @@ public class MetadataTest extends AbstractTest {
   @Test
   public void metadataWithCapabilities() throws Exception {
     InputStream input = 
getClass().getResourceAsStream("Metadata-With-Capabilities.xml");
-    final XMLMetadata metadata = getClient().getDeserializer(ODataFormat.XML).
+    final XMLMetadata metadata = 
getClient().getDeserializer(ContentType.APPLICATION_XML).
             toMetadata(input);
 
     CsdlSchema schema = metadata.getSchema("Capabilities");

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
----------------------------------------------------------------------
diff --git 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
index 46e0d22..ccce804 100644
--- 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
+++ 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
@@ -18,24 +18,25 @@
  */
 package org.apache.olingo.client.core.v4;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.util.Iterator;
+
 import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.core.AbstractTest;
 import org.apache.olingo.client.api.domain.ClientCollectionValue;
 import org.apache.olingo.client.api.domain.ClientComplexValue;
 import org.apache.olingo.client.api.domain.ClientProperty;
 import org.apache.olingo.client.api.domain.ClientValue;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.Format;
 import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
 import org.apache.olingo.commons.api.serialization.ODataSerializerException;
 import org.junit.Test;
 
-import java.io.InputStream;
-import java.util.Iterator;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 public class PropertyTest extends AbstractTest {
 
   @Override
@@ -43,16 +44,16 @@ public class PropertyTest extends AbstractTest {
     return v4Client;
   }
 
-  private void _enum(final ODataFormat format) throws 
ODataDeserializerException, ODataSerializerException {
-    final InputStream input = 
getClass().getResourceAsStream("Products_5_SkinColor." + getSuffix(format));
-    final ClientProperty property = 
getClient().getReader().readProperty(input, format);
+  private void _enum(final ContentType contentType) throws 
ODataDeserializerException, ODataSerializerException {
+    final InputStream input = 
getClass().getResourceAsStream("Products_5_SkinColor." + 
getSuffix(contentType));
+    final ClientProperty property = 
getClient().getReader().readProperty(input, contentType);
     assertNotNull(property);
     assertTrue(property.hasEnumValue());
 
     final ClientProperty written = getClient().getReader().readProperty(
-            getClient().getWriter().writeProperty(property, format), format);
+            getClient().getWriter().writeProperty(property, contentType), 
contentType);
     // This is needed because type information gets lost with serialization
-    if (format == ODataFormat.XML) {
+    if (contentType.getODataFormat() == Format.APPLICATION_XML) {
       final ClientProperty comparable = 
getClient().getObjectFactory().newEnumProperty(property.getName(),
               getClient().getObjectFactory().
               newEnumValue(property.getEnumValue().getTypeName(), 
written.getEnumValue().getValue()));
@@ -63,23 +64,23 @@ public class PropertyTest extends AbstractTest {
 
   @Test
   public void xmlEnum() throws Exception {
-    _enum(ODataFormat.XML);
+    _enum(ContentType.APPLICATION_XML);
   }
 
   @Test
   public void jsonEnum() throws Exception {
-    _enum(ODataFormat.JSON);
+    _enum(ContentType.JSON);
   }
 
-  private void complex(final ODataFormat format) throws 
ODataDeserializerException, ODataSerializerException {
-    final InputStream input = 
getClass().getResourceAsStream("Employees_3_HomeAddress." + getSuffix(format));
-    final ClientProperty property = 
getClient().getReader().readProperty(input, format);
+  private void complex(final ContentType contentType) throws 
ODataDeserializerException, ODataSerializerException {
+    final InputStream input = 
getClass().getResourceAsStream("Employees_3_HomeAddress." + 
getSuffix(contentType));
+    final ClientProperty property = 
getClient().getReader().readProperty(input, contentType);
     assertNotNull(property);
     assertTrue(property.hasComplexValue());
     assertEquals(3, property.getComplexValue().size());
 
     final ClientProperty written = getClient().getReader().readProperty(
-            getClient().getWriter().writeProperty(property, format), format);
+            getClient().getWriter().writeProperty(property, contentType), 
contentType);
     // This is needed because type information gets lost with JSON 
serialization
     final ClientComplexValue typedValue = getClient().getObjectFactory().
             newComplexValue(property.getComplexValue().getTypeName());
@@ -95,25 +96,25 @@ public class PropertyTest extends AbstractTest {
 
   @Test
   public void xmlComplex() throws Exception {
-    complex(ODataFormat.XML);
+    complex(ContentType.APPLICATION_XML);
   }
 
   @Test
   public void jsonComplex() throws Exception {
-    complex(ODataFormat.JSON);
+    complex(ContentType.JSON);
   }
 
-  private void collection(final ODataFormat format) throws 
ODataDeserializerException, ODataSerializerException {
-    final InputStream input = 
getClass().getResourceAsStream("Products_5_CoverColors." + getSuffix(format));
-    final ClientProperty property = 
getClient().getReader().readProperty(input, format);
+  private void collection(final ContentType contentType) throws 
ODataDeserializerException, ODataSerializerException {
+    final InputStream input = 
getClass().getResourceAsStream("Products_5_CoverColors." + 
getSuffix(contentType));
+    final ClientProperty property = 
getClient().getReader().readProperty(input, contentType);
     assertNotNull(property);
     assertTrue(property.hasCollectionValue());
     assertEquals(3, property.getCollectionValue().size());
 
     final ClientProperty written = getClient().getReader().readProperty(
-            getClient().getWriter().writeProperty(property, format), format);
+            getClient().getWriter().writeProperty(property, contentType), 
contentType);
     // This is needed because type information gets lost with JSON 
serialization
-    if (format == ODataFormat.XML) {
+    if (contentType.getODataFormat() == Format.APPLICATION_XML) {
       final ClientCollectionValue<ClientValue> typedValue = 
getClient().getObjectFactory().
               newCollectionValue(property.getCollectionValue().getTypeName());
       for (final Iterator<ClientValue> itor = 
written.getCollectionValue().iterator(); itor.hasNext();) {
@@ -129,11 +130,11 @@ public class PropertyTest extends AbstractTest {
 
   @Test
   public void xmlCollection() throws Exception {
-    collection(ODataFormat.XML);
+    collection(ContentType.APPLICATION_XML);
   }
 
   @Test
   public void jsonCollection() throws Exception {
-    collection(ODataFormat.JSON);
+    collection(ContentType.JSON);
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
----------------------------------------------------------------------
diff --git 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
index 1a2de09..65bd697 100644
--- 
a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
+++ 
b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
@@ -18,21 +18,22 @@
  */
 package org.apache.olingo.client.core.v4;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URI;
+
 import org.apache.olingo.client.api.ODataClient;
 import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.domain.ClientServiceDocument;
 import org.apache.olingo.client.core.AbstractTest;
 import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.client.api.domain.ClientServiceDocument;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.api.format.Format;
 import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
 import org.junit.Test;
 
-import java.net.URI;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 public class ServiceDocumentTest extends AbstractTest {
 
   @Override
@@ -40,13 +41,13 @@ public class ServiceDocumentTest extends AbstractTest {
     return v4Client;
   }
 
-  private String getFileExtension(final ODataFormat format) {
-    return format == ODataFormat.XML ? "xml" : "json";
+  private String getFileExtension(final ContentType contentType) {
+    return contentType.getODataFormat() == Format.XML ? "xml" : "json";
   }
 
-  private ClientServiceDocument parse(final ODataFormat format) throws 
ODataDeserializerException {
-    ResWrap<ServiceDocument> service = 
getClient().getDeserializer(format).toServiceDocument(
-            getClass().getResourceAsStream("serviceDocument." + 
getFileExtension(format)));
+  private ClientServiceDocument parse(final ContentType contentType) throws 
ODataDeserializerException {
+    ResWrap<ServiceDocument> service = 
getClient().getDeserializer(contentType).toServiceDocument(
+        getClass().getResourceAsStream("serviceDocument." + 
getFileExtension(contentType)));
 
     assertEquals(URI.create("http://host/service/$metadata";), 
service.getContextURL());
     assertEquals("W/\"MjAxMy0wNS0xM1QxNDo1NFo=\"", service.getMetadataETag());
@@ -56,20 +57,20 @@ public class ServiceDocumentTest extends AbstractTest {
 
     assertTrue(serviceDocument.getEntitySetNames().contains("Order Details"));
     assertEquals(URI.create("http://host/service/TopProducts";),
-            serviceDocument.getFunctionImportURI("TopProducts"));
+        serviceDocument.getFunctionImportURI("TopProducts"));
     assertEquals(URI.create("http://host/HR/";),
-            
serviceDocument.getRelatedServiceDocumentsURIs().iterator().next());
+        serviceDocument.getRelatedServiceDocumentsURIs().iterator().next());
 
     return serviceDocument;
   }
 
   @Test
   public void json() throws Exception {
-    parse(ODataFormat.JSON);
+    parse(ContentType.JSON);
   }
 
   @Test
   public void xml() throws Exception {
-    parse(ODataFormat.XML);
+    parse(ContentType.APPLICATION_XML);
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/AcceptType.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/AcceptType.java
 
b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/AcceptType.java
index 734e007..874944b 100644
--- 
a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/AcceptType.java
+++ 
b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/AcceptType.java
@@ -122,14 +122,14 @@ public class AcceptType {
 
   /**
    * Creates a list of {@link AcceptType} objects based on given input string 
(<code>format</code>).
-   * @param format accept types, comma-separated, as specified for the HTTP 
header <code>Accept</code>
+   * @param contentType accept types, comma-separated, as specified for the 
HTTP header <code>Accept</code>
    * @return a list of <code>AcceptType</code> objects
    * @throws IllegalArgumentException if input string is not parseable
    */
-  public static List<AcceptType> create(final String format) {
+  public static List<AcceptType> create(final String contentType) {
     List<AcceptType> result = new ArrayList<AcceptType>();
 
-    String[] values = format.split(",");
+    String[] values = contentType.split(",");
     for (String value : values) {
       result.add(new AcceptType(value.trim()));
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java
 
b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java
index 6ab29b6..90572a4 100644
--- 
a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java
+++ 
b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java
@@ -49,14 +49,20 @@ public final class ContentType {
   private static final String APPLICATION = "application";
   private static final String TEXT = "text";
   private static final String MULTIPART = "multipart";
-
+  
+  public static final ContentType APPLICATION_JSON = new 
ContentType(APPLICATION, "json", null);
+  public static final ContentType JSON = 
ContentType.create(ContentType.APPLICATION_JSON, "odata.metadata=minimal");
+  public static final ContentType JSON_NO_METADATA = 
ContentType.create(ContentType.APPLICATION_JSON, 
+                                                                        
"odata.metadata=none");
+  public static final ContentType JSON_FULL_METADATA = 
ContentType.create(ContentType.APPLICATION_JSON, 
+                                                                          
"odata.metadata=full");
+  
   public static final ContentType APPLICATION_XML = new 
ContentType(APPLICATION, "xml", null);
   public static final ContentType APPLICATION_ATOM_XML = new 
ContentType(APPLICATION, "atom+xml", null);
   public static final ContentType APPLICATION_ATOM_XML_ENTRY = 
create(APPLICATION_ATOM_XML, "type=entry");
   public static final ContentType APPLICATION_ATOM_XML_FEED = 
create(APPLICATION_ATOM_XML, "type=feed");
   public static final ContentType APPLICATION_ATOM_SVC = new 
ContentType(APPLICATION, "atomsvc+xml", null);
 
-  public static final ContentType APPLICATION_JSON = new 
ContentType(APPLICATION, "json", null);
 
   public static final ContentType APPLICATION_OCTET_STREAM = new 
ContentType(APPLICATION, "octet-stream", null);
 
@@ -74,9 +80,9 @@ public final class ContentType {
 
   public static final ContentType MULTIPART_FORM_DATA = new 
ContentType(MULTIPART, "form-data", null);
 
-  public static final String PARAMETER_CHARSET= "charset";
+  public static final String PARAMETER_CHARSET = "charset";
   public static final String PARAMETER_IEEE754_COMPATIBLE = 
"IEEE754Compatible";
-  
+
   private final String type;
   private final String subtype;
   private final Map<String, String> parameters;
@@ -132,12 +138,12 @@ public final class ContentType {
   /**
    * Creates a content type from format and key-value pairs for parameters.
    *
-   * @param format for example "application/json"
+   * @param contentType for example "application/json"
    * @param parameters for example "a=b", "c=d"
    * @return a new <code>ContentType</code> object
    */
-  public static ContentType create(final String format, final String... 
parameters) {
-    ContentType ct = parse(format);
+  public static ContentType create(final String contentType, final String... 
parameters) {
+    ContentType ct = parse(contentType);
 
     for (String p : parameters) {
       final String[] keyvalue = TypeUtil.parseParameter(p);
@@ -326,11 +332,54 @@ public final class ContentType {
 
     for (String key : parameters.keySet()) {
       sb.append(TypeUtil.PARAMETER_SEPARATOR).append(key)
-      
.append(TypeUtil.PARAMETER_KEY_VALUE_SEPARATOR).append(parameters.get(key));
+          
.append(TypeUtil.PARAMETER_KEY_VALUE_SEPARATOR).append(parameters.get(key));
     }
     return sb.toString();
   }
 
+  /**
+   * Returns the {@link Format} of the current Content-Type
+   * 
+   * @return {@link Format}
+   */
+  public Format getODataFormat() {
+    if (isCompatible(ContentType.APPLICATION_ATOM_XML)
+        || isCompatible(ContentType.APPLICATION_ATOM_SVC)) {
+      return Format.ATOM;
+    } else if (isCompatible(ContentType.APPLICATION_XML)) {
+      return Format.XML;
+    } else if (isCompatible(ContentType.APPLICATION_JSON)) {
+      String jsonVariant = getParameters().get("odata.metadata");
+      if (jsonVariant != null) {
+        if ("none".equals(jsonVariant)) {
+          return Format.JSON_NO_METADATA;
+        } else if ("minimal".equals(jsonVariant)) {
+          return Format.JSON;
+        } else if ("full".equals(jsonVariant)) {
+          return Format.JSON_FULL_METADATA;
+        }
+      }
+      return Format.JSON;
+    } else if (isCompatible(ContentType.APPLICATION_OCTET_STREAM)) {
+      return Format.APPLICATION_OCTET_STREAM;
+    } else if (isCompatible(ContentType.TEXT_PLAIN)) {
+      return Format.TEXT_PLAIN;
+    } else if (isCompatible(ContentType.APPLICATION_XHTML_XML)) {
+      return Format.APPLICATION_XHTML_XML;
+    } else if (isCompatible(ContentType.APPLICATION_SVG_XML)) {
+      return Format.APPLICATION_SVG_XML;
+    } else if (isCompatible(ContentType.APPLICATION_FORM_URLENCODED)) {
+      return Format.APPLICATION_FORM_URLENCODED;
+    } else if (isCompatible(ContentType.MULTIPART_FORM_DATA)) {
+      return Format.MULTIPART_FORM_DATA;
+    } else if (isCompatible(ContentType.TEXT_XML)) {
+      return Format.TEXT_XML;
+    } else if (isCompatible(ContentType.TEXT_HTML)) {
+      return Format.TEXT_HTML;
+    }
+    return null;
+  }
+
   @Override
   public String toString() {
     return toContentTypeString();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/Format.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/Format.java
 
b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/Format.java
new file mode 100644
index 0000000..09e6a01
--- /dev/null
+++ 
b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/Format.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.format;
+
+/**
+ * Available formats to be used in various contexts.
+ */
+public enum Format {
+  JSON_NO_METADATA,
+  JSON,
+  JSON_FULL_METADATA,
+  ATOM,
+  XML,
+  APPLICATION_XML,
+  APPLICATION_XHTML_XML,
+  APPLICATION_SVG_XML,
+  APPLICATION_JSON,
+  APPLICATION_FORM_URLENCODED,
+  MULTIPART_FORM_DATA,
+  APPLICATION_OCTET_STREAM,
+  TEXT_PLAIN,
+  TEXT_XML,
+  TEXT_HTML
+}
+

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
 
b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
deleted file mode 100644
index 2114942..0000000
--- 
a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.commons.api.format;
-
-/**
- * Available formats to be used in various contexts.
- */
-public enum ODataFormat {
-
-  /** JSON format with no metadata. */
-  JSON_NO_METADATA(ContentType.create(ContentType.APPLICATION_JSON, 
"odata.metadata=none")),
-  /** JSON format with minimal metadata (default). */
-  JSON(ContentType.create(ContentType.APPLICATION_JSON, 
"odata.metadata=minimal")),
-  /** JSON format with full metadata. */
-  JSON_FULL_METADATA(ContentType.create(ContentType.APPLICATION_JSON, 
"odata.metadata=full")),
-
-  /** XML format. */
-  XML(ContentType.APPLICATION_XML),
-  /** Atom format. */
-  ATOM(ContentType.APPLICATION_ATOM_XML),
-
-  // media formats
-  APPLICATION_XML(ContentType.APPLICATION_XML),
-  APPLICATION_ATOM_XML(ContentType.APPLICATION_ATOM_XML),
-  APPLICATION_XHTML_XML(ContentType.APPLICATION_XHTML_XML),
-  APPLICATION_SVG_XML(ContentType.APPLICATION_SVG_XML),
-  APPLICATION_JSON(ContentType.APPLICATION_JSON),
-  APPLICATION_FORM_URLENCODED(ContentType.APPLICATION_FORM_URLENCODED),
-  MULTIPART_FORM_DATA(ContentType.MULTIPART_FORM_DATA),
-  APPLICATION_OCTET_STREAM(ContentType.APPLICATION_OCTET_STREAM),
-  TEXT_PLAIN(ContentType.TEXT_PLAIN),
-  TEXT_XML(ContentType.TEXT_XML),
-  TEXT_HTML(ContentType.TEXT_HTML);
-
-  private final ContentType contentType;
-
-  ODataFormat(final ContentType contentType) {
-    this.contentType = contentType;
-  }
-
-  /**
-   * Gets format as {@link ContentType}.
-   * @return format as ContentType.
-   */
-  public ContentType getContentType() {
-    return contentType;
-  }
-
-  @Override
-  public String toString() {
-    if (contentType == null) {
-      throw new UnsupportedOperationException();
-    } else {
-      return contentType.toContentTypeString();
-    }
-  }
-
-  /**
-   * Gets OData format from a content type.
-   *
-   * @param contentType content type
-   * @return OData format.
-   */
-  public static ODataFormat fromContentType(final ContentType contentType) {
-    if (contentType == null) {
-      return null;
-    }
-
-    if (contentType.isCompatible(ContentType.APPLICATION_ATOM_XML)
-        || contentType.isCompatible(ContentType.APPLICATION_ATOM_SVC)) {
-      return ATOM;
-    } else if (contentType.isCompatible(ContentType.APPLICATION_XML)) {
-      return XML;
-    } else if (contentType.isCompatible(ContentType.APPLICATION_JSON)) {
-      String jsonVariant = contentType.getParameters().get("odata.metadata");
-      if (jsonVariant != null) {
-        if ("none".equals(jsonVariant)) {
-          return JSON_NO_METADATA;
-        } else if ("minimal".equals(jsonVariant)) {
-          return ODataFormat.JSON;
-        } else if ("full".equals(jsonVariant)) {
-          return ODataFormat.JSON_FULL_METADATA;
-        }
-      }
-      return JSON;
-    } else if (contentType.isCompatible(ContentType.APPLICATION_OCTET_STREAM)) 
{
-      return APPLICATION_OCTET_STREAM;
-    } else if (contentType.isCompatible(ContentType.TEXT_PLAIN)) {
-      return TEXT_PLAIN;
-    } else if (contentType.isCompatible(ContentType.APPLICATION_XHTML_XML)) {
-      return APPLICATION_XHTML_XML;
-    } else if (contentType.isCompatible(ContentType.APPLICATION_SVG_XML)) {
-      return APPLICATION_SVG_XML;
-    } else if 
(contentType.isCompatible(ContentType.APPLICATION_FORM_URLENCODED)) {
-      return APPLICATION_FORM_URLENCODED;
-    } else if (contentType.isCompatible(ContentType.MULTIPART_FORM_DATA)) {
-      return MULTIPART_FORM_DATA;
-    } else if (contentType.isCompatible(ContentType.TEXT_XML)) {
-      return TEXT_XML;
-    } else if (contentType.isCompatible(ContentType.TEXT_HTML)) {
-      return TEXT_HTML;
-    }
-
-    throw new IllegalArgumentException("Unsupported content Type: " + 
contentType);
-  }
-
-  public static ODataFormat fromString(final String contentType) {
-    return contentType == null ? null : 
fromContentType(ContentType.parse(contentType));
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/AcceptTypeTest.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/AcceptTypeTest.java
 
b/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/AcceptTypeTest.java
index a6248f3..47cfc3f 100644
--- 
a/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/AcceptTypeTest.java
+++ 
b/lib/commons-api/src/test/java/org/apache/olingo/commons/api/format/AcceptTypeTest.java
@@ -18,15 +18,13 @@
  */
 package org.apache.olingo.commons.api.format;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 import java.util.List;
 
 import org.junit.Test;
 
+
 public class AcceptTypeTest {
 
   @Test

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java
index ddb789d..9117ade 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java
@@ -29,7 +29,7 @@ import org.apache.olingo.commons.api.data.Operation;
 import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.commons.core.edm.EdmTypeInfo;
 
 import com.fasterxml.jackson.core.JsonGenerator;
@@ -43,8 +43,8 @@ public class JsonEntitySerializer extends JsonSerializer {
     super(serverMode);
   }
 
-  public JsonEntitySerializer(final boolean serverMode, final ODataFormat 
format) {
-    super(serverMode, format);
+  public JsonEntitySerializer(final boolean serverMode, final ContentType 
contentType) {
+    super(serverMode, contentType);
   }
 
   protected void doSerialize(final Entity entity, final JsonGenerator jgen)
@@ -73,12 +73,12 @@ public class JsonEntitySerializer extends JsonSerializer {
       }
     }
 
-    if (StringUtils.isNotBlank(entity.getType()) && format != 
ODataFormat.JSON_NO_METADATA) {
+    if (StringUtils.isNotBlank(entity.getType()) && contentType != 
ContentType.JSON_NO_METADATA) {
       jgen.writeStringField(Constants.JSON_TYPE,
           new 
EdmTypeInfo.Builder().setTypeExpression(entity.getType()).build().external());
     }
 
-    if (entity.getId() != null && format != ODataFormat.JSON_NO_METADATA) {
+    if (entity.getId() != null && contentType != ContentType.JSON_NO_METADATA) 
{
       jgen.writeStringField(Constants.JSON_ID, entity.getId().toASCIIString());
     }
 
@@ -100,7 +100,7 @@ public class JsonEntitySerializer extends JsonSerializer {
       }
     }
 
-    if (format != ODataFormat.JSON_NO_METADATA) {
+    if (contentType != ContentType.JSON_NO_METADATA) {
       links(entity, jgen);
     }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java
index 92ce269..1cc7e1a 100755
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java
@@ -43,7 +43,7 @@ import org.apache.olingo.commons.api.data.ValueType;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.commons.api.serialization.ODataSerializer;
 import org.apache.olingo.commons.api.serialization.ODataSerializerException;
 import org.apache.olingo.commons.core.edm.EdmTypeInfo;
@@ -65,15 +65,15 @@ public class JsonSerializer implements ODataSerializer {
 
   protected boolean serverMode;
 
-  protected ODataFormat format;
+  protected ContentType contentType;
 
   public JsonSerializer(final boolean serverMode) {
-    this(serverMode, ODataFormat.JSON_FULL_METADATA);
+    this(serverMode, ContentType.JSON_FULL_METADATA);
   }
 
-  public JsonSerializer(final boolean serverMode, final ODataFormat format) {
+  public JsonSerializer(final boolean serverMode, final ContentType 
contentType) {
     this.serverMode = serverMode;
-    this.format = format;
+    this.contentType = contentType;
   }
 
   @Override
@@ -83,7 +83,7 @@ public class JsonSerializer implements ODataSerializer {
       if (obj instanceof EntityCollection) {
         new JsonEntitySetSerializer(serverMode).doSerialize((EntityCollection) 
obj, json);
       } else if (obj instanceof Entity) {
-        new JsonEntitySerializer(serverMode, format).doSerialize((Entity) obj, 
json);
+        new JsonEntitySerializer(serverMode, contentType).doSerialize((Entity) 
obj, json);
       } else if (obj instanceof Property) {
         new JsonPropertySerializer(serverMode).doSerialize((Property) obj, 
json);
       } else if (obj instanceof Link) {
@@ -312,7 +312,7 @@ public class JsonSerializer implements ODataSerializer {
           throws IOException, EdmPrimitiveTypeException {
     jgen.writeStartObject();
 
-    if (typeInfo != null && format != ODataFormat.JSON_NO_METADATA) {
+    if (typeInfo != null && contentType != ContentType.JSON_NO_METADATA) {
       jgen.writeStringField(Constants.JSON_TYPE, typeInfo.external());
     }
 
@@ -359,7 +359,7 @@ public class JsonSerializer implements ODataSerializer {
           valuable.isPrimitive()) || valuable.isNull()) {
         type = EdmPrimitiveTypeKind.String.getFullQualifiedName().toString();
       }
-      if (StringUtils.isNotBlank(type) && format != 
ODataFormat.JSON_NO_METADATA) {
+      if (StringUtils.isNotBlank(type) && contentType != 
ContentType.JSON_NO_METADATA) {
         jgen.writeFieldName(
             name + StringUtils.prependIfMissing(Constants.JSON_TYPE, "@"));
         jgen.writeString(new 
EdmTypeInfo.Builder().setTypeExpression(type).build().external());

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
----------------------------------------------------------------------
diff --git 
a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java 
b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
index 8599982..1ed12d2 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
@@ -119,7 +119,7 @@ public abstract class OData {
    * Creates a new deserializer object for reading content in the specified 
format.
    * Deserializer are used in Processor implementations.
    *
-   * @param format any content type supported by Olingo (XML, JSON ...)
+   * @param contentType any content type supported by Olingo (XML, JSON ...)
    */
   public abstract ODataDeserializer createDeserializer(ContentType 
contentType) throws DeserializerException;
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java
----------------------------------------------------------------------
diff --git 
a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java
 
b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java
index 6584262..ad27ced 100644
--- 
a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java
+++ 
b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java
@@ -21,7 +21,6 @@ package org.apache.olingo.server.core;
 import java.io.ByteArrayInputStream;
 
 import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
 import org.apache.olingo.commons.api.http.HttpHeader;
 import org.apache.olingo.commons.api.http.HttpStatusCode;
 import org.apache.olingo.server.api.OData;
@@ -96,9 +95,9 @@ public class ErrorHandler {
       requestedContentType = 
ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
           request, this.customContent, RepresentationType.ERROR);
     } catch (final ContentNegotiatorException e) {
-      requestedContentType = ODataFormat.JSON.getContentType();
+      requestedContentType = ContentType.JSON;
     } catch (UriParserException e) {
-      requestedContentType = ODataFormat.JSON.getContentType();
+      requestedContentType = ContentType.JSON;
     }
     processError(response, serverError, requestedContentType);
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceRequest.java
----------------------------------------------------------------------
diff --git 
a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceRequest.java
 
b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceRequest.java
index c0428d4..26895de 100644
--- 
a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceRequest.java
+++ 
b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceRequest.java
@@ -28,7 +28,7 @@ import java.util.StringTokenizer;
 
 import org.apache.olingo.commons.api.data.ContextURL;
 import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.Format;
 import org.apache.olingo.commons.api.http.HttpHeader;
 import org.apache.olingo.commons.api.http.HttpMethod;
 import org.apache.olingo.server.api.OData;
@@ -143,16 +143,16 @@ public abstract class ServiceRequest {
   @SuppressWarnings("unchecked")
   public <T> T getSerializerOptions(Class<T> serilizerOptions, ContextURL 
contextUrl,
       boolean references) throws ContentNegotiatorException {
-    final ODataFormat format = 
ODataFormat.fromContentType(getResponseContentType());
+    final Format format = getResponseContentType().getODataFormat();
 
     if (serilizerOptions.isAssignableFrom(EntitySerializerOptions.class)) {
       return (T) EntitySerializerOptions.with()
-          .contextURL(format == ODataFormat.JSON_NO_METADATA ? null : 
contextUrl)
+          .contextURL(format == Format.JSON_NO_METADATA ? null : contextUrl)
           
.expand(uriInfo.getExpandOption()).select(this.uriInfo.getSelectOption())
           .setWriteOnlyReferences(references).build();
     } else if 
(serilizerOptions.isAssignableFrom(EntityCollectionSerializerOptions.class)) {
       return (T) EntityCollectionSerializerOptions.with()
-          .contextURL(format == ODataFormat.JSON_NO_METADATA ? null : 
contextUrl)
+          .contextURL(format == Format.JSON_NO_METADATA ? null : contextUrl)
           .count(uriInfo.getCountOption()).expand(uriInfo.getExpandOption())
           
.select(uriInfo.getSelectOption()).setWriteOnlyReferences(references).build();
     } else if 
(serilizerOptions.isAssignableFrom(ComplexSerializerOptions.class)) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinDataModel.java
----------------------------------------------------------------------
diff --git 
a/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinDataModel.java
 
b/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinDataModel.java
index b37c2ae..646e835 100644
--- 
a/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinDataModel.java
+++ 
b/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinDataModel.java
@@ -45,7 +45,7 @@ import org.apache.olingo.commons.api.edm.EdmProperty;
 import org.apache.olingo.commons.api.edm.EdmType;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.server.api.ODataApplicationException;
 import org.apache.olingo.server.api.ServiceMetadata;
 import org.apache.olingo.server.api.deserializer.DeserializerException;
@@ -116,7 +116,7 @@ public class TripPinDataModel {
 
   private EntityCollection loadEnities(String entitySetName, EdmEntityType 
type) {
     try {
-      ODataJsonDeserializer deserializer = new 
ODataJsonDeserializer(ODataFormat.JSON.getContentType());
+      ODataJsonDeserializer deserializer = new 
ODataJsonDeserializer(ContentType.JSON);
 
       EntityCollection set = deserializer.entityCollection(new 
FileInputStream(new File(
           "src/test/resources/" + entitySetName.toLowerCase() + ".json")), 
type).getEntityCollection();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java
----------------------------------------------------------------------
diff --git 
a/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java
 
b/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java
index db0eef1..f7675d6 100644
--- 
a/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java
+++ 
b/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java
@@ -23,7 +23,7 @@ import java.util.List;
 
 import org.apache.olingo.commons.api.format.AcceptType;
 import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.Format;
 import org.apache.olingo.commons.api.http.HttpHeader;
 import org.apache.olingo.server.api.ODataRequest;
 import org.apache.olingo.server.api.serializer.CustomContentTypeSupport;
@@ -48,9 +48,9 @@ public class ContentNegotiator {
       return Arrays.asList(ContentType.MULTIPART_MIXED);
     default:
       return Arrays.asList(
-          ODataFormat.JSON.getContentType(),
-          ODataFormat.JSON_NO_METADATA.getContentType(),
-          ODataFormat.APPLICATION_JSON.getContentType());
+          ContentType.JSON,
+          ContentType.JSON_NO_METADATA,
+          ContentType.APPLICATION_JSON);
     }
   }
 
@@ -78,14 +78,14 @@ public class ContentNegotiator {
 
     if (formatOption != null && formatOption.getFormat() != null) {
       final String formatString = formatOption.getFormat().trim();
-      final ODataFormat format =
-          ODataFormat.JSON.name().equalsIgnoreCase(formatString) ? 
ODataFormat.JSON :
-              ODataFormat.XML.name().equalsIgnoreCase(formatString) ? 
ODataFormat.XML :
-                  ODataFormat.ATOM.name().equalsIgnoreCase(formatString) ? 
ODataFormat.ATOM : null;
+      final ContentType contentType =
+          Format.JSON.name().equalsIgnoreCase(formatString) ? ContentType.JSON 
:
+            Format.XML.name().equalsIgnoreCase(formatString) ? 
ContentType.APPLICATION_XML :
+              Format.ATOM.name().equalsIgnoreCase(formatString) ? 
ContentType.APPLICATION_ATOM_XML : null;
       try {
         result = getAcceptedType(
-            AcceptType.fromContentType(format == null ?
-                ContentType.create(formatOption.getFormat()) : 
format.getContentType()),
+            AcceptType.fromContentType(contentType == null ?
+                ContentType.create(formatOption.getFormat()) : contentType),
             supportedContentTypes);
       } catch (final IllegalArgumentException e) {
         // Exception results in result = null for next check.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/588df780/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
----------------------------------------------------------------------
diff --git 
a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java 
b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
index b9989f0..47bef3d 100644
--- 
a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
+++ 
b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
@@ -23,7 +23,6 @@ import java.util.List;
 
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
 import org.apache.olingo.commons.api.http.HttpHeader;
 import org.apache.olingo.commons.api.http.HttpMethod;
 import org.apache.olingo.server.api.OData;
@@ -140,7 +139,7 @@ public class ODataHandler {
           uriInfo == null ? null : uriInfo.getFormatOption(), request, 
getCustomContentTypeSupport(),
           RepresentationType.ERROR);
     } catch (final ContentNegotiatorException e) {
-      requestedContentType = ODataFormat.JSON.getContentType();
+      requestedContentType = ContentType.JSON;
     }
     exceptionProcessor.processError(request, response, serverError, 
requestedContentType);
   }

Reply via email to