JBoss Tools SVN: r40636 - in trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples: configurators and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2012-04-30 08:54:06 -0400 (Mon, 30 Apr 2012)
New Revision: 40636
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/IJBossCentralConfigurator.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/DownloadRuntimeDialog.java
Log:
JBIDE-11683 - Enable defining runtime download using external xml file
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java 2012-04-30 12:44:25 UTC (rev 40635)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java 2012-04-30 12:54:06 UTC (rev 40636)
@@ -34,6 +34,10 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
import org.apache.commons.lang.StringEscapeUtils;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
@@ -51,6 +55,7 @@
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.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
@@ -127,13 +132,18 @@
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Version;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
/**
* The activator class controls the plug-in life cycle
*/
public class ProjectExamplesActivator extends AbstractUIPlugin {
- private static final String SEPARATOR = "/";
+ private static final String SEPARATOR = "/"; //$NON-NLS-1$
private static final int DESCRIPTION_LENGTH = 100;
@@ -226,6 +236,8 @@
private static final String URL = "url"; //$NON-NLS-1$
private static final String DISCLAIMER = "disclaimer"; //$NON-NLS-1$
+
+ private static final String DOWNLOAD_RUNTIMES_FILE = "download_runtime.xml"; //$NON-NLS-1$
private Map<String, DownloadRuntime> downloadRuntimes;
@@ -1178,10 +1190,86 @@
downloadRuntimes.put(id, downloadRuntime);
}
}
+ addExternalRuntimes();
}
return downloadRuntimes;
}
+ private void addExternalRuntimes() {
+ if (downloadRuntimes == null) {
+ return;
+ }
+ String urlString = getConfigurator().getDownloadRuntimesURL();
+ File cacheFile = null;
+ try {
+ long cacheModified = 0;
+ IPath location = ProjectExamplesActivator.getDefault()
+ .getStateLocation();
+ cacheFile = new File(location.toFile(), DOWNLOAD_RUNTIMES_FILE);
+ if (cacheFile.isFile()) {
+ cacheModified = cacheFile.lastModified();
+ }
+ URL url = new URL(urlString);
+ long urlModified;
+ try {
+ urlModified = ECFExamplesTransport.getInstance()
+ .getLastModified(url);
+ } catch (Exception e) {
+ urlModified = -1;
+ }
+ if (cacheModified == 0 || urlModified != cacheModified) {
+ File tempFile = File
+ .createTempFile("download_runtimes", ".xml"); //$NON-NLS-1$//$NON-NLS-2$
+ tempFile.deleteOnExit();
+ OutputStream destination = new FileOutputStream(tempFile);
+ IStatus status = ECFExamplesTransport.getInstance().download(
+ DOWNLOAD_RUNTIMES_FILE, urlString, destination,
+ new NullProgressMonitor());
+ if (status.isOK() && url != null) {
+ cacheModified = ECFExamplesTransport.getInstance()
+ .getLastModified(url);
+ ProjectExamplesActivator.copyFile(tempFile, cacheFile);
+ tempFile.delete();
+ cacheFile.setLastModified(cacheModified);
+ }
+ }
+ } catch (Exception e) {
+ log(e);
+ }
+ if (cacheFile != null && cacheFile.isFile()) {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory
+ .newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document doc = db.parse(cacheFile);
+ NodeList runtimes = doc.getElementsByTagName("runtime"); //$NON-NLS-1$
+ int len = runtimes.getLength();
+ for (int i = 0; i < len; i++) {
+ Node node = runtimes.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element element = (Element) node;
+ String id = element.getAttribute("id"); //$NON-NLS-1$
+ String name = element.getAttribute("name"); //$NON-NLS-1$
+ String version = element.getAttribute("version"); //$NON-NLS-1$
+ String url = element.getAttribute("url"); //$NON-NLS-1$
+ String disclaimer = element.getAttribute("disclaimer"); //$NON-NLS-1$
+ if (id == null || name == null || version == null || url == null) {
+ ProjectExamplesActivator.log("Invalid runtime: id=" + id + ",name=" +
+ name + ",version=" + version + ",url=" + url);
+ } else {
+ DownloadRuntime runtime = new DownloadRuntime(id, name, version, url);
+ runtime.setDisclaimer("true".equals(disclaimer)); //$NON-NLS-1$
+ downloadRuntimes.put(id, runtime);
+ }
+ }
+ }
+ } catch (Exception e) {
+ ProjectExamplesActivator.log(e);
+ }
+ }
+ }
+
+
public IJBossCentralConfigurator getConfigurator() {
if (configurator == null) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java 2012-04-30 12:44:25 UTC (rev 40635)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java 2012-04-30 12:54:06 UTC (rev 40636)
@@ -64,6 +64,7 @@
private static final String NEWS_URL = "http://planet.jboss.org/feeds/news"; //$NON-NLS-1$
+ private static final String DOWNLOAD_RUNTIMES_URL = "http://download.jboss.org/examples/download_runtimes.xml"; //$NON-NLS-1$
private Image headerImage;
@Override
@@ -111,4 +112,9 @@
}
return headerImage;
}
+
+ @Override
+ public String getDownloadRuntimesURL() {
+ return DOWNLOAD_RUNTIMES_URL;
+ }
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/IJBossCentralConfigurator.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/IJBossCentralConfigurator.java 2012-04-30 12:44:25 UTC (rev 40635)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/IJBossCentralConfigurator.java 2012-04-30 12:54:06 UTC (rev 40636)
@@ -26,6 +26,7 @@
String getTwitterLink();
String getBlogsUrl();
String getNewsUrl();
+ String getDownloadRuntimesURL();
List<String> getWizardIds();
Image getHeaderImage();
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/DownloadRuntimeDialog.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/DownloadRuntimeDialog.java 2012-04-30 12:44:25 UTC (rev 40635)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/DownloadRuntimeDialog.java 2012-04-30 12:54:06 UTC (rev 40636)
@@ -24,6 +24,7 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -391,20 +392,36 @@
destination.mkdirs();
file = new File (destination, name);
int i = 1;
- while (file.exists()) {
- file = new File(destination, name + "(" + i++ + ")");
+ boolean download = true;
+ long urlModified = 0;
+ if (deleteOnExit) {
+ while (file.exists()) {
+ file = new File(destination, name + "(" + i++ + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ } else {
+ long cacheModified = file.lastModified();
+ try {
+ urlModified = ECFExamplesTransport.getInstance()
+ .getLastModified(url);
+ download = cacheModified <= 0 || cacheModified != urlModified;
+ } catch (CoreException e) {
+ // ignore
+ }
}
-
if (deleteOnExit) {
file.deleteOnExit();
}
- out = new BufferedOutputStream(
- new FileOutputStream(file));
-
- IStatus result = ECFExamplesTransport.getInstance().download(file.getName(),
- url.toExternalForm(), out, monitor);
- out.flush();
- out.close();
+ IStatus result = null;
+ if (download) {
+ out = new BufferedOutputStream(new FileOutputStream(file));
+ result = ECFExamplesTransport.getInstance().download(
+ file.getName(), url.toExternalForm(), out, monitor);
+ out.flush();
+ out.close();
+ if (urlModified > 0) {
+ file.setLastModified(urlModified);
+ }
+ }
if (monitor.isCanceled()) {
file.deleteOnExit();
file.delete();
@@ -413,14 +430,19 @@
File directory = new File(selectedDirectory);
directory.mkdirs();
if (!directory.isDirectory()) {
- ProjectExamplesActivator.getDefault().getLog().log(result);
- MessageDialog.openError(getActiveShell(), "Error", "The '" + directory + "' is not a directory.");
+ String message = "The '" + directory + "' is not a directory.";
+ if (result != null) {
+ ProjectExamplesActivator.getDefault().getLog().log(result);
+ } else {
+ ProjectExamplesActivator.getDefault().getLog().log(result);
+ }
+ MessageDialog.openError(getActiveShell(), "Error", message);
file.deleteOnExit();
file.delete();
return Status.CANCEL_STATUS;
}
ProjectExamplesActivator.extractZipFile(file, directory, monitor);
- if (!result.isOK()) {
+ if (result != null && !result.isOK()) {
ProjectExamplesActivator.getDefault().getLog().log(result);
String message;
if (result.getException() != null) {
12 years, 7 months
JBoss Tools SVN: r40635 - in trunk/requirements: teiid-7.7.0.Final and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mickael_istria
Date: 2012-04-30 08:44:25 -0400 (Mon, 30 Apr 2012)
New Revision: 40635
Added:
trunk/requirements/teiid-7.7.0.Final/
trunk/requirements/teiid-7.7.0.Final/build.properties
trunk/requirements/teiid-7.7.0.Final/buildRequirement.xml
Log:
Added teeid-7.7.0.Final requirement
Added: trunk/requirements/teiid-7.7.0.Final/build.properties
===================================================================
--- trunk/requirements/teiid-7.7.0.Final/build.properties (rev 0)
+++ trunk/requirements/teiid-7.7.0.Final/build.properties 2012-04-30 12:44:25 UTC (rev 40635)
@@ -0,0 +1,6 @@
+teiid770final.build.uri=http://sourceforge.net/projects/teiid/files/teiid/7.7/Final
+build.uri=${teiid770final.build.uri}
+build.archive=teiid-7.7.0.Final-jboss-dist.zip
+md5=d5107e33b5c18673cbc74698e08b7612
+
+
Property changes on: trunk/requirements/teiid-7.7.0.Final/build.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/requirements/teiid-7.7.0.Final/buildRequirement.xml
===================================================================
--- trunk/requirements/teiid-7.7.0.Final/buildRequirement.xml (rev 0)
+++ trunk/requirements/teiid-7.7.0.Final/buildRequirement.xml 2012-04-30 12:44:25 UTC (rev 40635)
@@ -0,0 +1,8 @@
+<project default="build.requirement">
+ <import file="../generic/build.xml" />
+
+ <target name="unpack-zip" >
+ <unzip src="${driver.dest}/${build.archive}" dest="${unzip.dest}/teiid-7.7.0.Final" />
+ </target>
+
+</project>
Property changes on: trunk/requirements/teiid-7.7.0.Final/buildRequirement.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
12 years, 7 months
JBoss Tools SVN: r40634 - in trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test: resources/prj/jpatest35/src and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-04-30 08:41:47 -0400 (Mon, 30 Apr 2012)
New Revision: 40634
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/CodeCompletion.launch
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/src/org/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/src/org/test/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/src/org/test/completion/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/src/org/test/completion/CodeCompletionEntity.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeCompletionSuite.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/completion/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/completion/AnnotationCodeCompletionTest.java
Log:
Initial CodeCompletion test for HB ui bo test added
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/CodeCompletion.launch
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/CodeCompletion.launch (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/CodeCompletion.launch 2012-04-30 12:41:47 UTC (rev 40634)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.swtbot.eclipse.ui.launcher.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeCompletionSuite.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<mapAttribute key="org.eclipse.debug.core.environmentVariables">
+<mapEntry key="DISPLAY" value=":1"/>
+</mapAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.jboss.tools.hb.ui.bot.suite.CodeCompletionSuite"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.jboss.tools.hibernate.ui.bot.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms40m -Xmx512m -Xmx1024M -XX:PermSize=128M -XX:MaxPermSize=256M -Dusage_reporting_enabled=false -Dtest.configurations.dir=/home/jpeterka/etc/hb"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="com.jboss.jbds.product.product"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/launcher/CodeCompletion.launch
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/src/org/test/completion/CodeCompletionEntity.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/src/org/test/completion/CodeCompletionEntity.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/src/org/test/completion/CodeCompletionEntity.java 2012-04-30 12:41:47 UTC (rev 40634)
@@ -0,0 +1,24 @@
+package org.test.completion;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+import org.hibernate.annotations.Table;
+
+@Entity
+
+public class CodeCompletionEntity {
+
+ @Id
+ private long id;
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+
+}
\ No newline at end of file
Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/resources/prj/jpatest35/src/org/test/completion/CodeCompletionEntity.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeCompletionSuite.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeCompletionSuite.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeCompletionSuite.java 2012-04-30 12:41:47 UTC (rev 40634)
@@ -0,0 +1,12 @@
+package org.jboss.tools.hb.ui.bot.suite;
+
+import org.jboss.tools.hb.ui.bot.test.completion.AnnotationCodeCompletionTest;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+(a)RunWith(RequirementAwareSuite.class)
+(a)SuiteClasses({AnnotationCodeCompletionTest.class})
+public class CodeCompletionSuite {
+
+}
Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/CodeCompletionSuite.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/completion/AnnotationCodeCompletionTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/completion/AnnotationCodeCompletionTest.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/completion/AnnotationCodeCompletionTest.java 2012-04-30 12:41:47 UTC (rev 40634)
@@ -0,0 +1,58 @@
+package org.jboss.tools.hb.ui.bot.test.completion;
+
+import java.util.List;
+
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.jboss.tools.hb.ui.bot.common.JPAEntity;
+import org.jboss.tools.hb.ui.bot.common.Tree;
+import org.jboss.tools.hb.ui.bot.test.HibernateBaseTest;
+import org.jboss.tools.ui.bot.ext.config.Annotations.DB;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.helper.StringHelper;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
+import org.junit.Test;
+
+/**
+ * Create JPA Entity ui bot test
+ */
+@Require(db = @DB, clearProjects = true)
+public class AnnotationCodeCompletionTest extends HibernateBaseTest {
+
+ final String prj = "jpatest35";
+ final String pkg = "org.test.completion";
+ final String ent = "CodeCompletionEntity.java";
+
+ final String ext = ".java";
+
+ @Test
+ public void annotationCodeCompletionTest() {
+ emptyErrorLog();
+ importTestProject("/resources/prj/" + prj);
+ importTestProject("/resources/prj/" + "hibernatelib");
+ openJPAEntity();
+ tryCodeCompletion();
+ checkErrorLog();
+ }
+
+ private void tryCodeCompletion() {
+ SWTBotEditorExt editor = bot.swtBotEditorExtByTitle(ent);
+ StringHelper sh = new StringHelper(editor.toTextEditor().getText());
+ Point p = sh.getPositionAfter("@Entity");
+ editor.toTextEditor().selectRange(p.y, p.x + 1, 0);
+ String annoStart = "@Tab";
+ editor.toTextEditor().insertText("\n" + annoStart);
+ sh = new StringHelper(editor.toTextEditor().getText());
+ p = sh.getPositionAfter(annoStart);
+ editor.selectRange(p.y,p.x + 1,0);
+ List<String> autoCompleteProposals = editor.getAutoCompleteProposals("");
+ }
+
+ private void openJPAEntity() {
+ SWTBotView view = open.viewOpen(ActionItem.View.GeneralProjectExplorer.LABEL);
+ Tree.open(view.bot(), prj, "src", pkg, ent);
+ }
+}
Property changes on: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/test/completion/AnnotationCodeCompletionTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
12 years, 7 months
JBoss Tools SVN: r40633 - in trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test: editor and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2012-04-30 07:49:19 -0400 (Mon, 30 Apr 2012)
New Revision: 40633
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/MultiSelectionTest.java
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEStableSubsetBotTests.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java
Log:
Added Multiple Selection test
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2012-04-30 11:48:24 UTC (rev 40632)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2012-04-30 11:49:19 UTC (rev 40633)
@@ -17,6 +17,7 @@
import org.jboss.tools.vpe.ui.bot.test.editor.ExternalEditingTest;
import org.jboss.tools.vpe.ui.bot.test.editor.InsertActionsTest;
import org.jboss.tools.vpe.ui.bot.test.editor.MinMaxPanesTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.MultiSelectionTest;
import org.jboss.tools.vpe.ui.bot.test.editor.StylesOnThePageTest;
import org.jboss.tools.vpe.ui.bot.test.editor.TextEditingActionsTest;
import org.jboss.tools.vpe.ui.bot.test.editor.TextSelectionTest;
@@ -214,7 +215,8 @@
RichFacesComponentTest.class,
UnicodeCharacterDisplayingTest.class,
ExternalEditingTest.class,
- VpeToolbarTest.class
+ VpeToolbarTest.class,
+ MultiSelectionTest.class
})
public class VPEAllBotTests extends SWTBotTestCase{
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEStableSubsetBotTests.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEStableSubsetBotTests.java 2012-04-30 11:48:24 UTC (rev 40632)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEStableSubsetBotTests.java 2012-04-30 11:49:19 UTC (rev 40633)
@@ -15,6 +15,7 @@
import org.jboss.tools.vpe.ui.bot.test.editor.BlockCommentTest;
import org.jboss.tools.vpe.ui.bot.test.editor.JspFileEditingTest;
import org.jboss.tools.vpe.ui.bot.test.editor.MinMaxPanesTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.MultiSelectionTest;
import org.jboss.tools.vpe.ui.bot.test.editor.StylesOnThePageTest;
import org.jboss.tools.vpe.ui.bot.test.editor.TextSelectionTest;
import org.jboss.tools.vpe.ui.bot.test.editor.ToggleCommentTest;
@@ -95,7 +96,17 @@
import org.jboss.tools.vpe.ui.bot.test.wizard.VPESourceCodeTemplatesPreferencePageTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
-
+/**
+ * Test Suite containing stable SWT Bot test i. e. test which should always pass
+ * and are not firing events in Visual part of VPE.
+ * Main purpose of this sub suite of VPEAllBotTests suite is to be used by
+ * Continuous Integration Tools for testing VPE component
+ *
+ * Can be deleted once we have stable tests firing events in Visual part of VPE.
+ *
+ * @author vpakan
+ *
+ */
@RunWith(RequirementAwareSuite.class)
@SuiteClasses ({
NewXHTMLPageWizardTest.class,
@@ -178,7 +189,8 @@
OpenOnTest.class,
XhtmlFilePerformanceTest.class,
MarkersTest.class,
- JBIDE9445Test_DuplicateSourceMenu.class
+ JBIDE9445Test_DuplicateSourceMenu.class,
+ MultiSelectionTest.class
})
public class VPEStableSubsetBotTests extends SWTBotTestCase {
Added: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/MultiSelectionTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/MultiSelectionTest.java (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/MultiSelectionTest.java 2012-04-30 11:49:19 UTC (rev 40633)
@@ -0,0 +1,136 @@
+/*******************************************************************************
+
+ * Copyright (c) 2007-2012 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.bot.test.editor;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTJBTExt;
+import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
+import org.mozilla.interfaces.nsIDOMNode;
+/**
+ * Tests multiple selection in source pane of VPE and her proper visual representation
+ * within visual pane of VPE
+ * @author vlado pakan
+ *
+ */
+public class MultiSelectionTest extends VPEEditorTestCase {
+
+ private SWTBotExt botExt = null;
+ private static final String OUTPUT_TEXT_0_TEXT = "!@#_OUTPUT-TEXT_0_#@!";
+ private static final String OUTPUT_TEXT_1_TEXT = "!@#_OUTPUT-TEXT_1_#@!";
+
+ private static final String PAGE_TEXT = "<%@ taglib uri=\"http://java.sun.com/jsf/html\" prefix=\"h\" %>\n" +
+ "<html>\n" +
+ " <body>\n" +
+ "<h:outputText value=\"" + MultiSelectionTest.OUTPUT_TEXT_0_TEXT + "\"/>" +
+ "<h:outputText value=\"" + MultiSelectionTest.OUTPUT_TEXT_1_TEXT + "\"/>\n" +
+ " </body>\n" +
+ "</html>";
+
+ private static final String TEST_PAGE_NAME = "MultiSelectionTest.jsp";
+
+ private SWTBotEclipseEditor jspEditor;
+ private SWTBotWebBrowser webBrowser;
+
+ public MultiSelectionTest() {
+ super();
+ botExt = new SWTBotExt();
+ }
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ eclipse.maximizeActiveShell();
+ createJspPage(MultiSelectionTest.TEST_PAGE_NAME);
+ util.waitForNonIgnoredJobs();
+ jspEditor = botExt.editorByTitle(MultiSelectionTest.TEST_PAGE_NAME).toTextEditor();
+ webBrowser = new SWTBotWebBrowser(MultiSelectionTest.TEST_PAGE_NAME,botExt);
+
+ }
+ /**
+ * Tests Multiple Selection
+ */
+ public void testMultipleSeletion(){
+
+ jspEditor.show();
+ jspEditor.setText(MultiSelectionTest.PAGE_TEXT);
+ jspEditor.save();
+
+ SWTJBTExt.selectTextInSourcePane(botExt,
+ MultiSelectionTest.TEST_PAGE_NAME,
+ MultiSelectionTest.OUTPUT_TEXT_1_TEXT,
+ 0,
+ 0,
+ 0);
+
+ assertSelectedNodeHasText(webBrowser, MultiSelectionTest.OUTPUT_TEXT_1_TEXT);
+
+ SWTJBTExt.selectTextInSourcePane(botExt,
+ MultiSelectionTest.TEST_PAGE_NAME,
+ MultiSelectionTest.OUTPUT_TEXT_0_TEXT,
+ 0,
+ 0,
+ 0);
+
+ assertSelectedNodeHasText(webBrowser, MultiSelectionTest.OUTPUT_TEXT_0_TEXT);
+
+ final int xPos = jspEditor.cursorPosition().column;
+ final int yPos = jspEditor.cursorPosition().line;
+ final String tagsLine = jspEditor.getTextOnCurrentLine();
+
+ jspEditor.selectRange(yPos, xPos,
+ tagsLine.indexOf(MultiSelectionTest.OUTPUT_TEXT_1_TEXT) - tagsLine.indexOf(MultiSelectionTest.OUTPUT_TEXT_0_TEXT));
+
+ assertSelectedNodeHasText(webBrowser, MultiSelectionTest.OUTPUT_TEXT_0_TEXT);
+
+ jspEditor.selectCurrentLine();
+
+ assertTrue("Multiple selection doesn't contain proper nodes.",
+ webBrowser.selectionContainsNodes(false, MultiSelectionTest.OUTPUT_TEXT_0_TEXT
+ , MultiSelectionTest.OUTPUT_TEXT_1_TEXT));
+
+ }
+ @Override
+ protected void closeUnuseDialogs() {
+
+ }
+
+ @Override
+ protected boolean isUnuseDialogOpened() {
+ return false;
+ }
+ @Override
+ public void tearDown() throws Exception {
+ jspEditor.close();
+ super.tearDown();
+ }
+ /**
+ * Asserts selected node in Visual pane has text textToHave
+ * @param webBrowser
+ * @param nodeNameToContain
+ */
+ private static void assertSelectedNodeHasText (SWTBotWebBrowser webBrowser,
+ String textToHave){
+
+ nsIDOMNode selectedNode = webBrowser.getSelectedDomNode();
+
+ assertNotNull("There is no selected node within Visual pane of VPE",selectedNode);
+ assertNotNull("Selected node within Visual pane of VPE has no value",selectedNode.getNodeValue());
+
+ final String nodeValue = selectedNode.getNodeValue();
+
+ assertTrue("Selected node within Visual pane has value:\n" + nodeValue
+ + "\nbut has to have value:\n"
+ + textToHave,
+ textToHave.equals(nodeValue));
+
+ }
+}
Property changes on: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/MultiSelectionTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java 2012-04-30 11:48:24 UTC (rev 40632)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/tools/SWTBotWebBrowser.java 2012-04-30 11:49:19 UTC (rev 40633)
@@ -94,6 +94,7 @@
public static final String SELECT_THIS_TAG_MENU_LABEL = "Select This Tag";
public static final String PREFERENCES_MENU_LABEL = "Preferences..";
public static final String EXTERNALIZE_STRING_MENU_LABEL = "Externalize selected string...";
+ public static final String TEAM_MENU_LABEL = "Team";
public static final String JSF_MENU_LABEL = "JSF";
public static final String JBOSS_MENU_LABEL = "JBoss";
@@ -270,12 +271,7 @@
*/
public nsIDOMNode getSelectedDomNode (){
nsIDOMNode result = null;
- display.syncExec(new Runnable() {
- public void run() {
- mozillaEditor.setFocus();
- }
- });
- nsISelection selection = getSelectionController().getSelection(nsISelectionController.SELECTION_NORMAL);
+ nsISelection selection = getSelection();
if (selection != null){
result = selection.getFocusNode();
}
@@ -941,4 +937,41 @@
}
return result;
}
+ /**
+ * Returns true when current selection contains exactly nodes with values
+ * @param containsWholeNodes if true selection has to contain whole nodes
+ * @param values
+ * @return
+ */
+ public boolean selectionContainsNodes(boolean containsWholeNodes,
+ String... values) {
+ boolean result = true;
+
+ List<nsIDOMNode> selectedNodes = mozillaEditor.getXulRunnerEditor()
+ .getSelectedNodes();
+ if (selectedNodes != null && values != null) {
+ if (selectedNodes.size() == values.length) {
+ int index = 0;
+ while (result && index < values.length) {
+ boolean selectedNodeContainsValue = false;
+ Iterator<nsIDOMNode> itSelectedNodes = selectedNodes.iterator();
+ while (!selectedNodeContainsValue && itSelectedNodes.hasNext()) {
+ if (containsNodeWithValue(itSelectedNodes.next(), values[index])){
+ selectedNodeContainsValue = true;
+ }
+ }
+ if (!selectedNodeContainsValue){
+ result = false;
+ }
+ index++;
+ }
+ } else {
+ result = false;
+ }
+ } else {
+ result = false;
+ }
+
+ return result;
+ }
}
12 years, 7 months
JBoss Tools SVN: r40632 - in trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim: ui and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2012-04-30 07:48:24 -0400 (Mon, 30 Apr 2012)
New Revision: 40632
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/UIUtil.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/stop-selected.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/stop.png
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ResizableSkin.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSNavBarComposite.java
Log:
https://issues.jboss.org/browse/JBIDE-11334 : BrowserSim: provide a more appropriate stop button
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/stop-selected.png
===================================================================
(Binary files differ)
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/resources/ios/stop.png
===================================================================
(Binary files differ)
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java 2012-04-30 11:46:55 UTC (rev 40631)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java 2012-04-30 11:48:24 UTC (rev 40632)
@@ -588,21 +588,25 @@
@Override
public void goBack() {
browser.back();
+ browser.setFocus();
}
@Override
public void goForward() {
browser.forward();
+ browser.setFocus();
}
@Override
public void goHome() {
browser.setUrl(homeUrl);
+ browser.setFocus();
}
@Override
public void goToAddress(String address) {
browser.setUrl(address);
+ browser.setFocus();
}
@Override
@@ -618,11 +622,13 @@
@Override
public void stop() {
browser.stop();
+ browser.setFocus();
}
@Override
public void refresh() {
browser.refresh();
+ browser.setFocus();
}
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java 2012-04-30 11:46:55 UTC (rev 40631)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java 2012-04-30 11:48:24 UTC (rev 40632)
@@ -170,6 +170,8 @@
controlHandler.goToAddress(locationText.getText());
}
});
+
+ UIUtil.addSelectTextOnFocusListener(locationText);
}
@Override
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ResizableSkin.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ResizableSkin.java 2012-04-30 11:46:55 UTC (rev 40631)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ResizableSkin.java 2012-04-30 11:48:24 UTC (rev 40632)
@@ -62,8 +62,8 @@
controlHandler.goToAddress(((Text)e.widget).getText());
}
});
+ UIUtil.addSelectTextOnFocusListener(deviceComposite.getUrlText());
-
Listener moveListener = new Listener() {
Point origin;
Point shellOrigin;
Added: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/UIUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/UIUtil.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/UIUtil.java 2012-04-30 11:48:24 UTC (rev 40632)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.browsersim.ui.skin;
+
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author Yahor Radtsevich (yradtsevich)
+ */
+public class UIUtil {
+ public static void addSelectTextOnFocusListener(final Text targetText) {
+ targetText.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusGained(FocusEvent e) {
+ e.display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (!targetText.isDisposed()) {
+ targetText.selectAll();
+ }
+ }
+ });
+ }
+ });
+ }
+}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSNavBarComposite.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSNavBarComposite.java 2012-04-30 11:46:55 UTC (rev 40631)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/ios/IOSNavBarComposite.java 2012-04-30 11:48:24 UTC (rev 40632)
@@ -43,11 +43,11 @@
formData.bottom = new FormAttachment(0, 26);
formData.height = 27;
pageTitleStyledText.setLayoutData(formData);
+
urlText = new Text(this, SWT.SINGLE);
-
formData = new FormData();
formData.left = new FormAttachment(0, 12);
- formData.right = new FormAttachment(100, -62);
+ formData.right = new FormAttachment(100, -58);
formData.top = new FormAttachment(0, 33);
formData.bottom = new FormAttachment(100, -8);
urlText.setLayoutData(formData);
@@ -65,7 +65,7 @@
formData = new FormData();
Rectangle stopImageBounds = imageList.getImage(BD + "stop.png").getBounds();
formData.right = new FormAttachment(100, -42);
- formData.bottom = new FormAttachment(100, -11);
+ formData.bottom = new FormAttachment(100, -12);
formData.width = stopImageBounds.width;
formData.height = stopImageBounds.height;
stopButtonComposite.setLayoutData(formData);
12 years, 7 months
JBoss Tools SVN: r40631 - trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-04-30 07:46:55 -0400 (Mon, 30 Apr 2012)
New Revision: 40631
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerTest.java
Log:
modified RESTfulExplorerTest to test RESTful explorer without saving java file
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerTest.java 2012-04-30 11:45:53 UTC (rev 40630)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/rest/explorer/RESTfulExplorerTest.java 2012-04-30 11:46:55 UTC (rev 40631)
@@ -35,6 +35,11 @@
return restEmptyProjectName;
}
+ @Override
+ public void cleanup() {
+ bot.activeEditor().toTextEditor().save();
+ }
+
@Test
public void testAddingSimpleRESTMethods() {
@@ -42,7 +47,7 @@
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
RESTfulExplorerTest.class.getResourceAsStream(BASIC_WS_RESOURCE),
- false, getWsPackage(), getWsName());
+ false, false, getWsPackage(), getWsName());
bot.sleep(Timing.time2S());
restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
@@ -67,7 +72,7 @@
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
RESTfulExplorerTest.class.getResourceAsStream(ADVANCED_WS_RESOURCE),
- false, getWsPackage(), getWsName());
+ false, false, getWsPackage(), getWsName());
bot.sleep(Timing.time2S());
restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
@@ -110,7 +115,7 @@
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
RESTfulExplorerTest.class.getResourceAsStream(BASIC_WS_RESOURCE),
- false, getWsPackage(), getWsName());
+ false, false, getWsPackage(), getWsName());
restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
@@ -120,7 +125,7 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(), "@DELETE", "@GET");
+ resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(), "@DELETE", "@GET", false);
bot.sleep(Timing.time2S());
restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
@@ -143,7 +148,7 @@
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
RESTfulExplorerTest.class.getResourceAsStream(ADVANCED_WS_RESOURCE),
- false, getWsPackage(), getWsName());
+ false, false, getWsPackage(), getWsName());
restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
@@ -159,9 +164,10 @@
packageExplorer.openFile(getWsProjectName(), "src",
getWsPackage(), getWsName() + ".java").toTextEditor();
- resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(), "/delete/{id}", "delete/edited/{id}");
+ resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(),
+ "/delete/{id}", "delete/edited/{id}", false);
resourceHelper.replaceInEditor(bot.activeEditor().toTextEditor(), "@DELETE",
- "@DELETE" + LINE_SEPARATOR + "@Produces(\"text/plain\")");
+ "@DELETE" + LINE_SEPARATOR + "@Produces(\"text/plain\")", false);
bot.sleep(Timing.time2S());
restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
@@ -182,7 +188,7 @@
getWsPackage(), getWsName() + ".java").toTextEditor();
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
RESTfulExplorerTest.class.getResourceAsStream(BASIC_WS_RESOURCE),
- false, getWsPackage(), getWsName());
+ false, false, getWsPackage(), getWsName());
restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
SWTBotTreeItem[] restServices = restfulWizard.getAllRestServices();
@@ -195,7 +201,7 @@
resourceHelper.copyResourceToClass(bot.editorByTitle(getWsName() + ".java"),
RESTfulExplorerTest.class.
getResourceAsStream(EMPTY_WS_RESOURCE),
- false, getWsPackage(), getWsName());
+ false, false, getWsPackage(), getWsName());
bot.sleep(Timing.time2S());
restfulWizard = new RESTFullExplorerWizard(getWsProjectName());
12 years, 7 months
JBoss Tools SVN: r40630 - trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-04-30 07:45:53 -0400 (Mon, 30 Apr 2012)
New Revision: 40630
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ResourceHelper.java
Log:
overloaded methods copyResourceToClass and replaceInEditor added
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ResourceHelper.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ResourceHelper.java 2012-04-30 11:44:24 UTC (rev 40629)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ResourceHelper.java 2012-04-30 11:45:53 UTC (rev 40630)
@@ -69,26 +69,31 @@
* @param replacement
*/
public void replaceInEditor(SWTBotEclipseEditor ed, String target, String replacement) {
+ replaceInEditor(ed, target, replacement, true);
+ }
+
+ /**
+ * Method replaces string "target" by string "replacement.
+ * @param target
+ * @param replacement
+ */
+ public void replaceInEditor(SWTBotEclipseEditor ed, String target,
+ String replacement, boolean save) {
ed.selectRange(0, 0, ed.getText().length());
ed.setText(ed.getText().replace(target,replacement));
- ed.save();
+ if (save) ed.save();
}
-
/**
- * Method copies resource to class opened in SWTBotEditor
+ * Method copies resource to class opened in SWTBotEditor with entered parameters
* @param classEdit
* @param resource
* @param closeEdit
+ * @param param
*/
public void copyResourceToClass(SWTBotEditor classEdit,
- InputStream resource, boolean closeEdit) {
- SWTBotEclipseEditor st = classEdit.toTextEditor();
- st.selectRange(0, 0, st.getText().length());
- String code = readStream(resource);
- st.setText(code);
- classEdit.save();
- if (closeEdit) classEdit.close();
+ InputStream resource, boolean closeEdit, Object... param) {
+ copyResourceToClass(classEdit, resource, true, closeEdit, param);
}
/**
@@ -99,12 +104,13 @@
* @param param
*/
public void copyResourceToClass(SWTBotEditor classEdit,
- InputStream resource, boolean closeEdit, Object... param) {
+ InputStream resource, boolean save, boolean closeEdit, Object... param) {
String s = readStream(resource);
String code = MessageFormat.format(s, param);
- classEdit.toTextEditor().selectRange(0, 0, classEdit.toTextEditor().getText().length());
- classEdit.toTextEditor().setText(code);
- classEdit.save();
+ SWTBotEclipseEditor st = classEdit.toTextEditor();
+ st.selectRange(0, 0, st.getText().length());
+ st.setText(code);
+ if (save) classEdit.save();
if (closeEdit) classEdit.close();
}
12 years, 7 months
JBoss Tools SVN: r40629 - trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wstester.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-04-30 07:44:24 -0400 (Mon, 30 Apr 2012)
New Revision: 40629
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wstester/WsTesterTest.java
Log:
fix location of resource file for WsTesterTest
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wstester/WsTesterTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wstester/WsTesterTest.java 2012-04-30 11:14:47 UTC (rev 40628)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wstester/WsTesterTest.java 2012-04-30 11:44:24 UTC (rev 40629)
@@ -317,7 +317,7 @@
"WsTesterTest");
targetFolder.mkdirs();
for (String file : files) {
- InputStream is = WsTesterTest.class.getResourceAsStream("/wsdl/"
+ InputStream is = WsTesterTest.class.getResourceAsStream("/resources/wsdl/"
+ file);
File target = new File(targetFolder, file);
if (target.exists()) {
12 years, 7 months