Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/PreferencesTests.java25
-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/plugin/JptJpaEclipseLinkCoreTestsPlugin.java57
3 files changed, 63 insertions, 20 deletions
diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/PreferencesTests.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/PreferencesTests.java
index 17c1b293b4..3b0434c7d4 100644
--- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/PreferencesTests.java
+++ b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/PreferencesTests.java
@@ -10,8 +10,6 @@
package org.eclipse.jpt.common.core.tests;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
import java.util.Properties;
import junit.framework.TestCase;
import org.eclipse.core.resources.IProject;
@@ -87,38 +85,25 @@ public abstract class PreferencesTests
return this.javaProjectHarness.getProject();
}
- protected Properties readProjectPrefs() {
+ protected Properties readProjectPrefs() throws Exception {
return this.readProperties(this.projectPrefsFilePath);
}
- protected Properties readWorkspacePrefs() {
+ protected Properties readWorkspacePrefs() throws Exception {
return this.readProperties(this.workspacePrefsFilePath);
}
/**
* read preferences directly from file
*/
- protected Properties readProperties(String path) {
+ protected Properties readProperties(String path) throws Exception {
Properties properties = new Properties();
- FileInputStream stream;
- try {
- stream = new FileInputStream(path);
- } catch (FileNotFoundException ex) {
- throw new RuntimeException(ex);
- }
-
+ FileInputStream stream = new FileInputStream(path);
try {
properties.load(stream);
- } catch (IOException ex) {
- throw new RuntimeException(ex);
} finally {
- try {
- stream.close();
- } catch (IOException ex) {
- throw new RuntimeException(ex);
- }
+ stream.close();
}
-
return properties;
}
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 1c444422ef..c73f26aa7b 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
@@ -4,6 +4,7 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.jpa.eclipselink.core.tests;singleton:=true
Bundle-Version: 2.3.0.qualifier
+Bundle-Activator: org.eclipse.jpt.jpa.eclipselink.core.tests.internal.plugin.JptJpaEclipseLinkCoreTestsPlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Localization: plugin
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/plugin/JptJpaEclipseLinkCoreTestsPlugin.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/plugin/JptJpaEclipseLinkCoreTestsPlugin.java
new file mode 100644
index 0000000000..ad93244d89
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/plugin/JptJpaEclipseLinkCoreTestsPlugin.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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.plugin;
+
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+
+/**
+ * Configure the core for testing:<ul>
+ * <li>do not flush preferences
+ * </ul>
+ * The WTP build executes
+ * {@link org.eclipse.jpt.jpa.eclipselink.core.tests.internal.JptJpaEclipseLinkCoreMiscTests}
+ * standalone
+ * (as opposed to within
+ * {@link org.eclipse.jpt.jpa.eclipselink.core.tests.internal.JptJpaEclipseLinkCoreTests}).
+ * As a result, the
+ * {@link org.eclipse.jpt.jpa.core.tests.internal.plugin.JptJpaCoreTestsPlugin}
+ * is not loaded (as it is when executing
+ * {@link org.eclipse.jpt.jpa.eclipselink.core.tests.internal.JptJpaEclipseLinkCoreTests}).
+ * So we need to stop preference flushes {@link #start_() here} also.
+ */
+public class JptJpaEclipseLinkCoreTestsPlugin
+ extends JptPlugin
+{
+ // ********** singleton **********
+
+ private static JptJpaEclipseLinkCoreTestsPlugin INSTANCE;
+
+ public static JptJpaEclipseLinkCoreTestsPlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** Dali plug-in **********
+
+ public JptJpaEclipseLinkCoreTestsPlugin() {
+ super();
+ }
+
+ @Override
+ protected void start_() throws Exception {
+ super.start_();
+ JptPlugin.FlushPreferences = false;
+ }
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptJpaEclipseLinkCoreTestsPlugin) plugin;
+ }
+}

Back to the top