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 2015/11/17 19:48:04 UTC
[1/3] olingo-odata2 git commit: [OLINGO-824] Fixed JoinColumns on EDM
creation
Repository: olingo-odata2
Updated Branches:
refs/heads/master 2675f5f48 -> 2a22911dc
[OLINGO-824] Fixed JoinColumns on EDM creation
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/a2f89adc
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/a2f89adc
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/a2f89adc
Branch: refs/heads/master
Commit: a2f89adc367e0f48d9dbdc8d24370dd053143cfa
Parents: f8bbd74
Author: Michael Bolz <mi...@sap.com>
Authored: Mon Nov 16 19:27:22 2015 +0100
Committer: Michael Bolz <mi...@sap.com>
Committed: Mon Nov 16 19:27:22 2015 +0100
----------------------------------------------------------------------
.../jpa/processor/core/model/JPAEdmFacets.java | 16 +++-
.../processor/core/model/JPAEdmProperty.java | 87 ++++++++++----------
.../core/model/JPAEdmPropertyTest.java | 2 +
.../jpa/processor/ref/model/Customer.java | 19 ++++-
4 files changed, 75 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a2f89adc/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFacets.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFacets.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFacets.java
index 51cd37b..04c795e 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFacets.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFacets.java
@@ -28,19 +28,26 @@ import org.apache.olingo.odata2.api.edm.provider.Facets;
import org.apache.olingo.odata2.api.edm.provider.SimpleProperty;
public class JPAEdmFacets {
- public static void setFacets(final Attribute<?, ?> jpaAttribute, final SimpleProperty edmProperty) {
+ /**
+ * Create and set new facets for SimpleProperty.
+ * The new created and set facets are returned for further modification.
+ *
+ * @param jpaAttribute
+ * @param edmProperty property at which facets are set
+ * @return set new facets for SimpleProperty
+ */
+ public static Facets createAndSet(final Attribute<?, ?> jpaAttribute, final SimpleProperty edmProperty) {
EdmSimpleTypeKind edmTypeKind = edmProperty.getType();
Facets facets = new Facets();
edmProperty.setFacets(facets);
Column column = null;
if (jpaAttribute.getJavaMember() instanceof AnnotatedElement) {
- column = ((AnnotatedElement) jpaAttribute
- .getJavaMember()).getAnnotation(Column.class);
+ column = ((AnnotatedElement) jpaAttribute.getJavaMember()).getAnnotation(Column.class);
}
if (column == null) {
- return;
+ return facets;
}
setNullable(column, edmProperty);
@@ -68,6 +75,7 @@ public class JPAEdmFacets {
default:
break;
}
+ return facets;
}
private static void setNullable(final Column column, final SimpleProperty edmProperty) {
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a2f89adc/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
index fbb8f96..a0168e9 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
@@ -39,6 +39,7 @@ import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
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.Facets;
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;
@@ -192,13 +193,10 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
String targetEntityName = null;
String entityTypeName = null;
if (isBuildModeComplexType) {
- jpaAttributes = sortInAscendingOrder(complexTypeView.getJPAEmbeddableType()
- .getAttributes());
- entityTypeName = complexTypeView.getJPAEmbeddableType().getJavaType()
- .getSimpleName();
+ jpaAttributes = sortInAscendingOrder(complexTypeView.getJPAEmbeddableType().getAttributes());
+ entityTypeName = complexTypeView.getJPAEmbeddableType().getJavaType().getSimpleName();
} else {
- jpaAttributes = sortInAscendingOrder(entityTypeView.getJPAEntityType()
- .getAttributes());
+ jpaAttributes = sortInAscendingOrder(entityTypeView.getJPAEntityType().getAttributes());
entityTypeName = entityTypeView.getJPAEntityType().getName();
}
@@ -210,13 +208,12 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
continue;
}
- PersistentAttributeType attributeType = currentAttribute
- .getPersistentAttributeType();
+ PersistentAttributeType attributeType = currentAttribute.getPersistentAttributeType();
switch (attributeType) {
case BASIC:
currentSimpleProperty = new SimpleProperty();
- properties.add(buildSimpleProperty(currentAttribute, currentSimpleProperty, false));
+ properties.add(buildSimpleProperty(currentAttribute, currentSimpleProperty));
if (((SingularAttribute<?, ?>) currentAttribute).isId()) {
if (keyView == null) {
keyView = new JPAEdmKey(JPAEdmProperty.this);
@@ -226,46 +223,37 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
}
break;
case EMBEDDED:
- ComplexType complexType = complexTypeView
- .searchEdmComplexType(currentAttribute.getJavaType().getName());
+ ComplexType complexType = complexTypeView.searchEdmComplexType(currentAttribute.getJavaType().getName());
if (complexType == null) {
- JPAEdmComplexTypeView complexTypeViewLocal = new JPAEdmComplexType(
- schemaView, currentAttribute);
+ JPAEdmComplexTypeView complexTypeViewLocal = new JPAEdmComplexType(schemaView, currentAttribute);
complexTypeViewLocal.getBuilder().build();
complexType = complexTypeViewLocal.getEdmComplexType();
complexTypeView.addJPAEdmCompleTypeView(complexTypeViewLocal);
}
- if (isBuildModeComplexType == false
- && entityTypeView.getJPAEntityType().getIdType()
- .getJavaType()
- .equals(currentAttribute.getJavaType())) {
+ if (isBuildModeComplexType == false && entityTypeView.getJPAEntityType().getIdType().getJavaType()
+ .equals(currentAttribute.getJavaType())) {
if (keyView == null) {
- keyView = new JPAEdmKey(complexTypeView,
- JPAEdmProperty.this);
+ keyView = new JPAEdmKey(complexTypeView, JPAEdmProperty.this);
}
keyView.getBuilder().build();
complexTypeView.expandEdmComplexType(complexType, properties, currentAttribute.getName());
} else {
currentComplexProperty = new ComplexProperty();
if (isBuildModeComplexType) {
- JPAEdmNameBuilder
- .build((JPAEdmComplexPropertyView) JPAEdmProperty.this,
- complexTypeView.getJPAEmbeddableType().getJavaType().getSimpleName());
+ JPAEdmNameBuilder.build((JPAEdmComplexPropertyView) JPAEdmProperty.this,
+ complexTypeView.getJPAEmbeddableType().getJavaType().getSimpleName());
} else {
JPAEdmNameBuilder
- .build((JPAEdmComplexPropertyView) JPAEdmProperty.this,
- JPAEdmProperty.this, skipDefaultNaming);
+ .build((JPAEdmComplexPropertyView) JPAEdmProperty.this, JPAEdmProperty.this, skipDefaultNaming);
}
- currentComplexProperty.setType(new FullQualifiedName(
- schemaView.getEdmSchema().getNamespace(),
- complexType.getName()));
+ currentComplexProperty
+ .setType(new FullQualifiedName(schemaView.getEdmSchema().getNamespace(), complexType.getName()));
properties.add(currentComplexProperty);
- if (!complexTypeView.isReferencedInKey(currentComplexProperty.getType().getName()))
- {
+ if (!complexTypeView.isReferencedInKey(currentComplexProperty.getType().getName())) {
complexTypeView.setReferencedInKey(currentComplexProperty.getType().getName());
}
}
@@ -276,8 +264,8 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
case ONE_TO_ONE:
case MANY_TO_ONE:
- if (attributeType.equals(PersistentAttributeType.MANY_TO_ONE)
- || attributeType.equals(PersistentAttributeType.ONE_TO_ONE)) {
+ if (attributeType.equals(PersistentAttributeType.MANY_TO_ONE) || attributeType
+ .equals(PersistentAttributeType.ONE_TO_ONE)) {
addForeignKey(currentAttribute);
}
@@ -292,11 +280,11 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
associationView.addJPAEdmAssociationView(associationViewLocal, associationEndView);
}
- if (attributeType.equals(PersistentAttributeType.MANY_TO_ONE)
- || attributeType.equals(PersistentAttributeType.ONE_TO_ONE)) {
+ if (attributeType.equals(PersistentAttributeType.MANY_TO_ONE) || attributeType
+ .equals(PersistentAttributeType.ONE_TO_ONE)) {
- JPAEdmReferentialConstraintView refConstraintView = new JPAEdmReferentialConstraint(
- associationView, entityTypeView, JPAEdmProperty.this);
+ JPAEdmReferentialConstraintView refConstraintView =
+ new JPAEdmReferentialConstraint(associationView, entityTypeView, JPAEdmProperty.this);
refConstraintView.getBuilder().build();
if (refConstraintView.isExists()) {
@@ -309,8 +297,8 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
currentEntityName = entityTypeView.getJPAEntityType().getName();
if (currentAttribute.isCollection()) {
- targetEntityName = ((PluralAttribute<?, ?, ?>) currentAttribute).getElementType().getJavaType()
- .getSimpleName();
+ targetEntityName =
+ ((PluralAttribute<?, ?, ?>) currentAttribute).getElementType().getJavaType().getSimpleName();
} else {
targetEntityName = currentAttribute.getJavaType().getSimpleName();
}
@@ -333,18 +321,25 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
}
+ private SimpleProperty buildSimpleProperty(final Attribute<?, ?> jpaAttribute, final SimpleProperty simpleProperty)
+ throws ODataJPAModelException, ODataJPARuntimeException {
+ return buildSimpleProperty(jpaAttribute, simpleProperty, null);
+ }
+
private SimpleProperty buildSimpleProperty(final Attribute<?, ?> jpaAttribute, final SimpleProperty simpleProperty,
- final boolean isFK)
- throws ODataJPAModelException,
- ODataJPARuntimeException {
+ final JoinColumn joinColumn)
+ throws ODataJPAModelException, ODataJPARuntimeException {
- JPAEdmNameBuilder
- .build((JPAEdmPropertyView) JPAEdmProperty.this, isBuildModeComplexType, skipDefaultNaming, isFK);
+ boolean isForeignKey = joinColumn != null;
+ JPAEdmNameBuilder.build(JPAEdmProperty.this, isBuildModeComplexType, skipDefaultNaming, isForeignKey);
EdmSimpleTypeKind simpleTypeKind = JPATypeConvertor
.convertToEdmSimpleType(jpaAttribute
.getJavaType(), jpaAttribute);
simpleProperty.setType(simpleTypeKind);
- JPAEdmFacets.setFacets(jpaAttribute, simpleProperty);
+ Facets facets = JPAEdmFacets.createAndSet(jpaAttribute, simpleProperty);
+ if(isForeignKey) {
+ facets.setNullable(joinColumn.nullable());
+ }
return simpleProperty;
@@ -426,7 +421,11 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
}
if (joinColumn.insertable() && joinColumn.updatable()) {
currentSimpleProperty = new SimpleProperty();
- properties.add(buildSimpleProperty(currentRefAttribute, currentSimpleProperty, true));
+ properties.add(buildSimpleProperty(currentRefAttribute, currentSimpleProperty, joinColumn));
+ if(joinColumn.nullable()) {
+ currentSimpleProperty.getFacets();
+
+ }
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a2f89adc/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
index f76a50f..c8e9fe1 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
@@ -549,6 +549,7 @@ public class JPAEdmPropertyTest extends JPAEdmTestModelView {
EasyMock.expect(joinColumn.referencedColumnName()).andReturn("SOLITID").anyTimes();
EasyMock.expect(joinColumn.insertable()).andReturn(true).anyTimes();
EasyMock.expect(joinColumn.updatable()).andReturn(true).anyTimes();
+ EasyMock.expect(joinColumn.nullable()).andReturn(false).anyTimes();
EasyMock.replay(joinColumn);
return (T) joinColumn;
} else if (testCase.equals("NoJoinColumnNames")) {
@@ -557,6 +558,7 @@ public class JPAEdmPropertyTest extends JPAEdmTestModelView {
EasyMock.expect(joinColumn.referencedColumnName()).andReturn("").anyTimes();
EasyMock.expect(joinColumn.insertable()).andReturn(true).anyTimes();
EasyMock.expect(joinColumn.updatable()).andReturn(true).anyTimes();
+ EasyMock.expect(joinColumn.nullable()).andReturn(true).anyTimes();
EasyMock.replay(joinColumn);
return (T) joinColumn;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a2f89adc/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
index 0605956..656b0f6 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
@@ -20,7 +20,9 @@ package org.apache.olingo.odata2.jpa.processor.ref.model;
import java.sql.Timestamp;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@@ -29,7 +31,10 @@ import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@@ -39,9 +44,13 @@ import javax.persistence.Table;
public class Customer extends CustomerBase {
@Id
- @Column(name = "ID")
+ @Column(name = "ID", nullable = false, length = 20)
private Long id;
+ @ManyToOne(optional = true)
+ @JoinColumn(name = "PARENT_ID", referencedColumnName = "ID" , nullable = true)
+ private Customer parent;
+
@Column(name = "NAME")
private String name;
@@ -74,6 +83,14 @@ public class Customer extends CustomerBase {
this.id = id;
}
+ public Customer getParent() {
+ return parent;
+ }
+
+ public void setParent(Customer parent) {
+ this.parent = parent;
+ }
+
public String getName() {
return name;
}
[3/3] olingo-odata2 git commit: [OLINGO-824] Merge branch
'OLINGO-824_FacetsOnJoinColumns'
Posted by mi...@apache.org.
[OLINGO-824] Merge branch 'OLINGO-824_FacetsOnJoinColumns'
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/2a22911d
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/2a22911d
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/2a22911d
Branch: refs/heads/master
Commit: 2a22911dc2d9b8d23ce304404cd940c219b1df69
Parents: 2675f5f 4752ec1
Author: mibo <mi...@mirb.de>
Authored: Tue Nov 17 19:44:23 2015 +0100
Committer: mibo <mi...@mirb.de>
Committed: Tue Nov 17 19:44:23 2015 +0100
----------------------------------------------------------------------
.../jpa/processor/core/model/JPAEdmFacets.java | 16 +++-
.../processor/core/model/JPAEdmProperty.java | 87 ++++++++++----------
.../core/model/JPAEdmPropertyTest.java | 49 ++++++++---
.../jpa/processor/ref/model/Customer.java | 19 ++++-
4 files changed, 110 insertions(+), 61 deletions(-)
----------------------------------------------------------------------
[2/3] olingo-odata2 git commit: [OLINGO-824] Added test for fixed
JoinColumns on EDM creation
Posted by mi...@apache.org.
[OLINGO-824] Added test for fixed JoinColumns on EDM creation
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/4752ec10
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/4752ec10
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/4752ec10
Branch: refs/heads/master
Commit: 4752ec10a7ad694f491ad0712cc1ddc309679bf6
Parents: a2f89ad
Author: mibo <mi...@mirb.de>
Authored: Tue Nov 17 19:38:55 2015 +0100
Committer: mibo <mi...@mirb.de>
Committed: Tue Nov 17 19:38:55 2015 +0100
----------------------------------------------------------------------
.../core/model/JPAEdmPropertyTest.java | 47 +++++++++++++++-----
1 file changed, 35 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/4752ec10/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
index c8e9fe1..965ca70 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
@@ -38,12 +38,10 @@ import javax.persistence.metamodel.EntityType;
import javax.persistence.metamodel.Metamodel;
import javax.persistence.metamodel.Type;
+import org.apache.olingo.odata2.api.edm.EdmFacets;
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.NavigationProperty;
-import org.apache.olingo.odata2.api.edm.provider.Schema;
+import org.apache.olingo.odata2.api.edm.provider.*;
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;
@@ -198,6 +196,10 @@ public class JPAEdmPropertyTest extends JPAEdmTestModelView {
fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
}
+ Property property = objJPAEdmProperty.getEdmPropertyList().get(0);
+ EdmFacets facets = property.getFacets();
+ assertTrue(facets.isNullable());
+
NavigationProperty navigationProperty =
objJPAEdmProperty.getJPAEdmNavigationPropertyView().getEdmNavigationProperty();
assertNotNull(navigationProperty);
@@ -206,6 +208,26 @@ public class JPAEdmPropertyTest extends JPAEdmTestModelView {
assertEquals("StringDetails", navigationProperty.getName());
}
+ @Test
+ public void testBuildManyToOneJoinColumnWithFacets() {
+ ATTRIBUTE_TYPE = PersistentAttributeType.MANY_TO_ONE;
+ testCase = "JoinColumnWithFacets";
+ objJPAEdmPropertyTest = new JPAEdmPropertyTest();
+ objJPAEdmProperty = new JPAEdmProperty(objJPAEdmPropertyTest);
+
+ try {
+ objJPAEdmProperty.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);
+ }
+
+ Property property = objJPAEdmProperty.getEdmPropertyList().get(0);
+ EdmFacets facets = property.getFacets();
+ assertFalse(facets.isNullable());
+ }
+
@Override
public Metamodel getJPAMetaModel() {
return new JPAEdmMetaModel();
@@ -543,25 +565,26 @@ public class JPAEdmPropertyTest extends JPAEdmTestModelView {
if (annotationClass.equals(JoinColumn.class)) {
+ JoinColumn joinColumn = EasyMock.createMock(JoinColumn.class);
+ EasyMock.expect(joinColumn.insertable()).andReturn(true).anyTimes();
+ EasyMock.expect(joinColumn.updatable()).andReturn(true).anyTimes();
if (testCase.equals("Default")) {
- JoinColumn joinColumn = EasyMock.createMock(JoinColumn.class);
EasyMock.expect(joinColumn.name()).andReturn("FSOID").anyTimes();
EasyMock.expect(joinColumn.referencedColumnName()).andReturn("SOLITID").anyTimes();
- EasyMock.expect(joinColumn.insertable()).andReturn(true).anyTimes();
- EasyMock.expect(joinColumn.updatable()).andReturn(true).anyTimes();
EasyMock.expect(joinColumn.nullable()).andReturn(false).anyTimes();
EasyMock.replay(joinColumn);
- return (T) joinColumn;
} else if (testCase.equals("NoJoinColumnNames")) {
- JoinColumn joinColumn = EasyMock.createMock(JoinColumn.class);
EasyMock.expect(joinColumn.name()).andReturn("").anyTimes();
EasyMock.expect(joinColumn.referencedColumnName()).andReturn("").anyTimes();
- EasyMock.expect(joinColumn.insertable()).andReturn(true).anyTimes();
- EasyMock.expect(joinColumn.updatable()).andReturn(true).anyTimes();
EasyMock.expect(joinColumn.nullable()).andReturn(true).anyTimes();
EasyMock.replay(joinColumn);
- return (T) joinColumn;
+ } else if (testCase.equals("JoinColumnWithFacets")) {
+ EasyMock.expect(joinColumn.name()).andReturn("ColumnWithFacets").anyTimes();
+ EasyMock.expect(joinColumn.referencedColumnName()).andReturn("").anyTimes();
+ EasyMock.expect(joinColumn.nullable()).andReturn(false).anyTimes();
+ EasyMock.replay(joinColumn);
}
+ return (T) joinColumn;
} else {