Author: sdzmitrovich
Date: 2009-06-29 02:51:59 -0400 (Mon, 29 Jun 2009)
New Revision: 16239
Added:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/.classpath
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/.project
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/.settings/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/.settings/org.eclipse.jdt.core.prefs
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/META-INF/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/META-INF/MANIFEST.MF
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/Activator.class
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/JBossRuntimeStartup.class
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/Messages.class
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/messages.properties
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/preferences/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/preferences/JBossRuntimePreferencesInitializer.class
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/runtimePaths.properties
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/build.properties
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/plugin.properties
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/plugin.xml
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/resources/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/resources/runtimePaths.properties
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/Activator.java
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/JBossRuntimeStartup.java
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/Messages.java
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/messages.properties
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/preferences/
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/preferences/JBossRuntimePreferencesInitializer.java
Log:
These settings will be preloaded before tests launch. We need them to create and run Seam
tests
Added: workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/.classpath
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/.classpath
(rev 0)
+++ workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/.classpath 2009-06-29 06:51:59
UTC (rev 16239)
@@ -0,0 +1,8 @@
+<?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"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="resources"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/.project
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/.project
(rev 0)
+++ workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/.project 2009-06-29 06:51:59
UTC (rev 16239)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.ui.runtime.auto.test</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>
Added:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/.settings/org.eclipse.jdt.core.prefs 2009-06-29
06:51:59 UTC (rev 16239)
@@ -0,0 +1,7 @@
+#Thu Dec 04 23:27:23 CET 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
Added: workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/META-INF/MANIFEST.MF
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/META-INF/MANIFEST.MF
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/META-INF/MANIFEST.MF 2009-06-29
06:51:59 UTC (rev 16239)
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %BundleName
+Bundle-SymbolicName: org.jboss.tools.ui.runtime.auto.test;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.tools.ui.runtime.auto.test.Activator
+Bundle-Vendor: %BundleVendor
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.jboss.tools.seam.core,
+ org.eclipse.ui,
+ org.eclipse.wst.server.core,
+ org.eclipse.jdt.launching,
+ org.eclipse.ui.workbench,
+ org.eclipse.datatools.connectivity;visibility:=reexport,
+ org.eclipse.datatools.connectivity.db.generic,
+ org.jboss.tools.common,
+ org.jboss.tools.ui.auto.test;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+
Added:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/Activator.class
===================================================================
(Binary files differ)
Property changes on:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/Activator.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/JBossRuntimeStartup.class
===================================================================
(Binary files differ)
Property changes on:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/JBossRuntimeStartup.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/Messages.class
===================================================================
(Binary files differ)
Property changes on:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/Messages.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/messages.properties
===================================================================
---
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/messages.properties
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/messages.properties 2009-06-29
06:51:59 UTC (rev 16239)
@@ -0,0 +1,11 @@
+JBossRuntimeStartup_Cannot_create_new_JBoss_Server=Can''t create new JBoss
Server
+JBossRuntimeStartup_Cannott_create_new_DTP_Connection_Profile=Can''t create new
DTP Connection Profile for JBoss AS Hypersonic embedded database
+JBossRuntimeStartup_Cannott_create_new_HSQL_DB_Driver=Can''t create new HSQL DB
Driver.
+JBossRuntimeStartup_JBoss_Application_Server_3_2=JBoss Application Server 3.2
+JBossRuntimeStartup_JBoss_Application_Server_4_0=JBoss Application Server 4.0
+JBossRuntimeStartup_JBoss_Application_Server_4_2=JBoss Application Server 4.2
+JBossRuntimeStartup_JBoss_Application_Server_5_0=JBoss Application Server 5.0
+JBossRuntimeStartup_JBoss_Application_Server_5_1=JBoss Application Server 5.1
+JBossRuntimeStartup_JBoss_EAP_Server_4_3=JBoss EAP Server 4.3
+JBossRuntimeStartup_Runtime=Runtime
+JBossRuntimeStartup_The_JBoss_AS_Hypersonic_embedded_database=The JBoss AS Hypersonic
embedded database
Added:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/preferences/JBossRuntimePreferencesInitializer.class
===================================================================
(Binary files differ)
Property changes on:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/org/jboss/tools/ui/runtime/auto/test/preferences/JBossRuntimePreferencesInitializer.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/runtimePaths.properties
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/runtimePaths.properties
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/bin/runtimePaths.properties 2009-06-29
06:51:59 UTC (rev 16239)
@@ -0,0 +1 @@
+JBossEap4.3=C\:/jbdevstudioRelease/jboss-eap/jboss-as
\ No newline at end of file
Added: workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/build.properties
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/build.properties
(rev 0)
+++ workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/build.properties 2009-06-29
06:51:59 UTC (rev 16239)
@@ -0,0 +1,6 @@
+source.. = src/,resources/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties
Added: workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/plugin.properties
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/plugin.properties
(rev 0)
+++ workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/plugin.properties 2009-06-29
06:51:59 UTC (rev 16239)
@@ -0,0 +1,3 @@
+#Properties file for org.jboss.tools.runtime
+BundleVendor = JBoss, a divison of Red Hat
+BundleName = JBoss Runtime Initializer
\ No newline at end of file
Added: workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/plugin.xml
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/plugin.xml
(rev 0)
+++ workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/plugin.xml 2009-06-29 06:51:59
UTC (rev 16239)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup
+
class="org.jboss.tools.ui.runtime.auto.test.JBossRuntimeStartup">
+ </startup>
+ </extension>
+
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
class="org.jboss.tools.ui.runtime.auto.test.preferences.JBossRuntimePreferencesInitializer"/>
+ </extension>
+
+</plugin>
Added:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/resources/runtimePaths.properties
===================================================================
---
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/resources/runtimePaths.properties
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/resources/runtimePaths.properties 2009-06-29
06:51:59 UTC (rev 16239)
@@ -0,0 +1 @@
+JBossEap4.3=C\:/jbdevstudioRelease/jboss-eap/jboss-as
\ No newline at end of file
Added:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/Activator.java
===================================================================
---
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/Activator.java
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/Activator.java 2009-06-29
06:51:59 UTC (rev 16239)
@@ -0,0 +1,52 @@
+package org.jboss.tools.ui.runtime.auto.test;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.ui.runtime.auto.test";
//$NON-NLS-1$
+
+ public static final String FIRST_START = "firstStart"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Added:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/JBossRuntimeStartup.java
===================================================================
---
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/JBossRuntimeStartup.java
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/JBossRuntimeStartup.java 2009-06-29
06:51:59 UTC (rev 16239)
@@ -0,0 +1,320 @@
+package org.jboss.tools.ui.runtime.auto.test;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.datatools.connectivity.ConnectionProfileConstants;
+import org.eclipse.datatools.connectivity.ConnectionProfileException;
+import org.eclipse.datatools.connectivity.ProfileManager;
+import org.eclipse.datatools.connectivity.db.generic.IDBConnectionProfileConstants;
+import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants;
+import org.eclipse.datatools.connectivity.drivers.DriverInstance;
+import org.eclipse.datatools.connectivity.drivers.DriverManager;
+import org.eclipse.datatools.connectivity.drivers.IDriverMgmtConstants;
+import org.eclipse.datatools.connectivity.drivers.IPropertySet;
+import org.eclipse.datatools.connectivity.drivers.PropertySetImpl;
+import org.eclipse.datatools.connectivity.drivers.models.TemplateDescriptor;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.ui.IStartup;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
+import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
+
+@SuppressWarnings("restriction")
+public class JBossRuntimeStartup implements IStartup {
+
+ private static final String RUNTIME = Messages.JBossRuntimeStartup_Runtime;
+
+ public static String JBOSS_EAP_HOME; // JBoss AS home directory (relative to plugin)-
<RHDS_HOME>/jbossas. //$NON-NLS-1$
+
+ private static final String RUNTIME_PROPERTIES = "runtimePaths.properties";
+
+ static{
+ try {
+ InputStream inputStream =
Platform.getBundle(Activator.PLUGIN_ID).getResource(RUNTIME_PROPERTIES).openStream();
+ Properties properties = new Properties();
+ properties.load(inputStream);
+ JBOSS_EAP_HOME = System.getProperty("jbosstools.test.jboss.home.eap",
properties.getProperty("JBossEap4.3"));
+ } catch (IOException e) {
+ IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Can't load
properties from " + RUNTIME_PROPERTIES + " file", e);
+ Activator.getDefault().getLog().log(status);
+ e.printStackTrace();
+ } catch (IllegalStateException e) {
+ IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Property file
" + RUNTIME_PROPERTIES + " was not found", e);
+ Activator.getDefault().getLog().log(status);
+ e.printStackTrace();
+ }
+ }
+
+ // This constants are made to avoid dependency with org.jboss.ide.eclipse.as.core
plugin
+ public static final String JBOSS_AS_RUNTIME_TYPE_ID[] = {
+ "org.jboss.ide.eclipse.as.runtime.32", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.40", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.42", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.50", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.eap.43" //$NON-NLS-1$
+ };
+
+ public static final String JBOSS_AS_TYPE_ID[] = {
+ "org.jboss.ide.eclipse.as.32", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.40", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.42", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.50", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.eap.43" //$NON-NLS-1$
+ };
+
+ public static final String JBOSS_AS_NAME[] = {
+ Messages.JBossRuntimeStartup_JBoss_Application_Server_3_2,
+ Messages.JBossRuntimeStartup_JBoss_Application_Server_4_0,
+ Messages.JBossRuntimeStartup_JBoss_Application_Server_4_2,
+ Messages.JBossRuntimeStartup_JBoss_Application_Server_5_0,
+ Messages.JBossRuntimeStartup_JBoss_EAP_Server_4_3
+ };
+
+ public static final String JBOSS_AS_HOST = "localhost"; //$NON-NLS-1$
+
+ public static final String JBOSS_AS_DEFAULT_CONFIGURATION_NAME = "default";
//$NON-NLS-1$
+
+ //public static final String FIRST_START_PREFERENCE_NAME = "FIRST_START";
+
+ public static final String HSQL_DRIVER_DEFINITION_ID
+ = "DriverDefn.Hypersonic DB"; //$NON-NLS-1$
+
+ public static final String HSQL_DRIVER_NAME = "Hypersonic DB"; //$NON-NLS-1$
+
+ public static final String HSQL_DRIVER_TEMPLATE_ID
+ = "org.eclipse.datatools.enablement.hsqldb.1_8.driver"; //$NON-NLS-1$
+
+ public static final String DTP_DB_URL_PROPERTY_ID
+ = "org.eclipse.datatools.connectivity.db.URL"; //$NON-NLS-1$
+
+
+ public void earlyStartup() {
+ boolean firstStart =
Activator.getDefault().getPreferenceStore().getBoolean(Activator.FIRST_START);
+ if (!firstStart) {
+ return;
+ }
+ Activator.getDefault().getPreferenceStore().setValue(Activator.FIRST_START, false);
+ File jbossASDir = new File(JBOSS_EAP_HOME);
+ createJBossServer(jbossASDir,4, "jboss-eap", "jboss-eap " +
RUNTIME); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+
+ private void createJBossServer(File asLocation, int index, String name, String
runtimeName) {
+ if (!asLocation.isDirectory()) {
+ return;
+ }
+ IPath jbossAsLocationPath = new Path(asLocation.getAbsolutePath());
+
+ IServer[] servers = ServerCore.getServers();
+ for (int i = 0; i < servers.length; i++) {
+ IRuntime runtime = servers[i].getRuntime();
+ if(runtime != null && runtime.getLocation().equals(jbossAsLocationPath)) {
+ return;
+ }
+ }
+
+ IRuntime runtime = null;
+ IRuntime[] runtimes = ServerCore.getRuntimes();
+ for (int i = 0; i < runtimes.length; i++) {
+ if (runtimes[0].getLocation().equals(jbossAsLocationPath)) {
+ runtime = runtimes[0].createWorkingCopy();
+ break;
+ }
+ }
+
+ IProgressMonitor progressMonitor = new NullProgressMonitor();
+ try {
+ if (runtime == null) {
+ runtime = createRuntime(runtimeName, asLocation.getAbsolutePath(), progressMonitor,
index);
+ }
+ if (runtime != null) {
+ createServer(progressMonitor, runtime, index, name);
+ }
+
+ createDriver(asLocation.getAbsolutePath());
+ } catch (CoreException e) {
+ log(e,Messages.JBossRuntimeStartup_Cannot_create_new_JBoss_Server);
+ } catch (ConnectionProfileException e) {
+ log(e,Messages.JBossRuntimeStartup_Cannot_create_new_DTP_Connection_Profile);
+ }
+ }
+
+ private static void log(Throwable e, String message) {
+ IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message, e);
+ Activator.getDefault().getLog().log(status);
+ }
+
+ /**
+ * Creates new JBoss AS Runtime, Server and hsqldb driver
+ * @param jbossASLocation location of JBoss Server
+ * @param progressMonitor to report progress
+ * @return server working copy
+ * @throws CoreException
+ * @throws ConnectionProfileException
+ */
+ public static IServerWorkingCopy initJBossAS(String jbossASLocation, IProgressMonitor
progressMonitor) throws CoreException, ConnectionProfileException {
+ IRuntime runtime = createRuntime(null, jbossASLocation, progressMonitor, 2);
+ IServerWorkingCopy server = null;
+ if (runtime != null) {
+ server = createServer(progressMonitor, runtime, 2, null);
+ }
+ createDriver(jbossASLocation);
+ return server;
+ }
+
+ /**
+ * Creates new JBoss AS Runtime
+ * @param jbossASLocation location of JBoss AS
+ * @param progressMonitor
+ * @return runtime working copy
+ * @throws CoreException
+ */
+ private static IRuntime createRuntime(String runtimeName, String jbossASLocation,
IProgressMonitor progressMonitor, int index) throws CoreException {
+ IRuntimeWorkingCopy runtime = null;
+ String type = null;
+ String version = null;
+ String runtimeId = null;
+ IPath jbossAsLocationPath = new Path(jbossASLocation);
+ IRuntimeType[] runtimeTypes = ServerUtil.getRuntimeTypes(type, version,
JBOSS_AS_RUNTIME_TYPE_ID[index]);
+ if (runtimeTypes.length > 0) {
+ runtime = runtimeTypes[0].createRuntime(runtimeId, progressMonitor);
+ runtime.setLocation(jbossAsLocationPath);
+ if(runtimeName!=null) {
+ runtime.setName(runtimeName);
+ }
+ IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall();
+ // IJBossServerRuntime.PROPERTY_VM_ID
+ ((RuntimeWorkingCopy) runtime).setAttribute("PROPERTY_VM_ID",
defaultVM.getId()); //$NON-NLS-1$
+ // IJBossServerRuntime.PROPERTY_VM_TYPE_ID
+ ((RuntimeWorkingCopy) runtime).setAttribute("PROPERTY_VM_TYPE_ID",
defaultVM.getVMInstallType().getId()); //$NON-NLS-1$
+ // IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME
+ ((RuntimeWorkingCopy)
runtime).setAttribute("org.jboss.ide.eclipse.as.core.runtime.configurationName",
JBOSS_AS_DEFAULT_CONFIGURATION_NAME); //$NON-NLS-1$
+
+ return runtime.save(false, progressMonitor);
+ }
+ return runtime;
+ }
+
+ /**
+ * Creates new JBoss Server
+ * @param progressMonitor
+ * @param runtime parent JBoss AS Runtime
+ * @return server working copy
+ * @throws CoreException
+ */
+ private static IServerWorkingCopy createServer(IProgressMonitor progressMonitor,
IRuntime runtime, int index, String name) throws CoreException {
+ IServerType serverType = ServerCore.findServerType(JBOSS_AS_TYPE_ID[index]);
+ IServerWorkingCopy server = serverType.createServer(null, null, runtime,
progressMonitor);
+
+ server.setHost(JBOSS_AS_HOST);
+ if(name != null)
+ server.setName(name);
+ else
+ server.setName(JBOSS_AS_NAME[index]);
+
+ // JBossServer.DEPLOY_DIRECTORY
+ String deployVal =
runtime.getLocation().append("server").append(JBOSS_AS_DEFAULT_CONFIGURATION_NAME).append("deploy").toOSString();
//$NON-NLS-1$ //$NON-NLS-2$
+ ((ServerWorkingCopy)
server).setAttribute("org.jboss.ide.eclipse.as.core.server.deployDirectory",
deployVal); //$NON-NLS-1$
+
+ // IDeployableServer.TEMP_DEPLOY_DIRECTORY
+ String deployTmpFolderVal =
runtime.getLocation().append("server").append(JBOSS_AS_DEFAULT_CONFIGURATION_NAME).append("tmp").append("jbosstoolsTemp").toOSString();
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ((ServerWorkingCopy)
server).setAttribute("org.jboss.ide.eclipse.as.core.server.tempDeployDirectory",
deployTmpFolderVal); //$NON-NLS-1$
+
+ // If we'd need to set up a username / pw for JMX, do it here.
+// ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_USERNAME, authUser);
+// ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_PASSWORD, authPass);
+
+ server.save(false, progressMonitor);
+ return server;
+ }
+
+ private static boolean driverIsCreated = false;
+
+ /**
+ * Creates HSQL DB Driver
+ * @param jbossASLocation location of JBoss AS
+ * @throws ConnectionProfileException
+ * @return driver instance
+ */
+ private static void createDriver(String jbossASLocation) throws
ConnectionProfileException {
+ if(driverIsCreated) {
+ // Don't create the driver a few times
+ return;
+ }
+ String driverPath;
+ try {
+ driverPath = new File(jbossASLocation +
"/server/default/lib/hsqldb.jar").getCanonicalPath(); //$NON-NLS-1$
+ } catch (IOException e) {
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR,
+ Activator.PLUGIN_ID, Messages.JBossRuntimeStartup_Cannot_create_new_HSQL_DB_Driver,
e));
+ return;
+ }
+
+ DriverInstance driver =
DriverManager.getInstance().getDriverInstanceByName(HSQL_DRIVER_NAME);
+ if (driver == null) {
+ TemplateDescriptor descr =
TemplateDescriptor.getDriverTemplateDescriptor(HSQL_DRIVER_TEMPLATE_ID);
+ IPropertySet instance = new PropertySetImpl(HSQL_DRIVER_NAME,
HSQL_DRIVER_DEFINITION_ID);
+ instance.setName(HSQL_DRIVER_NAME);
+ instance.setID(HSQL_DRIVER_DEFINITION_ID);
+ Properties props = new Properties();
+
+ IConfigurationElement[] template = descr.getProperties();
+ for (int i = 0; i < template.length; i++) {
+ IConfigurationElement prop = template[i];
+ String id = prop.getAttribute("id"); //$NON-NLS-1$
+
+ String value = prop.getAttribute("value"); //$NON-NLS-1$
+ props.setProperty(id, value == null ? "" : value); //$NON-NLS-1$
+ }
+ props.setProperty(DTP_DB_URL_PROPERTY_ID, "jdbc:hsqldb:."); //$NON-NLS-1$
+ props.setProperty(IDriverMgmtConstants.PROP_DEFN_TYPE, descr.getId());
+ props.setProperty(IDriverMgmtConstants.PROP_DEFN_JARLIST, driverPath);
+
+ instance.setBaseProperties(props);
+ DriverManager.getInstance().removeDriverInstance(instance.getID());
+ System.gc();
+ DriverManager.getInstance().addDriverInstance(instance);
+ }
+
+ driver = DriverManager.getInstance().getDriverInstanceByName(HSQL_DRIVER_NAME);
+ if (driver != null &&
ProfileManager.getInstance().getProfileByName("DefaultDS") == null) {
//$NON-NLS-1$
+ // create profile
+ Properties props = new Properties();
+ props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID,
HSQL_DRIVER_DEFINITION_ID);
+ props.setProperty(IDBConnectionProfileConstants.CONNECTION_PROPERTIES_PROP_ID,
""); //$NON-NLS-1$
+ props.setProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID,
driver.getProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID));
+ props.setProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID));
+ props.setProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID,
driver.getProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID));
+ props.setProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID,
"Default"); //$NON-NLS-1$
+ props.setProperty(IDBDriverDefinitionConstants.PASSWORD_PROP_ID, "");
//$NON-NLS-1$
+ props.setProperty(IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID,
"false"); //$NON-NLS-1$
+ props.setProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID,
driver.getProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID));
+ props.setProperty(IDBDriverDefinitionConstants.URL_PROP_ID,
driver.getProperty(IDBDriverDefinitionConstants.URL_PROP_ID));
+
+ ProfileManager.getInstance().createProfile("DefaultDS", Messages.JBossRuntimeStartup_The_JBoss_AS_Hypersonic_embedded_database,
IDBConnectionProfileConstants.CONNECTION_PROFILE_ID, props, "", false);
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ if(driver!=null) {
+ driverIsCreated = true;
+ }
+ }
+
+}
\ No newline at end of file
Added:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/Messages.java
===================================================================
---
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/Messages.java
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/Messages.java 2009-06-29
06:51:59 UTC (rev 16239)
@@ -0,0 +1,24 @@
+package org.jboss.tools.ui.runtime.auto.test;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME =
"org.jboss.tools.ui.runtime.auto.test.messages"; //$NON-NLS-1$
+ public static String JBossRuntimeStartup_Cannot_create_new_JBoss_Server;
+ public static String JBossRuntimeStartup_Cannot_create_new_DTP_Connection_Profile;
+ public static String JBossRuntimeStartup_Cannot_create_new_HSQL_DB_Driver;
+ public static String JBossRuntimeStartup_JBoss_Application_Server_3_2;
+ public static String JBossRuntimeStartup_JBoss_Application_Server_4_0;
+ public static String JBossRuntimeStartup_JBoss_Application_Server_4_2;
+ public static String JBossRuntimeStartup_JBoss_Application_Server_5_0;
+ public static String JBossRuntimeStartup_JBoss_EAP_Server_4_3;
+ public static String JBossRuntimeStartup_Runtime;
+ public static String JBossRuntimeStartup_The_JBoss_AS_Hypersonic_embedded_database;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
Added:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/messages.properties
===================================================================
---
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/messages.properties
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/messages.properties 2009-06-29
06:51:59 UTC (rev 16239)
@@ -0,0 +1,11 @@
+JBossRuntimeStartup_Cannot_create_new_JBoss_Server=Can''t create new JBoss
Server
+JBossRuntimeStartup_Cannott_create_new_DTP_Connection_Profile=Can''t create new
DTP Connection Profile for JBoss AS Hypersonic embedded database
+JBossRuntimeStartup_Cannott_create_new_HSQL_DB_Driver=Can''t create new HSQL DB
Driver.
+JBossRuntimeStartup_JBoss_Application_Server_3_2=JBoss Application Server 3.2
+JBossRuntimeStartup_JBoss_Application_Server_4_0=JBoss Application Server 4.0
+JBossRuntimeStartup_JBoss_Application_Server_4_2=JBoss Application Server 4.2
+JBossRuntimeStartup_JBoss_Application_Server_5_0=JBoss Application Server 5.0
+JBossRuntimeStartup_JBoss_Application_Server_5_1=JBoss Application Server 5.1
+JBossRuntimeStartup_JBoss_EAP_Server_4_3=JBoss EAP Server 4.3
+JBossRuntimeStartup_Runtime=Runtime
+JBossRuntimeStartup_The_JBoss_AS_Hypersonic_embedded_database=The JBoss AS Hypersonic
embedded database
Added:
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/preferences/JBossRuntimePreferencesInitializer.java
===================================================================
---
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/preferences/JBossRuntimePreferencesInitializer.java
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.runtime.auto.test/src/org/jboss/tools/ui/runtime/auto/test/preferences/JBossRuntimePreferencesInitializer.java 2009-06-29
06:51:59 UTC (rev 16239)
@@ -0,0 +1,19 @@
+package org.jboss.tools.ui.runtime.auto.test.preferences;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.jboss.tools.ui.runtime.auto.test.Activator;
+
+@SuppressWarnings("deprecation")
+public class JBossRuntimePreferencesInitializer extends
+ AbstractPreferenceInitializer {
+
+ @Override
+ public void initializeDefaultPreferences() {
+ Preferences preferences = Activator.getDefault().getPluginPreferences();
+ preferences.setDefault(
+ Activator.FIRST_START,
+ true);
+ }
+
+}