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/09/24 14:42:29 UTC
[02/51] [partial] Refactored project structure
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAnnotationsImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAnnotationsImplProvTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAnnotationsImplProvTest.java
deleted file mode 100644
index a79ae2c..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAnnotationsImplProvTest.java
+++ /dev/null
@@ -1,119 +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.odata2.core.edm.provider;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.olingo.odata2.api.edm.EdmAnnotationAttribute;
-import org.apache.olingo.odata2.api.edm.EdmAnnotationElement;
-import org.apache.olingo.odata2.api.edm.provider.AnnotationAttribute;
-import org.apache.olingo.odata2.api.edm.provider.AnnotationElement;
-import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class EdmAnnotationsImplProvTest extends BaseTest {
-
- private static EdmAnnotationsImplProv annotationsProvider;
-
- @BeforeClass
- public static void getEdmEntityContainerImpl() throws Exception {
-
- List<AnnotationAttribute> annotationAttributes = new ArrayList<AnnotationAttribute>();
- AnnotationAttribute attribute =
- new AnnotationAttribute().setName("attributeName").setNamespace("namespace").setPrefix("prefix")
- .setText("Text");
- annotationAttributes.add(attribute);
-
- List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>();
- AnnotationElement element =
- new AnnotationElement().setName("elementName").setNamespace("namespace").setPrefix("prefix").setText("xmlData");
- annotationElements.add(element);
-
- annotationsProvider = new EdmAnnotationsImplProv(annotationAttributes, annotationElements);
-
- }
-
- @Test
- public void testAttributes() {
- List<? extends EdmAnnotationAttribute> annotations = annotationsProvider.getAnnotationAttributes();
- assertEquals(1, annotations.size());
-
- Iterator<? extends EdmAnnotationAttribute> iterator = annotations.iterator();
- while (iterator.hasNext()) {
- EdmAnnotationAttribute attribute = iterator.next();
- assertEquals("attributeName", attribute.getName());
- assertEquals("namespace", attribute.getNamespace());
- assertEquals("prefix", attribute.getPrefix());
- assertEquals("Text", attribute.getText());
- }
- }
-
- @Test
- public void testAttribute() {
- EdmAnnotationAttribute attribute = annotationsProvider.getAnnotationAttribute("attributeName", "namespace");
- assertEquals("attributeName", attribute.getName());
- assertEquals("namespace", attribute.getNamespace());
- assertEquals("prefix", attribute.getPrefix());
- assertEquals("Text", attribute.getText());
- }
-
- @Test
- public void testAttributeNull() {
- EdmAnnotationAttribute attribute =
- annotationsProvider.getAnnotationAttribute("attributeNameWrong", "namespaceWrong");
- assertNull(attribute);
- }
-
- @Test
- public void testElements() {
- List<? extends EdmAnnotationElement> annotations = annotationsProvider.getAnnotationElements();
- assertEquals(1, annotations.size());
-
- Iterator<? extends EdmAnnotationElement> iterator = annotations.iterator();
- while (iterator.hasNext()) {
- EdmAnnotationElement element = iterator.next();
- assertEquals("elementName", element.getName());
- assertEquals("namespace", element.getNamespace());
- assertEquals("prefix", element.getPrefix());
- assertEquals("xmlData", element.getText());
- }
- }
-
- @Test
- public void testElement() {
- EdmAnnotationElement element = annotationsProvider.getAnnotationElement("elementName", "namespace");
- assertEquals("elementName", element.getName());
- assertEquals("namespace", element.getNamespace());
- assertEquals("prefix", element.getPrefix());
- assertEquals("xmlData", element.getText());
- }
-
- @Test
- public void testElementNull() {
- EdmAnnotationElement element = annotationsProvider.getAnnotationElement("elementNameWrong", "namespaceWrong");
- assertNull(element);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationEndImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationEndImplProvTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationEndImplProvTest.java
deleted file mode 100644
index 009d979..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationEndImplProvTest.java
+++ /dev/null
@@ -1,78 +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.odata2.core.edm.provider;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.mock;
-
-import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
-import org.apache.olingo.odata2.api.edm.EdmAnnotations;
-import org.apache.olingo.odata2.api.edm.EdmAssociationEnd;
-import org.apache.olingo.odata2.api.edm.EdmException;
-import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import org.apache.olingo.odata2.api.edm.provider.AssociationEnd;
-import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- *
- */
-public class EdmAssociationEndImplProvTest extends BaseTest {
- private static EdmAssociationEndImplProv associationEndProv;
- private static EdmProvider edmProvider;
-
- @BeforeClass
- public static void getEdmEntityContainerImpl() throws Exception {
-
- edmProvider = mock(EdmProvider.class);
- EdmImplProv edmImplProv = new EdmImplProv(edmProvider);
-
- AssociationEnd end1 =
- new AssociationEnd().setRole("end1Role").setMultiplicity(EdmMultiplicity.ONE).setType(
- EdmSimpleTypeKind.String.getFullQualifiedName());
-
- associationEndProv = new EdmAssociationEndImplProv(edmImplProv, end1);
- }
-
- @Test
- public void testAssociationEnd() throws Exception {
- EdmAssociationEnd associationEnd = associationEndProv;
-
- assertEquals("end1Role", associationEnd.getRole());
- assertEquals(EdmMultiplicity.ONE, associationEnd.getMultiplicity());
- }
-
- @Test(expected = EdmException.class)
- public void testAssociationEntityType() throws Exception {
- EdmAssociationEnd associationEnd = associationEndProv;
- associationEnd.getEntityType();
- }
-
- @Test
- public void getAnnotations() throws Exception {
- EdmAnnotatable annotatable = associationEndProv;
- EdmAnnotations annotations = annotatable.getAnnotations();
- assertNull(annotations.getAnnotationAttributes());
- assertNull(annotations.getAnnotationElements());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationImplProvTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationImplProvTest.java
deleted file mode 100644
index b1dc084..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationImplProvTest.java
+++ /dev/null
@@ -1,116 +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.odata2.core.edm.provider;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.mock;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
-import org.apache.olingo.odata2.api.edm.EdmAnnotations;
-import org.apache.olingo.odata2.api.edm.EdmAssociation;
-import org.apache.olingo.odata2.api.edm.EdmException;
-import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import org.apache.olingo.odata2.api.edm.EdmTypeKind;
-import org.apache.olingo.odata2.api.edm.provider.Association;
-import org.apache.olingo.odata2.api.edm.provider.AssociationEnd;
-import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata2.api.edm.provider.PropertyRef;
-import org.apache.olingo.odata2.api.edm.provider.ReferentialConstraint;
-import org.apache.olingo.odata2.api.edm.provider.ReferentialConstraintRole;
-import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- *
- */
-public class EdmAssociationImplProvTest extends BaseTest {
-
- private static EdmAssociationImplProv associationProv;
- private static EdmProvider edmProvider;
-
- @BeforeClass
- public static void getEdmEntityContainerImpl() throws Exception {
-
- edmProvider = mock(EdmProvider.class);
- EdmImplProv edmImplProv = new EdmImplProv(edmProvider);
-
- AssociationEnd end1 =
- new AssociationEnd().setRole("end1Role").setMultiplicity(EdmMultiplicity.ONE).setType(
- EdmSimpleTypeKind.String.getFullQualifiedName());
- AssociationEnd end2 =
- new AssociationEnd().setRole("end2Role").setMultiplicity(EdmMultiplicity.ONE).setType(
- EdmSimpleTypeKind.String.getFullQualifiedName());
-
- List<PropertyRef> propRef = new ArrayList<PropertyRef>();
- propRef.add(new PropertyRef().setName("prop1"));
- List<PropertyRef> propRef2 = new ArrayList<PropertyRef>();
- propRef2.add(new PropertyRef().setName("prop2"));
-
- ReferentialConstraintRole dependent = new ReferentialConstraintRole().setRole("end1Role");
- ReferentialConstraintRole principal = new ReferentialConstraintRole().setRole("end2Role");
-
- ReferentialConstraint referentialConstraint =
- new ReferentialConstraint().setDependent(dependent).setPrincipal(principal);
-
- Association association = new Association().setName("association").setEnd1(end1).setEnd2(end2);
- association.setReferentialConstraint(referentialConstraint);
-
- associationProv = new EdmAssociationImplProv(edmImplProv, association, "namespace");
- }
-
- @Test
- public void testAssociation() throws Exception {
- EdmAssociation association = associationProv;
-
- assertEquals(EdmTypeKind.ASSOCIATION, association.getKind());
- assertEquals("end1Role", association.getEnd("end1Role").getRole());
- assertEquals("end2Role", association.getEnd("end2Role").getRole());
- assertEquals("namespace", association.getNamespace());
- assertEquals(null, association.getEnd("endWrongRole"));
- }
-
- @Test
- public void testAssociationEnds() throws EdmException {
- EdmAssociation association = associationProv;
- assertEquals("end1Role", association.getEnd1().getRole());
- assertEquals("end2Role", association.getEnd2().getRole());
- }
-
- @Test
- public void testReferentialConstraint() throws EdmException {
- EdmAssociation association = associationProv;
- assertEquals("end1Role", association.getReferentialConstraint().getDependent().getRole());
- assertEquals("end2Role", association.getReferentialConstraint().getPrincipal().getRole());
- }
-
- @Test
- public void getAnnotations() throws Exception {
- EdmAnnotatable annotatable = associationProv;
- EdmAnnotations annotations = annotatable.getAnnotations();
- assertNull(annotations.getAnnotationAttributes());
- assertNull(annotations.getAnnotationElements());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationSetEndImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationSetEndImplProvTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationSetEndImplProvTest.java
deleted file mode 100644
index 3e1b8c7..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationSetEndImplProvTest.java
+++ /dev/null
@@ -1,74 +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.odata2.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 org.apache.olingo.odata2.api.edm.EdmAnnotatable;
-import org.apache.olingo.odata2.api.edm.EdmAnnotations;
-import org.apache.olingo.odata2.api.edm.EdmAssociationSetEnd;
-import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
-import org.apache.olingo.odata2.api.edm.provider.AssociationSetEnd;
-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.EntitySet;
-import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class EdmAssociationSetEndImplProvTest extends BaseTest {
- private static EdmAssociationSetEnd edmAssociationSetEnd;
- private static EdmProvider edmProvider;
-
- @BeforeClass
- public static void getEdmEntityContainerImpl() throws Exception {
-
- edmProvider = mock(EdmProvider.class);
- EdmImplProv edmImplProv = new EdmImplProv(edmProvider);
-
- EntityContainerInfo entityContainer = new EntityContainerInfo().setName("Container");
- EdmEntityContainer edmEntityContainer = new EdmEntityContainerImplProv(edmImplProv, entityContainer);
-
- AssociationSetEnd associationSetEnd = new AssociationSetEnd().setRole("end1Role").setEntitySet("entitySetRole1");
- EntitySet entitySet = new EntitySet().setName("entitySetRole1");
- when(edmProvider.getEntitySet("Container", "entitySetRole1")).thenReturn(entitySet);
-
- edmAssociationSetEnd =
- new EdmAssociationSetEndImplProv(associationSetEnd, edmEntityContainer.getEntitySet("entitySetRole1"));
- }
-
- @Test
- public void testAssociationSetEnd() throws Exception {
- EdmAssociationSetEnd setEnd = edmAssociationSetEnd;
-
- assertEquals("end1Role", setEnd.getRole());
- assertEquals("entitySetRole1", setEnd.getEntitySet().getName());
- }
-
- @Test
- public void getAnnotations() throws Exception {
- EdmAnnotatable annotatable = (EdmAnnotatable) edmAssociationSetEnd;
- EdmAnnotations annotations = annotatable.getAnnotations();
- assertNull(annotations.getAnnotationAttributes());
- assertNull(annotations.getAnnotationElements());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationSetImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationSetImplProvTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationSetImplProvTest.java
deleted file mode 100644
index dacf62c..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmAssociationSetImplProvTest.java
+++ /dev/null
@@ -1,115 +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.odata2.core.edm.provider;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
-import org.apache.olingo.odata2.api.edm.EdmAnnotations;
-import org.apache.olingo.odata2.api.edm.EdmAssociationSet;
-import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
-import org.apache.olingo.odata2.api.edm.EdmException;
-import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import org.apache.olingo.odata2.api.edm.FullQualifiedName;
-import org.apache.olingo.odata2.api.edm.provider.Association;
-import org.apache.olingo.odata2.api.edm.provider.AssociationEnd;
-import org.apache.olingo.odata2.api.edm.provider.AssociationSet;
-import org.apache.olingo.odata2.api.edm.provider.AssociationSetEnd;
-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.EntitySet;
-import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class EdmAssociationSetImplProvTest extends BaseTest {
-
- private static EdmAssociationSet edmAssociationSet;
- private static EdmProvider edmProvider;
-
- @BeforeClass
- public static void getEdmEntityContainerImpl() throws Exception {
-
- edmProvider = mock(EdmProvider.class);
- EdmImplProv edmImplProv = new EdmImplProv(edmProvider);
-
- EntityContainerInfo entityContainer = new EntityContainerInfo().setName("Container");
- EdmEntityContainer edmEntityContainer = new EdmEntityContainerImplProv(edmImplProv, entityContainer);
-
- AssociationEnd end1 =
- new AssociationEnd().setRole("end1Role").setMultiplicity(EdmMultiplicity.ONE).setType(
- EdmSimpleTypeKind.String.getFullQualifiedName());
- AssociationEnd end2 =
- new AssociationEnd().setRole("end2Role").setMultiplicity(EdmMultiplicity.ONE).setType(
- EdmSimpleTypeKind.String.getFullQualifiedName());
- Association association = new Association().setName("association").setEnd1(end1).setEnd2(end2);
- FullQualifiedName assocName = new FullQualifiedName("namespace", "association");
- when(edmProvider.getAssociation(assocName)).thenReturn(association);
-
- AssociationSetEnd endSet1 = new AssociationSetEnd().setRole("end1Role").setEntitySet("entitySetRole1");
- when(edmProvider.getEntitySet("Container", "entitySetRole1")).thenReturn(new EntitySet().setName("entitySetRole1"));
- AssociationSetEnd endSet2 = new AssociationSetEnd().setRole("end2Role");
-
- AssociationSet associationSet =
- new AssociationSet().setName("associationSetName").setAssociation(assocName).setEnd1(endSet1).setEnd2(endSet2);
-
- edmAssociationSet = new EdmAssociationSetImplProv(edmImplProv, associationSet, edmEntityContainer);
- }
-
- @Test
- public void testAssociationSet() throws Exception {
- EdmAssociationSet associationSet = edmAssociationSet;
-
- assertEquals("associationSetName", associationSet.getName());
-
- assertEquals("end1Role", associationSet.getEnd("end1Role").getRole());
- assertEquals(null, associationSet.getEnd("endWrongRole"));
- }
-
- @Test(expected = EdmException.class)
- public void testAssociationSetNoEntity() throws Exception {
- EdmAssociationSet associationSet = edmAssociationSet;
- associationSet.getEnd("end2Role");
- }
-
- @Test
- public void testAssociationExists() throws Exception {
- EdmAssociationSet associationSet = edmAssociationSet;
- assertNotNull(associationSet.getAssociation());
- }
-
- @Test
- public void testEntityContainer() throws Exception {
- EdmAssociationSet associationSet = edmAssociationSet;
- assertNotNull(associationSet.getEntityContainer());
- }
-
- @Test
- public void getAnnotations() throws Exception {
- EdmAnnotatable annotatable = (EdmAnnotatable) edmAssociationSet;
- EdmAnnotations annotations = annotatable.getAnnotations();
- assertNull(annotations.getAnnotationAttributes());
- assertNull(annotations.getAnnotationElements());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmComplexTypeImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmComplexTypeImplProvTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmComplexTypeImplProvTest.java
deleted file mode 100644
index 38de885..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmComplexTypeImplProvTest.java
+++ /dev/null
@@ -1,120 +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.odata2.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.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
-import org.apache.olingo.odata2.api.edm.EdmAnnotations;
-import org.apache.olingo.odata2.api.edm.EdmComplexType;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import org.apache.olingo.odata2.api.edm.EdmTyped;
-import org.apache.olingo.odata2.api.edm.FullQualifiedName;
-import org.apache.olingo.odata2.api.edm.provider.ComplexType;
-import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata2.api.edm.provider.Property;
-import org.apache.olingo.odata2.api.edm.provider.SimpleProperty;
-import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- *
- */
-public class EdmComplexTypeImplProvTest extends BaseTest {
- private static EdmComplexTypeImplProv edmComplexType;
- private static EdmComplexTypeImplProv edmComplexTypeWithBaseType;
- private static EdmProvider edmProvider;
-
- @BeforeClass
- public static void getEdmEntityContainerImpl() throws Exception {
-
- edmProvider = mock(EdmProvider.class);
- EdmImplProv edmImplProv = new EdmImplProv(edmProvider);
-
- ComplexType fooComplexType = new ComplexType().setName("fooComplexType");
-
- List<Property> keyPropertysFoo = new ArrayList<Property>();
- keyPropertysFoo.add(new SimpleProperty().setName("Name").setType(EdmSimpleTypeKind.String));
- keyPropertysFoo.add(new SimpleProperty().setName("Address").setType(EdmSimpleTypeKind.String));
- fooComplexType.setProperties(keyPropertysFoo);
-
- edmComplexType = new EdmComplexTypeImplProv(edmImplProv, fooComplexType, "namespace");
-
- FullQualifiedName barBaseTypeName = new FullQualifiedName("namespace", "barBase");
- ComplexType barBase = new ComplexType().setName("barBase");
- when(edmProvider.getComplexType(barBaseTypeName)).thenReturn(barBase);
-
- List<Property> propertysBarBase = new ArrayList<Property>();
- propertysBarBase.add(new SimpleProperty().setName("Name").setType(EdmSimpleTypeKind.String));
- propertysBarBase.add(new SimpleProperty().setName("Address").setType(EdmSimpleTypeKind.String));
- barBase.setProperties(propertysBarBase);
-
- ComplexType barComplexType = new ComplexType().setName("barComplexType").setBaseType(barBaseTypeName);
- edmComplexTypeWithBaseType = new EdmComplexTypeImplProv(edmImplProv, barComplexType, "namespace");
-
- }
-
- @Test
- public void getPropertiesNames() throws Exception {
- List<String> properties = edmComplexType.getPropertyNames();
- assertNotNull(properties);
- assertTrue(properties.contains("Name"));
- assertTrue(properties.contains("Address"));
- }
-
- @Test
- public void getPropertiesWithBaseType() throws Exception {
- List<String> properties = edmComplexTypeWithBaseType.getPropertyNames();
- assertNotNull(properties);
- assertTrue(properties.contains("Name"));
- assertTrue(properties.contains("Address"));
- }
-
- @Test
- public void getBaseType() throws Exception {
- EdmComplexType baseType = edmComplexTypeWithBaseType.getBaseType();
- assertNotNull(baseType);
- assertEquals("barBase", baseType.getName());
- assertEquals("namespace", baseType.getNamespace());
- }
-
- @Test
- public void getProperty() throws Exception {
- EdmTyped property = edmComplexType.getProperty("Name");
- assertNotNull(property);
- assertEquals("Name", property.getName());
- }
-
- @Test
- public void getAnnotations() throws Exception {
- EdmAnnotatable annotatable = edmComplexType;
- EdmAnnotations annotations = annotatable.getAnnotations();
- assertNull(annotations.getAnnotationAttributes());
- assertNull(annotations.getAnnotationElements());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntityContainerImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntityContainerImplProvTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntityContainerImplProvTest.java
deleted file mode 100644
index 98ec966..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntityContainerImplProvTest.java
+++ /dev/null
@@ -1,149 +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.odata2.core.edm.provider;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-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.odata2.api.edm.EdmAnnotatable;
-import org.apache.olingo.odata2.api.edm.EdmAnnotations;
-import org.apache.olingo.odata2.api.edm.EdmAssociation;
-import org.apache.olingo.odata2.api.edm.EdmEntitySet;
-import org.apache.olingo.odata2.api.edm.EdmException;
-import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
-import org.apache.olingo.odata2.api.edm.FullQualifiedName;
-import org.apache.olingo.odata2.api.edm.provider.AssociationSet;
-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.EntitySet;
-import org.apache.olingo.odata2.api.edm.provider.FunctionImport;
-import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- *
- */
-public class EdmEntityContainerImplProvTest extends BaseTest {
-
- private static EdmEntityContainerImplProv edmEntityContainer;
-
- @BeforeClass
- public static void getEdmEntityContainerImpl() throws Exception {
- EdmProvider edmProvider = mock(EdmProvider.class);
- EdmImplProv edmImplProv = new EdmImplProv(edmProvider);
- when(edmProvider.getEntityContainerInfo("Container")).thenReturn(new EntityContainerInfo().setName("Container"));
-
- EntityContainerInfo entityContainer = new EntityContainerInfo().setName("Container1").setExtendz("Container");
-
- EntitySet entitySetFooFromParent = new EntitySet().setName("fooFromParent");
- when(edmProvider.getEntitySet("Container", "fooFromParent")).thenReturn(entitySetFooFromParent);
-
- EntitySet entitySetFoo = new EntitySet().setName("foo");
- when(edmProvider.getEntitySet("Container1", "foo")).thenReturn(entitySetFoo);
-
- EntitySet entitySetBar = new EntitySet().setName("foo");
- when(edmProvider.getEntitySet("Container1", "foo")).thenReturn(entitySetBar);
-
- AssociationSet associationSet = new AssociationSet().setName("4711");
- FullQualifiedName assocFQName = new FullQualifiedName("AssocNs", "AssocName");
- when(edmProvider.getAssociationSet("Container1", assocFQName, "foo", "fromRole")).thenReturn(associationSet);
-
- FunctionImport functionImportFoo = new FunctionImport().setName("foo");
- when(edmProvider.getFunctionImport("Container1", "foo")).thenReturn(functionImportFoo);
-
- FunctionImport functionImportBar = new FunctionImport().setName("foo");
- when(edmProvider.getFunctionImport("Container1", "foo")).thenReturn(functionImportBar);
-
- edmEntityContainer = new EdmEntityContainerImplProv(edmImplProv, entityContainer);
- }
-
- @Test
- public void testEntityContainerName() throws EdmException {
- assertEquals("Container1", edmEntityContainer.getName());
- }
-
- @Test
- public void testEntityContainerInheritance() throws EdmException {
- assertEquals("fooFromParent", edmEntityContainer.getEntitySet("fooFromParent").getName());
-
- EdmEntitySet sourceEntitySet = mock(EdmEntitySet.class);
- when(sourceEntitySet.getName()).thenReturn("foo");
-
- EdmAssociation edmAssociation = mock(EdmAssociation.class);
- when(edmAssociation.getNamespace()).thenReturn("AssocNs");
- when(edmAssociation.getName()).thenReturn("AssocName");
-
- EdmNavigationProperty edmNavigationProperty = mock(EdmNavigationProperty.class);
- when(edmNavigationProperty.getRelationship()).thenReturn(edmAssociation);
- when(edmNavigationProperty.getFromRole()).thenReturn("wrongRole");
-
- boolean failed = false;
- try {
- edmEntityContainer.getAssociationSet(sourceEntitySet, edmNavigationProperty);
- } catch (EdmException e) {
- failed = true;
- }
-
- assertTrue(failed);
- }
-
- @Test
- public void testEntitySetCache() throws EdmException {
- assertEquals(edmEntityContainer.getEntitySet("foo"), edmEntityContainer.getEntitySet("foo"));
- assertNotSame(edmEntityContainer.getEntitySet("foo"), edmEntityContainer.getEntitySet("bar"));
- }
-
- @Test
- public void testAssociationSetCache() throws EdmException {
- EdmEntitySet sourceEntitySet = mock(EdmEntitySet.class);
- when(sourceEntitySet.getName()).thenReturn("foo");
-
- EdmAssociation edmAssociation = mock(EdmAssociation.class);
- when(edmAssociation.getNamespace()).thenReturn("AssocNs");
- when(edmAssociation.getName()).thenReturn("AssocName");
-
- EdmNavigationProperty edmNavigationProperty = mock(EdmNavigationProperty.class);
- when(edmNavigationProperty.getRelationship()).thenReturn(edmAssociation);
- when(edmNavigationProperty.getFromRole()).thenReturn("fromRole");
-
- assertNotNull(edmEntityContainer.getAssociationSet(sourceEntitySet, edmNavigationProperty));
- assertEquals(edmEntityContainer.getAssociationSet(sourceEntitySet, edmNavigationProperty), edmEntityContainer
- .getAssociationSet(sourceEntitySet, edmNavigationProperty));
- }
-
- @Test
- public void testFunctionImportCache() throws EdmException {
- assertEquals(edmEntityContainer.getFunctionImport("foo"), edmEntityContainer.getFunctionImport("foo"));
- assertNotSame(edmEntityContainer.getFunctionImport("foo"), edmEntityContainer.getFunctionImport("bar"));
- }
-
- @Test
- public void getAnnotations() throws Exception {
- EdmAnnotatable annotatable = edmEntityContainer;
- EdmAnnotations annotations = annotatable.getAnnotations();
- assertNull(annotations.getAnnotationAttributes());
- assertNull(annotations.getAnnotationElements());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntitySetInfoImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntitySetInfoImplProvTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntitySetInfoImplProvTest.java
deleted file mode 100644
index 202a67f..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntitySetInfoImplProvTest.java
+++ /dev/null
@@ -1,75 +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.odata2.core.edm.provider;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.net.URI;
-
-import org.apache.olingo.odata2.api.edm.EdmEntitySetInfo;
-import org.apache.olingo.odata2.api.edm.provider.EntityContainerInfo;
-import org.apache.olingo.odata2.api.edm.provider.EntitySet;
-import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.junit.Test;
-
-public class EdmEntitySetInfoImplProvTest extends BaseTest {
-
- @Test
- public void entityWithDefaultContainer() throws Exception {
- String entitySetName = "Employees";
- URI entitySetUri = new URI(entitySetName);
- String entityContainerName = "Container";
-
- EntitySet entitySet = new EntitySet();
- entitySet.setName(entitySetName);
-
- EntityContainerInfo entityContainerInfo = new EntityContainerInfo();
- entityContainerInfo.setName(entityContainerName).setDefaultEntityContainer(true);
-
- EdmEntitySetInfo info = new EdmEntitySetInfoImplProv(entitySet, entityContainerInfo);
-
- assertEquals(entitySetName, info.getEntitySetName());
- assertEquals(entitySetUri.toASCIIString(), info.getEntitySetUri().toASCIIString());
- assertEquals(entityContainerName, info.getEntityContainerName());
- assertTrue(info.isDefaultEntityContainer());
- }
-
- @Test
- public void entityWithoutDefaultContainer() throws Exception {
- String entitySetName = "Employees";
- String entityContainerName = "Container";
- URI entitySetUri = new URI(entityContainerName + "." + entitySetName);
-
- EntitySet entitySet = new EntitySet();
- entitySet.setName(entitySetName);
-
- EntityContainerInfo entityContainerInfo = new EntityContainerInfo();
- entityContainerInfo.setName(entityContainerName).setDefaultEntityContainer(false);
-
- EdmEntitySetInfo info = new EdmEntitySetInfoImplProv(entitySet, entityContainerInfo);
-
- assertEquals(entitySetName, info.getEntitySetName());
- assertEquals(entitySetUri.toASCIIString(), info.getEntitySetUri().toASCIIString());
- assertEquals(entityContainerName, info.getEntityContainerName());
- assertFalse(info.isDefaultEntityContainer());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntitySetProvTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntitySetProvTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntitySetProvTest.java
deleted file mode 100644
index c843f7d..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntitySetProvTest.java
+++ /dev/null
@@ -1,147 +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.odata2.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.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
-import org.apache.olingo.odata2.api.edm.EdmAnnotations;
-import org.apache.olingo.odata2.api.edm.EdmEntitySet;
-import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
-import org.apache.olingo.odata2.api.edm.EdmTyped;
-import org.apache.olingo.odata2.api.edm.FullQualifiedName;
-import org.apache.olingo.odata2.api.edm.provider.Association;
-import org.apache.olingo.odata2.api.edm.provider.AssociationEnd;
-import org.apache.olingo.odata2.api.edm.provider.AssociationSet;
-import org.apache.olingo.odata2.api.edm.provider.AssociationSetEnd;
-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.EntitySet;
-import org.apache.olingo.odata2.api.edm.provider.EntityType;
-import org.apache.olingo.odata2.api.edm.provider.NavigationProperty;
-import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- *
- *
- */
-public class EdmEntitySetProvTest extends BaseTest {
-
- private static EdmEntitySetImplProv edmEntitySetFoo;
- private static EdmEntitySetImplProv edmEnitiySetBar;
- private static EdmProvider edmProvider;
-
- @BeforeClass
- public static void getEdmEntityContainerImpl() throws Exception {
-
- edmProvider = mock(EdmProvider.class);
- EdmImplProv edmImplProv = new EdmImplProv(edmProvider);
-
- EntityContainerInfo entityContainer = new EntityContainerInfo().setName("Container");
- when(edmProvider.getEntityContainerInfo("Container")).thenReturn(entityContainer);
- EdmEntityContainerImplProv edmEntityContainer = new EdmEntityContainerImplProv(edmImplProv, entityContainer);
-
- EntitySet entitySetFoo = new EntitySet().setName("foo");
- when(edmProvider.getEntitySet("Container", "foo")).thenReturn(entitySetFoo);
-
- List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>();
- FullQualifiedName fooBarAssocName = new FullQualifiedName("namespace", "fooBarAssoc");
- navigationProperties.add(new NavigationProperty().setName("fooBarNav").setFromRole("fromFoo").setRelationship(
- fooBarAssocName).setToRole("toBar"));
-
- EntityType fooEntityType = new EntityType().setName("fooEntityType").setNavigationProperties(navigationProperties);
- FullQualifiedName fooEntityTypeFullName = new FullQualifiedName("namespace", "fooEntityType");
- entitySetFoo.setEntityType(fooEntityTypeFullName);
- when(edmProvider.getEntityType(fooEntityTypeFullName)).thenReturn(fooEntityType);
-
- EntitySet entitySetBar = new EntitySet().setName("bar");
- when(edmProvider.getEntitySet("Container", "bar")).thenReturn(entitySetBar);
-
- EntityType barEntityType = new EntityType().setName("barEntityType");
- FullQualifiedName barEntityTypeFullName = new FullQualifiedName("namespace", "barEntityType");
- entitySetBar.setEntityType(barEntityTypeFullName);
- when(edmProvider.getEntityType(barEntityTypeFullName)).thenReturn(barEntityType);
-
- AssociationEnd fooEnd = new AssociationEnd().setRole("fromFoo");
- AssociationEnd barEnd = new AssociationEnd().setRole("toBar");
-
- Association fooBarAssoc = new Association().setName("fooBarAssoc").setEnd1(fooEnd).setEnd2(barEnd);
- when(edmProvider.getAssociation(fooBarAssocName)).thenReturn(fooBarAssoc);
-
- AssociationSet associationSet =
- new AssociationSet().setName("fooBarRelation").setEnd1(
- new AssociationSetEnd().setRole("fromFoo").setEntitySet("foo")).setEnd2(
- new AssociationSetEnd().setRole("toBar").setEntitySet("bar"));
- FullQualifiedName assocFQName = new FullQualifiedName("namespace", "fooBarAssoc");
- when(edmProvider.getAssociationSet("Container", assocFQName, "foo", "fromFoo")).thenReturn(associationSet);
-
- edmEntitySetFoo = new EdmEntitySetImplProv(edmImplProv, entitySetFoo, edmEntityContainer);
- edmEnitiySetBar = new EdmEntitySetImplProv(edmImplProv, entitySetBar, edmEntityContainer);
- }
-
- @Test
- public void testEntitySet1() throws Exception {
- assertEquals("foo", edmEntitySetFoo.getName());
- assertEquals("Container", edmEntitySetFoo.getEntityContainer().getName());
- }
-
- @Test
- public void testEntitySet2() throws Exception {
- assertEquals("bar", edmEnitiySetBar.getName());
- assertEquals("Container", edmEnitiySetBar.getEntityContainer().getName());
- }
-
- @Test
- public void testEntitySetNavigation() throws Exception {
- List<String> navPropertyyNames = edmEntitySetFoo.getEntityType().getNavigationPropertyNames();
- assertTrue(navPropertyyNames.contains("fooBarNav"));
- EdmTyped navProperty = edmEntitySetFoo.getEntityType().getProperty("fooBarNav");
- assertNotNull(navProperty);
-
- EdmEntitySet relatedEntitySet = edmEntitySetFoo.getRelatedEntitySet((EdmNavigationProperty) navProperty);
-
- assertEquals(edmEnitiySetBar.getName(), relatedEntitySet.getName());
- }
-
- @Test
- public void testEntitySetType() throws Exception {
- assertEquals("fooEntityType", edmEntitySetFoo.getEntityType().getName());
- assertEquals(edmEntitySetFoo.getEntityType().getName(), edmProvider.getEntityType(
- new FullQualifiedName("namespace", "fooEntityType")).getName());
- }
-
- @Test
- public void getAnnotations() throws Exception {
- EdmAnnotatable annotatable = edmEntitySetFoo;
- EdmAnnotations annotations = annotatable.getAnnotations();
- assertNull(annotations.getAnnotationAttributes());
- assertNull(annotations.getAnnotationElements());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntityTypeImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntityTypeImplProvTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntityTypeImplProvTest.java
deleted file mode 100644
index b264296..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmEntityTypeImplProvTest.java
+++ /dev/null
@@ -1,180 +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.odata2.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.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
-import org.apache.olingo.odata2.api.edm.EdmAnnotations;
-import org.apache.olingo.odata2.api.edm.EdmProperty;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import org.apache.olingo.odata2.api.edm.FullQualifiedName;
-import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata2.api.edm.provider.EntityType;
-import org.apache.olingo.odata2.api.edm.provider.Key;
-import org.apache.olingo.odata2.api.edm.provider.NavigationProperty;
-import org.apache.olingo.odata2.api.edm.provider.Property;
-import org.apache.olingo.odata2.api.edm.provider.PropertyRef;
-import org.apache.olingo.odata2.api.edm.provider.SimpleProperty;
-import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- *
- */
-public class EdmEntityTypeImplProvTest extends BaseTest {
-
- private static EdmEntityTypeImplProv edmEntityType;
- private static EdmEntityTypeImplProv edmEntityTypeWithBaseType;
- private static EdmProvider edmProvider;
-
- @BeforeClass
- public static void getEdmEntityContainerImpl() throws Exception {
-
- edmProvider = mock(EdmProvider.class);
- EdmImplProv edmImplProv = new EdmImplProv(edmProvider);
-
- List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>();
- FullQualifiedName fooBarAssocName = new FullQualifiedName("namespace", "fooBarAssoc");
- navigationProperties.add(new NavigationProperty().setName("fooBarNav").setFromRole("fromFoo").setRelationship(
- fooBarAssocName).setToRole("toBar"));
-
- EntityType fooEntityType = new EntityType().setName("fooEntityType").setNavigationProperties(navigationProperties);
- FullQualifiedName fooEntityTypeFullName = new FullQualifiedName("namespace", "fooEntityType");
- when(edmProvider.getEntityType(fooEntityTypeFullName)).thenReturn(fooEntityType);
-
- List<Property> keyPropertysFoo = new ArrayList<Property>();
- Property keyPropFoo = new SimpleProperty().setName("Id").setType(EdmSimpleTypeKind.String);
- keyPropertysFoo.add(keyPropFoo);
- fooEntityType.setProperties(keyPropertysFoo);
-
- PropertyRef refToKeyFoo = new PropertyRef().setName("Id");
- List<PropertyRef> propRefKeysFoo = new ArrayList<PropertyRef>();
- propRefKeysFoo.add(refToKeyFoo);
-
- Key fooTypeKey = new Key().setKeys(propRefKeysFoo);
- fooEntityType.setKey(fooTypeKey);
-
- edmEntityType = new EdmEntityTypeImplProv(edmImplProv, fooEntityType, "namespace");
-
- FullQualifiedName barBaseTypeName = new FullQualifiedName("namespace", "barBase");
- EntityType barBase = new EntityType().setName("barBase");
- when(edmProvider.getEntityType(barBaseTypeName)).thenReturn(barBase);
-
- List<NavigationProperty> navigationPropertiesBarBase = new ArrayList<NavigationProperty>();
- navigationPropertiesBarBase.add(new NavigationProperty().setName("barBaseNav"));
- barBase.setNavigationProperties(navigationPropertiesBarBase);
-
- List<Property> keyPropertysBarBase = new ArrayList<Property>();
- Property keyPropBarBase = new SimpleProperty().setName("Id").setType(EdmSimpleTypeKind.String);
- keyPropertysBarBase.add(keyPropBarBase);
- barBase.setProperties(keyPropertysBarBase);
-
- PropertyRef refToKeyBarBase = new PropertyRef().setName("Id");
- List<PropertyRef> propRefKeysBarBase = new ArrayList<PropertyRef>();
- propRefKeysBarBase.add(refToKeyBarBase);
-
- Key barBaseTypeKey = new Key().setKeys(propRefKeysBarBase);
- barBase.setKey(barBaseTypeKey);
-
- EntityType barEntityType = new EntityType().setName("barEntityType").setBaseType(barBaseTypeName);
- FullQualifiedName barEntityTypeFullName = new FullQualifiedName("namespace", "barEntityType");
- when(edmProvider.getEntityType(barEntityTypeFullName)).thenReturn(barEntityType);
-
- edmEntityTypeWithBaseType = new EdmEntityTypeImplProv(edmImplProv, barEntityType, "namespace");
-
- }
-
- @Test
- public void getKeyProperties() throws Exception {
- List<EdmProperty> keyProperties = edmEntityType.getKeyProperties();
- assertNotNull(keyProperties);
- assertEquals("Id", keyProperties.get(0).getName());
- }
-
- @Test
- public void getKeyPropertiesNames() throws Exception {
- List<String> keyProperties = edmEntityType.getKeyPropertyNames();
- assertNotNull(keyProperties);
- assertTrue(keyProperties.contains("Id"));
-
- List<String> properties = edmEntityType.getPropertyNames();
- assertNotNull(properties);
- assertTrue(properties.contains("Id"));
- }
-
- @Test
- public void getPropertiesNames() throws Exception {
- List<String> properties = edmEntityType.getPropertyNames();
- assertNotNull(properties);
- assertTrue(properties.contains("Id"));
- }
-
- @Test
- public void getNavProperties() throws Exception {
- List<String> navProperties = edmEntityType.getNavigationPropertyNames();
- assertNotNull(navProperties);
- assertTrue(navProperties.contains("fooBarNav"));
- }
-
- @Test
- public void getKeyPropertiesWithBaseType() throws Exception {
- List<EdmProperty> keyProperties = edmEntityTypeWithBaseType.getKeyProperties();
- assertNotNull(keyProperties);
- assertEquals("Id", keyProperties.get(0).getName());
- }
-
- @Test
- public void getKeyPropertiesNamesWithBaseType() throws Exception {
- List<String> keyProperties = edmEntityTypeWithBaseType.getKeyPropertyNames();
- assertNotNull(keyProperties);
- assertTrue(keyProperties.contains("Id"));
- }
-
- @Test
- public void getPropertiesWithBaseType() throws Exception {
- List<String> properties = edmEntityTypeWithBaseType.getPropertyNames();
- assertNotNull(properties);
- assertTrue(properties.contains("Id"));
- }
-
- @Test
- public void getNavPropertiesWithBaseType() throws Exception {
- List<String> navProperties = edmEntityTypeWithBaseType.getNavigationPropertyNames();
- assertNotNull(navProperties);
- assertTrue(navProperties.contains("barBaseNav"));
- }
-
- @Test
- public void getAnnotations() throws Exception {
- EdmAnnotatable annotatable = edmEntityType;
- EdmAnnotations annotations = annotatable.getAnnotations();
- assertNull(annotations.getAnnotationAttributes());
- assertNull(annotations.getAnnotationElements());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmFunctionImportImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmFunctionImportImplProvTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmFunctionImportImplProvTest.java
deleted file mode 100644
index aabf45b..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmFunctionImportImplProvTest.java
+++ /dev/null
@@ -1,181 +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.odata2.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.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
-import org.apache.olingo.odata2.api.edm.EdmAnnotations;
-import org.apache.olingo.odata2.api.edm.EdmEntitySet;
-import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
-import org.apache.olingo.odata2.api.edm.EdmParameter;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import org.apache.olingo.odata2.api.edm.EdmTyped;
-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.EntitySet;
-import org.apache.olingo.odata2.api.edm.provider.FunctionImport;
-import org.apache.olingo.odata2.api.edm.provider.FunctionImportParameter;
-import org.apache.olingo.odata2.api.edm.provider.ReturnType;
-import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.eclipse.jetty.http.HttpMethods;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- *
- */
-public class EdmFunctionImportImplProvTest extends BaseTest {
-
- private static EdmFunctionImportImplProv edmFunctionImport;
- private static EdmFunctionImportImplProv edmFunctionImportWithoutParameters;
- private static EdmEntityContainerImplProv edmEntityContainer;
-
- @BeforeClass
- public static void getEdmEntityContainerImpl() throws Exception {
- EdmProvider edmProvider = mock(EdmProvider.class);
- EdmImplProv edmImplProv = new EdmImplProv(edmProvider);
-
- EntityContainerInfo containerInfo = new EntityContainerInfo().setName("Container");
- when(edmProvider.getEntityContainerInfo("Container")).thenReturn(containerInfo);
- edmEntityContainer = new EdmEntityContainerImplProv(edmImplProv, containerInfo);
-
- EntitySet fooEntitySet = new EntitySet().setName("fooEntitySet");
- when(edmProvider.getEntitySet("Container", "fooEntitySet")).thenReturn(fooEntitySet);
-
- ReturnType fooReturnType =
- new ReturnType().setTypeName(EdmSimpleTypeKind.String.getFullQualifiedName()).setMultiplicity(
- EdmMultiplicity.ONE);
-
- List<FunctionImportParameter> parameters = new ArrayList<FunctionImportParameter>();
- FunctionImportParameter parameter =
- new FunctionImportParameter().setName("fooParameter1").setType(EdmSimpleTypeKind.String);
- parameters.add(parameter);
-
- parameter = new FunctionImportParameter().setName("fooParameter2").setType(EdmSimpleTypeKind.String);
- parameters.add(parameter);
-
- parameter = new FunctionImportParameter().setName("fooParameter3").setType(EdmSimpleTypeKind.String);
- parameters.add(parameter);
-
- FunctionImport functionImportFoo =
- new FunctionImport().setName("foo").setHttpMethod(HttpMethods.GET).setReturnType(fooReturnType).setEntitySet(
- "fooEntitySet").setParameters(parameters);
- when(edmProvider.getFunctionImport("Container", "foo")).thenReturn(functionImportFoo);
- edmFunctionImport = new EdmFunctionImportImplProv(edmImplProv, functionImportFoo, edmEntityContainer);
-
- FunctionImport functionImportBar = new FunctionImport().setName("bar").setHttpMethod(HttpMethods.GET);
- when(edmProvider.getFunctionImport("Container", "bar")).thenReturn(functionImportBar);
- edmFunctionImportWithoutParameters =
- new EdmFunctionImportImplProv(edmImplProv, functionImportBar, edmEntityContainer);
-
- }
-
- @Test
- public void functionImport() throws Exception {
- assertEquals("foo", edmFunctionImport.getName());
- assertEquals(HttpMethods.GET, edmFunctionImport.getHttpMethod());
-
- }
-
- @Test
- public void containerName() throws Exception {
- assertEquals(edmEntityContainer, edmFunctionImport.getEntityContainer());
- }
-
- @Test
- public void returnType() throws Exception {
- EdmTyped returnType = edmFunctionImport.getReturnType();
- assertNotNull(returnType);
- assertEquals(EdmSimpleTypeKind.String.getFullQualifiedName().getName(), returnType.getType().getName());
- assertEquals(EdmMultiplicity.ONE, returnType.getMultiplicity());
- }
-
- @Test
- public void entitySet() throws Exception {
- EdmEntitySet entitySet = edmFunctionImport.getEntitySet();
- assertNotNull(entitySet);
- assertEquals("fooEntitySet", entitySet.getName());
- assertEquals(edmEntityContainer.getEntitySet("fooEntitySet"), entitySet);
- }
-
- @Test
- public void parameterExisting() throws Exception {
- List<String> parameterNames = edmFunctionImport.getParameterNames();
- assertTrue(parameterNames.contains("fooParameter1"));
- assertTrue(parameterNames.contains("fooParameter2"));
- assertTrue(parameterNames.contains("fooParameter3"));
-
- EdmParameter parameter = edmFunctionImport.getParameter("fooParameter1");
- assertNotNull(parameter);
- assertEquals("fooParameter1", parameter.getName());
-
- parameter = edmFunctionImport.getParameter("fooParameter1");
- assertNotNull(parameter);
- assertEquals("fooParameter1", parameter.getName());
-
- parameter = edmFunctionImport.getParameter("fooParameter2");
- assertNotNull(parameter);
- assertEquals("fooParameter2", parameter.getName());
-
- parameter = edmFunctionImport.getParameter("fooParameter3");
- assertNotNull(parameter);
- assertEquals("fooParameter3", parameter.getName());
- }
-
- @Test
- public void parameterNotExisting() throws Exception {
- assertNotNull(edmFunctionImportWithoutParameters.getParameterNames());
-
- EdmParameter parameter = edmFunctionImportWithoutParameters.getParameter("fooParameter1");
- assertNull(parameter);
-
- parameter = edmFunctionImportWithoutParameters.getParameter("fooParameter2");
- assertNull(parameter);
-
- parameter = edmFunctionImportWithoutParameters.getParameter("fooParameter3");
- assertNull(parameter);
- }
-
- @Test
- public void parameterAnnotations() throws Exception {
- EdmParameter parameter = edmFunctionImport.getParameter("fooParameter1");
- assertNotNull(parameter);
- EdmAnnotatable annotatable = (EdmAnnotatable) parameter;
- EdmAnnotations annotations = annotatable.getAnnotations();
- assertNull(annotations.getAnnotationAttributes());
- assertNull(annotations.getAnnotationElements());
- }
-
- @Test
- public void getAnnotations() throws Exception {
- EdmAnnotatable annotatable = edmFunctionImport;
- EdmAnnotations annotations = annotatable.getAnnotations();
- assertNull(annotations.getAnnotationAttributes());
- assertNull(annotations.getAnnotationElements());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmImplProvTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmImplProvTest.java
deleted file mode 100644
index 5552d94..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmImplProvTest.java
+++ /dev/null
@@ -1,79 +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.odata2.core.edm.provider;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import org.apache.olingo.odata2.api.edm.EdmException;
-import org.apache.olingo.odata2.api.edm.FullQualifiedName;
-import org.apache.olingo.odata2.api.edm.provider.Association;
-import org.apache.olingo.odata2.api.edm.provider.ComplexType;
-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.Test;
-
-public class EdmImplProvTest extends BaseTest {
-
- private static EdmImplProv edm;
-
- @BeforeClass
- public static void getEdmImpl() throws Exception {
- EdmProvider edmProvider = mock(EdmProvider.class);
-
- EntityType entityType = new EntityType().setName("EntityType1");
- when(edmProvider.getEntityType(new FullQualifiedName("EntityType1Ns", "EntityType1"))).thenReturn(entityType);
-
- ComplexType complexType = new ComplexType().setName("ComplexType1");
- when(edmProvider.getComplexType(new FullQualifiedName("ComplexType1Ns", "ComplexType1"))).thenReturn(complexType);
-
- Association association = new Association().setName("Association1");
- when(edmProvider.getAssociation(new FullQualifiedName("Association1Ns", "Association1"))).thenReturn(association);
-
- EntityContainerInfo defaultEntityContainer = new EntityContainerInfo().setName("Container1");
- when(edmProvider.getEntityContainerInfo(null)).thenReturn(defaultEntityContainer);
- when(edmProvider.getEntityContainerInfo("Container1")).thenReturn(defaultEntityContainer);
-
- edm = new EdmImplProv(edmProvider);
- }
-
- @Test
- public void testEntityType() throws EdmException {
- assertEquals("EntityType1", edm.getEntityType("EntityType1Ns", "EntityType1").getName());
- }
-
- @Test
- public void testComplexType() throws EdmException {
- assertEquals("ComplexType1", edm.getComplexType("ComplexType1Ns", "ComplexType1").getName());
- }
-
- @Test
- public void testAssociation() throws EdmException {
- assertEquals("Association1", edm.getAssociation("Association1Ns", "Association1").getName());
- }
-
- @Test
- public void testDefaultEntityContainer() throws EdmException {
- assertEquals(edm.getEntityContainer("Container1"), edm.getDefaultEntityContainer());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmMappingTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmMappingTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmMappingTest.java
deleted file mode 100644
index 62da2e7..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmMappingTest.java
+++ /dev/null
@@ -1,83 +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.odata2.core.edm.provider;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Mockito.mock;
-
-import org.apache.olingo.odata2.api.edm.EdmMapping;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import org.apache.olingo.odata2.api.edm.provider.CustomizableFeedMappings;
-import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata2.api.edm.provider.Mapping;
-import org.apache.olingo.odata2.api.edm.provider.NavigationProperty;
-import org.apache.olingo.odata2.api.edm.provider.SimpleProperty;
-import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class EdmMappingTest extends BaseTest {
-
- private static EdmPropertyImplProv propertySimpleProvider;
- private static EdmNavigationPropertyImplProv navPropertyProvider;
- private static EdmMappingTest mappedObject;
-
- @BeforeClass
- public static void setup() throws Exception {
-
- EdmProvider edmProvider = mock(EdmProvider.class);
- EdmImplProv edmImplProv = new EdmImplProv(edmProvider);
-
- mappedObject = new EdmMappingTest();
-
- Mapping propertySimpleMapping =
- new Mapping().setMimeType("mimeType").setInternalName("value").setObject(mappedObject);
- CustomizableFeedMappings propertySimpleFeedMappings = new CustomizableFeedMappings().setFcKeepInContent(true);
- SimpleProperty propertySimple =
- new SimpleProperty().setName("PropertyName").setType(EdmSimpleTypeKind.String)
- .setMimeType("mimeType").setMapping(propertySimpleMapping).setCustomizableFeedMappings(
- propertySimpleFeedMappings);
- propertySimpleProvider = new EdmSimplePropertyImplProv(edmImplProv, propertySimple);
-
- NavigationProperty navProperty =
- new NavigationProperty().setName("navProperty").setFromRole("fromRole").setToRole("toRole").setMapping(
- propertySimpleMapping);
- navPropertyProvider = new EdmNavigationPropertyImplProv(edmImplProv, navProperty);
- }
-
- @Test
- public void testMappingProperty() throws Exception {
- EdmMapping mapping = propertySimpleProvider.getMapping();
- assertNotNull(mapping);
- assertEquals("value", mapping.getInternalName());
- assertEquals("mimeType", mapping.getMimeType());
- assertEquals(mappedObject, mapping.getObject());
- }
-
- @Test
- public void testMappingNavigationProperty() throws Exception {
- EdmMapping mapping = navPropertyProvider.getMapping();
- assertNotNull(mapping);
- assertEquals("value", mapping.getInternalName());
- assertEquals("mimeType", mapping.getMimeType());
- assertEquals(mappedObject, mapping.getObject());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmNamedImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmNamedImplProvTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmNamedImplProvTest.java
deleted file mode 100644
index 0691e97..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmNamedImplProvTest.java
+++ /dev/null
@@ -1,41 +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.odata2.core.edm.provider;
-
-import static org.mockito.Mockito.mock;
-
-import org.apache.olingo.odata2.api.edm.EdmException;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata2.api.edm.provider.SimpleProperty;
-import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.junit.Test;
-
-public class EdmNamedImplProvTest extends BaseTest {
-
- @Test(expected = EdmException.class)
- public void testPropertySimple() throws Exception {
-
- EdmProvider edmProvider = mock(EdmProvider.class);
- EdmImplProv edmImplProv = new EdmImplProv(edmProvider);
-
- SimpleProperty propertySimple = new SimpleProperty().setName("Prop;ertyName").setType(EdmSimpleTypeKind.String);
- new EdmSimplePropertyImplProv(edmImplProv, propertySimple);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmNavigationPropertyImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmNavigationPropertyImplProvTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmNavigationPropertyImplProvTest.java
deleted file mode 100644
index c9a12aa..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmNavigationPropertyImplProvTest.java
+++ /dev/null
@@ -1,95 +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.odata2.core.edm.provider;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
-import org.apache.olingo.odata2.api.edm.EdmAnnotations;
-import org.apache.olingo.odata2.api.edm.EdmAssociation;
-import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
-import org.apache.olingo.odata2.api.edm.FullQualifiedName;
-import org.apache.olingo.odata2.api.edm.provider.Association;
-import org.apache.olingo.odata2.api.edm.provider.AssociationEnd;
-import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata2.api.edm.provider.EntityType;
-import org.apache.olingo.odata2.api.edm.provider.NavigationProperty;
-import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- *
- */
-public class EdmNavigationPropertyImplProvTest extends BaseTest {
-
- private static EdmProvider edmProvider;
- private static EdmNavigationPropertyImplProv navPropertyProvider;
-
- @BeforeClass
- public static void setup() throws Exception {
-
- edmProvider = mock(EdmProvider.class);
- EdmImplProv edmImplProv = new EdmImplProv(edmProvider);
-
- FullQualifiedName relationship = new FullQualifiedName("namespace", "associationName");
- Association association = new Association().setName("associationName");
- when(edmProvider.getAssociation(relationship)).thenReturn(association);
-
- AssociationEnd end1 = new AssociationEnd().setRole("fromRole");
- FullQualifiedName entityName = new FullQualifiedName("namespace", "entityName");
- AssociationEnd end2 =
- new AssociationEnd().setRole("toRole").setMultiplicity(EdmMultiplicity.ONE).setType(entityName);
- association.setEnd1(end1).setEnd2(end2);
-
- EntityType entityType = new EntityType().setName("entityName");
- when(edmProvider.getEntityType(entityName)).thenReturn(entityType);
-
- NavigationProperty navProperty =
- new NavigationProperty().setName("navProperty").setFromRole("fromRole").setToRole("toRole").setRelationship(
- relationship);
- navPropertyProvider = new EdmNavigationPropertyImplProv(edmImplProv, navProperty);
- }
-
- @Test
- public void testNavigationProperty() throws Exception {
- assertNotNull(navPropertyProvider);
- assertEquals("navProperty", navPropertyProvider.getName());
- assertEquals("fromRole", navPropertyProvider.getFromRole());
- assertEquals("toRole", navPropertyProvider.getToRole());
- assertEquals(EdmMultiplicity.ONE, navPropertyProvider.getMultiplicity());
- assertEquals("entityName", navPropertyProvider.getType().getName());
-
- EdmAssociation association = navPropertyProvider.getRelationship();
- assertNotNull(association);
- assertEquals("associationName", association.getName());
- }
-
- @Test
- public void getAnnotations() throws Exception {
- EdmAnnotatable annotatable = navPropertyProvider;
- EdmAnnotations annotations = annotatable.getAnnotations();
- assertNull(annotations.getAnnotationAttributes());
- assertNull(annotations.getAnnotationElements());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/57599da6/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmPropertyImplProvTest.java
----------------------------------------------------------------------
diff --git a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmPropertyImplProvTest.java b/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmPropertyImplProvTest.java
deleted file mode 100644
index 79ef3a6..0000000
--- a/odata-core/src/test/java/org/apache/olingo/odata2/core/edm/provider/EdmPropertyImplProvTest.java
+++ /dev/null
@@ -1,131 +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.odata2.core.edm.provider;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
-import org.apache.olingo.odata2.api.edm.EdmAnnotations;
-import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
-import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
-import org.apache.olingo.odata2.api.edm.EdmTypeKind;
-import org.apache.olingo.odata2.api.edm.FullQualifiedName;
-import org.apache.olingo.odata2.api.edm.provider.ComplexProperty;
-import org.apache.olingo.odata2.api.edm.provider.ComplexType;
-import org.apache.olingo.odata2.api.edm.provider.CustomizableFeedMappings;
-import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata2.api.edm.provider.Facets;
-import org.apache.olingo.odata2.api.edm.provider.Mapping;
-import org.apache.olingo.odata2.api.edm.provider.SimpleProperty;
-import org.apache.olingo.odata2.core.edm.EdmSimpleTypeFacadeImpl;
-import org.apache.olingo.odata2.testutil.fit.BaseTest;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- *
- */
-public class EdmPropertyImplProvTest extends BaseTest {
-
- private static EdmProvider edmProvider;
- private static EdmPropertyImplProv propertySimpleProvider;
- private static EdmPropertyImplProv propertySimpleWithFacetsProvider;
- private static EdmPropertyImplProv propertySimpleWithFacetsProvider2;
- private static EdmPropertyImplProv propertyComplexProvider;
-
- @BeforeClass
- public static void setup() throws Exception {
-
- edmProvider = mock(EdmProvider.class);
- EdmImplProv edmImplProv = new EdmImplProv(edmProvider);
-
- Mapping propertySimpleMapping = new Mapping().setMimeType("mimeType2").setInternalName("value");
- CustomizableFeedMappings propertySimpleFeedMappings = new CustomizableFeedMappings().setFcKeepInContent(true);
- SimpleProperty propertySimple =
- new SimpleProperty().setName("PropertyName").setType(EdmSimpleTypeKind.String)
- .setMimeType("mimeType").setMapping(propertySimpleMapping).setCustomizableFeedMappings(
- propertySimpleFeedMappings);
- propertySimpleProvider = new EdmSimplePropertyImplProv(edmImplProv, propertySimple);
-
- Facets facets = new Facets().setNullable(false);
- SimpleProperty propertySimpleWithFacets =
- new SimpleProperty().setName("PropertyName").setType(EdmSimpleTypeKind.String).setFacets(facets);
- propertySimpleWithFacetsProvider = new EdmSimplePropertyImplProv(edmImplProv, propertySimpleWithFacets);
-
- Facets facets2 = new Facets().setNullable(true);
- SimpleProperty propertySimpleWithFacets2 =
- new SimpleProperty().setName("PropertyName").setType(EdmSimpleTypeKind.String).setFacets(facets2);
- propertySimpleWithFacetsProvider2 = new EdmSimplePropertyImplProv(edmImplProv, propertySimpleWithFacets2);
-
- ComplexType complexType = new ComplexType().setName("complexType");
- FullQualifiedName complexName = new FullQualifiedName("namespace", "complexType");
- when(edmProvider.getComplexType(complexName)).thenReturn(complexType);
-
- ComplexProperty propertyComplex = new ComplexProperty().setName("complexProperty").setType(complexName);
- propertyComplexProvider = new EdmComplexPropertyImplProv(edmImplProv, propertyComplex);
-
- }
-
- @Test
- public void testPropertySimple() throws Exception {
- assertNotNull(propertySimpleProvider);
- assertEquals("PropertyName", propertySimpleProvider.getName());
- assertNotNull(propertySimpleProvider.getType());
- assertEquals(EdmSimpleTypeFacadeImpl.getEdmSimpleType(EdmSimpleTypeKind.String), propertySimpleProvider.getType());
- assertEquals("mimeType", propertySimpleProvider.getMimeType());
- assertNotNull(propertySimpleProvider.getMapping());
- assertEquals("mimeType2", propertySimpleProvider.getMapping().getMimeType());
- assertNotNull(propertySimpleProvider.getCustomizableFeedMappings());
- assertEquals("value", propertySimpleProvider.getMapping().getInternalName());
- assertNull(propertySimpleProvider.getFacets());
- assertNotNull(propertySimpleProvider.getMultiplicity());
- assertEquals(EdmMultiplicity.ZERO_TO_ONE, propertySimpleProvider.getMultiplicity());
- }
-
- @Test
- public void testPropertySimpleWithFacets() throws Exception {
- assertNotNull(propertySimpleWithFacetsProvider.getFacets());
- assertNotNull(propertySimpleWithFacetsProvider.getMultiplicity());
- assertEquals(EdmMultiplicity.ONE, propertySimpleWithFacetsProvider.getMultiplicity());
-
- assertNotNull(propertySimpleWithFacetsProvider2.getFacets());
- assertNotNull(propertySimpleWithFacetsProvider2.getMultiplicity());
- assertEquals(EdmMultiplicity.ZERO_TO_ONE, propertySimpleWithFacetsProvider2.getMultiplicity());
- }
-
- @Test
- public void testPropertyComplex() throws Exception {
- assertNotNull(propertyComplexProvider);
- assertEquals("complexProperty", propertyComplexProvider.getName());
- assertEquals(EdmTypeKind.COMPLEX, propertyComplexProvider.getType().getKind());
- assertEquals("complexType", propertyComplexProvider.getType().getName());
- }
-
- @Test
- public void getAnnotations() throws Exception {
- EdmAnnotatable annotatable = propertySimpleProvider;
- EdmAnnotations annotations = annotatable.getAnnotations();
- assertNull(annotations.getAnnotationAttributes());
- assertNull(annotations.getAnnotationElements());
- }
-}