Splitting testing project out
diff --git a/.gitignore b/.gitignore
index f1fb894..f762257 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
-/Temporal Entity Example/classes
\ No newline at end of file
+/Temporal Entity Example/classes
+/Temporal Tests
\ No newline at end of file
diff --git a/Temporal Entity Example/.classpath b/Temporal Entity Example/.classpath
index 1cfcb7b..04bb888 100644
--- a/Temporal Entity Example/.classpath
+++ b/Temporal Entity Example/.classpath
@@ -1,18 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry excluding="**/.svn/**" kind="src" path="src"/>
- <classpathentry excluding="**/.svn/**" kind="src" path="test-src"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="con" path="org.eclipse.datatools.connectivity.jdt.DRIVERLIBRARY/MySQL JDBC Driver"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
- <attributes>
- <attribute name="owner.project.facets" value="java"/>
- </attributes>
- </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/EclipseLink 2.3.1">
<attributes>
<attribute name="owner.project.facets" value="jpt.jpa"/>
</attributes>
</classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
+ <attributes>
+ <attribute name="owner.project.facets" value="java"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="classes"/>
</classpath>
diff --git a/Temporal Entity Example/.settings/org.eclipse.jdt.core.prefs b/Temporal Entity Example/.settings/org.eclipse.jdt.core.prefs
index 37edcdc..a0f62a8 100644
--- a/Temporal Entity Example/.settings/org.eclipse.jdt.core.prefs
+++ b/Temporal Entity Example/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -74,4 +74,4 @@
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/Temporal Entity Example/.settings/org.eclipse.wst.common.project.facet.core.xml b/Temporal Entity Example/.settings/org.eclipse.wst.common.project.facet.core.xml
index 1e72272..b488517 100644
--- a/Temporal Entity Example/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ b/Temporal Entity Example/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -3,5 +3,5 @@
<fixed facet="java"/>
<fixed facet="jpt.jpa"/>
<installed facet="jpt.jpa" version="2.0"/>
- <installed facet="java" version="1.7"/>
+ <installed facet="java" version="1.6"/>
</faceted-project>
diff --git "a/Temporal Entity Example/run-configs/AllTests \0501\051.launch" "b/Temporal Entity Example/run-configs/AllTests \0501\051.launch"
deleted file mode 100644
index c812275..0000000
--- "a/Temporal Entity Example/run-configs/AllTests \0501\051.launch"
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/editionsets/AllTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.editionsets.AllTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/ApplySimpleEditionSetTests.launch b/Temporal Entity Example/run-configs/ApplySimpleEditionSetTests.launch
deleted file mode 100644
index 7e2ac48..0000000
--- a/Temporal Entity Example/run-configs/ApplySimpleEditionSetTests.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/editionsets/ApplySimpleEditionSetTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.editionsets.ApplySimpleEditionSetTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/CreateEditionSetTests.launch b/Temporal Entity Example/run-configs/CreateEditionSetTests.launch
deleted file mode 100644
index 21675b3..0000000
--- a/Temporal Entity Example/run-configs/CreateEditionSetTests.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/editionsets/CreateEditionSetTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.editionsets.CreateEditionSetTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/CreateEditionSetTests.verifyEditionSetAtT2.launch b/Temporal Entity Example/run-configs/CreateEditionSetTests.verifyEditionSetAtT2.launch
deleted file mode 100644
index 269c9f8..0000000
--- a/Temporal Entity Example/run-configs/CreateEditionSetTests.verifyEditionSetAtT2.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/editionsets/CreateEditionSetTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value="verifyEditionSetAtT2"/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.editionsets.CreateEditionSetTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/CreateEditionSetTests.verifyEditionSetAtT4.launch b/Temporal Entity Example/run-configs/CreateEditionSetTests.verifyEditionSetAtT4.launch
deleted file mode 100644
index e680401..0000000
--- a/Temporal Entity Example/run-configs/CreateEditionSetTests.verifyEditionSetAtT4.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/editionsets/CreateEditionSetTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value="verifyEditionSetAtT4"/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.editionsets.CreateEditionSetTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/DeleteTests.launch b/Temporal Entity Example/run-configs/DeleteTests.launch
deleted file mode 100644
index 29497db..0000000
--- a/Temporal Entity Example/run-configs/DeleteTests.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/DeleteTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.DeleteTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/DuplicateInsertOnCreateMerge.launch b/Temporal Entity Example/run-configs/DuplicateInsertOnCreateMerge.launch
deleted file mode 100644
index f51c47c..0000000
--- a/Temporal Entity Example/run-configs/DuplicateInsertOnCreateMerge.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/DuplicateInsertOnCreateMerge.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.DuplicateInsertOnCreateMerge"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/EditionSetConfigTests.launch b/Temporal Entity Example/run-configs/EditionSetConfigTests.launch
deleted file mode 100644
index 608f52b..0000000
--- a/Temporal Entity Example/run-configs/EditionSetConfigTests.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/editionsets/EditionSetConfigTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.editionsets.EditionSetConfigTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/EditionSetTests.launch b/Temporal Entity Example/run-configs/EditionSetTests.launch
deleted file mode 100644
index cb19a38..0000000
--- a/Temporal Entity Example/run-configs/EditionSetTests.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.EditionSetTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/FullPersonWithEditions.launch b/Temporal Entity Example/run-configs/FullPersonWithEditions.launch
deleted file mode 100644
index 4d06fdb..0000000
--- a/Temporal Entity Example/run-configs/FullPersonWithEditions.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/FullPersonWithEditions.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.FullPersonWithEditions"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/FullPersonWithEditions.queryAllCurrent.launch b/Temporal Entity Example/run-configs/FullPersonWithEditions.queryAllCurrent.launch
deleted file mode 100644
index 0b0fef2..0000000
--- a/Temporal Entity Example/run-configs/FullPersonWithEditions.queryAllCurrent.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/FullPersonWithEditions.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value="queryAllCurrent"/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.FullPersonWithEditions"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/FuturePersonTests.launch b/Temporal Entity Example/run-configs/FuturePersonTests.launch
deleted file mode 100644
index 1849c24..0000000
--- a/Temporal Entity Example/run-configs/FuturePersonTests.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/FuturePersonTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.FuturePersonTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/MultipleEditionQueries.launch b/Temporal Entity Example/run-configs/MultipleEditionQueries.launch
deleted file mode 100644
index 00b388a..0000000
--- a/Temporal Entity Example/run-configs/MultipleEditionQueries.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/MultipleEditionQueries.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.MultipleEditionQueries"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/PropagateChangesTests.launch b/Temporal Entity Example/run-configs/PropagateChangesTests.launch
deleted file mode 100644
index ca077c7..0000000
--- a/Temporal Entity Example/run-configs/PropagateChangesTests.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/editionsets/PropagateChangesTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.editionsets.PropagateChangesTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/ProxyWrapperUpdateTests.launch b/Temporal Entity Example/run-configs/ProxyWrapperUpdateTests.launch
deleted file mode 100644
index 6cd320d..0000000
--- a/Temporal Entity Example/run-configs/ProxyWrapperUpdateTests.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/ProxyWrapperUpdateTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.ProxyWrapperUpdateTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/Temporal Entity Example - AllTests.launch b/Temporal Entity Example/run-configs/Temporal Entity Example - AllTests.launch
deleted file mode 100644
index 55f51cf..0000000
--- a/Temporal Entity Example/run-configs/Temporal Entity Example - AllTests.launch
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/AllTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
-<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
-<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.AllTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/TemporalEntityManagerTests.launch b/Temporal Entity Example/run-configs/TemporalEntityManagerTests.launch
deleted file mode 100644
index 5885286..0000000
--- a/Temporal Entity Example/run-configs/TemporalEntityManagerTests.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/internal/TemporalEntityManagerTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.internal.TemporalEntityManagerTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/TemporalHelperTests.launch b/Temporal Entity Example/run-configs/TemporalHelperTests.launch
deleted file mode 100644
index a66f00f..0000000
--- a/Temporal Entity Example/run-configs/TemporalHelperTests.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/internal/TemporalHelperTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.internal.TemporalHelperTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/TemporalQueryRedirectorTests.launch b/Temporal Entity Example/run-configs/TemporalQueryRedirectorTests.launch
deleted file mode 100644
index ee7aad1..0000000
--- a/Temporal Entity Example/run-configs/TemporalQueryRedirectorTests.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/TemporalQueryRedirectorTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.TemporalQueryRedirectorTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/VerifyConfigTests.launch b/Temporal Entity Example/run-configs/VerifyConfigTests.launch
deleted file mode 100644
index ef2e044..0000000
--- a/Temporal Entity Example/run-configs/VerifyConfigTests.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/internal/VerifyConfigTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.internal.VerifyConfigTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/VerifySchemaManager.launch b/Temporal Entity Example/run-configs/VerifySchemaManager.launch
deleted file mode 100644
index 04cfc02..0000000
--- a/Temporal Entity Example/run-configs/VerifySchemaManager.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/internal/VerifySchemaManager.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.internal.VerifySchemaManager"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/run-configs/WrapperPolicyTests.launch b/Temporal Entity Example/run-configs/WrapperPolicyTests.launch
deleted file mode 100644
index d6b4e0d..0000000
--- a/Temporal Entity Example/run-configs/WrapperPolicyTests.launch
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/Temporal Entity Example/test-src/tests/internal/WrapperPolicyTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="tests.internal.WrapperPolicyTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Temporal Entity Example"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-javaagent:${eclipselink_2.3.2}\eclipselink\jlib\eclipselink.jar"/>
-</launchConfiguration>
diff --git a/Temporal Entity Example/sql b/Temporal Entity Example/sql
deleted file mode 100644
index af0e5b3..0000000
--- a/Temporal Entity Example/sql
+++ /dev/null
@@ -1,17 +0,0 @@
-SELECT t1.OID, t1.P_NAMES, t1.VERSION, t1.END_TS, t1.START_TS, t1.CID, t1.ADDR_ID
- FROM TADDRESS t0, TPERSON t1
- WHERE (((t0.CITY = 't2') AND ((100 >= t1.START_TS) AND (100 < t1.END_TS)))
- AND ((t0.CID = t1.ADDR_ID) AND ((100 >= t0.START_TS) AND (100 < t0.END_TS))))
-
- bind => [t2, 100, 100, 100, 100]
-
-
-SELECT t1.OID, t1.P_NAMES, t1.VERSION, t1.END_TS, t1.START_TS, t1.CID, t1.ADDR_ID
- FROM TADDRESS t0, TPERSON t1
- WHERE (((t0.CITY = 'now') AND ((200 >= t1.START_TS) AND (200 < t1.END_TS)))
- AND ((t0.OID = t1.ADDR_ID) AND ((200 >= t0.START_TS) AND (200 < t0.END_TS))))
-
- bind => [t2, 200, 200, 200, 200]
-
-SELECT * FROM TPERSON
-SELECT * FROM TADDRESS
\ No newline at end of file
diff --git a/Temporal Entity Example/src/model/entities/PersonEntity.java b/Temporal Entity Example/src/model/entities/PersonEntity.java
index 4379cb3..946a7fb 100644
--- a/Temporal Entity Example/src/model/entities/PersonEntity.java
+++ b/Temporal Entity Example/src/model/entities/PersonEntity.java
@@ -186,7 +186,6 @@
}
@SuppressWarnings("rawtypes")
- @Override
public void applyEdition(TemporalEntity edition) {
Person personEdition = (Person) edition;
diff --git a/Temporal Entity Example/src/temporal/BaseEntity.java b/Temporal Entity Example/src/temporal/BaseEntity.java
index 6bcda98..3d2ddba 100644
--- a/Temporal Entity Example/src/temporal/BaseEntity.java
+++ b/Temporal Entity Example/src/temporal/BaseEntity.java
@@ -56,5 +56,5 @@
public long getVersion() {
return version;
}
-
+
}
\ No newline at end of file
diff --git a/Temporal Entity Example/src/temporal/BaseTemporalEntity.java b/Temporal Entity Example/src/temporal/BaseTemporalEntity.java
index 38049dc..3d59652 100644
--- a/Temporal Entity Example/src/temporal/BaseTemporalEntity.java
+++ b/Temporal Entity Example/src/temporal/BaseTemporalEntity.java
@@ -77,11 +77,4 @@
return getContinuity() != null && getId() == getContinuity().getId();
}
- /**
- * TODO
- */
- @SuppressWarnings("rawtypes")
- public void applyEdition(TemporalEntity edition) {
-
- }
}
\ No newline at end of file
diff --git a/Temporal Entity Example/src/temporal/EditionSet.java b/Temporal Entity Example/src/temporal/EditionSet.java
index 8d38dbf..536e480 100644
--- a/Temporal Entity Example/src/temporal/EditionSet.java
+++ b/Temporal Entity Example/src/temporal/EditionSet.java
@@ -24,10 +24,10 @@
import temporal.persistence.EditionSetEventListener;
/**
- * An EditionSet represents a proposed set of future changes that should be performed
- * together at the same effective time. This is an optimisation in the model to
- * collect all changes for a future point and simplify committing them all
- * together as the current.
+ * An EditionSet represents a proposed set of future changes that should be
+ * performed together at the same effective time. This is an optimisation in the
+ * model to collect all changes for a future point and simplify committing them
+ * all together as the current.
*
* @author dclarke
* @since EclipseLink 2.3.1
@@ -39,12 +39,12 @@
public class EditionSet {
@Id
- @Column(name="ID")
+ @Column(name = "ID")
private long effective;
private String description;
-
- @OneToMany(mappedBy="editionSet", cascade=CascadeType.ALL)
+
+ @OneToMany(mappedBy = "editionSet", cascade = CascadeType.ALL)
private List<EditionSetEntry> entries = new ArrayList<EditionSetEntry>();
private EditionSet() {
@@ -72,13 +72,24 @@
return entries;
}
- public EditionSetEntry add(Temporal temporalObject) {
- EditionSetEntry entry = new EditionSetEntry(this, temporalObject);
+ public EditionSetEntry add(Temporal temporalObject, boolean newEntity) {
+ EditionSetEntry entry = new EditionSetEntry(this, temporalObject, newEntity);
getEntries().add(entry);
return entry;
}
- public boolean hasEntries() {
- return !getEntries().isEmpty();
+ public boolean hasChanges() {
+ for (EditionSetEntry ese : getEntries()) {
+ if (ese.hasChanges()) {
+ return true;
+ }
+ }
+ return false;
}
+
+ @Override
+ public String toString() {
+ return "EditionSet(" + Effectivity.timeString(getEffective()) + ")";
+ }
+
}
diff --git a/Temporal Entity Example/src/temporal/EditionSetEntry.java b/Temporal Entity Example/src/temporal/EditionSetEntry.java
index 823f55b..3f7314f 100644
--- a/Temporal Entity Example/src/temporal/EditionSetEntry.java
+++ b/Temporal Entity Example/src/temporal/EditionSetEntry.java
@@ -15,6 +15,7 @@
import java.util.HashSet;
import java.util.Set;
+import javax.persistence.CascadeType;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
@@ -54,7 +55,7 @@
* The {@link Temporal} or {@link TemporalEntity} that has been created or
* modified
*/
- @VariableOneToOne(fetch = FetchType.LAZY)
+ @VariableOneToOne(fetch = FetchType.LAZY, cascade=CascadeType.REMOVE)
private Temporal temporal;
/**
@@ -65,14 +66,17 @@
@Column(name = "ATTRIBUTE")
private Set<String> attributes = new HashSet<String>();
+ private boolean newTemporal = false;
+
private EditionSetEntry() {
super();
}
- public EditionSetEntry(EditionSet editionSet, Temporal temporal) {
+ public EditionSetEntry(EditionSet editionSet, Temporal temporal, boolean newTemporal) {
this();
this.editionSet = editionSet;
this.temporal = temporal;
+ this.newTemporal = newTemporal;
}
public long getId() {
@@ -101,6 +105,14 @@
}
}
+ public boolean isNew() {
+ return this.newTemporal;
+ }
+
+ public boolean hasChanges() {
+ return isNew() || !getAttributes().isEmpty();
+ }
+
@Override
public String toString() {
return "EditionSetEntry[" + getTemporal() + "]";
diff --git a/Temporal Entity Example/src/temporal/EditionSetHelper.java b/Temporal Entity Example/src/temporal/EditionSetHelper.java
index 6285102..ad5df16 100644
--- a/Temporal Entity Example/src/temporal/EditionSetHelper.java
+++ b/Temporal Entity Example/src/temporal/EditionSetHelper.java
@@ -72,20 +72,26 @@
}
}
}
-
- continuity.applyEdition(edition);
+
+ // continuity.applyEdition(edition);
continuity.getEffectivity().setEnd(edition.getEffectivity().getEnd());
}
/**
- * TODO
+ * Remove and {@link EditionSet} along with all of its entries. Any future
+ * edition value propagation must be undone in this method.
*
- * @param em
- * @param editionSet
- * @param effective
+ * @see TemporalEntityManager#remove(Object)
+ * @param temporalEntityManager
+ * @param entity
*/
- public static void move(EntityManager em, EditionSet editionSet, long effective) {
-
+ protected static void remove(TemporalEntityManager em, EditionSet editionSet) {
+ System.out.println("EditionSetHelper.remove: " + editionSet);
+
+ for (EditionSetEntry ese: editionSet.getEntries()) {
+ em.remove(ese.getTemporal());
+ }
}
+
}
diff --git a/Temporal Entity Example/src/temporal/Effectivity.java b/Temporal Entity Example/src/temporal/Effectivity.java
index 3999117..bcd10a0 100644
--- a/Temporal Entity Example/src/temporal/Effectivity.java
+++ b/Temporal Entity Example/src/temporal/Effectivity.java
@@ -88,7 +88,7 @@
}
public String toString() {
- return "Effectivity(" + getStart() + " - " + getEnd() + ")";
+ return "Effectivity(" + timeString(getStart()) + " - " + timeString(getEnd()) + ")";
}
public String toString(TemporalEntity<?> entity) {
@@ -104,7 +104,7 @@
return writer.toString();
}
- private String timeString(long ts) {
+ protected static String timeString(long ts) {
if (ts == BOT) {
return "BOT";
}
diff --git a/Temporal Entity Example/src/temporal/TemporalEntity.java b/Temporal Entity Example/src/temporal/TemporalEntity.java
index e97ce3f..94400d7 100644
--- a/Temporal Entity Example/src/temporal/TemporalEntity.java
+++ b/Temporal Entity Example/src/temporal/TemporalEntity.java
@@ -39,14 +39,4 @@
boolean isContinuity();
- /**
- * When an edition is promoted to become the continuity this method is
- * invoked. This method is invoked after the {@link EditionSetHelper} has
- * copied all of the mapped values over and allows for entity specific logic
- * to be applied.
- */
- @SuppressWarnings("rawtypes")
- void applyEdition(TemporalEntity edition);
-
-
}
diff --git a/Temporal Entity Example/src/temporal/TemporalEntityManager.java b/Temporal Entity Example/src/temporal/TemporalEntityManager.java
index 07c78e1..f98c72d 100644
--- a/Temporal Entity Example/src/temporal/TemporalEntityManager.java
+++ b/Temporal Entity Example/src/temporal/TemporalEntityManager.java
@@ -13,7 +13,8 @@
package temporal;
import static temporal.TemporalHelper.NON_TEMPORAL;
-import static temporal.persistence.DescriptorHelper.*;
+import static temporal.persistence.DescriptorHelper.getClassDescriptor;
+import static temporal.persistence.DescriptorHelper.getEditionDescriptor;
import java.lang.reflect.Member;
@@ -39,7 +40,8 @@
import temporal.persistence.DescriptorHelper;
/**
- * TODO
+ * {@link EntityManager} wrapper that handles edition change tracking with
+ * {@link EditionSet}
*
* @author dclarke
* @since EclipseLink 2.3.2
@@ -53,17 +55,18 @@
public static final String EFF_TS_PROPERTY = "EFF_TS";
/**
- * TODO
+ * Property name used to cache the {@link TemporalEntityManager} wrapper
+ * within the properties of the {@link EntityManager}.
*/
public static final String TEMPORAL_EM_PROPERTY = TemporalEntityManager.class.getName();
/**
- * TODO
+ * Current effective time for the creation of new editions
*/
private Long effective;
/**
- * TODO
+ * Current {@link EditionSet}
*/
private EditionSet editionSet;
@@ -74,7 +77,7 @@
* @return
*/
public static TemporalEntityManager getInstance(EntityManager em) {
- if (TemporalEntityManager.class.isAssignableFrom(em.getClass())) {
+ if (TemporalEntityManager.class == em.getClass()) {
return (TemporalEntityManager) em;
}
TemporalEntityManager tem = (TemporalEntityManager) em.getProperties().get(TEMPORAL_EM_PROPERTY);
@@ -109,21 +112,13 @@
return unwrap(RepeatableWriteUnitOfWork.class);
}
- public EditionSet setEffectiveTime(Long startTime, boolean initializeEditionSet) {
- this.effective = startTime;
- setProperty(EFF_TS_PROPERTY, startTime);
-
- if (getEditionSet() != null && getEditionSet().getEffective() != startTime) {
+ public void setEffectiveTime(Long startTime) {
+ if (startTime != getEffectiveTime()) {
this.editionSet = null;
}
- if (initializeEditionSet) {
- this.editionSet = initializeEditionSet();
- }
- return this.editionSet;
- }
- public EditionSet setEffectiveTime(Long startTime) {
- return setEffectiveTime(startTime, false);
+ this.effective = startTime;
+ setProperty(EFF_TS_PROPERTY, startTime);
}
public void clearEffectiveTime() {
@@ -131,10 +126,11 @@
setProperty(EFF_TS_PROPERTY, null);
}
+ /**
+ * @return the effective time using the {@link #editionSet} if available.
+ */
public Long getEffectiveTime() {
- // Lookup the EditionSet and use its effective if one exists.
- EditionSet editionSet = getEditionSet();
- if (editionSet != null) {
+ if (this.editionSet != null) {
return editionSet.getEffective();
}
@@ -146,6 +142,31 @@
}
/**
+ * Return the current EditionSet for the effective time. If one has not been
+ * created then create one. Calling this will persist a new
+ * {@link EditionSet} which will be stored on commit. If this side effect is
+ * not desired then rely on the {@link #hasEditionSet()} to ensure one is
+ * not created inadvertently.
+ */
+ public EditionSet getEditionSet() {
+ Long effective = getEffectiveTime();
+ if (this.editionSet == null && effective != null && effective > Effectivity.BOT) {
+ EditionSet es = getEntityManager().find(EditionSet.class, effective);
+
+ if (es == null) {
+ es = new EditionSet(effective);
+ getEntityManager().persist(es);
+ }
+ this.editionSet = es;
+ }
+ return this.editionSet;
+ }
+
+ public boolean hasEditionSet() {
+ return this.editionSet != null;
+ }
+
+ /**
* Create a new edition based on the previous edition (could be current or
* future continuity as well). All values from the provided
* {@link BaseEntity} are copied into the new one and if the start time is
@@ -175,7 +196,7 @@
if (start == null || start == Effectivity.BOT) {
throw new IllegalStateException("Cannot create an eddition without an effective time set");
}
-
+
ClassDescriptor descriptor = getClassDescriptor(session, sourceEntity);
T source = sourceEntity;
if (descriptor.hasWrapperPolicy() && descriptor.getWrapperPolicy().isWrapped(sourceEntity)) {
@@ -205,10 +226,10 @@
edition.getEffectivity().setStart(start);
edition.getEffectivity().setEnd(source.getEffectivity().getEnd());
source.getEffectivity().setEnd(start);
-
+
getEntityManager().persist(edition);
- editionSet.add(edition);
+ editionSet.add(edition, true);
// Flush the transaction so that any changes made to the new edition are
// tracked and the EditionSet can be properly populated at commit.
@@ -216,10 +237,10 @@
getEntityManager().flush();
}
- if (editionDesc.hasWrapperPolicy() && ! editionDesc.getWrapperPolicy().isWrapped(edition)) {
+ if (editionDesc.hasWrapperPolicy() && !editionDesc.getWrapperPolicy().isWrapped(edition)) {
edition = (TemporalEntity<T>) editionDesc.getWrapperPolicy().wrapObject(edition, session);
}
-
+
return (T) edition;
}
@@ -267,7 +288,7 @@
getEntityManager().persist(newInstance);
if (editionSet != null) {
- editionSet.add(newInstance);
+ editionSet.add(newInstance, true);
}
// TODO: Enable if change tracking required
@@ -316,15 +337,15 @@
getEntityManager().persist(edition);
if (editionSet != null) {
- editionSet.add(edition);
+ editionSet.add(edition, true);
}
getEntityManager().flush();
- if (descriptor.hasWrapperPolicy() && ! descriptor.getWrapperPolicy().isWrapped(edition)) {
+ if (descriptor.hasWrapperPolicy() && !descriptor.getWrapperPolicy().isWrapped(edition)) {
edition = (TemporalEntity<T>) descriptor.getWrapperPolicy().wrapObject(edition, session);
}
-
+
return (T) edition;
}
@@ -341,10 +362,10 @@
if (nonTemporal != null && Boolean.valueOf(nonTemporal)) {
return;
}
-
+
TemporalEntity<?> unwrappedSource = source;
if (mapping.getDescriptor().hasWrapperPolicy() && mapping.getDescriptor().getWrapperPolicy().isWrapped(unwrappedSource)) {
- unwrappedSource = (TemporalEntity<?>) mapping.getDescriptor().getWrapperPolicy().unwrapObject(unwrappedSource, session);
+ unwrappedSource = (TemporalEntity<?>) mapping.getDescriptor().getWrapperPolicy().unwrapObject(unwrappedSource, session);
}
Member member = null;
@@ -363,10 +384,10 @@
if (mapping.isCollectionMapping()) {
value = ((CollectionMapping) mapping).getContainerPolicy().cloneFor(value);
}
-
+
Object unwrappedTarget = target;
if (mapping.getDescriptor().hasWrapperPolicy() && mapping.getDescriptor().getWrapperPolicy().isWrapped(unwrappedTarget)) {
- unwrappedTarget = (TemporalEntity<?>) mapping.getDescriptor().getWrapperPolicy().unwrapObject(unwrappedTarget, session);
+ unwrappedTarget = (TemporalEntity<?>) mapping.getDescriptor().getWrapperPolicy().unwrapObject(unwrappedTarget, session);
}
mapping.setRealAttributeValueInObject(unwrappedTarget, value);
@@ -406,30 +427,6 @@
}
}
- public EditionSet getEditionSet() {
- return this.editionSet;
- }
-
- /**
- * Initialize a new EditionSet
- */
- public EditionSet initializeEditionSet() {
- if (!hasEffectiveTime()) {
- throw new IllegalStateException("No effective time configured");
- }
- Long effective = getEffectiveTime();
-
- if (getEditionSet() == null || getEditionSet().getEffective() != effective) {
- EditionSet es = getEntityManager().find(EditionSet.class, effective);
- if (es == null) {
- es = new EditionSet(effective);
- getEntityManager().persist(es);
- }
- this.editionSet = es;
- }
- return editionSet;
- }
-
/**
* TODO: Remove this method when em.find works on either current or edition
* based on temporal effectivity of EntityManager
@@ -489,12 +486,12 @@
*/
private void updateTemporalQuery(Query query) {
DatabaseQuery elQuery = JpaHelper.getDatabaseQuery(query);
-
+
if (hasEffectiveTime() && TemporalHelper.isTemporalEntity(elQuery.getReferenceClass())) {
RepeatableWriteUnitOfWork uow = getUnitOfWork();
ClassDescriptor descriptor = DescriptorHelper.getEditionDescriptor(uow, elQuery.getReferenceClass());
((ObjectLevelReadQuery) elQuery).setReferenceClass(descriptor.getJavaClass());
-
+
// TODO: Should this be set every time?
if (elQuery.getDescriptor() != null) {
elQuery.setDescriptor(descriptor);
@@ -502,6 +499,13 @@
}
}
+ @Override
+ public void remove(Object entity) {
+ super.remove(entity);
+ if (entity instanceof EditionSet) {
+ EditionSetHelper.remove(this, (EditionSet) entity);
+ }
+ }
public String toString() {
return "TemporalEntityManager@" + getEffectiveTime() + "[" + getEntityManager() + "]";
diff --git a/Temporal Entity Example/src/temporal/persistence/EditionSetEventListener.java b/Temporal Entity Example/src/temporal/persistence/EditionSetEventListener.java
index 84a0514..0dd4041 100644
--- a/Temporal Entity Example/src/temporal/persistence/EditionSetEventListener.java
+++ b/Temporal Entity Example/src/temporal/persistence/EditionSetEventListener.java
@@ -59,7 +59,7 @@
RepeatableWriteUnitOfWork uow = (RepeatableWriteUnitOfWork) event.getSession();
UnitOfWorkChangeSet uowCS = (UnitOfWorkChangeSet) uow.getUnitOfWorkChangeSet();
- if (es.hasEntries() && uowCS.hasChanges()) {
+ if (uowCS.hasChanges()) {
for (EditionSetEntry entry : es.getEntries()) {
ObjectChangeSet objCS = uowCS.getCloneToObjectChangeSet().get(entry.getTemporal());
if (objCS != null && objCS.hasChanges()) {
diff --git a/Temporal Entity Example/src/temporal/persistence/PropagateEditionChangesListener.java b/Temporal Entity Example/src/temporal/persistence/PropagateEditionChangesListener.java
index acbe83e..047bc46 100644
--- a/Temporal Entity Example/src/temporal/persistence/PropagateEditionChangesListener.java
+++ b/Temporal Entity Example/src/temporal/persistence/PropagateEditionChangesListener.java
@@ -50,7 +50,7 @@
TemporalEntityManager tem = TemporalEntityManager.getInstance(uow);
EditionSet es = tem.getEditionSet();
- if (es != null && es.hasEntries() && uowCS.hasChanges()) {
+ if (tem.hasEditionSet() && tem.getEditionSet().hasChanges() && uowCS.hasChanges()) {
for (EditionSetEntry entry : es.getEntries()) {
ObjectChangeSet objCS = uowCS.getCloneToObjectChangeSet().get(entry.getTemporal());
List<TemporalEntity<?>> futures = findFutureEditions(uow, entry);
diff --git a/Temporal Entity Example/test-src/tests/AllTests.java b/Temporal Entity Example/test-src/tests/AllTests.java
deleted file mode 100644
index 1f0a617..0000000
--- a/Temporal Entity Example/test-src/tests/AllTests.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses({ tests.internal.AllTests.class,
- FullPersonWithEditions.class,
- FuturePersonTests.class,
- DeleteTests.class,
- ProxyWrapperUpdateTests.class,
- //ModifyCurrentTests.class})
- //DeleteContinuityTests.class,
- MultipleEditionQueries.class,
- DuplicateInsertOnCreateMerge.class,
- tests.editionsets.AllTests.class})
-public class AllTests {
-}
diff --git a/Temporal Entity Example/test-src/tests/BaseTestCase.java b/Temporal Entity Example/test-src/tests/BaseTestCase.java
deleted file mode 100644
index e9d09f5..0000000
--- a/Temporal Entity Example/test-src/tests/BaseTestCase.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-
-import org.eclipse.persistence.jpa.JpaHelper;
-import org.eclipse.persistence.sessions.server.Server;
-import org.eclipse.persistence.tools.schemaframework.SchemaManager;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-
-import temporal.TemporalEntityManager;
-import temporal.persistence.TemporalSchemaManager;
-
-/**
- *
- * @author dclarke
- * @Since EclipseLink 2.3.1
- */
-public abstract class BaseTestCase {
-
- private static EntityManagerFactory emf;
-
- private TemporalEntityManager entityManager;
-
- @Rule
- public TestName testName = new TestName();
-
- public EntityManagerFactory getEMF() {
- if (emf == null) {
- emf = Persistence.createEntityManagerFactory("example");
-
- Server session = JpaHelper.getServerSession(emf);
-
- SchemaManager sm = new TemporalSchemaManager(session);
- // Cache SchemaManager so it can be verified in test cases
- session.setProperty(SchemaManager.class.getName(), sm);
- sm.replaceDefaultTables(false, true);
- sm.replaceSequences();
-
- // Populate test case example instances
- TemporalEntityManager em = TemporalEntityManager.getInstance(emf.createEntityManager());
- em.getTransaction().begin();
- populate(em);
- em.getTransaction().commit();
- em.close();
- System.out.println("\n--- CREATE EMF & POPULATE DONE ---\n");
-
- closeEntityManager();
- }
- return emf;
- }
-
- public TemporalEntityManager getEntityManager() {
- return getEntityManager(null);
- }
-
- public TemporalEntityManager getEntityManager(Long effectiveTime) {
- if (this.entityManager == null || !this.entityManager.isOpen()) {
- TemporalEntityManager em = TemporalEntityManager.getInstance(getEMF().createEntityManager());
- em.setEffectiveTime(effectiveTime, false);
- this.entityManager = em;
- }
- return this.entityManager;
- }
-
- public void populate(TemporalEntityManager em) {
- }
-
- @AfterClass
- public static void closeEMF() {
- if (emf != null && emf.isOpen()) {
- emf.close();
- }
- emf = null;
- }
-
- @Before
- public void logTestName() {
- System.out.println("\n\nTEST: " + testName.getMethodName() + "\n");
- }
-
- /**
- * After each test case ensure the {@link EntityManager} is closed and if a
- * transaction is active roll it back first.
- */
- @After
- public void closeEntityManager() {
- if (this.entityManager != null && this.entityManager.isOpen()) {
- if (this.entityManager.getTransaction().isActive()) {
- this.entityManager.getTransaction().rollback();
- }
- this.entityManager.close();
- }
- this.entityManager = null;
- if (emf != null && emf.isOpen()) {
- JpaHelper.getServerSession(emf).getIdentityMapAccessor().initializeAllIdentityMaps();
- }
-
- }
-
-}
diff --git a/Temporal Entity Example/test-src/tests/CustomerScenarios.java b/Temporal Entity Example/test-src/tests/CustomerScenarios.java
deleted file mode 100644
index cfba216..0000000
--- a/Temporal Entity Example/test-src/tests/CustomerScenarios.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-
-package tests;
-
-import static example.PersonModelExample.T1;
-import static example.PersonModelExample.T2;
-import static example.PersonModelExample.T3;
-import static example.PersonModelExample.T4;
-
-import java.util.List;
-
-import junit.framework.Assert;
-import model.Address;
-import model.Person;
-import model.Phone;
-import model.entities.AddressEntity;
-import model.entities.PhoneEntity;
-
-import org.junit.Test;
-
-import temporal.TemporalEntityManager;
-
-/**
- * TODO
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class CustomerScenarios extends BaseTestCase {
-
- @Test
- public void createPersonAndAddressNow() {
- TemporalEntityManager em = getEntityManager();
- em.getTransaction().begin();
-
- Person p = em.newEntity(Person.class);
- p.setName("Now");
- Address a = new AddressEntity("now", "now", "now");
- p.setAddress(a);
-
- em.persist(p);
-
- em.getTransaction().commit();
- em.clear();
- em.getEntityManagerFactory().getCache().evictAll();
- System.out.println("\nREAD:\n");
-
- Person readP = em.find(Person.class, p.getId());
-
- Assert.assertEquals(p.getName(), readP.getName());
- Assert.assertEquals("now", readP.getAddress().getCity());
- }
-
- @Test
- public void createPersonAndAddressFuture() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T2, true);
-
- em.getTransaction().begin();
-
- Person p = em.newEntity( Person.class);
- p.setName("Future");
- Address a = em.newEntity( Address.class);
- a.setCity("t2");
- p.setAddress(a);
-
- em.persist(p);
-
- em.getTransaction().commit();
- em.clear();
- em.getEntityManagerFactory().getCache().evictAll();
- System.out.println("\nREAD:\n");
-
- Person readP = em.createQuery("SELECT p FROM Person p WHERE p.cid = " + p.getId(), Person.class).getSingleResult();
-
- Assert.assertEquals(p.getName(), readP.getName());
- Assert.assertEquals("t2", readP.getAddress().getCity());
- }
-
- @Test
- public void createPersonInFutureWithOldAddress() {
- TemporalEntityManager em = getEntityManager();
- em.getTransaction().begin();
- Address a = new AddressEntity("now", "now", "now");
- em.persist(a);
- em.flush();
-
- em.setEffectiveTime(T2, true);
-
- Person p = em.newEntity( Person.class);
- p.setName("Future");
- p.setAddress(a);
-
- em.persist(p);
-
- em.getTransaction().commit();
- em.clear();
- em.getEntityManagerFactory().getCache().evictAll();
- System.out.println("\nREAD:\n");
-
- em.setEffectiveTime(T1, false);
-
- List<Person> results = em.createQuery("SELECT p FROM Person p WHERE p.address.city = 'now'", Person.class).getResultList();
- Assert.assertTrue(results.isEmpty());
-
- em.setEffectiveTime(T2, false);
- Person readP = em.createQuery("SELECT p FROM Person p JOIN FETCH p.address WHERE p.address.city = 'now'", Person.class).getSingleResult();
-
- Assert.assertNotNull(readP);
- Assert.assertNotNull(readP.getAddress());
- Assert.assertEquals(p.getName(), readP.getName());
- Assert.assertEquals("now", readP.getAddress().getCity());
- }
-
- @Test
- public void createPersonInFutureWithOldPhone() {
- TemporalEntityManager em = getEntityManager();
-
- em.getTransaction().begin();
- Phone phone_BOT = new PhoneEntity("work", "000-000-0000");
- em.persist(phone_BOT);
- em.flush();
-
- em.setEffectiveTime(T2, true);
-
- Person p = em.newEntity( Person.class);
- p.setName("Future");
- em.persist(p);
-
- em.setEffectiveTime(T3, true);
-
- Phone phone_T3 = em.newEdition(phone_BOT);
- phone_T3.setNumber("333-333-3333");
- p.addPhone(phone_T3);
- em.persist(phone_T3);
- em.getTransaction().commit();
- em.clear();
- em.getEntityManagerFactory().getCache().evictAll();
-
- System.out.println("\nREAD:\n");
-
- em.setEffectiveTime(T1);
- Person readP_T1 = em.find(Person.class, p.getId());
- System.out.println("Read Person @ T1: " + readP_T1);
-
- em.clear();
- em.getEntityManagerFactory().getCache().evictAll();
-
- em.setEffectiveTime(T2);
- Person readP_T2 = em.find(Person.class, p.getId());
- System.out.println("Read Person @ T2: " + readP_T2 + " Phone: " + readP_T2.getPhone("work"));
- Phone readPhone_T2 = em.find(Phone.class, phone_BOT.getId());
- System.out.println("Read Phone @ T2: " + readPhone_T2);
-
- em.clear();
- em.getEntityManagerFactory().getCache().evictAll();
-
- em.setEffectiveTime(T3);
- Person readP_T3 = em.find(Person.class, p.getId());
- System.out.println("Read Person @ T3: " + readP_T3 + " Phone: " + readP_T3.getPhone("work"));
-
- em.clear();
- em.getEntityManagerFactory().getCache().evictAll();
-
- em.setEffectiveTime(T4);
- Person readP_T4 = em.find(Person.class, p.getId());
- System.out.println("Read Person @ T4: " + readP_T4 + " Phone: " + readP_T4.getPhone("work"));
-
- }
-
- @Override
- public void populate(TemporalEntityManager em) {
- }
-
-}
diff --git a/Temporal Entity Example/test-src/tests/DeleteContinuityTests.java b/Temporal Entity Example/test-src/tests/DeleteContinuityTests.java
deleted file mode 100644
index 608e5d4..0000000
--- a/Temporal Entity Example/test-src/tests/DeleteContinuityTests.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests;
-
-import static example.PersonModelExample.GOLF;
-import static example.PersonModelExample.T2;
-import static example.PersonModelExample.T4;
-import model.Address;
-import model.Person;
-import model.Phone;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import temporal.TemporalEntityManager;
-import example.PersonModelExample;
-
-/**
- * TODO
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class DeleteContinuityTests extends BaseTestCase {
-
- private static PersonModelExample example = new PersonModelExample();
-
- private Person getSample() {
- return example.fullPerson;
- }
-
- @Test
- public void test() {
- getSample();
- Assert.fail("NOT YET IMPLEMENTED");
- }
-
- @Override
- public void populate(TemporalEntityManager em) {
- System.out.println("\nFullPersonWithEditions.populate:START");
-
- example.populateHobbies(em);
- em.persist(example.fullPerson);
- em.flush();
-
- System.out.println("\n> Create T2 Edition");
- em.setEffectiveTime( T2, true);
-
- Person fpEdition = em.find(Person.class, example.fullPerson.getId());
- Person personEditionT2 = em.newEdition( fpEdition);
- personEditionT2.setName("Jimmy");
- Address aT2 = em.newEdition( example.fullPerson.getAddress());
- aT2.setCity("Toronto");
- aT2.setState("ON");
- personEditionT2.setAddress(aT2);
- Phone pT2 = em.newEdition( example.fullPerson.getPhone("Home"));
- personEditionT2.addPhone(pT2);
- pT2.setNumber("222-222-2222");
- em.persist(personEditionT2.addHobby(example.hobbies.get("golf"), T2));
- em.flush();
-
- System.out.println("\n> Create T4 Edition");
- em.setEffectiveTime( T4, true);
-
- Person personEditionT4 = em.newEdition( personEditionT2);
- personEditionT4.setName("James");
- Address aT4 = em.newEdition( aT2);
- aT4.setCity("San Francisco");
- aT4.setState("CA");
- personEditionT4.setAddress(aT4);
- Phone pT4 = em.newEdition( pT2);
- pT4.setNumber("444-444-4444");
- personEditionT4.addPhone(pT4);
- personEditionT4.removeHobby(example.hobbies.get(GOLF), T4, T4);
- personEditionT4.addHobby(example.hobbies.get("running"), T4);
- personEditionT4.addHobby(example.hobbies.get("skiing"), T4);
- em.flush();
-
- System.out.println("\nFullPersonWithEditions.populate::DONE");
- }
-
-}
diff --git a/Temporal Entity Example/test-src/tests/DeleteTests.java b/Temporal Entity Example/test-src/tests/DeleteTests.java
deleted file mode 100644
index 51c0f43..0000000
--- a/Temporal Entity Example/test-src/tests/DeleteTests.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests;
-
-import static example.PersonModelExample.T1;
-
-import javax.persistence.EntityManager;
-
-import model.Person;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Test;
-
-import temporal.EditionWrapperHelper;
-import temporal.TemporalEntityManager;
-import example.PersonModelExample;
-
-/**
- * Tests to verify delete use cases. In this temporal usage delete is equivalent
- * to setting the end date to a point in time in the future. Then any queries
- * after that time result in no edition being returned.
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class DeleteTests extends BaseTestCase {
-
- private static PersonModelExample examples = new PersonModelExample();
-
- @Test
- public void deleteCurrentSimple() {
- TemporalEntityManager em = getEntityManager();
- em.getTransaction().begin();
- em.persist(examples.simplePerson);
- em.getTransaction().commit();
- closeEntityManager();
-
- em = getEntityManager();
-
- Assert.assertEquals(1, em.createQuery("SELECT COUNT(p) FROM Person p", Number.class).getSingleResult().intValue());
- Assert.assertEquals(0, em.createQuery("SELECT COUNT(a) FROM Address a", Number.class).getSingleResult().intValue());
- Assert.assertEquals(0, em.createQuery("SELECT COUNT(p) FROM Phone p", Number.class).getSingleResult().intValue());
- Person p = em.createQuery("SELECT p FROM Person p", Person.class).getSingleResult();
-
- Assert.assertNotNull(p);
-
- em.getTransaction().begin();
- em.remove(p);
- em.getTransaction().commit();
-
- Assert.assertEquals(0, em.createQuery("SELECT COUNT(p) FROM Person p", Number.class).getSingleResult().intValue());
- Assert.assertEquals(0, em.createQuery("SELECT COUNT(a) FROM Address a", Number.class).getSingleResult().intValue());
- Assert.assertEquals(0, em.createQuery("SELECT COUNT(p) FROM Phone p", Number.class).getSingleResult().intValue());
- }
-
- @Test
- public void deleteCurrentSimpleAtT1() {
- TemporalEntityManager em = getEntityManager();
- em.getTransaction().begin();
- em.persist(examples.simplePerson);
- em.getTransaction().commit();
- closeEntityManager();
-
- em = getEntityManager();
-
- Assert.assertEquals(1, em.createQuery("SELECT COUNT(p) FROM Person p", Number.class).getSingleResult().intValue());
- Assert.assertEquals(0, em.createQuery("SELECT COUNT(a) FROM Address a", Number.class).getSingleResult().intValue());
- Assert.assertEquals(0, em.createQuery("SELECT COUNT(p) FROM Phone p", Number.class).getSingleResult().intValue());
- Person p = em.createQuery("SELECT p FROM Person p", Person.class).getSingleResult();
-
- Assert.assertNotNull(p);
-
- em.getTransaction().begin();
-
- Person pWrapper = EditionWrapperHelper.wrap(em, p);
- pWrapper.getEffectivity().setEnd(T1);
-
- em.getTransaction().commit();
-
- Assert.assertEquals(1, em.createQuery("SELECT COUNT(p) FROM Person p", Number.class).getSingleResult().intValue());
- Assert.assertEquals(0, em.createQuery("SELECT COUNT(a) FROM Address a", Number.class).getSingleResult().intValue());
- Assert.assertEquals(0, em.createQuery("SELECT COUNT(p) FROM Phone p", Number.class).getSingleResult().intValue());
-
- em.setEffectiveTime( T1);
-
- Assert.assertEquals(0, em.createQuery("SELECT COUNT(p) FROM Person p", Number.class).getSingleResult().intValue());
- Assert.assertEquals(0, em.createQuery("SELECT COUNT(a) FROM Address a", Number.class).getSingleResult().intValue());
- Assert.assertEquals(0, em.createQuery("SELECT COUNT(p) FROM Phone p", Number.class).getSingleResult().intValue());
- }
-
- @After
- public void deleteAll() {
- EntityManager em = TemporalEntityManager.getInstance(getEMF().createEntityManager());
- em.getTransaction().begin();
- em.createQuery("DELETE FROM PersonHobby ph").executeUpdate();
- em.createQuery("DELETE FROM Hobby h").executeUpdate();
- em.createNativeQuery("DELETE FROM TADDRESS").executeUpdate();
- em.createNativeQuery("DELETE FROM TPERSON_NNAMES").executeUpdate();
- em.createNativeQuery("UPDATE TPERSON SET CID = NULL").executeUpdate();
- em.createNativeQuery("DELETE FROM TPERSON").executeUpdate();
- em.createNativeQuery("DELETE FROM TPHONE").executeUpdate();
- em.getTransaction().commit();
- em.close();
- }
-}
diff --git a/Temporal Entity Example/test-src/tests/DuplicateInsertOnCreateMerge.java b/Temporal Entity Example/test-src/tests/DuplicateInsertOnCreateMerge.java
deleted file mode 100644
index 9b4ff1b..0000000
--- a/Temporal Entity Example/test-src/tests/DuplicateInsertOnCreateMerge.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests;
-
-import static example.PersonModelExample.GOLF;
-import static example.PersonModelExample.RUN;
-import static example.PersonModelExample.SKI;
-import static example.PersonModelExample.T2;
-import static example.PersonModelExample.T4;
-import junit.framework.Assert;
-import model.Address;
-import model.Person;
-import model.Phone;
-
-import org.junit.Test;
-
-import temporal.TemporalEntityManager;
-import example.PersonModelExample;
-
-/**
- * Test cases dealing with potential duplicate insert scenarios
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class DuplicateInsertOnCreateMerge extends BaseTestCase {
-
- private static PersonModelExample example = new PersonModelExample();
-
- private Person getSample() {
- return example.fullPerson;
- }
-
- @Override
- public void populate(TemporalEntityManager em) {
- System.out.println("\nFullPersonWithEditions.populate:START");
-
- example.populateHobbies(em);
- em.persist(getSample());
- em.flush();
-
- System.out.println("\nFullPersonWithEditions.populate::DONE");
- }
-
- public Person createPersonEditionAtT2(TemporalEntityManager em) {
- em.setEffectiveTime( T2, true);
-
- Person fpEdition = em.find(Person.class, getSample().getId());
- Person personEditionT2 = fpEdition;
-
- if (personEditionT2.getEffectivity().getStart() != T2) {
- personEditionT2 = em.newEdition( fpEdition);
- personEditionT2.setName("Jimmy");
- Address aT2 = em.newEdition( fpEdition.getAddress());
- aT2.setCity("Toronto");
- aT2.setState("ON");
- personEditionT2.setAddress(aT2);
- Phone originalPhone = fpEdition.getPhone("Home");
-
- Phone pT2 = em.newEdition( originalPhone);
- personEditionT2.addPhone(pT2);
- pT2.setNumber("222-222-2222");
- em.persist(personEditionT2.addHobby(example.hobbies.get(GOLF), T2));
- } else {
- personEditionT2.getAddress();
- personEditionT2.getPhones().size();
- }
- return personEditionT2;
- }
-
- @Test
- public void createPersonAtT2AndMerge() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime( T2, true);
- em.getTransaction().begin();
-
- Person personEditionT2 = createPersonEditionAtT2(em);
-
- Assert.assertNotNull(personEditionT2);
- Assert.assertEquals(T2, personEditionT2.getEffectivity().getStart());
- Assert.assertNotNull(personEditionT2.getPhone("Home"));
-
- // XXX
- em.merge(personEditionT2);
-
- em.getTransaction().commit();
-
- em.clear();
- personEditionT2 = em.find(Person.class, getSample().getId());
-
- Assert.assertNotNull(personEditionT2);
- Assert.assertEquals(T2, personEditionT2.getEffectivity().getStart());
- Phone pT2 = personEditionT2.getPhone("Home");
- Assert.assertNotNull(pT2);
- }
-
- @Test
- public void createPersonAtT4AndMerge() {
- TemporalEntityManager em = getEntityManager();
- em.getTransaction().begin();
- Person personEditionT2 = createPersonEditionAtT2(em);
- Assert.assertNotNull(personEditionT2);
- Assert.assertEquals(T2, personEditionT2.getEffectivity().getStart());
- Assert.assertNotNull(personEditionT2.getPhone("Home"));
-
- em.setEffectiveTime( T4, true);
-
- Person personEditionT4 = em.newEdition( personEditionT2);
- personEditionT4.setName("James");
- Address aT4 = em.newEdition( personEditionT4.getAddress());
- aT4.setCity("San Francisco");
- aT4.setState("CA");
- personEditionT4.setAddress(aT4);
- Phone pT4 = em.newEdition( personEditionT4.getPhone("Home"));
- pT4.setNumber("444-444-4444");
- personEditionT4.addPhone(pT4);
- personEditionT4.removeHobby(example.hobbies.get(GOLF), T4, T4);
- em.persist(personEditionT4.addHobby(example.hobbies.get(RUN), T4));
- em.persist(personEditionT4.addHobby(example.hobbies.get(SKI), T4));
-
- em.merge(personEditionT4);
- em.getTransaction().commit();
- }
-}
diff --git a/Temporal Entity Example/test-src/tests/FullPersonWithEditions.java b/Temporal Entity Example/test-src/tests/FullPersonWithEditions.java
deleted file mode 100644
index 17a29c5..0000000
--- a/Temporal Entity Example/test-src/tests/FullPersonWithEditions.java
+++ /dev/null
@@ -1,798 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests;
-
-import static example.PersonModelExample.GOLF;
-import static example.PersonModelExample.RUN;
-import static example.PersonModelExample.SKI;
-import static example.PersonModelExample.T1;
-import static example.PersonModelExample.T2;
-import static example.PersonModelExample.T3;
-import static example.PersonModelExample.T4;
-import static example.PersonModelExample.T5;
-import static temporal.Effectivity.BOT;
-import static temporal.Effectivity.EOT;
-
-import java.sql.Date;
-import java.util.List;
-
-import javax.persistence.NoResultException;
-import javax.persistence.TypedQuery;
-
-import model.Address;
-import model.Person;
-import model.Phone;
-import model.entities.PhoneEntity;
-
-import org.eclipse.persistence.jpa.JpaHelper;
-import org.eclipse.persistence.sessions.CopyGroup;
-import org.junit.Assert;
-import org.junit.Test;
-
-import temporal.BaseEntity;
-import temporal.EditionSet;
-import temporal.TemporalEntityManager;
-import temporal.TemporalHelper;
-import example.PersonModelExample;
-
-/**
- * This test case performs current and edition queries on a simple
- * Person-Address-Phones model both illustrating and verifying query operations.
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class FullPersonWithEditions extends BaseTestCase {
-
- private static PersonModelExample example = new PersonModelExample();
-
- private Person getSample() {
- return example.fullPerson;
- }
-
- @Override
- public void populate(TemporalEntityManager em) {
- System.out.println("\nFullPersonWithEditions.populate:START");
-
- example.populateHobbies(em);
- em.persist(example.fullPerson);
- em.flush();
-
- System.out.println("\n> Create T2 Edition");
- em.setEffectiveTime(T2, true);
-
- Person fpEdition = em.find(Person.class, example.fullPerson.getId());
- Person personEditionT2 = em.newEdition(fpEdition);
-
- personEditionT2.setName("Jimmy");
- Address aT2 = em.newEdition(example.fullPerson.getAddress());
- aT2.setCity("Toronto");
- aT2.setState("ON");
- personEditionT2.setDateOfBirth(new Date(75, 1, 5));
-
- personEditionT2.setAddress(aT2);
- Phone pT2 = em.newEdition(example.fullPerson.getPhone("Home"));
- personEditionT2.addPhone(pT2);
- pT2.setNumber("222-222-2222");
- Phone pWT2 = em.newEntity(PhoneEntity.class);
- pWT2.setType("Work");
- pWT2.setNumber("333-333-3333");
- personEditionT2.addPhone(pWT2);
-
- em.persist(personEditionT2.addHobby(example.hobbies.get(GOLF), T2));
-
- // Assert.assertEquals(personEditionT2.getPhones().size() - 1,
- // fpEdition.getPhones().size());
- // Assert.assertEquals(personEditionT2.getPersonHobbies().size() - 1,
- // fpEdition.getPersonHobbies().size());
-
- em.flush();
-
- System.out.println("\n> Create T4 Edition");
- em.setEffectiveTime(T4, true);
-
- Person personEditionT4 = em.newEdition(personEditionT2);
- personEditionT4.setName("James");
- Address aT4 = em.newEdition(aT2);
- aT4.setCity("San Francisco");
- aT4.setState("CA");
- personEditionT4.setAddress(aT4);
-
- Phone pT4 = em.newEdition(pT2);
- pT4.setNumber("444-444-4444");
- personEditionT4.addPhone(pT4);
- pWT2.getEffectivity().setEnd(T4);
- Phone pCT4 = em.newEntity(PhoneEntity.class);
- pCT4.setType("Cell");
- pCT4.setNumber("555-555-55555");
- personEditionT4.addPhone(pCT4);
-
- personEditionT4.getPersonHobbies().get(GOLF).getEffectivity().setEnd(T4);
-
- em.persist(personEditionT4.addHobby(example.hobbies.get(RUN), T4));
- em.persist(personEditionT4.addHobby(example.hobbies.get(SKI), T4));
-
- em.flush();
-
- System.out.println("\nFullPersonWithEditions.populate::DONE");
- }
-
- @Test
- public void queryAllCurrent() {
- TemporalEntityManager em = getEntityManager();
- List<Person> results = em.createQuery("SELECT p From Person p", Person.class).getResultList();
-
- System.out.println("QUERY CURRENT:");
- for (Person p : results) {
- System.out.println("\t>" + p);
- }
-
- Assert.assertEquals(1, results.size());
-
- Person currentperson = results.get(0);
- Assert.assertSame(currentperson, currentperson.getContinuity());
- Assert.assertEquals(getSample().getId(), currentperson.getId());
- }
-
- @Test
- public void findCurrent() {
- TemporalEntityManager em = getEntityManager();
-
- Person current = em.find(Person.class, getSample().getId());
-
- System.out.println("VERIFY CURRENT: " + current);
-
- // Verify person
- Assert.assertNotNull(current);
- Assert.assertEquals(current, current.getContinuity());
- Assert.assertEquals(getSample().getId(), current.getId());
- Assert.assertEquals(getSample().getName(), current.getName());
- Assert.assertTrue(current.getEffectivity().isCurrent());
- Assert.assertFalse(current.getEffectivity().isFutureEdition());
- Assert.assertEquals(current.getEffectivity().getStart(), BOT);
- Assert.assertEquals(current.getEffectivity().getEnd(), T2);
-
- // Address
- Assert.assertNotNull(current.getAddress());
- Assert.assertEquals(getSample().getAddress().getStreet(), current.getAddress().getStreet());
- Assert.assertEquals(getSample().getAddress().getCity(), current.getAddress().getCity());
- Assert.assertEquals(getSample().getAddress().getState(), current.getAddress().getState());
- Assert.assertTrue(current.getAddress().getEffectivity().isCurrent());
- Assert.assertFalse(current.getAddress().getEffectivity().isFutureEdition());
- Assert.assertEquals(current.getAddress().getEffectivity().getStart(), BOT);
- Assert.assertEquals(current.getAddress().getEffectivity().getEnd(), T2);
-
- // Phone
- Assert.assertEquals(1, current.getPhones().size());
- Phone currentHome = current.getPhone("Home");
- Assert.assertNotNull(currentHome);
- Assert.assertEquals("111-111-1111", currentHome.getNumber());
- Assert.assertSame(current, currentHome.getPerson());
- }
-
- @Test
- public void queryAllCurrentJoinAddress() {
- TemporalEntityManager em = getEntityManager();
- List<Person> results = em.createQuery("SELECT p From Person p JOIN FETCH p.address", Person.class).getResultList();
-
- System.out.println("QUERY CURRENT:");
- for (Person p : results) {
- System.out.println("\t>" + p);
- }
-
- Assert.assertEquals(1, results.size());
-
- Person currentperson = results.get(0);
- Assert.assertSame(currentperson, currentperson.getContinuity());
- Assert.assertEquals(getSample().getId(), currentperson.getId());
- }
-
- @Test
- public void querySampleCurrentPerson() {
- TemporalEntityManager em = getEntityManager();
-
- Person person = em.createQuery("SELECT p From Person p WHERE p.id = " + getSample().getId(), Person.class).getSingleResult();
- Address address = person.getAddress();
-
- Assert.assertNotNull(person);
-
- System.out.println("FIND CURRENT: " + person);
-
- Assert.assertEquals(getSample().getId(), person.getId());
- Assert.assertSame(person, person.getContinuity());
- Assert.assertNotNull(address);
- Assert.assertEquals(getSample().getAddress().getCity(), address.getCity());
- }
-
- @Test
- public void querySampleCurrentPersonJoinAddress() {
- TemporalEntityManager em = getEntityManager();
-
- Person person = em.createQuery("SELECT p From Person p JOIN FETCH p.address WHERE p.id = " + getSample().getId(), Person.class).getSingleResult();
- Address address = person.getAddress();
-
- Assert.assertNotNull(person);
-
- System.out.println("FIND CURRENT: " + person);
-
- Assert.assertEquals(getSample().getId(), person.getId());
- Assert.assertEquals(person, person.getContinuity());
- Assert.assertNotNull(address);
- Assert.assertEquals(getSample().getAddress().getCity(), address.getCity());
- }
-
- @Test
- public void findSampleCurrentPerson() {
- TemporalEntityManager em = getEntityManager();
- Person person = em.find(Person.class, getSample().getId());
-
- Assert.assertNotNull(person);
-
- System.out.println("FIND CURRENT: " + person);
-
- Assert.assertEquals(getSample().getId(), person.getId());
- Assert.assertSame(person, person.getContinuity());
- Assert.assertTrue(person.getEffectivity().isCurrent());
- Assert.assertFalse(person.getEffectivity().isFutureEdition());
- Assert.assertEquals(person.getEffectivity().getStart(), BOT);
- Assert.assertEquals(person.getEffectivity().getEnd(), T2);
-
- Assert.assertEquals(0, person.getPersonHobbies().size());
-
- Assert.assertEquals(1, person.getPhones().size());
-
- }
-
- @Test
- public void findFuturePersonEntityEditionT2() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T2);
-
- Person person = em.find(Person.class, getSample().getId());
- Assert.assertNotNull(person);
- System.out.println("FIND Future Edition: " + person);
- Assert.assertEquals(1, person.getPersonHobbies().size());
-
- Person continuity = person.getContinuity();
-
- Assert.assertNotNull(continuity);
- System.out.println("\tContinuity: " + continuity);
- Assert.assertTrue("Not an edition entity", TemporalHelper.isEdition(em, person));
- Assert.assertEquals(getSample().getId(), person.getContinuity().getId());
-
- Assert.assertFalse(person.getEffectivity().isCurrent());
- Assert.assertTrue(person.getEffectivity().isFutureEdition());
- Assert.assertEquals(person.getEffectivity().getStart(), T2);
- Assert.assertEquals(person.getEffectivity().getEnd(), T4);
- Assert.assertNotSame(person, person.getContinuity());
- }
-
- @Test
- public void queryFutureEditionOfCurrentPersonAtBOT() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(BOT);
-
- Person pEdition = em.createQuery("SELECT p From Person p WHERE p.id = " + getSample().getId(), Person.class).getSingleResult();
-
- System.out.println("QUERY EDITION @ BOT: " + pEdition);
-
- Assert.assertNotNull("No edition found at BOT", pEdition);
- Assert.assertTrue(pEdition.getEffectivity().isCurrent());
- Assert.assertFalse(pEdition.getEffectivity().isFutureEdition());
- Assert.assertEquals(BOT, pEdition.getEffectivity().getStart());
- Assert.assertEquals(T2, pEdition.getEffectivity().getEnd());
- Assert.assertNotNull("No Continuity found", pEdition.getContinuity());
- Assert.assertEquals(0, pEdition.getPersonHobbies().size());
-
- Address address = pEdition.getAddress();
-
- Assert.assertNotNull(address);
- Assert.assertEquals(getSample().getAddress().getCity(), address.getCity());
-
- Assert.assertEquals(1, pEdition.getPhones().size());
- }
-
- @Test
- public void queryFutureEditionOfCurrentPersonAtT1() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T1);
-
- Person pEdition = em.createQuery("SELECT p From Person p WHERE p.id = " + getSample().getId(), Person.class).getSingleResult();
-
- System.out.println("QUERY EDITION @ T1: " + pEdition);
-
- Assert.assertNotNull("No edition found at T1", pEdition);
- Assert.assertTrue(pEdition.getEffectivity().isCurrent());
- Assert.assertFalse(pEdition.getEffectivity().isFutureEdition());
- Assert.assertEquals(BOT, pEdition.getEffectivity().getStart());
- Assert.assertEquals(T2, pEdition.getEffectivity().getEnd());
- Assert.assertNotNull("No Continuity found", pEdition.getContinuity());
-
- Assert.assertEquals(0, pEdition.getPersonHobbies().size());
- Assert.assertFalse(pEdition.getPersonHobbies().containsKey(SKI));
- Assert.assertFalse(pEdition.getPersonHobbies().containsKey(RUN));
- Assert.assertFalse(pEdition.getPersonHobbies().containsKey(GOLF));
-
- Address address = pEdition.getAddress();
-
- Assert.assertNotNull(address);
- Assert.assertEquals(getSample().getAddress().getCity(), address.getCity());
-
- Assert.assertEquals(1, pEdition.getPhones().size());
- }
-
- @Test
- public void queryFutureEditionOfCurrentPersonAtT2() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T2);
-
- Person pEdition = em.createQuery("SELECT p From Person p WHERE p.id = " + getSample().getId(), Person.class).getSingleResult();
-
- System.out.println("QUERY EDITION @ T2: " + pEdition);
-
- Assert.assertNotNull("No edition found at T2", pEdition);
- Assert.assertFalse(pEdition.getEffectivity().isCurrent());
- Assert.assertTrue(pEdition.getEffectivity().isFutureEdition());
- Assert.assertEquals(T2, pEdition.getEffectivity().getStart());
- Assert.assertEquals(T4, pEdition.getEffectivity().getEnd());
- Assert.assertNotSame(pEdition, pEdition.getContinuity());
-
- Assert.assertEquals(1, pEdition.getPersonHobbies().size());
- Assert.assertFalse(pEdition.getPersonHobbies().containsKey(SKI));
- Assert.assertFalse(pEdition.getPersonHobbies().containsKey(RUN));
- Assert.assertTrue(pEdition.getPersonHobbies().containsKey(GOLF));
-
- Address address = pEdition.getAddress();
-
- Assert.assertNotNull(address);
- Assert.assertEquals("Toronto", address.getCity());
-
- Assert.assertEquals(2, pEdition.getPhones().size());
- }
-
- @Test
- public void queryFutureEditionOfCurrentPersonAtT2JoinFetchAddress() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T2);
-
- Person pEdition = null;
- try {
- pEdition = em.createQuery("SELECT p From Person p JOIN FETCH p.address WHERE p.id = " + getSample().getId(), Person.class).getSingleResult();
- } catch (NoResultException e) {
- Assert.fail("Join returned no result");
- }
- Address address = pEdition.getAddress();
-
- System.out.println("QUERY EDITION @ T2: " + pEdition);
- System.out.println("\t> " + address);
-
- Assert.assertNotNull("No edition found", pEdition);
- Assert.assertFalse(pEdition.getEffectivity().isCurrent());
- Assert.assertTrue(pEdition.getEffectivity().isFutureEdition());
- Assert.assertEquals(T2, pEdition.getEffectivity().getStart());
- Assert.assertEquals(T4, pEdition.getEffectivity().getEnd());
- Assert.assertNotNull("No Continuity found", pEdition.getContinuity());
- Assert.assertNotNull(address);
- Assert.assertEquals("Toronto", address.getCity());
-
- Assert.assertEquals(1, pEdition.getPersonHobbies().size());
- Assert.assertFalse(pEdition.getPersonHobbies().containsKey(SKI));
- Assert.assertFalse(pEdition.getPersonHobbies().containsKey(RUN));
- Assert.assertTrue(pEdition.getPersonHobbies().containsKey(GOLF));
-
- Assert.assertEquals(2, pEdition.getPhones().size());
- }
-
- @Test
- public void queryFutureEditionOfCurrentPersonAtT3() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T3);
-
- Person pEdition = em.createQuery("SELECT p From Person p WHERE p.id = " + getSample().getId(), Person.class).getSingleResult();
-
- System.out.println("QUERY EDITION @ T3: " + pEdition);
-
- Assert.assertNotNull("No edition found ", pEdition);
- Assert.assertFalse(pEdition.getEffectivity().isCurrent());
- Assert.assertTrue(pEdition.getEffectivity().isFutureEdition());
- Assert.assertEquals(T2, pEdition.getEffectivity().getStart());
- Assert.assertEquals(T4, pEdition.getEffectivity().getEnd());
- Assert.assertNotSame(pEdition, pEdition.getContinuity());
-
- Assert.assertEquals(1, pEdition.getPersonHobbies().size());
- Assert.assertFalse(pEdition.getPersonHobbies().containsKey(SKI));
- Assert.assertFalse(pEdition.getPersonHobbies().containsKey(RUN));
- Assert.assertTrue(pEdition.getPersonHobbies().containsKey(GOLF));
-
- Address address = pEdition.getAddress();
-
- Assert.assertNotNull(address);
- Assert.assertEquals("Toronto", address.getCity());
-
- Assert.assertEquals(2, pEdition.getPhones().size());
- }
-
- @Test
- public void queryFutureEditionOfCurrentPersonAtT4() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T4);
-
- Person pEdition = em.createQuery("SELECT p From Person p WHERE p.id = " + getSample().getId(), Person.class).getSingleResult();
-
- System.out.println("QUERY EDITION @ T4: " + pEdition);
-
- Assert.assertNotNull("No Person Edition Found", pEdition);
- Assert.assertFalse(pEdition.getEffectivity().isCurrent());
- Assert.assertTrue(pEdition.getEffectivity().isFutureEdition());
- Assert.assertEquals(T4, pEdition.getEffectivity().getStart());
- Assert.assertEquals(EOT, pEdition.getEffectivity().getEnd());
- Assert.assertNotSame(pEdition, pEdition.getContinuity());
-
- Assert.assertEquals(2, pEdition.getPersonHobbies().size());
- Assert.assertTrue(pEdition.getPersonHobbies().containsKey(SKI));
- Assert.assertTrue(pEdition.getPersonHobbies().containsKey(RUN));
- Assert.assertFalse(pEdition.getPersonHobbies().containsKey(GOLF));
-
- Address address = pEdition.getAddress();
-
- Assert.assertNotNull(address);
-
- Assert.assertEquals(2, pEdition.getPhones().size());
- }
-
- @Test
- public void queryFutureEditionOfCurrentPersonAtT5() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T5);
-
- Person pEdition = em.createQuery("SELECT p From Person p WHERE p.id = " + getSample().getId(), Person.class).getSingleResult();
-
- System.out.println("QUERY EDITION @ T5: " + pEdition);
-
- Assert.assertNotNull("No edition found at T5", pEdition);
- Assert.assertFalse(pEdition.getEffectivity().isCurrent());
- Assert.assertTrue(pEdition.getEffectivity().isFutureEdition());
- Assert.assertEquals(T4, pEdition.getEffectivity().getStart());
- Assert.assertEquals(EOT, pEdition.getEffectivity().getEnd());
- Assert.assertNotSame(pEdition, pEdition.getContinuity());
- Assert.assertEquals(2, pEdition.getPersonHobbies().size());
-
- Assert.assertTrue(pEdition.getPersonHobbies().containsKey(SKI));
- Assert.assertTrue(pEdition.getPersonHobbies().containsKey(RUN));
- Assert.assertFalse(pEdition.getPersonHobbies().containsKey(GOLF));
-
- Assert.assertEquals(2, pEdition.getPhones().size());
- }
-
- @Test
- public void nativeQueryForAllEdition() {
- TemporalEntityManager em = getEntityManager();
-
- TypedQuery<Person> query = em.createNamedQuery("PersonEdition.all", Person.class);
- query.setParameter("CID", getSample().getId());
- List<Person> editions = query.getResultList();
-
- Assert.assertFalse("No edition found", editions.isEmpty());
-
- System.out.println("QUERY ALL EDITIONS:");
- for (Person p : editions) {
- System.out.println("\t" + p);
- Assert.assertNotNull("No Continuity found", p.getContinuity());
- }
-
- Assert.assertEquals(3, editions.size());
- }
-
- // @Test
- public void deleteAllAtT5() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T5);
-
- Person p = em.find(Person.class, getSample().getId());
-
- em.getTransaction().begin();
-
- p.getEffectivity().setEnd(T5);
- p.getAddress().getEffectivity().setEnd(T5);
- for (Phone phone : p.getPhones().values()) {
- phone.getEffectivity().setEnd(T5);
- }
-
- em.flush();
-
- // TODO - validation
- }
-
- @Test
- public void detachResultUsingCopyPolicy() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T2);
-
- TypedQuery<Person> query = em.createNamedQuery("PersonEdition.find", Person.class);
- query.setParameter("ID", getSample().getId());
-
- Person p = query.getSingleResult();
-
- System.out.println("ORIGINAL: " + p + " HASHCODE: " + System.identityHashCode(p));
- System.out.println("\t" + p.getAddress());
-
- CopyGroup cg = new CopyGroup();
- cg.cascadeAllParts();
-
- Person pCopy = (Person) JpaHelper.getEntityManager(em).copy(p, cg);
- System.out.println("COPY: " + pCopy + " HASHSCODE: " + System.identityHashCode(pCopy));
- System.out.println("\t" + pCopy.getAddress());
- }
-
- @Test
- public void modifyFutureEditionOfCurrentPersonAtT4() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T4);
-
- Person pEdition = em.createQuery("SELECT p From Person p WHERE p.id = " + getSample().getId(), Person.class).getSingleResult();
-
- System.out.println("QUERY EDITION @ T4: " + pEdition);
-
- Assert.assertNotNull("No Person Edition Found", pEdition);
- Assert.assertFalse(pEdition.getEffectivity().isCurrent());
- Assert.assertTrue(pEdition.getEffectivity().isFutureEdition());
- Assert.assertEquals(T4, pEdition.getEffectivity().getStart());
- Assert.assertNotSame(pEdition, pEdition.getContinuity());
-
- Assert.assertEquals(2, pEdition.getPersonHobbies().size());
- Assert.assertTrue(pEdition.getPersonHobbies().containsKey(SKI));
- Assert.assertTrue(pEdition.getPersonHobbies().containsKey(RUN));
- Assert.assertFalse(pEdition.getPersonHobbies().containsKey(GOLF));
-
- long currentVersion = pEdition.getVersion();
-
- em.getTransaction().begin();
- pEdition.setName(pEdition.getName().toUpperCase());
- em.flush();
-
- Assert.assertEquals(currentVersion + 1, pEdition.getVersion());
- }
-
- @Test
- public void modifyFutureEditionOfCurrentPersonAtT4UsingMerge() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T4);
-
- Person pEdition = em.createQuery("SELECT p From Person p WHERE p.id = " + getSample().getId(), Person.class).getSingleResult();
-
- System.out.println("QUERY EDITION @ T4: " + pEdition);
-
- // Create new unregistered hobby and add.
-
- Assert.assertNotNull("No Person Edition Found", pEdition);
- Assert.assertFalse(pEdition.getEffectivity().isCurrent());
- Assert.assertTrue(pEdition.getEffectivity().isFutureEdition());
- Assert.assertEquals(T4, pEdition.getEffectivity().getStart());
- Assert.assertNotSame(pEdition, pEdition.getContinuity());
-
- Assert.assertEquals(2, pEdition.getPersonHobbies().size());
- Assert.assertTrue(pEdition.getPersonHobbies().containsKey(SKI));
- Assert.assertTrue(pEdition.getPersonHobbies().containsKey(RUN));
- Assert.assertFalse(pEdition.getPersonHobbies().containsKey(GOLF));
-
- long currentVersion = pEdition.getVersion();
-
- em.getTransaction().begin();
- pEdition.setName(pEdition.getName().toUpperCase());
- em.flush();
-
- Assert.assertEquals(currentVersion + 1, pEdition.getVersion());
- }
-
- /**
- * Verify that the edition creation operation correctly copies values
- * including mutable values and collections.
- */
- @Test
- public void verifyCreateEditionCopying() {
- TemporalEntityManager em = getEntityManager();
- EditionSet es = em.setEffectiveTime(T5, true);
-
- Person pEdition = em.find(Person.class, getSample().getId());
-
- Assert.assertNotNull(pEdition);
- Assert.assertTrue(TemporalHelper.isEdition(em, pEdition));
- Assert.assertEquals(T4, pEdition.getEffectivity().getStart());
- Assert.assertNotNull(es);
- Assert.assertTrue(es.getEntries().isEmpty());
-
- Person pAtT5 = em.newEdition(pEdition);
-
- Assert.assertNotNull(pAtT5);
- Assert.assertTrue(TemporalHelper.isEdition(em, pEdition));
- Assert.assertEquals(T5, pAtT5.getEffectivity().getStart());
- Assert.assertFalse(es.getEntries().isEmpty());
- Assert.assertEquals(1, es.getEntries().size());
-
- // Verify collection/map cloning
- Assert.assertNotSame(pEdition.getPhones(), pAtT5.getPhones());
- Assert.assertNotSame(pEdition.getPersonHobbies(), pAtT5.getPersonHobbies());
- Assert.assertNotSame(pEdition.getNicknames(), pAtT5.getNicknames());
-
- // Mutable non-temporal values
- Assert.assertSame(pEdition.getDateOfBirth(), pAtT5.getDateOfBirth());
-
- // TODO: Validate mutable basic copying
-
- }
-
- @Test
- public void testDateOfBirthNonTemporalStorage() {
- TemporalEntityManager em = getEntityManager();
-
- List<?> results = em.createNativeQuery("SELECT DATEOFBIRTH FROM TPERSON WHERE CID = 1 ORDER BY OID").getResultList();
-
- Assert.assertNotNull(results);
- Assert.assertEquals(3, results.size());
- Assert.assertEquals(new Date(75, 1, 5), results.get(0));
- Assert.assertNull(results.get(1));
- Assert.assertNull(results.get(2));
- }
-
- /**
- * Verify the query result and relationship to person
- */
- @SuppressWarnings("unchecked")
- @Test
- public void queryCurrentHomePhone() {
- TemporalEntityManager em = getEntityManager();
-
- TypedQuery<Phone> query = em.createQuery("SELECT p FROM Phone p WHERE p.type = 'Home'", Phone.class);
- Phone phone = query.getSingleResult();
-
- Assert.assertNotNull(phone);
- Assert.assertFalse(TemporalHelper.isEditionClass((Class<BaseEntity>) phone.getClass()));
- Assert.assertNotNull(phone.getContinuity());
- Assert.assertEquals(phone, phone.getContinuity());
- Assert.assertEquals(BOT, phone.getEffectivity().getStart());
- Assert.assertEquals(T2, phone.getEffectivity().getEnd());
-
- Assert.assertNotNull(phone.getPerson());
- Assert.assertEquals(phone.getEffectivity().getStart(), phone.getPerson().getEffectivity().getStart());
- }
-
- /**
- * Verify the query result and relationship to person
- */
- @SuppressWarnings("unchecked")
- @Test
- public void queryHomePhoneAtBOT() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(BOT);
-
- TypedQuery<Phone> query = em.createQuery("SELECT p FROM Phone p WHERE p.type = 'Home'", Phone.class);
- Phone phone = query.getSingleResult();
-
- Assert.assertNotNull(phone);
- Assert.assertTrue(TemporalHelper.isEditionClass((Class<BaseEntity>) phone.getClass()));
- Assert.assertNotNull(phone.getContinuity());
- Assert.assertEquals(BOT, phone.getEffectivity().getStart());
- Assert.assertEquals(T2, phone.getEffectivity().getEnd());
-
- Assert.assertNotNull(phone.getPerson());
- Assert.assertEquals(phone.getEffectivity().getStart(), phone.getPerson().getEffectivity().getStart());
- }
-
- /**
- * Verify the query result and relationship to person
- */
- @SuppressWarnings("unchecked")
- @Test
- public void queryHomePhoneAtT1() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T1);
-
- TypedQuery<Phone> query = em.createQuery("SELECT p FROM Phone p WHERE p.type = 'Home'", Phone.class);
- Phone phone = query.getSingleResult();
-
- Assert.assertNotNull(phone);
- Assert.assertTrue(TemporalHelper.isEditionClass((Class<BaseEntity>) phone.getClass()));
- Assert.assertNotNull(phone.getContinuity());
- Assert.assertEquals(BOT, phone.getEffectivity().getStart());
- Assert.assertEquals(T2, phone.getEffectivity().getEnd());
-
- Assert.assertNotNull(phone.getPerson());
- Assert.assertEquals(phone.getEffectivity().getStart(), phone.getPerson().getEffectivity().getStart());
- }
-
- /**
- * Verify the query result and relationship to person
- */
- @SuppressWarnings("unchecked")
- @Test
- public void queryHomePhoneAtT2() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T2);
-
- TypedQuery<Phone> query = em.createQuery("SELECT p FROM Phone p WHERE p.type = 'Home'", Phone.class);
- Phone phone = query.getSingleResult();
-
- Assert.assertNotNull(phone);
- Assert.assertTrue(TemporalHelper.isEditionClass((Class<BaseEntity>) phone.getClass()));
- Assert.assertNotNull(phone.getContinuity());
- Assert.assertEquals(T2, phone.getEffectivity().getStart());
- Assert.assertEquals(T4, phone.getEffectivity().getEnd());
-
- Assert.assertNotNull(phone.getPerson());
- Assert.assertEquals(phone.getEffectivity().getStart(), phone.getPerson().getEffectivity().getStart());
- }
-
- /**
- * Verify the query result and relationship to person
- */
- @SuppressWarnings("unchecked")
- @Test
- public void queryHomePhoneAtT3() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T3);
-
- TypedQuery<Phone> query = em.createQuery("SELECT p FROM Phone p WHERE p.type = 'Home'", Phone.class);
- Phone phone = query.getSingleResult();
-
- Assert.assertNotNull(phone);
- Assert.assertTrue(TemporalHelper.isEditionClass((Class<BaseEntity>) phone.getClass()));
- Assert.assertNotNull(phone.getContinuity());
- Assert.assertEquals(T2, phone.getEffectivity().getStart());
- Assert.assertEquals(T4, phone.getEffectivity().getEnd());
-
- Assert.assertNotNull(phone.getPerson());
- Assert.assertEquals(phone.getEffectivity().getStart(), phone.getPerson().getEffectivity().getStart());
- }
-
- /**
- * Verify the query result and relationship to person
- */
- @SuppressWarnings("unchecked")
- @Test
- public void queryHomePhoneAtT4() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T4);
-
- TypedQuery<Phone> query = em.createQuery("SELECT p FROM Phone p WHERE p.type = 'Home'", Phone.class);
- Phone phone = query.getSingleResult();
-
- Assert.assertNotNull(phone);
- Assert.assertTrue(TemporalHelper.isEditionClass((Class<BaseEntity>) phone.getClass()));
- Assert.assertNotNull(phone.getContinuity());
- Assert.assertEquals(T4, phone.getEffectivity().getStart());
- Assert.assertEquals(EOT, phone.getEffectivity().getEnd());
-
- Assert.assertNotNull(phone.getPerson());
- Assert.assertEquals(phone.getEffectivity().getStart(), phone.getPerson().getEffectivity().getStart());
- }
-
- /**
- * Verify the query result and relationship to person
- */
- @SuppressWarnings("unchecked")
- @Test
- public void queryHomePhoneAtT5() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T5);
-
- TypedQuery<Phone> query = em.createQuery("SELECT p FROM Phone p WHERE p.type = 'Home'", Phone.class);
- Phone phone = query.getSingleResult();
-
- Assert.assertNotNull(phone);
- Assert.assertTrue(TemporalHelper.isEditionClass((Class<BaseEntity>) phone.getClass()));
- Assert.assertNotNull(phone.getContinuity());
- Assert.assertEquals(T4, phone.getEffectivity().getStart());
- Assert.assertEquals(EOT, phone.getEffectivity().getEnd());
-
- Assert.assertNotNull(phone.getPerson());
- Assert.assertEquals(phone.getEffectivity().getStart(), phone.getPerson().getEffectivity().getStart());
- }
-}
diff --git a/Temporal Entity Example/test-src/tests/FuturePersonTests.java b/Temporal Entity Example/test-src/tests/FuturePersonTests.java
deleted file mode 100644
index dde9a31..0000000
--- a/Temporal Entity Example/test-src/tests/FuturePersonTests.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests;
-
-import static example.PersonModelExample.T1;
-import static example.PersonModelExample.T2;
-import static example.PersonModelExample.T3;
-import static example.PersonModelExample.T4;
-import static example.PersonModelExample.*;
-import static temporal.Effectivity.BOT;
-
-import java.util.List;
-
-import model.Person;
-import model.PersonHobby;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import temporal.TemporalEntityManager;
-import example.PersonModelExample;
-
-/**
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class FuturePersonTests extends BaseTestCase {
-
- private static PersonModelExample example = new PersonModelExample();
-
- private Person getSample() {
- return example.futurePerson;
- }
-
- @Override
- public void populate(TemporalEntityManager em) {
- example.populateHobbies(em);
- for (PersonHobby ph : example.futurePerson.getPersonHobbies().values()) {
- em.persist(ph);
- }
- em.persist(example.futurePerson);
- }
-
- @Test
- public void queryAllCurrent() {
- TemporalEntityManager em = getEntityManager();
-
- List<Person> results = example.queryAllCurrent(em);
-
- Assert.assertTrue(results.isEmpty());
- }
-
- @Test
- public void queryPersonEditionAtBOT() {
- TemporalEntityManager em = getEntityManager();
- em.setProperty("EFF_TS", BOT);
-
- List<Person> results = em.createQuery("SELECT p FROM Person p WHERE p.cid = " + getSample().getId(), Person.class).getResultList();
-
- Assert.assertTrue("Editions found", results.isEmpty());
- }
-
- @Test
- public void queryFutureEditionOfCurrentPersonAtT1() {
- TemporalEntityManager em = getEntityManager();
- em.setProperty("EFF_TS", T1);
-
- List<Person> results = em.createQuery("SELECT p FROM Person p WHERE p.cid = " + getSample().getId(), Person.class).getResultList();
-
- Assert.assertTrue("Editions found", results.isEmpty());
- }
-
- @Test
- public void queryFutureEditionOfCurrentPersonAtT2() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T2);
-
- List<Person> results = em.createQuery("SELECT p FROM Person p WHERE p.cid = " + getSample().getId(), Person.class).getResultList();
-
- System.out.println("QUERY EFFECTIVE @ T2:");
- for (Person p : results) {
- System.out.println("\t>" + p);
- System.out.println("\t\t>" + p.getAddress());
- System.out.println("\t\t>" + p.getPhones().values());
- }
-
- Assert.assertFalse("No Editions found", results.isEmpty());
- Assert.assertEquals(1, results.size());
-
- Person person = results.get(0);
-
- Assert.assertSame(person, person.getContinuity());
- Assert.assertFalse(person.getEffectivity().isCurrent());
- Assert.assertTrue(person.getEffectivity().isFutureEdition());
- Assert.assertEquals(getSample().getId(), person.getId());
- Assert.assertEquals(getSample().getName(), person.getName());
- Assert.assertNull(person.getAddress());
- Assert.assertTrue(person.getPhones().isEmpty());
- }
-
- @Test
- public void queryFutureEditionOfCurrentPersonAtT3() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T3);
-
- List<Person> results = em.createQuery("SELECT p FROM Person p WHERE p.cid = " + getSample().getId(), Person.class).getResultList();
-
- System.out.println("QUERY EFFECTIVE @ T3:");
- for (Person p : results) {
- System.out.println("\t>" + p);
- System.out.println("\t\t>" + p.getAddress());
- System.out.println("\t\t>" + p.getPhones().values());
- }
-
- Assert.assertFalse("No Editions found", results.isEmpty());
- Assert.assertEquals(1, results.size());
-
- Person person = results.get(0);
-
- Assert.assertSame(person, person.getContinuity());
- Assert.assertFalse(person.getEffectivity().isCurrent());
- Assert.assertTrue(person.getEffectivity().isFutureEdition());
- Assert.assertEquals(getSample().getId(), person.getId());
- Assert.assertEquals(getSample().getName(), person.getName());
- Assert.assertNotNull(person.getAddress());
- Assert.assertTrue(person.getPhones().isEmpty());
- }
-
- @Test
- public void queryFutureEditionOfCurrentPersonAtT4() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T4);
-
- List<Person> results = em.createQuery("SELECT p FROM Person p WHERE p.cid = " + getSample().getId(), Person.class).getResultList();
-
- Assert.assertFalse("No PersonEdition Found", results.isEmpty());
-
- System.out.println("QUERY EFFECTIVE @ T4:");
- for (Person p : results) {
- System.out.println("\t>" + p);
- System.out.println("\t\t>" + p.getAddress());
- System.out.println("\t\t>" + p.getPhones().values());
- }
-
- Assert.assertFalse("No Editions found", results.isEmpty());
- Assert.assertEquals(1, results.size());
-
- Person person = results.get(0);
-
- Assert.assertSame(person, person.getContinuity());
- Assert.assertFalse(person.getEffectivity().isCurrent());
- Assert.assertTrue(person.getEffectivity().isFutureEdition());
- Assert.assertEquals(getSample().getId(), person.getId());
- Assert.assertEquals(getSample().getName(), person.getName());
- Assert.assertNotNull(person.getAddress());
- Assert.assertFalse(person.getPhones().isEmpty());
- }
-
- @Test
- public void queryFutureEditionOfCurrentPersonAtT5() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T5);
-
- List<Person> results = em.createQuery("SELECT p FROM Person p WHERE p.cid = " + getSample().getId(), Person.class).getResultList();
-
- System.out.println("QUERY EFFECTIVE @ T5:");
- for (Person p : results) {
- System.out.println("\t>" + p);
- System.out.println("\t\t>" + p.getAddress());
- System.out.println("\t\t>" + p.getPhones().values());
- }
-
- Assert.assertFalse("No Editions found", results.isEmpty());
- Assert.assertEquals(1, results.size());
-
- Person person = results.get(0);
-
- Assert.assertSame(person, person.getContinuity());
- Assert.assertFalse(person.getEffectivity().isCurrent());
- Assert.assertTrue(person.getEffectivity().isFutureEdition());
- Assert.assertEquals(getSample().getId(), person.getId());
- Assert.assertEquals(getSample().getName(), person.getName());
- Assert.assertNotNull(person.getAddress());
- Assert.assertFalse(person.getPhones().isEmpty());
- }
-
- @Test
- public void verifyCreateNewEntityInFuture() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T6, true);
-
- em.getTransaction().begin();
-
- Person p = em.newEntity(Person.class);
-
- Assert.assertNotNull(p);
- Assert.assertNotNull(p.getEffectivity());
-
- em.getTransaction().rollback();
- }
-
-}
diff --git a/Temporal Entity Example/test-src/tests/ModifyCurrentTests.java b/Temporal Entity Example/test-src/tests/ModifyCurrentTests.java
deleted file mode 100644
index 56ee1c7..0000000
--- a/Temporal Entity Example/test-src/tests/ModifyCurrentTests.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests;
-
-import static example.PersonModelExample.GOLF;
-import static example.PersonModelExample.RUN;
-import static example.PersonModelExample.SKI;
-import static example.PersonModelExample.T2;
-import static example.PersonModelExample.T4;
-import model.Address;
-import model.Person;
-import model.Phone;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import temporal.TemporalEntityManager;
-import example.PersonModelExample;
-
-/**
- * Make changes to the current (continuity) require that all future editions
- * which had the same value as the current be updated.
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class ModifyCurrentTests extends BaseTestCase {
-
- private static PersonModelExample example = new PersonModelExample();
-
- private Person getSample() {
- return example.fullPerson;
- }
-
- @Test
- public void test() {
- getSample();
- Assert.fail("NOT YET IMPLEMENTED");
- }
-
- @Override
- public void populate(TemporalEntityManager em) {
- System.out.println("\nFullPersonWithEditions.populate:START");
-
- example.populateHobbies(em);
- em.persist(example.fullPerson);
- em.flush();
-
- System.out.println("\n> Create T2 Edition");
- em.setEffectiveTime( T2, true);
-
- Person fpEdition = em.find(Person.class, example.fullPerson.getId());
- Person personEditionT2 = em.newEdition( fpEdition);
- personEditionT2.setName("Jimmy");
- Address aT2 = em.newEdition( example.fullPerson.getAddress());
- aT2.setCity("Toronto");
- aT2.setState("ON");
- personEditionT2.setAddress(aT2);
- Phone pT2 = em.newEdition( example.fullPerson.getPhone("Home"));
- personEditionT2.addPhone(pT2);
- pT2.setNumber("222-222-2222");
- em.persist(personEditionT2.addHobby(example.hobbies.get("golf"), T2));
- em.flush();
-
- System.out.println("\n> Create T4 Edition");
- em.setEffectiveTime( T4, true);
-
- Person personEditionT4 = em.newEdition( personEditionT2);
- personEditionT4.setName("James");
- Address aT4 = em.newEdition( aT2);
- aT4.setCity("San Francisco");
- aT4.setState("CA");
- personEditionT4.setAddress(aT4);
- Phone pT4 = em.newEdition( pT2);
- pT4.setNumber("444-444-4444");
- personEditionT4.addPhone(pT4);
- personEditionT4.removeHobby(example.hobbies.get(GOLF), T4, T4);
- em.persist(personEditionT4.addHobby(example.hobbies.get(RUN), T4));
- em.persist(personEditionT4.addHobby(example.hobbies.get(SKI), T4));
- em.flush();
-
- System.out.println("\nFullPersonWithEditions.populate::DONE");
- }
-
-}
diff --git a/Temporal Entity Example/test-src/tests/MultipleEditionQueries.java b/Temporal Entity Example/test-src/tests/MultipleEditionQueries.java
deleted file mode 100644
index 2876c2f..0000000
--- a/Temporal Entity Example/test-src/tests/MultipleEditionQueries.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests;
-
-import static example.PersonModelExample.GOLF;
-import static example.PersonModelExample.RUN;
-import static example.PersonModelExample.SKI;
-import static example.PersonModelExample.T2;
-import static example.PersonModelExample.T4;
-
-import java.util.List;
-
-import junit.framework.Assert;
-import model.Address;
-import model.Person;
-import model.Phone;
-
-import org.junit.Test;
-
-import temporal.TemporalEntityManager;
-import example.PersonModelExample;
-
-/**
- * TODO
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class MultipleEditionQueries extends BaseTestCase {
-
- private static PersonModelExample example = new PersonModelExample();
-
- private Person getSample() {
- return example.fullPerson;
- }
-
- @Test
- public void queryForAllPersonEditions() {
- TemporalEntityManager em = getEntityManager();
-
- List<Person> results = em.createQuery("SELECT p FROM PersonEditionView p ORDER BY p.effectivity.start", Person.class).getResultList();
-
- Assert.assertNotNull(results);
- Assert.assertEquals(3, results.size());
- }
-
- @Override
- public void populate(TemporalEntityManager em) {
- System.out.println("\nFullPersonWithEditions.populate:START");
-
- example.populateHobbies(em);
- em.persist(getSample());
- em.flush();
-
- System.out.println("\n> Create T2 Edition");
- em.setEffectiveTime(T2, true);
-
- Person fpEdition = em.find(Person.class, example.fullPerson.getId());
- Person personEditionT2 = em.newEdition(fpEdition);
- personEditionT2.setName("Jimmy");
- Address aT2 = em.newEdition(example.fullPerson.getAddress());
- aT2.setCity("Toronto");
- aT2.setState("ON");
- personEditionT2.setAddress(aT2);
- Phone pT2 = em.newEdition(example.fullPerson.getPhone("Home"));
- personEditionT2.addPhone(pT2);
- pT2.setNumber("222-222-2222");
- em.persist(personEditionT2.addHobby(example.hobbies.get(GOLF), T2));
- em.flush();
-
- System.out.println("\n> Create T4 Edition");
- em.setEffectiveTime(T4, true);
-
- Person personEditionT4 = em.newEdition(personEditionT2);
- personEditionT4.setName("James");
- Address aT4 = em.newEdition(aT2);
- aT4.setCity("San Francisco");
- aT4.setState("CA");
- personEditionT4.setAddress(aT4);
- Phone pT4 = em.newEdition(pT2);
- pT4.setNumber("444-444-4444");
- personEditionT4.addPhone(pT4);
- personEditionT4.removeHobby(example.hobbies.get(GOLF), T4, T4);
- em.persist(personEditionT4.addHobby(example.hobbies.get(RUN), T4));
- em.persist(personEditionT4.addHobby(example.hobbies.get(SKI), T4));
- em.flush();
-
- System.out.println("\nFullPersonWithEditions.populate::DONE");
- }
-
-}
diff --git a/Temporal Entity Example/test-src/tests/ProxyWrapperUpdateTests.java b/Temporal Entity Example/test-src/tests/ProxyWrapperUpdateTests.java
deleted file mode 100644
index 8745259..0000000
--- a/Temporal Entity Example/test-src/tests/ProxyWrapperUpdateTests.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests;
-
-import static example.PersonModelExample.T2;
-import static example.PersonModelExample.T4;
-
-import java.lang.reflect.Proxy;
-
-import junit.framework.Assert;
-import model.Address;
-import model.Person;
-import model.Phone;
-import model.entities.AddressEntity;
-import model.entities.PersonEntity;
-import model.entities.PhoneEntity;
-
-import org.junit.Test;
-
-import temporal.EditionWrapperHelper;
-import temporal.TemporalEdition;
-import temporal.TemporalEntity;
-import temporal.TemporalEntityManager;
-import example.PersonModelExample;
-
-/**
- * Tests that verify the update of editions
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class ProxyWrapperUpdateTests extends BaseTestCase {
-
- private static PersonModelExample example = new PersonModelExample();
-
- @Test
- public void createWrapperForCurrent() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime( null, false);
-
- try {
- EditionWrapperHelper.wrap(em, new PersonEntity());
- } catch (IllegalArgumentException e) {
- return;
- }
- Assert.fail("IllegalArgumentException not thrown");
- }
-
- @Test
- public void createWrapperForPersonEditionWithoutEffectiveTS() {
- TemporalEntityManager em = getEntityManager();
-
- try {
- em.getTransaction().begin();
- Person tempPerson = em.newEntity( Person.class);
- em.persist(tempPerson);
- em.flush();
-
- EditionWrapperHelper.wrap(em, tempPerson);
-
- } catch (IllegalArgumentException e) {
- return;
- }
-
- Assert.fail("IllegalArgumentException expected");
- }
-
- @Test
- public void createWrapperForPersonEdition() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime( T4, true);
-
- em.getTransaction().begin();
- Person tempPerson = em.newEntity( Person.class);
- em.persist(tempPerson);
- em.flush();
-
- TemporalEntity<Person> wrapper = EditionWrapperHelper.wrap(em, tempPerson);
-
- Assert.assertNotNull(wrapper);
- Assert.assertTrue(wrapper instanceof Person);
- Assert.assertTrue(wrapper instanceof TemporalEdition);
- }
-
- @Test
- public void createWrapperForAddressEdition() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime( T4, true);
-
- em.getTransaction().begin();
- TemporalEntity<Address> wrapper = EditionWrapperHelper.wrap(em, em.newEntity( AddressEntity.class));
-
- Assert.assertNotNull(wrapper);
- Assert.assertTrue(wrapper instanceof Address);
- Assert.assertTrue(wrapper instanceof TemporalEdition);
-
- em.getTransaction().rollback();
- }
-
- @Test
- public void createWrapperForPhoneEdition() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime( T4, true);
-
- em.getTransaction().begin();
- TemporalEntity<Phone> wrapper = EditionWrapperHelper.wrap(em,em.newEntity( PhoneEntity.class));
-
- Assert.assertNotNull(wrapper);
- Assert.assertTrue(wrapper instanceof Phone);
- Assert.assertTrue(wrapper instanceof TemporalEdition);
- em.getTransaction().rollback();
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void create2editionsUsingWrappers() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime( T2, true);
-
-
- Person editionAtT2 = em.find(Person.class, example.fullPerson.getId());
-
- em.getTransaction().begin();
- Person wrappedPerson = (Person) EditionWrapperHelper.wrap(em, editionAtT2);
-
- Assert.assertTrue(Proxy.isProxyClass(wrappedPerson.getClass()));
- Assert.assertTrue(Proxy.isProxyClass(wrappedPerson.getAddress().getClass()));
- Assert.assertFalse(((TemporalEdition<Person>) wrappedPerson).hasChanges());
-
- wrappedPerson.setName(editionAtT2.getName() + "@T2");
-
- Assert.assertTrue(((TemporalEdition<Person>) wrappedPerson).hasChanges());
-
- em.getTransaction().commit();
- em.close();
-
- em = getEntityManager();
- em.setEffectiveTime( T4, true);
-
- Person editionAtT4 = em.find(Person.class, example.fullPerson.getId());
-
- em.getTransaction().begin();
- wrappedPerson = (Person) EditionWrapperHelper.wrap(em, editionAtT4);
-
- Assert.assertFalse(((TemporalEdition<Person>) wrappedPerson).hasChanges());
-
- wrappedPerson.setName(editionAtT4.getName() + "@T4");
-
- Assert.assertTrue(((TemporalEdition<Person>) wrappedPerson).hasChanges());
-
- em.getTransaction().commit();
- }
-
- @Override
- public void populate(TemporalEntityManager em) {
- em.persist(example.fullPerson);
- }
-}
diff --git a/Temporal Entity Example/test-src/tests/editionsets/AllTests.java b/Temporal Entity Example/test-src/tests/editionsets/AllTests.java
deleted file mode 100644
index ed46d1d..0000000
--- a/Temporal Entity Example/test-src/tests/editionsets/AllTests.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests.editionsets;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses({ EditionSetConfigTests.class,
- CreateEditionSetTests.class,
- ApplySimpleEditionSetTests.class,
- MoveSingleEditionSetTests.class,
- DeleteEditionSetTests.class,
- PropagateChangesTests.class})
-public class AllTests {
-}
diff --git a/Temporal Entity Example/test-src/tests/editionsets/ApplySimpleEditionSetTests.java b/Temporal Entity Example/test-src/tests/editionsets/ApplySimpleEditionSetTests.java
deleted file mode 100644
index b21f89f..0000000
--- a/Temporal Entity Example/test-src/tests/editionsets/ApplySimpleEditionSetTests.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests.editionsets;
-
-import static example.PersonModelExample.GOLF;
-import static example.PersonModelExample.T2;
-import junit.framework.Assert;
-import model.Address;
-import model.Person;
-import model.Phone;
-import model.entities.PersonEntity;
-
-import org.junit.Test;
-
-import temporal.EditionSet;
-import temporal.EditionSetEntry;
-import temporal.EditionSetHelper;
-import temporal.TemporalEntityManager;
-import tests.BaseTestCase;
-import example.PersonModelExample;
-
-/**
- * Tests applying a simple (no conflict) {@link EditionSet}
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class ApplySimpleEditionSetTests extends BaseTestCase {
-
- private static PersonModelExample example = new PersonModelExample();
-
- private Person getSample() {
- return example.fullPerson;
- }
-
- @Test
- public void verifyEditionSetAtT2() {
- TemporalEntityManager em = getEntityManager();
-
- em.getTransaction().begin();
-
- EditionSet es = em.setEffectiveTime(T2, true);
-
- Assert.assertNotNull(es);
- Assert.assertEquals(T2, es.getEffective());
- Assert.assertEquals(3, es.getEntries().size());
-
- for (EditionSetEntry ese: es.getEntries()) {
- Assert.assertNotNull(ese.getTemporal());
- }
-
- EditionSetHelper.apply(em, es);
-
- em.flush();
- }
-
- /**
- * Populate initial sample entity
- */
- @Override
- public void populate(TemporalEntityManager em) {
- System.out.println("\nEditionSetTests.populate:START");
- example.populateHobbies(em);
- em.persist(getSample());
- em.flush();
-
- populateT2Editions(em);
- System.out.println("\nEditionSetTests.populate::DONE");
- }
-
- /**
- * Create the edition at T2 if it has not already been created
- */
- public Person populateT2Editions(TemporalEntityManager em) {
- EditionSet editionSet = em.setEffectiveTime(T2, true);
- Assert.assertNotNull(editionSet);
-
- Person personEditionT2 = em.find(Person.class, getSample().getId());
-
- if (personEditionT2.getEffectivity().getStart() != T2) {
- System.out.println("\nEditionSetTests.populateT2Edition:START");
-
- editionSet.setDescription("EditionSetTests::Person@T2");
- personEditionT2 = em.newEdition(personEditionT2);
- personEditionT2.setName("Jimmy");
- Address aT2 = em.newEdition(personEditionT2.getAddress());
- aT2.setCity("Toronto");
- aT2.setState("ON");
- personEditionT2.setAddress(aT2);
- Phone pT2 = em.newEdition(personEditionT2.getPhone("Home"));
- personEditionT2.addPhone(pT2);
- pT2.setNumber("222-222-2222");
- em.persist(personEditionT2.addHobby(example.hobbies.get(GOLF), T2));
-
- em.flush();
-
- System.out.println("\nEditionSetTests.populateT2Edition::DONE");
- }
-
- return personEditionT2;
- }
-
-}
diff --git a/Temporal Entity Example/test-src/tests/editionsets/CreateEditionSetTests.java b/Temporal Entity Example/test-src/tests/editionsets/CreateEditionSetTests.java
deleted file mode 100644
index 857cf24..0000000
--- a/Temporal Entity Example/test-src/tests/editionsets/CreateEditionSetTests.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests.editionsets;
-
-import static example.PersonModelExample.GOLF;
-import static example.PersonModelExample.RUN;
-import static example.PersonModelExample.SKI;
-import static example.PersonModelExample.T2;
-import static example.PersonModelExample.T4;
-import static example.PersonModelExample.T5;
-
-import java.util.List;
-
-import javax.persistence.Temporal;
-
-import junit.framework.Assert;
-import model.Address;
-import model.Person;
-import model.PersonHobby;
-import model.Phone;
-import model.entities.PersonEntity;
-
-import org.junit.Test;
-
-import temporal.EditionSet;
-import temporal.EditionSetEntry;
-import temporal.TemporalEntityManager;
-import temporal.TemporalHelper;
-import tests.BaseTestCase;
-import example.PersonModelExample;
-
-/**
- * Tests verifying the {@link EditionSet} capabilities.
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class CreateEditionSetTests extends BaseTestCase {
-
- private static PersonModelExample example = new PersonModelExample();
-
- private Person getSample() {
- return example.fullPerson;
- }
-
- @Test
- public void verifyEditionSetAtT2() {
- TemporalEntityManager em = getEntityManager();
-
- em.getTransaction().begin();
- populateT2Editions(em);
-
- EditionSet es = em.setEffectiveTime(T2, true);
-
- Assert.assertNotNull(es);
- Assert.assertEquals(T2, es.getEffective());
- Assert.assertEquals(4, es.getEntries().size());
-
- Assert.assertTrue(es.getEntries().get(0).getTemporal() instanceof Person);
- Person p = (Person) es.getEntries().get(0).getTemporal();
- Assert.assertEquals(T2, p.getEffectivity().getStart());
-
- Assert.assertTrue(es.getEntries().get(1).getTemporal() instanceof Address);
- Address a = (Address) es.getEntries().get(1).getTemporal();
- Assert.assertEquals(T2, a.getEffectivity().getStart());
-
- Assert.assertTrue(es.getEntries().get(2).getTemporal() instanceof Phone);
- Phone phone = (Phone) es.getEntries().get(2).getTemporal();
- Assert.assertEquals(T2, phone.getEffectivity().getStart());
-
- Assert.assertTrue(es.getEntries().get(3).getTemporal() instanceof PersonHobby);
- PersonHobby ph = (PersonHobby) es.getEntries().get(3).getTemporal();
- Assert.assertEquals(T2, ph.getEffectivity().getStart());
- Assert.assertSame(p, ph.getPerson());
- Assert.assertEquals(PersonModelExample.GOLF, ph.getName());
- Assert.assertEquals(PersonModelExample.GOLF, ph.getHobby().getName());
-
- Assert.assertEquals(1, p.getPersonHobbies().size());
-
- }
-
- @Test
- public void verifyEditionSetAtT4() {
- TemporalEntityManager em = getEntityManager();
- em.getTransaction().begin();
-
- populateT4Editions(em);
-
- List<EditionSet> editionSets = em.createQuery("SELECT e FROM EditionSet e ORDER BY e.effective", EditionSet.class).getResultList();
-
- Assert.assertNotNull(editionSets);
- Assert.assertEquals("Incorrect number of EditionSets found.", 2, editionSets.size());
-
- EditionSet t1 = editionSets.get(0);
- Assert.assertNotNull(t1);
- Assert.assertEquals(T2, t1.getEffective());
-
- EditionSet t2 = editionSets.get(1);
- Assert.assertNotNull(t2);
- Assert.assertEquals(T4, t2.getEffective());
- }
-
- /**
- * Verify that the addition of a {@link Temporal} value in a 1:M collection
- * causes an EditionSetEntry to be created.
- */
- @Test
- public void addHobbyAtT5WithInitializedEditionSet() {
- TemporalEntityManager em = getEntityManager();
- EditionSet es = em.setEffectiveTime(T5, true);
-
- Assert.assertNotNull(es);
-
- Person person = em.find(Person.class, getSample().getId());
- Assert.assertNotNull(person);
- Assert.assertTrue(TemporalHelper.isTemporalEntity(person));
- Assert.assertEquals(T5, es.getEffective());
-
- PersonHobby runHobby = em.newTemporal(PersonHobby.class);
- runHobby.setHobby(example.hobbies.get(RUN));
- person.addHobby(runHobby);
-
- Assert.assertEquals(1, es.getEntries().size());
-
- EditionSetEntry entry = es.getEntries().get(0);
-
- Assert.assertTrue(entry.getTemporal() instanceof PersonHobby);
- }
-
- /**
- * Populate initial sample entity
- */
- @Override
- public void populate(TemporalEntityManager em) {
- System.out.println("\nEditionSetTests.populate:START");
- example.populateHobbies(em);
- em.persist(getSample());
- System.out.println("\nEditionSetTests.populate::DONE");
- }
-
- /**
- * Create the edition at T2 if it has not already been created
- */
- public Person populateT2Editions(TemporalEntityManager em) {
- EditionSet editionSet = em.setEffectiveTime(T2, true);
- Assert.assertNotNull(editionSet);
-
- Person personEditionT2 = em.find(Person.class, getSample().getId());
-
- if (personEditionT2.getEffectivity().getStart() != T2) {
- System.out.println("\nEditionSetTests.populateT2Edition:START");
-
- editionSet.setDescription("EditionSetTests::Person@T2");
- personEditionT2 = em.newEdition(personEditionT2);
- personEditionT2.setName("Jimmy");
- Address aT2 = em.newEdition(personEditionT2.getAddress());
- aT2.setCity("Toronto");
- aT2.setState("ON");
- personEditionT2.setAddress(aT2);
- Phone pT2 = em.newEdition(personEditionT2.getPhone("Home"));
- personEditionT2.addPhone(pT2);
- pT2.setNumber("222-222-2222");
-
- PersonHobby golfHobby = em.newTemporal(PersonHobby.class);
- golfHobby.setHobby(example.hobbies.get(GOLF));
- personEditionT2.addHobby(golfHobby);
-
- em.flush();
-
- System.out.println("\nEditionSetTests.populateT2Edition::DONE");
- }
-
- return personEditionT2;
- }
-
- public Person populateT4Editions(TemporalEntityManager em) {
- populateT2Editions(em);
-
- EditionSet editionSet = em.setEffectiveTime(T4, true);
- Assert.assertNotNull(editionSet);
-
- Person personEditionT4 = em.find(Person.class, getSample().getId());
-
- if (personEditionT4 == null) {
- System.out.println("\nEditionSetTests.populateT4Edition:START");
- em.initializeEditionSet().setDescription("EditionSetTests::Person@T4");
- personEditionT4 = em.newEdition(personEditionT4);
- personEditionT4.setName("James");
- Address aT4 = em.newEdition(personEditionT4.getAddress());
- aT4.setCity("San Francisco");
- aT4.setState("CA");
- personEditionT4.setAddress(aT4);
- Phone pT4 = em.newEdition(personEditionT4.getPhone("Home"));
- pT4.setNumber("444-444-4444");
- personEditionT4.addPhone(pT4);
- personEditionT4.getPersonHobbies().get(GOLF).getEffectivity().setEnd(T4);
-
- PersonHobby runHobby = em.newTemporal(PersonHobby.class);
- runHobby.setHobby(example.hobbies.get(RUN));
- personEditionT4.addHobby(runHobby);
-
- PersonHobby skiHobby = em.newTemporal(PersonHobby.class);
- skiHobby.setHobby(example.hobbies.get(SKI));
- personEditionT4.addHobby(skiHobby);
-
- em.flush();
-
- System.out.println("\nEditionSetTests.populateT4Edition:DONE");
- }
-
- return personEditionT4;
- }
-}
diff --git a/Temporal Entity Example/test-src/tests/editionsets/DeleteEditionSetTests.java b/Temporal Entity Example/test-src/tests/editionsets/DeleteEditionSetTests.java
deleted file mode 100644
index f1e9690..0000000
--- a/Temporal Entity Example/test-src/tests/editionsets/DeleteEditionSetTests.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests.editionsets;
-
-import static example.PersonModelExample.GOLF;
-import static example.PersonModelExample.RUN;
-import static example.PersonModelExample.SKI;
-import static example.PersonModelExample.T2;
-import static example.PersonModelExample.T4;
-import static example.PersonModelExample.T5;
-
-import java.util.List;
-
-import javax.persistence.Temporal;
-
-import junit.framework.Assert;
-import model.Address;
-import model.Person;
-import model.PersonHobby;
-import model.Phone;
-import model.entities.PersonEntity;
-
-import org.junit.Test;
-
-import temporal.EditionSet;
-import temporal.EditionSetEntry;
-import temporal.TemporalEntityManager;
-import temporal.TemporalHelper;
-import tests.BaseTestCase;
-import example.PersonModelExample;
-
-/**
- * Tests verifying the {@link EditionSet} capabilities.
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class DeleteEditionSetTests extends BaseTestCase {
-
- private static PersonModelExample example = new PersonModelExample();
-
- private Person getSample() {
- return example.fullPerson;
- }
-
- @Test
- public void verifyEditionSetAtT2() {
- TemporalEntityManager em = getEntityManager();
-
- em.getTransaction().begin();
- populateT2Editions(em);
-
- EditionSet es = em.setEffectiveTime(T2, true);
-
- Assert.assertNotNull(es);
- Assert.assertEquals(T2, es.getEffective());
- Assert.assertEquals(4, es.getEntries().size());
-
- Assert.assertTrue(es.getEntries().get(0).getTemporal() instanceof Person);
- Person p = (Person) es.getEntries().get(0).getTemporal();
- Assert.assertEquals(T2, p.getEffectivity().getStart());
-
- Assert.assertTrue(es.getEntries().get(1).getTemporal() instanceof Address);
- Address a = (Address) es.getEntries().get(1).getTemporal();
- Assert.assertEquals(T2, a.getEffectivity().getStart());
-
- Assert.assertTrue(es.getEntries().get(2).getTemporal() instanceof Phone);
- Phone phone = (Phone) es.getEntries().get(2).getTemporal();
- Assert.assertEquals(T2, phone.getEffectivity().getStart());
-
- Assert.assertTrue(es.getEntries().get(3).getTemporal() instanceof PersonHobby);
- PersonHobby ph = (PersonHobby) es.getEntries().get(3).getTemporal();
- Assert.assertEquals(T2, ph.getEffectivity().getStart());
- Assert.assertSame(p, ph.getPerson());
- Assert.assertEquals(PersonModelExample.GOLF, ph.getName());
- Assert.assertEquals(PersonModelExample.GOLF, ph.getHobby().getName());
-
- Assert.assertEquals(1, p.getPersonHobbies().size());
-
- }
-
- @Test
- public void verifyEditionSetAtT4() {
- TemporalEntityManager em = getEntityManager();
- em.getTransaction().begin();
-
- populateT4Editions(em);
-
- List<EditionSet> editionSets = em.createQuery("SELECT e FROM EditionSet e ORDER BY e.effective", EditionSet.class).getResultList();
-
- Assert.assertNotNull(editionSets);
- Assert.assertEquals("Incorrect number of EditionSets found.", 2, editionSets.size());
-
- EditionSet t1 = editionSets.get(0);
- Assert.assertNotNull(t1);
- Assert.assertEquals(T2, t1.getEffective());
-
- EditionSet t2 = editionSets.get(1);
- Assert.assertNotNull(t2);
- Assert.assertEquals(T4, t2.getEffective());
- }
-
- /**
- * Verify that the addition of a {@link Temporal} value in a 1:M collection
- * causes an EditionSetEntry to be created.
- */
- @Test
- public void addHobbyAtT5WithInitializedEditionSet() {
- TemporalEntityManager em = getEntityManager();
- EditionSet es = em.setEffectiveTime(T5, true);
-
- Assert.assertNotNull(es);
-
- Person person = em.find(Person.class, getSample().getId());
- Assert.assertNotNull(person);
- Assert.assertTrue(TemporalHelper.isTemporalEntity(person));
- Assert.assertEquals(T5, es.getEffective());
-
- PersonHobby runHobby = em.newTemporal(PersonHobby.class);
- runHobby.setHobby(example.hobbies.get(RUN));
- person.addHobby(runHobby);
-
- Assert.assertEquals(1, es.getEntries().size());
-
- EditionSetEntry entry = es.getEntries().get(0);
-
- Assert.assertTrue(entry.getTemporal() instanceof PersonHobby);
- }
-
- /**
- * Populate initial sample entity
- */
- @Override
- public void populate(TemporalEntityManager em) {
- System.out.println("\nEditionSetTests.populate:START");
- example.populateHobbies(em);
- em.persist(getSample());
- System.out.println("\nEditionSetTests.populate::DONE");
- }
-
- /**
- * Create the edition at T2 if it has not already been created
- */
- public Person populateT2Editions(TemporalEntityManager em) {
- EditionSet editionSet = em.setEffectiveTime(T2, true);
- Assert.assertNotNull(editionSet);
-
- Person personEditionT2 = em.find(Person.class, getSample().getId());
-
- if (personEditionT2.getEffectivity().getStart() != T2) {
- System.out.println("\nEditionSetTests.populateT2Edition:START");
-
- editionSet.setDescription("EditionSetTests::Person@T2");
- personEditionT2 = em.newEdition(personEditionT2);
- personEditionT2.setName("Jimmy");
- Address aT2 = em.newEdition(personEditionT2.getAddress());
- aT2.setCity("Toronto");
- aT2.setState("ON");
- personEditionT2.setAddress(aT2);
- Phone pT2 = em.newEdition(personEditionT2.getPhone("Home"));
- personEditionT2.addPhone(pT2);
- pT2.setNumber("222-222-2222");
-
- PersonHobby golfHobby = em.newTemporal(PersonHobby.class);
- golfHobby.setHobby(example.hobbies.get(GOLF));
- personEditionT2.addHobby(golfHobby);
-
- em.flush();
-
- System.out.println("\nEditionSetTests.populateT2Edition::DONE");
- }
-
- return personEditionT2;
- }
-
- public Person populateT4Editions(TemporalEntityManager em) {
- populateT2Editions(em);
-
- EditionSet editionSet = em.setEffectiveTime(T4, true);
- Assert.assertNotNull(editionSet);
-
- Person personEditionT4 = em.find(Person.class, getSample().getId());
-
- if (personEditionT4 == null) {
- System.out.println("\nEditionSetTests.populateT4Edition:START");
- em.initializeEditionSet().setDescription("EditionSetTests::Person@T4");
- personEditionT4 = em.newEdition(personEditionT4);
- personEditionT4.setName("James");
- Address aT4 = em.newEdition(personEditionT4.getAddress());
- aT4.setCity("San Francisco");
- aT4.setState("CA");
- personEditionT4.setAddress(aT4);
- Phone pT4 = em.newEdition(personEditionT4.getPhone("Home"));
- pT4.setNumber("444-444-4444");
- personEditionT4.addPhone(pT4);
- personEditionT4.getPersonHobbies().get(GOLF).getEffectivity().setEnd(T4);
-
- PersonHobby runHobby = em.newTemporal(PersonHobby.class);
- runHobby.setHobby(example.hobbies.get(RUN));
- personEditionT4.addHobby(runHobby);
-
- PersonHobby skiHobby = em.newTemporal(PersonHobby.class);
- skiHobby.setHobby(example.hobbies.get(SKI));
- personEditionT4.addHobby(skiHobby);
-
- em.flush();
-
- System.out.println("\nEditionSetTests.populateT4Edition:DONE");
- }
-
- return personEditionT4;
- }
-}
diff --git a/Temporal Entity Example/test-src/tests/editionsets/EditionSetConfigTests.java b/Temporal Entity Example/test-src/tests/editionsets/EditionSetConfigTests.java
deleted file mode 100644
index 1fba99d..0000000
--- a/Temporal Entity Example/test-src/tests/editionsets/EditionSetConfigTests.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests.editionsets;
-
-import static example.PersonModelExample.T6;
-import junit.framework.Assert;
-import model.Person;
-
-import org.eclipse.persistence.descriptors.ClassDescriptor;
-import org.eclipse.persistence.mappings.OneToManyMapping;
-import org.eclipse.persistence.mappings.VariableOneToOneMapping;
-import org.eclipse.persistence.sessions.server.Server;
-import org.junit.Test;
-
-import temporal.EditionSet;
-import temporal.TemporalEntityManager;
-import temporal.TemporalHelper;
-import tests.BaseTestCase;
-import example.PersonModelExample;
-
-/**
- * Tests verifying the {@link EditionSet} capabilities.
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class EditionSetConfigTests extends BaseTestCase {
-
- private static PersonModelExample example = new PersonModelExample();
-
- private Person getSample() {
- return example.fullPerson;
- }
-
- @Test
- public void verifyEditionSetMapping() {
- TemporalEntityManager em = getEntityManager();
-
- ClassDescriptor desc = em.unwrap(Server.class).getClassDescriptorForAlias("EditionSet");
- Assert.assertNotNull(desc);
-
- OneToManyMapping otmMapping = (OneToManyMapping) desc.getMappingForAttributeName("entries");
- Assert.assertNotNull(otmMapping);
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- @Test
- public void verifyEditionSetEntryMapping() {
- TemporalEntityManager em = getEntityManager();
-
- ClassDescriptor desc = em.unwrap(Server.class).getClassDescriptorForAlias("EditionSetEntry");
- Assert.assertNotNull(desc);
-
- VariableOneToOneMapping votoMapping = (VariableOneToOneMapping) desc.getMappingForAttributeName("temporal");
- Assert.assertNotNull(votoMapping);
-
- Assert.assertEquals(8, votoMapping.getTypeIndicatorTranslation().size());
-
- Assert.assertTrue(votoMapping.getTypeIndicatorTranslation().containsKey("Person"));
- Assert.assertTrue(TemporalHelper.isEditionClass((Class) votoMapping.getTypeIndicatorTranslation().get("Person")));
-
- Assert.assertTrue(votoMapping.getTypeIndicatorTranslation().containsKey("Phone"));
- Assert.assertTrue(TemporalHelper.isEditionClass((Class) votoMapping.getTypeIndicatorTranslation().get("Phone")));
-
- Assert.assertTrue(votoMapping.getTypeIndicatorTranslation().containsKey("Address"));
- Assert.assertTrue(TemporalHelper.isEditionClass((Class) votoMapping.getTypeIndicatorTranslation().get("Address")));
-
- Assert.assertTrue(votoMapping.getTypeIndicatorTranslation().containsKey("PersonHobby"));
- Assert.assertTrue(TemporalHelper.isTemporal((Class) votoMapping.getTypeIndicatorTranslation().get("PersonHobby"), false));
- }
-
- @Test
- public void verifySetEffectiveInitialize() {
- TemporalEntityManager em = getEntityManager();
-
- em.setEffectiveTime(T6, true);
-
- EditionSet es = em.getEditionSet();
-
- Assert.assertNotNull(es);
- Assert.assertEquals(T6, es.getEffective());
- }
-
- @Test
- public void verifyInitialize() {
- TemporalEntityManager em = getEntityManager();
-
- em.setEffectiveTime(T6);
- em.initializeEditionSet();
-
- EditionSet es = em.getEditionSet();
-
- Assert.assertNotNull(es);
- Assert.assertEquals(T6, es.getEffective());
- }
-
- @Test
- public void verifyNotInitialized() {
- TemporalEntityManager em = getEntityManager();
-
- em.setEffectiveTime(T6);
-
- EditionSet es = em.getEditionSet();
-
- Assert.assertNull(es);
- }
-
- /**
- * Populate initial sample entity
- */
- @Override
- public void populate(TemporalEntityManager em) {
- System.out.println("\nEditionSetTests.populate:START");
- example.populateHobbies(em);
- em.persist(getSample());
- System.out.println("\nEditionSetTests.populate::DONE");
- }
-
-}
diff --git a/Temporal Entity Example/test-src/tests/editionsets/MoveSingleEditionSetTests.java b/Temporal Entity Example/test-src/tests/editionsets/MoveSingleEditionSetTests.java
deleted file mode 100644
index a2754a2..0000000
--- a/Temporal Entity Example/test-src/tests/editionsets/MoveSingleEditionSetTests.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests.editionsets;
-
-import static example.PersonModelExample.GOLF;
-import static example.PersonModelExample.T2;
-import junit.framework.Assert;
-import model.Address;
-import model.Person;
-import model.Phone;
-
-import org.junit.Test;
-
-import temporal.EditionSet;
-import temporal.EditionSetEntry;
-import temporal.TemporalEntityManager;
-import tests.BaseTestCase;
-import example.PersonModelExample;
-
-/**
- * Tests applying a simple (no conflict) {@link EditionSet}
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class MoveSingleEditionSetTests extends BaseTestCase {
-
- private static PersonModelExample example = new PersonModelExample();
-
- private Person getSample() {
- return example.fullPerson;
- }
-
- @Test
- public void moveEditionSetFromT2toT3() {
- TemporalEntityManager em = getEntityManager();
-
- em.getTransaction().begin();
-
- EditionSet es = em.setEffectiveTime(T2, true);
-
- Assert.assertNotNull(es);
- Assert.assertEquals(T2, es.getEffective());
- Assert.assertEquals(3, es.getEntries().size());
-
- for (EditionSetEntry entry : es.getEntries()) {
- System.out.println("> " + entry.getTemporal());
- for (String attrName : entry.getAttributes()) {
- System.out.println("\t>> " + attrName);
- }
- }
- }
-
- /**
- * Populate initial sample entity
- */
- @Override
- public void populate(TemporalEntityManager em) {
- System.out.println("\nEditionSetTests.populate:START");
- example.populateHobbies(em);
- em.persist(getSample());
- populateT2Editions(em);
- System.out.println("\nEditionSetTests.populate::DONE");
- }
-
- /**
- * Create the edition at T2 if it has not already been created
- */
- public Person populateT2Editions(TemporalEntityManager em) {
- EditionSet editionSet = em.setEffectiveTime(T2, true);
- Assert.assertNotNull(editionSet);
-
- Person personEditionT2 = em.find(Person.class, getSample().getId());
-
- if (personEditionT2.getEffectivity().getStart() != T2) {
- System.out.println("\nEditionSetTests.populateT2Edition:START");
-
- editionSet.setDescription("EditionSetTests::Person@T2");
- personEditionT2 = em.newEdition(personEditionT2);
- personEditionT2.setName("Jimmy");
- Address aT2 = em.newEdition(personEditionT2.getAddress());
- aT2.setCity("Toronto");
- aT2.setState("ON");
- personEditionT2.setAddress(aT2);
- Phone pT2 = em.newEdition(personEditionT2.getPhone("Home"));
- personEditionT2.addPhone(pT2);
- pT2.setNumber("222-222-2222");
- em.persist(personEditionT2.addHobby(example.hobbies.get(GOLF), T2));
- em.flush();
-
- System.out.println("\nEditionSetTests.populateT2Edition::DONE");
- }
-
- return personEditionT2;
- }
-
-}
diff --git a/Temporal Entity Example/test-src/tests/editionsets/PropagateChangesTests.java b/Temporal Entity Example/test-src/tests/editionsets/PropagateChangesTests.java
deleted file mode 100644
index 8ebeab3..0000000
--- a/Temporal Entity Example/test-src/tests/editionsets/PropagateChangesTests.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests.editionsets;
-
-import static example.PersonModelExample.GOLF;
-import static example.PersonModelExample.RUN;
-import static example.PersonModelExample.SWIM;
-import static example.PersonModelExample.T2;
-import static example.PersonModelExample.T4;
-import junit.framework.Assert;
-import model.Address;
-import model.Person;
-import model.Phone;
-import model.entities.PersonEntity;
-
-import org.junit.Test;
-
-import temporal.EditionSet;
-import temporal.TemporalEntityManager;
-import temporal.TemporalHelper;
-import tests.BaseTestCase;
-import example.PersonModelExample;
-
-/**
- * Tests change propagation through future editions.
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class PropagateChangesTests extends BaseTestCase {
-
- private static PersonModelExample example = new PersonModelExample();
-
- private Person getSample() {
- return example.fullPerson;
- }
-
- @Test
- public void makeBasicChangesAtT2Changes() {
- TemporalEntityManager em = getEntityManager();
-
- em.getTransaction().begin();
-
- EditionSet esT2 = em.setEffectiveTime( T2, true);
- Assert.assertNotNull(esT2);
-
- Person personT2 = em.find(Person.class, getSample().getId());
-
- Assert.assertNotNull(personT2);
- Assert.assertTrue(TemporalHelper.isEdition(em, personT2));
- Assert.assertEquals(T2, personT2.getEffectivity().getStart());
-
- personT2.setName("Jimster");
- personT2.setEmail("a@b.c");
- personT2.getAddress().setState("ONT");
- personT2.getAddress().setStreet(null);
-
- em.flush();
- em.clear();
-
- EditionSet esT4 = em.setEffectiveTime( T4, true);
- Assert.assertNotNull(esT4);
-
- Person personT4 = em.find(Person.class, getSample().getId());
-
- Assert.assertNotNull(personT4);
- Assert.assertTrue(TemporalHelper.isEdition(em, personT4));
- Assert.assertEquals(T4, personT4.getEffectivity().getStart());
-
- String nativeName = (String) em.createNativeQuery("SELECT P_NAMES FROM TPERSON WHERE CID = " + getSample().getId() + " AND START_TS = 400").getSingleResult();
- Assert.assertEquals("Jimbo", nativeName);
- Assert.assertEquals("Jimbo", personT4.getName());
-
- String nativeState = (String) em.createNativeQuery("SELECT STATE FROM TADDRESS WHERE CID = " + getSample().getAddress().getId() + " AND START_TS = 400").getSingleResult();
- Assert.assertEquals("ONT", nativeState);
- Assert.assertEquals("ONT", personT4.getAddress().getState());
-
- Assert.assertNull(personT4.getAddress().getStreet());
- Assert.assertNotNull(personT4.getEmail());
- }
-
- @Test
- public void makeBasicCollectionChangesAtT2Changes() {
- TemporalEntityManager em = getEntityManager();
-
- em.getTransaction().begin();
-
- EditionSet esT2 = em.setEffectiveTime( T2, true);
- Assert.assertNotNull(esT2);
-
- Person personT2 = em.find(Person.class, getSample().getId());
-
- Assert.assertNotNull(personT2);
- Assert.assertTrue(TemporalHelper.isEdition(em, personT2));
- Assert.assertEquals(T2, personT2.getEffectivity().getStart());
-
- em.persist(personT2.addHobby(example.hobbies.get(SWIM), T2));
-
- try {
- em.flush();
- } catch (UnsupportedOperationException e) {
- return;
- }
- Assert.fail("UnsupportedOperationException expected");
-
- }
-
- /**
- * Populate initial sample entity
- */
- @Override
- public void populate(TemporalEntityManager em) {
- System.out.println("\nEditionSetTests.populate:START");
- example.populateHobbies(em);
- em.persist(getSample());
- populateT2Editions(em);
- populateT4Editions(em);
- System.out.println("\nEditionSetTests.populate::DONE");
- }
-
- /**
- * Create the edition at T2 if it has not already been created
- */
- public Person populateT2Editions(TemporalEntityManager em) {
- EditionSet editionSet = em.setEffectiveTime( T2, true);
- Assert.assertNotNull(editionSet);
-
- Person personEditionT2 = em.find(Person.class, getSample().getId());
-
- if (personEditionT2.getEffectivity().getStart() != T2) {
- System.out.println("\nEditionSetTests.populateT2Edition:START");
-
- editionSet.setDescription("EditionSetTests::Person@T2");
- personEditionT2 = em.newEdition( personEditionT2);
- personEditionT2.setName("Jimmy");
- Address aT2 = em.newEdition( personEditionT2.getAddress());
- aT2.setCity("Toronto");
- aT2.setState("ON");
- personEditionT2.setAddress(aT2);
- Phone pT2 = em.newEdition( personEditionT2.getPhone("Home"));
- personEditionT2.addPhone(pT2);
- pT2.setNumber("222-222-2222");
- em.persist(personEditionT2.addHobby(example.hobbies.get(GOLF), T2));
- em.flush();
-
- System.out.println("\nEditionSetTests.populateT2Edition::DONE");
- }
-
- return personEditionT2;
- }
-
- /**
- * Create the edition at T2 if it has not already been created
- */
- public Person populateT4Editions(TemporalEntityManager em) {
- EditionSet editionSet = em.setEffectiveTime( T4, true);
- Assert.assertNotNull(editionSet);
-
- Person personEditionT4 = em.find(Person.class, getSample().getId());
-
- if (personEditionT4.getEffectivity().getStart() != T4) {
- System.out.println("\nEditionSetTests.populateT4Edition:START");
-
- editionSet.setDescription("EditionSetTests::Person@T4");
- personEditionT4 = em.newEdition( personEditionT4);
- personEditionT4.setName("Jimbo");
- Address aT4 = em.newEdition( personEditionT4.getAddress());
- aT4.setCity("Ottawa");
- personEditionT4.setAddress(aT4);
- Phone pT4 = em.newEdition( personEditionT4.getPhone("Home"));
- personEditionT4.addPhone(pT4);
- pT4.setNumber("444-444-4444");
- em.persist(personEditionT4.addHobby(example.hobbies.get(RUN), T4));
- em.flush();
-
- System.out.println("\nEditionSetTests.populateT4Edition::DONE");
- }
-
- return personEditionT4;
- }
-}
diff --git a/Temporal Entity Example/test-src/tests/internal/AllTests.java b/Temporal Entity Example/test-src/tests/internal/AllTests.java
deleted file mode 100644
index c6125a5..0000000
--- a/Temporal Entity Example/test-src/tests/internal/AllTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests.internal;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-/**
- * Internal test suite verifying how EclipseLInk and the temporal extensions are working.
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-@RunWith(Suite.class)
-@SuiteClasses({ VerifyConfigTests.class,
- VerifySchemaManager.class,
- TemporalHelperTests.class,
- TemporalEntityManagerTests.class,
- TemporalEntityTests.class,
- //WrapperPolicyTests.class,
- })
-public class AllTests {
-}
diff --git a/Temporal Entity Example/test-src/tests/internal/TemporalEntityManagerTests.java b/Temporal Entity Example/test-src/tests/internal/TemporalEntityManagerTests.java
deleted file mode 100644
index f20a375..0000000
--- a/Temporal Entity Example/test-src/tests/internal/TemporalEntityManagerTests.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests.internal;
-
-import static example.PersonModelExample.T1;
-import static example.PersonModelExample.T3;
-import static example.PersonModelExample.T4;
-import static example.PersonModelExample.T5;
-import static example.PersonModelExample.T6;
-import static example.PersonModelExample.T7;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static temporal.Effectivity.BOT;
-import static temporal.Effectivity.EOT;
-
-import javax.persistence.EntityManager;
-
-import junit.framework.Assert;
-import model.PersonHobby;
-
-import org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork;
-import org.eclipse.persistence.sessions.DatabaseSession;
-import org.eclipse.persistence.sessions.UnitOfWork;
-import org.eclipse.persistence.sessions.server.ClientSession;
-import org.eclipse.persistence.sessions.server.Server;
-import org.junit.Test;
-
-import temporal.TemporalEntityManager;
-import tests.BaseTestCase;
-
-/**
- * Verify the {@link TemporalEntityManager} API
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class TemporalEntityManagerTests extends BaseTestCase {
-
- private void verifySetStartTime(TemporalEntityManager em, Long value) {
- assertTrue(em.hasEffectiveTime());
- assertNotNull(em.getEffectiveTime());
- assertEquals(value, em.getEffectiveTime());
-
- RepeatableWriteUnitOfWork uow = em.unwrap(RepeatableWriteUnitOfWork.class);
- assertNotNull(uow);
-
- ClientSession clientSession = (ClientSession) uow.getParent();
-
- DatabaseSession session = em.unwrap(DatabaseSession.class);
- assertNotSame(clientSession, session);
-
- Server serverSession = em.unwrap(Server.class);
- assertNotSame(clientSession, serverSession);
- assertSame(session, serverSession);
- }
-
- @Test
- public void verifyGetInstance() {
- TemporalEntityManager em1 = getEntityManager();
-
- Assert.assertTrue(em1.getProperties().containsKey(TemporalEntityManager.TEMPORAL_EM_PROPERTY));
- Assert.assertFalse(em1.getProperties().containsKey(TemporalEntityManager.EFF_TS_PROPERTY));
- assertFalse(em1.hasEffectiveTime());
- assertNull(em1.getEffectiveTime());
-
- EntityManager wrappedEm = em1.unwrap(EntityManager.class);
- Assert.assertNotSame(em1, wrappedEm);
-
- TemporalEntityManager em2 = TemporalEntityManager.getInstance(wrappedEm);
- Assert.assertSame(em1, em2);
-
- TemporalEntityManager em3 = TemporalEntityManager.getInstance(wrappedEm.unwrap(UnitOfWork.class));
- Assert.assertSame(em1, em3);
-
- TemporalEntityManager em4 = TemporalEntityManager.getInstance(em1);
- Assert.assertSame(em1, em4);
- }
-
- @Test
- public void verifySetStartTime() {
- TemporalEntityManager em = getEntityManager();
-
- assertFalse(em.hasEffectiveTime());
- assertNull(em.getEffectiveTime());
-
- em.setEffectiveTime(T1);
-
- verifySetStartTime(em, T1);
- }
-
- @Test
- public void verifyClearStartTime() {
- TemporalEntityManager em = getEntityManager();
- assertFalse(em.hasEffectiveTime());
- assertNull(em.getEffectiveTime());
-
- em.setEffectiveTime(T3);
-
- verifySetStartTime(em, T3);
-
- em.clearEffectiveTime();
-
- assertFalse(em.hasEffectiveTime());
- assertNull(em.getEffectiveTime());
- }
-
- @Test
- public void verifyConcurrentSetStartTime() {
- TemporalEntityManager em1 = getEntityManager();
- TemporalEntityManager em2 = TemporalEntityManager.getInstance(getEMF().createEntityManager());
-
- assertNotSame(em1, em2);
-
- em1.setEffectiveTime(T4);
-
- em2.setEffectiveTime(T5);
-
- verifySetStartTime(em2, T5);
- verifySetStartTime(em1, T4);
- }
-
- @Test
- public void verifyConcurrentClearStartTime() {
- TemporalEntityManager em1 = getEntityManager();
- TemporalEntityManager em2 = TemporalEntityManager.getInstance(getEMF().createEntityManager());
-
- assertNotSame(em1, em2);
-
- em1.setEffectiveTime(T6);
- em2.setEffectiveTime(T7);
-
- verifySetStartTime(em2, T7);
- verifySetStartTime(em1, T6);
-
- em1.clearEffectiveTime();
- verifySetStartTime(em2, T7);
- assertFalse(em1.hasEffectiveTime());
- assertNull(em1.getEffectiveTime());
-
- em2.clearEffectiveTime();
- assertFalse(em2.hasEffectiveTime());
- assertNull(em2.getEffectiveTime());
- }
-
- @Test
- public void verifyCurrentCreateTemporal() {
- TemporalEntityManager em = getEntityManager();
- em.getTransaction().begin();
-
- PersonHobby ph = em.newTemporal(PersonHobby.class);
-
- Assert.assertNotNull(ph);
- Assert.assertNotNull(ph.getEffectivity());
- Assert.assertEquals(BOT, ph.getEffectivity().getStart());
- Assert.assertEquals(EOT, ph.getEffectivity().getEnd());
- }
-
- @Test
- public void verifyFutureCreateTemporal() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T3, true);
- em.getTransaction().begin();
-
- PersonHobby ph = em.newTemporal(PersonHobby.class);
-
- Assert.assertNotNull(ph);
- Assert.assertNotNull(ph.getEffectivity());
- Assert.assertEquals(T3, ph.getEffectivity().getStart());
- Assert.assertEquals(EOT, ph.getEffectivity().getEnd());
- }
-}
diff --git a/Temporal Entity Example/test-src/tests/internal/TemporalEntityTests.java b/Temporal Entity Example/test-src/tests/internal/TemporalEntityTests.java
deleted file mode 100644
index a27c535..0000000
--- a/Temporal Entity Example/test-src/tests/internal/TemporalEntityTests.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests.internal;
-
-import static temporal.Effectivity.BOT;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import temporal.BaseTemporalEntity;
-import temporal.TemporalEntity;
-
-/**
- * Simple tests verifying the functionality of the interfaces and base classes
- * used in this temporal extension framework.
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-
-public class TemporalEntityTests {
-
- @Test
- public void verifyTestEntityConstructor() {
- TestEntity entity = new TestEntityImpl();
-
- Assert.assertNotNull(entity.getEffectivity());
- Assert.assertNull(entity.getContinuity());
- Assert.assertNull(entity.getPreviousEdition());
- Assert.assertEquals(0, entity.getVersion());
- Assert.assertEquals(BOT, entity.getEffectivity().getStart());
- }
-
- @Test
- public void verifyTestEntityEditionConstructor() {
- TestEntity entity = new TestEntityEdition();
-
- Assert.assertNotNull(entity.getEffectivity());
- Assert.assertNull(entity.getContinuity());
- Assert.assertNull(entity.getPreviousEdition());
- Assert.assertEquals(0, entity.getVersion());
- Assert.assertEquals(BOT, entity.getEffectivity().getStart());
- }
-
- @Test
- public void verifyTestEntityEditionViewConstructor() {
- TestEntity entity = new TestEntityEditionView();
-
- Assert.assertNotNull(entity.getEffectivity());
- Assert.assertNull(entity.getContinuity());
- Assert.assertNull(entity.getPreviousEdition());
- Assert.assertEquals(0, entity.getVersion());
- Assert.assertEquals(BOT, entity.getEffectivity().getStart());
- }
-
- @Test
- public void testIsContinuity() {
- TestEntity entity = new TestEntityEditionView();
-
- Assert.assertFalse(entity.isContinuity());
-
- entity.setId(1);
- entity.setContinuity(entity);
-
- Assert.assertTrue(entity.isContinuity());
- }
-
- /**
- * Static test classes
- */
-
- public static interface TestEntity extends TemporalEntity<TestEntity> {
- void setId(int id);
- }
-
- public static class TestEntityImpl extends BaseTemporalEntity<TestEntity> implements TestEntity {
-
- @Override
- public void setId(int id) {
- super.setId(id);
- }
-
- }
-
- public static class TestEntityEdition extends TestEntityImpl {
-
- }
-
- public static class TestEntityEditionView extends TestEntityEdition {
-
- }
-}
diff --git a/Temporal Entity Example/test-src/tests/internal/TemporalHelperTests.java b/Temporal Entity Example/test-src/tests/internal/TemporalHelperTests.java
deleted file mode 100644
index c6ce20e..0000000
--- a/Temporal Entity Example/test-src/tests/internal/TemporalHelperTests.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests.internal;
-
-import static example.PersonModelExample.T1;
-import static temporal.Effectivity.*;
-import static example.PersonModelExample.T3;
-import static example.PersonModelExample.T4;
-import static example.PersonModelExample.T5;
-import static example.PersonModelExample.T6;
-import static example.PersonModelExample.T7;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import junit.framework.Assert;
-
-import model.PersonHobby;
-
-import org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork;
-import org.eclipse.persistence.sessions.DatabaseSession;
-import org.eclipse.persistence.sessions.server.ClientSession;
-import org.eclipse.persistence.sessions.server.Server;
-import org.junit.Test;
-
-import temporal.TemporalEntityManager;
-import temporal.TemporalHelper;
-import tests.BaseTestCase;
-
-/**
- * Verify the helper methods on {@link TemporalHelper}
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class TemporalHelperTests extends BaseTestCase {
-
- private void verifySetStartTime(TemporalEntityManager em, Long value) {
- assertTrue(em.hasEffectiveTime());
- assertNotNull(em.getEffectiveTime());
- assertEquals(value, em.getEffectiveTime());
-
- RepeatableWriteUnitOfWork uow = em.unwrap(RepeatableWriteUnitOfWork.class);
- assertNotNull(uow);
-
- ClientSession clientSession = (ClientSession) uow.getParent();
-
- DatabaseSession session = em.unwrap(DatabaseSession.class);
- assertNotSame(clientSession, session);
-
- Server serverSession = em.unwrap(Server.class);
- assertNotSame(clientSession, serverSession);
- assertSame(session, serverSession);
- }
-
- @Test
- public void verifySetStartTime() {
- TemporalEntityManager em = getEntityManager();
-
- assertFalse(em.hasEffectiveTime());
- assertNull(em.getEffectiveTime());
-
- em.setEffectiveTime(T1);
-
- verifySetStartTime(em, T1);
- }
-
- @Test
- public void verifyClearStartTime() {
- TemporalEntityManager em = getEntityManager();
- assertFalse(em.hasEffectiveTime());
- assertNull(em.getEffectiveTime());
-
- em.setEffectiveTime(T3);
-
- verifySetStartTime(em, T3);
-
- em.clearEffectiveTime();
-
- assertFalse(em.hasEffectiveTime());
- assertNull(em.getEffectiveTime());
- }
-
- @Test
- public void verifyConcurrentSetStartTime() {
- TemporalEntityManager em1 = getEntityManager();
- TemporalEntityManager em2 = TemporalEntityManager.getInstance(getEMF().createEntityManager());
-
- assertNotSame(em1, em2);
-
- em1.setEffectiveTime(T4);
-
- em2.setEffectiveTime(T5);
-
- verifySetStartTime(em2, T5);
- verifySetStartTime(em1, T4);
- }
-
- @Test
- public void verifyConcurrentClearStartTime() {
- TemporalEntityManager em1 = getEntityManager();
- TemporalEntityManager em2 = TemporalEntityManager.getInstance(getEMF().createEntityManager());
-
- assertNotSame(em1, em2);
-
- em1.setEffectiveTime(T6);
- em2.setEffectiveTime(T7);
-
- verifySetStartTime(em2, T7);
- verifySetStartTime(em1, T6);
-
- em1.clearEffectiveTime();
- verifySetStartTime(em2, T7);
- assertFalse(em1.hasEffectiveTime());
- assertNull(em1.getEffectiveTime());
-
- em2.clearEffectiveTime();
- assertFalse(em2.hasEffectiveTime());
- assertNull(em2.getEffectiveTime());
- }
-
- @Test
- public void verifyCurrentCreateTemporal() {
- TemporalEntityManager em = getEntityManager();
- em.getTransaction().begin();
-
- PersonHobby ph = em.newTemporal(PersonHobby.class);
-
- Assert.assertNotNull(ph);
- Assert.assertNotNull(ph.getEffectivity());
- Assert.assertEquals(BOT, ph.getEffectivity().getStart());
- Assert.assertEquals(EOT, ph.getEffectivity().getEnd());
- }
-
- @Test
- public void verifyFutureCreateTemporal() {
- TemporalEntityManager em = getEntityManager();
- em.setEffectiveTime(T3, true);
- em.getTransaction().begin();
-
- PersonHobby ph = em.newTemporal(PersonHobby.class);
-
- Assert.assertNotNull(ph);
- Assert.assertNotNull(ph.getEffectivity());
- Assert.assertEquals(T3, ph.getEffectivity().getStart());
- Assert.assertEquals(EOT, ph.getEffectivity().getEnd());
- }
-}
diff --git a/Temporal Entity Example/test-src/tests/internal/VerifyConfigTests.java b/Temporal Entity Example/test-src/tests/internal/VerifyConfigTests.java
deleted file mode 100644
index a4a8809..0000000
--- a/Temporal Entity Example/test-src/tests/internal/VerifyConfigTests.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests.internal;
-
-import junit.framework.Assert;
-import model.Address;
-import model.Hobby;
-import model.Person;
-import model.PersonHobby;
-import model.Phone;
-import model.entities.AddressEntity;
-import model.entities.PersonEntity;
-import model.entities.PhoneEntity;
-
-import org.eclipse.persistence.config.CacheIsolationType;
-import org.eclipse.persistence.descriptors.ClassDescriptor;
-import org.eclipse.persistence.internal.helper.DatabaseField;
-import org.eclipse.persistence.internal.weaving.PersistenceWeaved;
-import org.eclipse.persistence.internal.weaving.PersistenceWeavedChangeTracking;
-import org.eclipse.persistence.internal.weaving.PersistenceWeavedFetchGroups;
-import org.eclipse.persistence.internal.weaving.PersistenceWeavedLazy;
-import org.eclipse.persistence.jpa.JpaHelper;
-import org.eclipse.persistence.mappings.OneToManyMapping;
-import org.eclipse.persistence.mappings.OneToOneMapping;
-import org.eclipse.persistence.sessions.Session;
-import org.eclipse.persistence.sessions.server.Server;
-import org.junit.Test;
-
-import temporal.Effectivity;
-import temporal.TemporalEdition;
-import temporal.TemporalEntity;
-import temporal.TemporalHelper;
-import temporal.persistence.DescriptorHelper;
-import tests.BaseTestCase;
-
-/**
- * Tests that verify the descriptors are setup as expected and that the
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class VerifyConfigTests extends BaseTestCase {
-
- @Test
- public void verifyDescriptorsExist() {
- Server session = JpaHelper.getServerSession(getEMF());
-
- Assert.assertNotNull(session);
- Assert.assertTrue(session.isConnected());
- Assert.assertEquals(21, session.getDescriptors().size());
-
- Assert.assertNotNull(session.getClassDescriptorForAlias("Person"));
- Assert.assertNotNull(session.getClassDescriptor(PersonEntity.class));
- Assert.assertNotNull(session.getClassDescriptorForAlias("Address"));
- Assert.assertNotNull(session.getClassDescriptor(AddressEntity.class));
- Assert.assertNotNull(session.getClassDescriptorForAlias("Phone"));
- Assert.assertNotNull(session.getClassDescriptor(PhoneEntity.class));
- Assert.assertNotNull(session.getClassDescriptor(Effectivity.class));
-
- Assert.assertNotNull(session.getClassDescriptorForAlias("Hobby"));
- Assert.assertNotNull(session.getClassDescriptorForAlias("PersonHobby"));
- Assert.assertNotNull(session.getClassDescriptorForAlias("EditionSet"));
- Assert.assertNotNull(session.getClassDescriptorForAlias("EditionSetEntry"));
-
- Assert.assertNotNull(session.getClassDescriptorForAlias("PersonEdition"));
- Assert.assertNotNull(session.getClassDescriptorForAlias("AddressEdition"));
- Assert.assertNotNull(session.getClassDescriptorForAlias("PhoneEdition"));
-
- Assert.assertNotNull(session.getClassDescriptorForAlias("PersonEditionView"));
- Assert.assertNotNull(session.getClassDescriptorForAlias("AddressEditionView"));
- Assert.assertNotNull(session.getClassDescriptorForAlias("PhoneEditionView"));
- }
-
- @Test
- public void verifyInterface() {
- Server session = JpaHelper.getServerSession(getEMF());
-
- Assert.assertSame(Person.class, session.getClassDescriptor(PersonEntity.class).getProperty(TemporalHelper.INTERFACE));
- Assert.assertSame(Person.class, session.getClassDescriptor(Person.class).getProperty(TemporalHelper.INTERFACE));
- Assert.assertSame(Address.class, session.getClassDescriptor(AddressEntity.class).getProperty(TemporalHelper.INTERFACE));
- Assert.assertSame(Address.class, session.getClassDescriptor(Address.class).getProperty(TemporalHelper.INTERFACE));
- Assert.assertSame(Phone.class, session.getClassDescriptor(PhoneEntity.class).getProperty(TemporalHelper.INTERFACE));
- Assert.assertSame(Phone.class, session.getClassDescriptor(Phone.class).getProperty(TemporalHelper.INTERFACE));
- }
-
- @Test
- public void verifyWeavingPerson() {
- Assert.assertTrue(PersistenceWeaved.class.isAssignableFrom(PersonEntity.class));
- Assert.assertTrue(PersistenceWeavedLazy.class.isAssignableFrom(PersonEntity.class));
- Assert.assertTrue(PersistenceWeavedChangeTracking.class.isAssignableFrom(PersonEntity.class));
- Assert.assertTrue(PersistenceWeavedFetchGroups.class.isAssignableFrom(PersonEntity.class));
- Assert.assertFalse(TemporalEdition.class.isAssignableFrom(PersonEntity.class));
- }
-
- @Test
- public void verifyWeavingAddress() {
- Assert.assertTrue(PersistenceWeaved.class.isAssignableFrom(AddressEntity.class));
- Assert.assertTrue(PersistenceWeavedLazy.class.isAssignableFrom(AddressEntity.class));
- Assert.assertTrue(PersistenceWeavedChangeTracking.class.isAssignableFrom(AddressEntity.class));
- Assert.assertTrue(PersistenceWeavedFetchGroups.class.isAssignableFrom(AddressEntity.class));
- Assert.assertFalse(TemporalEdition.class.isAssignableFrom(AddressEntity.class));
- }
-
- @Test
- public void verifyWeavingPhone() {
- Assert.assertTrue(PersistenceWeaved.class.isAssignableFrom(PhoneEntity.class));
- Assert.assertTrue(PersistenceWeavedLazy.class.isAssignableFrom(PhoneEntity.class));
- Assert.assertTrue(PersistenceWeavedChangeTracking.class.isAssignableFrom(PhoneEntity.class));
- Assert.assertTrue(PersistenceWeavedFetchGroups.class.isAssignableFrom(PhoneEntity.class));
- Assert.assertFalse(TemporalEdition.class.isAssignableFrom(PhoneEntity.class));
- }
-
- @Test
- public void verifyAttributeChangeTracking() {
- Server session = JpaHelper.getServerSession(getEMF());
-
- assertAttributeChangeTracking(session, "Person");
- assertAttributeChangeTracking(session, "Address");
- assertAttributeChangeTracking(session, "Phone");
- }
-
- @Test
- public void verifyEntityDescriptors() {
- Server session = JpaHelper.getServerSession(getEMF());
-
- for (String alias : new String[] { "Person", "Address", "Phone" }) {
- ClassDescriptor descriptor = session.getClassDescriptorForAlias(alias);
-
- Assert.assertNotNull(descriptor);
- Assert.assertNotNull(descriptor.getQueryManager().getAdditionalJoinExpression());
- Assert.assertFalse(descriptor.shouldBeReadOnly());
- Assert.assertFalse(descriptor.isIsolated());
- Assert.assertTrue(descriptor.getObjectChangePolicy().isAttributeChangeTrackingPolicy());
-
- Assert.assertEquals(1, descriptor.getPrimaryKeyFieldNames().size());
- Assert.assertEquals("OID", descriptor.getPrimaryKeyFields().get(0).getName());
-
- Assert.assertEquals(CacheIsolationType.PROTECTED, descriptor.getCacheIsolation());
- }
- }
-
- /**
- * Verify the {@link PersonHobby} and {@link Hobby} mappings are correct.
- * These mappings are temporal but they are not {@link TemporalEntity}
- */
- @Test
- public void verifyPersonHobbyMappings() {
- Server session = JpaHelper.getServerSession(getEMF());
- ClassDescriptor phDesc = session.getDescriptorForAlias("PersonHobby");
- Assert.assertNotNull(phDesc);
-
- OneToOneMapping personMapping = (OneToOneMapping) phDesc.getMappingForAttributeName("person");
- Assert.assertNotNull(personMapping);
- Assert.assertSame(PersonEntity.class, personMapping.getReferenceClass());
-
- Assert.assertEquals(1, personMapping.getForeignKeyFields().size());
- DatabaseField fkField = personMapping.getForeignKeyFields().firstElement();
- Assert.assertEquals("PERSON_ID", fkField.getName());
-
- DatabaseField targetField = personMapping.getSourceToTargetKeyFields().get(fkField);
- Assert.assertEquals("CID", targetField.getName());
- }
-
- @Test
- public void verifyEditionDescriptors() {
- Server session = JpaHelper.getServerSession(getEMF());
-
- for (String alias : new String[] { "Person", "Address", "Phone" }) {
- ClassDescriptor descriptor = session.getClassDescriptorForAlias(alias + DescriptorHelper.EDITION);
-
- Assert.assertNotNull(descriptor);
- Assert.assertNotNull(descriptor.getQueryManager().getAdditionalJoinExpression());
- Assert.assertFalse(descriptor.shouldBeReadOnly());
- Assert.assertTrue(descriptor.isIsolated());
- Assert.assertTrue(descriptor.getObjectChangePolicy().isAttributeChangeTrackingPolicy());
-
- Assert.assertEquals(1, descriptor.getPrimaryKeyFieldNames().size());
- Assert.assertEquals("OID", descriptor.getPrimaryKeyFields().get(0).getName());
-
- Assert.assertEquals(CacheIsolationType.ISOLATED, descriptor.getCacheIsolation());
- }
- }
-
- @Test
- public void verifyEditionViewDescriptors() {
- Server session = JpaHelper.getServerSession(getEMF());
-
- for (String alias : new String[] { "Person", "Address", "Phone" }) {
- ClassDescriptor descriptor = session.getClassDescriptorForAlias(alias + DescriptorHelper.EDITION_VIEW);
-
- Assert.assertNotNull(descriptor);
- Assert.assertNull(descriptor.getQueryManager().getAdditionalJoinExpression());
- Assert.assertTrue(descriptor.getObjectChangePolicy().isAttributeChangeTrackingPolicy());
- Assert.assertTrue(descriptor.isIsolated());
- Assert.assertEquals(1, descriptor.getPrimaryKeyFieldNames().size());
- Assert.assertEquals("OID", descriptor.getPrimaryKeyFields().get(0).getName());
-
- Assert.assertEquals(CacheIsolationType.ISOLATED, descriptor.getCacheIsolation());
- }
- }
-
- private void assertAttributeChangeTracking(Session session, String alias) {
- ClassDescriptor descriptor = session.getClassDescriptorForAlias(alias);
- Assert.assertNotNull(descriptor);
- Assert.assertTrue(descriptor.getObjectChangePolicy().isAttributeChangeTrackingPolicy());
-
- if (TemporalEntity.class.isAssignableFrom(descriptor.getJavaClass()) && !descriptor.getAlias().endsWith(DescriptorHelper.EDITION)) {
- assertAttributeChangeTracking(session, alias + DescriptorHelper.EDITION);
- }
- }
-
- @Test
- public void verifyPersonPhonesDescriptor() {
- Server session = JpaHelper.getServerSession(getEMF());
- ClassDescriptor descriptor = session.getClassDescriptorForAlias("Person");
-
- Assert.assertNotNull(descriptor);
- Assert.assertEquals(PersonEntity.class, descriptor.getJavaClass());
-
- OneToManyMapping phonesMapping = (OneToManyMapping) descriptor.getMappingForAttributeName("phones");
- Assert.assertNotNull(phonesMapping);
-
- Assert.assertEquals("Phone", phonesMapping.getReferenceDescriptor().getAlias());
- Assert.assertTrue(phonesMapping.isCacheable());
-
- // TODO: Verify FK fields
- }
-
-}
diff --git a/Temporal Entity Example/test-src/tests/internal/VerifySchemaManager.java b/Temporal Entity Example/test-src/tests/internal/VerifySchemaManager.java
deleted file mode 100644
index bf211c2..0000000
--- a/Temporal Entity Example/test-src/tests/internal/VerifySchemaManager.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests.internal;
-
-import junit.framework.Assert;
-
-import org.eclipse.persistence.tools.schemaframework.ForeignKeyConstraint;
-import org.eclipse.persistence.tools.schemaframework.SchemaManager;
-import org.eclipse.persistence.tools.schemaframework.TableDefinition;
-import org.junit.Test;
-
-import temporal.persistence.TemporalSchemaManager;
-import tests.BaseTestCase;
-
-/**
- * Verify the schema manager's table definitions
- */
-public class VerifySchemaManager extends BaseTestCase {
-
- private SchemaManager getSchemaManager() {
- return (SchemaManager) getEMF().getProperties().get(SchemaManager.class.getName());
- }
-
- private TemporalSchemaManager getTemporalSchemaManager() {
- return (TemporalSchemaManager) getSchemaManager();
- }
-
- @Test
- public void verifySchemaManager() {
- SchemaManager sm = getSchemaManager();
- Assert.assertNotNull(sm);
- Assert.assertTrue(sm instanceof TemporalSchemaManager);
- Assert.assertSame(sm, getTemporalSchemaManager());
- Assert.assertNotNull(getTemporalSchemaManager().getTableCreator());
- }
-
- @Test
- public void verifyPhoneTable() {
- TableDefinition td = getTemporalSchemaManager().getTableDefinition("TPHONE");
- Assert.assertNotNull(td);
-
- ForeignKeyConstraint fkc = td.getForeignKeyMap().get("FK_TPHONE_PERSON_ID");
- Assert.assertNotNull(fkc);
- Assert.assertEquals("OID", fkc.getTargetFields().get(0));
- }
-
- @Test
- public void verifyPersonHobbyTable() {
- TableDefinition td = getTemporalSchemaManager().getTableDefinition("TPERSON_HOBBY");
- Assert.assertNotNull(td);
-
- ForeignKeyConstraint fkc = td.getForeignKeyMap().get("FK_TPERSON_HOBBY_PERSON_ID");
- Assert.assertNotNull(fkc);
- Assert.assertEquals("OID", fkc.getTargetFields().get(0));
- }
-
- @Test
- public void verifyPersonTable() {
- TableDefinition td = getTemporalSchemaManager().getTableDefinition("TPERSON");
- Assert.assertNotNull(td);
-
- ForeignKeyConstraint fkc = td.getForeignKeyMap().get("FK_TPERSON_ADDR_ID");
- Assert.assertNotNull(fkc);
- Assert.assertEquals("OID", fkc.getTargetFields().get(0));
- }
-}
diff --git a/Temporal Entity Example/test-src/tests/internal/WrapperPolicyTests.java b/Temporal Entity Example/test-src/tests/internal/WrapperPolicyTests.java
deleted file mode 100644
index d89200f..0000000
--- a/Temporal Entity Example/test-src/tests/internal/WrapperPolicyTests.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011-2012 Oracle. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 and Eclipse Distribution License v. 1.0 which accompanies
- * this distribution. The Eclipse Public License is available at
- * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
- * License is available at http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors: dclarke - Bug 361016: Future Versions Examples
- ******************************************************************************/
-package tests.internal;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
-
-import junit.framework.Assert;
-
-import org.eclipse.persistence.descriptors.ClassDescriptor;
-import org.eclipse.persistence.internal.sessions.AbstractSession;
-import org.eclipse.persistence.jpa.JpaHelper;
-import org.eclipse.persistence.sessions.server.Server;
-import org.junit.Test;
-
-import temporal.TemporalHelper;
-import temporal.persistence.DescriptorHelper;
-import temporal.persistence.EditionWrapperPolicy;
-import tests.BaseTestCase;
-
-/**
- * Verify the helper methods on {@link TemporalHelper}
- *
- * @author dclarke
- * @since EclipseLink 2.3.1
- */
-public class WrapperPolicyTests extends BaseTestCase {
-
- @Test
- public void verifyConfig() {
- Server session = JpaHelper.getServerSession(getEMF());
-
- Assert.assertNotNull(session);
-
- for (String alias : new String[] { "Person", "Address", "Phone" }) {
- ClassDescriptor cd = session.getClassDescriptorForAlias(alias);
- Assert.assertNotNull(cd);
- Assert.assertTrue(cd.hasWrapperPolicy());
- Assert.assertTrue(cd.getWrapperPolicy() instanceof EditionWrapperPolicy);
-
- cd = session.getClassDescriptorForAlias(alias + DescriptorHelper.EDITION);
- Assert.assertNotNull(cd);
- Assert.assertTrue(cd.hasWrapperPolicy());
- Assert.assertTrue(cd.getWrapperPolicy() instanceof EditionWrapperPolicy);
- }
- }
-
- @Test
- public void createEntityAndDescriptorLookupUsingProxy() {
- Server session = JpaHelper.getServerSession(getEMF());
- Assert.assertNotNull(session);
-
- for (String alias : new String[] { "Person", "Address", "Phone" }) {
- ClassDescriptor cd = session.getClassDescriptorForAlias(alias);
- Assert.assertNotNull(cd);
-
- Object entity = cd.getInstantiationPolicy().buildNewInstance();
- Assert.assertNotNull(entity);
- Assert.assertFalse(cd.getWrapperPolicy().isWrapped(entity));
-
- Object wrappedEnObject = cd.getWrapperPolicy().wrapObject(entity, (AbstractSession) session);
-
- Assert.assertNotNull(wrappedEnObject);
- Assert.assertTrue(cd.getWrapperPolicy().isWrapped(wrappedEnObject));
- Assert.assertTrue(Proxy.isProxyClass(wrappedEnObject.getClass()));
- InvocationHandler handler = Proxy.getInvocationHandler(wrappedEnObject);
- Assert.assertTrue(handler instanceof EditionWrapperPolicy.Handler<?>);
-
- ClassDescriptor lookupCD = session.getClassDescriptor(wrappedEnObject);
- Assert.assertNotNull(lookupCD);
- Assert.assertSame(cd, lookupCD);
- }
- }
-
- @Test
- public void createEditionAndDescriptorLookupUsingProxy() {
- Server session = JpaHelper.getServerSession(getEMF());
- Assert.assertNotNull(session);
-
- for (String alias : new String[] { "Person", "Address", "Phone" }) {
- ClassDescriptor cd = session.getClassDescriptorForAlias(alias+ DescriptorHelper.EDITION);
- Assert.assertNotNull(cd);
-
- Object entity = cd.getInstantiationPolicy().buildNewInstance();
- Assert.assertNotNull(entity);
- Assert.assertFalse(cd.getWrapperPolicy().isWrapped(entity));
-
- Object wrappedEnObject = cd.getWrapperPolicy().wrapObject(entity, (AbstractSession) session);
-
- Assert.assertNotNull(wrappedEnObject);
- Assert.assertTrue(Proxy.isProxyClass(wrappedEnObject.getClass()));
- InvocationHandler handler = Proxy.getInvocationHandler(wrappedEnObject);
- Assert.assertTrue(handler instanceof EditionWrapperPolicy.Handler<?>);
-
- ClassDescriptor lookupCD = session.getClassDescriptor(wrappedEnObject);
- Assert.assertNotNull(lookupCD);
- Assert.assertSame(cd, lookupCD);
- }
- }
-}
diff --git a/Temporal Entity Example/test-src/tests/internal/asm/ASMifyPersonEdition.java b/Temporal Entity Example/test-src/tests/internal/asm/ASMifyPersonEdition.java
deleted file mode 100644
index 7f2b90b..0000000
--- a/Temporal Entity Example/test-src/tests/internal/asm/ASMifyPersonEdition.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package tests.internal.asm;
-
-import org.eclipse.persistence.internal.libraries.asm.util.ASMifierClassVisitor;
-
-public class ASMifyPersonEdition {
-
- /**
- * @param args
- * @throws Exception
- */
- public static void main(String[] args) throws Exception {
- ASMifierClassVisitor.main(new String[] { PersonEdition.class.getName()});
- }
-
-}
diff --git a/Temporal Entity Example/test-src/tests/internal/asm/PersonEdition.java b/Temporal Entity Example/test-src/tests/internal/asm/PersonEdition.java
deleted file mode 100644
index 5d2fff0..0000000
--- a/Temporal Entity Example/test-src/tests/internal/asm/PersonEdition.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package tests.internal.asm;
-
-import model.Person;
-
-public interface PersonEdition extends Person {
-
-}
diff --git a/Temporal Tests.zip b/Temporal Tests.zip
new file mode 100644
index 0000000..0d18520
--- /dev/null
+++ b/Temporal Tests.zip
Binary files differ
diff --git a/eclipselink2_3_1_v20111018-r10243-shared-lib.zip b/eclipselink2_3_1_v20111018-r10243-shared-lib.zip
new file mode 100644
index 0000000..84504bd
--- /dev/null
+++ b/eclipselink2_3_1_v20111018-r10243-shared-lib.zip
Binary files differ
diff --git a/weblogic.application.xml b/weblogic.application.xml
new file mode 100644
index 0000000..153405b
--- /dev/null
+++ b/weblogic.application.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wls:weblogic-application xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-application" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.2/weblogic-application.xsd">
+ <wls:application-param>
+ <wls:param-name>webapp.encoding.default</wls:param-name>
+ <wls:param-value>UTF-8</wls:param-value>
+ </wls:application-param>
+ <wls:library-ref>
+ <wls:library-name>eclipselink</wls:library-name>
+ <wls:specification-version>2.0</wls:specification-version>
+ <wls:implementation-version>2.3.2</wls:implementation-version>
+ <wls:exact-match>true</wls:exact-match>
+ </wls:library-ref>
+</wls:weblogic-application>
\ No newline at end of file