Started to write Mapping tests
diff --git a/antbuild.xml b/antbuild.xml
index 72a86fb..00020cc 100644
--- a/antbuild.xml
+++ b/antbuild.xml
@@ -57,7 +57,7 @@
<target name="clean" depends="init, clean-tools, clean-tools-test" description="Cleans all build generated files."/>
<target name="build-distribution" depends="clean, build, build-javadocs, package-installer-zip" description="Builds all jars, generates javadoc, and builds installer."/>
<target name="test-srg" depends="init, test-tools-srg" description="Run the SRG test suites"/>
- <target name="test-lrg" depends="init, test-tools" description="Run the LRG test suites"/>
+ <target name="test-lrg" depends="init, test-tools-lrg" description="Run the LRG test suites"/>
<!-- ================================================================================= -->
<!-- =========================== Init Targets ====================================== -->
@@ -320,15 +320,32 @@
<!-- ================================================================================= -->
<!-- =========================== Test Targets ====================================== -->
- <!-- Run core LRG. -->
- <target name="test-tools" description="run the LRG tests">
- <echo message="test-tools (LRG run)"/>
- <ant antfile="test.xml" dir="${tools.root}/org.eclipse.persistence.tools.utility.tests" target="run"/>
+
+ <!-- Run All LRG tests -->
+ <target name="test-tools-lrg" description="run all the LRG tests"
+ depends="test-utility-lrg, test-mapping-lrg" />
+
+ <!-- Run Utility LRG tests -->
+ <target name="test-utility-lrg" description="run the Utility tests">
+ <ant antfile="antbuild.xml" dir="${tools.root}/org.eclipse.persistence.tools.utility.tests" target="run"/>
</target>
- <!-- Run core SRG. -->
- <target name="test-tools-srg" description="run the SRG tests">
- <echo message="test-tools-srg (SRG run)"/>
- <ant antfile="test.xml" dir="${tools.root}/org.eclipse.persistence.tools.utility.tests" target="test-srg"/>
+ <!-- Run Mapping LRG tests -->
+ <target name="test-mapping-lrg" description="run the Mapping tests">
+ <ant antfile="antbuild.xml" dir="${tools.root}/org.eclipse.persistence.tools.mapping.tests" target="run"/>
+ </target>
+
+
+ <!-- Run All SRG tests -->
+ <target name="test-tools-srg" description="run all the SRG tests"
+ depends="test-utility-srg, test-mapping-srg" />
+
+ <!-- Run Utility SRG tests -->
+ <target name="test-utility-srg" description="run the Utility tests">
+ <ant antfile="antbuild.xml" dir="${tools.root}/org.eclipse.persistence.tools.utility.tests" target="test-srg"/>
+ </target>
+ <!-- Run Mapping SRG tests -->
+ <target name="test-mapping-srg" description="run the Mapping tests">
+ <ant antfile="antbuild.xml" dir="${tools.root}/org.eclipse.persistence.tools.mapping.tests" target="test-srg"/>
</target>
<!-- ================================================================================= -->
diff --git a/tools/org.eclipse.persistence.tools.mapping.tests/META-INF/MANIFEST.MF b/tools/org.eclipse.persistence.tools.mapping.tests/META-INF/MANIFEST.MF
index bc44163..750bd56 100644
--- a/tools/org.eclipse.persistence.tools.mapping.tests/META-INF/MANIFEST.MF
+++ b/tools/org.eclipse.persistence.tools.mapping.tests/META-INF/MANIFEST.MF
@@ -5,4 +5,6 @@
Bundle-Version: 2.6.0.qualifier
Bundle-Vendor: Eclipse.org - EclipseLink Project
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.eclipse.persistence.tools.mapping
+Require-Bundle: org.eclipse.persistence.tools.mapping;bundle-version="[2.6.0,2.7.0)",
+ org.eclipse.persistence.tools.utility;bundle-version="[2.6.0,2.7.0)",
+ org.junit;bundle-version="[4.8.1,5.0.0)"
diff --git a/tools/org.eclipse.persistence.tools.mapping.tests/MappingTests.launch b/tools/org.eclipse.persistence.tools.mapping.tests/MappingTests.launch
new file mode 100644
index 0000000..78b3428
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping.tests/MappingTests.launch
@@ -0,0 +1,19 @@
+<?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="/org.eclipse.persistence.tools.mapping.tests/src/org/eclipse/persistence/tools/mapping/tests/AllMappingTests.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="org.eclipse.persistence.tools.mapping.tests.AllMappingTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.persistence.tools.mapping.tests"/>
+</launchConfiguration>
diff --git a/tools/org.eclipse.persistence.tools.utility.tests/test.xml b/tools/org.eclipse.persistence.tools.mapping.tests/antbuild.xml
similarity index 93%
copy from tools/org.eclipse.persistence.tools.utility.tests/test.xml
copy to tools/org.eclipse.persistence.tools.mapping.tests/antbuild.xml
index d5a6f56..61b441c 100644
--- a/tools/org.eclipse.persistence.tools.utility.tests/test.xml
+++ b/tools/org.eclipse.persistence.tools.mapping.tests/antbuild.xml
@@ -1,51 +1,51 @@
-<?xml version="1.0"?>
-<!--
- Copyright (c) 2007, 2012 Oracle and/or its affiliates. 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:
- Oracle - initial API and implementation
- -->
-<project name="testsuite" default="run" basedir=".">
- <!-- The property ${eclipse-home} should be passed into this script -->
- <!-- Set a meaningful default value for when it is not. -->
- <echo message="basedir ${basedir}" />
- <echo message="eclipse place ${eclipse-home}" />
- <!-- sets the properties plugin-name -->
- <property name="plugin-name" value="org.eclipse.persistence.tools.utility.tests"/>
-
- <!-- This target holds all initialization code that needs to be done for -->
- <!-- all tests that are to be run. Initialization for individual tests -->
- <!-- should be done within the body of the suite target. -->
- <target name="init">
- <tstamp/>
- <delete>
- <fileset dir="${eclipse-home}" includes="org*.xml"/>
- </delete>
- </target>
-
- <!-- This target defines the tests that need to be run. -->
- <target name="suite">
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname" value="org.eclipse.persistence.tools.utility.tests.internal.CommonUtilityTests" />
- <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/>
- </ant>
- </target>
-
- <!-- This target holds code to cleanup the testing environment after -->
- <!-- after all of the tests have been run. You can use this target to -->
- <!-- delete temporary files that have been created. -->
- <target name="cleanup">
- </target>
-
- <!-- This target runs the test suite. Any actions that need to happen -->
- <!-- after all the tests have been run should go here. -->
- <target name="run" depends="init, suite, cleanup">
- </target>
+<?xml version="1.0"?>
+<!--
+ Copyright (c) 2007, 2013 Oracle and/or its affiliates. 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:
+ Oracle - initial API and implementation
+ -->
+<project name="testsuite" default="run" basedir=".">
+ <!-- The property ${eclipse-home} should be passed into this script -->
+ <!-- Set a meaningful default value for when it is not. -->
+ <echo message="basedir ${basedir}" />
+ <echo message="eclipse place ${eclipse-home}" />
+ <!-- sets the properties plugin-name -->
+ <property name="plugin-name" value="org.eclipse.persistence.tools.mapping.tests"/>
+
+ <!-- This target holds all initialization code that needs to be done for -->
+ <!-- all tests that are to be run. Initialization for individual tests -->
+ <!-- should be done within the body of the suite target. -->
+ <target name="init">
+ <tstamp/>
+ <delete>
+ <fileset dir="${eclipse-home}" includes="org*.xml"/>
+ </delete>
+ </target>
+
+ <!-- This target defines the tests that need to be run. -->
+ <target name="suite">
+ <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname" value="org.eclipse.persistence.tools.mapping.tests.AllMappingTests" />
+ <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/>
+ </ant>
+ </target>
+
+ <!-- This target holds code to cleanup the testing environment after -->
+ <!-- after all of the tests have been run. You can use this target to -->
+ <!-- delete temporary files that have been created. -->
+ <target name="cleanup">
+ </target>
+
+ <!-- This target runs the test suite. Any actions that need to happen -->
+ <!-- after all the tests have been run should go here. -->
+ <target name="run" depends="init, suite, cleanup">
+ </target>
</project>
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping.tests/pom.xml b/tools/org.eclipse.persistence.tools.mapping.tests/pom.xml
new file mode 100644
index 0000000..cf6f25b
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping.tests/pom.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>EclipseLink Tools Mapping Tests</name>
+ <groupId>org.eclipse.persistence</groupId>
+ <artifactId>org.eclipse.persistence.tools.mapping.tests</artifactId>
+ <version>2.6.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+
+ <parent>
+ <artifactId>org.eclipse.persistence.tools.parent</artifactId>
+ <groupId>org.eclipse.persistence</groupId>
+ <version>2.6.0-SNAPSHOT</version>
+ <relativePath>../org.eclipse.persistence.tools.parent/pom.xml</relativePath>
+ </parent>
+
+</project>
diff --git a/tools/org.eclipse.persistence.tools.mapping.tests/src/org/eclipse/persistence/tools/mapping/tests/AbstractExternalFormTests.java b/tools/org.eclipse.persistence.tools.mapping.tests/src/org/eclipse/persistence/tools/mapping/tests/AbstractExternalFormTests.java
new file mode 100644
index 0000000..64bfc24
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping.tests/src/org/eclipse/persistence/tools/mapping/tests/AbstractExternalFormTests.java
@@ -0,0 +1,526 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. 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:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.mapping.tests;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.persistence.tools.mapping.ExternalForm;
+import org.junit.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import static org.junit.Assert.*;
+
+/**
+ * @version 2.6
+ */
+@SuppressWarnings("nls")
+public abstract class AbstractExternalFormTests<T extends ExternalForm> {
+
+ /**
+ * Populates
+ *
+ * @param tester
+ */
+ protected abstract void populate(RootNodeTester<T> tester);
+
+ @Test
+ public final void test() throws Exception {
+ DefaultRootNodeTester tester = new DefaultRootNodeTester();
+ populate(tester);
+ tester.test();
+ }
+
+ /**
+ * An <code>AttributeTester</code> tests setting and retrieving the value associated with
+ * an element's attribute.
+ */
+ public interface AttributeTester<T, VALUE> extends PropertyTester<T, VALUE> {
+
+ }
+
+ /**
+ * An <code>AttributeTesterWrapper</code> tests setting and retrieving the value associated with
+ * an element's attribute.
+ * <p>
+ * <div nowrap>Form: <code><b><nodeName attributeName="value"/></b></div>
+ */
+ private class AttributeTesterWrapper extends NodeTesterWrapper {
+
+ /**
+ * Creates a new <code>AttributeTesterWrapper</code>.
+ *
+ * @param tester This object defines a single node to test an attribute node
+ */
+ AttributeTesterWrapper(AttributeTester<T, ?> tester) {
+ super(tester);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ String displayString() {
+ return "<element " + tester.getNodeName() + "=\"...\">";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ Node getNode(Node parent, String nodeName) {
+
+ if (parent.getNodeType() == Node.ELEMENT_NODE) {
+ Element element = (Element) parent;
+ return element.getAttributes().getNamedItem(nodeName);
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ String getNodeValue(Node node) {
+ return node.getNodeValue();
+ }
+ }
+
+ public interface ChildNodeTester<T, VALUE> extends NodeTester<T, VALUE> {
+ void addChild(T form);
+ boolean hasChild(T form);
+ void removeChild(T form);
+ }
+
+ /**
+ * A <code>ChildNodeTesterWrapper</code> TODO.
+ */
+ private class ChildNodeTesterWrapper extends NodeTesterWrapper {
+
+ /**
+ * Creates a new <code>NullNodeTester</code>.
+ *
+ * @param tester
+ */
+ ChildNodeTesterWrapper(ChildNodeTester<T, ?> tester) {
+ super(tester);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ String displayString() {
+ return "<" + tester.getNodeName() + ">";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ Node getNode(Node parent, String nodeName) {
+ return getChildNode(parent, nodeName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ String getNodeValue(Node node) {
+ return null;
+ }
+ }
+
+ private class DefaultRootNodeTester implements RootNodeTester<T> {
+
+ /**
+ * The list of testers that used to test every single attribute nodes of the one represented
+ * by this tester.
+ */
+ private List<AttributeTesterWrapper> attributes;
+
+ /**
+ *
+ */
+ private NodeBuilder<T> builder;
+
+ /**
+ * The list of testers that used to test every single child nodes of the one represented by
+ * this tester.
+ */
+ private List<NodeTesterWrapper> children;
+
+ /**
+ * Creates a new <code>DefaultRootNodeTester</code>.
+ */
+ private DefaultRootNodeTester() {
+ super();
+ attributes = new ArrayList<AttributeTesterWrapper>();
+ children = new ArrayList<NodeTesterWrapper>();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addAttribute(AttributeTester<T, ?> tester) {
+ attributes.add(new AttributeTesterWrapper(tester));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addNode(ChildNodeTester<T, ?> tester) {
+ children.add(new ChildNodeTesterWrapper(tester));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void addTextNode(TextNodeTester<T, ?> tester) {
+ children.add(new TextNodeTesterWrapper(tester));
+ }
+
+ private Node getRootNode(Document document) {
+ return document.getFirstChild();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setBuilder(NodeBuilder<T> builder) {
+ this.builder = builder;
+ }
+
+ void test() throws Exception {
+
+ // Creates the ExternalForm
+ T form = builder.build();
+ assertNotNull("The external form cannot be null", form);
+
+ // Retrieve the root node
+ Node parent = builder.getRootNode(form);
+ assertNotNull("The parent cannot be null", parent);
+
+ Node expected = getRootNode(parent.getOwnerDocument());
+ assertSame("The root node was not retrieved correctly", expected, parent);
+
+ // Test each attribute
+ for (AttributeTesterWrapper tester : attributes) {
+ tester.test(form, parent);
+ }
+
+ // Test each child node
+ for (NodeTesterWrapper tester : children) {
+ tester.test(form, parent);
+ }
+ }
+ }
+
+ /**
+ * A builder creates the document and element tree
+ */
+ public interface NodeBuilder<T> {
+
+ /**
+ * Creates
+ *
+ * @return
+ * @throws IOException
+ */
+ T build() throws IOException;
+
+ /**
+ * Returns
+ *
+ * @param form
+ * @return
+ */
+ Node getRootNode(T form);
+ }
+
+ public interface NodeTester<T, Value> {
+
+ /**
+ * Retrieves the name of the node for which retrieving and setting its value is tested.
+ *
+ * @return The name of the node to test
+ */
+ String getNodeName();
+ }
+
+ private abstract class NodeTesterWrapper {
+
+ /**
+ * This object defines a single node to test (which is either a child element or an attribute).
+ */
+ final NodeTester<T, Object> tester;
+
+ /**
+ * Creates a new <code>AbstractNodeTester</code>.
+ *
+ * @param tester This object defines a single node to test (which is either a child element
+ * or an attribute)
+ */
+ @SuppressWarnings("unchecked")
+ NodeTesterWrapper(NodeTester<T, ?> tester) {
+ super();
+ this.tester = (NodeTester<T, Object>) tester;
+ }
+
+ abstract String displayString();
+
+ final Node getChildNode(Node parent, String nodeName) {
+
+ parent = parent.getFirstChild();
+
+ while (parent != null) {
+
+ if (nodeName.equals(parent.getNodeName())) {
+ return parent;
+ }
+
+ parent = parent.getNextSibling();
+ }
+
+ return null;
+ }
+
+ abstract Node getNode(Node parent, String nodeName);
+
+ abstract String getNodeValue(Node node);
+
+ void test(T form, Node parent) {
+
+// // Node name
+// String nodeName = tester.getNodeName();
+// assertNotNull("The node name cannot be null", nodeName);
+//
+// // The element should be empty
+// assertEquals(displayString() + " : The element should not have any children", 0, parent.getChildNodes().getLength());
+//
+// // The child node should not exist
+// Node childNode = getNode(parent, nodeName);
+// assertNull(displayString() + " : The node name should be null", childNode);
+//
+// // The node value should not exist
+// Object result = tester.getValue(form);
+// assertNull(displayString() + " : The element's value should be null", result);
+// assertEquals(displayString() + " : The element should not have any children", 0, parent.getChildNodes().getLength());
+//
+// // The child node should still not exist
+// childNode = getNode(parent, nodeName);
+// assertNull(displayString() + " : The node name should be null", childNode);
+// assertEquals(displayString() + " : The element should not have any children", 0, parent.getChildNodes().getLength());
+//
+// // Change the node value (null)
+// tester.setValue(form, null);
+// assertEquals(displayString() + " : The element should not have any children", 0, parent.getChildNodes().getLength());
+//
+// // Make sure nothing changed
+// result = tester.getValue(form);
+// assertNull(displayString() + " : The element's value should be null", result);
+//
+// // Change the value to something
+// Object expectedValue1 = tester.getValue1();
+// assertNotNull(displayString() + " : Value 1 cannot be null", expectedValue1);
+// tester.setValue(form, expectedValue1);
+//
+// // The child node should have been added
+// childNode = getNode(parent, nodeName);
+// assertNotNull(displayString() + " : The node cannot be null", childNode);
+// assertEquals(displayString() + " : The element should have a single child", 1, parent.getChildNodes().getLength());
+//
+// // Get the value
+// result = tester.getValue(form);
+// assertEquals(displayString() + "The element's value was not set correctly", expectedValue1, result);
+//
+// // Get the value directly
+// String stringResult = getNodeValue(childNode);
+// String stringNodeValue = tester.toString(expectedValue1);
+// assertEquals(displayString() + " : The value was not set correctly", stringNodeValue, stringResult);
+//
+// // Change the value to something else
+// Object expectedValue2 = tester.getValue2();
+// assertNotSame(displayString() + " : Value 1 and value 2 cannot be the same", expectedValue1, expectedValue2);
+// tester.setValue(form, expectedValue2);
+//
+// // Get the value
+// result = tester.getValue(form);
+// assertEquals(displayString() + " The element's value was not set correctly", expectedValue2, result);
+//
+// // Get the value directly
+// stringResult = getNodeValue(childNode);
+// stringNodeValue = tester.toString(expectedValue2);
+// assertEquals(displayString() + " : The element's value was not set correctly", stringNodeValue, stringResult);
+//
+// // Change the node value (null)
+// tester.setValue(form, null);
+// assertEquals(displayString() + " : The element should not have any children", 0, parent.getChildNodes().getLength());
+ }
+ }
+
+ private abstract class PropertyNodeTesterWrapper extends NodeTesterWrapper {
+
+ /**
+ * Creates a new <code>PropertyNodeTesterWrapper</code>.
+ *
+ * @param tester This object defines a single node to test a child text node
+ */
+ PropertyNodeTesterWrapper(PropertyTester<T, ?> tester) {
+ super(tester);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ Node getNode(Node parent, String nodeName) {
+
+ parent = parent.getFirstChild();
+
+ while (parent != null) {
+
+ if (nodeName.equals(parent.getNodeName())) {
+ return parent;
+ }
+
+ parent = parent.getNextSibling();
+ }
+
+ return null;
+ }
+ }
+
+ private interface PropertyTester<T, VALUE> extends NodeTester<T, VALUE> {
+
+ /**
+ * Retrieves the value of the node.
+ *
+ * @param form The external form that will retrieve the value
+ * @return The value, which can be <code>null</code>
+ */
+ VALUE getValue(T form);
+
+ /**
+ * Retrieves a non-<code>null</code> value that will be used for testing that is different
+ * than the one returned by {@link #getValue2()}.
+ *
+ * @return A non-<code>null</code> value used for testing
+ */
+ VALUE getValue1();
+
+ /**
+ * Retrieves a non-<code>null</code> value that will be used for testing that is different
+ * than the one returned by {@link #getValue1()}.
+ *
+ * @return A non-<code>null</code> value used for testing
+ */
+ VALUE getValue2();
+
+ /**
+ * Sets the value of the node.
+ *
+ * @param form The external form that will set the value
+ * @return The value, which can be <code>null</code>
+ */
+ void setValue(T form, VALUE value);
+
+ /**
+ * Converts the value to its string representation.
+ *
+ * @param value A non-<code>null</code> value to convert into a string
+ * @return The given value represented as a string
+ */
+ String toString(VALUE value);
+ }
+
+ /**
+ *
+ */
+ public interface RootNodeTester<T extends ExternalForm> {
+
+ /**
+ * Adds
+ *
+ * @param tester
+ */
+ void addAttribute(AttributeTester<T, ?> tester);
+
+ /**
+ * Adds
+ *
+ * @param tester
+ */
+ void addNode(ChildNodeTester<T, ?> tester);
+
+ /**
+ * Adds
+ *
+ * @param tester
+ */
+ void addTextNode(TextNodeTester<T, ?> tester);
+
+ /**
+ * Sets
+ *
+ * @param builder
+ */
+ void setBuilder(NodeBuilder<T> builder);
+ }
+
+ /**
+ * A <code>TextNodeTester</code> tests setting and retrieving the value associated with a text node.
+ */
+ public interface TextNodeTester<T, VALUE> extends PropertyTester<T, VALUE> {
+ }
+
+ /**
+ * <p>A <code>TextNodeTesterWrapper</code> tests setting and retrieving the value associated with
+ * a text node.</p>
+ * <div nowrap>Form: <code><b><node_name>text</node_name></b></code>.</div>
+ */
+ private class TextNodeTesterWrapper extends PropertyNodeTesterWrapper {
+
+ /**
+ * Creates a new <code>TextNodeTesterWrapper</code>.
+ *
+ * @param tester This object defines a single node to test a child text node
+ */
+ TextNodeTesterWrapper(TextNodeTester<T, ?> tester) {
+ super(tester);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ String displayString() {
+ return "<element \"" + tester.getNodeName() + "\">";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ String getNodeValue(Node node) {
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping.tests/src/org/eclipse/persistence/tools/mapping/tests/AllMappingTests.java b/tools/org.eclipse.persistence.tools.mapping.tests/src/org/eclipse/persistence/tools/mapping/tests/AllMappingTests.java
new file mode 100644
index 0000000..072cb86
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping.tests/src/org/eclipse/persistence/tools/mapping/tests/AllMappingTests.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. 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:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.mapping.tests;
+
+import org.eclipse.persistence.tools.mapping.tests.dom.orm.AllORMTests;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * The root test suite for the EclipseLink Tools - Mappings API.
+ *
+ * @version 2.6
+ */
+@SuiteClasses({
+ AllORMTests.class
+})
+@RunWith(Suite.class)
+public final class AllMappingTests {
+
+ private AllMappingTests() {
+ super();
+ }
+}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping.tests/src/org/eclipse/persistence/tools/mapping/tests/dom/orm/AllORMTests.java b/tools/org.eclipse.persistence.tools.mapping.tests/src/org/eclipse/persistence/tools/mapping/tests/dom/orm/AllORMTests.java
new file mode 100644
index 0000000..154410a
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping.tests/src/org/eclipse/persistence/tools/mapping/tests/dom/orm/AllORMTests.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. 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:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.mapping.tests.dom.orm;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * The test suite for the unit-tests defined in the same package.
+ *
+ * @version 2.6
+ */
+@SuiteClasses({
+ ORMConfigurationTests.class
+})
+@RunWith(Suite.class)
+public final class AllORMTests {
+
+ private AllORMTests() {
+ super();
+ }
+}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping.tests/src/org/eclipse/persistence/tools/mapping/tests/dom/orm/ORMConfigurationTests.java b/tools/org.eclipse.persistence.tools.mapping.tests/src/org/eclipse/persistence/tools/mapping/tests/dom/orm/ORMConfigurationTests.java
new file mode 100644
index 0000000..15a5d2c
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.mapping.tests/src/org/eclipse/persistence/tools/mapping/tests/dom/orm/ORMConfigurationTests.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. 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:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.mapping.tests.dom.orm;
+
+import java.io.IOException;
+import java.util.Vector;
+import javax.xml.XMLConstants;
+import org.eclipse.persistence.tools.mapping.orm.ExternalORMConfiguration;
+import org.eclipse.persistence.tools.mapping.orm.ExternalPersistenceUnit;
+import org.eclipse.persistence.tools.mapping.orm.ORMDocumentType;
+import org.eclipse.persistence.tools.mapping.orm.dom.ORMConfiguration;
+import org.eclipse.persistence.tools.mapping.orm.dom.ORMRepository;
+import org.eclipse.persistence.tools.mapping.tests.AbstractExternalFormTests;
+import org.w3c.dom.Node;
+
+/**
+ * @version 2.6
+ */
+@SuppressWarnings("nls")
+public final class ORMConfigurationTests extends AbstractExternalFormTests<ExternalORMConfiguration> {
+
+ private TextNodeTester<ExternalORMConfiguration, String> buildCatalogTester() {
+ return new TextNodeTester<ExternalORMConfiguration, String>() {
+ @Override
+ public String getNodeName() {
+ return ExternalORMConfiguration.CATALOG;
+ }
+ @Override
+ public String getValue(ExternalORMConfiguration form) {
+ return form.getCatalogName();
+ }
+ @Override
+ public String getValue1() {
+ return "cat";
+ }
+ @Override
+ public String getValue2() {
+ return "EL";
+ }
+ @Override
+ public void setValue(ExternalORMConfiguration form, String value) {
+ form.setCatalogName(value);
+ }
+ @Override
+ public String toString(String value) {
+ return value;
+ }
+ };
+ }
+
+ private TextNodeTester<ExternalORMConfiguration, String> buildDescriptionTester() {
+ return new TextNodeTester<ExternalORMConfiguration, String>() {
+ @Override
+ public String getNodeName() {
+ return ExternalORMConfiguration.DESCRIPTION;
+ }
+ @Override
+ public String getValue(ExternalORMConfiguration form) {
+ return form.getDescription();
+ }
+ @Override
+ public String getValue1() {
+ return "testing ORM configuration";
+ }
+ @Override
+ public String getValue2() {
+ return "something";
+ }
+ @Override
+ public void setValue(ExternalORMConfiguration form, String value) {
+ form.setDescription(value);
+ }
+ @Override
+ public String toString(String value) {
+ return value;
+ }
+ };
+ }
+
+ private NodeBuilder<ExternalORMConfiguration> buildORMConfigurationBuilder() {
+ return new NodeBuilder<ExternalORMConfiguration>() {
+ @Override
+ public ExternalORMConfiguration build() throws IOException {
+ ORMRepository repository = new ORMRepository();
+ return repository.buildORMConfiguration(null, ORMDocumentType.ECLIPELINK_2_6);
+ }
+ @Override
+ public Node getRootNode(ExternalORMConfiguration form) {
+ return ((ORMConfiguration) form).getElement();
+ }
+ };
+ }
+
+ private TextNodeTester<ExternalORMConfiguration, String> buildPackageTester() {
+ return new TextNodeTester<ExternalORMConfiguration, String>() {
+ @Override
+ public String getNodeName() {
+ return ExternalORMConfiguration.PACKAGE;
+ }
+ @Override
+ public String getValue(ExternalORMConfiguration form) {
+ return form.getPackageName();
+ }
+ @Override
+ public String getValue1() {
+ return Vector.class.getPackage().getName();
+ }
+ @Override
+ public String getValue2() {
+ return XMLConstants.class.getPackage().getName();
+ }
+ @Override
+ public void setValue(ExternalORMConfiguration form, String value) {
+ form.setPackageName(value);
+ }
+ @Override
+ public String toString(String value) {
+ return value;
+ }
+ };
+ }
+
+ private ChildNodeTester<ExternalORMConfiguration, Object> buildPersistenceUnitMetadataTester() {
+ return new ChildNodeTester<ExternalORMConfiguration, Object>() {
+ @Override
+ public void addChild(ExternalORMConfiguration form) {
+ form.addPersistenceUnitMetaData();
+ }
+ @Override
+ public String getNodeName() {
+ return ExternalPersistenceUnit.PERSISTENCE_UNIT_METADATA;
+ }
+ @Override
+ public boolean hasChild(ExternalORMConfiguration form) {
+ return form.hasPersistenceUnitMetaData();
+ }
+ @Override
+ public void removeChild(ExternalORMConfiguration form) {
+ form.removePersistenceUnitMetaData();
+ }
+ };
+ }
+
+ private TextNodeTester<ExternalORMConfiguration, String> buildSchemaTester() {
+ return new TextNodeTester<ExternalORMConfiguration, String>() {
+ @Override
+ public String getNodeName() {
+ return ExternalORMConfiguration.SCHEMA;
+ }
+ @Override
+ public String getValue(ExternalORMConfiguration form) {
+ return form.getSchemaName();
+ }
+ @Override
+ public String getValue1() {
+ return "HR";
+ }
+ @Override
+ public String getValue2() {
+ return "eclipselink";
+ }
+ @Override
+ public void setValue(ExternalORMConfiguration form, String value) {
+ form.setSchemaName(value);
+ }
+ @Override
+ public String toString(String value) {
+ return value;
+ }
+ };
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void populate(RootNodeTester<ExternalORMConfiguration> tester) {
+
+ tester.setBuilder(buildORMConfigurationBuilder());
+ tester.addTextNode(buildDescriptionTester());
+ tester.addNode(buildPersistenceUnitMetadataTester());
+ tester.addTextNode(buildPackageTester());
+ tester.addTextNode(buildSchemaTester());
+ tester.addTextNode(buildCatalogTester());
+// tester.addChild(buildAccessTester());
+// tester.addChild(buildSequenceGeneratorTester());
+// tester.addChild(buildTableGeneratorTester());
+// tester.addChild(buildNamedQueryTester());
+// tester.addChild(buildNamedNativeQueryTester());
+// tester.addChild(buildNamedStoredProcedureQueryTester());
+// tester.addChild(buildSqlResultSetMappingTester());
+// tester.addChild(buildMappedSuperclassTester());
+// tester.addChild(buildEntityTester());
+// tester.addChild(buildEmbeddableTester());
+// tester.addChild(buildConverterTester());
+ }
+}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.mapping/META-INF/MANIFEST.MF b/tools/org.eclipse.persistence.tools.mapping/META-INF/MANIFEST.MF
index a250cb5..5cdb826 100644
--- a/tools/org.eclipse.persistence.tools.mapping/META-INF/MANIFEST.MF
+++ b/tools/org.eclipse.persistence.tools.mapping/META-INF/MANIFEST.MF
@@ -6,7 +6,8 @@
Require-Bundle: org.eclipse.persistence.core;bundle-version="2.4.0",
javax.persistence;bundle-version="2.0.0",
org.eclipse.persistence.tools.utility;bundle-version="2.6.0"
-Export-Package: org.eclipse.persistence.tools.mapping.orm,
+Export-Package: org.eclipse.persistence.tools.mapping,
+ org.eclipse.persistence.tools.mapping.orm,
org.eclipse.persistence.tools.mapping.orm.dom,
org.eclipse.persistence.tools.mapping.persistence,
org.eclipse.persistence.tools.mapping.persistence.dom
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/AbstractExternalForm.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/AbstractExternalForm.java
index cd64348..b3b327a 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/AbstractExternalForm.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/AbstractExternalForm.java
@@ -1518,7 +1518,7 @@
if (element != null) {
return getTextNode(element);
}
-
+
return null;
}
@@ -1787,7 +1787,7 @@
*
* @return The XML document
*/
- protected final Document getDocument() {
+ public final Document getDocument() {
return getHelper().getDocument();
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/DefaultFormHelper.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/DefaultFormHelper.java
index 6c129f1..24a56dc 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/DefaultFormHelper.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/DefaultFormHelper.java
@@ -168,7 +168,7 @@
*/
@Override
public TextRange getElementNameTextRange(AbstractExternalForm externalForm, Element element) {
- return null;
+ throw new IllegalAccessError("Not supported");
}
/**
@@ -191,24 +191,16 @@
* {@inheritDoc}
*/
@Override
- public TextRange getTextNodeTextRange(AbstractExternalForm externalForm, Node element) {
- return null;
+ public TextRange getTextNodeTextRange(AbstractExternalForm externalForm, Node node) {
+ throw new IllegalAccessError("Not supported");
}
/**
* {@inheritDoc}
*/
@Override
- public TextRange getTextRange(AbstractExternalForm externalForm, Attr attribute) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public TextRange getTextRange(AbstractExternalForm externalForm, Element element) {
- return null;
+ public TextRange getTextRange(AbstractExternalForm externalForm, Node node) {
+ throw new IllegalAccessError("Not supported");
}
/**
@@ -232,6 +224,7 @@
*/
@Override
public void removeChildren(AbstractExternalForm externalForm, Node node, String elementName) {
+
for (Element childElement : externalForm.getChildren(node, elementName)) {
node.removeChild(childElement);
}
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalFormHelper.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalFormHelper.java
index 72f71f8..e65d199 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalFormHelper.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/ExternalFormHelper.java
@@ -18,7 +18,6 @@
import org.eclipse.persistence.tools.mapping.orm.dom.ORMConfiguration;
import org.eclipse.persistence.tools.mapping.persistence.dom.PersistenceConfiguration;
import org.eclipse.persistence.tools.utility.TextRange;
-import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -73,14 +72,18 @@
List<String> elementNamesOrder);
/**
+ * Creates the root {@link Element} defining the persistence object/relational mapping file.
*
- * @param ormConfiguration
+ * @param ormConfiguration The root of the external form
+ * @return The newly created {@link Element}
*/
Element buildORMConfiguration(ORMConfiguration ormConfiguration);
/**
+ * Creates the root {@link Element} defining the persistence configuration file.
*
- * @param persistence
+ * @param persistence The root of the external form
+ * @return The newly created {@link Element}
*/
Element buildPersistenceConfiguration(PersistenceConfiguration persistence);
@@ -115,31 +118,23 @@
URL getSourceRoot();
/**
- * Retrieves the {@link TextRange} of the given text node's value.
+ * Retrieves the {@link TextRange} of the given node's text value.
*
* @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
- * @param element The node from which the {@link TextRange} is retrieved
+ * @param node The node from which the {@link TextRange} is retrieved
* @return The {@link TextRange} of the node's text
*/
- TextRange getTextNodeTextRange(AbstractExternalForm externalForm, Node element);
-
- /**
- * Retrieves the {@link TextRange} for the given {@link Attr} within the document.
- *
- * @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
- * @param attribute The {@link Attr} to retrieve its {@link TextRange}
- * @return The {@link TextRange} of the given {@link Attr}'s value
- */
- TextRange getTextRange(AbstractExternalForm externalForm, Attr attribute);
+ TextRange getTextNodeTextRange(AbstractExternalForm externalForm, Node node);
/**
* Retrieves the {@link TextRange} of the given {@link Node}.
*
* @param externalForm Reference to the {@link AbstractExternalForm} invoking this method
- * @param element The node from which the {@link TextRange} is retrieved
+ * @param node The node from which the {@link TextRange} is retrieved, which can be either an
+ * {@link Element} or an {@link Attr}
* @return The {@link TextRange} of the given {@link Node}
*/
- TextRange getTextRange(AbstractExternalForm externalForm, Element element);
+ TextRange getTextRange(AbstractExternalForm externalForm, Node node);
/**
* Releases the previously acquired lock from the document.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalORMConfiguration.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalORMConfiguration.java
index 10c22a1..241851d 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalORMConfiguration.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/ExternalORMConfiguration.java
@@ -327,6 +327,11 @@
String getXML();
/**
+ * Determines whether the persistence unit metadata is defined or not.
+ */
+ boolean hasPersistenceUnitMetaData();
+
+ /**
* Returns a list of all mapped super class entities associated with this ORM configuration.
*/
List<ExternalMappedSuperClass> mappedSuperClasses();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AbstractTenantDiscriminatorColumn.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AbstractTenantDiscriminatorColumn.java
index 3331b78..9819d4d 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AbstractTenantDiscriminatorColumn.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/AbstractTenantDiscriminatorColumn.java
@@ -13,11 +13,11 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm.dom;
-import org.w3c.dom.Element;
import javax.persistence.DiscriminatorType;
import org.eclipse.persistence.tools.mapping.AbstractExternalForm;
import org.eclipse.persistence.tools.mapping.orm.ExternalTenantDiscriminatorColumn;
import org.eclipse.persistence.tools.utility.TextRange;
+import org.w3c.dom.Element;
/**
* The external form of the tenant discriminator column.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EmbeddedMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EmbeddedMapping.java
index 9d15b31..3b848b9 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EmbeddedMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/EmbeddedMapping.java
@@ -19,7 +19,6 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalAttributeOverride;
import org.eclipse.persistence.tools.mapping.orm.ExternalEmbeddedMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalNoSqlField;
-import org.w3c.dom.Element;
/**
* The external form for a embedded mapping, which is a child of an entity.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Entity.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Entity.java
index 5cefb7f..7dc30eb 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Entity.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Entity.java
@@ -26,8 +26,8 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalNamedQuery;
import org.eclipse.persistence.tools.mapping.orm.ExternalNativeQuery;
import org.eclipse.persistence.tools.mapping.orm.ExternalPrimaryKeyJoinColumn;
-import org.eclipse.persistence.tools.mapping.orm.ExternalSecondaryTable;
import org.eclipse.persistence.tools.mapping.orm.ExternalSQLResultSetMapping;
+import org.eclipse.persistence.tools.mapping.orm.ExternalSecondaryTable;
import org.eclipse.persistence.tools.mapping.orm.ExternalStoredProcedureQuery;
import org.eclipse.persistence.tools.utility.ObjectTools;
import org.eclipse.persistence.tools.utility.TextRange;
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/JoinTable.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/JoinTable.java
index 16fc694..ecf89cb 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/JoinTable.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/JoinTable.java
@@ -19,7 +19,6 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalInverseJoinColumn;
import org.eclipse.persistence.tools.mapping.orm.ExternalJoinColumn;
import org.eclipse.persistence.tools.mapping.orm.ExternalJoinTable;
-import org.w3c.dom.Element;
/**
* The external form of a Join table, which is a child of a relationship mapping.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/MappedSuperClassEntity.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/MappedSuperClassEntity.java
index 168b83d..0c76ac6 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/MappedSuperClassEntity.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/MappedSuperClassEntity.java
@@ -14,7 +14,6 @@
package org.eclipse.persistence.tools.mapping.orm.dom;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import org.eclipse.persistence.annotations.ExistenceType;
import org.eclipse.persistence.tools.mapping.orm.ExternalCache;
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedStoredProcedureQuery.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedStoredProcedureQuery.java
index b45ee4f..6a7e602 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedStoredProcedureQuery.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NamedStoredProcedureQuery.java
@@ -19,7 +19,6 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalStoredProcedureParameter;
import org.eclipse.persistence.tools.mapping.orm.ExternalStoredProcedureQuery;
import org.eclipse.persistence.tools.utility.TextRange;
-import org.w3c.dom.Element;
/**
* The external form of a stored procedure query, which is a child of an entity or an ORM configuration.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NonTransientMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NonTransientMapping.java
index 2f81214..ce701fb 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NonTransientMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/NonTransientMapping.java
@@ -21,7 +21,6 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalNonTransientMapping;
import org.eclipse.persistence.tools.utility.ObjectTools;
import org.eclipse.persistence.tools.utility.TextRange;
-import org.w3c.dom.Element;
/**
* The external form for a non-transient mapping, which is a child of an entity.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMConfiguration.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMConfiguration.java
index 4c8da8f..bce45bb 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMConfiguration.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMConfiguration.java
@@ -34,8 +34,8 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalORMConfiguration;
import org.eclipse.persistence.tools.mapping.orm.ExternalObjectTypeConverter;
import org.eclipse.persistence.tools.mapping.orm.ExternalPersistenceUnit;
-import org.eclipse.persistence.tools.mapping.orm.ExternalSequenceGenerator;
import org.eclipse.persistence.tools.mapping.orm.ExternalSQLResultSetMapping;
+import org.eclipse.persistence.tools.mapping.orm.ExternalSequenceGenerator;
import org.eclipse.persistence.tools.mapping.orm.ExternalStoredProcedureQuery;
import org.eclipse.persistence.tools.mapping.orm.ExternalStructConverter;
import org.eclipse.persistence.tools.mapping.orm.ExternalTableGenerator;
@@ -44,9 +44,7 @@
import org.eclipse.persistence.tools.mapping.orm.ORMDocumentType;
import org.eclipse.persistence.tools.utility.ObjectTools;
import org.eclipse.persistence.tools.utility.TextRange;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import static org.eclipse.persistence.tools.mapping.orm.ORMXmlConstants.*;
import static org.eclipse.persistence.tools.mapping.orm.XmlConstants.*;
/**
@@ -54,7 +52,7 @@
*
* @version 2.6
*/
-@SuppressWarnings({"nls", "unused"}) // unused used for the import statement: see bug 330740
+@SuppressWarnings("nls")
public final class ORMConfiguration extends AbstractExternalForm
implements ExternalORMConfiguration {
@@ -854,6 +852,7 @@
* {@inheritDoc}
*/
@Override
+ @SuppressWarnings("resource")
public String getXML() {
try {
@@ -863,13 +862,13 @@
TransformerFactory transformerFactory = TransformerFactory.newInstance();
javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(getDocument());
- ByteArrayOutputStream ouput = new ByteArrayOutputStream();
- StreamResult result = new StreamResult(ouput);
+
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ StreamResult result = new StreamResult(output);
transformer.transform(source, result);
- return ouput.toString();
-
+ return output.toString();
}
catch (Exception e) {
throw new RuntimeException(e);
@@ -883,6 +882,14 @@
* {@inheritDoc}
*/
@Override
+ public boolean hasPersistenceUnitMetaData() {
+ return hasChild(PersistenceUnit.PERSISTENCE_UNIT_METADATA);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public List<ExternalMappedSuperClass> mappedSuperClasses() {
int count = mappedSuperClassesSize();
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMRepository.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMRepository.java
index 91f539b..83ff33b 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMRepository.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/ORMRepository.java
@@ -21,7 +21,6 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.persistence.tools.mapping.DefaultFormHelper;
-import org.eclipse.persistence.tools.mapping.orm.ExternalORMConfiguration;
import org.eclipse.persistence.tools.mapping.orm.ExternalORMRepository;
import org.eclipse.persistence.tools.mapping.orm.ORMDocumentType;
import org.eclipse.persistence.tools.utility.XMLTools;
@@ -60,7 +59,7 @@
* {@inheritDoc}
*/
@Override
- public ExternalORMConfiguration buildORMConfiguration(URL location, ORMDocumentType docType) throws IOException {
+ public ORMConfiguration buildORMConfiguration(URL location, ORMDocumentType docType) throws IOException {
DefaultFormHelper helper = new DefaultFormHelper(XMLTools.newDocument(), location);
ORMConfiguration ormConfiguration = new ORMConfiguration(helper);
ormConfiguration.setDocumentType(docType);
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToManyMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToManyMapping.java
index 84d4dd8..283d0e2 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToManyMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToManyMapping.java
@@ -20,7 +20,6 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalNoSqlJoinField;
import org.eclipse.persistence.tools.mapping.orm.ExternalOneToManyMapping;
import org.eclipse.persistence.tools.utility.TextRange;
-import org.w3c.dom.Element;
/**
* The external form for a 1:M mapping, which is a child of an entity.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToOneMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToOneMapping.java
index adf2a0f..18b7204 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToOneMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OneToOneMapping.java
@@ -20,7 +20,6 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalOneToOneMapping;
import org.eclipse.persistence.tools.mapping.orm.ExternalPrimaryKeyJoinColumn;
import org.eclipse.persistence.tools.utility.TextRange;
-import org.w3c.dom.Element;
/**
* The external form for a 1:1 mapping, which is a child of an entity.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OptimisticLocking.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OptimisticLocking.java
index 682efe9..b6eafc5 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OptimisticLocking.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/OptimisticLocking.java
@@ -20,7 +20,6 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityColumn;
import org.eclipse.persistence.tools.mapping.orm.ExternalOptimisticLocking;
import org.eclipse.persistence.tools.utility.TextRange;
-import org.w3c.dom.Element;
/**
* The external form of a optimistic locking, which is a child of an entity.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKey.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKey.java
index 0593c39..9222165 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKey.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/PrimaryKey.java
@@ -21,7 +21,6 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalEntityColumn;
import org.eclipse.persistence.tools.mapping.orm.ExternalPrimaryKey;
import org.eclipse.persistence.tools.utility.TextRange;
-import org.w3c.dom.Element;
/**
* The external form of a primary key, which is a child of an entity.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Table.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Table.java
index bb1d744..0d508e8 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Table.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/Table.java
@@ -20,7 +20,6 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalUniqueConstraint;
import org.eclipse.persistence.tools.utility.TextRange;
import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.w3c.dom.Element;
/**
* The external form of an entity table.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TableGenerator.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TableGenerator.java
index 93d85fa..97685a5 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TableGenerator.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TableGenerator.java
@@ -20,7 +20,6 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalUniqueConstraint;
import org.eclipse.persistence.tools.utility.TextRange;
import org.eclipse.persistence.tools.utility.iterable.ListIterable;
-import org.w3c.dom.Element;
/**
* The external form of a table generator.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TransformationMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TransformationMapping.java
index 152f49d..7e68149 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TransformationMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/TransformationMapping.java
@@ -21,7 +21,6 @@
import org.eclipse.persistence.tools.mapping.orm.ExternalTransformer;
import org.eclipse.persistence.tools.mapping.orm.ExternalWriteTransformer;
import org.eclipse.persistence.tools.utility.TextRange;
-import org.w3c.dom.Element;
/**
* The external form of a transformation mapping.
diff --git a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/VersionMapping.java b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/VersionMapping.java
index 8de7d11..2fc7a7e 100644
--- a/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/VersionMapping.java
+++ b/tools/org.eclipse.persistence.tools.mapping/src/org/eclipse/persistence/tools/mapping/orm/dom/VersionMapping.java
@@ -13,10 +13,10 @@
******************************************************************************/
package org.eclipse.persistence.tools.mapping.orm.dom;
-import org.eclipse.persistence.tools.mapping.orm.ExternalEntityColumn;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.TemporalType;
+import org.eclipse.persistence.tools.mapping.orm.ExternalEntityColumn;
import org.eclipse.persistence.tools.mapping.orm.ExternalVersionMapping;
import org.eclipse.persistence.tools.utility.TextRange;
diff --git a/tools/org.eclipse.persistence.tools.parent/pom.xml b/tools/org.eclipse.persistence.tools.parent/pom.xml
index 2f0ceb0..49ca0ce 100644
--- a/tools/org.eclipse.persistence.tools.parent/pom.xml
+++ b/tools/org.eclipse.persistence.tools.parent/pom.xml
@@ -43,6 +43,7 @@
<module>../org.eclipse.persistence.tools.mapping</module>
<module>../org.eclipse.persistence.tools.gen.nosql</module>
<module>../org.eclipse.persistence.tools.utility.tests</module>
+ <module>../org.eclipse.persistence.tools.mapping.tests</module>
</modules>
<profiles>
diff --git a/tools/org.eclipse.persistence.tools.utility.tests/test.xml b/tools/org.eclipse.persistence.tools.utility.tests/antbuild.xml
similarity index 96%
rename from tools/org.eclipse.persistence.tools.utility.tests/test.xml
rename to tools/org.eclipse.persistence.tools.utility.tests/antbuild.xml
index d5a6f56..4af0fc1 100644
--- a/tools/org.eclipse.persistence.tools.utility.tests/test.xml
+++ b/tools/org.eclipse.persistence.tools.utility.tests/antbuild.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- Copyright (c) 2007, 2012 Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2007, 2013 Oracle and/or its affiliates. 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.
diff --git a/tools/org.eclipse.persistence.tools.utility/src/org/eclipse/persistence/tools/utility/Assert.java b/tools/org.eclipse.persistence.tools.utility/src/org/eclipse/persistence/tools/utility/Assert.java
new file mode 100644
index 0000000..883c726
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.utility/src/org/eclipse/persistence/tools/utility/Assert.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. 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:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.utility;
+
+/**
+ * This class is used for assertion.
+ *
+ * @version 2.6
+ */
+@SuppressWarnings("nls")
+public final class Assert {
+
+ /**
+ * This flag is used to determine if the unit-tests are running.
+ */
+ public static boolean UNIT_TESTS = Boolean.getBoolean("unit-tests");
+
+ /**
+ * This class is not intended to be instantiated.
+ */
+ private Assert() {
+ super();
+ throw new UnsupportedOperationException("Assert cannot be instantiated");
+ }
+
+ /**
+ * Shorthand for causing a check exception if the code reaches an unexpected location.
+ */
+ public static void fail() {
+ fail("fail");
+ }
+
+ /**
+ * Shorthand for causing a check exception if the code reaches an unexpected location.
+ *
+ * @param description The description of the failure
+ */
+ public static void fail(String description) {
+ throw new AssertionFailedException(description);
+ }
+
+ /**
+ * Asserts that the given boolean is <code>false</code>. If this is not the case, some kind of
+ * unchecked exception is thrown.
+ *
+ * @param expression The out code of the check
+ * @return <code>true</code> if the check passes (does not return if the check fails)
+ * @exception AssertionFailedException if the test failed
+ */
+ public static boolean isFalse(boolean expression) {
+ return isFalse(expression, StringTools.EMPTY_STRING);
+ }
+
+ /**
+ * Asserts that the given boolean is <code>false</code>. If this is not the case, some kind of
+ * unchecked exception is thrown. The given message is included in that exception, to aid debugging.
+ *
+ * @param expression The out code of the check
+ * @param message The message to include in the exception
+ * @return <code>true</code> if the check passes (does not return if the check fails)
+ * @exception AssertionFailedException if the test failed
+ */
+ public static boolean isFalse(boolean expression, String message) {
+ if (expression) {
+ fail(message);
+ }
+ return expression;
+ }
+
+ /**
+ * Asserts that an argument is legal. If the given boolean is not <code>true</code>, an {@link
+ * AssertionFailedException} is thrown.
+ *
+ * @param expression The out code of the check
+ * @return <code>true</code> if the check passes (does not return if the check fails)
+ * @exception AssertionFailedException if the legality test failed
+ */
+ public static boolean isLegal(boolean expression) {
+ return isLegal(expression, StringTools.EMPTY_STRING);
+ }
+
+ /**
+ * Asserts that an argument is legal. If the given boolean is not <code>true</code>, an {@link
+ * AssertionFailedException} is thrown.The given message is included in that exception, to aid
+ * debugging.
+ *
+ * @param expression The out code of the check
+ * @param message The message to include in the exception
+ * @return <code>true</code> if the check passes (does not return if the check fails)
+ * @exception AssertionFailedException if the test failed
+ */
+ public static boolean isLegal(boolean expression, String message) {
+ if (!expression) {
+ fail(message);
+ }
+ return expression;
+ }
+
+ /**
+ * Asserts that the given object is not <code>null</code>. If this is not the case, some kind of
+ * unchecked exception is thrown.
+ *
+ * @param object The value to test
+ * @exception AssertionFailedException if the test failed
+ */
+ public static void isNotNull(Object object) {
+ isNotNull(object, StringTools.EMPTY_STRING);
+ }
+
+ /**
+ * Asserts that the given object is not <code>null</code>. If this is not the case, some kind of
+ * unchecked exception is thrown. The given message is included in that exception, to aid debugging.
+ *
+ * @param object The value to test
+ * @param message The message to include in the exception
+ * @exception AssertionFailedException if the test failed
+ */
+ public static void isNotNull(Object object, String message) {
+ if (object == null) {
+ fail(message);
+ }
+ }
+
+ /**
+ * Asserts that the given boolean is <code>true</code>. If this is not the case, some kind of
+ * unchecked exception is thrown.
+ *
+ * @param expression The out code of the check
+ * @return <code>true</code> if the check passes (does not return if the check fails)
+ * @exception AssertionFailedException if the test failed
+ */
+ public static boolean isTrue(boolean expression) {
+ return isTrue(expression, StringTools.EMPTY_STRING);
+ }
+
+ /**
+ * Asserts that the given boolean is <code>true</code>. If this is not the case, some kind of
+ * unchecked exception is thrown. The given message is included in that exception, to aid debugging.
+ *
+ * @param expression The out code of the check
+ * @param message The message to include in the exception
+ * @return <code>true</code> if the check passes (does not return if the check fails)
+ * @exception AssertionFailedException if the test failed
+ */
+ public static boolean isTrue(boolean expression, String message) {
+ if (!expression) {
+ fail(message);
+ }
+ return expression;
+ }
+}
\ No newline at end of file
diff --git a/tools/org.eclipse.persistence.tools.utility/src/org/eclipse/persistence/tools/utility/AssertionFailedException.java b/tools/org.eclipse.persistence.tools.utility/src/org/eclipse/persistence/tools/utility/AssertionFailedException.java
new file mode 100644
index 0000000..f06ba98
--- /dev/null
+++ b/tools/org.eclipse.persistence.tools.utility/src/org/eclipse/persistence/tools/utility/AssertionFailedException.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. 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:
+ * Oracle - initial API and implementation
+ *
+ ******************************************************************************/
+package org.eclipse.persistence.tools.utility;
+
+/**
+ * The exception used to be thrown when asserting.
+ *
+ * @see Assert
+ *
+ * @version 2.6
+ */
+public class AssertionFailedException extends RuntimeException {
+
+ /**
+ * The serial version number of this class.
+ */
+ static final long serialVersionUID = 3312027513928750865L;
+
+ /**
+ * Creates a new <code>AssertionFailedException</code>.
+ *
+ * @param detail The detail message of the exception
+ */
+ public AssertionFailedException(String detail) {
+ super(detail);
+ }
+}
\ No newline at end of file