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

[13/50] [abbrv] git commit: [OLINGO-142] Removed dependency to ODataRuntimeException

[OLINGO-142] Removed dependency to ODataRuntimeException


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/a02c14ee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/a02c14ee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/a02c14ee

Branch: refs/heads/Olingo-129_PocJpaDataStore
Commit: a02c14ee923fdc36c161c59b742ca69bf3122232
Parents: 1b4e3ee
Author: Michael Bolz <mi...@apache.org>
Authored: Fri Feb 7 13:44:21 2014 +0100
Committer: Michael Bolz <mi...@apache.org>
Committed: Fri Feb 7 13:44:21 2014 +0100

----------------------------------------------------------------------
 .../annotation-processor-core/pom.xml           |  5 ++-
 .../core/datasource/AnnotationInMemoryDs.java   | 26 +++++++-------
 .../processor/core/datasource/DataStore.java    |  6 ++--
 .../core/edm/AnnotationEdmProvider.java         | 15 ++++----
 .../processor/core/util/AnnotationHelper.java   | 19 +++++-----
 .../core/util/AnnotationRuntimeException.java   | 37 ++++++++++++++++++++
 .../processor/core/util/ClassHelper.java        | 10 +++---
 .../datasource/AnnotationsInMemoryDsTest.java   | 10 +++---
 .../core/edm/AnnotationEdmProviderTest.java     |  2 +-
 .../core/util/AnnotationHelperTest.java         |  3 +-
 10 files changed, 84 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a02c14ee/odata2-annotation-processor/annotation-processor-core/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/pom.xml b/odata2-annotation-processor/annotation-processor-core/pom.xml
index 89d85f5..1997352 100644
--- a/odata2-annotation-processor/annotation-processor-core/pom.xml
+++ b/odata2-annotation-processor/annotation-processor-core/pom.xml
@@ -80,12 +80,15 @@
       <artifactId>olingo-odata2-api-incubating</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <!-- 
+     -->
+    <!-- Test dependencies -->
     <dependency>
       <groupId>org.apache.olingo</groupId>
       <artifactId>olingo-odata2-core-incubating</artifactId>
       <version>${project.version}</version>
+      <scope>test</scope>
     </dependency>
-    <!-- Test dependencies -->
     <dependency>
       <groupId>org.apache.olingo</groupId>
       <artifactId>olingo-odata2-testutil-incubating</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a02c14ee/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
index e83f5d1..c1b121c 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
@@ -26,6 +26,7 @@ import org.apache.olingo.odata2.annotation.processor.core.datasource.DataStore.D
 import org.apache.olingo.odata2.annotation.processor.core.util.AnnotationHelper;
 import org.apache.olingo.odata2.annotation.processor.core.util.AnnotationHelper.AnnotatedNavInfo;
 import org.apache.olingo.odata2.annotation.processor.core.util.AnnotationHelper.ODataAnnotationException;
+import org.apache.olingo.odata2.annotation.processor.core.util.AnnotationRuntimeException;
 import org.apache.olingo.odata2.annotation.processor.core.util.ClassHelper;
 import org.apache.olingo.odata2.api.annotation.edm.EdmMediaResourceContent;
 import org.apache.olingo.odata2.api.annotation.edm.EdmMediaResourceMimeType;
@@ -38,7 +39,6 @@ import org.apache.olingo.odata2.api.exception.ODataApplicationException;
 import org.apache.olingo.odata2.api.exception.ODataException;
 import org.apache.olingo.odata2.api.exception.ODataNotFoundException;
 import org.apache.olingo.odata2.api.exception.ODataNotImplementedException;
-import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
 
 public class AnnotationInMemoryDs implements DataSource {
 
@@ -146,7 +146,7 @@ public class AnnotationInMemoryDs implements DataSource {
         sourceStore.getDataTypeClass(), targetStore.getDataTypeClass());
     Field sourceField = navInfo.getFromField();
     if (sourceField == null) {
-      throw new ODataRuntimeException("Missing source field for related data (sourceStore='" + sourceStore
+      throw new AnnotationRuntimeException("Missing source field for related data (sourceStore='" + sourceStore
           + "', targetStore='" + targetStore + "').");
     }
 
@@ -247,7 +247,7 @@ public class AnnotationInMemoryDs implements DataSource {
       return dataStore.createInstance();
     }
 
-    throw new ODataRuntimeException("No DataStore found for entitySet with name: " + entitySet.getName());
+    throw new AnnotationRuntimeException("No DataStore found for entitySet with name: " + entitySet.getName());
   }
 
   @Override
@@ -267,7 +267,7 @@ public class AnnotationInMemoryDs implements DataSource {
             mediaEntityInstance, EdmMediaResourceMimeType.class, binaryData.getMimeType());
       }
     } catch (ODataAnnotationException e) {
-      throw new ODataRuntimeException("Invalid media resource annotation at entity set '" + entitySet.getName()
+      throw new AnnotationRuntimeException("Invalid media resource annotation at entity set '" + entitySet.getName()
           + "' with message '" + e.getMessage() + "'.", e);
     }
   }
