You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2014/02/18 16:49:42 UTC

[02/12] [OLINGO-170] Moved provider and implementation to server module

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmProviderImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmProviderImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmProviderImplTest.java
new file mode 100644
index 0000000..2c83e56
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmProviderImplTest.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.server.core.edm.provider;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.ODataException;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.edm.provider.AliasInfo;
+import org.apache.olingo.odata4.server.api.edm.provider.ComplexType;
+import org.apache.olingo.odata4.server.api.edm.provider.EdmProvider;
+import org.apache.olingo.odata4.server.api.edm.provider.EntityContainerInfo;
+import org.apache.olingo.odata4.server.api.edm.provider.EntityType;
+import org.apache.olingo.odata4.server.api.edm.provider.EnumType;
+import org.apache.olingo.odata4.server.api.edm.provider.PropertyRef;
+import org.apache.olingo.odata4.server.api.edm.provider.TypeDefinition;
+import org.junit.Before;
+import org.junit.Test;
+
+public class EdmProviderImplTest {
+
+  private Edm edm;
+  private final FullQualifiedName FQN = new FullQualifiedName("testNamespace", "testName");
+  private final FullQualifiedName WRONG_FQN = new FullQualifiedName("wrong", "wrong");
+
+  @Before
+  public void setup() throws Exception {
+    EdmProvider provider = mock(EdmProvider.class);
+    EntityContainerInfo containerInfo = new EntityContainerInfo().setContainerName(FQN);
+    when(provider.getEntityContainerInfo(FQN)).thenReturn(containerInfo);
+    when(provider.getEntityContainerInfo(null)).thenReturn(containerInfo);
+
+    EnumType enumType = new EnumType().setName(FQN.getName());
+    when(provider.getEnumType(FQN)).thenReturn(enumType);
+
+    TypeDefinition typeDefinition =
+        new TypeDefinition().setName(FQN.getName()).setUnderlyingType(new FullQualifiedName("Edm", "String"));
+    when(provider.getTypeDefinition(FQN)).thenReturn(typeDefinition);
+
+    EntityType entityType = new EntityType().setName(FQN.getName()).setKey(new ArrayList<PropertyRef>());
+    when(provider.getEntityType(FQN)).thenReturn(entityType);
+
+    ComplexType complexType = new ComplexType().setName(FQN.getName());
+    when(provider.getComplexType(FQN)).thenReturn(complexType);
+
+    List<AliasInfo> aliasInfos = new ArrayList<AliasInfo>();
+    aliasInfos.add(new AliasInfo().setAlias("alias").setNamespace("namespace"));
+    when(provider.getAliasInfos()).thenReturn(aliasInfos);
+
+    edm = new EdmProviderImpl(provider);
+  }
+
+  @Test
+  public void nothingSpecifiedMustNotResultInExceptions() throws Exception {
+    EdmProvider localProvider = mock(EdmProvider.class);
+    when(localProvider.getActions(FQN)).thenReturn(null);
+    when(localProvider.getFunctions(FQN)).thenReturn(null);
+    Edm localEdm = new EdmProviderImpl(localProvider);
+    localEdm.getAction(FQN, null, null);
+    localEdm.getFunction(FQN, null, null, null);
+    localEdm.getAction(FQN, FQN, true);
+    localEdm.getFunction(FQN, FQN, true, null);
+    localEdm.getComplexType(FQN);
+    localEdm.getEntityContainer(FQN);
+    localEdm.getEntityType(FQN);
+    localEdm.getEnumType(FQN);
+    localEdm.getTypeDefinition(FQN);
+    localEdm.getServiceMetadata();
+  }
+
+  @Test
+  public void convertExceptionsTest() throws Exception {
+    EdmProvider localProvider = mock(EdmProvider.class);
+    FullQualifiedName fqn = new FullQualifiedName("namespace", "name");
+    when(localProvider.getEntityContainerInfo(fqn)).thenThrow(new ODataException("msg"));
+    when(localProvider.getEnumType(fqn)).thenThrow(new ODataException("msg"));
+    when(localProvider.getTypeDefinition(fqn)).thenThrow(new ODataException("msg"));
+    when(localProvider.getEntityType(fqn)).thenThrow(new ODataException("msg"));
+    when(localProvider.getComplexType(fqn)).thenThrow(new ODataException("msg"));
+    when(localProvider.getActions(fqn)).thenThrow(new ODataException("msg"));
+    when(localProvider.getFunctions(fqn)).thenThrow(new ODataException("msg"));
+
+    Edm localEdm = new EdmProviderImpl(localProvider);
+
+    callMethodAndExpectEdmException(localEdm, "getEntityContainer");
+    callMethodAndExpectEdmException(localEdm, "getEnumType");
+    callMethodAndExpectEdmException(localEdm, "getTypeDefinition");
+    callMethodAndExpectEdmException(localEdm, "getEntityType");
+    callMethodAndExpectEdmException(localEdm, "getComplexType");
+
+    // seperate because of signature
+    try {
+      localEdm.getAction(fqn, null, null);
+    } catch (EdmException e) {
+      assertEquals("org.apache.olingo.odata4.commons.api.ODataException: msg", e.getMessage());
+    }
+
+    try {
+      localEdm.getFunction(fqn, null, null, null);
+    } catch (EdmException e) {
+      assertEquals("org.apache.olingo.odata4.commons.api.ODataException: msg", e.getMessage());
+    }
+    try {
+      localEdm.getAction(fqn, fqn, true);
+    } catch (EdmException e) {
+      assertEquals("org.apache.olingo.odata4.commons.api.ODataException: msg", e.getMessage());
+    }
+
+    try {
+      localEdm.getFunction(fqn, fqn, true, null);
+    } catch (EdmException e) {
+      assertEquals("org.apache.olingo.odata4.commons.api.ODataException: msg", e.getMessage());
+    }
+  }
+
+  private void callMethodAndExpectEdmException(final Edm localEdm, final String methodName) throws Exception {
+    Method method = localEdm.getClass().getMethod(methodName, FullQualifiedName.class);
+    try {
+      method.invoke(localEdm, new FullQualifiedName("namespace", "name"));
+    } catch (InvocationTargetException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof EdmException) {
+        return;
+      }
+    }
+    fail("EdmException expected for method: " + methodName);
+  }
+
+  @Test(expected = EdmException.class)
+  public void convertExceptionsAliasTest() throws Exception {
+    EdmProvider localProvider = mock(EdmProvider.class);
+    when(localProvider.getAliasInfos()).thenThrow(new ODataException("msg"));
+
+    Edm localEdm = new EdmProviderImpl(localProvider);
+    localEdm.getEntityContainer(null);
+  }
+
+  @Test
+  public void getEntityContainer() {
+    EdmEntityContainer entityContainer = edm.getEntityContainer(FQN);
+    assertNotNull(entityContainer);
+    assertEquals(FQN.getNamespace(), entityContainer.getNamespace());
+    assertEquals(FQN.getName(), entityContainer.getName());
+
+    entityContainer = edm.getEntityContainer(null);
+    assertNotNull(entityContainer);
+    assertEquals(FQN.getNamespace(), entityContainer.getNamespace());
+    assertEquals(FQN.getName(), entityContainer.getName());
+
+    assertNull(edm.getEntityContainer(WRONG_FQN));
+  }
+
+  @Test
+  public void getEnumType() {
+    EdmEnumType enumType = edm.getEnumType(FQN);
+    assertNotNull(enumType);
+    assertEquals(FQN.getNamespace(), enumType.getNamespace());
+    assertEquals(FQN.getName(), enumType.getName());
+
+    assertNull(edm.getEnumType(WRONG_FQN));
+  }
+
+  @Test
+  public void getTypeDefinition() {
+    EdmTypeDefinition typeDefinition = edm.getTypeDefinition(FQN);
+    assertNotNull(typeDefinition);
+    assertEquals(FQN.getNamespace(), typeDefinition.getNamespace());
+    assertEquals(FQN.getName(), typeDefinition.getName());
+
+    assertNull(edm.getTypeDefinition(WRONG_FQN));
+  }
+
+  @Test
+  public void getEntityType() {
+    EdmEntityType entityType = edm.getEntityType(FQN);
+    assertNotNull(entityType);
+    assertEquals(FQN.getNamespace(), entityType.getNamespace());
+    assertEquals(FQN.getName(), entityType.getName());
+
+    assertNull(edm.getEntityType(WRONG_FQN));
+  }
+
+  @Test
+  public void getComplexType() {
+    EdmComplexType complexType = edm.getComplexType(FQN);
+    assertNotNull(complexType);
+    assertEquals(FQN.getNamespace(), complexType.getNamespace());
+    assertEquals(FQN.getName(), complexType.getName());
+
+    assertNull(edm.getComplexType(WRONG_FQN));
+  }
+
+  @Test
+  public void getServiceMetadata() {
+    assertNotNull(edm.getServiceMetadata());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmReturnTypeImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmReturnTypeImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmReturnTypeImplTest.java
new file mode 100644
index 0000000..2270841
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmReturnTypeImplTest.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.server.core.edm.provider;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.EdmReturnType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.odata4.server.api.edm.provider.ReturnType;
+import org.junit.Test;
+
+public class EdmReturnTypeImplTest {
+
+  @Test
+  public void primitiveReturnType() {
+    ReturnType providerType = new ReturnType().setType(new FullQualifiedName("Edm", "String"));
+
+    EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType);
+
+    assertEquals(EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance(), typeImpl.getType());
+    assertFalse(typeImpl.isCollection());
+
+    assertNull(typeImpl.getPrecision());
+    assertNull(typeImpl.getMaxLength());
+    assertNull(typeImpl.getScale());
+    assertNull(typeImpl.isNullable());
+  }
+
+  @Test
+  public void primitiveCollectionReturnType() {
+    ReturnType providerType = new ReturnType().setType(new FullQualifiedName("Edm", "String")).setCollection(true);
+
+    EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType);
+
+    assertEquals(EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance(), typeImpl.getType());
+    assertTrue(typeImpl.isCollection());
+  }
+
+  @Test(expected = EdmException.class)
+  public void invalidPrimitiveType() {
+    ReturnType providerType = new ReturnType().setType(new FullQualifiedName("Edm", "wrong")).setCollection(true);
+    EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType);
+    typeImpl.getType();
+  }
+
+  @Test
+  public void complexType() {
+    EdmProviderImpl mock = mock(EdmProviderImpl.class);
+    FullQualifiedName baseType = new FullQualifiedName("namespace", "type");
+    EdmComplexType edmType = mock(EdmComplexType.class);
+    when(mock.getComplexType(baseType)).thenReturn(edmType);
+    ReturnType providerType = new ReturnType().setType(baseType);
+    EdmReturnType typeImpl = new EdmReturnTypeImpl(mock, providerType);
+    EdmType returnedType = typeImpl.getType();
+    assertEquals(edmType, returnedType);
+  }
+
+  @Test
+  public void entityType() {
+    EdmProviderImpl mock = mock(EdmProviderImpl.class);
+    FullQualifiedName baseType = new FullQualifiedName("namespace", "type");
+    EdmEntityType edmType = mock(EdmEntityType.class);
+    when(mock.getEntityType(baseType)).thenReturn(edmType);
+    ReturnType providerType = new ReturnType().setType(baseType);
+    EdmReturnType typeImpl = new EdmReturnTypeImpl(mock, providerType);
+    EdmType returnedType = typeImpl.getType();
+    assertEquals(edmType, returnedType);
+  }
+
+  @Test
+  public void enumType() {
+    EdmProviderImpl mock = mock(EdmProviderImpl.class);
+    FullQualifiedName baseType = new FullQualifiedName("namespace", "type");
+    EdmEnumType edmType = mock(EdmEnumType.class);
+    when(mock.getEnumType(baseType)).thenReturn(edmType);
+    ReturnType providerType = new ReturnType().setType(baseType);
+    EdmReturnType typeImpl = new EdmReturnTypeImpl(mock, providerType);
+    EdmType returnedType = typeImpl.getType();
+    assertEquals(edmType, returnedType);
+  }
+
+  @Test
+  public void typeDefinition() {
+    EdmProviderImpl mock = mock(EdmProviderImpl.class);
+    FullQualifiedName baseType = new FullQualifiedName("namespace", "type");
+    EdmTypeDefinition edmType = mock(EdmTypeDefinition.class);
+    when(mock.getTypeDefinition(baseType)).thenReturn(edmType);
+    ReturnType providerType = new ReturnType().setType(baseType);
+    EdmReturnType typeImpl = new EdmReturnTypeImpl(mock, providerType);
+    EdmType returnedType = typeImpl.getType();
+    assertEquals(edmType, returnedType);
+  }
+
+  @Test(expected = EdmException.class)
+  public void invalidType() {
+    ReturnType providerType = new ReturnType().setType(new FullQualifiedName("wrong", "wrong"));
+    EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType);
+    typeImpl.getType();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmServiceMetadataImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmServiceMetadataImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmServiceMetadataImplTest.java
new file mode 100644
index 0000000..f48f08a
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmServiceMetadataImplTest.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.server.core.edm.provider;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.ODataException;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntitySetInfo;
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImportInfo;
+import org.apache.olingo.odata4.commons.api.edm.EdmServiceMetadata;
+import org.apache.olingo.odata4.commons.api.edm.EdmSingletonInfo;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.odata4.server.api.edm.provider.EdmProvider;
+import org.apache.olingo.odata4.server.api.edm.provider.EntityContainer;
+import org.apache.olingo.odata4.server.api.edm.provider.EntitySet;
+import org.apache.olingo.odata4.server.api.edm.provider.FunctionImport;
+import org.apache.olingo.odata4.server.api.edm.provider.Schema;
+import org.apache.olingo.odata4.server.api.edm.provider.Singleton;
+import org.junit.Test;
+
+public class EdmServiceMetadataImplTest {
+
+  @Test
+  public void allGettersMustDeliver() {
+    EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImpl(new CustomProvider(true));
+    List<EdmEntitySetInfo> entitySetInfos = serviceMetadata.getEntitySetInfos();
+    assertNotNull(entitySetInfos);
+    assertEquals(2, entitySetInfos.size());
+
+    List<EdmSingletonInfo> singletonInfos = serviceMetadata.getSingletonInfos();
+    assertNotNull(singletonInfos);
+    assertEquals(2, singletonInfos.size());
+
+    List<EdmFunctionImportInfo> functionImportInfos = serviceMetadata.getFunctionImportInfos();
+    assertNotNull(functionImportInfos);
+    assertEquals(2, functionImportInfos.size());
+
+    // Cache test
+    assertTrue(entitySetInfos == serviceMetadata.getEntitySetInfos());
+    assertTrue(singletonInfos == serviceMetadata.getSingletonInfos());
+    assertTrue(functionImportInfos == serviceMetadata.getFunctionImportInfos());
+  }
+
+  @Test(expected = RuntimeException.class)
+  public void getMetadataAsInputStreamIsNotImplemented() {
+    EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImpl(new CustomProvider(true));
+    serviceMetadata.getMetadata();
+  }
+
+  @Test
+  public void initialProvider() {
+    EdmProvider provider = new EdmProvider() {};
+    EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImpl(provider);
+    assertEquals(ODataServiceVersion.V40, serviceMetadata.getDataServiceVersion());
+  }
+
+  @Test(expected = EdmException.class)
+  public void initialProviderEntitySetInfo() {
+    EdmProvider provider = new EdmProvider() {};
+    EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImpl(provider);
+    serviceMetadata.getEntitySetInfos();
+  }
+
+  @Test(expected = EdmException.class)
+  public void initialProviderSingletonInfo() {
+    EdmProvider provider = new EdmProvider() {};
+    EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImpl(provider);
+    serviceMetadata.getSingletonInfos();
+  }
+
+  @Test(expected = EdmException.class)
+  public void initialProviderFunctionImportInfo() {
+    EdmProvider provider = new EdmProvider() {};
+    EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImpl(provider);
+    serviceMetadata.getFunctionImportInfos();
+  }
+
+  @Test
+  public void emptySchemaMustNotResultInException() {
+    EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImpl(new CustomProvider(false));
+    assertNotNull(serviceMetadata.getEntitySetInfos());
+    assertEquals(0, serviceMetadata.getEntitySetInfos().size());
+
+    assertNotNull(serviceMetadata.getSingletonInfos());
+    assertEquals(0, serviceMetadata.getSingletonInfos().size());
+
+    assertNotNull(serviceMetadata.getFunctionImportInfos());
+    assertEquals(0, serviceMetadata.getFunctionImportInfos().size());
+  }
+
+  @Test
+  public void oDataExceptionsGetCaughtAndTransformed() {
+    EdmProvider provider = new EdmProvider() {
+      @Override
+      public List<Schema> getSchemas() throws ODataException {
+        throw new ODataException("msg");
+      }
+    };
+
+    EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImpl(provider);
+    callGetEntitySetInfosAndExpectException(serviceMetadata);
+    callGetSingletonInfosAndExpectException(serviceMetadata);
+    callGetFunctionImportInfosAndExpectException(serviceMetadata);
+  }
+
+  private void callGetFunctionImportInfosAndExpectException(final EdmServiceMetadata svc) {
+    try {
+      svc.getFunctionImportInfos();
+    } catch (EdmException e) {
+      assertEquals("org.apache.olingo.odata4.commons.api.ODataException: msg", e.getMessage());
+      return;
+    }
+    fail("Expected EdmException was not thrown");
+
+  }
+
+  private void callGetSingletonInfosAndExpectException(final EdmServiceMetadata svc) {
+    try {
+      svc.getSingletonInfos();
+    } catch (EdmException e) {
+      assertEquals("org.apache.olingo.odata4.commons.api.ODataException: msg", e.getMessage());
+      return;
+    }
+    fail("Expected EdmException was not thrown");
+  }
+
+  private void callGetEntitySetInfosAndExpectException(final EdmServiceMetadata svc) {
+    try {
+      svc.getEntitySetInfos();
+    } catch (EdmException e) {
+      assertEquals("org.apache.olingo.odata4.commons.api.ODataException: msg", e.getMessage());
+      return;
+    }
+    fail("Expected EdmException was not thrown");
+  }
+
+  private class CustomProvider extends EdmProvider {
+    private List<Schema> schemas;
+
+    public CustomProvider(final boolean fillSchema) {
+      schemas = new ArrayList<Schema>();
+      if (fillSchema) {
+        List<EntitySet> entitySets = new ArrayList<EntitySet>();
+        entitySets.add(new EntitySet().setName("1"));
+        entitySets.add(new EntitySet().setName("2"));
+        List<Singleton> singletons = new ArrayList<Singleton>();
+        singletons.add(new Singleton().setName("1"));
+        singletons.add(new Singleton().setName("2"));
+        List<FunctionImport> functionImports = new ArrayList<FunctionImport>();
+        functionImports.add(new FunctionImport().setName("1"));
+        functionImports.add(new FunctionImport().setName("2"));
+        EntityContainer entityContainer =
+            new EntityContainer().setName("cont").setEntitySets(entitySets).setSingletons(singletons)
+                .setFunctionImports(functionImports);
+        Schema schema = new Schema().setEntityContainer(entityContainer);
+        schemas.add(schema);
+      }
+    }
+
+    @Override
+    public List<Schema> getSchemas() throws ODataException {
+      return schemas;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmSingletonImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmSingletonImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmSingletonImplTest.java
new file mode 100644
index 0000000..d7f1932
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmSingletonImplTest.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.server.core.edm.provider;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.Arrays;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmBindingTarget;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.edm.provider.EdmProvider;
+import org.apache.olingo.odata4.server.api.edm.provider.EntityContainerInfo;
+import org.apache.olingo.odata4.server.api.edm.provider.EntityType;
+import org.apache.olingo.odata4.server.api.edm.provider.NavigationPropertyBinding;
+import org.apache.olingo.odata4.server.api.edm.provider.PropertyRef;
+import org.apache.olingo.odata4.server.api.edm.provider.Singleton;
+import org.apache.olingo.odata4.server.api.edm.provider.Target;
+import org.junit.Test;
+
+public class EdmSingletonImplTest {
+
+  @Test
+  public void singleton() throws Exception {
+    EdmProvider provider = mock(EdmProvider.class);
+    EdmProviderImpl edm = new EdmProviderImpl(provider);
+
+    final FullQualifiedName typeName = new FullQualifiedName("ns", "entityType");
+    final EntityType entityTypeProvider = new EntityType()
+        .setName(typeName.getName())
+        .setKey(Arrays.asList(new PropertyRef().setPropertyName("Id")));
+    when(provider.getEntityType(typeName)).thenReturn(entityTypeProvider);
+
+    final FullQualifiedName containerName = new FullQualifiedName("ns", "container");
+    final EntityContainerInfo containerInfo = new EntityContainerInfo().setContainerName(containerName);
+    when(provider.getEntityContainerInfo(containerName)).thenReturn(containerInfo);
+    final EdmEntityContainer entityContainer = new EdmEntityContainerImpl(edm, provider, containerInfo);
+
+    final String singletonName = "singleton";
+    final Singleton singletonProvider = new Singleton()
+        .setName(singletonName)
+        .setType(typeName)
+        .setNavigationPropertyBindings(Arrays.asList(
+            new NavigationPropertyBinding().setPath("path")
+                .setTarget(new Target().setEntityContainer(containerName).setTargetName(singletonName))));
+    when(provider.getSingleton(containerName, singletonName)).thenReturn(singletonProvider);
+
+    final EdmSingleton singleton = new EdmSingletonImpl(edm, entityContainer, singletonProvider);
+    assertEquals(singletonName, entityContainer.getSingleton(singletonName).getName());
+    assertEquals(singletonName, singleton.getName());
+    final EdmEntityType entityType = singleton.getEntityType();
+    assertEquals(typeName.getNamespace(), entityType.getNamespace());
+    assertEquals(typeName.getName(), entityType.getName());
+    assertEquals(entityContainer, singleton.getEntityContainer());
+    assertNull(singleton.getRelatedBindingTarget(null));
+    final EdmBindingTarget target = singleton.getRelatedBindingTarget("path");
+    assertEquals(singletonName, target.getName());
+  }
+
+  @Test(expected = EdmException.class)
+  public void wrongTarget() throws Exception {
+    EdmProvider provider = mock(EdmProvider.class);
+    EdmProviderImpl edm = new EdmProviderImpl(provider);
+
+    final FullQualifiedName containerName = new FullQualifiedName("ns", "container");
+    final EntityContainerInfo containerInfo = new EntityContainerInfo().setContainerName(containerName);
+    when(provider.getEntityContainerInfo(containerName)).thenReturn(containerInfo);
+
+    final String singletonName = "singleton";
+    final Singleton singletonProvider = new Singleton()
+        .setNavigationPropertyBindings(Arrays.asList(
+            new NavigationPropertyBinding().setPath("path")
+                .setTarget(new Target().setEntityContainer(containerName).setTargetName("wrong"))));
+    when(provider.getSingleton(containerName, singletonName)).thenReturn(singletonProvider);
+
+    final EdmSingleton singleton = new EdmSingletonImpl(edm, null, singletonProvider);
+    singleton.getRelatedBindingTarget("path");
+  }
+
+  @Test(expected = EdmException.class)
+  public void wrongTargetContainer() throws Exception {
+    EdmProvider provider = mock(EdmProvider.class);
+    EdmProviderImpl edm = new EdmProviderImpl(provider);
+
+    final FullQualifiedName containerName = new FullQualifiedName("ns", "container");
+    final String singletonName = "singleton";
+    final Singleton singletonProvider = new Singleton()
+        .setNavigationPropertyBindings(Arrays.asList(
+            new NavigationPropertyBinding().setPath("path")
+                .setTarget(new Target().setEntityContainer(new FullQualifiedName("ns", "wrongContainer"))
+                    .setTargetName(singletonName))));
+    when(provider.getSingleton(containerName, singletonName)).thenReturn(singletonProvider);
+
+    final EdmSingleton singleton = new EdmSingletonImpl(edm, null, singletonProvider);
+    singleton.getRelatedBindingTarget("path");
+  }
+
+  @Test(expected = EdmException.class)
+  public void nonExsistingEntityType() throws Exception {
+    EdmProvider provider = mock(EdmProvider.class);
+    EdmProviderImpl edm = new EdmProviderImpl(provider);
+
+    Singleton singleton = new Singleton().setName("name");
+    final EdmSingleton edmSingleton = new EdmSingletonImpl(edm, null, singleton);
+    edmSingleton.getEntityType();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmSingletonInfoImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmSingletonInfoImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmSingletonInfoImplTest.java
new file mode 100644
index 0000000..93b97cd
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmSingletonInfoImplTest.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.server.core.edm.provider;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.EdmSingletonInfo;
+import org.apache.olingo.odata4.server.api.edm.provider.EntityContainer;
+import org.apache.olingo.odata4.server.api.edm.provider.Singleton;
+import org.junit.Test;
+
+public class EdmSingletonInfoImplTest {
+
+  @Test
+  public void singletonTest() {
+    Singleton providerSingleton = new Singleton().setName("name");
+    EntityContainer providerContainer = new EntityContainer().setName("container");
+
+    EdmSingletonInfo info = new EdmSingletonInfoImpl(providerContainer, providerSingleton);
+
+    assertEquals("name", info.getSingletonName());
+    assertEquals("container", info.getEntityContainerName());
+  }
+
+  @Test(expected = EdmException.class)
+  public void getUriTest() {
+    Singleton providerSingleton = new Singleton().setName("name");
+    EntityContainer providerContainer = new EntityContainer().setName("container");
+
+    EdmSingletonInfo info = new EdmSingletonInfoImpl(providerContainer, providerSingleton);
+    info.getEntitySetUri();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmTypeDefinitionImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmTypeDefinitionImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmTypeDefinitionImplTest.java
new file mode 100644
index 0000000..8df155a
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmTypeDefinitionImplTest.java
@@ -0,0 +1,74 @@
+package org.apache.olingo.odata4.server.core.edm.provider;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.odata4.server.api.edm.provider.TypeDefinition;
+import org.junit.Test;
+
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+
+public class EdmTypeDefinitionImplTest {
+
+  @Test
+  public void typeDefOnStringNoFacets() throws Exception {
+    FullQualifiedName typeDefName = new FullQualifiedName("namespace", "name");
+    TypeDefinition providerTypeDef =
+        new TypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("Edm", "String"));
+    EdmTypeDefinition typeDefImpl =
+        new EdmTypeDefinitionImpl(mock(EdmProviderImpl.class), typeDefName, providerTypeDef);
+
+    assertEquals("name", typeDefImpl.getName());
+    assertEquals("namespace", typeDefImpl.getNamespace());
+    assertEquals(String.class, typeDefImpl.getDefaultType());
+    assertEquals(EdmTypeKind.DEFINITION, typeDefImpl.getKind());
+    assertEquals(EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance(), typeDefImpl.getUnderlyingType());
+    assertTrue(typeDefImpl.isCompatible(EdmPrimitiveTypeKind.String.getEdmPrimitiveTypeInstance()));
+
+    // String validation
+    assertEquals("'StringValue'", typeDefImpl.toUriLiteral("StringValue"));
+    assertEquals("String''Value", typeDefImpl.fromUriLiteral("'String''''Value'"));
+    assertTrue(typeDefImpl.validate("text", null, null, null, null, null));
+    assertEquals("text", typeDefImpl.valueToString("text", null, null, null, null, null));
+    assertEquals("text", typeDefImpl.valueOfString("text", null, null, null, null, null, String.class));
+
+    // Facets must be initial
+    assertNull(typeDefImpl.getMaxLength());
+    assertNull(typeDefImpl.getPrecision());
+    assertNull(typeDefImpl.getScale());
+    assertNull(typeDefImpl.isUnicode());
+  }
+
+  @Test(expected = EdmException.class)
+  public void invalidTypeResultsInEdmException() throws Exception {
+    FullQualifiedName typeDefName = new FullQualifiedName("namespace", "name");
+    TypeDefinition providerTypeDef =
+        new TypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("wrong", "wrong"));
+    new EdmTypeDefinitionImpl(mock(EdmProviderImpl.class), typeDefName, providerTypeDef);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmTypeImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmTypeImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmTypeImplTest.java
new file mode 100644
index 0000000..d8a04e0
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmTypeImplTest.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.server.core.edm.provider;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
+import org.junit.Test;
+
+public class EdmTypeImplTest {
+
+  @Test
+  public void getterTest() {
+    EdmType type = new EdmTypeImplTester(new FullQualifiedName("namespace", "name"), EdmTypeKind.UNDEFINED);
+    assertEquals("name", type.getName());
+    assertEquals("namespace", type.getNamespace());
+    assertEquals(EdmTypeKind.UNDEFINED, type.getKind());
+  }
+
+  private class EdmTypeImplTester extends EdmTypeImpl {
+    public EdmTypeImplTester(final FullQualifiedName name, final EdmTypeKind kind) {
+      super(null, name, kind);
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/PrimitiveTypeBaseTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/PrimitiveTypeBaseTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/PrimitiveTypeBaseTest.java
new file mode 100644
index 0000000..b5a1853
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/PrimitiveTypeBaseTest.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.server.core.edm.provider;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.odata4.commons.api.edm.EdmPrimitiveTypeException;
+
+public abstract class PrimitiveTypeBaseTest {
+
+  private void expectErrorInValueToString(final EdmPrimitiveType instance,
+      final Object value, final Boolean isNullable, final Integer maxLength,
+      final Integer precision, final Integer scale, final Boolean isUnicode,
+      final String messageReferenceString) {
+    try {
+      instance.valueToString(value, isNullable, maxLength, precision, scale, isUnicode);
+      fail("Expected exception not thrown");
+    } catch (final EdmPrimitiveTypeException e) {
+      assertNotNull(e.getLocalizedMessage());
+      assertTrue(e.getLocalizedMessage().startsWith(messageReferenceString));
+    }
+  }
+
+  private void expectErrorInValueToString(final EdmPrimitiveType instance, final Object value,
+      final String messageReference) {
+    expectErrorInValueToString(instance, value, null, null, null, null, null, messageReference);
+  }
+
+  protected void expectTypeErrorInValueToString(final EdmPrimitiveType instance, final Object value) {
+    expectErrorInValueToString(instance, value, "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED");
+  }
+
+  protected void expectContentErrorInValueToString(final EdmPrimitiveType instance, final Object value) {
+    expectErrorInValueToString(instance, value, "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT");
+  }
+
+  protected void expectFacetsErrorInValueToString(final EdmPrimitiveType instance, final Object value,
+      final Boolean isNullable, final Integer maxLength, final Integer precision,
+      final Integer scale, final Boolean isUnicode) {
+    expectErrorInValueToString(instance, value, isNullable, maxLength, precision, scale, isUnicode,
+        "EdmPrimitiveTypeException.VALUE_FACETS_NOT_MATCHED");
+  }
+
+  protected void expectNullErrorInValueToString(final EdmPrimitiveType instance) {
+    expectErrorInValueToString(instance, null, false, null, null, null, null,
+        "EdmPrimitiveTypeException.VALUE_NULL_NOT_ALLOWED");
+  }
+
+  private void expectErrorInValueOfString(final EdmPrimitiveType instance,
+      final String value, final Boolean isNullable, final Integer maxLength, final Integer precision,
+      final Integer scale, final Boolean isUnicode, final Class<?> returnType, final String messageReferenceString) {
+    try {
+      instance.valueOfString(value, isNullable, maxLength, precision, scale, isUnicode, returnType);
+      fail("Expected exception not thrown");
+    } catch (final EdmPrimitiveTypeException e) {
+      assertNotNull(e.getLocalizedMessage());
+      assertTrue(e.getLocalizedMessage().startsWith(messageReferenceString));
+    }
+  }
+
+  protected void expectTypeErrorInValueOfString(final EdmPrimitiveType instance, final String value) {
+    expectErrorInValueOfString(instance, value, null, null, null, null, null, Class.class,
+        "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED");
+  }
+
+  protected void expectUnconvertibleErrorInValueOfString(final EdmPrimitiveType instance, final String value,
+      final Class<?> type) {
+    expectErrorInValueOfString(instance, value, null, null, null, null, null, type,
+        "EdmPrimitiveTypeException.LITERAL_UNCONVERTIBLE_TO_VALUE_TYPE");
+  }
+
+  protected void expectContentErrorInValueOfString(final EdmPrimitiveType instance, final String value) {
+    expectErrorInValueOfString(instance, value, null, null, null, null, null, instance.getDefaultType(),
+        "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT");
+  }
+
+  protected void expectFacetsErrorInValueOfString(final EdmPrimitiveType instance, final String value,
+      final Boolean isNullable, final Integer maxLength, final Integer precision,
+      final Integer scale, final Boolean isUnicode) {
+    expectErrorInValueOfString(instance, value, isNullable, maxLength, precision, scale, isUnicode,
+        instance.getDefaultType(), "EdmPrimitiveTypeException.LITERAL_FACETS_NOT_MATCHED");
+  }
+
+  protected void expectNullErrorInValueOfString(final EdmPrimitiveType instance) {
+    expectErrorInValueOfString(instance, null, false, null, null, null, null, instance.getDefaultType(),
+        "EdmPrimitiveTypeException.LITERAL_NULL_NOT_ALLOWED");
+  }
+
+  protected void expectErrorInFromUriLiteral(final EdmPrimitiveType instance, final String value) {
+    try {
+      instance.fromUriLiteral(value);
+      fail("Expected exception not thrown");
+    } catch (final EdmPrimitiveTypeException e) {
+      assertNotNull(e.getLocalizedMessage());
+      assertTrue(e.getLocalizedMessage().startsWith("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT"));
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechProvider.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechProvider.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechProvider.java
index 41e1181..1dfc7d7 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechProvider.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechProvider.java
@@ -22,30 +22,30 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.olingo.odata4.commons.api.edm.provider.Action;
-import org.apache.olingo.odata4.commons.api.edm.provider.ActionImport;
-import org.apache.olingo.odata4.commons.api.edm.provider.AliasInfo;
-import org.apache.olingo.odata4.commons.api.edm.provider.ComplexType;
-import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata4.commons.api.edm.provider.EntityContainerInfo;
-import org.apache.olingo.odata4.commons.api.edm.provider.EntitySet;
-import org.apache.olingo.odata4.commons.api.edm.provider.EntityType;
-import org.apache.olingo.odata4.commons.api.edm.provider.EnumMember;
-import org.apache.olingo.odata4.commons.api.edm.provider.EnumType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.edm.provider.Function;
-import org.apache.olingo.odata4.commons.api.edm.provider.FunctionImport;
-import org.apache.olingo.odata4.commons.api.edm.provider.NavigationProperty;
-import org.apache.olingo.odata4.commons.api.edm.provider.NavigationPropertyBinding;
-import org.apache.olingo.odata4.commons.api.edm.provider.Parameter;
-import org.apache.olingo.odata4.commons.api.edm.provider.Property;
-import org.apache.olingo.odata4.commons.api.edm.provider.PropertyRef;
-import org.apache.olingo.odata4.commons.api.edm.provider.ReferentialConstraint;
-import org.apache.olingo.odata4.commons.api.edm.provider.ReturnType;
-import org.apache.olingo.odata4.commons.api.edm.provider.Singleton;
-import org.apache.olingo.odata4.commons.api.edm.provider.Target;
-import org.apache.olingo.odata4.commons.api.exception.ODataException;
+import org.apache.olingo.odata4.commons.api.ODataException;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.odata4.server.api.edm.provider.Action;
+import org.apache.olingo.odata4.server.api.edm.provider.ActionImport;
+import org.apache.olingo.odata4.server.api.edm.provider.AliasInfo;
+import org.apache.olingo.odata4.server.api.edm.provider.ComplexType;
+import org.apache.olingo.odata4.server.api.edm.provider.EdmProvider;
+import org.apache.olingo.odata4.server.api.edm.provider.EntityContainerInfo;
+import org.apache.olingo.odata4.server.api.edm.provider.EntitySet;
+import org.apache.olingo.odata4.server.api.edm.provider.EntityType;
+import org.apache.olingo.odata4.server.api.edm.provider.EnumMember;
+import org.apache.olingo.odata4.server.api.edm.provider.EnumType;
+import org.apache.olingo.odata4.server.api.edm.provider.Function;
+import org.apache.olingo.odata4.server.api.edm.provider.FunctionImport;
+import org.apache.olingo.odata4.server.api.edm.provider.NavigationProperty;
+import org.apache.olingo.odata4.server.api.edm.provider.NavigationPropertyBinding;
+import org.apache.olingo.odata4.server.api.edm.provider.Parameter;
+import org.apache.olingo.odata4.server.api.edm.provider.Property;
+import org.apache.olingo.odata4.server.api.edm.provider.PropertyRef;
+import org.apache.olingo.odata4.server.api.edm.provider.ReferentialConstraint;
+import org.apache.olingo.odata4.server.api.edm.provider.ReturnType;
+import org.apache.olingo.odata4.server.api.edm.provider.Singleton;
+import org.apache.olingo.odata4.server.api.edm.provider.Target;
 
 public class EdmTechProvider extends EdmProvider {
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechTestProvider.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechTestProvider.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechTestProvider.java
index 803226e..060a275 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechTestProvider.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/EdmTechTestProvider.java
@@ -21,20 +21,19 @@ package org.apache.olingo.odata4.server.core.testutil;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.olingo.odata4.commons.api.edm.provider.ComplexType;
-import org.apache.olingo.odata4.commons.api.edm.provider.EntitySet;
-import org.apache.olingo.odata4.commons.api.edm.provider.EntityType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.edm.provider.Property;
-import org.apache.olingo.odata4.commons.api.edm.provider.PropertyRef;
-import org.apache.olingo.odata4.commons.api.exception.ODataException;
-
+import org.apache.olingo.odata4.commons.api.ODataException;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.edm.provider.ComplexType;
+import org.apache.olingo.odata4.server.api.edm.provider.EntitySet;
+import org.apache.olingo.odata4.server.api.edm.provider.EntityType;
+import org.apache.olingo.odata4.server.api.edm.provider.Property;
+import org.apache.olingo.odata4.server.api.edm.provider.PropertyRef;
 
 /**
  * Implement the EdmTechProvider and
  * <li>adds a entity type <b>ETabc with</b> properties a,b,c,d,e,f</li>
  * <li>adds a complex type <b>CTabc</b> with properties a,b,c,d,e,f</li>
- * <li>adds a <b>abc</b> entity set of type <b>ETabc</b></li> 
+ * <li>adds a <b>abc</b> entity set of type <b>ETabc</b></li>
  */
 public class EdmTechTestProvider extends EdmTechProvider {
 
@@ -44,7 +43,7 @@ public class EdmTechTestProvider extends EdmTechProvider {
   Property propertyDInt16 = new Property().setName("d").setType(nameInt16);
   Property propertyEInt16 = new Property().setName("e").setType(nameInt16);
   Property propertyFInt16 = new Property().setName("f").setType(nameInt16);
-  
+
   public static final FullQualifiedName nameCTabc = new FullQualifiedName(nameSpace, "CTabc");
   public static final FullQualifiedName nameETabc = new FullQualifiedName(nameSpace, "ETabc");
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java
index fce1932..c5a0e29 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java
@@ -22,9 +22,9 @@ package org.apache.olingo.odata4.server.core.testutil;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
 import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
 import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandItem;
 import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
@@ -76,10 +76,10 @@ public class ExpandValidator implements Validator {
         .setUriInfoImplPath(uriInfo);
 
   }
-  
+
   public UriResourceValidator goSelectItemPath(final int index) {
     SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
-    
+
     SelectItem item = select.getSelectItems().get(index);
     UriInfoImpl uriInfo = (UriInfoImpl) item.getResourceInfo();
 
@@ -89,8 +89,6 @@ public class ExpandValidator implements Validator {
         .setUriInfoImplPath(uriInfo);
 
   }
-  
-    
 
   public ExpandValidator goExpand() {
     ExpandValidator val = new ExpandValidator();
@@ -164,24 +162,23 @@ public class ExpandValidator implements Validator {
     assertEquals(text, option.getText());
     return this;
   }
-  
+
   public ExpandValidator isSelectItemStar(final int index) {
     SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
-    
+
     SelectItem item = select.getSelectItems().get(index);
     assertEquals(true, item.isStar());
     return this;
   }
-  
-  public ExpandValidator isSelectItemAllOp(final int index, FullQualifiedName fqn) {
+
+  public ExpandValidator isSelectItemAllOp(final int index, final FullQualifiedName fqn) {
     SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
-    
+
     SelectItem item = select.getSelectItems().get(index);
     assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
     return this;
   }
-  
-  
+
   public ExpandValidator isFilterText(final String text) {
     QueryOptionImpl option = (QueryOptionImpl) expandItem.getFilterOption();
     assertEquals(text, option.getText());

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java
index a7c2158..c0f7ad8 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java
@@ -20,9 +20,9 @@ package org.apache.olingo.odata4.server.core.testutil;
 
 import java.util.List;
 
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
 import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
 import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
 import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
 import org.apache.olingo.odata4.server.api.uri.UriResource;
 import org.apache.olingo.odata4.server.api.uri.UriResourceLambdaAll;
@@ -154,7 +154,8 @@ public class FilterTreeToText implements ExpressionVisitor<String> {
   }
 
   @Override
-  public String visitConstant(SupportedConstants kind) throws ExceptionVisitExpression, ODataApplicationException {
+  public String visitConstant(final SupportedConstants kind)
+      throws ExceptionVisitExpression, ODataApplicationException {
     // TODO Auto-generated method stub
     return "<" + kind.toString() + ">";
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java
index 5a03a17..6d5d2cc 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java
@@ -23,10 +23,10 @@ import static org.junit.Assert.fail;
 
 import java.util.List;
 
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
 import org.apache.olingo.odata4.commons.api.edm.Edm;
 import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.odata4.server.api.uri.UriInfo;
 import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
 import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
@@ -40,7 +40,6 @@ import org.apache.olingo.odata4.server.core.uri.UriParserSemanticException;
 import org.apache.olingo.odata4.server.core.uri.UriParserSyntaxException;
 import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl;
 import org.apache.olingo.odata4.server.core.uri.parser.Parser;
-import org.apache.olingo.odata4.server.core.uri.parser.UriParseTreeVisitor;
 import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.expression.BinaryImpl;
@@ -112,7 +111,7 @@ public class FilterValidator implements Validator {
     String uri = "ESTwoKeyNav?$orderby=" + orderBy.trim();
     return runUriOrderBy(uri);
   }
-  
+
   public FilterValidator runOrderByOnETTwoKeyNavEx(final String orderBy) throws UriParserException {
     String uri = "ESTwoKeyNav?$orderby=" + orderBy.trim();
     return runUriOrderByEx(uri);
@@ -139,7 +138,7 @@ public class FilterValidator implements Validator {
     String uri = "ESKeyNav(1)?$filter=" + filter.trim();
     return runUri(uri);
   }
-  
+
   public FilterValidator runOnETKeyNavEx(final String filter) throws UriParserException {
     String uri = "ESKeyNav(1)?$filter=" + filter.trim();
     return runUriEx(uri);
@@ -200,9 +199,9 @@ public class FilterValidator implements Validator {
     UriInfo uriInfo = null;
 
     try {
-      uriInfo = parser.parseUri(uri,  edm);
+      uriInfo = parser.parseUri(uri, edm);
     } catch (UriParserException e) {
-      this.exception = e;
+      exception = e;
       return this;
     }
 
@@ -228,15 +227,15 @@ public class FilterValidator implements Validator {
     setOrderBy((OrderByOptionImpl) uriInfo.getOrderByOption());
     return this;
   }
-  
+
   public FilterValidator runUriOrderByEx(final String uri) {
     Parser parser = new Parser();
     UriInfo uriInfo = null;
 
     try {
-      uriInfo = parser.parseUri(uri,edm);
+      uriInfo = parser.parseUri(uri, edm);
     } catch (UriParserException e) {
-      this.exception = e;
+      exception = e;
       return this;
     }
 
@@ -248,7 +247,6 @@ public class FilterValidator implements Validator {
     return this;
   }
 
-
   // --- Navigation ---
 
   public Validator goUp() {
@@ -389,7 +387,6 @@ public class FilterValidator implements Validator {
     return this;
   }
 
-  
   public FilterValidator isParameterText(final int parameterIndex, final String parameterText)
       throws ExceptionVisitExpression, ODataApplicationException {
 
@@ -417,12 +414,12 @@ public class FilterValidator implements Validator {
     return this;
   }
 
-  public FilterValidator isTypedLiteral(FullQualifiedName fullName) {
+  public FilterValidator isTypedLiteral(final FullQualifiedName fullName) {
     if (!(curExpression instanceof TypeLiteralImpl)) {
       fail("Current expression not a typeLiteral");
     }
 
-    this.isType(fullName);
+    isType(fullName);
 
     return this;
   }
@@ -458,7 +455,7 @@ public class FilterValidator implements Validator {
     return this;
   }
 
-  public FilterValidator isConstant(SupportedConstants kind) {
+  public FilterValidator isConstant(final SupportedConstants kind) {
     if (!(curExpression instanceof ConstantImpl)) {
       fail("Current expression not a constant");
     }
@@ -468,22 +465,22 @@ public class FilterValidator implements Validator {
     return this;
   }
 
-  public FilterValidator isSortOrder(int index, boolean descending) {
+  public FilterValidator isSortOrder(final int index, final boolean descending) {
     assertEquals(descending, orderBy.getOrders().get(index).isDescending());
     return this;
   }
 
-  public FilterValidator goOrder(int index) {
+  public FilterValidator goOrder(final int index) {
     curExpression = orderBy.getOrders().get(index).getExpression();
     return this;
   }
 
-  public FilterValidator isExSyntax(long errorID) {
+  public FilterValidator isExSyntax(final long errorID) {
     assertEquals(UriParserSyntaxException.class, exception.getClass());
     return this;
   }
 
-  public FilterValidator isExSemantic(long errorID) {
+  public FilterValidator isExSemantic(final long errorID) {
     assertEquals(UriParserSemanticException.class, exception.getClass());
     return this;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserTest.java
index 3526271..a5a7904 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserTest.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserTest.java
@@ -32,20 +32,20 @@ public class ParserTest extends Parser {
   }
 
   @Override
-  protected void addStage2ErrorStategy(UriParserParser parser) {
+  protected void addStage2ErrorStategy(final UriParserParser parser) {
     // Don't throw an at first syntax error, so the error listener will be called
     parser.setErrorHandler(new DefaultErrorStrategy());
   }
 
   @Override
-  protected void addStage1ErrorListener(UriParserParser parser) {
+  protected void addStage1ErrorListener(final UriParserParser parser) {
     // Log error to console
     parser.removeErrorListeners();
     parser.addErrorListener(errorCollector1);
   }
 
   @Override
-  protected void addStage2ErrorListener(UriParserParser parser) {
+  protected void addStage2ErrorListener(final UriParserParser parser) {
     // Log error to console
     parser.removeErrorListeners();
     parser.addErrorListener(errorCollector2);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java
index f9c7e14..d5af0b6 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java
@@ -100,7 +100,7 @@ public class ParserValidator {
       (new TokenValidator()).log(lexerLogLevel).run(input);
     }
 
-    /**///root = parseInput(uri);
+    /**/// root = parseInput(uri);
 
     // if LOG > 0 - Write serialized tree
     if (logLevel > 0) {
@@ -165,79 +165,79 @@ public class ParserValidator {
   }
 
   // --- Helper ---
-/*
-  private OdataRelativeUriEOFContext parseInput(final String input) {
-    UriParserParser parser = null;
-    UriLexerWithTrace lexer = null;
-    OdataRelativeUriEOFContext ret = null;
-
-    // Use 2 stage approach to improve performance
-    // see https://github.com/antlr/antlr4/issues/192
-    // TODO verify this
-
-    // stage= 1
-    try {
-      curException = null;
-      exceptions.clear();
-
-      // create parser
-      lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
-      parser = new UriParserParser(new CommonTokenStream(lexer));
-
-      // write always a error message in case of syntax errors
-      // parser.addErrorListener(new TestErrorHandler<Object>());
-      // check error message if whether they are allowed or not
-      // parser.addErrorListener(new ErrorCollector());
-
-      // bail out of parser at first syntax error. --> proceed in catch block with step 2
-      parser.setErrorHandler(new BailErrorStrategy());
-
-      // user the faster SLL parsing
-      parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
-
-      // parse
-      if (logLevel > 0) {
-        System.out.println("Step 1");
-        System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode());
-      }
-      ret = parser.odataRelativeUriEOF();
-
-    } catch (Exception exception) {
-      curException = exception;
-      try {
-        // clear status
-        curException = null;
-        exceptions.clear();
-
-        // create parser
-        lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
-        parser = new UriParserParser(new CommonTokenStream(lexer));
-
-        // write always a error message in case of syntax errors
-        // parser.addErrorListener(new ErrorCollector(this));
-        // check error message if whether they are allowed or not
-        // parser.addErrorListener(new ErrorCollector(this));
-
-        // Used default error strategy
-        parser.setErrorHandler(new DefaultErrorStrategy());
-
-        // User the slower SLL parsing
-        parser.getInterpreter().setPredictionMode(PredictionMode.LL);
-
-        // parse
-        if (logLevel > 1) {
-          System.out.println("Step 2");
-          System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode() + ")");
-        }
-        ret = parser.odataRelativeUriEOF();
-
-      } catch (Exception exception1) {
-        curException = exception1;
-        // exceptionOnStage = 2;
-      }
-    }
-
-    return ret;
-  }
-*/
+  /*
+   * private OdataRelativeUriEOFContext parseInput(final String input) {
+   * UriParserParser parser = null;
+   * UriLexerWithTrace lexer = null;
+   * OdataRelativeUriEOFContext ret = null;
+   * 
+   * // Use 2 stage approach to improve performance
+   * // see https://github.com/antlr/antlr4/issues/192
+   * // TODO verify this
+   * 
+   * // stage= 1
+   * try {
+   * curException = null;
+   * exceptions.clear();
+   * 
+   * // create parser
+   * lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
+   * parser = new UriParserParser(new CommonTokenStream(lexer));
+   * 
+   * // write always a error message in case of syntax errors
+   * // parser.addErrorListener(new TestErrorHandler<Object>());
+   * // check error message if whether they are allowed or not
+   * // parser.addErrorListener(new ErrorCollector());
+   * 
+   * // bail out of parser at first syntax error. --> proceed in catch block with step 2
+   * parser.setErrorHandler(new BailErrorStrategy());
+   * 
+   * // user the faster SLL parsing
+   * parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
+   * 
+   * // parse
+   * if (logLevel > 0) {
+   * System.out.println("Step 1");
+   * System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode());
+   * }
+   * ret = parser.odataRelativeUriEOF();
+   * 
+   * } catch (Exception exception) {
+   * curException = exception;
+   * try {
+   * // clear status
+   * curException = null;
+   * exceptions.clear();
+   * 
+   * // create parser
+   * lexer = new UriLexerWithTrace(new ANTLRInputStream(input), lexerLogLevel);
+   * parser = new UriParserParser(new CommonTokenStream(lexer));
+   * 
+   * // write always a error message in case of syntax errors
+   * // parser.addErrorListener(new ErrorCollector(this));
+   * // check error message if whether they are allowed or not
+   * // parser.addErrorListener(new ErrorCollector(this));
+   * 
+   * // Used default error strategy
+   * parser.setErrorHandler(new DefaultErrorStrategy());
+   * 
+   * // User the slower SLL parsing
+   * parser.getInterpreter().setPredictionMode(PredictionMode.LL);
+   * 
+   * // parse
+   * if (logLevel > 1) {
+   * System.out.println("Step 2");
+   * System.out.println(" PrectictionMode: " + parser.getInterpreter().getPredictionMode() + ")");
+   * }
+   * ret = parser.odataRelativeUriEOF();
+   * 
+   * } catch (Exception exception1) {
+   * curException = exception1;
+   * // exceptionOnStage = 2;
+   * }
+   * }
+   * 
+   * return ret;
+   * }
+   */
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java
index 877b06d..46e9eb8 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java
@@ -34,7 +34,7 @@ class TestErrorLogger implements ANTLRErrorListener {
   private String prefix;
   private int logLevel = 0;
 
-  public TestErrorLogger(String prefix, int logLevel) {
+  public TestErrorLogger(final String prefix, final int logLevel) {
     this.prefix = prefix;
     this.logLevel = logLevel;
   }
@@ -49,7 +49,7 @@ class TestErrorLogger implements ANTLRErrorListener {
       System.out.println("\n" + prefix + " -- SyntaxError");
       trace(recognizer, offendingSymbol, line, charPositionInLine, msg, e);
     }
-    
+
   }
 
   @Override
@@ -124,7 +124,7 @@ class TestErrorLogger implements ANTLRErrorListener {
   public void trace(final Recognizer<?, ?> recognizer, final Object offendingSymbol,
       final int line, final int charPositionInLine, final String msg, final RecognitionException e) {
 
-    System.out.println("Error message: " +  msg);
+    System.out.println("Error message: " + msg);
     // TODO check also http://stackoverflow.com/questions/14747952/ll-exact-ambig-detection-interpetation
 
     printStack(recognizer);
@@ -145,30 +145,30 @@ class TestErrorLogger implements ANTLRErrorListener {
       System.out.println(" line " + line + ":" + charPositionInLine + " at " + offendingSymbol + ": " + msg);
     }
   }
-  
-  public static int getDecisionRule(Recognizer<?, ?> recognizer, int decision) {
+
+  public static int getDecisionRule(final Recognizer<?, ?> recognizer, final int decision) {
     if (recognizer == null || decision < 0) {
-        return -1;
+      return -1;
     }
 
     if (decision >= recognizer.getATN().decisionToState.size()) {
-        return -1;
+      return -1;
     }
 
     return recognizer.getATN().decisionToState.get(decision).ruleIndex;
-}
+  }
 
-public static String getRuleDisplayName(Recognizer<?, ?> recognizer, int ruleIndex) {
+  public static String getRuleDisplayName(final Recognizer<?, ?> recognizer, final int ruleIndex) {
     if (recognizer == null || ruleIndex < 0) {
-        return Integer.toString(ruleIndex);
+      return Integer.toString(ruleIndex);
     }
 
     String[] ruleNames = recognizer.getRuleNames();
     if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
-        return Integer.toString(ruleIndex);
+      return Integer.toString(ruleIndex);
     }
 
     return ruleNames[ruleIndex];
-}
+  }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriResourceValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriResourceValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriResourceValidator.java
index 25b46f5..637f9e3 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriResourceValidator.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriResourceValidator.java
@@ -24,11 +24,11 @@ import static org.junit.Assert.fail;
 
 import java.util.List;
 
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
 import org.apache.olingo.odata4.commons.api.edm.Edm;
 import org.apache.olingo.odata4.commons.api.edm.EdmElement;
 import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.odata4.server.api.uri.UriInfo;
 import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
 import org.apache.olingo.odata4.server.api.uri.UriParameter;
@@ -50,7 +50,6 @@ import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceNavigationPro
 import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourcePrimitivePropertyImpl;
 import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceSingletonImpl;
 import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceWithKeysImpl;
-import org.apache.olingo.odata4.server.core.uri.parser.UriParseTreeVisitor;
 import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl;
@@ -86,7 +85,7 @@ public class UriResourceValidator implements Validator {
 
   public UriResourceValidator run(final String uri) {
     ParserTest testParser = new ParserTest();
-    //testParser.setLogLevel(1);
+    // testParser.setLogLevel(1);
     UriInfoImpl uriInfoTmp = null;
     uriPathInfo = null;
     try {
@@ -149,10 +148,10 @@ public class UriResourceValidator implements Validator {
     assertEquals(var, actualVar);
     return this;
   }
-  
+
   public UriResourceValidator goSelectItemPath(final int index) {
     SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-    
+
     SelectItem item = select.getSelectItems().get(index);
     UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourceInfo();
 
@@ -218,7 +217,7 @@ public class UriResourceValidator implements Validator {
   public UriResourceValidator isTypeFilter(final FullQualifiedName expectedType) {
 
     if (uriPathInfo.getKind() != UriResourceKind.complexProperty &&
-        uriPathInfo.getKind() != UriResourceKind.singleton && 
+        uriPathInfo.getKind() != UriResourceKind.singleton &&
         uriPathInfo.getKind() != UriResourceKind.startingTypeFilter) {
       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
     }
@@ -347,7 +346,6 @@ public class UriResourceValidator implements Validator {
     return this;
   }
 
-  
   public UriResourceValidator isKeyPredicateRef(final int index, final String name, final String refencedProperty) {
     if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
@@ -360,6 +358,7 @@ public class UriResourceValidator implements Validator {
     return this;
 
   }
+
   public UriResourceValidator isKeyPredicate(final int index, final String name, final String text) {
     if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
@@ -385,7 +384,7 @@ public class UriResourceValidator implements Validator {
     return this;
 
   }
-  
+
   public UriResourceValidator isParameterAlias(final int index, final String name, final String alias) {
     if (!(uriPathInfo instanceof UriResourceFunctionImpl)) {
       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
@@ -399,14 +398,13 @@ public class UriResourceValidator implements Validator {
 
   }
 
-
   public UriResourceValidator isKind(final UriInfoKind kind) {
     assertEquals(kind, uriInfo.getKind());
     return this;
   }
 
-  public UriResourceValidator isPrimitiveProperty(final String name, 
-      final FullQualifiedName type, boolean isCollection) {
+  public UriResourceValidator isPrimitiveProperty(final String name,
+      final FullQualifiedName type, final boolean isCollection) {
     if (!(uriPathInfo instanceof UriResourcePrimitivePropertyImpl)) {
       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
     }
@@ -421,7 +419,8 @@ public class UriResourceValidator implements Validator {
     return this;
   }
 
-  public UriResourceValidator isComplexProperty(final String name, final FullQualifiedName type, boolean isCollection) {
+  public UriResourceValidator isComplexProperty(final String name, final FullQualifiedName type,
+      final boolean isCollection) {
     if (!(uriPathInfo instanceof UriResourceComplexPropertyImpl)) {
       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
     }
@@ -436,7 +435,8 @@ public class UriResourceValidator implements Validator {
     return this;
   }
 
-  public UriResourceValidator isNavProperty(final String name, final FullQualifiedName type, boolean isCollection) {
+  public UriResourceValidator
+      isNavProperty(final String name, final FullQualifiedName type, final boolean isCollection) {
     if (!(uriPathInfo instanceof UriResourceNavigationPropertyImpl)) {
       fail("invalid resource kind: " + uriPathInfo.getKind().toString());
     }
@@ -543,18 +543,18 @@ public class UriResourceValidator implements Validator {
     assertEquals(skipTokenText, uriInfo.getSkipTokenOption().getText());
     return this;
   }
-  
+
   public UriResourceValidator isSelectItemStar(final int index) {
     SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-    
+
     SelectItem item = select.getSelectItems().get(index);
     assertEquals(true, item.isStar());
     return this;
   }
-  
-  public UriResourceValidator isSelectItemAllOp(final int index, FullQualifiedName fqn) {
+
+  public UriResourceValidator isSelectItemAllOp(final int index, final FullQualifiedName fqn) {
     SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-    
+
     SelectItem item = select.getSelectItems().get(index);
     assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
     return this;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java
index 11571e2..8e9613f 100644
--- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java
@@ -25,7 +25,7 @@ import java.util.List;
 
 import org.apache.olingo.odata4.commons.api.edm.Edm;
 import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
 import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption;
 import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
@@ -34,7 +34,6 @@ import org.apache.olingo.odata4.server.core.uri.UriParserSemanticException;
 import org.apache.olingo.odata4.server.core.uri.UriParserSyntaxException;
 import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl;
 import org.apache.olingo.odata4.server.core.uri.parser.Parser;
-import org.apache.olingo.odata4.server.core.uri.parser.UriParseTreeVisitor;
 import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
 import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl;
@@ -174,12 +173,12 @@ public class UriValidator implements Validator {
 
   }
 
-  public UriValidator isExSyntax(long errorID) {
+  public UriValidator isExSyntax(final long errorID) {
     assertEquals(UriParserSyntaxException.class, exception.getClass());
     return this;
   }
 
-  public UriValidator isExSemantic(long errorID) {
+  public UriValidator isExSemantic(final long errorID) {
     assertEquals(UriParserSemanticException.class, exception.getClass());
     return this;
   }
@@ -235,7 +234,7 @@ public class UriValidator implements Validator {
     return this;
   }
 
-  public UriValidator isSelectItemAllOp(final int index, FullQualifiedName fqn) {
+  public UriValidator isSelectItemAllOp(final int index, final FullQualifiedName fqn) {
     SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
 
     SelectItem item = select.getSelectItems().get(index);