Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2011-02-06 02:34:58 +0000
committerkmoore2011-02-06 02:34:58 +0000
commit51446c9a978a2348ce6e627a04c0744aff4cdfb7 (patch)
treed3790a9bc9e81af48162712052374166a9a2fcb0 /jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource
parentda90c110eaa10e7f631b6baac3055ccb4d2df73b (diff)
downloadwebtools.dali-51446c9a978a2348ce6e627a04c0744aff4cdfb7.tar.gz
webtools.dali-51446c9a978a2348ce6e627a04c0744aff4cdfb7.tar.xz
webtools.dali-51446c9a978a2348ce6e627a04c0744aff4cdfb7.zip
renamed org.eclipse.jpt.core.tests.extension.resource to org.eclipse.jpt.jpa.core.tests.extension.resource
Diffstat (limited to 'jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource')
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.classpath13
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.cvsignore6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.project28
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/META-INF/MANIFEST.MF23
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/about.html34
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/build.properties19
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/plugin.properties23
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/plugin.xml34
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/ExtensionTestPlugin.java55
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestAttributeMapping.java35
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestAttributeMappingDefinition.java63
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestTypeMapping.java42
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestTypeMappingDefinition.java54
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJavaBasicMapping.java21
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJavaEntity.java31
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaFactory.java39
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java66
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformProvider.java163
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformUiFactory.java33
21 files changed, 792 insertions, 0 deletions
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.classpath b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.classpath
new file mode 100644
index 0000000000..1f8c49a2a4
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.classpath
@@ -0,0 +1,13 @@
+<?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/core/**"/>
+ <accessrule kind="accessible" pattern="org/eclipse/jpt/utility/**"/>
+ <accessrule kind="accessible" pattern="org/eclipse/jpt/ui/**"/>
+ </accessrules>
+ </classpathentry>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.cvsignore b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.cvsignore
new file mode 100644
index 0000000000..a196dd7686
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.cvsignore
@@ -0,0 +1,6 @@
+bin
+@dot
+temp.folder
+build.xml
+javaCompiler...args
+javaCompiler...args.* \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.project b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.project
new file mode 100644
index 0000000000..b7783a563f
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jpt.jpa.core.tests.extension.resource</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.core.tests.extension.resource/.settings/org.eclipse.core.resources.prefs b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000000..55044aaf02
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Mon Apr 07 14:26:32 EDT 2008
+eclipse.preferences.version=1
+encoding/<project>=ISO-8859-1
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.settings/org.eclipse.jdt.core.prefs b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..929d54536d
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Sun May 27 14:59:18 EDT 2007
+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.core.tests.extension.resource/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..62d8ab41d4
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.eclipse.jpt.jpa.core.tests.extension.resource;singleton:=true
+Bundle-Version: 2.4.0.qualifier
+Bundle-Activator: org.eclipse.jpt.jpa.core.tests.extension.resource.ExtensionTestPlugin
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.jdt.core,
+ org.eclipse.jpt.common.core,
+ org.eclipse.jpt.jpa.core,
+ org.eclipse.jpt.jpa.ui,
+ org.eclipse.jpt.jpa.gen,
+ org.eclipse.jpt.jpa.db,
+ org.eclipse.jpt.common.utility,
+ org.eclipse.swt,
+ org.eclipse.wst.common.project.facet.core,
+ org.eclipse.wst.validation
+Export-Package: org.eclipse.jpt.jpa.core.tests.extension.resource;x-friends:="org.eclipse.jpt.jpa.ui.tests,org.eclipse.jpt.jpa.core.tests"
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/about.html b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/about.html
new file mode 100644
index 0000000000..be534ba44f
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/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.core.tests.extension.resource/build.properties b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/build.properties
new file mode 100644
index 0000000000..f33b241f91
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/build.properties
@@ -0,0 +1,19 @@
+################################################################################
+# Copyright (c) 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
+################################################################################
+javacSource=1.5
+javacTarget=1.5
+source.. = src/
+output.. = bin/
+bin.includes = .,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+jars.compile.order = .
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/plugin.properties b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/plugin.properties
new file mode 100644
index 0000000000..0558789278
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/plugin.properties
@@ -0,0 +1,23 @@
+################################################################################
+# Copyright (c) 2007, 2009 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 = Dali Java Persistence Tools - Extension Tests
+providerName = Eclipse Web Tools Platform
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/plugin.xml b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/plugin.xml
new file mode 100644
index 0000000000..747a8d16d1
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/plugin.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?> <!--
+ Copyright (c) 2007, 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
+ -->
+
+<plugin>
+
+ <extension
+ point="org.eclipse.jpt.jpa.core.jpaPlatforms">
+
+ <jpaPlatform
+ id="core.testJpaPlatform"
+ label="Test Jpa Platform"
+ factoryClass="org.eclipse.jpt.jpa.core.tests.extension.resource.TestJpaPlatformFactory"/>
+
+ </extension>
+
+ <extension
+ point="org.eclipse.jpt.jpa.ui.jpaPlatformUis">
+
+ <jpaPlatformUi
+ id="core.testJpaPlatform.ui"
+ jpaPlatform="core.testJpaPlatform"
+ factoryClass="org.eclipse.jpt.jpa.core.tests.extension.resource.TestJpaPlatformUiFactory"/>
+
+ </extension>
+
+</plugin>
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/ExtensionTestPlugin.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/ExtensionTestPlugin.java
new file mode 100644
index 0000000000..ae5cd6e783
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/ExtensionTestPlugin.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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.core.tests.extension.resource;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class ExtensionTestPlugin extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.jpt.jpa.core.tests.extension.resource"; //$NON-NLS-1$
+
+ // The shared instance
+ private static ExtensionTestPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public ExtensionTestPlugin() {
+ super();
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static ExtensionTestPlugin getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestAttributeMapping.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestAttributeMapping.java
new file mode 100644
index 0000000000..e47d0ee7da
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestAttributeMapping.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.core.tests.extension.resource;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+
+public class JavaTestAttributeMapping
+ extends AbstractJavaAttributeMapping<Annotation>
+{
+ public static final String TEST_ATTRIBUTE_MAPPING_KEY = "testAttribute"; //$NON-NLS-1$
+ public static final String TEST_ATTRIBUTE_ANNOTATION_NAME = "test.TestAttribute"; //$NON-NLS-1$
+
+
+ public JavaTestAttributeMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ public String getKey() {
+ return JavaTestAttributeMapping.TEST_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected String getAnnotationName() {
+ return JavaTestAttributeMapping.TEST_ATTRIBUTE_ANNOTATION_NAME;
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestAttributeMappingDefinition.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestAttributeMappingDefinition.java
new file mode 100644
index 0000000000..4b423d8912
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestAttributeMappingDefinition.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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.core.tests.extension.resource;
+
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+
+public class JavaTestAttributeMappingDefinition
+ implements JavaAttributeMappingDefinition
+{
+ // singleton
+ private static final JavaAttributeMappingDefinition INSTANCE = new JavaTestAttributeMappingDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static JavaAttributeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaTestAttributeMappingDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return JavaTestAttributeMapping.TEST_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return JavaTestAttributeMapping.TEST_ATTRIBUTE_ANNOTATION_NAME;
+ }
+
+ public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return EmptyIterable.instance();
+ }
+
+ public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
+ return ((TestJpaFactory) factory).buildJavaTestAttributeMapping(persistentAttribute);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestTypeMapping.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestTypeMapping.java
new file mode 100644
index 0000000000..469d58dd2a
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestTypeMapping.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.core.tests.extension.resource;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaTypeMapping;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+
+public class JavaTestTypeMapping
+ extends AbstractJavaTypeMapping<Annotation>
+{
+ public static final String TEST_TYPE_MAPPING_KEY = "test"; //$NON-NLS-1$
+ public static final String TEST_TYPE_ANNOTATION_NAME = "test.Test"; //$NON-NLS-1$
+
+
+ public JavaTestTypeMapping(JavaPersistentType parent) {
+ super(parent, null);
+ }
+
+ public String getKey() {
+ return TEST_TYPE_MAPPING_KEY;
+ }
+
+ public JavaPersistentType getIdClass() {
+ return null;
+ }
+
+ public boolean isMapped() {
+ return true;
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestTypeMappingDefinition.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestTypeMappingDefinition.java
new file mode 100644
index 0000000000..7313299580
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestTypeMappingDefinition.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.core.tests.extension.resource;
+
+import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.jpa.core.JpaFactory;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.resource.java.Annotation;
+
+public class JavaTestTypeMappingDefinition
+ implements JavaTypeMappingDefinition
+{
+ // singleton
+ private static final JavaTestTypeMappingDefinition INSTANCE = new JavaTestTypeMappingDefinition();
+
+ /**
+ * Return the singleton
+ */
+ public static JavaTypeMappingDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaTestTypeMappingDefinition() {
+ super();
+ }
+
+ public String getKey() {
+ return JavaTestTypeMapping.TEST_TYPE_MAPPING_KEY;
+ }
+
+ public String getAnnotationName() {
+ return JavaTestTypeMapping.TEST_TYPE_ANNOTATION_NAME;
+ }
+
+ public Iterable<String> getSupportingAnnotationNames() {
+ return EmptyIterable.instance();
+ }
+
+ public JavaTestTypeMapping buildMapping(JavaPersistentType persistentType, Annotation annotation, JpaFactory factory) {
+ return ((TestJpaFactory) factory).buildJavaTestTypeMapping(persistentType);
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJavaBasicMapping.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJavaBasicMapping.java
new file mode 100644
index 0000000000..c4ade4014e
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJavaBasicMapping.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * 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.core.tests.extension.resource;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBasicMapping;
+
+public class TestJavaBasicMapping
+ extends AbstractJavaBasicMapping
+{
+ public TestJavaBasicMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJavaEntity.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJavaEntity.java
new file mode 100644
index 0000000000..2aee63a1e2
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJavaEntity.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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.core.tests.extension.resource;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEntity;
+import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0;
+import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
+
+public class TestJavaEntity
+ extends AbstractJavaEntity
+{
+ protected TestJavaEntity(JavaPersistentType parent, EntityAnnotation mappingAnnotation) {
+ super(parent, mappingAnnotation);
+ }
+
+ public JavaCacheable2_0 getCacheable() {
+ return null;
+ }
+
+ public boolean calculateDefaultCacheable() {
+ return false;
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaFactory.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaFactory.java
new file mode 100644
index 0000000000..1fb3e08be3
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaFactory.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 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.core.tests.extension.resource;
+
+import org.eclipse.jpt.jpa.core.context.java.JavaBasicMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaFactory;
+import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
+
+public class TestJpaFactory
+ extends AbstractJpaFactory
+{
+ @Override
+ public JavaEntity buildJavaEntity(JavaPersistentType parent, EntityAnnotation entityAnnotation) {
+ return new TestJavaEntity(parent, entityAnnotation);
+ }
+
+ @Override
+ public JavaBasicMapping buildJavaBasicMapping(JavaPersistentAttribute parent) {
+ return new TestJavaBasicMapping(parent);
+ }
+
+ public JavaTestTypeMapping buildJavaTestTypeMapping(JavaPersistentType parent) {
+ return new JavaTestTypeMapping(parent);
+ }
+
+ public JavaTestAttributeMapping buildJavaTestAttributeMapping(JavaPersistentAttribute parent) {
+ return new JavaTestAttributeMapping(parent);
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java
new file mode 100644
index 0000000000..820c9a843a
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 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.core.tests.extension.resource;
+
+import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
+import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
+import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider;
+import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationProvider;
+import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
+import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion;
+
+/**
+ * All the state in the JPA platform should be "static" (i.e. unchanging once
+ * it is initialized).
+ */
+@SuppressWarnings("nls")
+public class TestJpaPlatformFactory
+ implements JpaPlatformFactory
+{
+ /**
+ * zero-argument constructor
+ */
+ public TestJpaPlatformFactory() {
+ super();
+ }
+
+
+ public JpaPlatform buildJpaPlatform(String id) {
+ return new GenericJpaPlatform(
+ id,
+ buildJpaVersion(),
+ new TestJpaFactory(),
+ new GenericJpaAnnotationProvider(GenericJpaAnnotationDefinitionProvider.instance()),
+ TestJpaPlatformProvider.instance(),
+ buildJpaPlatformVariation());
+ }
+
+ private JpaPlatform.Version buildJpaVersion() {
+ return new SimpleVersion(JpaFacet.VERSION_1_0.getVersionString()) {
+ @Override
+ public String getVersion() {
+ return "BOOOYAH!";
+ }
+ };
+ }
+
+ protected JpaPlatformVariation buildJpaPlatformVariation() {
+ return new JpaPlatformVariation() {
+ public Supported getTablePerConcreteClassInheritanceIsSupported() {
+ return Supported.MAYBE;
+ }
+ public boolean isJoinTableOverridable() {
+ return false;
+ }
+ };
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformProvider.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformProvider.java
new file mode 100644
index 0000000000..5a072bf5b1
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformProvider.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * 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.core.tests.extension.resource;
+
+import java.util.ArrayList;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.ResourceDefinition;
+import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaBasicMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddableDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaEntityDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaIdMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToManyMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToOneMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaMappedSuperclassDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToManyMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToOneMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaVersionMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
+
+public class TestJpaPlatformProvider extends AbstractJpaPlatformProvider
+{
+ public static final String ID = "core.testJpaPlatform"; //$NON-NLS-1$
+
+ // singleton
+ private static final JpaPlatformProvider INSTANCE = new TestJpaPlatformProvider();
+
+
+ /**
+ * Return the singleton.
+ */
+ public static JpaPlatformProvider instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private TestJpaPlatformProvider() {
+ super();
+ }
+
+
+ // ********** resource models **********
+
+ public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
+ if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
+ return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
+ }
+ else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
+ return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
+ }
+ else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
+ return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE;
+ }
+ else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) {
+ return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE;
+ }
+ else {
+ throw new IllegalArgumentException(contentType.toString());
+ }
+ }
+
+ @Override
+ protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
+ CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
+ }
+
+ // order should not be important here
+ protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] {
+ JavaResourceModelProvider.instance(),
+ JarResourceModelProvider.instance(),
+ PersistenceResourceModelProvider.instance(),
+ OrmResourceModelProvider.instance()
+ };
+
+
+ // ********** Java type mappings **********
+
+ @Override
+ protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS);
+ }
+
+ // order matches that used by the Reference Implementation (EclipseLink)
+ protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] {
+ JavaEntityDefinition.instance(),
+ JavaEmbeddableDefinition.instance(),
+ JavaMappedSuperclassDefinition.instance(),
+ JavaTestTypeMappingDefinition.instance() // added
+ };
+
+
+ // ********** Java attribute mappings **********
+
+ @Override
+ protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ }
+
+ // order matches that used by the Reference Implementation (EclipseLink)
+ protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] {
+ JavaEmbeddedMappingDefinition.instance(),
+ JavaBasicMappingDefinition.instance()
+ };
+ @Override
+ protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ }
+
+ // order matches that used by the Reference Implementation (EclipseLink)
+ protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] {
+ JavaTransientMappingDefinition.instance(),
+ JavaIdMappingDefinition.instance(),
+ JavaVersionMappingDefinition.instance(),
+ JavaBasicMappingDefinition.instance(),
+ JavaEmbeddedMappingDefinition.instance(),
+ JavaEmbeddedIdMappingDefinition.instance(),
+ JavaManyToManyMappingDefinition.instance(),
+ JavaManyToOneMappingDefinition.instance(),
+ JavaOneToManyMappingDefinition.instance(),
+ JavaOneToOneMappingDefinition.instance(),
+ JavaTestAttributeMappingDefinition.instance() // added
+ };
+
+
+ // ********** resource definitions **********
+
+ @Override
+ protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) {
+ CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS);
+ }
+
+ protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
+ GenericPersistenceXmlDefinition.instance(),
+ GenericOrmXmlDefinition.instance()
+ };
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformUiFactory.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformUiFactory.java
new file mode 100644
index 0000000000..32db21485c
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformUiFactory.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.core.tests.extension.resource;
+
+import org.eclipse.jpt.jpa.ui.JpaPlatformUi;
+import org.eclipse.jpt.jpa.ui.JpaPlatformUiFactory;
+import org.eclipse.jpt.jpa.ui.internal.GenericJpaPlatformUiProvider;
+import org.eclipse.jpt.jpa.ui.internal.platform.generic.GenericJpaPlatformUi;
+import org.eclipse.jpt.jpa.ui.internal.platform.generic.GenericNavigatorProvider;
+
+public class TestJpaPlatformUiFactory implements JpaPlatformUiFactory
+{
+
+ /**
+ * Zero arg constructor for extension point
+ */
+ public TestJpaPlatformUiFactory() {
+ super();
+ }
+
+ public JpaPlatformUi buildJpaPlatformUi() {
+ return new GenericJpaPlatformUi(
+ new GenericNavigatorProvider(),
+ GenericJpaPlatformUiProvider.instance());
+ }
+}

Back to the top