@@ -329,7 +329,7 @@ public class AnnotationInMemoryDs implements DataSource {
     // get and validate source fields
     Field sourceField = commonNavInfo.getFromField();
     if (sourceField == null) {
-      throw new ODataRuntimeException("Missing source field for related data (sourceStore='" + sourceStore
+      throw new AnnotationRuntimeException("Missing source field for related data (sourceStore='" + sourceStore
           + "', targetStore='" + targetStore + "').");
     }
 
@@ -369,7 +369,7 @@ public class AnnotationInMemoryDs implements DataSource {
       }
       collection.add(value);
     } else if (fieldTypeClass.isArray()) {
-      throw new ODataRuntimeException("Write relations for internal used arrays is not supported.");
+      throw new AnnotationRuntimeException("Write relations for internal used arrays is not supported.");
     } else {
       setValue(instance, field, value);
     }
@@ -377,19 +377,19 @@ public class AnnotationInMemoryDs implements DataSource {
 
   /**
    * Returns corresponding DataStore for EdmEntitySet or if no data store is registered an
-   * ODataRuntimeException is thrown.
+   * AnnotationRuntimeException is thrown.
    * Never returns NULL.
    * 
    * @param entitySet for which the corresponding DataStore is returned
    * @return a DataStore object
    * @throws EdmException
-   * @throws ODataRuntimeException if no DataStore is found
+   * @throws AnnotationRuntimeException if no DataStore is found
    */
   private DataStore<Object> getDataStore(final EdmEntitySet entitySet) throws EdmException {
     final String name = entitySet.getName();
     DataStore<Object> dataStore = dataStores.get(name);
     if (dataStore == null) {
-      throw new ODataRuntimeException("No DataStore found for entity set '" + entitySet + "'.");
+      throw new AnnotationRuntimeException("No DataStore found for entity set '" + entitySet + "'.");
     }
     return dataStore;
   }
@@ -402,10 +402,10 @@ public class AnnotationInMemoryDs implements DataSource {
       field.setAccessible(access);
       return value;
     } catch (IllegalArgumentException e) {
-      throw new ODataRuntimeException("Error for getting value of field '"
+      throw new AnnotationRuntimeException("Error for getting value of field '"
           + field + "' at instance '" + instance + "'.", e);
     } catch (IllegalAccessException e) {
-      throw new ODataRuntimeException("Error for getting value of field '"
+      throw new AnnotationRuntimeException("Error for getting value of field '"
           + field + "' at instance '" + instance + "'.", e);
     }
   }
@@ -417,10 +417,10 @@ public class AnnotationInMemoryDs implements DataSource {
       field.set(instance, value);
       field.setAccessible(access);
     } catch (IllegalArgumentException e) {
-      throw new ODataRuntimeException("Error for setting value of field: '"
+      throw new AnnotationRuntimeException("Error for setting value of field: '"
           + field + "' at instance: '" + instance + "'.", e);
     } catch (IllegalAccessException e) {
-      throw new ODataRuntimeException("Error for setting value of field: '"
+      throw new AnnotationRuntimeException("Error for setting value of field: '"
           + field + "' at instance: '" + instance + "'.", e);
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a02c14ee/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/DataStore.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/DataStore.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/DataStore.java
index 7be4abe..c03a557 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/DataStore.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/DataStore.java
@@ -29,10 +29,10 @@ import java.util.Map;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.olingo.odata2.annotation.processor.core.util.AnnotationHelper;
+import org.apache.olingo.odata2.annotation.processor.core.util.AnnotationRuntimeException;
 import org.apache.olingo.odata2.annotation.processor.core.util.ClassHelper;
 import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
 import org.apache.olingo.odata2.api.exception.ODataApplicationException;
-import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
 
 /**
  *
@@ -92,9 +92,9 @@ public class DataStore<T> {
     try {
       return dataTypeClass.newInstance();
     } catch (InstantiationException e) {
-      throw new ODataRuntimeException("Unable to create instance of class '" + dataTypeClass + "'.", e);
+      throw new AnnotationRuntimeException("Unable to create instance of class '" + dataTypeClass + "'.", e);
     } catch (IllegalAccessException e) {
-      throw new ODataRuntimeException("Unable to create instance of class '" + dataTypeClass + "'.", e);
+      throw new AnnotationRuntimeException("Unable to create instance of class '" + dataTypeClass + "'.", e);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a02c14ee/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProvider.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProvider.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProvider.java
index 7247e5c..cf7b94e 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProvider.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProvider.java
@@ -66,7 +66,6 @@ import org.apache.olingo.odata2.api.edm.provider.Schema;
 import org.apache.olingo.odata2.api.edm.provider.SimpleProperty;
 import org.apache.olingo.odata2.api.edm.provider.Using;
 import org.apache.olingo.odata2.api.exception.ODataException;
-import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
 
 /**
  * Provider for the entity data model used in the reference scenario
@@ -82,7 +81,7 @@ public class AnnotationEdmProvider extends EdmProvider {
   private final Map<String, Schema> namespace2Schema = new HashMap<String, Schema>();
   private EntityContainer defaultContainer;
 
-  public AnnotationEdmProvider(final Collection<Class<?>> annotatedClasses) {
+  public AnnotationEdmProvider(final Collection<Class<?>> annotatedClasses) throws ODataException {
 
     this.annotatedClasses = new ArrayList<Class<?>>(annotatedClasses.size());
     for (Class<?> aClass : annotatedClasses) {
@@ -94,7 +93,7 @@ public class AnnotationEdmProvider extends EdmProvider {
     init();
   }
 
-  public AnnotationEdmProvider(final String packageToScan) {
+  public AnnotationEdmProvider(final String packageToScan) throws ODataException {
     annotatedClasses = ClassHelper.loadClasses(packageToScan, new ClassHelper.ClassValidator() {
       @Override
       public boolean isClassValid(final Class<?> c) {
@@ -105,7 +104,7 @@ public class AnnotationEdmProvider extends EdmProvider {
     init();
   }
 
-  private void init() {
+  private void init() throws ODataException {
     for (Class<?> aClass : annotatedClasses) {
       updateSchema(aClass);
       handleEntityContainer(aClass);
@@ -303,7 +302,7 @@ public class AnnotationEdmProvider extends EdmProvider {
     return ANNOTATION_HELPER.extractEntityTypeFqn(annotatedClass);
   }
 
-  private void finish() {
+  private void finish() throws ODataException {
     //
     Collection<ContainerBuilder> containers = containerName2ContainerBuilder.values();
     for (ContainerBuilder containerBuilder : containers) {
@@ -726,7 +725,7 @@ public class AnnotationEdmProvider extends EdmProvider {
       return this;
     }
 
-    public void addAssociationSets(final Collection<Association> associations) {
+    public void addAssociationSets(final Collection<Association> associations) throws ODataException {
       for (Association association : associations) {
         AssociationSet as = new AssociationSet();
         as.setName(association.getName());
@@ -757,13 +756,13 @@ public class AnnotationEdmProvider extends EdmProvider {
       return ec;
     }
 
-    private String getEntitySetName(final AssociationEnd end) {
+    private String getEntitySetName(final AssociationEnd end) throws ODataException {
       for (EntitySet entitySet : entitySets) {
         if (entitySet.getEntityType().equals(end.getType())) {
           return entitySet.getName();
         }
       }
-      throw new ODataRuntimeException("No entity set found for " + end.getType());
+      throw new ODataException("No entity set found for " + end.getType());
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a02c14ee/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelper.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelper.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelper.java
index acf1deb..d8e5fb6 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelper.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelper.java
@@ -38,7 +38,6 @@ import org.apache.olingo.odata2.api.edm.EdmSimpleTypeException;
 import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
 import org.apache.olingo.odata2.api.edm.FullQualifiedName;
 import org.apache.olingo.odata2.api.exception.ODataException;
-import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
 
 /**
  *
@@ -64,7 +63,7 @@ public class AnnotationHelper {
     Map<String, Object> firstKeyFields = getValueForAnnotatedFields(firstInstance, EdmKey.class);
     Map<String, Object> secondKeyFields = getValueForAnnotatedFields(secondInstance, EdmKey.class);
     if (firstKeyFields.isEmpty() && secondKeyFields.isEmpty()) {
-      throw new ODataRuntimeException("Both object instances does not have EdmKey fields defined ["
+      throw new AnnotationRuntimeException("Both object instances does not have EdmKey fields defined ["
           + "firstClass=" + firstInstance.getClass().getName()
           + " secondClass=" + secondInstance.getClass().getName() + "].");
     }
@@ -88,7 +87,7 @@ public class AnnotationHelper {
     if (firstKeyValues.size() != secondKeyValues.size()) {
       return false;
     } else if (firstKeyValues.isEmpty()) {
-      throw new ODataRuntimeException("No keys given for key value matching.");
+      throw new AnnotationRuntimeException("No keys given for key value matching.");
     } else {
       Set<Map.Entry<String, Object>> entries = firstKeyValues.entrySet();
       for (Map.Entry<String, Object> entry : entries) {
@@ -631,9 +630,9 @@ public class AnnotationHelper {
       field.setAccessible(access);
       return value;
     } catch (IllegalArgumentException ex) { // should never happen
-      throw new ODataRuntimeException(ex);
+      throw new AnnotationRuntimeException(ex);
     } catch (IllegalAccessException ex) { // should never happen
-      throw new ODataRuntimeException(ex);
+      throw new AnnotationRuntimeException(ex);
     }
   }
 
@@ -650,9 +649,9 @@ public class AnnotationHelper {
       field.set(instance, usedValue);
       field.setAccessible(access);
     } catch (IllegalArgumentException ex) { // should never happen
-      throw new ODataRuntimeException(ex);
+      throw new AnnotationRuntimeException(ex);
     } catch (IllegalAccessException ex) { // should never happen
-      throw new ODataRuntimeException(ex);
+      throw new AnnotationRuntimeException(ex);
     }
   }
 
@@ -664,7 +663,7 @@ public class AnnotationHelper {
       return type.getEdmSimpleTypeInstance().valueOfString(propertyValue,
           EdmLiteralKind.DEFAULT, null, fieldClass);
     } catch (EdmSimpleTypeException ex) {
-      throw new ODataRuntimeException("Conversion failed for string property ["
+      throw new AnnotationRuntimeException("Conversion failed for string property ["
           + propertyValue + "] on field ["
           + field + "] with error: " + ex.getMessage(), ex);
     }
@@ -746,7 +745,7 @@ public class AnnotationHelper {
     case TIME:
       return EdmSimpleTypeKind.Time;
     default:
-      throw new ODataRuntimeException("Unknown type '" + type
+      throw new AnnotationRuntimeException("Unknown type '" + type
           + "' for mapping to EdmSimpleTypeKind.");
     }
   }
@@ -760,7 +759,7 @@ public class AnnotationHelper {
     case MANY:
       return EdmMultiplicity.MANY;
     default:
-      throw new ODataRuntimeException("Unknown type '" + multiplicity + "' for mapping to EdmMultiplicity.");
+      throw new AnnotationRuntimeException("Unknown type '" + multiplicity + "' for mapping to EdmMultiplicity.");
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a02c14ee/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationRuntimeException.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationRuntimeException.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationRuntimeException.java
new file mode 100644
index 0000000..b558719
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationRuntimeException.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata2.annotation.processor.core.util;
+
+public class AnnotationRuntimeException extends RuntimeException {
+
+  /** */
+  private static final long serialVersionUID = 42L;
+  
+  public AnnotationRuntimeException(String message) {
+    super(message);
+  }
+
+  public AnnotationRuntimeException(Throwable cause) {
+    super(cause);
+  }
+
+  public AnnotationRuntimeException(String message, Throwable cause) {
+    super(message, cause);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a02c14ee/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
index 66f7860..22ba73c 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
@@ -32,8 +32,6 @@ import java.util.List;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 
-import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
-
 /**
  *
  */
@@ -181,9 +179,9 @@ public class ClassHelper {
         return value;
       }
     } catch (IllegalArgumentException ex) { // should never happen
-      throw new ODataRuntimeException(ex);
+      throw new AnnotationRuntimeException(ex);
     } catch (IllegalAccessException ex) { // should never happen
-      throw new ODataRuntimeException(ex);
+      throw new AnnotationRuntimeException(ex);
     }
   }
 
@@ -196,9 +194,9 @@ public class ClassHelper {
         field.setAccessible(access);
       }
     } catch (IllegalArgumentException ex) { // should never happen
-      throw new ODataRuntimeException(ex);
+      throw new AnnotationRuntimeException(ex);
     } catch (IllegalAccessException ex) { // should never happen
-      throw new ODataRuntimeException(ex);
+      throw new AnnotationRuntimeException(ex);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a02c14ee/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
index 690570a..7b2ee4b 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
@@ -40,6 +40,7 @@ import org.apache.olingo.odata2.annotation.processor.core.model.RefBase;
 import org.apache.olingo.odata2.annotation.processor.core.model.Room;
 import org.apache.olingo.odata2.annotation.processor.core.model.Team;
 import org.apache.olingo.odata2.annotation.processor.core.util.AnnotationHelper;
+import org.apache.olingo.odata2.annotation.processor.core.util.AnnotationRuntimeException;
 import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
 import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
 import org.apache.olingo.odata2.api.edm.EdmEntitySet;
@@ -48,7 +49,6 @@ import org.apache.olingo.odata2.api.edm.FullQualifiedName;
 import org.apache.olingo.odata2.api.edm.provider.EntitySet;
 import org.apache.olingo.odata2.api.exception.ODataException;
 import org.apache.olingo.odata2.api.exception.ODataNotFoundException;
-import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
 import org.junit.Assert;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -367,7 +367,7 @@ public class AnnotationsInMemoryDsTest {
     }
   }
 
-  @Test(expected = ODataRuntimeException.class)
+  @Test(expected = AnnotationRuntimeException.class)
   public void readUnknownEntity() throws Exception {
     EdmEntitySet unknownEntitySet = Mockito.mock(EdmEntitySet.class);
     Mockito.when(unknownEntitySet.getName()).thenReturn("UnknownEntity");
@@ -378,7 +378,7 @@ public class AnnotationsInMemoryDsTest {
     datasource.readData(unknownEntitySet, keys);
   }
 
-  @Test(expected = ODataRuntimeException.class)
+  @Test(expected = AnnotationRuntimeException.class)
   public void readUnknownEntities() throws Exception {
     EdmEntitySet unknownEntitySet = Mockito.mock(EdmEntitySet.class);
     Mockito.when(unknownEntitySet.getName()).thenReturn("UnknownEntity");
@@ -711,7 +711,7 @@ public class AnnotationsInMemoryDsTest {
     } catch (ODataNotFoundException e) {}
   }
 
-  @Test(expected = ODataRuntimeException.class)
+  @Test(expected = AnnotationRuntimeException.class)
   public void unknownEntitySetForEntity() throws Exception {
     String entitySetName = "Unknown";
     FullQualifiedName entityType = new FullQualifiedName(DEFAULT_CONTAINER, entitySetName);
@@ -728,7 +728,7 @@ public class AnnotationsInMemoryDsTest {
     datasource.readData(edmEntitySet, keys);
   }
 
-  @Test(expected = ODataRuntimeException.class)
+  @Test(expected = AnnotationRuntimeException.class)
   public void unknownEntitySetForEntities() throws Exception {
     String entitySetName = "Unknown";
     FullQualifiedName entityType = new FullQualifiedName(DEFAULT_CONTAINER, entitySetName);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a02c14ee/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProviderTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProviderTest.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProviderTest.java
index 7c35fca..24f550a 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProviderTest.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProviderTest.java
@@ -80,7 +80,7 @@ public class AnnotationEdmProviderTest {
   private final AnnotationEdmProvider aep;
   private final Collection<Class<?>> annotatedClasses = new ArrayList<Class<?>>();
 
-  public AnnotationEdmProviderTest() {
+  public AnnotationEdmProviderTest() throws ODataException {
     annotatedClasses.add(RefBase.class);
     annotatedClasses.add(Building.class);
     annotatedClasses.add(City.class);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a02c14ee/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelperTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelperTest.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelperTest.java
index 7bd35ad..18d7df2 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelperTest.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelperTest.java
@@ -29,7 +29,6 @@ import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
 import org.apache.olingo.odata2.api.annotation.edm.EdmType;
 import org.apache.olingo.odata2.api.edm.FullQualifiedName;
 import org.apache.olingo.odata2.api.exception.ODataException;
-import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
 import org.junit.Test;
 
 /**
@@ -150,7 +149,7 @@ public class AnnotationHelperTest {
     Assert.assertFalse(result2);
   }
 
-  @Test(expected = ODataRuntimeException.class)
+  @Test(expected = AnnotationRuntimeException.class)
   public void keyMatchNegativeNotAnnotated() throws ODataException {
     NotAnnotatedBean firstInstance = new NotAnnotatedBean();
     NotAnnotatedBean secondInstance = new NotAnnotatedBean();