JBoss Tools SVN: r36324 - in trunk/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-11-14 10:29:00 -0500 (Mon, 14 Nov 2011)
New Revision: 36324
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ResourceModuleResourceUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
Log:
JBIDE-8863
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java 2011-11-14 14:54:47 UTC (rev 36323)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java 2011-11-14 15:29:00 UTC (rev 36324)
@@ -353,11 +353,7 @@
}
public static IModule[] combine(IModule[] module, IModule newMod) {
- IModule[] retval = new IModule[module.length + 1];
- for( int i = 0; i < module.length; i++ )
- retval[i]=module[i];
- retval[retval.length-1] = newMod;
- return retval;
+ return PublishUtil.combine(module, newMod);
}
public IPath getOutputFilePath() {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ResourceModuleResourceUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ResourceModuleResourceUtil.java 2011-11-14 14:54:47 UTC (rev 36323)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ResourceModuleResourceUtil.java 2011-11-14 15:29:00 UTC (rev 36324)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.modules;
+import java.io.File;
import java.util.ArrayList;
import org.eclipse.core.resources.IContainer;
@@ -18,6 +19,10 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleFolder;
import org.eclipse.wst.server.core.model.IModuleResource;
import org.eclipse.wst.server.core.util.ModuleFile;
import org.eclipse.wst.server.core.util.ModuleFolder;
@@ -38,8 +43,7 @@
public static IModuleResource createFile(IFile resource, IPath path) {
IPath global = resource.getLocation();
- return new ModuleFile(global.toFile(),
- global.lastSegment(), path);
+ return new ModuleFile(global.toFile(), global.lastSegment(), path);
}
public static IModuleResource createFolder(IContainer cont, IPath path) {
@@ -71,4 +75,47 @@
}
return modChildren.toArray(new IModuleResource[modChildren.size()]);
}
+
+ public static IModuleResource[] addFileToModuleResources(IModule[] moduleTree, IPath prevPath,
+ IModuleResource[] resources, IPath remainingPath, File childFile) {
+ boolean found = false;
+ String name = remainingPath.segment(0);
+ remainingPath = remainingPath.removeFirstSegments(1);
+
+ for( int i = 0; i < resources.length; i++ ) {
+ if( resources[i].getName().equals(remainingPath.segment(0))) {
+ found = true;
+ if( resources[i] instanceof IModuleFile ) {
+ resources[i] = new ModuleFile(childFile, name, prevPath);
+ return resources;
+ } else if( resources[i] instanceof IModuleFolder){
+ IModuleFolder mf = (IModuleFolder) resources[i];
+ IModuleResource[] mfChildren = mf.members();
+ IModuleResource[] newChildren = addFileToModuleResources(moduleTree,
+ prevPath.append(name), mfChildren, remainingPath, childFile);
+ ((ModuleFolder)mf).setMembers(newChildren);
+ }
+ }
+ }
+
+ if( found )
+ return resources;
+
+ IModuleResource[] newResources = new IModuleResource[resources.length+1];
+ System.arraycopy(resources, 0, newResources, 0, resources.length);
+ if( remainingPath.segmentCount() == 0 ) {
+ // add a file
+ newResources[newResources.length-1] = new ModuleFile(childFile, name, prevPath);
+ } else {
+ // add a folder
+ ModuleFolder mf = new ModuleFolder(null, name, prevPath);
+ IModuleResource[] newChildren = addFileToModuleResources(moduleTree,
+ prevPath.append(name), new IModuleResource[]{}, remainingPath, childFile);
+ ((ModuleFolder)mf).setMembers(newChildren);
+ newResources[newResources.length-1] = mf;
+ }
+ return newResources;
+ }
+
+
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java 2011-11-14 14:54:47 UTC (rev 36323)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java 2011-11-14 15:29:00 UTC (rev 36324)
@@ -31,9 +31,11 @@
import org.eclipse.wst.server.core.model.IModuleResource;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
import org.eclipse.wst.server.core.util.ModuleFile;
+import org.eclipse.wst.server.core.util.ProjectModule;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
+import org.jboss.ide.eclipse.as.core.modules.ResourceModuleResourceUtil;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
@@ -202,7 +204,7 @@
List<IStatus> list = new ArrayList<IStatus>();
boolean isBinaryObject = ServerModelUtilities.isBinaryModule(module);
- boolean forceZip = forceZipModule(moduleTree);
+ boolean forceZip = forceZipModule(moduleTree) || parentModuleIsForcedZip(moduleTree);
if( !forceZip && !isBinaryObject) {
PublishCopyUtil util = new PublishCopyUtil(callback);
@@ -224,31 +226,72 @@
return status;
}
+ private File createForceZippedChild(IPath deployRoot, IModule module, IModule[] moduleTree,
+ ArrayList<IStatus> errors) throws CoreException {
+ File temp = null;
+ try {
+ ProjectModule pm = (ProjectModule) module.loadAdapter(ProjectModule.class, null);
+ IModuleResource[] resources = pm.members();
+
+ IModule[] children = server.getServer().getChildModules(moduleTree, new NullProgressMonitor());
+ for( int i = 0; i < children.length; i++ ) {
+ IPath path = new Path(pm.getPath(children[i]));
+ IModule[] tmpTree = PublishUtil.combine(moduleTree, children[i]);
+ File childFile = createForceZippedChild(deployRoot, children[i], tmpTree, errors);
+ resources = ResourceModuleResourceUtil.addFileToModuleResources(
+ tmpTree, new Path("/"), resources, path, childFile); //$NON-NLS-1$
+ }
+
+ // Make output
+ temp = File.createTempFile(module.getName(), ".tmp", deployRoot.toFile()); //$NON-NLS-1$
+ IPath tempFile = new Path(temp.getAbsolutePath());
+ IStatus[] e2 = PublishUtil.packModuleIntoJar(moduleTree[moduleTree.length-1].getName(), resources, tempFile);
+ errors.addAll(Arrays.asList(e2));
+ return temp;
+ } catch( IOException ioe) {
+ errors.add( new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, ioe.getMessage(), ioe));
+ return null;
+ }
+ }
+
+ private boolean parentModuleIsForcedZip(IModule[] moduleTree) {
+ ArrayList<IModule> tmp = new ArrayList<IModule>();
+ tmp.addAll(Arrays.asList(moduleTree));
+ tmp.remove(tmp.size()-1);
+ while( tmp.size() > 0 ) {
+ IModule[] tmpArray = tmp.toArray(new IModule[tmp.size()]);
+ if( forceZipModule(tmpArray) ) {
+ return true;
+ }
+ tmp.remove(tmp.size()-1);
+ }
+ return false;
+ }
+
protected IStatus[] transferForceZippedChild(IPath deployPath, IModule module, IModule[] moduleTree, IProgressMonitor monitor) throws CoreException {
+ // Been here already
+ if(parentModuleIsForcedZip(moduleTree))
+ return new IStatus[]{};
+
// A child that must be zipped, forceZip is true
ArrayList<IStatus> list = new ArrayList<IStatus>();
IPath deployRoot = JBossServerCorePlugin.getServerStateLocation(server.getServer()).
append(IJBossToolingConstants.TEMP_DEPLOY).makeAbsolute();
- try {
// Make local jar copy
- File temp = File.createTempFile(module.getName(), ".tmp", deployRoot.toFile()); //$NON-NLS-1$
- IPath tempFile = new Path(temp.getAbsolutePath());
- list.addAll(Arrays.asList(PublishUtil.packModuleIntoJar(moduleTree[moduleTree.length-1], tempFile)));
-
- // TODO !!!!! Transfer it
+ File temp = createForceZippedChild(deployRoot, module, moduleTree, list);
+ if( temp != null ) {
+ // Transfer it
IPath deployPathInner = getParentDeployPath(moduleTree, server);
IPublishCopyCallbackHandler handler = getCallbackHandler(getRootPath(deployPathInner).append(deployPathInner));
IPath filePath = deployPath.removeFirstSegments(deployPathInner.segments().length);
IPath parentFolderPath = filePath.removeLastSegments(1);
handler.makeDirectoryIfRequired(parentFolderPath, getSubMon(monitor, 200));
- ModuleFile mf = new ModuleFile(tempFile.toFile(), tempFile.lastSegment(), tempFile);
+ ModuleFile mf = new ModuleFile(temp, temp.getName(), new Path(temp.getAbsolutePath()));
handler.copyFile(mf, filePath, getSubMon(monitor, 500));
// Cleanup
- tempFile.toFile().delete();
- } catch( IOException ioe) {
- list.add( new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, ioe.getMessage(), ioe));
+ temp.delete();
}
return list.toArray(new IStatus[list.size()]);
}
@@ -272,7 +315,7 @@
boolean isBinaryObject = ServerModelUtilities.isBinaryModule(module);
monitor.beginTask("Incremental Publish: " + moduleTree[moduleTree.length-1].getName(), 100); //$NON-NLS-1$
- boolean forceZip = forceZipModule(moduleTree);
+ boolean forceZip = forceZipModule(moduleTree) || parentModuleIsForcedZip(moduleTree);
IPublishCopyCallbackHandler handler = null;
if( !forceZip && !isBinaryObject) {
handler = getCallbackHandler(deployPath);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2011-11-14 14:54:47 UTC (rev 36323)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2011-11-14 15:29:00 UTC (rev 36324)
@@ -384,4 +384,11 @@
}
}
+ public static IModule[] combine(IModule[] module, IModule newMod) {
+ IModule[] retval = new IModule[module.length + 1];
+ for( int i = 0; i < module.length; i++ )
+ retval[i]=module[i];
+ retval[retval.length-1] = newMod;
+ return retval;
+ }
}
13 years, 1 month
JBoss Tools SVN: r36323 - trunk/download.jboss.org/jbosstools/examples.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-11-14 09:54:47 -0500 (Mon, 14 Nov 2011)
New Revision: 36323
Modified:
trunk/download.jboss.org/jbosstools/examples/project-examples-maven-3.3.xml
Log:
Add new POH5 archetype
Modified: trunk/download.jboss.org/jbosstools/examples/project-examples-maven-3.3.xml
===================================================================
--- trunk/download.jboss.org/jbosstools/examples/project-examples-maven-3.3.xml 2011-11-14 14:45:39 UTC (rev 36322)
+++ trunk/download.jboss.org/jbosstools/examples/project-examples-maven-3.3.xml 2011-11-14 14:54:47 UTC (rev 36323)
@@ -348,4 +348,52 @@
</mavenArchetype>
<!--targetProjectFacet facet="jst.ear" version="6.0"/-->
</project>
+ <!-- Temporary POH5 project - replace with Pete's new archetype when it's ready -->
+ <project>
+ <category>Java EE 6 Quickstarts</category>
+ <name>jboss-javaee6-poh5-archetype</name>
+ <included-projects>jboss-javaee6-poh5</included-projects>
+ <shortDescription>Java EE 6 Plain Old HTML5 Webapp (Maven archetype)</shortDescription>
+ <description>An archetype that generates a starter Java EE 6 Plain Old HTML5 (POH5) webapp project for JBoss AS 7 / EAP 6</description>
+ <size>165567</size>
+ <url/>
+ <fixes>
+ <fix type="wtpruntime">
+ <property name="allowed-types">org.jboss.ide.eclipse.as.runtime.70, org.jboss.ide.eclipse.as.runtime.eap.60</property>
+ <property name="description">This project example requires JBoss AS 7.0</property>
+ <property name="downloadId">org.jboss.tools.runtime.core.as.702</property>
+ </fix>
+ <fix type="plugin">
+ <property name="id">org.eclipse.m2e.core</property>
+ <property name="versions">[1.0.0,1.2.0)</property>
+ <property name="description">This project example requires m2e >= 1.0.</property>
+ <property name="connectorIds">org.eclipse.m2e.feature</property>
+ </fix>
+ <fix type="plugin">
+ <property name="id">org.maven.ide.eclipse.wtp</property>
+ <property name="versions">[0.13.1,0.15.0)</property>
+ <property name="description">This project example requires m2eclipse-wtp >= 0.13.1.</property>
+ <property name="connectorIds">org.maven.ide.eclipse.wtp</property>
+ </fix>
+ <fix type="plugin">
+ <property name="id">org.jboss.tools.maven.core</property>
+ <property name="versions">[1.3.0,1.4.0)</property>
+ <property name="description">This project example requires JBoss Maven Tools.</property>
+ <property name="connectorIds">org.jboss.tools.maven.feature,org.jboss.tools.maven.cdi.feature</property>
+ </fix>
+ </fixes>
+ <importType>mavenArchetype</importType>
+ <importTypeDescription>The project example requires the m2e, m2eclipse-wtp and JBoss Maven Integration feature.</importTypeDescription>
+ <mavenArchetype>
+ <archetypeGroupId>org.jboss.spec.archetypes</archetypeGroupId>
+ <archetypeArtifactId>jboss-javaee6-poh5-archetype</archetypeArtifactId>
+ <archetypeVersion>7.0.2-SNAPSHOT</archetypeVersion>
+ <archetypeRepository>http://anonsvn.jboss.org/repos/jbosstools/workspace/fred/repositories/sna...</archetypeRepository>
+ <groupId>org.jboss.tools.example</groupId>
+ <artifactId>poh5</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <javaPackage>org.jboss.tools.example.poh5</javaPackage>
+ </mavenArchetype>
+ <!--targetProjectFacet facet="jst.ear" version="6.0"/-->
+ </project>
</projects>
13 years, 1 month
JBoss Tools SVN: r36322 - in workspace/fred/repositories/snapshot/org/jboss/spec/archetypes: jboss-javaee6-poh5-archetype and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-11-14 09:45:39 -0500 (Mon, 14 Nov 2011)
New Revision: 36322
Added:
workspace/fred/repositories/snapshot/org/jboss/spec/archetypes/jboss-javaee6-poh5-archetype/
workspace/fred/repositories/snapshot/org/jboss/spec/archetypes/jboss-javaee6-poh5-archetype/7.0.2-SNAPSHOT/
workspace/fred/repositories/snapshot/org/jboss/spec/archetypes/jboss-javaee6-poh5-archetype/7.0.2-SNAPSHOT/jboss-javaee6-poh5-archetype-7.0.2-SNAPSHOT-sources.jar
workspace/fred/repositories/snapshot/org/jboss/spec/archetypes/jboss-javaee6-poh5-archetype/7.0.2-SNAPSHOT/jboss-javaee6-poh5-archetype-7.0.2-SNAPSHOT.jar
workspace/fred/repositories/snapshot/org/jboss/spec/archetypes/jboss-javaee6-poh5-archetype/7.0.2-SNAPSHOT/jboss-javaee6-poh5-archetype-7.0.2-SNAPSHOT.pom
Log:
Add POH5 archetype
Added: workspace/fred/repositories/snapshot/org/jboss/spec/archetypes/jboss-javaee6-poh5-archetype/7.0.2-SNAPSHOT/jboss-javaee6-poh5-archetype-7.0.2-SNAPSHOT-sources.jar
===================================================================
(Binary files differ)
Property changes on: workspace/fred/repositories/snapshot/org/jboss/spec/archetypes/jboss-javaee6-poh5-archetype/7.0.2-SNAPSHOT/jboss-javaee6-poh5-archetype-7.0.2-SNAPSHOT-sources.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/fred/repositories/snapshot/org/jboss/spec/archetypes/jboss-javaee6-poh5-archetype/7.0.2-SNAPSHOT/jboss-javaee6-poh5-archetype-7.0.2-SNAPSHOT.jar
===================================================================
(Binary files differ)
Property changes on: workspace/fred/repositories/snapshot/org/jboss/spec/archetypes/jboss-javaee6-poh5-archetype/7.0.2-SNAPSHOT/jboss-javaee6-poh5-archetype-7.0.2-SNAPSHOT.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/fred/repositories/snapshot/org/jboss/spec/archetypes/jboss-javaee6-poh5-archetype/7.0.2-SNAPSHOT/jboss-javaee6-poh5-archetype-7.0.2-SNAPSHOT.pom
===================================================================
--- workspace/fred/repositories/snapshot/org/jboss/spec/archetypes/jboss-javaee6-poh5-archetype/7.0.2-SNAPSHOT/jboss-javaee6-poh5-archetype-7.0.2-SNAPSHOT.pom (rev 0)
+++ workspace/fred/repositories/snapshot/org/jboss/spec/archetypes/jboss-javaee6-poh5-archetype/7.0.2-SNAPSHOT/jboss-javaee6-poh5-archetype-7.0.2-SNAPSHOT.pom 2011-11-14 14:45:39 UTC (rev 36322)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>6-beta-2</version>
+ </parent>
+
+ <groupId>org.jboss.spec.archetypes</groupId>
+ <artifactId>jboss-javaee6-poh5-archetype</artifactId>
+ <version>7.0.2-SNAPSHOT</version>
+ <packaging>maven-archetype</packaging>
+
+ <name>Java EE 6 POH5 Webapp</name>
+
+ <description>An archetype that generates a starter Java EE 6 Plain Old HTML5 (POH5) webapp project for JBoss AS 7 / EAP 6</description>
+
+ <url>http://jboss.org/jbossas</url>
+
+ <developers>
+ <developer>
+ <name>Steven Boscarine</name>
+ <email>stevenboscarine(a)gmail.com</email>
+ </developer>
+ <developer>
+ <id>fbricon</id>
+ <name>Fred Bricon</name>
+ <email>fbricon(a)gmail.com</email>
+ <organization>Red Hat, Inc.</organization>
+ <organizationUrl>http://redhat.com/jboss</organizationUrl>
+ <url>http://community.jboss.org/people/fbricon</url>
+ <timezone>+1</timezone>
+ </developer>
+ <developer>
+ <name>Dan Allen</name>
+ <email>dan.j.allen(a)gmail.com</email>
+ <organization>JBoss, by Red Hat</organization>
+ <organizationUrl>http://redhat.com/jboss</organizationUrl>
+ <url>http://community.jboss.org/people/dan.j.allen</url>
+ </developer>
+ <developer>
+ <name>Pete Muir</name>
+ <email>pete.muir(a)jboss.org</email>
+ <organization>Red Hat, Inc.</organization>
+ <organizationUrl>http://redhat.com/jboss</organizationUrl>
+ <url>http://in.relation.to/Bloggers/Pete</url>
+ </developer>
+ <developer>
+ <name>Jay Balunas</name>
+ <email>jbalunas(a)jboss.org</email>
+ <organization>Red Hat, Inc.</organization>
+ <organizationUrl>http://redhat.com/jboss</organizationUrl>
+ <url>http://in.relation.to/Bloggers/Jay</url>
+ </developer>
+ </developers>
+
+ <repositories>
+ <repository>
+ <id>jboss-public-repository</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/nexus/content/groups/public</url>
+ <!-- These optional flags are designed to speed up your builds by
+ reducing remote server calls -->
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>archetype-packaging</artifactId>
+ <version>2.1</version>
+ </extension>
+ </extensions>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-archetype-plugin</artifactId>
+ <version>2.1</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
13 years, 1 month
JBoss Tools SVN: r36321 - in trunk/cdi/tests/org.jboss.tools.cdi.bot.test: resources and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2011-11-14 07:39:50 -0500 (Mon, 14 Nov 2011)
New Revision: 36321
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/EventsProducer.java.cdi
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/MyBean1.java.cdi
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/MyBean2.java.cdi
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/ObserverBean.java.cdi
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/CDIBeansEditorTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIFacetTest.java
Removed:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/BeansEditorTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDISmokeBotTests.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/CDIFindObserverForEventTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/CDIOpenOnTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/CDIQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/seam3/CDISeam3Test.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/CDIBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/CDIUtil.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/Wizard.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIATWizardTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIConfigurationPresetTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIPerspectiveTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/todo.txt
Log:
CDIFindObserverForEventTest + CDIFacetTest + huge refactoring + resources, needed for tests, added
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/EventsProducer.java.cdi
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/EventsProducer.java.cdi (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/EventsProducer.java.cdi 2011-11-14 12:39:50 UTC (rev 36321)
@@ -0,0 +1,67 @@
+package cdi;
+
+import javax.ejb.Stateless;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+import javax.inject.Inject;
+
+@Stateless
+public class EventsProducer {
+
+ public EventsProducer() {
+
+ }
+
+ @Inject
+ @Q1
+ Event<MyBean1> myBean1Q1Event;
+
+ @Inject
+ @Any
+ Event<MyBean1> myBean1AnyEvent;
+
+
+ @Inject
+ @Q1
+ Event<MyBean2> myBean2Q1Event;
+
+ @Inject
+ @Any
+ Event<MyBean2> myBean2AnyEvent;
+
+ @Inject
+ @Q2
+ Event<MyBean1> myBean1Q2Event;
+
+ @Inject
+ @Q2
+ Event<MyBean2> myBean2Q2Event;
+
+ public void fireEvent1() {
+ myBean1Q1Event.fire(new MyBean1());
+ }
+
+ public void fireEvent2() {
+ myBean1AnyEvent.fire(new MyBean1());
+ }
+
+ public void fireEvent3() {
+ myBean2Q1Event.fire(new MyBean2());
+ }
+
+ public void fireEvent4() {
+ myBean2AnyEvent.fire(new MyBean2());
+ }
+
+ public void fireEvent5() {
+ myBean1Q2Event.fire(new MyBean1());
+ }
+
+ public void fireEvent6() {
+ myBean2Q2Event.fire(new MyBean2());
+ }
+
+ public void fireEvent7() {
+ myBean1AnyEvent.fire(new MyBean2());
+ }
+}
\ No newline at end of file
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/MyBean1.java.cdi
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/MyBean1.java.cdi (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/MyBean1.java.cdi 2011-11-14 12:39:50 UTC (rev 36321)
@@ -0,0 +1,15 @@
+package cdi;
+
+public class MyBean1 {
+
+ String message;
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+}
\ No newline at end of file
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/MyBean2.java.cdi
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/MyBean2.java.cdi (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/MyBean2.java.cdi 2011-11-14 12:39:50 UTC (rev 36321)
@@ -0,0 +1,5 @@
+package cdi;
+
+public class MyBean2 extends MyBean1 {
+
+}
\ No newline at end of file
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/ObserverBean.java.cdi
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/ObserverBean.java.cdi (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/events/ObserverBean.java.cdi 2011-11-14 12:39:50 UTC (rev 36321)
@@ -0,0 +1,41 @@
+package cdi;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Any;
+
+public class ObserverBean {
+
+
+ public void observeNoQualifierMyBean1(@Observes MyBean1 bean) {
+
+ }
+
+ public void observeAnyMyBean1(@Observes @Any MyBean1 bean) {
+
+ }
+
+ public void observeQ1MyBean1(@Observes @Q1 MyBean1 bean) {
+
+ }
+
+ public void observeNoQualifierMyBean2(@Observes MyBean2 bean) {
+
+ }
+
+ public void observeAnyMyBean2(@Observes @Any MyBean2 bean) {
+
+ }
+
+ public void observeQ1MyBean2(@Observes @Q1 MyBean2 bean) {
+
+ }
+
+ public void observeQ2MyBean1(@Observes @Q2 MyBean1 bean) {
+
+ }
+
+ public void observeQ2MyBean2(@Observes @Q2 MyBean2 bean) {
+
+ }
+
+}
\ No newline at end of file
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java 2011-11-13 19:35:17 UTC (rev 36320)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java 2011-11-14 12:39:50 UTC (rev 36321)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.bot.test;
-import org.jboss.tools.cdi.bot.test.editor.BeansEditorTest;
+import org.jboss.tools.cdi.bot.test.editor.CDIBeansEditorTest;
import org.jboss.tools.cdi.bot.test.openon.CDIFindObserverForEventTest;
import org.jboss.tools.cdi.bot.test.openon.CDIOpenOnTest;
import org.jboss.tools.cdi.bot.test.quickfix.CDIQuickFixTest;
@@ -19,7 +19,7 @@
import org.jboss.tools.cdi.bot.test.uiutils.actions.CDIUtil;
import org.jboss.tools.cdi.bot.test.wizard.CDIATWizardTest;
import org.jboss.tools.cdi.bot.test.wizard.CDIConfigurationPresetTest;
-import org.jboss.tools.cdi.bot.test.wizard.CDIPerspectiveTest;
+import org.jboss.tools.cdi.bot.test.wizard.CDIFacetTest;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
import org.jboss.tools.ui.bot.ext.types.ViewType;
import org.junit.BeforeClass;
@@ -42,7 +42,7 @@
* JAVA=1.6,/space/java/sdk/jdk1.6.0_22
*
*
- * Suite duration: aprox. 14min
+ * Suite duration: aprox. 19min
*
* @author Lukas Jungmann
* @author Jaroslav Jankovic
@@ -50,9 +50,10 @@
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({
//CDIPerspectiveTest.class,
- CDIConfigurationPresetTest.class,
+ CDIConfigurationPresetTest.class,
+ CDIFacetTest.class,
CDIATWizardTest.class,
- BeansEditorTest.class,
+ CDIBeansEditorTest.class,
CDIQuickFixTest.class,
CDIOpenOnTest.class,
CDIFindObserverForEventTest.class,
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDISmokeBotTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDISmokeBotTests.java 2011-11-13 19:35:17 UTC (rev 36320)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDISmokeBotTests.java 2011-11-14 12:39:50 UTC (rev 36321)
@@ -10,10 +10,12 @@
******************************************************************************/
package org.jboss.tools.cdi.bot.test;
+import org.jboss.tools.cdi.bot.test.editor.CDIBeansEditorTest;
import org.jboss.tools.cdi.bot.test.uiutils.actions.CDIBase;
import org.jboss.tools.cdi.bot.test.uiutils.actions.CDIUtil;
import org.jboss.tools.cdi.bot.test.wizard.CDIATWizardTest;
import org.jboss.tools.cdi.bot.test.wizard.CDIConfigurationPresetTest;
+import org.jboss.tools.cdi.bot.test.wizard.CDIFacetTest;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
import org.jboss.tools.ui.bot.ext.types.ViewType;
import org.junit.BeforeClass;
@@ -36,7 +38,7 @@
* JAVA=1.6,/space/java/sdk/jdk1.6.0_22
*
*
- * Suite duration: aprox. 12min
+ * Suite duration: aprox. 3min
*
* @author Jaroslav Jankovic
*/
@@ -44,7 +46,9 @@
@SuiteClasses({
//CDIPerspectiveTest.class,
CDIConfigurationPresetTest.class,
+ CDIFacetTest.class,
CDIATWizardTest.class,
+ CDIBeansEditorTest.class,
})
public class CDISmokeBotTests extends CDIBase {
Deleted: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/BeansEditorTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/BeansEditorTest.java 2011-11-13 19:35:17 UTC (rev 36320)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/BeansEditorTest.java 2011-11-14 12:39:50 UTC (rev 36321)
@@ -1,287 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.cdi.bot.test.editor;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.jboss.tools.cdi.bot.test.CDIAllBotTests;
-import org.jboss.tools.cdi.bot.test.uiutils.actions.CDIBase;
-import org.jboss.tools.cdi.bot.test.uiutils.editor.BeansEditor;
-import org.jboss.tools.cdi.bot.test.uiutils.editor.BeansEditor.Item;
-import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
-import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
-import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
-import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
-import org.jboss.tools.ui.bot.ext.types.EntityType;
-import org.jboss.tools.ui.bot.ext.view.ProjectExplorer;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite.SuiteClasses;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-/**
- * prerequisite - CDIAtWizardTest
- *
- *
- * TO DO - copy resources into right location - PACKAGE_NAME
- *
- * @author Lukas Jungmann
- * @author jjankovi
- */
-@Require(clearProjects = false, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
-(a)RunWith(RequirementAwareSuite.class)
-@SuiteClasses({ CDIAllBotTests.class })
-public class BeansEditorTest extends CDIBase {
-
- private static final String descPath = "WebContent/WEB-INF/beans.xml";
- private static final String project = "CDIProject";
- private static final String PACKAGE_NAME = "cdi";
- private static final Logger LOGGER = Logger.getLogger(BeansEditorTest.class.getName());
-
- @BeforeClass
- public static void prepare() {
- if (!projectExists(project)) {
- createAndCheckCDIProject(bot, util, projectExplorer, project);
- createPackage(PACKAGE_NAME);
- }
-
- copyResource("resources/beans.xml", descPath);
- copyResource("resources/Foo.jav_", "src/" + PACKAGE_NAME + "/Foo.java");
- copyResource("resources/Bar.jav_", "src/" + PACKAGE_NAME + "/Bar.java");
- }
-
- @AfterClass
- public static void clean() {
- removeObjectInProjectExplorer(PACKAGE_NAME, project + "/Java Resources/src");
- removeObjectInProjectExplorer("beans.xml", project + "/WebContent/WEB-INF");
- }
-
- @Before
- public void setup() {
- new ProjectExplorer().openFile(project, descPath.split("/"));
- }
-
- @After
- public void waitForJobs() {
- util.waitForNonIgnoredJobs();
- }
-
- @Test
- public void testClasses() {
- addItem(Item.CLASS, PACKAGE_NAME + ".Foo");
- addItem(Item.CLASS, PACKAGE_NAME + ".Bar");
- removeItem(Item.CLASS, PACKAGE_NAME + ".Foo");
- }
-
- @Test
- public void testInterceptors() {
- addItem(Item.INTERCEPTOR, PACKAGE_NAME + ".I1");
- removeItem(Item.INTERCEPTOR, PACKAGE_NAME + ".I1");
- addItem(Item.INTERCEPTOR, PACKAGE_NAME + ".I2");
- }
-
-
- @Test
- public void testDecorators() {
- addItem(Item.DECORATOR, PACKAGE_NAME + ".MapDecorator");
- addItem(Item.DECORATOR, PACKAGE_NAME + ".ComparableDecorator");
- removeItem(Item.DECORATOR, PACKAGE_NAME + ".ComparableDecorator");
- }
-
-
- @Test
- public void testStereotypes() {
- addItem(Item.STEREOTYPE, PACKAGE_NAME + ".S2");
- addItem(Item.STEREOTYPE, PACKAGE_NAME + ".S3");
- removeItem(Item.STEREOTYPE, PACKAGE_NAME + ".S3");
- addItem(Item.STEREOTYPE, PACKAGE_NAME + ".S1");
- removeItem(Item.STEREOTYPE, PACKAGE_NAME + ".S2");
- }
-
- @Test
- public void testResult() {
- SWTBotEditor editor = new SWTWorkbenchBot().activeEditor();
- BeansEditor be = new BeansEditor(editor.getReference(), new SWTWorkbenchBot());
- be.activatePage("Source");
- String text = be.toTextEditor().getText();
- List<Node> nl = getItems(text, Item.INTERCEPTOR);
- assertEquals(1, nl.size());
- assertTrue(containsItem(nl, PACKAGE_NAME + ".I2"));
-
- nl = getItems(text, Item.DECORATOR);
- assertEquals(1, nl.size());
- assertTrue(containsItem(nl, PACKAGE_NAME + ".MapDecorator"));
-
- nl = getItems(text, Item.CLASS);
- assertEquals(1, nl.size());
- assertTrue(containsItem(nl, PACKAGE_NAME + ".Bar"));
-
- nl = getItems(text, Item.STEREOTYPE);
- assertEquals(1, nl.size());
- assertTrue(containsItem(nl, PACKAGE_NAME + ".S1"));
- }
-
- private void addItem(Item item, String name) {
- SWTBotEditor editor = new SWTWorkbenchBot().activeEditor();
- BeansEditor be = new BeansEditor(editor.getReference(), new SWTWorkbenchBot());
- be.activatePage("Tree");
- try {
- be.add(item, name);
- Assert.assertTrue(be.isDirty());
- Assert.assertEquals(name, be.getSelectedItem());
- be.activatePage("Source");
- String text = be.toTextEditor().getText();
- List<Node> nl = getItems(text, item);
- assertTrue(containsItem(nl, name));
- } finally {
- if (be.isDirty()) {
- be.save();
- }
- }
- }
-
- private void removeItem(Item item, String name) {
- SWTBotEditor editor = new SWTWorkbenchBot().activeEditor();
- BeansEditor be = new BeansEditor(editor.getReference(), new SWTWorkbenchBot());
- be.activatePage("Tree");
- try {
- be.remove(item, name);
- Assert.assertTrue(be.isDirty());
- be.activatePage("Source");
- String text = be.toTextEditor().getText();
- List<Node> nl = getItems(text, item);
- assertFalse(containsItem(nl, name));
- } finally {
- if (be.isDirty()) {
- be.save();
- }
- }
- }
-
- private Document getDocument(String text) {
- Document d = null;
- try {
- d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(text.getBytes()));
- } catch (SAXException e) {
- LOGGER.log(Level.SEVERE, e.getMessage(), e);
- } catch (IOException e) {
- LOGGER.log(Level.SEVERE, e.getMessage(), e);
- } catch (ParserConfigurationException e) {
- LOGGER.log(Level.SEVERE, e.getMessage(), e);
- }
- return d;
- }
-
- private List<Node> getItems(String doc, Item i) {
- Document d = getDocument(doc);
- NodeList nl = null;
- switch (i) {
- case DECORATOR:
- nl = d.getElementsByTagName("decorators");
- break;
- case INTERCEPTOR:
- nl = d.getElementsByTagName("interceptors");
- break;
- case STEREOTYPE:
- return getNodes(d.getElementsByTagName("stereotype"), i);
- case CLASS:
- nl = d.getElementsByTagName("alternatives");
- break;
- }
- return nl.getLength() > 0 ? getNodes(nl.item(0).getChildNodes(), i) : new ArrayList<Node>();
- }
-
- private List<Node> getNodes(NodeList nl, Item item) {
- List<Node> list = new ArrayList<Node>();
- for (int i = 0; i < nl.getLength(); i++) {
- Node n = nl.item(i);
- if (item.getElementName().equals(n.getNodeName())) {
- list.add(n);
- }
- }
- return list;
- }
-
- private boolean containsItem(List<Node> nl, String name) {
- if (nl == null) {
- return false;
- }
- for (int i = 0; i < nl.size(); i++) {
- if (name.equals(nl.get(i).getTextContent())) {
- return true;
- }
- }
- return false;
- }
-
- private static void createPackage(String packageName) {
- projectExplorer.selectProject(project);
- eclipse.createNew(EntityType.JAVA_PACKAGE);
- SWTBot packageDialogBot = bot.activeShell().bot();
- packageDialogBot.textWithLabel("Name:").typeText(packageName);
- packageDialogBot.button("Finish").click();
- util.waitForNonIgnoredJobs();
- LOGGER.info("Package " + PACKAGE_NAME + " created");
- }
-
- private static void copyResource(String src, String target) {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProjects()[0];
- IFile f = project.getFile(target);
- if (f.exists()) {
- LOGGER.info("Replacing " + target + " file");
- try {
- f.delete(true, new NullProgressMonitor());
- } catch (CoreException ce) {
- LOGGER.log(Level.WARNING, ce.getMessage(), ce);
- }
- }
- InputStream is = null;
- try {
- is = BeansEditorTest.class.getResourceAsStream(src);
- f.create(is, true, new NullProgressMonitor());
- } catch (CoreException ce) {
- LOGGER.log(Level.WARNING, ce.getMessage(), ce);
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException ioe) {
- //ignore
- }
- }
- }
- }
-}
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/CDIBeansEditorTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/CDIBeansEditorTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/editor/CDIBeansEditorTest.java 2011-11-14 12:39:50 UTC (rev 36321)
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.bot.test.editor;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.jboss.tools.cdi.bot.test.CDIAllBotTests;
+import org.jboss.tools.cdi.bot.test.uiutils.actions.CDIBase;
+import org.jboss.tools.cdi.bot.test.uiutils.actions.CDIUtil;
+import org.jboss.tools.cdi.bot.test.uiutils.editor.BeansEditor;
+import org.jboss.tools.cdi.bot.test.uiutils.editor.BeansEditor.Item;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
+import org.jboss.tools.ui.bot.ext.view.ProjectExplorer;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * prerequisite - CDIAtWizardTest!!!
+ *
+ *
+ * @author Lukas Jungmann
+ * @author jjankovi
+ */
+@Require(clearProjects = false, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
+(a)RunWith(RequirementAwareSuite.class)
+@SuiteClasses({ CDIAllBotTests.class })
+public class CDIBeansEditorTest extends CDIBase {
+
+ private static final String descPath = "WebContent/WEB-INF/beans.xml";
+ private static final Logger LOGGER = Logger.getLogger(CDIBeansEditorTest.class.getName());
+
+ @BeforeClass
+ public static void setup() {
+ CDIUtil.copyResource("resources/beans.xml", descPath);
+ CDIUtil.copyResource("resources/Foo.jav_", "src/cdi/Foo.java");
+ CDIUtil.copyResource("resources/Bar.jav_", "src/cdi/Bar.java");
+ }
+
+ @Override
+ public void checkAndCreateProject() {
+ new ProjectExplorer().openFile(getProjectName(), descPath.split("/"));
+ }
+
+ @Override
+ public String getProjectName() {
+ return "CDIWizardTest";
+ }
+
+ @Test
+ public void testClasses() {
+ addItem(Item.CLASS, getPackageName() + ".Foo");
+ addItem(Item.CLASS, getPackageName() + ".Bar");
+ removeItem(Item.CLASS, getPackageName() + ".Foo");
+ }
+
+ @Test
+ public void testInterceptors() {
+ addItem(Item.INTERCEPTOR, getPackageName() + ".I1");
+ removeItem(Item.INTERCEPTOR, getPackageName() + ".I1");
+ addItem(Item.INTERCEPTOR, getPackageName() + ".I2");
+ }
+
+
+ @Test
+ public void testDecorators() {
+ addItem(Item.DECORATOR, getPackageName() + ".MapDecorator");
+ addItem(Item.DECORATOR, getPackageName() + ".ComparableDecorator");
+ removeItem(Item.DECORATOR, getPackageName() + ".ComparableDecorator");
+ }
+
+
+ @Test
+ public void testStereotypes() {
+ addItem(Item.STEREOTYPE, getPackageName() + ".S2");
+ addItem(Item.STEREOTYPE, getPackageName() + ".S3");
+ removeItem(Item.STEREOTYPE, getPackageName() + ".S3");
+ addItem(Item.STEREOTYPE, getPackageName() + ".S1");
+ removeItem(Item.STEREOTYPE, getPackageName() + ".S2");
+ }
+
+ @Test
+ public void testResult() {
+ SWTBotEditor editor = new SWTWorkbenchBot().activeEditor();
+ BeansEditor be = new BeansEditor(editor.getReference(), new SWTWorkbenchBot());
+ be.activatePage("Source");
+ String text = be.toTextEditor().getText();
+ List<Node> nl = getItems(text, Item.INTERCEPTOR);
+ assertEquals(1, nl.size());
+ assertTrue(containsItem(nl, getPackageName() + ".I2"));
+
+ nl = getItems(text, Item.DECORATOR);
+ assertEquals(1, nl.size());
+ assertTrue(containsItem(nl, getPackageName() + ".MapDecorator"));
+
+ nl = getItems(text, Item.CLASS);
+ assertEquals(1, nl.size());
+ assertTrue(containsItem(nl, getPackageName() + ".Bar"));
+
+ nl = getItems(text, Item.STEREOTYPE);
+ assertEquals(1, nl.size());
+ assertTrue(containsItem(nl, getPackageName() + ".S1"));
+ }
+
+ private void addItem(Item item, String name) {
+ SWTBotEditor editor = new SWTWorkbenchBot().activeEditor();
+ BeansEditor be = new BeansEditor(editor.getReference(), new SWTWorkbenchBot());
+ be.activatePage("Tree");
+ try {
+ be.add(item, name);
+ Assert.assertTrue(be.isDirty());
+ Assert.assertEquals(name, be.getSelectedItem());
+ be.activatePage("Source");
+ String text = be.toTextEditor().getText();
+ List<Node> nl = getItems(text, item);
+ assertTrue(containsItem(nl, name));
+ } finally {
+ if (be.isDirty()) {
+ be.save();
+ }
+ }
+ }
+
+ private void removeItem(Item item, String name) {
+ SWTBotEditor editor = new SWTWorkbenchBot().activeEditor();
+ BeansEditor be = new BeansEditor(editor.getReference(), new SWTWorkbenchBot());
+ be.activatePage("Tree");
+ try {
+ be.remove(item, name);
+ Assert.assertTrue(be.isDirty());
+ be.activatePage("Source");
+ String text = be.toTextEditor().getText();
+ List<Node> nl = getItems(text, item);
+ assertFalse(containsItem(nl, name));
+ } finally {
+ if (be.isDirty()) {
+ be.save();
+ }
+ }
+ }
+
+ private Document getDocument(String text) {
+ Document d = null;
+ try {
+ d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(text.getBytes()));
+ } catch (SAXException e) {
+ LOGGER.log(Level.SEVERE, e.getMessage(), e);
+ } catch (IOException e) {
+ LOGGER.log(Level.SEVERE, e.getMessage(), e);
+ } catch (ParserConfigurationException e) {
+ LOGGER.log(Level.SEVERE, e.getMessage(), e);
+ }
+ return d;
+ }
+
+ private List<Node> getItems(String doc, Item i) {
+ Document d = getDocument(doc);
+ NodeList nl = null;
+ switch (i) {
+ case DECORATOR:
+ nl = d.getElementsByTagName("decorators");
+ break;
+ case INTERCEPTOR:
+ nl = d.getElementsByTagName("interceptors");
+ break;
+ case STEREOTYPE:
+ return getNodes(d.getElementsByTagName("stereotype"), i);
+ case CLASS:
+ nl = d.getElementsByTagName("alternatives");
+ break;
+ }
+ return nl.getLength() > 0 ? getNodes(nl.item(0).getChildNodes(), i) : new ArrayList<Node>();
+ }
+
+ private List<Node> getNodes(NodeList nl, Item item) {
+ List<Node> list = new ArrayList<Node>();
+ for (int i = 0; i < nl.getLength(); i++) {
+ Node n = nl.item(i);
+ if (item.getElementName().equals(n.getNodeName())) {
+ list.add(n);
+ }
+ }
+ return list;
+ }
+
+ private boolean containsItem(List<Node> nl, String name) {
+ if (nl == null) {
+ return false;
+ }
+ for (int i = 0; i < nl.size(); i++) {
+ if (name.equals(nl.get(i).getTextContent())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/CDIFindObserverForEventTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/CDIFindObserverForEventTest.java 2011-11-13 19:35:17 UTC (rev 36320)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/CDIFindObserverForEventTest.java 2011-11-14 12:39:50 UTC (rev 36321)
@@ -10,64 +10,327 @@
******************************************************************************/
package org.jboss.tools.cdi.bot.test.openon;
+import java.util.logging.Logger;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.jboss.tools.cdi.bot.test.CDIAllBotTests;
import org.jboss.tools.cdi.bot.test.uiutils.actions.CDIBase;
+import org.jboss.tools.cdi.bot.test.uiutils.actions.CDIUtil;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.jboss.tools.ui.bot.ext.Timing;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
-import org.junit.After;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
/**
-* Test operates on CDI perspective
-*
-* @author Jaroslav Jankovic
-*/
+ * Test operates on CDI perspective
+ *
+ * @author Jaroslav Jankovic
+ */
-@Require(clearProjects = false, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
+@Require(clearProjects = true, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({ CDIAllBotTests.class })
public class CDIFindObserverForEventTest extends CDIBase {
- //private static final Logger LOGGER = Logger.getLogger(CDIFindObserverForEventTest.class.getName());
- private static final String PROJECT_NAME = "CDIProject";
- //private static final String PACKAGE_NAME = "cdi";
-
-
- @BeforeClass
- public static void checkAndCreateProject() {
- if (!projectExists(PROJECT_NAME)) {
- createAndCheckCDIProject(bot, util, projectExplorer,PROJECT_NAME);
- }
+ private static final Logger LOGGER = Logger.getLogger(CDIFindObserverForEventTest.class.getName());
+ private final String[] events = { "myBean1Q1Event", "myBean1AnyEvent",
+ "myBean2Q1Event", "myBean2AnyEvent", "myBean1Q2Event",
+ "myBean2Q2Event", "myBean1Q1Event.fire(new MyBean1());",
+ "myBean1AnyEvent.fire(new MyBean1())",
+ "myBean2Q1Event.fire(new MyBean2())",
+ "myBean2AnyEvent.fire(new MyBean2())",
+ "myBean1Q2Event.fire(new MyBean1())",
+ "myBean2Q2Event.fire(new MyBean2())",
+ "myBean1AnyEvent.fire(new MyBean2())" };
+ private final String[] observers = { "observeNoQualifierMyBean1",
+ "observeAnyMyBean1", "observeQ1MyBean1",
+ "observeNoQualifierMyBean2", "observeAnyMyBean2",
+ "observeQ1MyBean2", "observeQ2MyBean1", "observeQ2MyBean2" };
+
+ @Override
+ public String getProjectName() {
+ return "CDIObserverTest";
}
- @After
- public void waitForJobs() {
- util.waitForNonIgnoredJobs();
- }
-
- //not implemented yet
@Test
- public void testSimpleObserverFinding() {
+ public void testSimpleCaseObserverFinding() {
+
prepareSimpleObserverFinding();
-
+
+ testSimpleObserverFinding();
+
}
- //not implemented yet
+
+ // not implemented yet
@Test
- public void testComplexObserverFinding() {
- prepareComplexObserverFinding();
+ public void testComplexCaseObserverFinding() {
+
+ prepareComplexObserverFinding();
+
+ testComplexObserverFinding();
}
-
+
private void prepareSimpleObserverFinding() {
+
+ createComponent(CDICOMPONENT.QUALIFIER, "Q1", getPackageName(), null);
+
+ createComponent(CDICOMPONENT.QUALIFIER, "Q2", getPackageName(), null);
+
+ createComponent(CDICOMPONENT.BEAN, "MyBean1", getPackageName(), null);
+ CDIUtil.copyResourceToClass(getEd(), CDIFindObserverForEventTest.class
+ .getResourceAsStream("/resources/events/MyBean1.java.cdi"),
+ false);
+
+ createComponent(CDICOMPONENT.BEAN, "MyBean2", getPackageName(), null);
+ CDIUtil.copyResourceToClass(getEd(), CDIFindObserverForEventTest.class
+ .getResourceAsStream("/resources/events/MyBean2.java.cdi"),
+ false);
+
+ createComponent(CDICOMPONENT.BEAN, "EventsProducer", getPackageName(), null);
+ CDIUtil.copyResourceToClass(
+ getEd(),
+ CDIFindObserverForEventTest.class
+ .getResourceAsStream("/resources/events/EventsProducer.java.cdi"),
+ false);
+
+ createComponent(CDICOMPONENT.BEAN, "ObserverBean", getPackageName(), null);
+ CDIUtil.copyResourceToClass(
+ getEd(),
+ CDIFindObserverForEventTest.class
+ .getResourceAsStream("/resources/events/ObserverBean.java.cdi"),
+ false);
+ util.waitForNonIgnoredJobs();
+ }
+
+ private void testSimpleObserverFinding() {
+
+ for (int i = 0; i < events.length; i++) {
+ checkObserverMethodsForEvent(events[i]);
+ }
+
+
+ for (int i = 0; i < observers.length; i++) {
+ checkEventsForObserverMethods(observers[i]);
+ }
}
-
- private void prepareComplexObserverFinding() {
+
+ private void checkObserverMethodsForEvent(String eventName) {
+ String eventsClass = "EventsProducer.java";
+
+ String showObserverOption = "Show CDI Observer Methods...";
+
+ checkEventsAndObserver(eventName, eventsClass, showObserverOption);
+
}
+
+ private void checkEventsForObserverMethods(String observerName) {
+
+ String observerClass = "ObserverBean.java";
+
+ /**
+ * there are two observer methods for which there is only one
+ * event, so there will be no "Show CDI Events" option, instead
+ * of that, there will be "Open CDI Event" option
+ */
+ String showObserverOption = ((observerName.equals("observeQ1MyBean2")) ||
+ (observerName.equals("observeQ2MyBean2"))) ? "Open CDI Event" : "Show CDI Events...";
+
+ checkEventsAndObserver(observerName, observerClass, showObserverOption);
+ }
+
+ private void checkEventsAndObserver(String name, String className,
+ String option) {
+ openOn(name, className, option);
+ bot.sleep(Timing.time1S());
+ if (option.equals("Open CDI Event")) {
+ if (name.equals("observeQ1MyBean2")) {
+ LOGGER.info("Testing observer: observeQ1MyBean2 started");
+ assertTrue(getEd().toTextEditor().getSelection().equals("myBean2Q1Event"));
+ LOGGER.info("Testing observer: observeQ1MyBean2 ended");
+ }else {
+ //observeQ1MyBean2
+ LOGGER.info("Testing observer: observeQ1MyBean2 started");
+ assertTrue(getEd().toTextEditor().getSelection().equals("myBean2Q2Event"));
+ LOGGER.info("Testing observer: observeQ1MyBean2 ended");
+ }
+ } else {
+ SWTBotTable observerTable = bot.table(0);
+ if (className.equals("EventsProducer.java")) {
+ assertTrue(checkAllObserverMethodsForEvent(name, observerTable));
+ }
+ if (className.equals("ObserverBean.java")) {
+ assertTrue(checkAllEventsForObserverMethod(name, observerTable));
+ }
+ }
+ }
+
+ private boolean checkAllObserverMethodsForEvent(String eventName,
+ SWTBotTable observerTable) {
+ String observerClass = "ObserverBean";
+ String packageProjectPath = getPackageName() + " - /" + getProjectName() + "/src";
+ String parametrizedEventItem = observerClass + ".observeXXX() - " + packageProjectPath;
+ boolean allObserversFound = false;
+ for (int i = 0; i < events.length; i++) {
+ if (eventName.equals(events[i])) {
+ LOGGER.info("Testing event: " + events[i] + " started");
+ switch (i) {
+ //myBean1Q1Event
+ //myBean1Q1Event.fire(new MyBean1())
+ case 0:
+ case 6:
+ if (observerTable.containsItem(parametrizedEventItem.replace("XXX", "Q1MyBean1")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "AnyMyBean1")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "NoQualifierMyBean1"))) {
+ allObserversFound = true;
+ }
+ break;
+ //myBean1AnyEvent
+ //myBean1AnyEvent.fire(new MyBean1())
+ //myBean1AnyEvent.fire(new MyBean2())
+ case 1:
+ case 7:
+ case 12:
+ if (observerTable.containsItem(parametrizedEventItem.replace("XXX", "AnyMyBean1")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "NoQualifierMyBean1"))) {
+ allObserversFound = true;
+ }
+ break;
+ //myBean2Q1Event
+ //myBean2Q1Event.fire(new MyBean2())
+ case 2:
+ case 8:
+ if (observerTable.containsItem(parametrizedEventItem.replace("XXX", "Q1MyBean1")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "Q1MyBean2")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "AnyMyBean1")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "AnyMyBean2")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "NoQualifierMyBean1")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "NoQualifierMyBean2"))) {
+ allObserversFound = true;
+ }
+ break;
+ //myBean2AnyEvent
+ //myBean2AnyEvent.fire(new MyBean2())
+ case 3:
+ case 9:
+ if (observerTable.containsItem(parametrizedEventItem.replace("XXX", "AnyMyBean1")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "AnyMyBean2")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "NoQualifierMyBean1")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "NoQualifierMyBean2"))) {
+ allObserversFound = true;
+ }
+ break;
+ //myBean1Q2Event
+ //myBean1Q2Event.fire(new MyBean1())
+ case 4:
+ case 10:
+ if (observerTable.containsItem(parametrizedEventItem.replace("XXX", "Q2MyBean1")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "AnyMyBean1")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "NoQualifierMyBean1"))) {
+ allObserversFound = true;
+ }
+ break;
+ //myBean2Q2Event
+ //myBean2Q2Event.fire(new MyBean2())
+ case 5:
+ case 11:
+ if (observerTable.containsItem(parametrizedEventItem.replace("XXX", "Q2MyBean1")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "Q2MyBean2")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "AnyMyBean1")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "AnyMyBean2")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "NoQualifierMyBean1")) &&
+ observerTable.containsItem(parametrizedEventItem.replace("XXX", "NoQualifierMyBean2"))) {
+ allObserversFound = true;
+ }
+ break;
+ }
+ LOGGER.info("Testing event: " + events[i] + " ended");
+ break;
+ }
+ }
+ return allObserversFound;
+ }
+
+ private boolean checkAllEventsForObserverMethod(String observerName,
+ SWTBotTable eventsTable) {
+ String eventsClass = "EventsProducer";
+ String packageProjectPath = getPackageName() + " - /" + getProjectName() + "/src";
+ String parametrizedEventItem = eventsClass + ".myBeanXXX - " + packageProjectPath;
+ boolean allEventsFound = false;
+ for (int i = 0; i < observers.length; i++) {
+ if (observerName.equals(observers[i])) {
+ LOGGER.info("Testing observer: " + observers[i] + " started");
+ switch (i) {
+ //observeNoQualifierMyBean1
+ //observeAnyMyBean1
+ case 0:
+ case 1:
+ if (eventsTable.containsItem(parametrizedEventItem.replace("XXX", "1Q1Event")) &&
+ eventsTable.containsItem(parametrizedEventItem.replace("XXX", "2Q1Event")) &&
+ eventsTable.containsItem(parametrizedEventItem.replace("XXX", "1AnyEvent")) &&
+ eventsTable.containsItem(parametrizedEventItem.replace("XXX", "2AnyEvent")) &&
+ eventsTable.containsItem(parametrizedEventItem.replace("XXX", "1Q2Event")) &&
+ eventsTable.containsItem(parametrizedEventItem.replace("XXX", "2Q2Event"))) {
+ allEventsFound = true;
+ }
+ //observeQ1MyBean1
+ case 2:
+ if (eventsTable.containsItem(parametrizedEventItem.replace("XXX", "1Q1Event")) &&
+ eventsTable.containsItem(parametrizedEventItem.replace("XXX", "2Q1Event"))) {
+ allEventsFound = true;
+ }
+ break;
+ //observeNoQualifierMyBean2
+ //observeAnyMyBean2
+ case 3:
+ case 4:
+ if (eventsTable.containsItem(parametrizedEventItem.replace("XXX", "2Q1Event")) &&
+ eventsTable.containsItem(parametrizedEventItem.replace("XXX", "2AnyEvent")) &&
+ eventsTable.containsItem(parametrizedEventItem.replace("XXX", "2Q2Event"))) {
+ allEventsFound = true;
+ }
+ break;
+ //observeQ1MyBean2
+ case 5:
+ throw new IllegalStateException("Observer method \"observeQ1MyBean2\" should " +
+ "have been tested earlier!!");
+ //observeQ2MyBean1
+ case 6:
+ if (eventsTable.containsItem(parametrizedEventItem.replace("XXX", "1Q2Event")) &&
+ eventsTable.containsItem(parametrizedEventItem.replace("XXX", "2Q2Event"))) {
+ allEventsFound = true;
+ }
+ break;
+ //observeQ2MyBean2
+ case 7:
+ throw new IllegalStateException("Observer method \"observeQ2MyBean2\" should " +
+ "have been tested earlier!!");
+ }
+ LOGGER.info("Testing observer: " + observers[i] + " ended");
+ break;
+ }
+ }
+ return allEventsFound;
+ }
+
+ // not implemented yet
+ private void prepareComplexObserverFinding() {
+
+ }
+
+ // not implemented yet
+ private void testComplexObserverFinding() {
+ /**
+ * main idea - check events which have multiple qualifiers defined
+ * (http://docs.jboss.org/weld/reference/1.0.0/en-US/html/events.html -
+ * 11.6) - check events with qualifiers which has members
+ * (http://docs.jboss.org/weld/reference/1.0.0/en-US/html/events.html -
+ * 11.5)
+ */
+ }
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/CDIOpenOnTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/CDIOpenOnTest.java 2011-11-13 19:35:17 UTC (rev 36320)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/openon/CDIOpenOnTest.java 2011-11-14 12:39:50 UTC (rev 36321)
@@ -20,9 +20,6 @@
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@@ -36,43 +33,28 @@
* TO DO
*
* - Classes indication for Open Injected Class works
- * - https://issues.jboss.org/browse/JBIDE-6179
*
*
*/
-@Require(clearProjects = false, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
+@Require(clearProjects = true, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({ CDIAllBotTests.class })
public class CDIOpenOnTest extends CDIBase {
private static final Logger LOGGER = Logger.getLogger(CDIQuickFixTest.class.getName());
- private static final String PROJECT_NAME = "CDIProject";
- private static final String PACKAGE_NAME = "cdi";
- @BeforeClass
- public static void checkAndCreateProject() {
- if (!projectExists(PROJECT_NAME)) {
- createAndCheckCDIProject(bot, util, projectExplorer,PROJECT_NAME);
- }
+ @Override
+ public String getProjectName() {
+ return "CDIOpenOnTest";
}
-
- @AfterClass
- public static void clean() {
- removeObjectInProjectExplorer("beans.xml", PROJECT_NAME + "/WebContent/WEB-INF");
- }
-
- @After
- public void waitForJobs() {
- util.waitForNonIgnoredJobs();
- }
-
+
@Test
public void testBeanInjectOpenOn() {
- createComponent(CDICOMPONENT.BEAN, "Animal", PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "Animal", getPackageName(), null);
- createComponent(CDICOMPONENT.BEAN, "BrokenFarm", PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "BrokenFarm", getPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDIOpenOnTest.class
.getResourceAsStream("/resources/cdi/BrokenFarm.java.cdi"),
@@ -91,39 +73,39 @@
/*
* check if beans.xml was not created in previous tests. If so, I cannot create
- * beans.xml into PROJECT_NAME/WebContent/WEB-INF/beans.xml.
+ * beans.xml into getProjectName()/WebContent/WEB-INF/beans.xml.
*/
- if (!projectExplorer.isFilePresent(PROJECT_NAME, "WebContent/META-INF/beans.xml") &&
- !projectExplorer.isFilePresent(PROJECT_NAME, "WebContent/WEB-INF/beans.xml")) {
- createComponent(CDICOMPONENT.BEANSXML, null, PROJECT_NAME + "/WebContent/WEB-INF", null);
+ if (!projectExplorer.isFilePresent(getProjectName(), "WebContent/META-INF/beans.xml") &&
+ !projectExplorer.isFilePresent(getProjectName(), "WebContent/WEB-INF/beans.xml")) {
+ createComponent(CDICOMPONENT.BEANSXML, null, getProjectName() + "/WebContent/WEB-INF", null);
}
- createComponent(CDICOMPONENT.DECORATOR, "D1", PACKAGE_NAME,
+ createComponent(CDICOMPONENT.DECORATOR, "D1", getPackageName(),
"java.util.Set");
bot.editorByTitle("beans.xml").show();
bot.cTabItem("Source").activate();
- openOn(PACKAGE_NAME + ".D1", "beans.xml", null);
+ openOn(getPackageName() + ".D1", "beans.xml", null);
assertTrue("ERROR: redirected to " + getEd().getTitle(),
getEd().getTitle().equals("D1.java"));
- createComponent(CDICOMPONENT.INTERCEPTOR, "Interceptor1", PACKAGE_NAME,
+ createComponent(CDICOMPONENT.INTERCEPTOR, "Interceptor1", getPackageName(),
null);
bot.editorByTitle("beans.xml").show();
- openOn(PACKAGE_NAME + ".Interceptor1", "beans.xml", null);
+ openOn(getPackageName() + ".Interceptor1", "beans.xml", null);
assertTrue("ERROR: redirected to " + getEd(),
getEd().getTitle().equals("Interceptor1.java"));
- createComponent(CDICOMPONENT.BEAN, "B1", PACKAGE_NAME,
+ createComponent(CDICOMPONENT.BEAN, "B1", getPackageName(),
"alternative+beansxml");
bot.editorByTitle("beans.xml").show();
- openOn(PACKAGE_NAME + ".B1", "beans.xml", null);
+ openOn(getPackageName() + ".B1", "beans.xml", null);
assertTrue("ERROR: redirected to " + getEd(),
getEd().getTitle().equals("B1.java"));
- createComponent(CDICOMPONENT.STEREOSCOPE, "S1", PACKAGE_NAME,
+ createComponent(CDICOMPONENT.STEREOSCOPE, "S1", getPackageName(),
"alternative+beansxml");
bot.editorByTitle("beans.xml").show();
- openOn(PACKAGE_NAME + ".S1", "beans.xml", null);
+ openOn(getPackageName() + ".S1", "beans.xml", null);
assertTrue("ERROR: redirected to " + getEd(),
getEd().getTitle().equals("S1.java"));
@@ -137,8 +119,8 @@
public void testDisposerProducerOpenOn() {
String testedBean = "DisposerProducerBean";
- createComponent(CDICOMPONENT.BEAN, "MyBean", PACKAGE_NAME, null);
- createComponent(CDICOMPONENT.BEAN, testedBean, PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "MyBean", getPackageName(), null);
+ createComponent(CDICOMPONENT.BEAN, testedBean, getPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDIOpenOnTest.class
.getResourceAsStream("/resources/cdi/" + testedBean + ".java.cdi"),
false);
@@ -151,12 +133,12 @@
@Test
public void testObserverOpenOn() {
- createComponent(CDICOMPONENT.QUALIFIER, "Q1", PACKAGE_NAME, null);
- createComponent(CDICOMPONENT.BEAN, "MyBean3", PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.QUALIFIER, "Q1", getPackageName(), null);
+ createComponent(CDICOMPONENT.BEAN, "MyBean3", getPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDIOpenOnTest.class
.getResourceAsStream("/resources/cdi/MyBean3.java.cdi"),
false);
- createComponent(CDICOMPONENT.BEAN, "MyBean4", PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "MyBean4", getPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDIOpenOnTest.class
.getResourceAsStream("/resources/cdi/MyBean4.java.cdi"),
false);
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/CDIQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/CDIQuickFixTest.java 2011-11-13 19:35:17 UTC (rev 36320)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/CDIQuickFixTest.java 2011-11-14 12:39:50 UTC (rev 36321)
@@ -21,9 +21,6 @@
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
import org.jboss.tools.ui.bot.ext.view.ProblemsView;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@@ -34,45 +31,39 @@
* @author Jaroslav Jankovic
*/
-@Require(clearProjects = false, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
+@Require(clearProjects = true, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({ CDIAllBotTests.class })
public class CDIQuickFixTest extends CDIBase {
- private static final String PROJECT_NAME = "CDIProject";
- private static final String PACKAGE_NAME = "cdi";
private static SWTBotTreeItem[] problemsTrees;
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
-
- @BeforeClass
- public static void checkAndCreateProject() {
- if (!projectExists(PROJECT_NAME)) {
- createAndCheckCDIProject(bot, util, projectExplorer,PROJECT_NAME);
- }
+ @Override
+ public String getProjectName() {
+ return "CDIQuickFixTest";
}
- @AfterClass
- public static void clean() {
- removeObjectInProjectExplorer(PACKAGE_NAME, PROJECT_NAME + "/Java Resources/src");
- }
-
/*
* check problems (warnings and errors in Problems View)
*/
- @After
+ @Override
public void waitForJobs() {
checkProjectAllProblems();
util.waitForNonIgnoredJobs();
+ /**
+ * needed for creating non-dependant components
+ */
+ projectExplorer.selectProject(getProjectName());
}
+
-
@Test
public void testSerializableQF() {
String className = "B1";
- createComponent(CDICOMPONENT.BEAN, className, PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, className, getPackageName(), null);
// https://issues.jboss.org/browse/JBIDE-8550
checkSerializableAnnotation(CDICOMPONENT.BEAN, className);
@@ -81,7 +72,7 @@
@Test
public void testMultipleBeansQF() {
String className = "BrokenFarm";
- createComponent(CDICOMPONENT.BEAN, className, PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, className, getPackageName(), null);
// https://issues.jboss.org/browse/JBIDE-7635
checkMultipleBeans(CDICOMPONENT.BEAN, className);
@@ -208,7 +199,7 @@
* method edits default Target form because of "one space inconsistency"
*/
private void prepareCdiComponent(CDICOMPONENT component, String name) {
- createComponent(component, name, PACKAGE_NAME, null);
+ createComponent(component, name, getPackageName(), null);
switch (component) {
case QUALIFIER:
CDIUtil.replaceInEditor(getEd(), bot, "@Target({ TYPE, METHOD, PARAMETER, FIELD })",
@@ -237,11 +228,11 @@
}
private void prepareMultipleBeans(String className) {
- createComponent(CDICOMPONENT.BEAN, "Animal", PACKAGE_NAME, null);
- createComponent(CDICOMPONENT.BEAN, "Dog", PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "Animal", getPackageName(), null);
+ createComponent(CDICOMPONENT.BEAN, "Dog", getPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDIQuickFixTest.class
.getResourceAsStream("/resources/cdi/Dog.java.cdi"), false);
- createComponent(CDICOMPONENT.QUALIFIER, "Q1", PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.QUALIFIER, "Q1", getPackageName(), null);
bot.editorByTitle(className + ".java").show();
setEd(bot.activeEditor().toTextEditor());
CDIUtil.copyResourceToClass(getEd(), CDIQuickFixTest.class
@@ -326,9 +317,9 @@
}
private void prepareComponentsForSpecializeAnnotation(String testBeanName) {
- createComponent(CDICOMPONENT.BEAN, "AnyBean", PACKAGE_NAME, null);
- createComponent(CDICOMPONENT.INTERBINDING, "AnyBinding", PACKAGE_NAME, null);
- createComponent(CDICOMPONENT.BEAN, testBeanName, PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "AnyBean", getPackageName(), null);
+ createComponent(CDICOMPONENT.INTERBINDING, "AnyBinding", getPackageName(), null);
+ createComponent(CDICOMPONENT.BEAN, testBeanName, getPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDIQuickFixTest.class
.getResourceAsStream("/resources/cdi/TestBean.java.cdi"), false);
}
@@ -605,18 +596,18 @@
private void checkNonBindingAnnotationWithAddon(CDICOMPONENT comp, String className,
String replacement) {
if (comp == CDICOMPONENT.INTERBINDING) {
- boolean interceptorCreated = projectExplorer.isFilePresent(PROJECT_NAME,
- "Java Resources", "src", PACKAGE_NAME, className + ".java");
+ boolean interceptorCreated = projectExplorer.isFilePresent(getProjectName(),
+ "Java Resources", "src", getPackageName(), className + ".java");
if (!interceptorCreated) {
- createComponent(CDICOMPONENT.INTERBINDING, className, PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.INTERBINDING, className, getPackageName(), null);
}
}
if (replacement.equals("Annotation")) {
- boolean annotationCreated = projectExplorer.isFilePresent(PROJECT_NAME,
- "Java Resources", "src", PACKAGE_NAME, "AAnnotation.java");
+ boolean annotationCreated = projectExplorer.isFilePresent(getProjectName(),
+ "Java Resources", "src", getPackageName(), "AAnnotation.java");
if (!annotationCreated) {
- createComponent(null, "AAnnotation", PACKAGE_NAME, null);
+ createComponent(null, "AAnnotation", getPackageName(), null);
}
bot.editorByTitle(className + ".java").show();
setEd(bot.activeEditor().toTextEditor());
@@ -684,7 +675,7 @@
problemsContains = "Multiple beans are eligible";
}
problemsTree = ProblemsView.getFilteredWarningsTreeItems(bot, problemsContains, "/"
- + PROJECT_NAME, className, "CDI Problem");
+ + getProjectName(), className, "CDI Problem");
} else {
if (className.equals("InterDecor.java")) {
if (getEd().toTextEditor().getText().contains("produceString")) {
@@ -698,7 +689,7 @@
}
}
problemsTree = ProblemsView.getFilteredErrorsTreeItems(bot, problemsContains, "/"
- + PROJECT_NAME, className, "CDI Problem");
+ + getProjectName(), className, "CDI Problem");
}
return problemsTree;
}
@@ -754,7 +745,7 @@
util.waitForNonIgnoredJobs();
assertFalse(bot.button("Add >").isEnabled());
assertFalse(bot.button("Finish").isEnabled());
- bot.table(0).click(bot.table(0).indexOf("Q1 - " + PACKAGE_NAME), 0);
+ bot.table(0).click(bot.table(0).indexOf("Q1 - " + getPackageName()), 0);
assertTrue(bot.button("Add >").isEnabled());
assertFalse(bot.button("Finish").isEnabled());
bot.clickButton("Add >");
@@ -785,24 +776,24 @@
SWTBotTreeItem[] problemsTree = null;
if (problemType == PROBLEM_TYPE.WARNINGS) {
problemsTree = ProblemsView.getFilteredWarningsTreeItems(bot, null, "/"
- + PROJECT_NAME, null, null);
+ + getProjectName(), null, null);
}else if (problemType == PROBLEM_TYPE.ERRORS) {
problemsTree = ProblemsView.getFilteredErrorsTreeItems(bot, null, "/"
- + PROJECT_NAME, null, null);
+ + getProjectName(), null, null);
}
return problemsTree;
}
private void cleanWarnings(String className) {
problemsTrees = ProblemsView.getFilteredWarningsTreeItems(bot, null, "/"
- + PROJECT_NAME, className + ".java", null);
+ + getProjectName(), className + ".java", null);
assertTrue(problemsTrees.length != 0);
CDIUtil.openQuickFix(problemsTrees[0], bot);
bot.clickButton("Finish");
bot.sleep(Timing.time1S());
bot.activeEditor().save();
problemsTrees = ProblemsView.getFilteredWarningsTreeItems(bot, null, "/"
- + PROJECT_NAME, className, "CDI Problem");
+ + getProjectName(), className, "CDI Problem");
assertTrue(problemsTrees.length == 0);
}
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/seam3/CDISeam3Test.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/seam3/CDISeam3Test.java 2011-11-13 19:35:17 UTC (rev 36320)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/seam3/CDISeam3Test.java 2011-11-14 12:39:50 UTC (rev 36321)
@@ -27,7 +27,6 @@
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
import org.junit.After;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@@ -38,29 +37,35 @@
* @author Jaroslav Jankovic
*/
-@Require(clearProjects = false, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
+@Require(clearProjects = true, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({ CDIAllBotTests.class })
public class CDISeam3Test extends CDIBase {
private static final Logger LOGGER = Logger.getLogger(CDISeam3Test.class.getName());
- private static final String PROJECT_NAME = "CDIProject";
- private static final String PACKAGE_NAME = "cdi";
- private static final String GENERIC_PACKAGE_NAME = "org.cdi.generic";
private final String genericPoint1 = "MyExtendedConfiguration ";
private final String genericPoint2 = "MyConfigurationProducer.getOneConfig()";
private final String genericPoint3 = "MyConfigurationProducer.getSecondConfig()";
- @BeforeClass
- public static void checkAndCreateProject() {
- if (!projectExists(PROJECT_NAME)) {
- createAndCheckCDIProject(bot, util, projectExplorer,PROJECT_NAME);
+ @Override
+ public void checkAndCreateProject() {
+ if (!projectExists(getProjectName())) {
+ createAndCheckCDIProject(bot, util, projectExplorer,getProjectName());
+ addLibrary("seam-solder.jar");
+ checkLibrary("seam-solder.jar");
}
- addLibrary("seam-solder.jar");
- checkLibrary("seam-solder.jar");
}
+ @Override
+ public String getProjectName() {
+ return "CDISeam3Test";
+ }
+
+ private String getGenericPackageName() {
+ return "org.cdi.generic";
+ }
+
@After
public void waitForJobs() {
util.waitForNonIgnoredJobs();
@@ -72,9 +77,9 @@
@Test
public void testResourceOpenOn() {
- createComponent(CDICOMPONENT.BEANSXML, "beans.xml", PROJECT_NAME + "/WebContent/WEB-INF", null);
+ createComponent(CDICOMPONENT.BEANSXML, "beans.xml", getProjectName() + "/WebContent/WEB-INF", null);
- createComponent(CDICOMPONENT.BEAN, "B2", PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "B2", getPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDIQuickFixTest.class
.getResourceAsStream("/resources/cdi/B2.java.cdi"), false);
LOGGER.info("Content of \"B2.java.cdi\" copied to B2");
@@ -83,8 +88,8 @@
assertTrue("ERROR: redirected to " + destinationFile,
destinationFile.equals("beans.xml"));
- moveFileInProjectExplorer("beans.xml", PROJECT_NAME + "/WebContent/WEB-INF",
- PROJECT_NAME + "/WebContent/META-INF");
+ moveFileInProjectExplorer("beans.xml", getProjectName() + "/WebContent/WEB-INF",
+ getProjectName() + "/WebContent/META-INF");
LOGGER.info("bean.xml was moved to META-INF");
setEd(bot.swtBotEditorExtByTitle("B2.java"));
@@ -112,19 +117,20 @@
checkMyGenericBean2();
}
- private static void addLibrary(String libraryName) {
+ private void addLibrary(String libraryName) {
try {
- addLibraryIntoProject(PROJECT_NAME, libraryName);
+ addLibraryIntoProject(getProjectName(), libraryName);
LOGGER.info("Library: \"" + libraryName + "\" copied");
- addLibraryToProjectsClassPath(PROJECT_NAME, libraryName);
- LOGGER.info("Library: \"" + libraryName + "\" on class path of project\"" + PROJECT_NAME + "\"");
+ util.waitForNonIgnoredJobs();
+ addLibraryToProjectsClassPath(getProjectName(), libraryName);
+ LOGGER.info("Library: \"" + libraryName + "\" on class path of project\"" + getProjectName() + "\"");
} catch (IOException exc) {
LOGGER.log(Level.SEVERE, "Error while adding seam solder library into project");
}
}
- private static void checkLibrary(String libraryName) {
- isLibraryInProjectClassPath(PROJECT_NAME, libraryName);
+ private void checkLibrary(String libraryName) {
+ isLibraryInProjectClassPath(getProjectName(), libraryName);
}
/**
@@ -134,38 +140,38 @@
/*
* injectable beans + qualifiers + generic configuration components
*/
- createComponent(CDICOMPONENT.BEAN, "MyBean", GENERIC_PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "MyBean", getGenericPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDISeam3Test.class
.getResourceAsStream("/resources/generic/MyBean.java.cdi"), false);
CDIUtil.replaceInEditor(getEd(), bot, "MyBeanX", "MyBean");
- createComponent(CDICOMPONENT.BEAN, "MyBean2", GENERIC_PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "MyBean2", getGenericPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDISeam3Test.class
.getResourceAsStream("/resources/generic/MyBean.java.cdi"), false);
CDIUtil.replaceInEditor(getEd(), bot, "MyBeanX", "MyBean2");
- createComponent(CDICOMPONENT.BEAN, "MyBean3", GENERIC_PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "MyBean3", getGenericPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDISeam3Test.class
.getResourceAsStream("/resources/generic/MyBean.java.cdi"), false);
CDIUtil.replaceInEditor(getEd(), bot, "MyBeanX", "MyBean3");
- createComponent(CDICOMPONENT.BEAN, "MyConfiguration", GENERIC_PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "MyConfiguration", getGenericPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDISeam3Test.class
.getResourceAsStream("/resources/generic/MyBean.java.cdi"), false);
CDIUtil.replaceInEditor(getEd(), bot, "MyBeanX", "MyConfiguration");
- createComponent(CDICOMPONENT.BEAN, "MyGenericType", GENERIC_PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "MyGenericType", getGenericPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDISeam3Test.class
.getResourceAsStream("/resources/generic/MyGenericType.java.cdi"), false);
- createComponent(CDICOMPONENT.QUALIFIER, "Qualifier1", GENERIC_PACKAGE_NAME, null);
- createComponent(CDICOMPONENT.QUALIFIER, "Qualifier2", GENERIC_PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.QUALIFIER, "Qualifier1", getGenericPackageName(), null);
+ createComponent(CDICOMPONENT.QUALIFIER, "Qualifier2", getGenericPackageName(), null);
- createComponent(CDICOMPONENT.BEAN, "MyExtendedConfiguration", GENERIC_PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "MyExtendedConfiguration", getGenericPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDISeam3Test.class
.getResourceAsStream("/resources/generic/MyExtendConfig.java.cdi"), false);
- createComponent(CDICOMPONENT.BEAN, "MyConfigurationProducer", GENERIC_PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "MyConfigurationProducer", getGenericPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDISeam3Test.class
.getResourceAsStream("/resources/generic/MyConfigProd.java.cdi"), false);
@@ -174,15 +180,15 @@
* generic configurations
*/
- createComponent(CDICOMPONENT.BEAN, "MyBeanInjections", GENERIC_PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "MyBeanInjections", getGenericPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDISeam3Test.class
.getResourceAsStream("/resources/generic/MyBeanInjections.java.cdi"), false);
- createComponent(CDICOMPONENT.BEAN, "MyGenericBean", GENERIC_PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "MyGenericBean", getGenericPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDISeam3Test.class
.getResourceAsStream("/resources/generic/MyGenericBean.java.cdi"), false);
- createComponent(CDICOMPONENT.BEAN, "MyGenericBean2", GENERIC_PACKAGE_NAME, null);
+ createComponent(CDICOMPONENT.BEAN, "MyGenericBean2", getGenericPackageName(), null);
CDIUtil.copyResourceToClass(getEd(), CDISeam3Test.class
.getResourceAsStream("/resources/generic/MyGenericBean2.java.cdi"), false);
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/CDIBase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/CDIBase.java 2011-11-13 19:35:17 UTC (rev 36320)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/CDIBase.java 2011-11-14 12:39:50 UTC (rev 36321)
@@ -2,7 +2,7 @@
* Copyright (c) 2010 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,
+ * Eclipse public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
@@ -38,8 +38,33 @@
import org.jboss.tools.ui.bot.ext.helper.TreeHelper;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ui.bot.ext.view.ProjectExplorer;
+import org.junit.After;
+import org.junit.Before;
public class CDIBase extends SWTTestExt {
+
+ private String projectName = "CDIProject";
+ private String packageName = "cdi";
+
+ @Before
+ public void checkAndCreateProject() {
+ if (!projectExists(getProjectName())) {
+ createAndCheckCDIProject(bot, util, projectExplorer, getProjectName());
+ }
+ }
+
+ @After
+ public void waitForJobs() {
+ util.waitForNonIgnoredJobs();
+ }
+
+ public String getProjectName() {
+ return projectName;
+ }
+
+ public String getPackageName() {
+ return packageName;
+ }
public enum CDICOMPONENT {
STEREOSCOPE, QUALIFIER, SCOPE, BEAN, INTERBINDING, DECORATOR, INTERCEPTOR, ANNLITERAL, BEANSXML
@@ -132,7 +157,7 @@
}
- public static void createAndCheckCDIProject(SWTBotExt bot, SWTUtilExt util,
+ public void createAndCheckCDIProject(SWTBotExt bot, SWTUtilExt util,
ProjectExplorer projectExplorer, String projectName) {
createCDIProject(util, projectName);
projectExplorer.selectProject(projectName);
@@ -142,21 +167,29 @@
addCDISupport(tree, item, bot, util);
}
- public static void createCDIProject(SWTUtilExt util, String projectName) {
+ public void createCDIProject(SWTUtilExt util, String projectName) {
new NewFileWizardAction().run()
.selectTemplate("Web", "Dynamic Web Project").next();
new DynamicWebProjectWizard().setProjectName(projectName).finish();
util.waitForNonIgnoredJobs();
}
- public static void createCDIProjectWithCDIPreset(SWTUtilExt util, String projectName) {
+ public void createCDIProjectWithCDIPreset(SWTUtilExt util, String projectName) {
new NewFileWizardAction().run()
.selectTemplate("Web", "Dynamic Web Project").next();
new DynamicWebProjectWizard().setProjectName(projectName).setCDIPreset().finish();
util.waitForNonIgnoredJobs();
}
+
+ public void createCDIProjectWithCDIFacets(SWTUtilExt util, String projectName) {
+ new NewFileWizardAction().run()
+ .selectTemplate("Web", "Dynamic Web Project").next();
+ new DynamicWebProjectWizard().setProjectName(projectName).setCDIFacet().finish();
+ bot.sleep(Timing.time5S());
+ util.waitForNonIgnoredJobs();
+ }
- public static void addCDISupport(final SWTBotTree tree, SWTBotTreeItem item,
+ public void addCDISupport(final SWTBotTree tree, SWTBotTreeItem item,
SWTBotExt bot, SWTUtilExt util) {
CDIUtil.nodeContextMenu(tree, item, "Configure",
"Add CDI (Context and Dependency Injection) support...")
@@ -194,7 +227,7 @@
setEd(bot.activeEditor().toTextEditor());
}
- public static void addLibraryToProjectsClassPath(String projectName, String libraryName) {
+ public void addLibraryToProjectsClassPath(String projectName, String libraryName) {
SWTBotTree tree = projectExplorer.bot().tree();
ContextMenuHelper.prepareTreeItemForContextMenu(tree);
@@ -220,7 +253,7 @@
* copy library located in PROJECT_NAME/resources/libraries into project
* libraryName must include extension: seam-solder.jar
*/
- public static void addLibraryIntoProject(String projectName, String libraryName) throws IOException {
+ public void addLibraryIntoProject(String projectName, String libraryName) throws IOException {
File in = null;
FileChannel inChannel = null;
FileChannel outChannel = null;
@@ -244,7 +277,7 @@
* check if library with name libraryName is set on classpath of project with name
* projectName
*/
- public static void isLibraryInProjectClassPath(String projectName, String libraryName) {
+ public void isLibraryInProjectClassPath(String projectName, String libraryName) {
SWTBotTree tree = projectExplorer.bot().tree();
ContextMenuHelper.prepareTreeItemForContextMenu(tree);
@@ -288,7 +321,7 @@
bot.button("OK").click();
}
- public static void removeObjectInProjectExplorer(String object, String sourceFolder) {
+ public void removeObjectInProjectExplorer(String object, String sourceFolder) {
SWTBotTree tree = projectExplorer.bot().tree();
SWTBotTreeItem item = projectExplorer.selectTreeItem(object, sourceFolder.split("/"));
@@ -301,7 +334,7 @@
bot.sleep(Timing.time2S());
}
- public static boolean projectExists(String projectName) {
+ public boolean projectExists(String projectName) {
SWTBotTree tree = projectExplorer.bot().tree();
boolean projectExists = false;
try {
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/CDIUtil.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/CDIUtil.java 2011-11-13 19:35:17 UTC (rev 36320)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/actions/CDIUtil.java 2011-11-14 12:39:50 UTC (rev 36321)
@@ -10,9 +10,15 @@
******************************************************************************/
package org.jboss.tools.cdi.bot.test.uiutils.actions;
+import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.SWTBot;
@@ -22,6 +28,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.cdi.bot.test.editor.CDIBeansEditorTest;
import org.jboss.tools.cdi.bot.test.uiutils.wizards.CDIWizard;
import org.jboss.tools.cdi.bot.test.uiutils.wizards.CDIWizardType;
import org.jboss.tools.ui.bot.ext.SWTBotExt;
@@ -33,6 +40,12 @@
public class CDIUtil {
+ private CDIUtil() {
+ // this class servers only for static related methods
+ // it should not be instantiated
+ throw new AssertionError();
+ }
+
public static void openQuickFix(SWTBotTreeItem item, SWTBotExt bot) {
nodeContextMenu(bot.tree(), item, "Quick Fix").click();
}
@@ -56,6 +69,31 @@
classEdit.close();
}
}
+
+ public static void copyResource(String src, String target) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProjects()[0];
+ IFile f = project.getFile(target);
+ if (f.exists()) {
+ try {
+ f.delete(true, new NullProgressMonitor());
+ } catch (CoreException ce) {
+ }
+ }
+ InputStream is = null;
+ try {
+ is = CDIBeansEditorTest.class.getResourceAsStream(src);
+ f.create(is, true, new NullProgressMonitor());
+ } catch (CoreException ce) {
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException ioe) {
+ //ignore
+ }
+ }
+ }
+ }
public static void replaceInEditor(SWTBotEclipseEditor ed, SWTBotExt bot,
String target, String replacement) {
@@ -187,6 +225,7 @@
}
}
w = w.setPublic(isPublic).setFinal(isFinal).setAbstract(isAbstract).setAlternative(alternative);
+ //w = w.setPublic(isPublic).setFinal(isFinal).setAbstract(isAbstract);
if (interfaces != null && !"".equals(interfaces.trim())) {
w.addInterface(interfaces);
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/Wizard.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/Wizard.java 2011-11-13 19:35:17 UTC (rev 36320)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/Wizard.java 2011-11-14 12:39:50 UTC (rev 36321)
@@ -11,10 +11,12 @@
package org.jboss.tools.cdi.bot.test.uiutils.wizards;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.Timing;
public class Wizard extends SWTBotShell {
@@ -66,6 +68,27 @@
return this;
}
+ public Wizard setCDIFacet() {
+ clickButton("Modify...");
+ SWTBot bot = bot().shell("Project Facets").bot();
+ setCDIFacet(bot);
+ bot().sleep(Timing.time1S());
+ return this;
+ }
+
+ private void setCDIFacet(SWTBot bot) {
+ SWTBotTree tree= bot.tree();
+ for (SWTBotTreeItem ti: tree.getAllItems()) {
+ if (ti.cell(0).contains("CDI (Contexts and Dependency Injection)")) {
+ ti.check();
+ break;
+ }
+ }
+ bot.sleep(Timing.time1S());
+ bot.button("OK").click();
+ }
+
+
protected void clickButton(String text) {
bot().button(text).click();
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIATWizardTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIATWizardTest.java 2011-11-13 19:35:17 UTC (rev 36320)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIATWizardTest.java 2011-11-14 12:39:50 UTC (rev 36321)
@@ -22,11 +22,10 @@
import org.jboss.tools.cdi.bot.test.uiutils.wizards.CDIWizard;
import org.jboss.tools.cdi.bot.test.uiutils.wizards.CDIWizardType;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.jboss.tools.ui.bot.ext.Timing;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
-import org.junit.After;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@@ -35,30 +34,29 @@
* @author Lukas Jungmann
* @author jjankovi
*/
-@Require(clearProjects = false, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
+@Require(clearProjects = true, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({ CDIAllBotTests.class, CDISmokeBotTests.class })
public class CDIATWizardTest extends CDIBase {
- private static final String PROJECT_NAME = "CDIProject";
- private static final String PACKAGE_NAME = "cdi";
private static final Logger L = Logger.getLogger(CDIATWizardTest.class.getName());
- @After
+ public String getProjectName() {
+ return "CDIWizardTest";
+ }
+
+ @Override
public void waitForJobs() {
util.waitForNonIgnoredJobs();
+ /**
+ * needed for creating non-dependant components
+ */
+ projectExplorer.selectProject(getProjectName());
}
-
- @BeforeClass
- public static void checkAndCreateProject() {
- if (!projectExists(PROJECT_NAME)) {
- createAndCheckCDIProject(bot, util, projectExplorer,PROJECT_NAME);
- }
- }
@Test
public void testQualifier() {
- CDIUtil.qualifier(PACKAGE_NAME, "Q1", false, false).finish();
+ CDIUtil.qualifier(getPackageName(), "Q1", false, false).finish();
util.waitForNonIgnoredJobs();
SWTBotEditor ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("Q1.java").equals(ed.getTitle()));
@@ -70,7 +68,7 @@
assertFalse(code.contains("@Inherited"));
assertFalse(code.startsWith("/**"));
- CDIUtil.qualifier(PACKAGE_NAME, "Q2", true, true).finish();
+ CDIUtil.qualifier(getPackageName(), "Q2", true, true).finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("Q2.java").equals(ed.getTitle()));
@@ -85,7 +83,7 @@
@Test
public void testScope() {
- CDIUtil.scope(PACKAGE_NAME, "Scope1", true, false, true, false).finish();
+ CDIUtil.scope(getPackageName(), "Scope1", true, false, true, false).finish();
util.waitForNonIgnoredJobs();
SWTBotEditor ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("Scope1.java").equals(ed.getTitle()));
@@ -99,7 +97,7 @@
assertTrue(code.contains("@Inherited"));
assertFalse(code.startsWith("/**"));
- CDIUtil.scope(PACKAGE_NAME, "Scope2", false, true, true, true).finish();
+ CDIUtil.scope(getPackageName(), "Scope2", false, true, true, true).finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("Scope2.java").equals(ed.getTitle()));
@@ -112,7 +110,7 @@
assertFalse(code.contains("@Inherited"));
assertTrue(code.startsWith("/**"));
- CDIUtil.scope(PACKAGE_NAME, "Scope3", false, true, false, false).finish();
+ CDIUtil.scope(getPackageName(), "Scope3", false, true, false, false).finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("Scope3.java").equals(ed.getTitle()));
@@ -128,7 +126,7 @@
@Test
public void testIBinding() {
- CDIWizard w = CDIUtil.binding(PACKAGE_NAME, "B1", null, true, false);
+ CDIWizard w = CDIUtil.binding(getPackageName(), "B1", null, true, false);
assertEquals(2, w.getTargets().size());
w.finish();
util.waitForNonIgnoredJobs();
@@ -142,7 +140,7 @@
assertTrue(code.contains("@Inherited"));
assertFalse(code.startsWith("/**"));
- CDIUtil.binding(PACKAGE_NAME, "B2", "TYPE", false, true).finish();
+ CDIUtil.binding(getPackageName(), "B2", "TYPE", false, true).finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("B2.java").equals(ed.getTitle()));
@@ -154,7 +152,7 @@
assertFalse(code.contains("@Inherited"));
assertTrue(code.startsWith("/**"));
- CDIUtil.binding(PACKAGE_NAME, "B3", "TYPE", false, true).finish();
+ CDIUtil.binding(getPackageName(), "B3", "TYPE", false, true).finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
assertTrue(("B3.java").equals(ed.getTitle()));
@@ -166,8 +164,8 @@
assertFalse(code.contains("@Inherited"));
assertTrue(code.startsWith("/**"));
- w = CDIUtil.binding(PACKAGE_NAME, "B4", "TYPE", true, false);
- w.addIBinding(PACKAGE_NAME + ".B2");
+ w = CDIUtil.binding(getPackageName(), "B4", "TYPE", true, false);
+ w.addIBinding(getPackageName() + ".B2");
w.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
@@ -184,7 +182,7 @@
@Test
public void testStereotype() {
- CDIWizard w = CDIUtil.stereotype(PACKAGE_NAME, "S1", null, null, false, false, false, false,
+ CDIWizard w = CDIUtil.stereotype(getPackageName(), "S1", null, null, false, false, false, false,
false);
assertEquals(9, w.getScopes().size());
assertEquals(5, w.getTargets().size());
@@ -202,7 +200,7 @@
assertFalse(code.contains("@Inherited"));
assertFalse(code.startsWith("/**"));
- CDIUtil.stereotype(PACKAGE_NAME, "S2", "@Scope3", "FIELD", true, true, true, false, true)
+ CDIUtil.stereotype(getPackageName(), "S2", "@Scope3", "FIELD", true, true, true, false, true)
.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
@@ -218,9 +216,9 @@
assertTrue(code.contains("@Target({ FIELD })"));
assertTrue(code.startsWith("/**"));
- w = CDIUtil.stereotype(PACKAGE_NAME, "S3", null, null, false, false, true, false, false);
- w.addIBinding(PACKAGE_NAME + ".B1");
- w.addStereotype(PACKAGE_NAME + ".S1");
+ w = CDIUtil.stereotype(getPackageName(), "S3", null, null, false, false, true, false, false);
+ w.addIBinding(getPackageName() + ".B1");
+ w.addStereotype(getPackageName() + ".S1");
w.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
@@ -241,7 +239,8 @@
@Test
public void testDecorator() {
- CDIWizard w = CDIUtil.decorator(PACKAGE_NAME, "", "java.lang.Comparable", null, true, true, false, false);
+ bot.sleep(Timing.time1S());
+ CDIWizard w = CDIUtil.decorator(getPackageName(), "", "java.lang.Comparable", null, true, true, false, false);
w.finish();
util.waitForNonIgnoredJobs();
SWTBotEditor ed = new SWTWorkbenchBot().editorByTitle("ComparableDecorator.java");
@@ -257,7 +256,7 @@
assertFalse(code.contains("final"));
assertFalse(code.startsWith("/**"));
- w = CDIUtil.decorator(PACKAGE_NAME, "", "java.util.Map", "field", false, false, true, true);
+ w = CDIUtil.decorator(getPackageName(), "", "java.util.Map", "field", false, false, true, true);
w.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().editorByTitle("MapDecorator.java");
@@ -276,7 +275,7 @@
@Test
public void testInterceptor() {
- CDIWizard w = CDIUtil.interceptor(PACKAGE_NAME, "I1", "B2", null, null, false);
+ CDIWizard w = CDIUtil.interceptor(getPackageName(), "I1", "B2", null, null, false);
w.finish();
util.waitForNonIgnoredJobs();
SWTBotEditor ed = new SWTWorkbenchBot().editorByTitle("I1.java");
@@ -290,7 +289,7 @@
assertFalse(code.contains("final"));
assertFalse(code.startsWith("/**"));
- w = CDIUtil.interceptor(PACKAGE_NAME, "I2", "B4", "java.util.Date", "sample", true);
+ w = CDIUtil.interceptor(getPackageName(), "I2", "B4", "java.util.Date", "sample", true);
w.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().editorByTitle("I2.java");
@@ -309,9 +308,9 @@
@Test
public void testBeansXml() {
CDIWizard w = new NewCDIFileWizard(CDIWizardType.BEANS_XML).run();
- w.setSourceFolder(PROJECT_NAME + "/WebContent/WEB-INF");
+ w.setSourceFolder(getProjectName() + "/WebContent/WEB-INF");
assertFalse(w.canFinish());
- w.setSourceFolder(PROJECT_NAME + "/src/" + PACKAGE_NAME.replaceAll(".", "/"));
+ w.setSourceFolder(getProjectName() + "/src/" + getPackageName().replaceAll(".", "/"));
assertTrue(w.canFinish());
w.cancel();
w = new NewCDIFileWizard(CDIWizardType.BEANS_XML).run();
@@ -321,7 +320,7 @@
@Test
public void testBean() {
- CDIWizard w = CDIUtil.bean(PACKAGE_NAME, "Bean1", true, true, false, false, false, false, null, null, null, null);
+ CDIWizard w = CDIUtil.bean(getPackageName(), "Bean1", true, true, false, false, false, false, null, null, null, null);
w.finish();
util.waitForNonIgnoredJobs();
SWTBotEditor ed = new SWTWorkbenchBot().activeEditor();
@@ -334,7 +333,7 @@
assertFalse(code.contains("final"));
assertFalse(code.startsWith("/**"));
- w = CDIUtil.bean(PACKAGE_NAME, "Bean2", false, false, true, true, false, false, "", null, "@Dependent", null);
+ w = CDIUtil.bean(getPackageName(), "Bean2", false, false, true, true, false, false, "", null, "@Dependent", null);
w.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
@@ -348,7 +347,7 @@
assertTrue(code.contains("final class Bean2 {"));
assertTrue(code.startsWith("/**"));
- w = CDIUtil.bean(PACKAGE_NAME, "Bean3", true, false, false, true, false, false, "TestedBean", null, "@Scope2", "Q1");
+ w = CDIUtil.bean(getPackageName(), "Bean3", true, false, false, true, false, false, "TestedBean", null, "@Scope2", "Q1");
w.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
@@ -366,7 +365,7 @@
@Test
public void testAnnLiteral() {
- CDIWizard w = CDIUtil.annLiteral(PACKAGE_NAME, "AnnL1", true, false, true, false, PACKAGE_NAME + ".Q1");
+ CDIWizard w = CDIUtil.annLiteral(getPackageName(), "AnnL1", true, false, true, false, getPackageName() + ".Q1");
w.finish();
util.waitForNonIgnoredJobs();
SWTBotEditor ed = new SWTWorkbenchBot().activeEditor();
@@ -379,7 +378,7 @@
assertFalse(code.contains("abstract"));
assertFalse(code.startsWith("/**"));
- w = CDIUtil.annLiteral(PACKAGE_NAME, "AnnL2", false, true, false, true, "Q2");
+ w = CDIUtil.annLiteral(getPackageName(), "AnnL2", false, true, false, true, "Q2");
w.finish();
util.waitForNonIgnoredJobs();
ed = new SWTWorkbenchBot().activeEditor();
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIConfigurationPresetTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIConfigurationPresetTest.java 2011-11-13 19:35:17 UTC (rev 36320)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIConfigurationPresetTest.java 2011-11-14 12:39:50 UTC (rev 36321)
@@ -23,7 +23,6 @@
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
-import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@@ -40,18 +39,23 @@
public class CDIConfigurationPresetTest extends CDIBase {
private static final Logger LOGGER = Logger.getLogger(CDIConfigurationPresetTest.class.getName());
- private static final String PROJECT_NAME = "CDIPresetProject";
-
- @After
- public void waitForJobs() {
- jbt.deleteProject(PROJECT_NAME);
+
+ @Override
+ public void checkAndCreateProject() {
+ if (!projectExists(getProjectName())) {
+ createCDIProjectWithCDIPreset(util, getProjectName());
+ }
}
+ @Override
+ public String getProjectName() {
+ return "CDIPresetProject";
+ }
+
@Test
public void testCDIPreset() {
- createCDIProjectWithCDIPreset(util, PROJECT_NAME);
LOGGER.info("Dynamic Web Project with CDI Configuration Preset created");
- assertTrue(checkCDISupport(PROJECT_NAME));
+ assertTrue(checkCDISupport(getProjectName()));
}
private boolean checkCDISupport(String projectName) {
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIFacetTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIFacetTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIFacetTest.java 2011-11-14 12:39:50 UTC (rev 36321)
@@ -0,0 +1,53 @@
+package org.jboss.tools.cdi.bot.test.wizard;
+
+import java.util.logging.Logger;
+
+import org.jboss.tools.cdi.bot.test.CDIAllBotTests;
+import org.jboss.tools.cdi.bot.test.CDISmokeBotTests;
+import org.jboss.tools.cdi.bot.test.uiutils.actions.CDIBase;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+* Test checks if beans.xml is created when selectin CDI Facet
+*
+* @author Jaroslav Jankovic
+*/
+
+@Require(clearProjects = true, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
+(a)RunWith(RequirementAwareSuite.class)
+@SuiteClasses({ CDIAllBotTests.class , CDISmokeBotTests.class })
+public class CDIFacetTest extends CDIBase {
+
+ private static final Logger LOGGER = Logger.getLogger(CDIFacetTest.class.getName());
+
+
+ @Override
+ public void checkAndCreateProject() {
+ if (!projectExists(getProjectName())) {
+ createCDIProjectWithCDIFacets(util, getProjectName());
+ }
+ }
+
+ @Override
+ public String getProjectName() {
+ return "CDIFacetsProject";
+ }
+
+ @Test
+ public void testCDIFacet() {
+ LOGGER.info("Dynamic Web Project with CDI Facet created");
+ assertTrue("Error: beans.xml should be created when selecting CDI Facet",
+ projectExplorer.isFilePresent(getProjectName(), getBeansXmlLocation().split("/")));
+ }
+
+ private String getBeansXmlLocation() {
+ return "WebContent/WEB-INF/beans.xml";
+ }
+
+}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIPerspectiveTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIPerspectiveTest.java 2011-11-13 19:35:17 UTC (rev 36320)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/CDIPerspectiveTest.java 2011-11-14 12:39:50 UTC (rev 36321)
@@ -26,7 +26,6 @@
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
import org.jboss.tools.ui.bot.ext.types.PerspectiveType;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@@ -37,28 +36,31 @@
* @author Jaroslav Jankovic
*/
-@Require(clearProjects = false, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
+@Require(clearProjects = true, perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({ CDIAllBotTests.class, CDISmokeBotTests.class })
public class CDIPerspectiveTest extends CDIBase {
private static final Logger LOGGER = Logger.getLogger(CDIPerspectiveTest.class.getName());
- private static final String PROJECT_NAME = "CDIProject";
private enum CDIARTIFACTS {
BEAN, QUALIFIER, STEREOTYPE, SCOPE, INTERBINDING, INTERCEPTOR, DECORATOR, ANNOTLITERAL, BEANSXML
}
-
- @BeforeClass
- public static void checkAndCreateProject() {
- if (!projectExists(PROJECT_NAME)) {
- createAndCheckCDIProject(bot, util, projectExplorer, PROJECT_NAME);
+ @Override
+ public void checkAndCreateProject() {
+ if (!projectExists(getProjectName())) {
+ createAndCheckCDIProject(bot, util, projectExplorer, getProjectName());
+ eclipse.openPerspective(PerspectiveType.CDI);
+ LOGGER.info("CDI perspective selected");
+ bot.sleep(Timing.time2S());
}
- eclipse.openPerspective(PerspectiveType.CDI);
- LOGGER.info("CDI perspective selected");
- bot.sleep(Timing.time2S());
}
+ @Override
+ public String getProjectName() {
+ return "CDIPerspectiveTest";
+ }
+
@Test
public void testCDIArtifactBeanWizard() {
@@ -104,7 +106,7 @@
private boolean openCDIArtifactsWizard(CDIARTIFACTS artifact) {
SWTBotTree tree = packageExplorer.bot().tree();
- SWTBotTreeItem item = tree.getTreeItem(PROJECT_NAME);
+ SWTBotTreeItem item = tree.getTreeItem(getProjectName());
item.expand();
boolean artifactWizardExists = true;
try {
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/todo.txt
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/todo.txt 2011-11-13 19:35:17 UTC (rev 36320)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/todo.txt 2011-11-14 12:39:50 UTC (rev 36321)
@@ -1,3 +1,32 @@
+/**
+ * what tests have to be done(JBDS50_0010):
+ * 1. Classes indication for Open Injected Class works
+ * 2. CDI Facets can create beans.xml file when selected
+ * 3. Code completion works in beans.xml
+ * 4. Classes in beans.xml are validated
+ * 5. Complex test from Weld is working in JBDS and CDI functionality works without errors
+ * 6. CDI @Named beans are renamed via refactoring and shows up correctly
+ * when using Find References for EL Expressions
+ * 8. Create new decorator from existing Web Bean
+ * 9. EL refactoring for @Named beans works
+ *
+ *
+ * what tests have to be done(JBDS50_0015):
+ * 1. OpenOn works for injected classes
+ * 2. OpenOn works in Seam Config for given beans
+ * 3. OpenOn works for Bean injected into java source files declard in seam-config.xml can be navigated
+ * 4. Seam-beans.xml validation works
+ * 5. Seam3 not-trivial example works with JBDS without errors and as expected
+ * 6. Wel extension(beans_1_1.xsd) is now supported by beans.xml editor
+ * 7. Non-serializable passivating-scoped beans are now validated correctly
+ * 8. Code completion and validation works in seam config for annotated CDI beans
+ * 9. Seam3 features is enabled automatically for CDI support enabled project containing corresponding Seam module
+ * 10.CDI supports Seam3 annotations (@Veto,@Requires,@Exact,@MessageLogger,@MessageBundle
+ * @DefaultBean,@Unwraps,@ServiceHandlerType,@FullyQualified,@Resource)
+ * 11.CDI tools can work with generic beans and validation, code completion, hyperlinks,
+ * refactoring is working as expected
+ */
+
UI tests to implement for CDI (based on F2F meeting)
hyperlinks (...open ons etc)
13 years, 1 month
JBoss Tools SVN: r36320 - in trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central: actions and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-11-13 14:35:17 -0500 (Sun, 13 Nov 2011)
New Revision: 36320
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossToolsTwitterHandler.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenWithBrowserHandler.java
Log:
JBIDE-10072 Twitter in JBoss Central is non-functional
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java 2011-11-13 19:31:21 UTC (rev 36319)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java 2011-11-13 19:35:17 UTC (rev 36320)
@@ -214,15 +214,18 @@
return prefs.getBoolean(SHOW_JBOSS_CENTRAL_ON_STARTUP, SHOW_JBOSS_CENTRAL_ON_STARTUP_DEFAULT_VALUE);
}
+ public static void openUrl(String location, Shell shell) {
+ openUrl(location, shell);
+ }
- public static void openUrl(String location, Shell shell) {
+ public static void openUrl(String location, Shell shell, boolean asExternal) {
URL url = null;
try {
if (location != null) {
url = new URL(location);
}
- if (WebBrowserPreference.getBrowserChoice() == WebBrowserPreference.EXTERNAL) {
+ if (WebBrowserPreference.getBrowserChoice() == WebBrowserPreference.EXTERNAL || asExternal) {
IWorkbenchBrowserSupport support = PlatformUI.getWorkbench()
.getBrowserSupport();
support.getExternalBrowser().openURL(url);
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossToolsTwitterHandler.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossToolsTwitterHandler.java 2011-11-13 19:31:21 UTC (rev 36319)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenJBossToolsTwitterHandler.java 2011-11-13 19:35:17 UTC (rev 36320)
@@ -23,4 +23,9 @@
return "http://twitter.com/#!/jbosstools";
}
+ @Override
+ public boolean asExternal() {
+ return true;
+ }
+
}
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenWithBrowserHandler.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenWithBrowserHandler.java 2011-11-13 19:31:21 UTC (rev 36319)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/OpenWithBrowserHandler.java 2011-11-13 19:35:17 UTC (rev 36320)
@@ -25,11 +25,15 @@
public abstract class OpenWithBrowserHandler extends AbstractHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
- JBossCentralActivator.openUrl(getLocation(), getShell());
+ JBossCentralActivator.openUrl(getLocation(), getShell(), asExternal());
return null;
}
public abstract String getLocation();
+
+ public boolean asExternal() {
+ return false;
+ }
private static Shell getShell() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
13 years, 1 month
JBoss Tools SVN: r36319 - trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-11-13 14:31:21 -0500 (Sun, 13 Nov 2011)
New Revision: 36319
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java
Log:
JBIDE-10130 rearrange the quick access icons
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2011-11-12 16:43:07 UTC (rev 36318)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2011-11-13 19:31:21 UTC (rev 36319)
@@ -371,6 +371,9 @@
CommandContributionItem item = JBossCentralActivator.createContributionItem(getSite(), "org.jboss.tools.central.openJBossNews");
toolBarManager.add(item);
+ item = JBossCentralActivator.createContributionItem(getSite(), "org.jboss.tools.central.openJBossToolsTwitter");
+ toolBarManager.add(item);
+
item = JBossCentralActivator.createContributionItem(getSite(), "org.jboss.tools.central.refreshJBossNews");
toolBarManager.add(item);
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java 2011-11-12 16:43:07 UTC (rev 36318)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/JBossCentralEditor.java 2011-11-13 19:31:21 UTC (rev 36319)
@@ -291,8 +291,8 @@
item = JBossCentralActivator.createContributionItem(getSite(), "org.jboss.tools.central.preferences");
toolbar.add(item);
- item = JBossCentralActivator.createContributionItem(getSite(), "org.jboss.tools.central.openJBossToolsTwitter");
- toolbar.add(item);
+ //item = JBossCentralActivator.createContributionItem(getSite(), "org.jboss.tools.central.openJBossToolsTwitter");
+ //toolbar.add(item);
toolbar.update(true);
}
13 years, 1 month
JBoss Tools SVN: r36318 - in trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui: dialogs and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-11-12 11:43:07 -0500 (Sat, 12 Nov 2011)
New Revision: 36318
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeScanner.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java
Log:
JBIDE-9712 Runtime Detection Dialog during first start gets over modal dialog with request to let usage reporting.
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeScanner.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeScanner.java 2011-11-12 16:43:01 UTC (rev 36317)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeScanner.java 2011-11-12 16:43:07 UTC (rev 36318)
@@ -51,7 +51,7 @@
if (exists) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ Shell shell = Display.getCurrent().getActiveShell();
RuntimeUIActivator.refreshRuntimes(shell, RuntimeUIActivator.getDefault().getRuntimePaths(), null, false, 7);
}
});
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java 2011-11-12 16:43:01 UTC (rev 36317)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java 2011-11-12 16:43:07 UTC (rev 36318)
@@ -66,7 +66,7 @@
public SearchRuntimePathDialog(Shell parent, Set<RuntimePath> runtimePaths, boolean needRefresh, int heightHint) {
super(parent);
setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
- | SWT.RESIZE | getDefaultOrientation());
+ | SWT.APPLICATION_MODAL | SWT.RESIZE | getDefaultOrientation());
this.runtimePaths = runtimePaths;
this.needRefresh = needRefresh;
this.heightHint = heightHint;
13 years, 1 month
JBoss Tools SVN: r36317 - trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-11-12 11:43:01 -0500 (Sat, 12 Nov 2011)
New Revision: 36317
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReportEnablementDialog.java
Log:
JBIDE-9712 Runtime Detection Dialog during first start gets over modal dialog with request to let usage reporting.
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java 2011-11-12 04:21:06 UTC (rev 36316)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java 2011-11-12 16:43:01 UTC (rev 36317)
@@ -133,7 +133,7 @@
public void run() {
UsageReportEnablementDialog dialog =
new UsageReportEnablementDialog(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+ Display.getCurrent().getActiveShell(),
JBossToolsUsageActivator.getDefault().getUsageBranding());
if (dialog.open() == Window.OK) {
userResponse[0] = dialog.isReportEnabled();
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReportEnablementDialog.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReportEnablementDialog.java 2011-11-12 04:21:06 UTC (rev 36316)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReportEnablementDialog.java 2011-11-12 16:43:01 UTC (rev 36317)
@@ -34,12 +34,17 @@
private boolean reportEnabled;
private IUsageBranding branding;
- private ForceActiveShellAdapter forceActiveShellAdapter = new ForceActiveShellAdapter();
+ //private ForceActiveShellAdapter forceActiveShellAdapter = new ForceActiveShellAdapter();
public UsageReportEnablementDialog(IShellProvider parentShell, IUsageBranding branding) {
super(parentShell);
this.branding = branding;
}
+
+ public UsageReportEnablementDialog(Shell parentShell, IUsageBranding branding) {
+ super(parentShell);
+ this.branding = branding;
+ }
protected void buttonPressed(int buttonId) {
this.reportEnabled = (buttonId == IDialogConstants.OK_ID);
@@ -64,12 +69,12 @@
protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setText(branding.getStartupAllowReportingTitle());
- forceActiveShellAdapter.attachTo(shell);
+ //forceActiveShellAdapter.attachTo(shell);
}
@Override
public boolean close() {
- forceActiveShellAdapter.removeFrom(getShell());
+ //forceActiveShellAdapter.removeFrom(getShell());
return super.close();
}
@@ -113,27 +118,27 @@
return reportEnabled;
}
- private class ForceActiveShellAdapter extends ShellAdapter {
-
- public void shellDeactivated(ShellEvent e) {
- Shell shell = getShell();
- if (shell != null
- && !shell.isDisposed())
- shell.forceActive();
- }
-
- private void attachTo(Shell shell) {
- if (shell != null
- && !shell.isDisposed()) {
- shell.addShellListener(this);
- }
- }
-
- private void removeFrom(Shell shell) {
- if (shell != null
- && !shell.isDisposed()) {
- shell.removeShellListener(this);
- }
- }
- }
+// private class ForceActiveShellAdapter extends ShellAdapter {
+//
+// public void shellDeactivated(ShellEvent e) {
+// Shell shell = getShell();
+// if (shell != null
+// && !shell.isDisposed())
+// shell.forceActive();
+// }
+//
+// private void attachTo(Shell shell) {
+// if (shell != null
+// && !shell.isDisposed()) {
+// shell.addShellListener(this);
+// }
+// }
+//
+// private void removeFrom(Shell shell) {
+// if (shell != null
+// && !shell.isDisposed()) {
+// shell.removeShellListener(this);
+// }
+// }
+// }
}
13 years, 1 month
JBoss Tools SVN: r36316 - trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests.
by jbosstools-commits@lists.jboss.org
Author: ldimaggio
Date: 2011-11-11 23:21:06 -0500 (Fri, 11 Nov 2011)
New Revision: 36316
Modified:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingBundledInSOA.java
Log:
Finished test for JBDS-1927
Modified: trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingBundledInSOA.java
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingBundledInSOA.java 2011-11-12 01:06:27 UTC (rev 36315)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingBundledInSOA.java 2011-11-12 04:21:06 UTC (rev 36316)
@@ -5,6 +5,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.config.TestConfigurator;
import org.jboss.tools.ui.bot.ext.config.Annotations.*;
import org.jboss.tools.ui.bot.ext.gen.ActionItem;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.ESBESBProject;
@@ -21,36 +22,52 @@
testNewProject("ESBstandalone");
}
public void testNewProject(String projectName) {
- SWTBot wiz = open.newObject(ActionItem.NewObject.ESBESBProject.LABEL);
+
+ /* This test updated for JBDS-1927 - ldimaggi - Nov 11 2011 */
+
+ SWTBot wiz = open.newObject(ActionItem.NewObject.ESBESBProject.LABEL);
wiz.textWithLabel(ESBESBProject.TEXT_PROJECT_NAME).setText(projectName);
wiz.comboBoxInGroup("Target runtime").setSelection(configuredState.getServer().name);
wiz.comboBoxInGroup("JBoss ESB version").setSelection(SWTTestExt.configuredState.getServer().bundledESBVersion);
-
+
wiz.button(IDELabel.Button.NEXT).click();
wiz.button(IDELabel.Button.NEXT).click();
/* Radio button indicating that server supplied ESB runtime is used */
//System.out.println ("DEBUG = " + wiz.radio(0).isSelected() );
assertTrue(wiz.radio(0).isSelected());
+
+ wiz.sleep(3000l);
+ org.jboss.tools.ui.bot.ext.SWTUtilExt.displayAllBotWidgets(wiz);
+ wiz.button("Finish").click();
+ wiz.sleep(3000l);
- open.finish(wiz);
-
+ /* Locate the SOA-P server */
SWTBot serv = servers.bot();
SWTBotTree servTree = serv.tree();
servTree.select ("SOA-5.2 [Stopped]").contextMenu("Add and Remove...").click();
- assertTrue (bot.label(1).getText().equals("There are no resources that can be added or removed from the server."));
- fail ("Failure - JBDS-1927");
+ /* Deploy the ESB project to the server */
+ bot.button ("Add All >>").click();
+ bot.sleep(3000l);
+ /* There should only be one project deployed to the server */
+ assertTrue (bot.tree(1).getAllItems().length == 1);
+
+ /* And it is the ESB project */
+ assertTrue (projectName.equals(bot.tree(1).getTreeItem(projectName).getText()));
+
+ bot.button("Finish").click();
+
+ /* Check for JBDS-1927 */
+ assertFalse (bot.label(1).getText().equals("There are no resources that can be added or removed from the server."));
wiz.sleep(3000l);
- bot.button("OK").click();
- wiz.sleep(3000l);
+ /* Verify that the ESB editor can open jboss-esb.xml */
assertTrue(projectExplorer.existsResource(projectName));
- assertTrue(projectExplorer.existsResource(projectName, "JBoss ESB Runtime ["+configuredState.getServer().name+"]"));
+// assertTrue(projectExplorer.existsResource(projectName, "JBoss ESB Runtime ["+configuredState.getServer().name+"]"));
assertTrue(bot.editorByTitle("jboss-esb.xml")!=null);
- // Now - deploy the project!
-
- }
-}
+ } /* test method */
+
+} /* class */
13 years, 1 month
JBoss Tools SVN: r36315 - workspace/snjeza/swt.win64.patch.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-11-11 20:06:27 -0500 (Fri, 11 Nov 2011)
New Revision: 36315
Added:
workspace/snjeza/swt.win64.patch/SWT333360Patch.zip
workspace/snjeza/swt.win64.patch/org.eclipse.swt.win32.win32.x86_64_compiled_Win7_64_JDK6u25.zip
workspace/snjeza/swt.win64.patch/org.eclipse.swt.win32.win32.x86_64_tweaked.zip
Log:
files from Snjeza: SWT333360Patch.zip (unchanged); org.eclipse.swt.win32.win32.x86_64_tweaked.zip (modified); org.eclipse.swt.win32.win32.x86_64_compiled_Win7_64_JDK6u25.zip (generated on Win7_64 w/ JDK6u25
Added: workspace/snjeza/swt.win64.patch/SWT333360Patch.zip
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/swt.win64.patch/SWT333360Patch.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/snjeza/swt.win64.patch/org.eclipse.swt.win32.win32.x86_64_compiled_Win7_64_JDK6u25.zip
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/swt.win64.patch/org.eclipse.swt.win32.win32.x86_64_compiled_Win7_64_JDK6u25.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/snjeza/swt.win64.patch/org.eclipse.swt.win32.win32.x86_64_tweaked.zip
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/swt.win64.patch/org.eclipse.swt.win32.win32.x86_64_tweaked.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
13 years, 1 month