You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2013/12/28 15:18:08 UTC
[10/31] [OLINGO-99] Re-factor Package Names. Following are the changes
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEmbeddableMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEmbeddableMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEmbeddableMock.java
new file mode 100644
index 0000000..f9c57b5
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEmbeddableMock.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * 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.jpa.processor.core.mock.model;
+
+import java.util.Set;
+
+import javax.persistence.metamodel.Attribute;
+import javax.persistence.metamodel.CollectionAttribute;
+import javax.persistence.metamodel.EmbeddableType;
+import javax.persistence.metamodel.ListAttribute;
+import javax.persistence.metamodel.MapAttribute;
+import javax.persistence.metamodel.PluralAttribute;
+import javax.persistence.metamodel.SetAttribute;
+import javax.persistence.metamodel.SingularAttribute;
+
+public class JPAEmbeddableMock<X> implements EmbeddableType<X> {
+
+ @Override
+ public Attribute<? super X, ?> getAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public Set<Attribute<? super X, ?>> getAttributes() {
+ return null;
+ }
+
+ @Override
+ public CollectionAttribute<? super X, ?> getCollection(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> CollectionAttribute<? super X, E> getCollection(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public Attribute<X, ?> getDeclaredAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public Set<Attribute<X, ?>> getDeclaredAttributes() {
+ return null;
+ }
+
+ @Override
+ public CollectionAttribute<X, ?> getDeclaredCollection(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> CollectionAttribute<X, E> getDeclaredCollection(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public ListAttribute<X, ?> getDeclaredList(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> ListAttribute<X, E> getDeclaredList(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public MapAttribute<X, ?, ?> getDeclaredMap(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <K, V> MapAttribute<X, K, V> getDeclaredMap(final String arg0, final Class<K> arg1, final Class<V> arg2) {
+ return null;
+ }
+
+ @Override
+ public Set<PluralAttribute<X, ?, ?>> getDeclaredPluralAttributes() {
+ return null;
+ }
+
+ @Override
+ public SetAttribute<X, ?> getDeclaredSet(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> SetAttribute<X, E> getDeclaredSet(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public SingularAttribute<X, ?> getDeclaredSingularAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <Y> SingularAttribute<X, Y> getDeclaredSingularAttribute(final String arg0, final Class<Y> arg1) {
+ return null;
+ }
+
+ @Override
+ public Set<SingularAttribute<X, ?>> getDeclaredSingularAttributes() {
+ return null;
+ }
+
+ @Override
+ public ListAttribute<? super X, ?> getList(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> ListAttribute<? super X, E> getList(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public MapAttribute<? super X, ?, ?> getMap(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <K, V> MapAttribute<? super X, K, V> getMap(final String arg0, final Class<K> arg1, final Class<V> arg2) {
+ return null;
+ }
+
+ @Override
+ public Set<PluralAttribute<? super X, ?, ?>> getPluralAttributes() {
+ return null;
+ }
+
+ @Override
+ public SetAttribute<? super X, ?> getSet(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> SetAttribute<? super X, E> getSet(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public SingularAttribute<? super X, ?> getSingularAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <Y> SingularAttribute<? super X, Y> getSingularAttribute(final String arg0, final Class<Y> arg1) {
+ return null;
+ }
+
+ @Override
+ public Set<SingularAttribute<? super X, ?>> getSingularAttributes() {
+ return null;
+ }
+
+ @Override
+ public Class<X> getJavaType() {
+ return null;
+ }
+
+ @Override
+ public javax.persistence.metamodel.Type.PersistenceType getPersistenceType() {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEmbeddableTypeMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEmbeddableTypeMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEmbeddableTypeMock.java
new file mode 100644
index 0000000..f7383ce
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEmbeddableTypeMock.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * 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.jpa.processor.core.mock.model;
+
+import java.util.Set;
+
+import javax.persistence.metamodel.Attribute;
+import javax.persistence.metamodel.CollectionAttribute;
+import javax.persistence.metamodel.EmbeddableType;
+import javax.persistence.metamodel.ListAttribute;
+import javax.persistence.metamodel.MapAttribute;
+import javax.persistence.metamodel.PluralAttribute;
+import javax.persistence.metamodel.SetAttribute;
+import javax.persistence.metamodel.SingularAttribute;
+
+public class JPAEmbeddableTypeMock<X> implements EmbeddableType<X> {
+
+ @Override
+ public Attribute<? super X, ?> getAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public Set<Attribute<? super X, ?>> getAttributes() {
+ return null;
+ }
+
+ @Override
+ public CollectionAttribute<? super X, ?> getCollection(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> CollectionAttribute<? super X, E> getCollection(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public Attribute<X, ?> getDeclaredAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public Set<Attribute<X, ?>> getDeclaredAttributes() {
+ return null;
+ }
+
+ @Override
+ public CollectionAttribute<X, ?> getDeclaredCollection(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> CollectionAttribute<X, E> getDeclaredCollection(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public ListAttribute<X, ?> getDeclaredList(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> ListAttribute<X, E> getDeclaredList(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public MapAttribute<X, ?, ?> getDeclaredMap(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <K, V> MapAttribute<X, K, V> getDeclaredMap(final String arg0, final Class<K> arg1, final Class<V> arg2) {
+ return null;
+ }
+
+ @Override
+ public Set<PluralAttribute<X, ?, ?>> getDeclaredPluralAttributes() {
+ return null;
+ }
+
+ @Override
+ public SetAttribute<X, ?> getDeclaredSet(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> SetAttribute<X, E> getDeclaredSet(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public SingularAttribute<X, ?> getDeclaredSingularAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <Y> SingularAttribute<X, Y> getDeclaredSingularAttribute(final String arg0, final Class<Y> arg1) {
+ return null;
+ }
+
+ @Override
+ public Set<SingularAttribute<X, ?>> getDeclaredSingularAttributes() {
+ return null;
+ }
+
+ @Override
+ public ListAttribute<? super X, ?> getList(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> ListAttribute<? super X, E> getList(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public MapAttribute<? super X, ?, ?> getMap(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <K, V> MapAttribute<? super X, K, V> getMap(final String arg0, final Class<K> arg1, final Class<V> arg2) {
+ return null;
+ }
+
+ @Override
+ public Set<PluralAttribute<? super X, ?, ?>> getPluralAttributes() {
+ return null;
+ }
+
+ @Override
+ public SetAttribute<? super X, ?> getSet(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> SetAttribute<? super X, E> getSet(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public SingularAttribute<? super X, ?> getSingularAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <Y> SingularAttribute<? super X, Y> getSingularAttribute(final String arg0, final Class<Y> arg1) {
+ return null;
+ }
+
+ @Override
+ public Set<SingularAttribute<? super X, ?>> getSingularAttributes() {
+ return null;
+ }
+
+ @Override
+ public Class<X> getJavaType() {
+ return null;
+ }
+
+ @Override
+ public javax.persistence.metamodel.Type.PersistenceType getPersistenceType() {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEntityTypeMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEntityTypeMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEntityTypeMock.java
new file mode 100644
index 0000000..1069815
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAEntityTypeMock.java
@@ -0,0 +1,246 @@
+/*******************************************************************************
+ * 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.jpa.processor.core.mock.model;
+
+import java.util.Set;
+
+import javax.persistence.metamodel.Attribute;
+import javax.persistence.metamodel.CollectionAttribute;
+import javax.persistence.metamodel.EntityType;
+import javax.persistence.metamodel.IdentifiableType;
+import javax.persistence.metamodel.ListAttribute;
+import javax.persistence.metamodel.MapAttribute;
+import javax.persistence.metamodel.PluralAttribute;
+import javax.persistence.metamodel.SetAttribute;
+import javax.persistence.metamodel.SingularAttribute;
+import javax.persistence.metamodel.Type;
+
+public abstract class JPAEntityTypeMock<X> implements EntityType<X> {
+
+ @Override
+ public <Y> SingularAttribute<X, Y> getDeclaredId(final Class<Y> arg0) {
+ return null;
+ }
+
+ @Override
+ public <Y> SingularAttribute<X, Y> getDeclaredVersion(final Class<Y> arg0) {
+ return null;
+ }
+
+ @Override
+ public <Y> SingularAttribute<? super X, Y> getId(final Class<Y> arg0) {
+ return null;
+ }
+
+ @Override
+ public Set<SingularAttribute<? super X, ?>> getIdClassAttributes() {
+ return null;
+ }
+
+ @Override
+ public Type<?> getIdType() {
+ return null;
+ }
+
+ @Override
+ public IdentifiableType<? super X> getSupertype() {
+ return null;
+ }
+
+ @Override
+ public <Y> SingularAttribute<? super X, Y> getVersion(final Class<Y> arg0) {
+ return null;
+ }
+
+ @Override
+ public boolean hasSingleIdAttribute() {
+ return false;
+ }
+
+ @Override
+ public boolean hasVersionAttribute() {
+ return false;
+ }
+
+ @Override
+ public Attribute<? super X, ?> getAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public Set<Attribute<? super X, ?>> getAttributes() {
+ return null;
+ }
+
+ @Override
+ public CollectionAttribute<? super X, ?> getCollection(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> CollectionAttribute<? super X, E> getCollection(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public Attribute<X, ?> getDeclaredAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public Set<Attribute<X, ?>> getDeclaredAttributes() {
+ return null;
+ }
+
+ @Override
+ public CollectionAttribute<X, ?> getDeclaredCollection(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> CollectionAttribute<X, E> getDeclaredCollection(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public ListAttribute<X, ?> getDeclaredList(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> ListAttribute<X, E> getDeclaredList(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public MapAttribute<X, ?, ?> getDeclaredMap(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <K, V> MapAttribute<X, K, V> getDeclaredMap(final String arg0, final Class<K> arg1, final Class<V> arg2) {
+ return null;
+ }
+
+ @Override
+ public Set<PluralAttribute<X, ?, ?>> getDeclaredPluralAttributes() {
+ return null;
+ }
+
+ @Override
+ public SetAttribute<X, ?> getDeclaredSet(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> SetAttribute<X, E> getDeclaredSet(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public SingularAttribute<X, ?> getDeclaredSingularAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <Y> SingularAttribute<X, Y> getDeclaredSingularAttribute(final String arg0, final Class<Y> arg1) {
+ return null;
+ }
+
+ @Override
+ public Set<SingularAttribute<X, ?>> getDeclaredSingularAttributes() {
+ return null;
+ }
+
+ @Override
+ public ListAttribute<? super X, ?> getList(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> ListAttribute<? super X, E> getList(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public MapAttribute<? super X, ?, ?> getMap(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <K, V> MapAttribute<? super X, K, V> getMap(final String arg0, final Class<K> arg1, final Class<V> arg2) {
+ return null;
+ }
+
+ @Override
+ public Set<PluralAttribute<? super X, ?, ?>> getPluralAttributes() {
+ return null;
+ }
+
+ @Override
+ public SetAttribute<? super X, ?> getSet(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> SetAttribute<? super X, E> getSet(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public SingularAttribute<? super X, ?> getSingularAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <Y> SingularAttribute<? super X, Y> getSingularAttribute(final String arg0, final Class<Y> arg1) {
+ return null;
+ }
+
+ @Override
+ public Set<SingularAttribute<? super X, ?>> getSingularAttributes() {
+ return null;
+ }
+
+ @Override
+ public Class<X> getJavaType() {
+ return null;
+ }
+
+ @Override
+ public javax.persistence.metamodel.Type.PersistenceType getPersistenceType() {
+ return null;
+ }
+
+ @Override
+ public Class<X> getBindableJavaType() {
+ return null;
+ }
+
+ @Override
+ public javax.persistence.metamodel.Bindable.BindableType getBindableType() {
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAJavaMemberMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAJavaMemberMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAJavaMemberMock.java
new file mode 100644
index 0000000..58a852f
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAJavaMemberMock.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * 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.jpa.processor.core.mock.model;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Member;
+
+import javax.persistence.JoinColumns;
+
+public class JPAJavaMemberMock implements Member, AnnotatedElement, Annotation {
+
+ @Override
+ public Class<?> getDeclaringClass() {
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ @Override
+ public int getModifiers() {
+ return 0;
+ }
+
+ @Override
+ public boolean isSynthetic() {
+ return false;
+ }
+
+ @Override
+ public boolean isAnnotationPresent(final Class<? extends Annotation> annotationClass) {
+ return false;
+ }
+
+ @Override
+ public Annotation[] getAnnotations() {
+ return null;
+ }
+
+ @Override
+ public Annotation[] getDeclaredAnnotations() {
+ return null;
+ }
+
+ @Override
+ public Class<? extends Annotation> annotationType() {
+ return JoinColumns.class;
+ }
+
+ @Override
+ public <T extends Annotation> T getAnnotation(final Class<T> annotationClass) {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAManagedTypeMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAManagedTypeMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAManagedTypeMock.java
new file mode 100644
index 0000000..a7b025f
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAManagedTypeMock.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * 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.jpa.processor.core.mock.model;
+
+import java.util.Set;
+
+import javax.persistence.metamodel.Attribute;
+import javax.persistence.metamodel.CollectionAttribute;
+import javax.persistence.metamodel.ListAttribute;
+import javax.persistence.metamodel.ManagedType;
+import javax.persistence.metamodel.MapAttribute;
+import javax.persistence.metamodel.PluralAttribute;
+import javax.persistence.metamodel.SetAttribute;
+import javax.persistence.metamodel.SingularAttribute;
+
+public class JPAManagedTypeMock<X> implements ManagedType<X> {
+
+ @Override
+ public Class<X> getJavaType() {
+ return null;
+ }
+
+ @Override
+ public javax.persistence.metamodel.Type.PersistenceType getPersistenceType() {
+ return null;
+ }
+
+ @Override
+ public Attribute<? super X, ?> getAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public Set<Attribute<? super X, ?>> getAttributes() {
+ return null;
+ }
+
+ @Override
+ public CollectionAttribute<? super X, ?> getCollection(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> CollectionAttribute<? super X, E> getCollection(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public Attribute<X, ?> getDeclaredAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public Set<Attribute<X, ?>> getDeclaredAttributes() {
+ return null;
+ }
+
+ @Override
+ public CollectionAttribute<X, ?> getDeclaredCollection(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> CollectionAttribute<X, E> getDeclaredCollection(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public ListAttribute<X, ?> getDeclaredList(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> ListAttribute<X, E> getDeclaredList(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public MapAttribute<X, ?, ?> getDeclaredMap(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <K, V> MapAttribute<X, K, V> getDeclaredMap(final String arg0, final Class<K> arg1, final Class<V> arg2) {
+ return null;
+ }
+
+ @Override
+ public Set<PluralAttribute<X, ?, ?>> getDeclaredPluralAttributes() {
+ return null;
+ }
+
+ @Override
+ public SetAttribute<X, ?> getDeclaredSet(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> SetAttribute<X, E> getDeclaredSet(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public SingularAttribute<X, ?> getDeclaredSingularAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <Y> SingularAttribute<X, Y> getDeclaredSingularAttribute(final String arg0, final Class<Y> arg1) {
+ return null;
+ }
+
+ @Override
+ public Set<SingularAttribute<X, ?>> getDeclaredSingularAttributes() {
+ return null;
+ }
+
+ @Override
+ public ListAttribute<? super X, ?> getList(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> ListAttribute<? super X, E> getList(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public MapAttribute<? super X, ?, ?> getMap(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <K, V> MapAttribute<? super X, K, V> getMap(final String arg0, final Class<K> arg1, final Class<V> arg2) {
+ return null;
+ }
+
+ @Override
+ public Set<PluralAttribute<? super X, ?, ?>> getPluralAttributes() {
+ return null;
+ }
+
+ @Override
+ public SetAttribute<? super X, ?> getSet(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <E> SetAttribute<? super X, E> getSet(final String arg0, final Class<E> arg1) {
+ return null;
+ }
+
+ @Override
+ public SingularAttribute<? super X, ?> getSingularAttribute(final String arg0) {
+ return null;
+ }
+
+ @Override
+ public <Y> SingularAttribute<? super X, Y> getSingularAttribute(final String arg0, final Class<Y> arg1) {
+ return null;
+ }
+
+ @Override
+ public Set<SingularAttribute<? super X, ?>> getSingularAttributes() {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAMetaModelMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAMetaModelMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAMetaModelMock.java
new file mode 100644
index 0000000..d06b930
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAMetaModelMock.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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.jpa.processor.core.mock.model;
+
+import java.util.Set;
+
+import javax.persistence.metamodel.EmbeddableType;
+import javax.persistence.metamodel.EntityType;
+import javax.persistence.metamodel.ManagedType;
+import javax.persistence.metamodel.Metamodel;
+
+public class JPAMetaModelMock implements Metamodel {
+
+ @Override
+ public <X> EmbeddableType<X> embeddable(final Class<X> arg0) {
+ return null;
+ }
+
+ @Override
+ public <X> EntityType<X> entity(final Class<X> arg0) {
+ return null;
+ }
+
+ @Override
+ public Set<EmbeddableType<?>> getEmbeddables() {
+ return null;
+ }
+
+ @Override
+ public Set<EntityType<?>> getEntities() {
+ return null;
+ }
+
+ @Override
+ public Set<ManagedType<?>> getManagedTypes() {
+ return null;
+ }
+
+ @Override
+ public <X> ManagedType<X> managedType(final Class<X> arg0) {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAPluralAttributeMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAPluralAttributeMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAPluralAttributeMock.java
new file mode 100644
index 0000000..23e7330
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPAPluralAttributeMock.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * 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.jpa.processor.core.mock.model;
+
+import java.lang.reflect.Member;
+import java.util.ArrayList;
+
+import javax.persistence.metamodel.ManagedType;
+import javax.persistence.metamodel.PluralAttribute;
+import javax.persistence.metamodel.Type;
+
+public class JPAPluralAttributeMock implements PluralAttribute<Object, ArrayList<String>, String> {
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public javax.persistence.metamodel.Attribute.PersistentAttributeType getPersistentAttributeType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ManagedType<Object> getDeclaringType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Class<ArrayList<String>> getJavaType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Member getJavaMember() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isAssociation() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isCollection() {
+ return false;
+ }
+
+ @Override
+ public javax.persistence.metamodel.Bindable.BindableType getBindableType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Class<String> getBindableJavaType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public javax.persistence.metamodel.PluralAttribute.CollectionType getCollectionType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Type<String> getElementType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPASingularAttributeMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPASingularAttributeMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPASingularAttributeMock.java
new file mode 100644
index 0000000..e64303e
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/JPASingularAttributeMock.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * 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.jpa.processor.core.mock.model;
+
+import java.lang.reflect.Member;
+
+import javax.persistence.metamodel.ManagedType;
+import javax.persistence.metamodel.SingularAttribute;
+import javax.persistence.metamodel.Type;
+
+public class JPASingularAttributeMock<X, T> implements SingularAttribute<X, T> {
+
+ @Override
+ public ManagedType<X> getDeclaringType() {
+ return null;
+ }
+
+ @Override
+ public Member getJavaMember() {
+ return null;
+ }
+
+ @Override
+ public Class<T> getJavaType() {
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ @Override
+ public javax.persistence.metamodel.Attribute.PersistentAttributeType getPersistentAttributeType() {
+ return null;
+ }
+
+ @Override
+ public boolean isAssociation() {
+ return false;
+ }
+
+ @Override
+ public boolean isCollection() {
+ return false;
+ }
+
+ @Override
+ public Class<T> getBindableJavaType() {
+ return null;
+ }
+
+ @Override
+ public javax.persistence.metamodel.Bindable.BindableType getBindableType() {
+ return null;
+ }
+
+ @Override
+ public Type<T> getType() {
+ return null;
+ }
+
+ @Override
+ public boolean isId() {
+ return false;
+ }
+
+ @Override
+ public boolean isOptional() {
+ return false;
+ }
+
+ @Override
+ public boolean isVersion() {
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/_JPACustomProcessorMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/_JPACustomProcessorMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/_JPACustomProcessorMock.java
new file mode 100644
index 0000000..1cdd158
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/_JPACustomProcessorMock.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * 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.jpa.processor.core.mock.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.annotation.edm.Facets;
+import org.apache.olingo.odata2.api.annotation.edm.FunctionImport;
+import org.apache.olingo.odata2.api.annotation.edm.FunctionImport.Multiplicity;
+import org.apache.olingo.odata2.api.annotation.edm.FunctionImport.ReturnType;
+import org.apache.olingo.odata2.api.annotation.edm.Parameter;
+import org.apache.olingo.odata2.api.annotation.edm.Parameter.Mode;
+
+@Deprecated
+public class _JPACustomProcessorMock {
+
+ public static final String className = "_JPACustomProcessorMock";
+ public static final String edmName = "JPACustomProcessor";
+
+ @FunctionImport(name = "Method1", entitySet = "MockSet", returnType = ReturnType.ENTITY_TYPE,
+ multiplicity = Multiplicity.MANY)
+ public List<_JPACustomProcessorMock> method1(@Parameter(name = "Param1", facets = @Facets(nullable = true,
+ maxLength = 2), mode = Mode.IN) final String param1, final int param2, @Parameter(name = "Param3",
+ facets = @Facets(precision = 10, scale = 2), mode = Mode.IN) final double param3) {
+ return new ArrayList<_JPACustomProcessorMock>();
+ }
+
+ @FunctionImport(name = "Method2", entitySet = "MockSet", returnType = ReturnType.ENTITY_TYPE,
+ multiplicity = Multiplicity.MANY)
+ public List<_JPACustomProcessorMock> method2(
+ @Parameter(facets = @Facets(maxLength = 2), name = "Param2") final String param2) {
+ return new ArrayList<_JPACustomProcessorMock>();
+ }
+
+ @FunctionImport(returnType = ReturnType.SCALAR)
+ public int method3(@Parameter(name = "Param3") final String param3) {
+ return 0;
+ }
+
+ @FunctionImport(returnType = ReturnType.NONE)
+ public void method4() {
+ return;
+ }
+
+ @FunctionImport(returnType = ReturnType.ENTITY_TYPE, entitySet = "MockSet", multiplicity = Multiplicity.ONE)
+ public _JPACustomProcessorMock method7() {
+ return null;
+ }
+
+ @FunctionImport(returnType = ReturnType.COMPLEX_TYPE, multiplicity = Multiplicity.ONE)
+ public _JPACustomProcessorMock method9() {
+ return null;
+ }
+
+ @FunctionImport(returnType = ReturnType.COMPLEX_TYPE, multiplicity = Multiplicity.MANY)
+ public List<_JPACustomProcessorMock> method10() {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/_JPACustomProcessorNegativeMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/_JPACustomProcessorNegativeMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/_JPACustomProcessorNegativeMock.java
new file mode 100644
index 0000000..a727d5b
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/model/_JPACustomProcessorNegativeMock.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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.jpa.processor.core.mock.model;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.annotation.edm.FunctionImport;
+import org.apache.olingo.odata2.api.annotation.edm.FunctionImport.Multiplicity;
+import org.apache.olingo.odata2.api.annotation.edm.FunctionImport.ReturnType;
+import org.apache.olingo.odata2.api.annotation.edm.Parameter;
+
+@Deprecated
+public class _JPACustomProcessorNegativeMock {
+
+ @FunctionImport(returnType = ReturnType.ENTITY_TYPE, multiplicity = Multiplicity.MANY)
+ public List<_JPACustomProcessorNegativeMock> method5() {
+ return null;
+ }
+
+ @FunctionImport(returnType = ReturnType.ENTITY_TYPE, entitySet = "MockSet", multiplicity = Multiplicity.MANY)
+ public void method6() {
+ return;
+ }
+
+ @FunctionImport(returnType = ReturnType.ENTITY_TYPE, entitySet = "MockSet", multiplicity = Multiplicity.MANY)
+ public _JPACustomProcessorNegativeMock method8() {
+ return null;
+ }
+
+ @FunctionImport(returnType = ReturnType.COMPLEX_TYPE, multiplicity = Multiplicity.ONE)
+ public _JPACustomProcessorNegativeMock method11() {
+ return null;
+ }
+
+ @FunctionImport(returnType = ReturnType.SCALAR, multiplicity = Multiplicity.ONE)
+ public JPACustomProcessorMock method12() {
+ return null;
+ }
+
+ @FunctionImport(returnType = ReturnType.SCALAR, multiplicity = Multiplicity.ONE)
+ public int method13(@Parameter(name = "") final int y) {
+ return 0;
+ }
+
+ @FunctionImport(returnType = ReturnType.SCALAR, multiplicity = Multiplicity.ONE)
+ public void method16(@Parameter(name = "") final int y) {
+ return;
+ }
+
+ @FunctionImport(returnType = ReturnType.COMPLEX_TYPE, multiplicity = Multiplicity.ONE)
+ public void method17(@Parameter(name = "") final int y) {
+ return;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationEndTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationEndTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationEndTest.java
new file mode 100644
index 0000000..b756f91
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationEndTest.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * 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.jpa.processor.core.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import javax.persistence.metamodel.Attribute;
+
+import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
+import org.apache.olingo.odata2.api.edm.FullQualifiedName;
+import org.apache.olingo.odata2.api.edm.provider.AssociationEnd;
+import org.apache.olingo.odata2.api.edm.provider.EntityType;
+import org.apache.olingo.odata2.jpa.processor.api.access.JPAEdmBuilder;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType;
+import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType.SimpleTypeA;
+import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmAssociationEnd;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class JPAEdmAssociationEndTest extends JPAEdmTestModelView {
+
+ private final static int VARIANT1 = 1;
+ private final static int VARIANT2 = 2;
+ private final static int VARIANT3 = 3;
+
+ private static int variant;
+
+ private static final String PUNIT_NAME = "salesorderprocessing";
+ private static JPAEdmAssociationEnd objJPAEdmAssociationEnd = null;
+ private static JPAEdmAssociationEndTest objJPAEdmAssociationEndTest = null;
+
+ @BeforeClass
+ public static void setup() {
+ objJPAEdmAssociationEndTest = new JPAEdmAssociationEndTest();
+ objJPAEdmAssociationEnd = new JPAEdmAssociationEnd(objJPAEdmAssociationEndTest, objJPAEdmAssociationEndTest);
+ try {
+ objJPAEdmAssociationEnd.getBuilder().build();
+ } catch (ODataJPAModelException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ } catch (ODataJPARuntimeException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ }
+ }
+
+ @Test
+ public void testGetBuilder() {
+ JPAEdmBuilder builder = objJPAEdmAssociationEnd.getBuilder();
+ assertNotNull(builder);
+
+ }
+
+ @Test
+ public void testGetBuilderIdempotent() {
+ JPAEdmBuilder builder1 = objJPAEdmAssociationEnd.getBuilder();
+ JPAEdmBuilder builder2 = objJPAEdmAssociationEnd.getBuilder();
+
+ assertEquals(builder1.hashCode(), builder2.hashCode());
+ }
+
+ @Test
+ public void testGetAssociationEnd1() {
+ AssociationEnd associationEnd = objJPAEdmAssociationEnd.getEdmAssociationEnd1();
+ assertEquals(associationEnd.getType().getName(), "SOID");
+ }
+
+ @Test
+ public void testGetAssociationEnd2() {
+ AssociationEnd associationEnd = objJPAEdmAssociationEnd.getEdmAssociationEnd2();
+ assertEquals(associationEnd.getType().getName(), "String");
+ }
+
+ @Test
+ public void testCompare() {
+ assertTrue(objJPAEdmAssociationEnd.compare(getAssociationEnd("SOID", 1), getAssociationEnd("String", 1)));
+ assertFalse(objJPAEdmAssociationEnd.compare(getAssociationEnd("String", 2), getAssociationEnd("SOID", 1)));
+ }
+
+ @Test
+ public void testBuildAssociationEnd() {
+ assertEquals("SOID", objJPAEdmAssociationEnd.getEdmAssociationEnd1().getType().getName());
+ assertEquals(new FullQualifiedName("salesorderprocessing", "SOID"), objJPAEdmAssociationEnd.getEdmAssociationEnd1()
+ .getType());
+ assertTrue(objJPAEdmAssociationEnd.isConsistent());
+
+ }
+
+ private AssociationEnd getAssociationEnd(final String typeName, final int variant) {
+ AssociationEnd associationEnd = new AssociationEnd();
+ associationEnd.setType(getFullQualifiedName(typeName));
+ if (variant == VARIANT1) {
+ associationEnd.setMultiplicity(EdmMultiplicity.MANY);
+ } else if (variant == VARIANT2) {
+ associationEnd.setMultiplicity(EdmMultiplicity.ONE);
+ } else if (variant == VARIANT3) {
+ associationEnd.setMultiplicity(EdmMultiplicity.ZERO_TO_ONE);
+ } else {
+ associationEnd.setMultiplicity(EdmMultiplicity.MANY);//
+ }
+ return associationEnd;
+ }
+
+ private FullQualifiedName getFullQualifiedName(final String typeName) {
+ FullQualifiedName fullQualifiedName = new FullQualifiedName(PUNIT_NAME, typeName);
+ return fullQualifiedName;
+ }
+
+ private Attribute<?, ?> getJPAAttributeLocal() {
+ AttributeMock<Object, String> attr = new AttributeMock<Object, String>();
+ return attr;
+ }
+
+ @Override
+ public Attribute<?, ?> getJPAAttribute() {
+ return getJPAAttributeLocal();
+ }
+
+ @Override
+ public String getpUnitName() {
+ return PUNIT_NAME;
+ }
+
+ @Override
+ public EntityType getEdmEntityType() {
+ EntityType entityType = new EntityType();
+ entityType.setName(SimpleTypeA.NAME);
+ return entityType;
+ }
+
+ // The inner class which gives us an replica of the jpa attribute
+ @SuppressWarnings("hiding")
+ public class AttributeMock<Object, String> extends JPAAttributeMock<Object, String> {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<String> getJavaType() {
+ return (Class<String>) SimpleType.SimpleTypeA.clazz;
+ }
+
+ @Override
+ public PersistentAttributeType getPersistentAttributeType() {
+ if (variant == VARIANT1) {
+ return PersistentAttributeType.ONE_TO_MANY;
+ } else if (variant == VARIANT2) {
+ return PersistentAttributeType.ONE_TO_ONE;
+ } else if (variant == VARIANT3) {
+ return PersistentAttributeType.MANY_TO_ONE;
+ } else {
+ return PersistentAttributeType.MANY_TO_MANY;
+ }
+
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationSetTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationSetTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationSetTest.java
new file mode 100644
index 0000000..cb7d252
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationSetTest.java
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * 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.jpa.processor.core.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.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.EntitySet;
+import org.apache.olingo.odata2.api.edm.provider.Schema;
+import org.apache.olingo.odata2.jpa.processor.api.access.JPAEdmBuilder;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmAssociationView;
+import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntityContainerView;
+import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntitySetView;
+import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmAssociationSet;
+import org.junit.Before;
+import org.junit.Test;
+
+public class JPAEdmAssociationSetTest extends JPAEdmTestModelView {
+
+ private JPAEdmAssociationSetTest objJPAEdmAssociationSetTest;
+ private JPAEdmAssociationSet objJPAEdmAssociationSet;
+
+ @Before
+ public void setUp() {
+ objJPAEdmAssociationSetTest = new JPAEdmAssociationSetTest();
+ objJPAEdmAssociationSet = new JPAEdmAssociationSet(objJPAEdmAssociationSetTest);
+ try {
+ objJPAEdmAssociationSet.getBuilder().build();
+ } catch (ODataJPAModelException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ } catch (ODataJPARuntimeException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ }
+
+ }
+
+ @Test
+ public void testGetBuilder() {
+ assertNotNull(objJPAEdmAssociationSet.getBuilder());
+ }
+
+ @Test
+ public void testGetConsistentEdmAssociationSetList() {
+ assertNotNull(objJPAEdmAssociationSet.getConsistentEdmAssociationSetList());
+ }
+
+ @Test
+ public void testGetEdmAssociationSet() {
+ assertNotNull(objJPAEdmAssociationSet.getEdmAssociationSet());
+ }
+
+ @Test
+ public void testGetEdmAssociation() {
+ assertNotNull(objJPAEdmAssociationSet.getEdmAssociation());
+ }
+
+ @Test
+ public void testIsConsistent() {
+ assertTrue(objJPAEdmAssociationSet.isConsistent());
+ }
+
+ @Test
+ public void testGetBuilderIdempotent() {
+ JPAEdmBuilder builder1 = objJPAEdmAssociationSet.getBuilder();
+ JPAEdmBuilder builder2 = objJPAEdmAssociationSet.getBuilder();
+
+ assertEquals(builder1.hashCode(), builder2.hashCode());
+ }
+
+ @Override
+ public JPAEdmEntityContainerView getJPAEdmEntityContainerView() {
+ return this;
+ }
+
+ @Override
+ public JPAEdmEntitySetView getJPAEdmEntitySetView() {
+ return this;
+ }
+
+ @Override
+ public JPAEdmAssociationView getJPAEdmAssociationView() {
+ return this;
+ }
+
+ @Override
+ public AssociationSet getEdmAssociationSet() {
+ AssociationSet associationSet = new AssociationSet();
+ associationSet.setEnd1(new AssociationSetEnd());
+ associationSet.setEnd2(new AssociationSetEnd());
+
+ return associationSet;
+ }
+
+ @Override
+ public List<Association> getConsistentEdmAssociationList() {
+ return getEdmAssociationListLocal();
+ }
+
+ @Override
+ public List<AssociationSet> getConsistentEdmAssociationSetList() {
+
+ List<AssociationSet> associationSetList = new ArrayList<AssociationSet>();
+ associationSetList.add(getEdmAssociationSet());
+ associationSetList.add(getEdmAssociationSet());
+
+ return associationSetList;
+ }
+
+ @Override
+ public List<EntitySet> getConsistentEdmEntitySetList() {
+ return getEntitySetListLocal();
+ }
+
+ @Override
+ public boolean isConsistent() {
+ return true;
+ }
+
+ @Override
+ public Schema getEdmSchema() {
+ Schema schema = new Schema();
+ schema.setNamespace("salesordereprocessing");
+ return schema;
+ }
+
+ private List<EntitySet> getEntitySetListLocal() {
+ List<EntitySet> entitySetList = new ArrayList<EntitySet>();
+
+ EntitySet entitySet = new EntitySet();
+ entitySet.setName("SalesOrderHeader");
+ entitySet.setEntityType(new FullQualifiedName("salesorderprocessing", "SOID"));
+
+ EntitySet entitySet2 = new EntitySet();
+ entitySet2.setName("SalesOrderItem");
+ entitySet2.setEntityType(new FullQualifiedName("salesorderprocessing", "SOID"));
+
+ entitySetList.add(entitySet);
+ entitySetList.add(entitySet2);
+ return entitySetList;
+ }
+
+ private List<Association> getEdmAssociationListLocal() {
+ List<Association> associationList = new ArrayList<Association>();
+
+ Association association = new Association();
+ association.setName("Assoc_SalesOrderHeader_SalesOrderItem");
+ association.setEnd1(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "String")).setRole(
+ "SalesOrderHeader"));
+ association.setEnd2(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "SalesOrderItem"))
+ .setRole("SalesOrderItem"));
+
+ associationList.add(association);
+ return associationList;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationTest.java
new file mode 100644
index 0000000..3923dd8
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationTest.java
@@ -0,0 +1,426 @@
+/*******************************************************************************
+
+ * 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.jpa.processor.core.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import javax.persistence.metamodel.Attribute;
+
+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.EntityType;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmAssociationEndView;
+import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmReferentialConstraintView;
+import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType;
+import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType.SimpleTypeA;
+import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmAssociation;
+import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmAssociationEnd;
+import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmReferentialConstraint;
+import org.easymock.EasyMock;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class JPAEdmAssociationTest extends JPAEdmTestModelView {
+
+ private static JPAEdmAssociation objAssociation = null;
+ private static String ASSOCIATION_NAME = "SalesOrderHeader_String";
+ private static JPAEdmAssociationTest localView = null;
+ private static final String PUNIT_NAME = "salesorderprocessing";
+ private int variant;
+
+ @BeforeClass
+ public static void setup() {
+ localView = new JPAEdmAssociationTest();
+ objAssociation = new JPAEdmAssociation(localView, localView, localView, 1);
+ try {
+ objAssociation.getBuilder().build();
+ } catch (ODataJPAModelException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ } catch (ODataJPARuntimeException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ }
+ }
+
+ @Override
+ public AssociationEnd getEdmAssociationEnd1() {
+ AssociationEnd associationEnd = new AssociationEnd();
+ associationEnd.setType(new FullQualifiedName("salesorderprocessing", "SalesOrderHeader"));
+ associationEnd.setRole("SalesOrderHeader");
+ associationEnd.setMultiplicity(EdmMultiplicity.ONE);
+ return associationEnd;
+ }
+
+ @Override
+ public AssociationEnd getEdmAssociationEnd2() {
+ AssociationEnd associationEnd = new AssociationEnd();
+ associationEnd.setType(new FullQualifiedName("salesorderprocessing", "String"));
+ associationEnd.setRole("String");
+ associationEnd.setMultiplicity(EdmMultiplicity.MANY);
+ return associationEnd;
+ }
+
+ @Override
+ public Association getEdmAssociation() {
+ Association association = new Association();
+ association
+ .setEnd1(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "SalesOrderHeader")));
+ association.setEnd2(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing", "String")));
+
+ return association;
+ }
+
+ @Override
+ public boolean isExists() {
+ return true;
+ }
+
+ @Override
+ public JPAEdmReferentialConstraintView getJPAEdmReferentialConstraintView() {
+ JPAEdmReferentialConstraint refConstraintView = new JPAEdmReferentialConstraint(localView, localView, localView);
+ return refConstraintView;
+ }
+
+ @Override
+ public Attribute<?, ?> getJPAAttribute() {
+ return getJPAAttributeLocal();
+ }
+
+ @Override
+ public String getpUnitName() {
+ return PUNIT_NAME;
+ }
+
+ @Override
+ public EntityType getEdmEntityType() {
+ EntityType entityType = new EntityType();
+ entityType.setName(SimpleTypeA.NAME);
+ return entityType;
+ }
+
+ // The inner class which gives us an replica of the jpa attribute
+ @SuppressWarnings("hiding")
+ private class AttributeMock<Object, String> extends JPAAttributeMock<Object, String> {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<String> getJavaType() {
+ return (Class<String>) SimpleType.SimpleTypeA.clazz;
+ }
+
+ @Override
+ public PersistentAttributeType getPersistentAttributeType() {
+ if (variant == 1) {
+ return PersistentAttributeType.ONE_TO_MANY;
+ } else if (variant == 2) {
+ return PersistentAttributeType.ONE_TO_ONE;
+ } else if (variant == 2) {
+ return PersistentAttributeType.MANY_TO_ONE;
+ } else {
+ return PersistentAttributeType.MANY_TO_MANY;
+ }
+
+ }
+ }
+
+ private Attribute<?, ?> getJPAAttributeLocal() {
+ AttributeMock<Object, String> attr = new AttributeMock<Object, String>();
+ return attr;
+ }
+
+ @Test
+ public void testGetBuilder() {
+ assertNotNull(objAssociation.getBuilder());
+ }
+
+ @Test
+ public void testGetEdmAssociation() {
+ assertNotNull(objAssociation.getEdmAssociation());
+ assertEquals(objAssociation.getEdmAssociation().getName(), ASSOCIATION_NAME);
+ }
+
+ @Test
+ public void testGetConsistentEdmAssociationList() {
+ assertTrue(objAssociation.getConsistentEdmAssociationList().size() > 0);
+ }
+
+ @Override
+ public String getEdmRelationShipName() {
+ return "Association_SalesOrderHeader_String";
+ }
+
+ @Test
+ public void testSearchAssociation1() {
+ class TestAssociationEndView extends JPAEdmTestModelView {
+ @Override
+ public String getEdmRelationShipName() {
+ return "SalesOrderHeader_String1";
+ }
+
+ private Attribute<?, ?> getJPAAttributeLocal() {
+ AttributeMock<Object, String> attr = new AttributeMock<Object, String>();
+ return attr;
+ }
+
+ @Override
+ public Attribute<?, ?> getJPAAttribute() {
+ return getJPAAttributeLocal();
+ }
+
+ @Override
+ public String getJoinColumnName() {
+ return "SO_ID";
+ }
+
+ @Override
+ public String getJoinColumnReferenceColumnName() {
+ return "DEMO_ID";
+ }
+
+ @Override
+ public String getMappedByName() {
+ return "demo";
+ }
+
+ @Override
+ public String getOwningPropertyName() {
+ return "salesOrder";
+ }
+
+ @Override
+ public int getNumberOfAssociationsWithSimilarEndPoints(final JPAEdmAssociationEndView view) {
+ return 1;
+ }
+
+ @Override
+ public String getpUnitName() {
+ return "salesorderprocessing";
+ }
+
+ @Override
+ public EntityType getEdmEntityType() {
+ EntityType entityType = new EntityType();
+ entityType.setName("SalesOrderHeader");
+ return entityType;
+ }
+
+ @SuppressWarnings("hiding")
+ class AttributeMock<Object, String> extends JPAAttributeMock<Object, String> {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<String> getJavaType() {
+ return (Class<String>) SimpleType.SimpleTypeA.clazz;
+ }
+
+ @Override
+ public PersistentAttributeType getPersistentAttributeType() {
+
+ return PersistentAttributeType.ONE_TO_MANY;
+
+ }
+
+ @Override
+ public Member getJavaMember() {
+ return new AnnotatedElementMock();
+ }
+
+ @Override
+ public java.lang.String getName() {
+ // TODO Auto-generated method stub
+ return super.getName();
+ }
+
+ class AnnotatedElementMock implements AnnotatedElement, Member {
+
+ @Override
+ public boolean isAnnotationPresent(final Class<? extends Annotation> annotationClass) {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Annotation getAnnotation(@SuppressWarnings("rawtypes") final Class annotationClass) {
+ if (annotationClass.equals(JoinColumn.class)) {
+ JoinColumn joinColumn = EasyMock.createMock(JoinColumn.class);
+ EasyMock.expect(joinColumn.name()).andStubReturn("SO_ID");
+ EasyMock.expect(joinColumn.referencedColumnName()).andStubReturn("DEMO_ID");
+ EasyMock.replay(joinColumn);
+ return joinColumn;
+ } else {
+ OneToMany oneToMany = EasyMock.createMock(OneToMany.class);
+ EasyMock.expect(oneToMany.mappedBy()).andStubReturn("demo");
+ EasyMock.replay(oneToMany);
+ return oneToMany;
+ }
+ }
+
+ @Override
+ public Annotation[] getAnnotations() {
+ return null;
+ }
+
+ @Override
+ public Annotation[] getDeclaredAnnotations() {
+ return null;
+ }
+
+ @Override
+ public Class<?> getDeclaringClass() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public java.lang.String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getModifiers() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public boolean isSynthetic() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ }
+
+ }
+ }
+ TestAssociationEndView objJPAEdmAssociationEndTest = new TestAssociationEndView();
+ JPAEdmAssociationEnd objJPAEdmAssociationEnd =
+ new JPAEdmAssociationEnd(objJPAEdmAssociationEndTest, objJPAEdmAssociationEndTest);
+ try {
+ objJPAEdmAssociationEnd.getBuilder().build();
+ Field field = objAssociation.getClass().getDeclaredField("associationEndMap");
+ field.setAccessible(true);
+ Map<String, JPAEdmAssociationEndView> associationEndMap = new HashMap<String, JPAEdmAssociationEndView>();
+ associationEndMap.put("SalesOrderHeader_String", objJPAEdmAssociationEnd);
+ field.set(objAssociation, associationEndMap);
+ } catch (ODataJPARuntimeException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ } catch (ODataJPAModelException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ } catch (SecurityException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ } catch (NoSuchFieldException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ } catch (IllegalArgumentException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ } catch (IllegalAccessException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ }
+
+ assertEquals("SalesOrderHeader_String", objAssociation.searchAssociation(objJPAEdmAssociationEnd).getName());
+
+ }
+
+ @Test
+ public void testAddJPAEdmAssociationView() {
+
+ class LocalJPAAssociationView extends JPAEdmTestModelView {
+ @Override
+ public AssociationEnd getEdmAssociationEnd1() {
+ AssociationEnd associationEnd = new AssociationEnd();
+ associationEnd.setType(new FullQualifiedName("salesorderprocessing", "SalesOrderHeader"));
+ associationEnd.setRole("SalesOrderHeader");
+ associationEnd.setMultiplicity(EdmMultiplicity.ONE);
+ return associationEnd;
+ }
+
+ @Override
+ public AssociationEnd getEdmAssociationEnd2() {
+ AssociationEnd associationEnd = new AssociationEnd();
+ associationEnd.setType(new FullQualifiedName("salesorderprocessing", "SalesOrderItem"));
+ associationEnd.setRole("SalesOrderItem");
+ associationEnd.setMultiplicity(EdmMultiplicity.MANY);
+ return associationEnd;
+ }
+
+ @Override
+ public Association getEdmAssociation() {
+ Association association = new Association();
+ association.setEnd1(new AssociationEnd().setType(new FullQualifiedName("salesorderprocessing",
+ "SalesOrderHeader")));
+ association.setEnd2(new AssociationEnd()
+ .setType(new FullQualifiedName("salesorderprocessing", "SalesOrderItem")));
+
+ return association;
+ }
+ }
+ LocalJPAAssociationView assocViewObj = new LocalJPAAssociationView();
+ JPAEdmAssociation objLocalAssociation = new JPAEdmAssociation(assocViewObj, assocViewObj, assocViewObj, 1);
+ try {
+ objLocalAssociation.getBuilder().build();
+ } catch (ODataJPARuntimeException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ } catch (ODataJPAModelException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ }
+
+ objAssociation.addJPAEdmAssociationView(objLocalAssociation, localView);
+
+ }
+
+ @Test
+ public void testAddJPAEdmRefConstraintView() {
+
+ localView = new JPAEdmAssociationTest();
+ objAssociation = new JPAEdmAssociation(localView, localView, localView, 1);
+ try {
+ objAssociation.getBuilder().build();
+ } catch (ODataJPAModelException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ } catch (ODataJPARuntimeException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ }
+
+ objAssociation.addJPAEdmRefConstraintView(localView);
+ assertTrue(objAssociation.getConsistentEdmAssociationList().size() > 0);
+ }
+
+ @Test
+ public void testGetJPAEdmReferentialConstraintView() {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmBaseViewImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmBaseViewImplTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmBaseViewImplTest.java
new file mode 100644
index 0000000..237a6a3
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmBaseViewImplTest.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * 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.jpa.processor.core.model;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import javax.persistence.metamodel.Metamodel;
+
+import org.apache.olingo.odata2.jpa.processor.api.access.JPAEdmBuilder;
+import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
+import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmBaseViewImpl;
+import org.junit.Before;
+import org.junit.Test;
+
+public class JPAEdmBaseViewImplTest extends JPAEdmTestModelView {
+
+ private JPAEdmBaseViewImplTest objJPAEdmBaseViewImplTest;
+ private JPAEdmBaseViewImpl objJPAEdmBaseViewImpl;
+
+ @Before
+ public void setUp() {
+ objJPAEdmBaseViewImplTest = new JPAEdmBaseViewImplTest();
+ objJPAEdmBaseViewImpl = new JPAEdmBaseViewImpl(objJPAEdmBaseViewImplTest) {
+
+ @Override
+ public JPAEdmBuilder getBuilder() {
+ return null;
+ }
+ };
+
+ objJPAEdmBaseViewImpl = new JPAEdmBaseViewImpl(getJPAMetaModel(), getpUnitName()) {
+
+ @Override
+ public JPAEdmBuilder getBuilder() {
+ return null;
+ }
+ };
+
+ }
+
+ @Test
+ public void testGetpUnitName() {
+ assertTrue(objJPAEdmBaseViewImpl.getpUnitName().equals("salesorderprocessing"));
+ }
+
+ @Test
+ public void testGetJPAMetaModel() {
+ assertNotNull(objJPAEdmBaseViewImpl.getJPAMetaModel());
+ }
+
+ @Test
+ public void testIsConsistent() {
+ assertTrue(objJPAEdmBaseViewImpl.isConsistent());
+ }
+
+ @Test
+ public void testClean() {
+ objJPAEdmBaseViewImpl.clean();
+ assertFalse(objJPAEdmBaseViewImpl.isConsistent());
+ }
+
+ @Override
+ public String getpUnitName() {
+ return "salesorderprocessing";
+ }
+
+ @Override
+ public Metamodel getJPAMetaModel() {
+ return new JPAMetaModelMock();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/63b621a8/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmComplexTypeTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmComplexTypeTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmComplexTypeTest.java
new file mode 100644
index 0000000..9ab7872
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmComplexTypeTest.java
@@ -0,0 +1,270 @@
+/*******************************************************************************
+ * 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.jpa.processor.core.model;
+
+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.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.persistence.metamodel.Attribute;
+import javax.persistence.metamodel.EmbeddableType;
+import javax.persistence.metamodel.Metamodel;
+
+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.Mapping;
+import org.apache.olingo.odata2.api.edm.provider.Property;
+import org.apache.olingo.odata2.api.edm.provider.SimpleProperty;
+import org.apache.olingo.odata2.jpa.processor.api.access.JPAEdmBuilder;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping;
+import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEmbeddableMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPASingularAttributeMock;
+import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmComplexType;
+import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmMappingImpl;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class JPAEdmComplexTypeTest extends JPAEdmTestModelView {
+
+ private static JPAEdmComplexType objComplexType = null;
+ private static JPAEdmComplexTypeTest localView = null;
+
+ @BeforeClass
+ public static void setup() {
+ localView = new JPAEdmComplexTypeTest();
+ objComplexType = new JPAEdmComplexType(localView);
+ try {
+ objComplexType.getBuilder().build();
+ } catch (ODataJPAModelException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ } catch (ODataJPARuntimeException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public EmbeddableType<?> getJPAEmbeddableType() {
+ @SuppressWarnings("hiding")
+ class JPAComplexAttribute<Long> extends JPAEmbeddableMock<Long> {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<Long> getJavaType() {
+
+ return (Class<Long>) java.lang.Long.class;
+ }
+
+ }
+ return new JPAComplexAttribute();
+ }
+
+ @Override
+ public String getpUnitName() {
+ return "salesorderprocessing";
+ }
+
+ @Override
+ public Metamodel getJPAMetaModel() {
+ return new JPAEdmMetaModel();
+ }
+
+ @Test
+ public void testGetBuilder() {
+
+ assertNotNull(objComplexType.getBuilder());
+ }
+
+ @Test
+ public void testGetEdmComplexType() {
+ assertEquals(objComplexType.getEdmComplexType().getName(), "String");
+ }
+
+ @Test
+ public void testSearchComplexTypeString() {
+ assertNotNull(objComplexType.searchEdmComplexType("java.lang.String"));
+
+ }
+
+ @Test
+ public void testGetJPAEmbeddableType() {
+ assertTrue(objComplexType.getJPAEmbeddableType().getAttributes().size() > 0);
+
+ }
+
+ @Test
+ public void testGetConsistentEdmComplexTypes() {
+ assertTrue(objComplexType.getConsistentEdmComplexTypes().size() > 0);
+ }
+
+ @Test
+ public void testSearchComplexTypeFullQualifiedName() {
+ assertNotNull(objComplexType.searchEdmComplexType(new FullQualifiedName("salesorderprocessing", "String")));
+
+ }
+
+ @Test
+ public void testSearchComplexTypeFullQualifiedNameNegative() {
+ assertNull(objComplexType.searchEdmComplexType(new FullQualifiedName("salesorderprocessing", "lang.String")));
+ }
+
+ @Test
+ public void testGetBuilderIdempotent() {
+ JPAEdmBuilder builder1 = objComplexType.getBuilder();
+ JPAEdmBuilder builder2 = objComplexType.getBuilder();
+
+ assertEquals(builder1.hashCode(), builder2.hashCode());
+ }
+
+ @Test
+ public void testAddCompleTypeView() {
+ localView = new JPAEdmComplexTypeTest();
+ objComplexType = new JPAEdmComplexType(localView);
+ try {
+ objComplexType.getBuilder().build();
+ } catch (ODataJPAModelException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ } catch (ODataJPARuntimeException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ }
+
+ objComplexType.addJPAEdmCompleTypeView(localView);
+ assertTrue(objComplexType.getConsistentEdmComplexTypes().size() > 1);
+ }
+
+ @Test
+ public void testExpandEdmComplexType() {
+ ComplexType complexType = new ComplexType();
+ List<Property> properties = new ArrayList<Property>();
+ JPAEdmMapping mapping1 = new JPAEdmMappingImpl();
+ mapping1.setJPAColumnName("LINEITEMID");
+ ((Mapping) mapping1).setInternalName("LineItemKey.LiId");
+ JPAEdmMapping mapping2 = new JPAEdmMappingImpl();
+ mapping2.setJPAColumnName("LINEITEMNAME");
+ ((Mapping) mapping2).setInternalName("LineItemKey.LiName");
+ properties.add(new SimpleProperty().setName("LIID").setMapping((Mapping) mapping1));
+ properties.add(new SimpleProperty().setName("LINAME").setMapping((Mapping) mapping2));
+ complexType.setProperties(properties);
+ List<Property> expandedList = null;
+ try {
+ objComplexType.expandEdmComplexType(complexType, expandedList, "SalesOrderItemKey");
+ } catch (ClassCastException e) {
+ assertTrue(false);
+ }
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testComplexTypeCreation() {
+ try {
+ objComplexType.getBuilder().build();
+ } catch (ODataJPARuntimeException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ } catch (ODataJPAModelException e) {
+ fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+ }
+ assertEquals(objComplexType.pUnitName, "salesorderprocessing");
+ }
+
+ private class JPAEdmMetaModel extends JPAMetaModelMock {
+ Set<EmbeddableType<?>> embeddableSet;
+
+ public JPAEdmMetaModel() {
+ embeddableSet = new HashSet<EmbeddableType<?>>();
+ }
+
+ @Override
+ public Set<EmbeddableType<?>> getEmbeddables() {
+ embeddableSet.add(new JPAEdmEmbeddable<String>());
+ return embeddableSet;
+ }
+
+ }
+
+ @SuppressWarnings("hiding")
+ private class JPAEdmEmbeddable<String> extends JPAEmbeddableMock<String> {
+
+ Set<Attribute<? super String, ?>> attributeSet = new HashSet<Attribute<? super String, ?>>();
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ private void setValuesToSet() {
+ attributeSet.add((Attribute<? super String, String>) new JPAEdmAttribute(java.lang.String.class, "SOID"));
+ attributeSet.add((Attribute<? super String, String>) new JPAEdmAttribute(java.lang.String.class, "SONAME"));
+ }
+
+ @Override
+ public Set<Attribute<? super String, ?>> getAttributes() {
+ setValuesToSet();
+ return attributeSet;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<String> getJavaType() {
+ return (Class<String>) java.lang.String.class;
+ }
+
+ }
+
+ @SuppressWarnings("hiding")
+ private class JPAEdmAttribute<Object, String> extends JPASingularAttributeMock<Object, String> {
+
+ @Override
+ public PersistentAttributeType getPersistentAttributeType() {
+ return PersistentAttributeType.BASIC;
+ }
+
+ Class<String> clazz;
+ java.lang.String attributeName;
+
+ public JPAEdmAttribute(final Class<String> javaType, final java.lang.String name) {
+ this.clazz = javaType;
+ this.attributeName = name;
+
+ }
+
+ @Override
+ public Class<String> getJavaType() {
+ return clazz;
+ }
+
+ @Override
+ public java.lang.String getName() {
+ return this.attributeName;
+ }
+
+ @Override
+ public boolean isId() {
+ return false;
+ }
+
+ }
+}