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 2013/11/15 14:07:28 UTC
[6/7] git commit: [OLINGO-68] Api documentation and tests
[OLINGO-68] Api documentation and tests
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/3200dbbf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/3200dbbf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/3200dbbf
Branch: refs/heads/PocEdmAnnotationsExtension
Commit: 3200dbbf3515c22ecc31efd7ee28659cfbae42ed
Parents: 82f4393
Author: Christian Amend <ch...@apache.org>
Authored: Fri Nov 15 13:30:29 2013 +0100
Committer: Christian Amend <ch...@apache.org>
Committed: Fri Nov 15 13:30:29 2013 +0100
----------------------------------------------------------------------
.../odata2/api/edm/provider/EdmProvider.java | 6 +++++
.../core/edm/provider/EdmImplProvTest.java | 27 +++++++++++++++++---
2 files changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/3200dbbf/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/edm/provider/EdmProvider.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/edm/provider/EdmProvider.java b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/edm/provider/EdmProvider.java
index 9462131..b22531c 100644
--- a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/edm/provider/EdmProvider.java
+++ b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/edm/provider/EdmProvider.java
@@ -117,6 +117,12 @@ public abstract class EdmProvider {
throw new ODataNotImplementedException();
}
+ /**
+ * This method should return a list of all defined aliases and their associated namespace. If not implemented aliases
+ * cannot be resolved
+ * @return List<{@link AliasInfo}>
+ * @throws ODataException
+ */
public List<AliasInfo> getAliasInfos() throws ODataException {
return null;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/3200dbbf/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmImplProvTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmImplProvTest.java
index 574b1f5..d479bcd 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmImplProvTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmImplProvTest.java
@@ -37,15 +37,15 @@ import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
import org.apache.olingo.odata2.api.edm.provider.EntityContainerInfo;
import org.apache.olingo.odata2.api.edm.provider.EntityType;
import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.Test;
public class EdmImplProvTest extends BaseTest {
private static EdmImplProv edm;
- @BeforeClass
- public static void getEdmImpl() throws Exception {
+ @Before
+ public void getEdmImpl() throws Exception {
EdmProvider edmProvider = mock(EdmProvider.class);
List<AliasInfo> aliasInfos = new ArrayList<AliasInfo>();
@@ -75,6 +75,27 @@ public class EdmImplProvTest extends BaseTest {
}
@Test
+ public void assertCallWithAliasResultsInRightCaching() throws Exception{
+ EdmEntityType entityTypeWithAlias = edm.getEntityType("et1", "EntityType1");
+ assertEquals("EntityType1", entityTypeWithAlias.getName());
+ EdmEntityType entityType = edm.getEntityType("EntityType1Ns", "EntityType1");
+ assertEquals("EntityType1", entityType.getName());
+ assertEquals(entityType, entityTypeWithAlias);
+
+ EdmComplexType complexTypeWithAlias = edm.getComplexType("ct1", "ComplexType1");
+ assertEquals("ComplexType1", complexTypeWithAlias.getName());
+ EdmComplexType complexType = edm.getComplexType("ComplexType1Ns", "ComplexType1");
+ assertEquals("ComplexType1", complexType.getName());
+ assertEquals(complexType, complexTypeWithAlias);
+
+ EdmAssociation associationWithAlias = edm.getAssociation("at1", "Association1");
+ assertEquals("Association1", associationWithAlias.getName());
+ EdmAssociation association = edm.getAssociation("Association1Ns", "Association1");
+ assertEquals("Association1", association.getName());
+ assertEquals(association, associationWithAlias);
+ }
+
+ @Test
public void testEntityType() throws EdmException {
EdmEntityType entityType = edm.getEntityType("EntityType1Ns", "EntityType1");
assertEquals("EntityType1", entityType.getName());