Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbvosburgh2011-05-12 04:20:34 +0000
committerbvosburgh2011-05-12 04:20:34 +0000
commitf3839df4f3b3b266e76201593d47d50cfd40ddd2 (patch)
tree7009a51955a04fb47f6abfb4121d37ac4c82408f /jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa
parent8a54688d33fdd37a7c0e6a70c8014cb239fa978a (diff)
downloadwebtools.dali-f3839df4f3b3b266e76201593d47d50cfd40ddd2.tar.gz
webtools.dali-f3839df4f3b3b266e76201593d47d50cfd40ddd2.tar.xz
webtools.dali-f3839df4f3b3b266e76201593d47d50cfd40ddd2.zip
[336296] fix validation of virtual attribute mappings 2 - fix messages
Diffstat (limited to 'jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa')
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java31
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java29
2 files changed, 36 insertions, 24 deletions
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java
index 4834c24f8d..ab7850d978 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -481,20 +481,27 @@ public class OrmIdMappingTests extends ContextModelTestCase
GeneratedValue generatedValue = idMapping.getGeneratedValue();
assertEquals("myTableGenerator", generatedValue.getSpecifiedGenerator());
assertEquals(GenerationType.TABLE, generatedValue.getSpecifiedStrategy());
-
+
+// >>> I'm going to argue there is no such thing as a "virtual" generator,
+// since a Java generator is *not* overridden when its ID mapping (or entity)
+// is overridden in the orm.xml file - both the orm.xml ID mapping and the
+// Java mapping can define an "active" generator as long as they have different
+// names ~bjv
TableGenerator tableGenerator = idMapping.getGeneratorContainer().getTableGenerator();
- assertEquals("myTableGenerator", tableGenerator.getName());
- assertEquals("myTable", tableGenerator.getSpecifiedTable());
- assertEquals("myCatalog", tableGenerator.getSpecifiedCatalog());
- assertEquals("mySchema", tableGenerator.getSpecifiedSchema());
- assertEquals("myPkColumnName", tableGenerator.getSpecifiedPkColumnName());
- assertEquals("myPkColumnValue", tableGenerator.getSpecifiedPkColumnValue());
- assertEquals("myValueColumnName", tableGenerator.getSpecifiedValueColumnName());
- assertEquals(Integer.valueOf(1), tableGenerator.getSpecifiedInitialValue());
- assertEquals(Integer.valueOf(1), tableGenerator.getSpecifiedAllocationSize());
+ assertNull(tableGenerator);
+// assertEquals("myTableGenerator", tableGenerator.getName());
+// assertEquals("myTable", tableGenerator.getSpecifiedTable());
+// assertEquals("myCatalog", tableGenerator.getSpecifiedCatalog());
+// assertEquals("mySchema", tableGenerator.getSpecifiedSchema());
+// assertEquals("myPkColumnName", tableGenerator.getSpecifiedPkColumnName());
+// assertEquals("myPkColumnValue", tableGenerator.getSpecifiedPkColumnValue());
+// assertEquals("myValueColumnName", tableGenerator.getSpecifiedValueColumnName());
+// assertEquals(Integer.valueOf(1), tableGenerator.getSpecifiedInitialValue());
+// assertEquals(Integer.valueOf(1), tableGenerator.getSpecifiedAllocationSize());
SequenceGenerator sequenceGenerator = idMapping.getGeneratorContainer().getSequenceGenerator();
- assertEquals("mySequenceGenerator", sequenceGenerator.getName());
+ assertNull(sequenceGenerator);
+// assertEquals("mySequenceGenerator", sequenceGenerator.getName());
}
public void testVirtualMappingMetadataCompleteTrue() throws Exception {
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java
index a4a493fd7e..1ee6bae024 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -577,21 +577,27 @@ public class OrmTableGeneratorTests extends ContextModelTestCase
JavaTableGenerator javaTableGenerator = javaIdMapping.getGeneratorContainer().addTableGenerator();
javaTableGenerator.setName("TABLE_GENERATOR");
+// >>> I'm going to argue there is no such thing as a "virtual" generator,
+// since a Java generator is *not* overridden when its ID mapping (or entity)
+// is overridden in the orm.xml file - both the orm.xml ID mapping and the
+// Java mapping can define an "active" generator as long as they have different
+// names ~bjv
TableGenerator tableGenerator = virtualIdMapping.getGeneratorContainer().getTableGenerator();
- Iterator<UniqueConstraint> uniqueConstraints = tableGenerator.getUniqueConstraints().iterator();
- assertFalse(uniqueConstraints.hasNext());
-
+ assertNull(tableGenerator);
+// Iterator<UniqueConstraint> uniqueConstraints = tableGenerator.getUniqueConstraints().iterator();
+// assertFalse(uniqueConstraints.hasNext());
javaTableGenerator.addUniqueConstraint().addColumnName("FOO");
javaTableGenerator.addUniqueConstraint().addColumnName("BAR");
javaTableGenerator.addUniqueConstraint().addColumnName("BAZ");
- uniqueConstraints = tableGenerator.getUniqueConstraints().iterator();
- assertTrue(uniqueConstraints.hasNext());
- assertEquals("FOO", uniqueConstraints.next().getColumnNames().iterator().next());
- assertEquals("BAR", uniqueConstraints.next().getColumnNames().iterator().next());
- assertEquals("BAZ", uniqueConstraints.next().getColumnNames().iterator().next());
- assertFalse(uniqueConstraints.hasNext());
+ assertNull(tableGenerator);
+// uniqueConstraints = tableGenerator.getUniqueConstraints().iterator();
+// assertTrue(uniqueConstraints.hasNext());
+// assertEquals("FOO", uniqueConstraints.next().getColumnNames().iterator().next());
+// assertEquals("BAR", uniqueConstraints.next().getColumnNames().iterator().next());
+// assertEquals("BAZ", uniqueConstraints.next().getColumnNames().iterator().next());
+// assertFalse(uniqueConstraints.hasNext());
OrmIdMapping ormIdMapping = (OrmIdMapping) virtualAttribute.convertToSpecified().getMapping();
@@ -600,5 +606,4 @@ public class OrmTableGeneratorTests extends ContextModelTestCase
assertEquals(0, ormTableGenerator2.getUniqueConstraintsSize());
}
-
-} \ No newline at end of file
+}

Back to the top