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 2015/04/04 19:05:15 UTC

[09/50] [abbrv] olingo-odata4 git commit: [OLINGO-575] Edm cleanup: Remove EdmAnnotationHelperImpl

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16b94eb4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeImpl.java
deleted file mode 100644
index 014184d..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeImpl.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.commons.core.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmElement;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
-import org.apache.olingo.commons.api.edm.provider.Property;
-import org.apache.olingo.commons.api.edm.provider.StructuralType;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-public abstract class EdmStructuredTypeImpl extends EdmTypeImpl implements EdmStructuredType {
-
-  protected EdmStructuredType baseType;
-  protected FullQualifiedName baseTypeName;
-
-  private List<String> propertyNames;
-  private List<String> navigationPropertyNames;
-  private Map<String, EdmProperty> properties;
-  private Map<String, EdmNavigationProperty> navigationProperties;
-  private final StructuralType structuredType;
-
-  public EdmStructuredTypeImpl(
-      final Edm edm,
-      final FullQualifiedName typeName,
-      final EdmTypeKind kind,
-      final StructuralType structuredType) {
-
-    super(edm, typeName, kind);
-    this.baseTypeName = structuredType.getBaseTypeFQN();
-    this.structuredType = structuredType;
-  }
-
-  protected abstract EdmStructuredType buildBaseType(FullQualifiedName baseTypeName);
-
-  protected abstract void checkBaseType();
-
-  @Override
-  public List<String> getPropertyNames() {
-    if (propertyNames == null) {
-      propertyNames = new ArrayList<String>();
-      checkBaseType();
-      if (baseType != null) {
-        propertyNames.addAll(baseType.getPropertyNames());
-      }
-      propertyNames.addAll(getProperties().keySet());
-    }
-    return propertyNames;
-  }
-
-  @Override
-  public List<String> getNavigationPropertyNames() {
-    if (navigationPropertyNames == null) {
-      navigationPropertyNames = new ArrayList<String>();
-      checkBaseType();
-      if (baseType != null) {
-        navigationPropertyNames.addAll(baseType.getNavigationPropertyNames());
-      }
-      navigationPropertyNames.addAll(getNavigationProperties().keySet());
-    }
-    return navigationPropertyNames;
-  }
-
-  @Override
-  public EdmElement getProperty(final String name) {
-    EdmElement property = getStructuralProperty(name);
-    if (property == null) {
-      property = getNavigationProperty(name);
-    }
-    return property;
-  }
-
-  @Override
-  public EdmProperty getStructuralProperty(final String name) {
-    EdmProperty property = null;
-    checkBaseType();
-    if (baseType != null) {
-      property = baseType.getStructuralProperty(name);
-    }
-    if (property == null) {
-      property = getProperties().get(name);
-    }
-    return property;
-  }
-
-  @Override
-  public EdmNavigationProperty getNavigationProperty(final String name) {
-    EdmNavigationProperty property = null;
-    checkBaseType();
-    if (baseType != null) {
-      property = baseType.getNavigationProperty(name);
-    }
-    if (property == null) {
-      property = getNavigationProperties().get(name);
-    }
-    return property;
-  }
-
-  @Override
-  public boolean compatibleTo(final EdmType targetType) {
-    EdmStructuredType sourceType = this;
-    if (targetType == null) {
-      throw new EdmException("Target type must not be null");
-    }
-    while (!sourceType.getName().equals(targetType.getName())
-        || !sourceType.getNamespace().equals(targetType.getNamespace())) {
-
-      sourceType = sourceType.getBaseType();
-      if (sourceType == null) {
-        return false;
-      }
-    }
-
-    return true;
-  }
-
-  @Override
-  public String getAnnotationsTargetPath() {
-    return null;
-  }
-
-  @Override
-  public FullQualifiedName getAnnotationsTargetFQN() {
-    return getFullQualifiedName();
-  }
-
-  public Map<String, EdmProperty> getProperties() {
-    if (properties == null) {
-      properties = new LinkedHashMap<String, EdmProperty>();
-        for (Property property : structuredType.getProperties()) {
-          properties.put(property.getName(), new EdmPropertyImpl(edm, typeName, property));
-      }
-    }
-    return properties;
-  }
-
-  public Map<String, EdmNavigationProperty> getNavigationProperties() {
-    if (navigationProperties == null) {
-      navigationProperties = new LinkedHashMap<String, EdmNavigationProperty>();
-      if (structuredType.getNavigationProperties() != null) {
-        for (NavigationProperty navigationProperty : structuredType.getNavigationProperties()) {
-          navigationProperties.put(navigationProperty.getName(),
-                  new EdmNavigationPropertyImpl(edm, typeName, navigationProperty));
-        }
-      }
-    }
-    return navigationProperties;
-  }
-
-  public boolean isOpenType() {
-    return structuredType.isOpenType();
-  }
-
-  public boolean isAbstract() {
-    return structuredType.isAbstract();
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16b94eb4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTermImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTermImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTermImpl.java
index e1f7ce0..146ff7e 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTermImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTermImpl.java
@@ -23,7 +23,6 @@ import java.util.List;
 
 import org.apache.commons.lang3.ClassUtils;
 import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
 import org.apache.olingo.commons.api.edm.EdmException;
 import org.apache.olingo.commons.api.edm.EdmTerm;
 import org.apache.olingo.commons.api.edm.EdmType;
@@ -34,24 +33,22 @@ import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class EdmTermImpl extends EdmNamedImpl implements EdmTerm {
+public class EdmTermImpl extends AbstractEdmNamed implements EdmTerm {
 
   private static final Logger LOG = LoggerFactory.getLogger(EdmTermImpl.class);
   private final Term term;
   private final FullQualifiedName fqn;
   private final EdmTypeInfo typeInfo;
-  private final EdmAnnotationHelperImpl helper;
   private EdmType termType;
   private EdmTerm baseTerm;
   private List<Class<?>> appliesTo;
 
   public EdmTermImpl(final Edm edm, final String namespace, final Term term) {
-    super(edm, term.getName());
+    super(edm, term.getName(), term);
 
     this.term = term;
     this.fqn = new FullQualifiedName(namespace, term.getName());
     this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(term.getType()).build();
-    this.helper = new EdmAnnotationHelperImpl(edm, term);
   }
 
   @Override
@@ -146,15 +143,4 @@ public class EdmTermImpl extends EdmNamedImpl implements EdmTerm {
   public String getAnnotationsTargetPath() {
     return null;
   }
-
-  @Override
-  public EdmAnnotation getAnnotation(final EdmTerm term) {
-    return helper.getAnnotation(term);
-  }
-
-  @Override
-  public List<EdmAnnotation> getAnnotations() {
-    return helper.getAnnotations();
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16b94eb4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java
index 6831f07..9c6155f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java
@@ -18,15 +18,11 @@
  */
 package org.apache.olingo.commons.core.edm.provider;
 
-import java.util.List;
-
 import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
 import org.apache.olingo.commons.api.edm.EdmException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmTerm;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
@@ -34,20 +30,17 @@ import org.apache.olingo.commons.api.edm.geo.SRID;
 import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
 import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
 
-public class EdmTypeDefinitionImpl extends EdmNamedImpl implements EdmTypeDefinition {
+public class EdmTypeDefinitionImpl extends AbstractEdmNamed implements EdmTypeDefinition {
 
   private TypeDefinition typeDefinition;
   private FullQualifiedName typeDefinitionName;
   private EdmPrimitiveType edmPrimitiveTypeInstance;
-  private final EdmAnnotationHelperImpl helper;
 
   public EdmTypeDefinitionImpl(final Edm edm, final FullQualifiedName typeDefinitionName,
       final TypeDefinition typeDefinition) {
-    super(edm, typeDefinitionName.getName());
+    super(edm, typeDefinitionName.getName(), typeDefinition);
     this.typeDefinitionName = typeDefinitionName;
     this.typeDefinition = typeDefinition;
-  
-    this.helper = new EdmAnnotationHelperImpl(edm, typeDefinition);
   }
 
   @Override
@@ -164,18 +157,7 @@ public class EdmTypeDefinitionImpl extends EdmNamedImpl implements EdmTypeDefini
   }
   
   @Override
-  public EdmAnnotation getAnnotation(final EdmTerm term) {
-    return helper.getAnnotation(term);
-  }
-
-  @Override
-  public List<EdmAnnotation> getAnnotations() {
-    return helper.getAnnotations();
-  }
-  
-  @Override
   public String getAnnotationsTargetPath() {
     return getName();
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16b94eb4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeImpl.java
index 337d700..ff3cd65 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeImpl.java
@@ -22,14 +22,16 @@ import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmType;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.provider.Annotatable;
 
-public class EdmTypeImpl extends EdmNamedImpl implements EdmType {
+public class EdmTypeImpl extends AbstractEdmNamed implements EdmType {
 
   protected final FullQualifiedName typeName;
   protected final EdmTypeKind kind;
 
-  public EdmTypeImpl(final Edm edm, final FullQualifiedName typeName, final EdmTypeKind kind) {
-    super(edm, typeName.getName());
+  public EdmTypeImpl(final Edm edm, final FullQualifiedName typeName, final EdmTypeKind kind,
+                     final Annotatable annotatable) {
+    super(edm, typeName.getName(), annotatable);
     this.typeName = typeName;
     this.kind = kind;
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16b94eb4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeInfo.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeInfo.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeInfo.java
index 768ec00..c11e880 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeInfo.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeInfo.java
@@ -35,9 +35,7 @@ public class EdmTypeInfo {
   public static class Builder {
 
     private String typeExpression;
-
     private String defaultNamespace;
-
     private Edm edm;
 
     public Builder setTypeExpression(final String typeExpression) {
@@ -62,25 +60,15 @@ public class EdmTypeInfo {
     }
   }
 
-  private final Edm edm;
-
   private final boolean collection;
-
   private final FullQualifiedName fullQualifiedName;
-
   private EdmPrimitiveTypeKind primitiveType;
-
   private EdmTypeDefinition typeDefinition;
-
   private EdmEnumType enumType;
-
   private EdmComplexType complexType;
-
   private EdmEntityType entityType;
 
   private EdmTypeInfo(final Edm edm, final String typeExpression) {
-    this.edm = edm;
-
     String baseType;
     final int collStartIdx = typeExpression.indexOf("Collection(");
     final int collEndIdx = typeExpression.lastIndexOf(')');
@@ -105,7 +93,6 @@ public class EdmTypeInfo {
     if (lastDotIdx == -1) {
       namespace = EdmPrimitiveType.EDM_NAMESPACE;
       typeName = baseType;
-      baseType = new FullQualifiedName(EdmPrimitiveType.EDM_NAMESPACE, baseType).toString();
     } else {
       namespace = baseType.substring(0, lastDotIdx);
       typeName = baseType.substring(lastDotIdx + 1);
@@ -115,9 +102,6 @@ public class EdmTypeInfo {
       throw new IllegalArgumentException("Null or empty type name in " + typeExpression);
     }
 
-    final StringBuilder exp = new StringBuilder();
-    exp.append(baseType);
-
     fullQualifiedName = new FullQualifiedName(namespace, typeName);
 
     try {
@@ -125,14 +109,14 @@ public class EdmTypeInfo {
     } catch (final IllegalArgumentException e) {
       primitiveType = null;
     }
-    if (primitiveType == null && this.edm != null) {
-      typeDefinition = this.edm.getTypeDefinition(fullQualifiedName);
+    if (primitiveType == null && edm != null) {
+      typeDefinition = edm.getTypeDefinition(fullQualifiedName);
       if (typeDefinition == null) {
-        enumType = this.edm.getEnumType(fullQualifiedName);
+        enumType = edm.getEnumType(fullQualifiedName);
         if (enumType == null) {
-          complexType = this.edm.getComplexType(fullQualifiedName);
+          complexType = edm.getComplexType(fullQualifiedName);
           if (complexType == null) {
-            entityType = this.edm.getEntityType(fullQualifiedName);
+            entityType = edm.getEntityType(fullQualifiedName);
           }
         }
       }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16b94eb4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/AbstractEdmNamedTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/AbstractEdmNamedTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/AbstractEdmNamedTest.java
new file mode 100644
index 0000000..04f0556
--- /dev/null
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/AbstractEdmNamedTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.server.core.edm.provider;
+
+import org.apache.olingo.commons.api.edm.EdmAnnotatable;
+import org.apache.olingo.commons.api.edm.EdmNamed;
+import org.apache.olingo.commons.api.edm.provider.Annotatable;
+import org.apache.olingo.commons.api.edm.provider.Annotation;
+import org.apache.olingo.commons.core.edm.provider.AbstractEdmNamed;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class AbstractEdmNamedTest {
+
+  @Test
+  public void getNameTest() {
+    EdmNamed obj = new EdmNamedImplTester("Name");
+    assertEquals("Name", obj.getName());
+    EdmAnnotatable an = (EdmAnnotatable) obj;
+    assertNotNull(an.getAnnotations().get(0));
+  }
+
+  private class EdmNamedImplTester extends AbstractEdmNamed {
+
+    public EdmNamedImplTester(final String name) {
+      super(null, name, new AnnoTester());
+    }
+  }
+
+  private class AnnoTester implements Annotatable {
+    @Override
+    public List<Annotation> getAnnotations() {
+      Annotation annotation = new Annotation();
+      annotation.setTerm("NS.SimpleTerm");
+      return Arrays.asList(annotation);
+    }
+  }
+}

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

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/16b94eb4/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java
index 38938fd..ddfd15d 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java
@@ -18,13 +18,20 @@
  */
 package org.apache.olingo.server.core.edm.provider;
 
+import org.apache.olingo.commons.api.edm.EdmAnnotatable;
 import org.apache.olingo.commons.api.edm.EdmType;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.provider.Annotatable;
+import org.apache.olingo.commons.api.edm.provider.Annotation;
 import org.apache.olingo.commons.core.edm.provider.EdmTypeImpl;
 import org.junit.Test;
 
+import java.util.Arrays;
+import java.util.List;
+
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
 public class EdmTypeImplTest {
 
@@ -34,12 +41,22 @@ public class EdmTypeImplTest {
     assertEquals("name", type.getName());
     assertEquals("namespace", type.getNamespace());
     assertEquals(EdmTypeKind.UNDEFINED, type.getKind());
+    EdmAnnotatable an = (EdmAnnotatable) type;
+    assertNotNull(an.getAnnotations().get(0));
   }
 
   private class EdmTypeImplTester extends EdmTypeImpl {
     public EdmTypeImplTester(final FullQualifiedName name, final EdmTypeKind kind) {
-      super(null, name, kind);
+      super(null, name, kind, new AnnoTester());
     }
   }
 
+  private class AnnoTester implements Annotatable {
+    @Override
+    public List<Annotation> getAnnotations() {
+      Annotation annotation = new Annotation();
+      annotation.setTerm("NS.SimpleTerm");
+      return Arrays.asList(annotation);
+    }
+  }
 }