Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbvosburgh2008-09-15 15:29:50 +0000
committerbvosburgh2008-09-15 15:29:50 +0000
commite847b65c39a5bb0974d0b0061c7ab69cec83241d (patch)
tree444d6a354853540f923abe11f189f0bf5e00d818
parent273691310157ea0c6b88bb7386fde72d37c56dac (diff)
downloadwebtools.dali-e847b65c39a5bb0974d0b0061c7ab69cec83241d.tar.gz
webtools.dali-e847b65c39a5bb0974d0b0061c7ab69cec83241d.tar.xz
webtools.dali-e847b65c39a5bb0974d0b0061c7ab69cec83241d.zip
created gen.tests plug-in
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/.classpath11
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/.project28
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/META-INF/MANIFEST.MF13
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/about.html34
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/build.properties18
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/plugin.properties22
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/src/org/eclipse/jpt/gen/tests/internal/EntityGenToolsTests.java144
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/src/org/eclipse/jpt/gen/tests/internal/JptGenTests.java32
-rw-r--r--jpa/tests/org.eclipse.jpt.gen.tests/test.xml40
10 files changed, 349 insertions, 0 deletions
diff --git a/jpa/tests/org.eclipse.jpt.gen.tests/.classpath b/jpa/tests/org.eclipse.jpt.gen.tests/.classpath
new file mode 100644
index 0000000000..84744e7e8a
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.gen.tests/.classpath
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <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="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/jpa/tests/org.eclipse.jpt.gen.tests/.project b/jpa/tests/org.eclipse.jpt.gen.tests/.project
new file mode 100644
index 0000000000..2159feb5ef
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.gen.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jpt.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.gen.tests/.settings/org.eclipse.jdt.core.prefs b/jpa/tests/org.eclipse.jpt.gen.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..8bab913c29
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.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.gen.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.gen.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..b9425307fe
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.gen.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.jpt.gen.tests
+Bundle-Version: 2.0.0
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0",
+ org.eclipse.jdt.core;bundle-version="3.4.0",
+ org.eclipse.jpt.utility;bundle-version="1.2.0",
+ org.eclipse.jpt.db;bundle-version="1.1.1",
+ org.eclipse.jpt.gen;bundle-version="1.1.0",
+ org.junit;bundle-version="3.8.2"
diff --git a/jpa/tests/org.eclipse.jpt.gen.tests/about.html b/jpa/tests/org.eclipse.jpt.gen.tests/about.html
new file mode 100644
index 0000000000..be534ba44f
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.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.gen.tests/build.properties b/jpa/tests/org.eclipse.jpt.gen.tests/build.properties
new file mode 100644
index 0000000000..e68d4bf9e4
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.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.gen.tests/plugin.properties b/jpa/tests/org.eclipse.jpt.gen.tests/plugin.properties
new file mode 100644
index 0000000000..269a5dc154
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.gen.tests/plugin.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# 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.gen.tests/src/org/eclipse/jpt/gen/tests/internal/EntityGenToolsTests.java b/jpa/tests/org.eclipse.jpt.gen.tests/src/org/eclipse/jpt/gen/tests/internal/EntityGenToolsTests.java
new file mode 100644
index 0000000000..9ff221c28f
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.gen.tests/src/org/eclipse/jpt/gen/tests/internal/EntityGenToolsTests.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * 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.gen.tests.internal;
+
+import java.util.HashSet;
+
+import org.eclipse.jpt.gen.internal.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.gen.tests/src/org/eclipse/jpt/gen/tests/internal/JptGenTests.java b/jpa/tests/org.eclipse.jpt.gen.tests/src/org/eclipse/jpt/gen/tests/internal/JptGenTests.java
new file mode 100644
index 0000000000..1e79d7d032
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.gen.tests/src/org/eclipse/jpt/gen/tests/internal/JptGenTests.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.gen.tests.internal;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.jpt.gen.tests.internal.EntityGenToolsTests;
+
+/**
+ *
+ */
+public class JptGenTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("JPT Entity Generation Tests"); //$NON-NLS-1$
+ suite.addTestSuite(EntityGenToolsTests.class);
+ return suite;
+ }
+
+ private JptGenTests() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.gen.tests/test.xml b/jpa/tests/org.eclipse.jpt.gen.tests/test.xml
new file mode 100644
index 0000000000..11d311ae85
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.gen.tests/test.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<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.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.gen.tests.internal.JptGenTests" />
+ <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

Back to the top