Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortle2012-04-02 18:58:58 -0400
committertle2012-04-02 18:58:58 -0400
commitd9ada50aaeac0e395b841702a8f7dc12567b11b2 (patch)
tree7a24a1612cd2ac0e905db97252dd0bb38eb37003
parent07d7b38b1f10a43231d2c0c2728c44875506b0e7 (diff)
downloadwebtools.dali-d9ada50aaeac0e395b841702a8f7dc12567b11b2.tar.gz
webtools.dali-d9ada50aaeac0e395b841702a8f7dc12567b11b2.tar.xz
webtools.dali-d9ada50aaeac0e395b841702a8f7dc12567b11b2.zip
Added preference metadata tests.
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferencesManager.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/META-INF/MANIFEST.MF2
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JptJpaCoreTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaEntityGenMetadataTests.java66
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaJpqlMetadataTests.java59
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaMetadataTests.java101
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaValidationMetadataTests.java83
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JptJpaCoreMetadataTests.java33
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/test.xml2
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/META-INF/MANIFEST.MF1
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/JptJpaEclipseLinkCoreTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/EclipseLinkStaticWeavingBuilderMetadataTests.java67
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/JptJpaEclipseLinkCoreMetadataTests.java32
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/test.xml4
14 files changed, 452 insertions, 4 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferencesManager.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferencesManager.java
index b53836e2dd..ef089ba576 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferencesManager.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferencesManager.java
@@ -266,7 +266,7 @@ public class JpaPreferencesManager
/**
* Return the legacy Dali (org.eclipse.jpt.core) preferences for the specified Eclipse project.
*/
- protected IEclipsePreferences getLegacyProjectPreferences() {
+ public IEclipsePreferences getLegacyProjectPreferences() {
return getLegacyPreferences(new ProjectScope(this.project));
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.jpa.core.tests/META-INF/MANIFEST.MF
index da2b60c37f..5ef2272139 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/META-INF/MANIFEST.MF
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/META-INF/MANIFEST.MF
@@ -11,6 +11,7 @@ Require-Bundle: org.eclipse.core.commands;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.emf.ecore.xmi;bundle-version="[2.4.0,3.0.0)",
org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.jdt.launching;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jem.util;bundle-version="[2.0.100,3.0.0)",
org.eclipse.jpt.common.core;bundle-version="[1.0.0,2.0.0)",
org.eclipse.jpt.common.core.tests;bundle-version="[1.0.0,2.0.0)",
@@ -36,6 +37,7 @@ Export-Package: org.eclipse.jpt.jpa.core.tests;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.jpa2.context.orm;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.jpa2.context.persistence;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.jpa2.resource.java;x-internal:=true,
+ org.eclipse.jpt.jpa.core.tests.internal.metadata;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.model;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.platform;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.projects;x-internal:=true,
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JptJpaCoreTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JptJpaCoreTests.java
index f6e3de9f6e..85e0c1a8a5 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JptJpaCoreTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JptJpaCoreTests.java
@@ -13,6 +13,7 @@ import java.io.File;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.jpt.jpa.core.tests.internal.context.JptJpaCoreContextModelTests;
+import org.eclipse.jpt.jpa.core.tests.internal.metadata.JptJpaCoreMetadataTests;
import org.eclipse.jpt.jpa.core.tests.internal.model.JptJpaCoreModelTests;
import org.eclipse.jpt.jpa.core.tests.internal.projects.TestJpaProject;
import org.eclipse.jpt.jpa.core.tests.internal.resource.JptJpaCoreResourceModelTests;
@@ -33,6 +34,7 @@ public class JptJpaCoreTests {
suite.addTest(JptJpaCoreModelTests.suite());
suite.addTest(JptJpaCoreResourceModelTests.suite());
suite.addTest(JptJpaCoreContextModelTests.suite());
+ suite.addTest(JptJpaCoreMetadataTests.suite());
return suite;
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaEntityGenMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaEntityGenMetadataTests.java
new file mode 100644
index 0000000000..e21c902e3f
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaEntityGenMetadataTests.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+* Copyright (c) 2012 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.internal.metadata;
+
+import junit.framework.Assert;
+
+import org.eclipse.jpt.jpa.core.prefs.JpaEntityGenPreferencesManager;
+
+/**
+ * JpaEntityGenMetadataTests
+ */
+public class JpaEntityGenMetadataTests extends JpaMetadataTests {
+
+ public static final String DEFAULT_PACKAGE_PREF_KEY = "entitygen.DEFAULT_PACKAGE"; //$NON-NLS-1$
+
+ public static final String DEFAULT_PACKAGE_TEST_VALUE = "test.model"; //$NON-NLS-1$
+
+ protected JpaEntityGenPreferencesManager projectPrefsManager;
+
+ // ********** constructor **********
+
+ public JpaEntityGenMetadataTests(String name) {
+ super(name);
+ }
+
+ // ********** overrides **********
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ this.projectPrefsManager = new JpaEntityGenPreferencesManager(this.getJavaProject().getProject());
+ Assert.assertNotNull(this.projectPrefsManager);
+ }
+
+ // ********** tests **********
+
+ public void testDefaultPackageWorkspaceMetadata() throws Exception {
+ JpaEntityGenPreferencesManager.setDefaultPackageWorkspacePreference(DEFAULT_PACKAGE_TEST_VALUE);
+ JpaEntityGenPreferencesManager.getLegacyWorkspacePreferences().flush();
+
+ String value = this.getWorkspacePrefs().get(DEFAULT_PACKAGE_PREF_KEY);
+ Assert.assertNotNull(value);
+ Assert.assertTrue(DEFAULT_PACKAGE_TEST_VALUE.equals(value));
+
+ JpaEntityGenPreferencesManager.removeLegacyWorkspacePreference(DEFAULT_PACKAGE_PREF_KEY);
+ }
+
+ public void testDefaultPackageProjectMetadata() throws Exception {
+
+ this.projectPrefsManager.setDefaultPackagePreference(DEFAULT_PACKAGE_TEST_VALUE);
+ this.projectPrefsManager.getLegacyProjectPreferences().flush();
+
+ String value = this.getProjectPrefs().get(DEFAULT_PACKAGE_PREF_KEY);
+ Assert.assertNotNull(value);
+ Assert.assertTrue(DEFAULT_PACKAGE_TEST_VALUE.equals(value));
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaJpqlMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaJpqlMetadataTests.java
new file mode 100644
index 0000000000..df1daea08d
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaJpqlMetadataTests.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+* Copyright (c) 2012 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.internal.metadata;
+
+import junit.framework.Assert;
+
+import org.eclipse.jpt.jpa.core.prefs.JpaEntityGenPreferencesManager;
+import org.eclipse.jpt.jpa.core.prefs.JpaJpqlPreferencesManager;
+
+/**
+ * JpaJpqlMetadataTests
+ */
+public class JpaJpqlMetadataTests extends JpaMetadataTests {
+
+ public static final String CASE_PREF_KEY = "jpqlIdentifier.CASE";
+ public static final String MATCH_FIRST_CHARACTER_CASE_PREF_KEY = "jpqlIdentifier.MATCH_FIRST_CHARACTER_CASE";
+
+ public static final String CASE_TEST_VALUE = JpaJpqlPreferencesManager.JPQL_IDENTIFIER_UPPERCASE_PREF_VALUE;
+ public static final boolean MATCH_FIRST_CHARACTER_CASE_TEST_VALUE = ! JpaJpqlPreferencesManager.DEFAULT_MATCH_FIRST_CHARACTER_CASE;
+
+ // ********** constructor **********
+
+ public JpaJpqlMetadataTests(String name) {
+ super(name);
+ }
+
+ // ********** tests **********
+
+ public void testIdentifiersCaseWorkspaceMetadata() throws Exception {
+ JpaJpqlPreferencesManager.setIdentifiersCaseWorkspacePreference(CASE_TEST_VALUE);
+ JpaJpqlPreferencesManager.getLegacyWorkspacePreferences().flush();
+
+ String value = this.getWorkspacePrefs().get(CASE_PREF_KEY);
+ Assert.assertNotNull(value);
+ Assert.assertTrue(CASE_TEST_VALUE.equals(value));
+
+ JpaEntityGenPreferencesManager.removeLegacyWorkspacePreference(CASE_PREF_KEY);
+ }
+
+ public void testMatchFirstCharacterCaseWorkspaceMetadata() throws Exception {
+ JpaJpqlPreferencesManager.setMatchFirstCharacterCaseWorkspacePreference(MATCH_FIRST_CHARACTER_CASE_TEST_VALUE);
+ JpaJpqlPreferencesManager.getLegacyWorkspacePreferences().flush();
+
+ String stringValue = this.getWorkspacePrefs().get(MATCH_FIRST_CHARACTER_CASE_PREF_KEY);
+ Assert.assertNotNull(stringValue);
+ boolean value = Boolean.valueOf(stringValue);
+ Assert.assertTrue(value == MATCH_FIRST_CHARACTER_CASE_TEST_VALUE);
+
+ JpaEntityGenPreferencesManager.removeLegacyWorkspacePreference(MATCH_FIRST_CHARACTER_CASE_PREF_KEY);
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaMetadataTests.java
new file mode 100644
index 0000000000..2997c41acc
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaMetadataTests.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+* Copyright (c) 2012 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.internal.metadata;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
+
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jpt.common.core.tests.internal.utility.jdt.AnnotationTestCase;
+import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+
+/**
+ * JpaMetadataTests
+ */
+public abstract class JpaMetadataTests extends AnnotationTestCase {
+
+ private static final String SETTINGS_DIR = ".settings/";
+ private static final String ECLIPSE_CORE_SETTINGS_DIR = ".metadata/.plugins/org.eclipse.core.runtime/" + SETTINGS_DIR;
+ public static final String PREFS_FILE_NAME = JptJpaCorePlugin.LEGACY_PLUGIN_ID + ".prefs";
+
+ protected IEclipsePreferences workspacePreferences;
+ private String eclipseCoreSettingsDir;
+ private String projectSettingsDir;
+
+ // ********** constructor **********
+
+ protected JpaMetadataTests(String name) {
+ super(name);
+ }
+
+ // ********** overrides **********
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ IPath workspacePath = this.getWorkspaceRoot().getLocation();
+ this.eclipseCoreSettingsDir = workspacePath + "/" + ECLIPSE_CORE_SETTINGS_DIR;
+
+ IPath projectPath = this.javaProject.getProject().getLocation();
+ this.projectSettingsDir = projectPath + "/" + SETTINGS_DIR;
+ }
+
+ // ********** preferences **********
+
+ protected Map<String, String> getWorkspacePrefs() {
+ return this.getSettings(this.eclipseCoreSettingsDir + PREFS_FILE_NAME);
+ }
+
+ protected Map<String, String> getProjectPrefs() {
+ return this.getSettings(this.projectSettingsDir + PREFS_FILE_NAME);
+ }
+
+ // ********** internal methods **********
+
+ private IWorkspaceRoot getWorkspaceRoot() {
+ return ResourcesPlugin.getWorkspace().getRoot();
+ }
+
+ private Map<String, String> getSettings(String settingsPath) {
+ Set<Entry<Object, Object>> settingsSet = null;
+ try {
+ settingsSet = this.loadMetadata(settingsPath);
+ }
+ catch (IOException e) {
+ throw new RuntimeException("Missing: " + settingsPath, e);
+ }
+
+ Map<String, String> settings = new HashMap<String, String>();
+ for(Entry<Object, Object> property : settingsSet) {
+ settings.put((String)property.getKey(), (String)property.getValue());
+ }
+ return settings;
+ }
+
+ private Set<Entry<Object, Object>> loadMetadata(String metadataPath) throws IOException {
+ FileInputStream stream = new FileInputStream(metadataPath);
+
+ Properties properties = new Properties();
+ properties.load(stream);
+ stream.close();
+
+ return properties.entrySet();
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaValidationMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaValidationMetadataTests.java
new file mode 100644
index 0000000000..00394e1e6f
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaValidationMetadataTests.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+* Copyright (c) 2012 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.internal.metadata;
+
+import junit.framework.Assert;
+
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.jpa.core.prefs.JpaValidationPreferencesManager;
+
+/**
+ * JpaValidationMetadataTests
+ */
+public class JpaValidationMetadataTests extends JpaMetadataTests {
+
+ public static final String WORKSPACE_OVERRIDEN_PREF_KEY = "workspace_preferences_overriden";
+ public static final String PERSISTENCE_NO_PERSISTENCE_UNIT_PREF_KEY = "problem." + JpaValidationMessages.PERSISTENCE_NO_PERSISTENCE_UNIT;
+
+ public static final boolean WORKSPACE_OVERRIDEN_TEST_VALUE = true;
+ public static final String PERSISTENCE_NO_PERSISTENCE_UNIT_TEST_VALUE = JpaValidationPreferencesManager.INFO;
+
+ protected JpaValidationPreferencesManager projectPrefsManager;
+
+ // ********** constructor **********
+
+ public JpaValidationMetadataTests(String name) {
+ super(name);
+ }
+
+ // ********** overrides **********
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ this.projectPrefsManager = new JpaValidationPreferencesManager(this.getJavaProject().getProject());
+ Assert.assertNotNull(this.projectPrefsManager);
+ }
+
+ // ********** tests **********
+
+ public void testWorkspaceLevelProblemMetadata() throws Exception {
+ JpaValidationPreferencesManager.setWorkspaceLevelProblemPreference(
+ JpaValidationMessages.PERSISTENCE_NO_PERSISTENCE_UNIT,
+ PERSISTENCE_NO_PERSISTENCE_UNIT_TEST_VALUE);
+ JpaValidationPreferencesManager.getLegacyWorkspacePreferences().flush();
+
+ String value = this.getWorkspacePrefs().get(PERSISTENCE_NO_PERSISTENCE_UNIT_PREF_KEY);
+ Assert.assertNotNull(value);
+ Assert.assertTrue(PERSISTENCE_NO_PERSISTENCE_UNIT_TEST_VALUE.equals(value));
+
+ JpaValidationPreferencesManager.removeLegacyWorkspacePreference(PERSISTENCE_NO_PERSISTENCE_UNIT_PREF_KEY);
+ }
+
+ public void testProjectHasSpecificOptionsMetadata() throws Exception {
+
+ this.projectPrefsManager.setProjectHasSpecificOptions(WORKSPACE_OVERRIDEN_TEST_VALUE);
+ this.projectPrefsManager.getLegacyProjectPreferences().flush();
+
+ String stringValue = this.getProjectPrefs().get(WORKSPACE_OVERRIDEN_PREF_KEY);
+ Assert.assertNotNull(stringValue);
+ boolean value = Boolean.valueOf(stringValue);
+ Assert.assertTrue(value == WORKSPACE_OVERRIDEN_TEST_VALUE);
+ }
+
+ public void testProjectLevelProblemMetadata() throws Exception {
+
+ this.projectPrefsManager.setProjectLevelProblemPreference(
+ JpaValidationMessages.PERSISTENCE_NO_PERSISTENCE_UNIT,
+ PERSISTENCE_NO_PERSISTENCE_UNIT_TEST_VALUE);
+ this.projectPrefsManager.getLegacyProjectPreferences().flush();
+
+ String value = this.getProjectPrefs().get(PERSISTENCE_NO_PERSISTENCE_UNIT_PREF_KEY);
+ Assert.assertNotNull(value);
+ Assert.assertTrue(PERSISTENCE_NO_PERSISTENCE_UNIT_TEST_VALUE.equals(value));
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JptJpaCoreMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JptJpaCoreMetadataTests.java
new file mode 100644
index 0000000000..41ba644d5c
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JptJpaCoreMetadataTests.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+* Copyright (c) 2012 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.internal.metadata;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * JptJpaCoreMetadataTests
+ */
+public class JptJpaCoreMetadataTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(JptJpaCoreMetadataTests.class.getPackage().getName());
+ suite.addTestSuite(JpaEntityGenMetadataTests.class);
+ suite.addTestSuite(JpaJpqlMetadataTests.class);
+ suite.addTestSuite(JpaValidationMetadataTests.class);
+ return suite;
+ }
+
+ private JptJpaCoreMetadataTests() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/test.xml b/jpa/tests/org.eclipse.jpt.jpa.core.tests/test.xml
index 18b64a4abe..2188dfd2f6 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/test.xml
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/test.xml
@@ -21,7 +21,7 @@
</target>
<!-- This target defines the tests that need to be run. -->
- <target name="suite1"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.core.tests.internal.model.JptJpaCoreModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> </ant> </target> <target name="suite2"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.core.tests.internal.resource.JptJpaCoreResourceModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar}"/> </ant> </target> <target name="suite3"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.core.tests.internal.context.JptJpaCoreContextModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar}"/> </ant> </target>
+ <target name="suite1"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.core.tests.internal.model.JptJpaCoreModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> </ant> </target> <target name="suite2"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.core.tests.internal.resource.JptJpaCoreResourceModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar}"/> </ant> </target> <target name="suite3"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.core.tests.internal.context.JptJpaCoreContextModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar}"/> </ant> </target> <target name="suite4"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.core.tests.internal.metadata.JptJpaCoreMetadataTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar}"/> </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. -->
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/META-INF/MANIFEST.MF
index 1ed964b5fb..9fe3acc778 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/META-INF/MANIFEST.MF
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/META-INF/MANIFEST.MF
@@ -28,5 +28,6 @@ Export-Package: org.eclipse.jpt.jpa.eclipselink.core.tests.internal;x-internal:=
org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.java;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.orm;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.persistence;x-internal:=true,
+ org.eclipse.jpt.jpa.eclipselink.core.tests.internal.metadata;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.core.tests.internal.resource;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.core.tests.internal.resource.java;x-internal:=true
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/JptJpaEclipseLinkCoreTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/JptJpaEclipseLinkCoreTests.java
index d64454a021..97d7891e9c 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/JptJpaEclipseLinkCoreTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/JptJpaEclipseLinkCoreTests.java
@@ -14,6 +14,7 @@ import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.jpt.jpa.core.tests.internal.projects.TestJpaProject;
import org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.JptJpaEclipseLinkCoreContextModelTests;
+import org.eclipse.jpt.jpa.eclipselink.core.tests.internal.metadata.JptJpaEclipseLinkCoreMetadataTests;
import org.eclipse.jpt.jpa.eclipselink.core.tests.internal.resource.JptJpaEclipselinkCoreResourceModelTests;
/**
@@ -33,6 +34,7 @@ public class JptJpaEclipseLinkCoreTests
TestSuite suite = new TestSuite(JptJpaEclipseLinkCoreTests.class.getPackage().getName());
suite.addTest(JptJpaEclipselinkCoreResourceModelTests.suite());
suite.addTest(JptJpaEclipseLinkCoreContextModelTests.suite());
+ suite.addTest(JptJpaEclipseLinkCoreMetadataTests.suite());
return suite;
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/EclipseLinkStaticWeavingBuilderMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/EclipseLinkStaticWeavingBuilderMetadataTests.java
new file mode 100644
index 0000000000..764927f336
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/EclipseLinkStaticWeavingBuilderMetadataTests.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+* Copyright (c) 2012 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.eclipselink.core.tests.internal.metadata;
+
+import junit.framework.Assert;
+
+import org.eclipse.jpt.jpa.core.tests.internal.metadata.JpaMetadataTests;
+import org.eclipse.jpt.jpa.eclipselink.core.builder.StaticWeavingBuilderConfigurator;
+
+/**
+ * JpaStaticWeavingBuilderMetadataTests
+ */
+public class EclipseLinkStaticWeavingBuilderMetadataTests extends JpaMetadataTests {
+
+ public static final String SOURCE_PREF_KEY = "staticweave.SOURCE"; //$NON-NLS-1$
+ public static final String LOG_LEVEL_PREF_KEY = "staticweave.LOG_LEVEL"; //$NON-NLS-1$
+
+ public static final String SOURCE_TEST_VALUE = "bin"; //$NON-NLS-1$
+ public static final String LOG_LEVEL_TEST_VALUE = "ALL"; //$NON-NLS-1$
+
+ protected StaticWeavingBuilderConfigurator projectPrefsManager;
+
+ // ********** constructor **********
+
+ public EclipseLinkStaticWeavingBuilderMetadataTests(String name) {
+ super(name);
+ }
+
+ // ********** overrides **********
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ this.projectPrefsManager = new StaticWeavingBuilderConfigurator(this.getJavaProject().getProject());
+ Assert.assertNotNull(this.projectPrefsManager);
+ }
+
+ // ********** tests **********
+
+ public void testSourceLocationProjectMetadata() throws Exception {
+
+ this.projectPrefsManager.setSourceLocationPreference(SOURCE_TEST_VALUE);
+ this.projectPrefsManager.getLegacyProjectPreferences().flush();
+
+ String value = this.getProjectPrefs().get(SOURCE_PREF_KEY);
+ Assert.assertNotNull(value);
+ Assert.assertTrue(SOURCE_TEST_VALUE.equals(value));
+ }
+
+ public void testLogLevelProjectMetadata() throws Exception {
+
+ this.projectPrefsManager.setLogLevelPreference(LOG_LEVEL_TEST_VALUE);
+ this.projectPrefsManager.getLegacyProjectPreferences().flush();
+
+ String value = this.getProjectPrefs().get(LOG_LEVEL_PREF_KEY);
+ Assert.assertNotNull(value);
+ Assert.assertTrue(LOG_LEVEL_TEST_VALUE.equals(value));
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/JptJpaEclipseLinkCoreMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/JptJpaEclipseLinkCoreMetadataTests.java
new file mode 100644
index 0000000000..ce8adf5e40
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/JptJpaEclipseLinkCoreMetadataTests.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+* Copyright (c) 2012 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.eclipselink.core.tests.internal.metadata;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+/**
+ * JptJpaEclipseLinkCoreMetadataTests
+ */
+public class JptJpaEclipseLinkCoreMetadataTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(JptJpaEclipseLinkCoreMetadataTests.class.getPackage().getName());
+ suite.addTestSuite(EclipseLinkStaticWeavingBuilderMetadataTests.class);
+ return suite;
+ }
+
+ private JptJpaEclipseLinkCoreMetadataTests() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/test.xml b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/test.xml
index 9b3b5db533..b76008604b 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/test.xml
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/test.xml
@@ -34,8 +34,8 @@
<property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/>
<property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar} -Dorg.eclipse.jpt.eclipselink.jar=${testDir}/${jpt-eclipselink-jar}"/>
</ant>
- </target>
- <target name="suite2"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.JptJpaEclipseLinkCoreContextModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar} -Dorg.eclipse.jpt.eclipselink.jar=${testDir}/${jpt-eclipselink-jar}"/> </ant> </target>
+ </target>
+ <target name="suite2"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.JptJpaEclipseLinkCoreContextModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar} -Dorg.eclipse.jpt.eclipselink.jar=${testDir}/${jpt-eclipselink-jar}"/> </ant> </target> <target name="suite3"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.eclipselink.core.tests.internal.metadata.JptJpaEclipseLinkCoreMetadataTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar} -Dorg.eclipse.jpt.eclipselink.jar=${testDir}/${jpt-eclipselink-jar}"/> </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. -->

Back to the top