renamed org.eclipse.jpt.gen.tests to org.eclipse.jpt.jpa.gen.tests
diff --git a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/.classpath b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/.classpath
new file mode 100644
index 0000000..482a6d9
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/.classpath
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
+ <accessrules>
+ <accessrule kind="accessible" pattern="org/eclipse/jpt/gen/**"/>
+ </accessrules>
+ </classpathentry>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/.project b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/.project
new file mode 100644
index 0000000..b68577b
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jpt.jpa.gen.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/.settings/org.eclipse.core.resources.prefs b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..2c6dda4
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Tue Jan 15 11:12:14 EST 2008
+eclipse.preferences.version=1
+encoding/<project>=ISO-8859-1
diff --git a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/.settings/org.eclipse.jdt.core.prefs b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..8bab913
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Mon Jul 07 20:13:24 EDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..a9134a2
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.eclipse.jpt.jpa.gen.tests
+Bundle-Version: 2.0.0
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0",
+ org.eclipse.jdt.core;bundle-version="3.4.0",
+ org.eclipse.jpt.common.utility;bundle-version="1.2.0",
+ org.eclipse.jpt.jpa.db;bundle-version="1.1.1",
+ org.eclipse.jpt.jpa.gen;bundle-version="1.1.0",
+ org.junit;bundle-version="3.8.0"
+Export-Package: org.eclipse.jpt.jpa.gen.tests.internal;x-internal:=true
diff --git a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/about.html b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/about.html
new file mode 100644
index 0000000..be534ba
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/about.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+
+<BODY lang="EN-US">
+
+<H3>About This Content</H3>
+
+<P>May 02, 2008</P>
+
+<H3>License</H3>
+
+<P>The Eclipse Foundation makes available all content in this plug-in
+("Content"). Unless otherwise indicated below, the Content is provided to you
+under the terms and conditions of the Eclipse Public License Version 1.0
+("EPL"). A copy of the EPL is available at
+<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
+For purposes of the EPL, "Program" will mean the Content.</P>
+
+<P>If you did not receive this Content directly from the Eclipse Foundation, the
+Content is being redistributed by another party ("Redistributor") and different
+terms and conditions may apply to your use of any object code in the Content.
+Check the Redistributor's license that was provided with the Content. If no such
+license exists, contact the Redistributor. Unless otherwise indicated below, the
+terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at
+<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
+
+</BODY>
+</HTML>
diff --git a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/build.properties b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/build.properties
new file mode 100644
index 0000000..e68d4bf
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/build.properties
@@ -0,0 +1,18 @@
+################################################################################
+# Copyright (c) 2008 Oracle. All rights reserved.
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v1.0, which accompanies this distribution
+# and is available at http://www.eclipse.org/legal/epl-v10.html.
+#
+# Contributors:
+# Oracle - initial API and implementation
+################################################################################
+javacSource = 1.5
+javacTarget = 1.5
+bin.includes = .,\
+ META-INF/,\
+ about.html,\
+ test.xml,\
+ plugin.properties
+source.. = src/
+output.. = bin/
diff --git a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/plugin.properties b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/plugin.properties
new file mode 100644
index 0000000..f81a674
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/plugin.properties
@@ -0,0 +1,23 @@
+################################################################################
+# Copyright (c) 2006, 2007 Oracle. All rights reserved.
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v1.0, which accompanies this distribution
+# and is available at http://www.eclipse.org/legal/epl-v10.html.
+#
+# Contributors:
+# Oracle - initial API and implementation
+################################################################################
+# ====================================================================
+# To code developer:
+# Do NOT change the properties between this line and the
+# "%%% END OF TRANSLATED PROPERTIES %%%" line.
+# Make a new property name, append to the end of the file and change
+# the code to use the new property.
+# ====================================================================
+
+# ====================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# ====================================================================
+
+pluginName=Java Persistence Tools Entity Generation Tests
+providerName=Eclipse.org
diff --git a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/EntityGenToolsTests.java b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/EntityGenToolsTests.java
new file mode 100644
index 0000000..25e870f
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/EntityGenToolsTests.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.gen.tests.internal;
+
+import java.util.HashSet;
+import org.eclipse.jpt.jpa.gen.internal.util.EntityGenTools;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ */
+@SuppressWarnings("nls")
+public class EntityGenToolsTests extends TestCase {
+
+ public EntityGenToolsTests(String name) {
+ super(name);
+ }
+
+ public void testConvertToUniqueJavaStyleClassName1() {
+ HashSet<String> names = new HashSet<String>();
+ assertEquals("Foo", EntityGenTools.convertToUniqueJavaStyleClassName("Foo", names));
+ assertEquals("Foo", EntityGenTools.convertToUniqueJavaStyleClassName("foo", names));
+ assertEquals("Foo", EntityGenTools.convertToUniqueJavaStyleClassName("FOO", names));
+ assertEquals("Foo", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_", names));
+ assertEquals("Foo", EntityGenTools.convertToUniqueJavaStyleClassName("_FOO", names));
+ assertEquals("Foo_", EntityGenTools.convertToUniqueJavaStyleClassName("FOO*", names));
+ assertEquals("_oo", EntityGenTools.convertToUniqueJavaStyleClassName("5oo", names));
+ }
+
+ public void testConvertToUniqueJavaStyleClassName2() {
+ HashSet<String> names = new HashSet<String>();
+ names.add("Foo");
+ assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("Foo", names));
+ assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("foo", names));
+ assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("FOO", names));
+ assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_", names));
+ assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("_FOO", names));
+ assertEquals("Foo_", EntityGenTools.convertToUniqueJavaStyleClassName("FOO*", names));
+ assertEquals("_oo", EntityGenTools.convertToUniqueJavaStyleClassName("5OO", names));
+ }
+
+ public void testConvertToUniqueJavaStyleClassName3() {
+ HashSet<String> names = new HashSet<String>();
+ names.add("foo");
+ assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("Foo", names));
+ assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("foo", names));
+ assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("FOO", names));
+ assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_", names));
+ assertEquals("Foo2", EntityGenTools.convertToUniqueJavaStyleClassName("_FOO", names));
+ assertEquals("Foo_", EntityGenTools.convertToUniqueJavaStyleClassName("FOO*", names));
+ assertEquals("_oo", EntityGenTools.convertToUniqueJavaStyleClassName("5OO", names));
+ }
+
+ public void testConvertToUniqueJavaStyleClassName4() {
+ HashSet<String> names = new HashSet<String>();
+ assertEquals("FooBar", EntityGenTools.convertToUniqueJavaStyleClassName("FooBar", names));
+ assertEquals("Foo_bar", EntityGenTools.convertToUniqueJavaStyleClassName("foo_bar", names));
+ assertEquals("FooBar", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR", names));
+ assertEquals("FooBar", EntityGenTools.convertToUniqueJavaStyleClassName("_FOO_BAR", names));
+ assertEquals("FooBar", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR_", names));
+ assertEquals("FooBar_", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR_*", names));
+ assertEquals("_fooBar", EntityGenTools.convertToUniqueJavaStyleClassName("4FOO_BAR", names));
+ }
+
+ public void testConvertToUniqueJavaStyleClassName5() {
+ HashSet<String> names = new HashSet<String>();
+ names.add("FooBar");
+ assertEquals("FooBar2", EntityGenTools.convertToUniqueJavaStyleClassName("FooBar", names));
+ assertEquals("Foo_bar", EntityGenTools.convertToUniqueJavaStyleClassName("foo_bar", names));
+ assertEquals("FooBar2", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR", names));
+ assertEquals("FooBar2", EntityGenTools.convertToUniqueJavaStyleClassName("_FOO_BAR", names));
+ assertEquals("FooBar2", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR_", names));
+ assertEquals("FooBar_", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR_*", names));
+ assertEquals("_fooBar", EntityGenTools.convertToUniqueJavaStyleClassName("4FOO_BAR", names));
+ }
+
+ public void testConvertToUniqueJavaStyleAttributeName1() {
+ HashSet<String> names = new HashSet<String>();
+ assertEquals("foo", EntityGenTools.convertToUniqueJavaStyleAttributeName("Foo", names));
+ assertEquals("foo", EntityGenTools.convertToUniqueJavaStyleAttributeName("foo", names));
+ assertEquals("foo", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO", names));
+ assertEquals("foo", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_", names));
+ assertEquals("foo", EntityGenTools.convertToUniqueJavaStyleAttributeName("_FOO", names));
+ assertEquals("foo_", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO*", names));
+ assertEquals("_oo", EntityGenTools.convertToUniqueJavaStyleAttributeName("5oo", names));
+ }
+
+ public void testConvertToUniqueJavaStyleAttributeName2() {
+ HashSet<String> names = new HashSet<String>();
+ names.add("Foo");
+ assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("Foo", names));
+ assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("foo", names));
+ assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO", names));
+ assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_", names));
+ assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("_FOO", names));
+ assertEquals("foo_", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO*", names));
+ assertEquals("_oo", EntityGenTools.convertToUniqueJavaStyleAttributeName("5OO", names));
+ }
+
+ public void testConvertToUniqueJavaStyleAttributeName3() {
+ HashSet<String> names = new HashSet<String>();
+ names.add("foo");
+ assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("Foo", names));
+ assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("foo", names));
+ assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO", names));
+ assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_", names));
+ assertEquals("foo2", EntityGenTools.convertToUniqueJavaStyleAttributeName("_FOO", names));
+ assertEquals("foo_", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO*", names));
+ assertEquals("_oo", EntityGenTools.convertToUniqueJavaStyleAttributeName("5OO", names));
+ }
+
+ public void testConvertToUniqueJavaStyleAttributeName4() {
+ HashSet<String> names = new HashSet<String>();
+ assertEquals("fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("FooBar", names));
+ assertEquals("foo_bar", EntityGenTools.convertToUniqueJavaStyleAttributeName("foo_bar", names));
+ assertEquals("fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR", names));
+ assertEquals("fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("_FOO_BAR", names));
+ assertEquals("fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR_", names));
+ assertEquals("fooBar_", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR_*", names));
+ assertEquals("_fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("4FOO_BAR", names));
+ }
+
+ public void testConvertToUniqueJavaStyleAttributeName5() {
+ HashSet<String> names = new HashSet<String>();
+ names.add("FooBar");
+ assertEquals("fooBar2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FooBar", names));
+ assertEquals("foo_bar", EntityGenTools.convertToUniqueJavaStyleAttributeName("foo_bar", names));
+ assertEquals("fooBar2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR", names));
+ assertEquals("fooBar2", EntityGenTools.convertToUniqueJavaStyleAttributeName("_FOO_BAR", names));
+ assertEquals("fooBar2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR_", names));
+ assertEquals("fooBar_", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR_*", names));
+ assertEquals("_fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("4FOO_BAR", names));
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/JptJpaGenTests.java b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/JptJpaGenTests.java
new file mode 100644
index 0000000..530dd84
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/JptJpaGenTests.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.jpa.gen.tests.internal;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.jpt.jpa.gen.tests.internal.EntityGenToolsTests;
+
+/**
+ *
+ */
+public class JptJpaGenTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("JPT Entity Generation Tests"); //$NON-NLS-1$
+ suite.addTestSuite(EntityGenToolsTests.class);
+ return suite;
+ }
+
+ private JptJpaGenTests() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/test.xml b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/test.xml
new file mode 100644
index 0000000..40a027f
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/test.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!--
+ Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0, which accompanies this distribution
+ and is available at http://www.eclipse.org/legal/epl-v10.html.
+
+ 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.jpt.jpa.gen.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="gen-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname" value="org.eclipse.jpt.jpa.gen.tests.internal.JptJpaGenTests" />
+ <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/>
+ <property name="extraVMargs" value=""/>
+ </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