Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 237428 Details for
Bug 421595
JavaFX toolkit support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Added necessary classes to support JavaFX-Toolkit
JavaFXSupportPatchV2.patch (text/plain), 39.40 KB, created by
Marcel Hein
on 2013-11-13 08:56:01 EST
(
hide
)
Description:
Added necessary classes to support JavaFX-Toolkit
Filename:
MIME Type:
Creator:
Marcel Hein
Created:
2013-11-13 08:56:01 EST
Size:
39.40 KB
patch
obsolete
>diff --git a/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/AbstractStartJavaAut.java b/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/AbstractStartJavaAut.java >index f8736ac..ff95992 100644 >--- a/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/AbstractStartJavaAut.java >+++ b/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/AbstractStartJavaAut.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2010 BREDEX GmbH. >+ * Copyright (c) 2004, 2010, 2013 BREDEX GmbH. > * 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 >@@ -190,7 +190,7 @@ public abstract class AbstractStartJavaAut extends AbstractStartToolkitAut { > * @param parameters The parameters for starting the AUT. > * @return the main class > */ >- private String getMainClassFromManifest(Map parameters) { >+ protected String getMainClassFromManifest(Map parameters) { > String jarFile = createAbsoluteJarPath(parameters); > return getAttributeFromManifest("main-class", jarFile); //$NON-NLS-1$ > } >@@ -201,7 +201,7 @@ public abstract class AbstractStartJavaAut extends AbstractStartToolkitAut { > * @return the String value of the specified attribute name, or null if > * not found. > */ >- private String getAttributeFromManifest( >+ protected String getAttributeFromManifest( > String attributeName, String jarFile) { > > if (jarFile == null || jarFile.length() < 1) { >@@ -229,7 +229,7 @@ public abstract class AbstractStartJavaAut extends AbstractStartToolkitAut { > * @param parameters The parameters for starting the AUT. > * @return the absolute path to the AUT jar file or null. > */ >- private String createAbsoluteJarPath(Map parameters) { >+ protected String createAbsoluteJarPath(Map parameters) { > File workingDir = getWorkingDir(parameters); > String jarPath = (String)parameters.get(AutConfigConstants.JAR_FILE); > if (jarPath != null && jarPath.length() > 0) { >diff --git a/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/AbstractStartJavaAutServer.java b/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/AbstractStartJavaAutServer.java >new file mode 100644 >index 0000000..cdebf0e >--- /dev/null >+++ b/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/AbstractStartJavaAutServer.java >@@ -0,0 +1,308 @@ >+/******************************************************************************* >+ * Copyright (c) 2013 BREDEX GmbH. >+ * 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: >+ * BREDEX GmbH - initial API and implementation and/or initial documentation >+ *******************************************************************************/ >+package org.eclipse.jubula.autagent.commands; >+ >+import java.io.File; >+import java.io.FilenameFilter; >+import java.util.Arrays; >+import java.util.List; >+import java.util.Locale; >+import java.util.Map; >+import java.util.StringTokenizer; >+import java.util.Vector; >+ >+import org.eclipse.jubula.autagent.AutStarter; >+import org.eclipse.jubula.tools.constants.AutConfigConstants; >+import org.eclipse.jubula.tools.constants.CommandConstants; >+import org.eclipse.jubula.tools.constants.StringConstants; >+import org.slf4j.Logger; >+import org.slf4j.LoggerFactory; >+ >+/** >+ * Upperclass for the JavaFX and SwingStart Server Command classes. >+ * This was created because the AbstractStartJavaAut already has more >+ * than 400 lines of code and it is also extended by StartRcpAutServerCommand. >+ * This class implements all methods that are the same for the >+ * JavaFX and Swing classes. >+ */ >+public abstract class AbstractStartJavaAutServer extends AbstractStartJavaAut { >+ >+ /** the logger */ >+ private static final Logger LOG = >+ LoggerFactory.getLogger(AbstractStartJavaAutServer.class); >+ >+ /** separates the environment variables */ >+ private static final String ENV_SEPARATOR = "\n"; //$NON-NLS-1$ >+ >+ /** >+ * >+ * @return the Id of the specific rc bundle >+ */ >+ protected abstract String getRcBundleClassPath(); >+ >+ @Override >+ protected abstract String getServerClassName(); >+ >+ @Override >+ protected abstract String[] createCmdArray(String baseCmd, Map parameters); >+ >+ /** >+ * Sets -javaagent, JRE arguments and the arguments for >+ * the AutServer as environment variables. >+ * @param parameters The parameters for starting the AUT >+ * @param autServerClasspath The classpath of the AUT Server >+ */ >+ protected void setEnv(Map parameters, String autServerClasspath) { >+ String env = (String)parameters.get(AutConfigConstants.ENVIRONMENT); >+ if (env == null) { >+ env = StringConstants.EMPTY; >+ } else { >+ env += ENV_SEPARATOR; >+ } >+ env += setJavaOptions(parameters); >+ if (isRunningFromExecutable(parameters)) { >+ // agent arguments >+ String serverPort = "null"; //$NON-NLS-1$ >+ if (AutStarter.getInstance().getAutCommunicator() != null) { >+ serverPort = String.valueOf(AutStarter.getInstance() >+ .getAutCommunicator().getLocalPort()); >+ } >+ >+ env += ENV_SEPARATOR + "AUT_SERVER_PORT=" + serverPort; ////$NON-NLS-1$ >+ env += ENV_SEPARATOR + "AUT_SERVER_CLASSPATH=" + autServerClasspath; //$NON-NLS-1$ >+ env += ENV_SEPARATOR + "AUT_SERVER_NAME=" + getServerClassName(); //$NON-NLS-1$ >+ >+ // Aut Agent variables >+ env += ENV_SEPARATOR + AutConfigConstants.AUT_AGENT_HOST + "=" + parameters.get(AutConfigConstants.AUT_AGENT_HOST); //$NON-NLS-1$ >+ env += ENV_SEPARATOR + AutConfigConstants.AUT_AGENT_PORT + "=" + parameters.get(AutConfigConstants.AUT_AGENT_PORT); //$NON-NLS-1$ >+ env += ENV_SEPARATOR + AutConfigConstants.AUT_NAME + "=" + parameters.get(AutConfigConstants.AUT_NAME); //$NON-NLS-1$ >+ } >+ // create environment >+ parameters.put(AutConfigConstants.ENVIRONMENT, env); >+ } >+ >+ /** >+ * >+ * @return an array of Strings representing the launch classpath. >+ */ >+ public String[] getLaunchClasspath() { >+ StringBuffer autServerClasspath = new StringBuffer(); >+ createServerClasspath(autServerClasspath); >+ autServerClasspath.append(PATH_SEPARATOR) >+ .append(getRcBundleClassPath()); >+ return autServerClasspath.toString().split(PATH_SEPARATOR); >+ } >+ >+ /** >+ * Creates the Server classpath. >+ * @param serverClasspath the server classpath >+ */ >+ protected void createServerClasspath(StringBuffer serverClasspath) { >+ >+ String [] bundlesToAddToClasspath = { >+ CommandConstants.TOOLS_BUNDLE_ID, >+ CommandConstants.COMMUNICATION_BUNDLE_ID, >+ CommandConstants.RC_COMMON_BUNDLE_ID, >+ CommandConstants.SLF4J_JCL_BUNDLE_ID, >+ CommandConstants.SLF4J_API_BUNDLE_ID, >+ CommandConstants.COMMONS_LANG_BUNDLE_ID, >+ CommandConstants.APACHE_ORO_BUNDLE_ID, >+ CommandConstants.COMMONS_BEAN_UTILS_BUNDLE_ID, >+ CommandConstants.COMMONS_COLLECTIONS_BUNDLE_ID, >+ CommandConstants.LOGBACK_CLASSIC_BUNDLE_ID, >+ CommandConstants.LOGBACK_CORE_BUNDLE_ID, >+ CommandConstants.LOGBACK_SLF4J_BUNDLE_ID >+ }; >+ >+ for (String bundleId : bundlesToAddToClasspath) { >+ serverClasspath.append( >+ AbstractStartToolkitAut.getClasspathForBundleId(bundleId)); >+ serverClasspath.append(PATH_SEPARATOR); >+ } >+ >+ >+ serverClasspath.append(getAbsExtImplClassesPath()); >+ if (LOG.isDebugEnabled()) { >+ LOG.debug("serverClasspath" + serverClasspath); //$NON-NLS-1$ >+ } >+ } >+ >+ /** >+ * Gets the absolute path of the location of the external ImplClasses. >+ * @return the absolute path >+ */ >+ protected String getAbsExtImplClassesPath() { >+ >+ final File implDir = new File(CommandConstants.EXT_IMPLCLASSES_PATH); >+ final StringBuffer paths = new StringBuffer(implDir.getAbsolutePath()); >+ final File[] jars = implDir.listFiles(new FilenameFilter() { >+ public boolean accept(File dir, String name) { >+ return name.endsWith(".jar"); //$NON-NLS-1$ >+ } >+ }); >+ >+ if (jars != null) { >+ final int maxIdx = jars.length; >+ for (int i = 0; i < maxIdx; i++) { >+ File f = jars[i]; >+ paths.append(PATH_SEPARATOR); >+ paths.append(f.getAbsolutePath()); >+ } >+ } >+ return paths.toString(); >+ } >+ >+ /** >+ * Adds elements to the given cmds List. >+ * @param autServerClasspath the server classpath >+ * @param cmds the 1st part of the cmd array >+ * @param parameters The parameters for starting the AUT. >+ */ >+ protected void createAutServerClasspath(StringBuffer autServerClasspath, >+ List cmds, Map parameters) { >+ >+ if (AutStarter.getInstance().getAutCommunicator() != null) { >+ cmds.add(String.valueOf( >+ AutStarter.getInstance().getAutCommunicator() >+ .getLocalPort())); >+ } else { >+ cmds.add("null"); //$NON-NLS-1$ >+ } >+ >+ String autMain = getAUTMainClass(parameters); >+ if (autMain == null) { >+ return; >+ } >+ cmds.add(autMain); >+ autServerClasspath.append(PATH_SEPARATOR) >+ .append(getRcBundleClassPath()); >+ cmds.add(autServerClasspath.toString()); >+ cmds.add(getServerClassName()); >+ } >+ >+ /** >+ * >+ * @return the server base path including resources path >+ */ >+ protected String createServerBasePath() { >+ return AbstractStartToolkitAut.getClasspathForBundleId( >+ CommandConstants.RC_COMMON_BUNDLE_ID); >+ } >+ >+ /** >+ * @param parameters The parameters for starting the AUT. >+ * @return The arguments for the AUT that were found in the >+ * given parameters. >+ */ >+ protected List createAutArguments(Map parameters) { >+ List argsList = new Vector(); >+ if (parameters.get(AutConfigConstants.AUT_RUN_AUT_ARGUMENTS) >+ instanceof String[]) { >+ String[] autArgs = (String[])parameters >+ .get(AutConfigConstants.AUT_RUN_AUT_ARGUMENTS); >+ return Arrays.asList(autArgs); >+ } >+ String autArguments = >+ (String)parameters.get(AutConfigConstants.AUT_ARGUMENTS); >+ >+ if (autArguments == null) { >+ autArguments = StringConstants.EMPTY; >+ } >+ >+ StringTokenizer args = new StringTokenizer(autArguments, >+ WHITESPACE_DELIMITER); >+ while (args.hasMoreTokens()) { >+ String arg = args.nextToken(); >+ argsList.add(arg); >+ } >+ >+ return argsList; >+ } >+ >+ /** >+ * @param cmds the commands list >+ * @param autServerClasspath the autServerClassPath to change >+ * @param parameters The parameters for starting the AUT. >+ */ >+ protected void createAutServerLauncherClasspath(List cmds, >+ StringBuffer autServerClasspath, Map parameters) { >+ >+ addBaseSettings(cmds, parameters); >+ cmds.add("-classpath"); //$NON-NLS-1$ >+ StringBuffer autClassPath = createAutClasspath(parameters); >+ String serverBasePath = createServerBasePath(); >+ cmds.add( >+ autClassPath.append(PATH_SEPARATOR) >+ .append(serverBasePath).toString()); >+ // add classname of autLauncher >+ cmds.add(CommandConstants.AUT_SERVER_LAUNCHER); >+ // add autServerBase dirs to autServerClassPath >+ autServerClasspath.append(PATH_SEPARATOR).append(serverBasePath); >+ } >+ >+ >+ /** * Creates the AUT settings. >+ * @param cmds the commands list >+ * @param parameters The parameters for starting the AUT. >+ */ >+ protected void addBaseSettings(List cmds, Map parameters) { >+ // add locale >+ addLocale(cmds, (Locale)parameters.get(IStartAut.LOCALE)); >+ >+ // add JRE params >+ final String jreParams = (String)parameters.get( >+ AutConfigConstants.JRE_PARAMETER); >+ if (jreParams != null && jreParams.length() > 0) { >+ StringTokenizer tok = new StringTokenizer(jreParams, >+ WHITESPACE_DELIMITER); >+ while (tok.hasMoreTokens()) { >+ cmds.add(tok.nextToken()); >+ } >+ } >+ >+ // add debug options (if neccessary) >+ addDebugParams(cmds, false); >+ // add -Duser.dir and workingDir here >+ } >+ >+ >+ /** >+ * Creates the AUT classpath. >+ * @param parameters The parameters for starting the AUT. >+ * @return The classpath of the AUT. >+ */ >+ protected StringBuffer createAutClasspath(Map parameters) { >+ // Add AUT classpath >+ String autClassPathStr = (String)parameters.get( >+ AutConfigConstants.CLASSPATH); >+ if (autClassPathStr == null) { >+ autClassPathStr = StringConstants.EMPTY; >+ } >+ StringBuffer autClassPath = new StringBuffer( >+ convertClientSeparator(autClassPathStr)); >+ if (autClassPath.length() > 0) { >+ autClassPath.append(PATH_SEPARATOR); >+ } >+ String jarFile = (String)parameters.get(AutConfigConstants.JAR_FILE); >+ if (jarFile == null) { >+ jarFile = StringConstants.EMPTY; >+ } >+ String manifestClassPath = getClassPathFromManifest(parameters); >+ if (manifestClassPath.length() > 0) { >+ autClassPath.append(manifestClassPath).append(PATH_SEPARATOR); >+ } >+ autClassPath.append(jarFile); >+ if (jarFile != null && jarFile.length() > 0) { >+ autClassPath.append(PATH_SEPARATOR); >+ } >+ return autClassPath; >+ } >+} >diff --git a/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/StartJavaFXAutServerCommand.java b/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/StartJavaFXAutServerCommand.java >new file mode 100644 >index 0000000..bb51733 >--- /dev/null >+++ b/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/StartJavaFXAutServerCommand.java >@@ -0,0 +1,126 @@ >+/******************************************************************************* >+ * Copyright (c) 2013 BREDEX GmbH. >+ * 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: >+ * BREDEX GmbH - initial API and implementation and/or initial documentation >+ *******************************************************************************/ >+package org.eclipse.jubula.autagent.commands; >+ >+import java.util.ArrayList; >+import java.util.List; >+import java.util.Map; >+import java.util.Vector; >+ >+import org.eclipse.jubula.tools.constants.AutConfigConstants; >+import org.eclipse.jubula.tools.constants.CommandConstants; >+import org.eclipse.jubula.tools.utils.MonitoringUtil; >+import org.slf4j.Logger; >+import org.slf4j.LoggerFactory; >+ >+/** >+ * @author BREDEX GmbH >+ * @created September 25, 2013 >+ * >+ */ >+public class StartJavaFXAutServerCommand extends AbstractStartJavaAutServer { >+ >+ /** the logger */ >+ private static final Logger LOG = LoggerFactory >+ .getLogger(StartJavaFXAutServerCommand.class); >+ >+ /** separates the environment variables */ >+ private static final String ENV_SEPARATOR = "\n"; //$NON-NLS-1$ >+ >+ /** the classpath of the Aut Server */ >+ private String m_autServerClasspath = "AutServerClasspath"; //$NON-NLS-1$ >+ >+ /** >+ * {@inheritDoc} >+ */ >+ protected String[] createCmdArray(String baseCmd, Map parameters) { >+ List cmds = new Vector(); >+ cmds.add(baseCmd); >+ >+ StringBuffer autServerClasspath = new StringBuffer(); >+ createServerClasspath(autServerClasspath); >+ >+ List autAgentArgs = new ArrayList(); >+ autAgentArgs.add(String.valueOf(parameters >+ .get(AutConfigConstants.AUT_AGENT_HOST))); >+ autAgentArgs.add(String.valueOf(parameters >+ .get(AutConfigConstants.AUT_AGENT_PORT))); >+ autAgentArgs.add(String.valueOf(parameters >+ .get(AutConfigConstants.AUT_NAME))); >+ >+ if (!isRunningFromExecutable(parameters)) { >+ createAutServerLauncherClasspath(cmds, autServerClasspath, >+ parameters); >+ createAutServerClasspath(autServerClasspath, cmds, parameters); >+ cmds.addAll(autAgentArgs); >+ // information for aut server that agent is not used >+ cmds.add(CommandConstants.RC_COMMON_AGENT_INACTIVE); >+ } else { >+ String serverBasePath = createServerBasePath(); >+ autServerClasspath.append(PATH_SEPARATOR).append(serverBasePath) >+ .append(PATH_SEPARATOR).append(getRcBundleClassPath()); >+ m_autServerClasspath = autServerClasspath.toString(); >+ >+ } >+ cmds.addAll(createAutArguments(parameters)); >+ return (String[]) cmds.toArray(new String[cmds.size()]); >+ } >+ >+ /** >+ * {@inheritDoc} >+ */ >+ protected String getServerClassName() { >+ return CommandConstants.AUT_JAVAFX_SERVER; >+ } >+ >+ /** >+ * >+ * {@inheritDoc} >+ */ >+ protected String getRcBundleId() { >+ return CommandConstants.RC_JAVAFX_BUNDLE_ID; >+ } >+ >+ @Override >+ protected String[] createEnvArray(Map parameters, boolean isAgentSet) { >+ >+ if (isRunningFromExecutable(parameters) >+ || MonitoringUtil.shouldAndCanRunWithMonitoring(parameters)) { >+ setEnv(parameters, m_autServerClasspath); >+ boolean agentActive = true; >+ return super.createEnvArray(parameters, agentActive); >+ } >+ >+ return super.createEnvArray(parameters, isAgentSet); >+ >+ } >+ >+ >+ /** >+ * >+ * @return the class path corresponding to the receiver's RC bundle. >+ */ >+ protected String getRcBundleClassPath() { >+ return AbstractStartToolkitAut.getClasspathForBundleId(getRcBundleId()); >+ } >+ >+ @Override >+ protected String getMainClassFromManifest(Map parameters) { >+ String jarFile = createAbsoluteJarPath(parameters); >+ String attr = getAttributeFromManifest("main-class", jarFile); //$NON-NLS-1$ >+ // Replacing "/" with "." because, in the Manifest file of an Application >+ // that was build with JavaFX-Ant-Tasks, the path to the JavaFX loader >+ // class >+ // has slashes but for the Classloader we need the qualified class name >+ // with dots. >+ return attr.replace("/", "."); //$NON-NLS-1$//$NON-NLS-2$ >+ } >+} >diff --git a/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/StartSwingAutServerCommand.java b/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/StartSwingAutServerCommand.java >index 32f774b..433ccc8 100644 >--- a/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/StartSwingAutServerCommand.java >+++ b/org.eclipse.jubula.autagent/src/org/eclipse/jubula/autagent/commands/StartSwingAutServerCommand.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2010 BREDEX GmbH. >+ * Copyright (c) 2004, 2010, 2013 BREDEX GmbH. > * 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 >@@ -10,20 +10,13 @@ > *******************************************************************************/ > package org.eclipse.jubula.autagent.commands; > >-import java.io.File; >-import java.io.FilenameFilter; > import java.util.ArrayList; >-import java.util.Arrays; > import java.util.List; >-import java.util.Locale; > import java.util.Map; >-import java.util.StringTokenizer; > import java.util.Vector; > >-import org.eclipse.jubula.autagent.AutStarter; > import org.eclipse.jubula.tools.constants.AutConfigConstants; > import org.eclipse.jubula.tools.constants.CommandConstants; >-import org.eclipse.jubula.tools.constants.StringConstants; > import org.eclipse.jubula.tools.utils.MonitoringUtil; > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; >@@ -34,71 +27,18 @@ import org.slf4j.LoggerFactory; > * @created Jul 6, 2007 > * > */ >-public class StartSwingAutServerCommand extends AbstractStartJavaAut { >+public class StartSwingAutServerCommand extends AbstractStartJavaAutServer { > > /** the logger */ > private static final Logger LOG = > LoggerFactory.getLogger(StartSwingAutServerCommand.class); > >- /** separates the environment variables */ >- private static final String ENV_SEPARATOR = "\n"; //$NON-NLS-1$ >- > /** the classpath of the Aut Server */ > private String m_autServerClasspath = "AutServerClasspath"; //$NON-NLS-1$ > > /** > * {@inheritDoc} > */ >- protected String[] createEnvArray(Map parameters, boolean isAgentSet) { >- >- if (isRunningFromExecutable(parameters) >- || MonitoringUtil.shouldAndCanRunWithMonitoring(parameters)) { >- setEnv(parameters); >- boolean agentActive = true; >- return super.createEnvArray(parameters, agentActive); >- } >- >- return super.createEnvArray(parameters, isAgentSet); >- >- } >- >- /** >- * Sets -javaagent, JRE arguments and the arguments for >- * the AutServer as environment variables. >- * @param parameters The parameters for starting the AUT >- */ >- private void setEnv(Map parameters) { >- String env = (String)parameters.get(AutConfigConstants.ENVIRONMENT); >- if (env == null) { >- env = StringConstants.EMPTY; >- } else { >- env += ENV_SEPARATOR; >- } >- env += setJavaOptions(parameters); >- if (isRunningFromExecutable(parameters)) { >- // agent arguments >- String serverPort = "null"; //$NON-NLS-1$ >- if (AutStarter.getInstance().getAutCommunicator() != null) { >- serverPort = String.valueOf(AutStarter.getInstance() >- .getAutCommunicator().getLocalPort()); >- } >- >- env += ENV_SEPARATOR + "AUT_SERVER_PORT=" + serverPort; ////$NON-NLS-1$ >- env += ENV_SEPARATOR + "AUT_SERVER_CLASSPATH=" + m_autServerClasspath; //$NON-NLS-1$ >- env += ENV_SEPARATOR + "AUT_SERVER_NAME=" + getServerClassName(); //$NON-NLS-1$ >- >- // Aut Agent variables >- env += ENV_SEPARATOR + AutConfigConstants.AUT_AGENT_HOST + "=" + parameters.get(AutConfigConstants.AUT_AGENT_HOST); //$NON-NLS-1$ >- env += ENV_SEPARATOR + AutConfigConstants.AUT_AGENT_PORT + "=" + parameters.get(AutConfigConstants.AUT_AGENT_PORT); //$NON-NLS-1$ >- env += ENV_SEPARATOR + AutConfigConstants.AUT_NAME + "=" + parameters.get(AutConfigConstants.AUT_NAME); //$NON-NLS-1$ >- } >- // create environment >- parameters.put(AutConfigConstants.ENVIRONMENT, env); >- } >- >- /** >- * {@inheritDoc} >- */ > protected String[] createCmdArray(String baseCmd, Map parameters) { > List cmds = new Vector(); > cmds.add(baseCmd); >@@ -132,164 +72,19 @@ public class StartSwingAutServerCommand extends AbstractStartJavaAut { > cmds.addAll(createAutArguments(parameters)); > return (String[])cmds.toArray(new String[cmds.size()]); > } >- >- /** >- * >- * @return an array of Strings representing the launch classpath. >- */ >- public String[] getLaunchClasspath() { >- StringBuffer autServerClasspath = new StringBuffer(); >- createServerClasspath(autServerClasspath); >- autServerClasspath.append(PATH_SEPARATOR) >- .append(getRcBundleClassPath()); >- return autServerClasspath.toString().split(PATH_SEPARATOR); >- } >- >- /** * Creates the AUT settings. >- * @param cmds the commands list >- * @param parameters The parameters for starting the AUT. >- */ >- private void addBaseSettings(List cmds, Map parameters) { >- // add locale >- addLocale(cmds, (Locale)parameters.get(IStartAut.LOCALE)); >- >- // add JRE params >- final String jreParams = (String)parameters.get( >- AutConfigConstants.JRE_PARAMETER); >- if (jreParams != null && jreParams.length() > 0) { >- StringTokenizer tok = new StringTokenizer(jreParams, >- WHITESPACE_DELIMITER); >- while (tok.hasMoreTokens()) { >- cmds.add(tok.nextToken()); >- } >- } >- >- // add debug options (if neccessary) >- addDebugParams(cmds, false); >- // add -Duser.dir and workingDir here >- } >- /** >- * Creates the Server classpath. >- * @param serverClasspath the server classpath >- */ >- private void createServerClasspath(StringBuffer serverClasspath) { > >- String [] bundlesToAddToClasspath = { >- CommandConstants.TOOLS_BUNDLE_ID, >- CommandConstants.COMMUNICATION_BUNDLE_ID, >- CommandConstants.RC_COMMON_BUNDLE_ID, >- CommandConstants.SLF4J_JCL_BUNDLE_ID, >- CommandConstants.SLF4J_API_BUNDLE_ID, >- CommandConstants.COMMONS_LANG_BUNDLE_ID, >- CommandConstants.APACHE_ORO_BUNDLE_ID, >- CommandConstants.COMMONS_BEAN_UTILS_BUNDLE_ID, >- CommandConstants.COMMONS_COLLECTIONS_BUNDLE_ID, >- CommandConstants.LOGBACK_CLASSIC_BUNDLE_ID, >- CommandConstants.LOGBACK_CORE_BUNDLE_ID, >- CommandConstants.LOGBACK_SLF4J_BUNDLE_ID >- }; >- >- for (String bundleId : bundlesToAddToClasspath) { >- serverClasspath.append( >- AbstractStartToolkitAut.getClasspathForBundleId(bundleId)); >- serverClasspath.append(PATH_SEPARATOR); >- } >- >- >- serverClasspath.append(getAbsExtImplClassesPath()); >- if (LOG.isDebugEnabled()) { >- LOG.debug("serverClasspath" + serverClasspath); //$NON-NLS-1$ >- } >- } >- >- /** >- * @param cmds the commands list >- * @param autServerClasspath the autServerClassPath to change >- * @param parameters The parameters for starting the AUT. >- */ >- private void createAutServerLauncherClasspath(List cmds, >- StringBuffer autServerClasspath, Map parameters) { >- >- addBaseSettings(cmds, parameters); >- cmds.add("-classpath"); //$NON-NLS-1$ >- StringBuffer autClassPath = createAutClasspath(parameters); >- String serverBasePath = createServerBasePath(); >- cmds.add( >- autClassPath.append(PATH_SEPARATOR) >- .append(serverBasePath).toString()); >- // add classname of autLauncher >- cmds.add(CommandConstants.AUT_SERVER_LAUNCHER); >- // add autServerBase dirs to autServerClassPath >- autServerClasspath.append(PATH_SEPARATOR).append(serverBasePath); >- } >- >- /** >- * Creates the AUT classpath. >- * @param parameters The parameters for starting the AUT. >- * @return The classpath of the AUT. >- */ >- private StringBuffer createAutClasspath(Map parameters) { >- // Add AUT classpath >- String autClassPathStr = (String)parameters.get( >- AutConfigConstants.CLASSPATH); >- if (autClassPathStr == null) { >- autClassPathStr = StringConstants.EMPTY; >- } >- StringBuffer autClassPath = new StringBuffer( >- convertClientSeparator(autClassPathStr)); >- if (autClassPath.length() > 0) { >- autClassPath.append(PATH_SEPARATOR); >- } >- String jarFile = (String)parameters.get(AutConfigConstants.JAR_FILE); >- if (jarFile == null) { >- jarFile = StringConstants.EMPTY; >- } >- String manifestClassPath = getClassPathFromManifest(parameters); >- if (manifestClassPath.length() > 0) { >- autClassPath.append(manifestClassPath).append(PATH_SEPARATOR); >- } >- autClassPath.append(jarFile); >- if (jarFile != null && jarFile.length() > 0) { >- autClassPath.append(PATH_SEPARATOR); >- } >- return autClassPath; >- } >- >- /** >- * >- * @return the server base path including resources path >- */ >- private String createServerBasePath() { >- return AbstractStartToolkitAut.getClasspathForBundleId( >- CommandConstants.RC_COMMON_BUNDLE_ID); >- } >- >- /** >- * Adds elements to the given cmds List. >- * @param autServerClasspath the server classpath >- * @param cmds the 1st part of the cmd array >- * @param parameters The parameters for starting the AUT. >- */ >- private void createAutServerClasspath(StringBuffer autServerClasspath, >- List cmds, Map parameters) { >+ @Override >+ protected String[] createEnvArray(Map parameters, boolean isAgentSet) { > >- if (AutStarter.getInstance().getAutCommunicator() != null) { >- cmds.add(String.valueOf( >- AutStarter.getInstance().getAutCommunicator() >- .getLocalPort())); >- } else { >- cmds.add("null"); //$NON-NLS-1$ >- } >+ if (isRunningFromExecutable(parameters) >+ || MonitoringUtil.shouldAndCanRunWithMonitoring(parameters)) { >+ setEnv(parameters, m_autServerClasspath); >+ boolean agentActive = true; >+ return super.createEnvArray(parameters, agentActive); >+ } >+ >+ return super.createEnvArray(parameters, isAgentSet); > >- String autMain = getAUTMainClass(parameters); >- if (autMain == null) { >- return; >- } >- cmds.add(autMain); >- autServerClasspath.append(PATH_SEPARATOR) >- .append(getRcBundleClassPath()); >- cmds.add(autServerClasspath.toString()); >- cmds.add(getServerClassName()); > } > > /** >@@ -309,61 +104,6 @@ public class StartSwingAutServerCommand extends AbstractStartJavaAut { > } > > /** >- * @param parameters The parameters for starting the AUT. >- * @return The arguments for the AUT that were found in the >- * given parameters. >- */ >- private List createAutArguments(Map parameters) { >- List argsList = new Vector(); >- if (parameters.get(AutConfigConstants.AUT_RUN_AUT_ARGUMENTS) >- instanceof String[]) { >- String[] autArgs = (String[])parameters >- .get(AutConfigConstants.AUT_RUN_AUT_ARGUMENTS); >- return Arrays.asList(autArgs); >- } >- String autArguments = >- (String)parameters.get(AutConfigConstants.AUT_ARGUMENTS); >- >- if (autArguments == null) { >- autArguments = StringConstants.EMPTY; >- } >- >- StringTokenizer args = new StringTokenizer(autArguments, >- WHITESPACE_DELIMITER); >- while (args.hasMoreTokens()) { >- String arg = args.nextToken(); >- argsList.add(arg); >- } >- >- return argsList; >- } >- >- /** >- * Gets the absolute path of the location of the external ImplClasses. >- * @return the absolute path >- */ >- private String getAbsExtImplClassesPath() { >- >- final File implDir = new File(CommandConstants.EXT_IMPLCLASSES_PATH); >- final StringBuffer paths = new StringBuffer(implDir.getAbsolutePath()); >- final File[] jars = implDir.listFiles(new FilenameFilter() { >- public boolean accept(File dir, String name) { >- return name.endsWith(".jar"); //$NON-NLS-1$ >- } >- }); >- >- if (jars != null) { >- final int maxIdx = jars.length; >- for (int i = 0; i < maxIdx; i++) { >- File f = jars[i]; >- paths.append(PATH_SEPARATOR); >- paths.append(f.getAbsolutePath()); >- } >- } >- return paths.toString(); >- } >- >- /** > * Gets the absolute path of the RCAgent.jar file. > * @return the absolute path > */ >diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/MessageFactory.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/MessageFactory.java >index ed84463..11c6879 100644 >--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/MessageFactory.java >+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/MessageFactory.java >@@ -61,6 +61,9 @@ public class MessageFactory { > "org.eclipse.jubula.communication.message.win.ActivateWinApplicationMessage"); //$NON-NLS-1$ > toolkitToActivationMessageClassName.put(CommandConstants.IOS_TOOLKIT, > "org.eclipse.jubula.communication.message.ios.IOSActivateApplicationMessage"); //$NON-NLS-1$ >+ toolkitToActivationMessageClassName.put(CommandConstants. >+ JAVAFX_TOOLKIT, >+ "org.eclipse.jubula.communication.message.javafx.ActivateJavaFXApplicationMessage"); //$NON-NLS-1$ > } > > /** >@@ -85,6 +88,8 @@ public class MessageFactory { > "org.eclipse.jubula.communication.message.win.CAPWinTestMessage"); //$NON-NLS-1$ > toolkitToTestMessageClassName.put(CommandConstants.IOS_TOOLKIT, > "org.eclipse.jubula.communication.message.ios.IOSCAPTestMessage"); //$NON-NLS-1$ >+ toolkitToTestMessageClassName.put(CommandConstants.JAVAFX_TOOLKIT, >+ "org.eclipse.jubula.communication.message.javafx.CAPJavaFXTestMessage"); //$NON-NLS-1$ > } > > /** >diff --git a/org.eclipse.jubula.communication/src/org/eclipse/jubula/communication/message/javafx/ActivateJavaFXApplicationMessage.java b/org.eclipse.jubula.communication/src/org/eclipse/jubula/communication/message/javafx/ActivateJavaFXApplicationMessage.java >new file mode 100644 >index 0000000..422202a >--- /dev/null >+++ b/org.eclipse.jubula.communication/src/org/eclipse/jubula/communication/message/javafx/ActivateJavaFXApplicationMessage.java >@@ -0,0 +1,27 @@ >+/******************************************************************************* >+ * Copyright (c) 2013 BREDEX GmbH. >+ * 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: >+ * BREDEX GmbH - initial API and implementation and/or initial documentation >+ *******************************************************************************/ >+package org.eclipse.jubula.communication.message.javafx; >+ >+import org.eclipse.jubula.communication.message.ActivateApplicationMessage; >+import org.eclipse.jubula.tools.constants.CommandConstants; >+ >+/** >+ * @author BREDEX GmbH >+ * @created 2013 >+ */ >+public class ActivateJavaFXApplicationMessage >+ extends ActivateApplicationMessage { >+ >+ /** {@inheritDoc} */ >+ public String getCommandClass() { >+ return CommandConstants.ACTIVATE_JAVAFX_APPLICATION_COMMAND; >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jubula.communication/src/org/eclipse/jubula/communication/message/javafx/CAPJavaFXTestMessage.java b/org.eclipse.jubula.communication/src/org/eclipse/jubula/communication/message/javafx/CAPJavaFXTestMessage.java >new file mode 100644 >index 0000000..9e66a57 >--- /dev/null >+++ b/org.eclipse.jubula.communication/src/org/eclipse/jubula/communication/message/javafx/CAPJavaFXTestMessage.java >@@ -0,0 +1,46 @@ >+/******************************************************************************* >+ * Copyright (c) 2013 BREDEX GmbH. >+ * 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: >+ * BREDEX GmbH - initial API and implementation and/or initial documentation >+ *******************************************************************************/ >+package org.eclipse.jubula.communication.message.javafx; >+ >+import org.eclipse.jubula.communication.message.CAPTestMessage; >+import org.eclipse.jubula.communication.message.MessageCap; >+import org.eclipse.jubula.tools.constants.CommandConstants; >+ >+/** >+ * This class sends a component-action-param-triple to the AutJavaFXServer. >+ * @author BREDEX GmbH >+ * @created 2013 >+ */ >+public class CAPJavaFXTestMessage extends CAPTestMessage { >+ /** >+ * Default constructor. >+ * Do nothing (required by Betwixt). >+ */ >+ public CAPJavaFXTestMessage() { >+ // Nothing to be done >+ } >+ >+ /** >+ * Creates a new instance with the passed CAP message data. The data are >+ * sent to the AUT server to execute a test step. >+ * @param messageCap The message data >+ */ >+ public CAPJavaFXTestMessage(MessageCap messageCap) { >+ super(messageCap); >+ } >+ >+ /** >+ * @return the command class >+ */ >+ public String getCommandClass() { >+ return CommandConstants.JAVAFX_CAP_TEST_COMMAND; >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/constants/CommandConstants.java b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/constants/CommandConstants.java >index 4e03cfe..268a4a9 100644 >--- a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/constants/CommandConstants.java >+++ b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/constants/CommandConstants.java >@@ -259,7 +259,20 @@ public abstract class CommandConstants { > public static final String HTML_GET_WINDOW_TITLES_RESPONSE_COMMAND = "org.eclipse.jubula.client.core.commands.WindowTitlesChangedCommand"; //$NON-NLS-1$ > /** AUT Server (HTML) - in OMM selection of a specific window for the OMM */ > public static final String HTML_OMM_SELECT_WINDOW_COMMAND = "com.bredexsw.jubula.rc.html.commands.OMSelectWindowCommand"; //$NON-NLS-1$ >+ /** constant: "org.eclipse.jubula.rc.javafx.JavaFXAUTServer" */ >+ public static final String AUT_JAVAFX_SERVER = "org.eclipse.jubula.rc.javafx.JavaFXAUTServer"; //$NON-NLS-1$ >+ >+ /** ID of the JavaFX RC bundle */ >+ public static final String RC_JAVAFX_BUNDLE_ID = "org.eclipse.jubula.rc.javafx"; //$NON-NLS-1$ > >+ /** constant: "org.eclipse.jubula.rc.swt.commands.CAPTestCommand" */ >+ public static final String JAVAFX_CAP_TEST_COMMAND = "org.eclipse.jubula.rc.javafx.commands.CAPTestCommand"; //$NON-NLS-1$ >+ >+ /** constant: "org.eclipse.jubula.rc.swing.commands.ActivateApplicationCommand" */ >+ public static final String ACTIVATE_JAVAFX_APPLICATION_COMMAND = "org.eclipse.jubula.rc.javafx.commands.ActivateApplicationCommand"; //$NON-NLS-1$ >+ >+ /** constant: "JavaFX" */ >+ public static final String JAVAFX_TOOLKIT = "org.eclipse.jubula.JavaFXToolkitPlugin"; //$NON-NLS-1$ > /** to prevent instantiation */ > private CommandConstants() { > // do nothing
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
markus.tiede
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 421595
:
237415
| 237428 |
239575
|
239604
|
239819