JBoss Tools SVN: r37863 - trunk/openshift/tests/org.jboss.tools.openshift.egit.test.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-16 09:25:24 -0500 (Mon, 16 Jan 2012)
New Revision: 37863
Modified:
trunk/openshift/tests/org.jboss.tools.openshift.egit.test/pom.xml
Log:
[JBIDE-10391] implemented GitIgnore to be able to merge new entries with existing ones
Modified: trunk/openshift/tests/org.jboss.tools.openshift.egit.test/pom.xml
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.egit.test/pom.xml 2012-01-16 14:23:58 UTC (rev 37862)
+++ trunk/openshift/tests/org.jboss.tools.openshift.egit.test/pom.xml 2012-01-16 14:25:24 UTC (rev 37863)
@@ -8,8 +8,5 @@
</parent>
<groupId>org.jboss.tools.openshift.tests</groupId>
<artifactId>org.jboss.tools.openshift.egit.test</artifactId>
- <!-- TODO: if this plugin gets actual tests (rather than framework plugins on which other tests depend)
- then change this to packaging=eclipse-test-plugin to make Tycho RUN the tests rather than just
- compiling sources -->
- <packaging>eclipse-plugin</packaging>
+ <packaging>eclipse-test-plugin</packaging>
</project>
12 years, 12 months
JBoss Tools SVN: r37862 - in trunk/openshift: plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-16 09:23:58 -0500 (Mon, 16 Jan 2012)
New Revision: 37862
Added:
trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitTestSuite.java
trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/GitIgnoreTest.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/GitIgnore.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java
Log:
[JBIDE-10391] implemented GitIgnore to be able to merge new entries with existing ones
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java 2012-01-16 13:48:45 UTC (rev 37861)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java 2012-01-16 14:23:58 UTC (rev 37862)
@@ -73,14 +73,12 @@
*/
public class EGitUtils {
- private static final RefSpec DEFAULT_PUSH_REF_SPEC =
- new RefSpec("refs/heads/*:refs/remotes/origin/*"); //$NON-NLS-1$
-
+ // private static final RefSpec DEFAULT_PUSH_REF_SPEC = new RefSpec("refs/heads/*:refs/remotes/origin/*"); //$NON-NLS-1$
+ private static final String DEFAULT_REFSPEC_SOURCE = Constants.HEAD; // HEAD
+ private static final String DEFAULT_REFSPEC_DESTINATION = Constants.R_HEADS + Constants.MASTER; // refs/heads/master
private static final int PUSH_TIMEOUT = 10 * 1024;
+ private static final String EGIT_TEAM_PROVIDER_ID = "org.eclipse.egit.core·GitProvider";
- private static final String EGIT_TEAM_PROVIDER_ID =
- "org.eclipse.egit.core·GitProvider";
-
private EGitUtils() {
// inhibit instantiation
}
@@ -296,7 +294,8 @@
*
* @see #connect(IProject, Repository)
*/
- private static RevCommit commit(IProject project, String commitMessage, IProgressMonitor monitor) throws CoreException {
+ private static RevCommit commit(IProject project, String commitMessage, IProgressMonitor monitor)
+ throws CoreException {
Repository repository = getRepository(project);
Assert.isLegal(repository != null, "Cannot commit project to repository. ");
return commit(project, commitMessage, repository, monitor);
@@ -306,7 +305,8 @@
return commit(project, "Commit from JBoss Tools", monitor);
}
- private static RevCommit commit(IProject project, String commitMessage, Repository repository, IProgressMonitor monitor)
+ private static RevCommit commit(IProject project, String commitMessage, Repository repository,
+ IProgressMonitor monitor)
throws CoreException {
Assert.isLegal(project != null, "Could not commit project. No project provided");
Assert.isLegal(
@@ -365,14 +365,13 @@
return push(repository, remoteConfig, false, monitor);
}
-
public static PushOperationResult pushForce(String remote, Repository repository, IProgressMonitor monitor)
throws CoreException {
RemoteConfig remoteConfig = getRemoteConfig(remote, repository);
return push(repository, remoteConfig, true, monitor);
}
- private static PushOperationResult push(Repository repository, RemoteConfig remoteConfig,
+ private static PushOperationResult push(Repository repository, RemoteConfig remoteConfig,
boolean force, IProgressMonitor monitor) throws CoreException {
try {
if (remoteConfig == null) {
@@ -381,30 +380,21 @@
}
PushOperation op = createPushOperation(remoteConfig, repository, force);
op.run(monitor);
- PushOperationResult result = op.getOperationResult();
- return result;
+ return op.getOperationResult();
} catch (CoreException e) {
throw e;
} catch (Exception e) {
throw new CoreException(createStatus(e, "Could not push repo {0}", repository.toString()));
}
}
-//
- // only available in EGit 1.1
- //
- // private static PushOperation createPushOperation(String remoteName,
- // Repository repository) { return new PushOperation(repository, remoteName,
- // false, PUSH_TIMEOUT); }
- //
- private static PushOperation createPushOperation(RemoteConfig remoteConfig, Repository repository)
- throws CoreException {
- return createPushOperation(remoteConfig, repository, false);
+ private static PushOperation createPushOperation(String remoteName, Repository repository) {
+ return new PushOperation(repository, remoteName, false, PUSH_TIMEOUT);
}
-
+
private static PushOperation createPushOperation(RemoteConfig remoteConfig, Repository repository, boolean force)
throws CoreException {
-
+
PushOperationSpecification spec = new PushOperationSpecification();
List<URIish> pushToUris = getPushURIs(remoteConfig);
List<RefSpec> pushRefSpecs = getPushRefSpecs(remoteConfig);
@@ -413,7 +403,7 @@
// return new PushOperation(repository, spec, false, PUSH_TIMEOUT);
// TODO: fix pushoperation to really use the spec (currently seems like
// it does not work so we push everything to the remote)
-
+
// TODO ensure the 'force' is respected
return new PushOperation(repository, remoteConfig.getName(), false, PUSH_TIMEOUT);
}
@@ -474,10 +464,13 @@
*/
private static List<RefSpec> getPushRefSpecs(RemoteConfig config) {
List<RefSpec> pushRefSpecs = new ArrayList<RefSpec>();
- pushRefSpecs.addAll(config.getPushRefSpecs());
- if (pushRefSpecs.isEmpty()) {
- // default push to all branches
- pushRefSpecs.add(DEFAULT_PUSH_REF_SPEC);
+ List<RefSpec> remoteConfigPushRefSpecs = config.getPushRefSpecs();
+ if (!remoteConfigPushRefSpecs.isEmpty()) {
+ pushRefSpecs.addAll(remoteConfigPushRefSpecs);
+ } else {
+ // default is to push current HEAD to remote MASTER
+ pushRefSpecs.add(new RefSpec()
+ .setSource(DEFAULT_REFSPEC_SOURCE).setDestination(DEFAULT_REFSPEC_DESTINATION));
}
return pushRefSpecs;
}
@@ -704,7 +697,8 @@
return -1;
}
- private static Set<String> getCommitableChanges(IProject project, IServer server, IProgressMonitor monitor) throws IOException {
+ private static Set<String> getCommitableChanges(IProject project, IServer server, IProgressMonitor monitor)
+ throws IOException {
Repository repo = getRepository(project);
EclipseGitProgressTransformer jgitMonitor = new EclipseGitProgressTransformer(monitor);
@@ -713,52 +707,57 @@
indexDiff.diff(jgitMonitor, 0, 0, NLS.bind(
UIText.CommitActionHandler_repository, repo.getDirectory().getPath()));
Set<String> set = new HashSet<String>();
- if( commitAddedResources(server))
+ if (commitAddedResources(server))
set.addAll(indexDiff.getAdded());
- if( commitChangedResources(server))
+ if (commitChangedResources(server))
set.addAll(indexDiff.getChanged());
- if( commitConflictingResources(server))
+ if (commitConflictingResources(server))
set.addAll(indexDiff.getConflicting());
- if( commitMissingResources(server))
+ if (commitMissingResources(server))
set.addAll(indexDiff.getMissing());
- if( commitModifiedResources(server))
+ if (commitModifiedResources(server))
set.addAll(indexDiff.getModified());
- if( commitRemovedResources(server))
+ if (commitRemovedResources(server))
set.addAll(indexDiff.getRemoved());
- if( commitUntrackedResources(server))
+ if (commitUntrackedResources(server))
set.addAll(indexDiff.getUntracked());
return set;
}
/*
- * Current behaviour is to commit only:
- * added, changed, modified, removed
- *
- * These can be customized as properties on the server one day, if we wish,
- * such that each server can have custom settings, or, they can be global settings
+ * Current behaviour is to commit only: added, changed, modified, removed
+ *
+ * These can be customized as properties on the server one day, if we wish,
+ * such that each server can have custom settings, or, they can be global
+ * settings
*/
public static boolean commitAddedResources(IServer server) {
return true;
}
+
public static boolean commitChangedResources(IServer server) {
return true;
}
+
public static boolean commitConflictingResources(IServer server) {
return false;
}
+
public static boolean commitMissingResources(IServer server) {
return false;
}
+
public static boolean commitModifiedResources(IServer server) {
return true;
}
+
public static boolean commitRemovedResources(IServer server) {
return true;
}
+
public static boolean commitUntrackedResources(IServer server) {
return false;
}
-
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/GitIgnore.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/GitIgnore.java 2012-01-16 13:48:45 UTC (rev 37861)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/GitIgnore.java 2012-01-16 14:23:58 UTC (rev 37862)
@@ -10,30 +10,70 @@
******************************************************************************/
package org.jboss.tools.openshift.egit.core;
-import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
import java.io.File;
-import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
+import java.io.Reader;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.core.resources.IProject;
import org.eclipse.jgit.lib.Constants;
+/**
+ * @author André Dietisheim
+ */
public class GitIgnore {
- private List<String> entries;
- private File baseDir;
+ public static final String NL = System.getProperty("line.separator");
+
+ private Set<String> entries;
+ private File file;
- public GitIgnore(File baseDir) {
- this.baseDir = baseDir;
- this.entries = new ArrayList<String>();
+ public GitIgnore(IProject project) throws IOException {
+ this(new File(project.getLocation().toFile(), Constants.GITIGNORE_FILENAME));
}
+ public GitIgnore(File gitIgnoreFile) throws IOException {
+ this.file = gitIgnoreFile;
+ initEntries(gitIgnoreFile);
+ }
+
+ private void initEntries(File gitIgnore) throws IOException {
+ this.entries = new HashSet<String>();
+ if (gitIgnore == null
+ || !gitIgnore.canRead()) {
+ return;
+ }
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new FileReader(gitIgnore));
+ for (String line = null; (line = reader.readLine()) != null;) {
+ if (line != null) {
+ entries.add(line);
+ }
+ }
+ } finally {
+ safeClose(reader);
+ }
+ }
+
public GitIgnore add(String entry) {
this.entries.add(entry);
return this;
}
+ public boolean contains(String entry) {
+ return entries.contains(entry);
+ }
+
+ public int size() {
+ return entries.size();
+ }
+
/**
* Writes the entries in this instance to the .gitignore file. Overwrites
* and existing file if the given overwrite is set to <code>true</code>,
@@ -45,25 +85,31 @@
* @throws IOException
*/
public void write(boolean overwrite) throws IOException {
- File file = getFile();
- BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file, !overwrite));
+ BufferedWriter writer = new BufferedWriter(new FileWriter(file, !overwrite));
try {
for (String entry : entries) {
- out.write(entry.getBytes());
- out.write('\n');
+ writer.write(entry);
+ writer.write(NL);
}
- out.flush();
+ writer.flush();
} finally {
- out.close();
+ writer.close();
}
}
public boolean exists() {
- return getFile().exists();
+ return file != null
+ && file.exists();
}
-
- private File getFile() {
- File file = new File(baseDir, Constants.GITIGNORE_FILENAME);
- return file;
+
+ private void safeClose(Reader reader) {
+ if (reader == null) {
+ return;
+ }
+ try {
+ reader.close();
+ } catch (IOException e) {
+ // swallow
+ }
}
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java 2012-01-16 13:48:45 UTC (rev 37861)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java 2012-01-16 14:23:58 UTC (rev 37862)
@@ -13,7 +13,6 @@
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.List;
@@ -22,8 +21,6 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.transport.URIish;
import org.eclipse.osgi.util.NLS;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
import org.jboss.tools.openshift.egit.core.EGitUtils;
@@ -113,9 +110,11 @@
Assert.isLegal(project != null);
File projectFolder = project.getLocation().toFile();
monitor.subTask(NLS.bind("Copying openshift configuration to project {0}...", project.getName()));
+
FileUtils.copy(new File(sourceFolder, ".openshift"), projectFolder, false);
FileUtils.copy(new File(sourceFolder, "deployments"), projectFolder, false);
- createGitIgnore(projectFolder);
+
+ createGitIgnore(project);
}
/**
@@ -125,8 +124,8 @@
* @param projectFolder
* @throws IOException
*/
- private void createGitIgnore(File projectFolder) throws IOException {
- GitIgnore gitIgnore = new GitIgnore(projectFolder);
+ private void createGitIgnore(IProject project) throws IOException {
+ GitIgnore gitIgnore = new GitIgnore(project);
// TODO: merge existing .gitignore
// (https://issues.jboss.org/browse/JBIDE-10391)
if (gitIgnore.exists()) {
Added: trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitTestSuite.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitTestSuite.java (rev 0)
+++ trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitTestSuite.java 2012-01-16 14:23:58 UTC (rev 37862)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.openshift.egit.internal.test;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+(a)RunWith(Suite.class)
+@SuiteClasses({
+ EGitUtilsTest.class
+ , GitIgnoreTest.class
+})
+/**
+ * @author Andre Dietisheim
+ */
+public class EGitTestSuite {
+}
Property changes on: trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitTestSuite.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/GitIgnoreTest.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/GitIgnoreTest.java (rev 0)
+++ trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/GitIgnoreTest.java 2012-01-16 14:23:58 UTC (rev 37862)
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.openshift.egit.internal.test;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.eclipse.jgit.lib.Constants;
+import org.jboss.tools.openshift.egit.core.GitIgnore;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class GitIgnoreTest {
+
+ public static final String NL = System.getProperty("line.separator");
+
+ private File gitIgnoreFile;
+
+ public void setUp() throws IOException {
+ this.gitIgnoreFile = createGitFile("");
+ }
+
+ public void tearDown() {
+ gitIgnoreFile.delete();
+ }
+
+ @Test
+ public void canAddEntries() throws IOException {
+ GitIgnore gitIgnore = new GitIgnore(gitIgnoreFile);
+ assertTrue(gitIgnore.size() == 0);
+ String entry = "dummy";
+ gitIgnore.add(entry);
+ assertTrue(gitIgnore.size() == 1);
+ assertTrue(gitIgnore.contains(entry));
+ }
+
+ @Test
+ public void canParseExistingEntries() throws IOException {
+ File gitIgnoreFile = null;
+ try {
+ gitIgnoreFile = createGitFile("redhat", "jboss", "tools");
+ GitIgnore gitIgnore = new GitIgnore(gitIgnoreFile);
+ assertTrue(gitIgnore.size() == 3);
+ assertTrue(gitIgnore.contains("redhat"));
+ assertTrue(gitIgnore.contains("jboss"));
+ assertTrue(gitIgnore.contains("tools"));
+ } finally {
+ if (gitIgnoreFile != null) {
+ gitIgnoreFile.delete();
+ }
+ }
+ }
+
+ @Test
+ public void entryIsNotAddedTwice() throws IOException {
+ File gitIgnoreFile = null;
+ try {
+ gitIgnoreFile = createGitFile("redhat");
+ GitIgnore gitIgnore = new GitIgnore(gitIgnoreFile);
+ assertTrue(gitIgnore.size() == 1);
+ assertTrue(gitIgnore.contains("redhat"));
+ gitIgnore.add("redhat");
+ assertTrue(gitIgnore.size() == 1);
+ } finally {
+ gitIgnoreFile.delete();
+ }
+ }
+
+ private File createTmpFolder() throws IOException {
+ String tmpFolder = System.getProperty("java.io.tmpdir");
+ String currentTime = String.valueOf(System.currentTimeMillis());
+ File randomTmpFolder = new File(tmpFolder, currentTime);
+ randomTmpFolder.mkdir();
+ return randomTmpFolder;
+
+ }
+
+ private File createGitFile(String... gitIgnoreEntries) throws IOException {
+ File gitFile = new File(createTmpFolder(), Constants.GITIGNORE_FILENAME);
+ BufferedWriter writer = null;
+ try {
+ writer = new BufferedWriter(new FileWriter(gitFile));
+ for (String entry : gitIgnoreEntries) {
+ writer.write(entry);
+ writer.write(NL);
+ }
+ writer.flush();
+ } finally {
+ if (writer != null) {
+ writer.close();
+ }
+ }
+
+ return gitFile;
+ }
+}
Property changes on: trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/GitIgnoreTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
12 years, 12 months
JBoss Tools SVN: r37861 - in trunk/cdi/tests/org.jboss.tools.cdi.bot.test: resources/quickfix/injection and 10 other directories.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-01-16 08:48:45 -0500 (Mon, 16 Jan 2012)
New Revision: 37861
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/AnimalWithQualifier.java.cdi
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/BrokenFarm.java.cdi
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/BrokenFarmWithQualifier.java.cdi
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/Dog.java.cdi
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/DogWithQualifier.java.cdi
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/BeansXMLQuickFixTestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/EligibleInjectionQuickFixTestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QuickFixTestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/IValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ValidationProblem.java
Removed:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/addQualifier/
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/removeQualifier/
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/base/
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ValidationErrorProvider.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/requirements.properties
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/BeansXMLValidationErrors.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/CDIAnnotationsType.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLCompletionTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/injection/ProblemEligibleInjectionTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeanValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeansXMLValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/DecoratorValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/IBindingValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/InterceptorValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/QualifierValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/ScopeValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/StereotypeValidationQuickFixTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/AbstractValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeanValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeansXmlValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/DecoratorValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorBindingValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/QualifierValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ScopeValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/StereotypeValidationProvider.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/DynamicWebProjectWizard.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/WizardTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/todo.txt
Log:
Huge refactoring of all CDI QuickFix-like test + moving resources for QuickFix tests into one folder
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/requirements.properties
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/requirements.properties 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/requirements.properties 2012-01-16 13:48:45 UTC (rev 37861)
@@ -1 +1,2 @@
-requirements=jbossas-6.0.0.Final
\ No newline at end of file
+#requirements=jbossas-6.0.0.Final
+requirements=jbossas
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/AnimalWithQualifier.java.cdi
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/AnimalWithQualifier.java.cdi (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/AnimalWithQualifier.java.cdi 2012-01-16 13:48:45 UTC (rev 37861)
@@ -0,0 +1,7 @@
+package cdi;
+
+@Q1
+public class Animal {
+
+
+}
\ No newline at end of file
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/BrokenFarm.java.cdi
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/BrokenFarm.java.cdi (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/BrokenFarm.java.cdi 2012-01-16 13:48:45 UTC (rev 37861)
@@ -0,0 +1,9 @@
+package cdi;
+
+import javax.inject.Inject;
+
+public class BrokenFarm {
+ @SuppressWarnings("unused")
+ @Inject private Animal animal;
+
+}
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/BrokenFarmWithQualifier.java.cdi
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/BrokenFarmWithQualifier.java.cdi (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/BrokenFarmWithQualifier.java.cdi 2012-01-16 13:48:45 UTC (rev 37861)
@@ -0,0 +1,9 @@
+package cdi;
+
+import javax.inject.Inject;
+
+public class BrokenFarm {
+ @SuppressWarnings("unused")
+ @Inject @Q1 private Animal animal;
+
+}
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/Dog.java.cdi
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/Dog.java.cdi (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/Dog.java.cdi 2012-01-16 13:48:45 UTC (rev 37861)
@@ -0,0 +1,9 @@
+package cdi;
+
+public class Dog extends Animal {
+
+ public Dog() {
+
+ }
+
+}
\ No newline at end of file
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/DogWithQualifier.java.cdi
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/DogWithQualifier.java.cdi (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/resources/quickfix/injection/DogWithQualifier.java.cdi 2012-01-16 13:48:45 UTC (rev 37861)
@@ -0,0 +1,6 @@
+package cdi;
+
+@Q1
+public class Dog extends Animal {
+
+}
\ No newline at end of file
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDITestBase.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -11,6 +11,8 @@
package org.jboss.tools.cdi.bot.test;
+import java.util.Arrays;
+import java.util.List;
import java.util.logging.Logger;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
@@ -29,6 +31,14 @@
@SuiteClasses({ CDIAllBotTests.class })
public class CDITestBase extends CDIBase {
+ protected static final String BEANS_XML = "beans.xml";
+ protected static final String CLASS_END_TAG = "</class>";
+ protected static final String CLASS_OPEN_TAG = "<class>";
+ protected static final String STEREOTYPE_END_TAG = "</stereotype>";
+ protected static final String STEREOTYPE_OPEN_TAG = "<stereotype>";
+ protected static final List<String> BEANS_XML_TAGS = Arrays.asList(
+ "alternatives", "decorators", "interceptors");
+
private String projectName = "CDIProject";
private String packageName = "cdi";
protected final String LINE_SEPARATOR = System.getProperty("line.separator");
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/BeansXMLValidationErrors.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/BeansXMLValidationErrors.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/BeansXMLValidationErrors.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -13,6 +13,19 @@
public enum BeansXMLValidationErrors {
- ALTERNATIVE, DECORATOR, INTERCEPTOR, NO_SUCH_CLASS
+ ALTERNATIVE("must specify the name of an alternative bean class"),
+ DECORATOR("must specify the name of a decorator bean class"),
+ INTERCEPTOR("must specify the name of an interceptor class"),
+ NO_SUCH_CLASS("There is no class with the specified name");
+ private String validationError;
+
+ private BeansXMLValidationErrors(String validationError) {
+ this.validationError = validationError;
+ }
+
+ public String message() {
+ return validationError;
+ }
+
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/CDIAnnotationsType.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/CDIAnnotationsType.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/CDIAnnotationsType.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -14,6 +14,7 @@
public enum CDIAnnotationsType {
SERIALIZABLE, TARGET, RETENTION, NAMED, TYPED, DISPOSES, OBSERVES, INTERCEPTOR,
- SPECIALIZES, DECORATOR, PRODUCES, NONBINDING, STATELESS, INJECT;
+ SPECIALIZES, DECORATOR, PRODUCES, NONBINDING, STATELESS, INJECT,
+ MULTIPLE_BEAN_ELIGIBLE, NO_BEAN_ELIGIBLE;
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLCompletionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLCompletionTest.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLCompletionTest.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -33,8 +33,6 @@
public class BeansXMLCompletionTest extends CDITestBase {
- private static final List<String> BEANS_XML_TAGS = Arrays.asList(
- "alternatives", "decorators", "interceptors");
private static final List<String> INTERCEPTOR_NAMES = Arrays.asList(
"I1", "I2", "I3");
private static final List<String> DECORATORS_NAMES = Arrays.asList(
@@ -43,10 +41,6 @@
"A1", "A2", "A3");
private static final List<String> STEREOTYPES_NAMES = Arrays.asList(
"S1", "S2", "S3");
- private static final String BEANS_XML = "beans.xml";
- private static final String CLASS_END_TAG = "</class>";
- private static final String STEREOTYPE_END_TAG = "</stereotype>";
-
@Override
public String getProjectName() {
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/BeansXMLQuickFixTestBase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/BeansXMLQuickFixTestBase.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/BeansXMLQuickFixTestBase.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * 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.quickfix;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.BeansXmlValidationProvider;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
+import org.jboss.tools.cdi.bot.test.uiutils.wizards.CDIWizardBase;
+import org.jboss.tools.cdi.bot.test.uiutils.wizards.QuickFixDialogWizard;
+
+public class BeansXMLQuickFixTestBase extends QuickFixTestBase {
+
+ private static IValidationProvider validationProvider = new BeansXmlValidationProvider();
+
+ public IValidationProvider validationProvider() {
+ return validationProvider;
+ }
+
+ /**
+ * Method firstly gets beans.xml validation problem. Then
+ * it opens quick fix wizard, selects default value and
+ * press finish button
+ */
+ private void openBeanXMLValidationProblem(ValidationType validationProblemType) {
+
+ SWTBotTreeItem validationProblem = getProblem(validationProblemType);
+ assertNotNull(validationProblem);
+
+ quickFixHelper.openQuickFix(validationProblem);
+ QuickFixDialogWizard qfWizard = new QuickFixDialogWizard();
+ qfWizard.setFix(qfWizard.getAvailableFixes().get(0));
+ qfWizard.setResource(qfWizard.getResources().get(0));
+ qfWizard.finish();
+ }
+
+ /**
+ * Method checks if there is no beans.xml validation error
+ * @return
+ */
+ public boolean isBeanXMLValidationProblemsEmpty() {
+ for (ValidationType validationType: validationProvider().getAllValidationProblemsType()) {
+ if (getProblem(validationType) != null) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Method resolves validation error where there is no such Alternative as
+ * configured in beans.xml. It opens quick fix and through finish button
+ * the Bean Wizard dialog is opened where both parameters are used to create
+ * the new alternative bean
+ * @param name
+ * @param pkg
+ */
+ public void resolveAddNewAlternative(String name, String pkg) {
+
+ openBeanXMLValidationProblem(ValidationType.NO_CLASS);
+ CDIWizardBase cdiWizardBase = new CDIWizardBase(CDIWizardType.BEAN);
+ if (cdiWizardBase.isAlternative() && cdiWizardBase.canFinish()) {
+ cdiWizardBase.setName(name).setPackage(pkg).finish();
+ }else {
+ fail("Dialog can't be finished");
+ }
+
+ }
+
+ /**
+ * Method resolves validation error where there is no such Stereotype as
+ * configured in beans.xml. It opens quick fix and through finish button
+ * the Stereotype Wizard dialog is opened where both parameters are used to create
+ * the new stereotype annotation
+ * @param name
+ * @param pkg
+ */
+ public void resolveAddNewStereotype(String name, String pkg) {
+
+ openBeanXMLValidationProblem(ValidationType.NO_ANNOTATION);
+ CDIWizardBase cdiWizardBase = new CDIWizardBase(CDIWizardType.STEREOTYPE);
+ if (cdiWizardBase.isAlternative() && cdiWizardBase.canFinish()) {
+ cdiWizardBase.setName(name).setPackage(pkg).finish();
+ }else {
+ fail("Dialog can't be finished");
+ }
+
+ }
+
+ /**
+ * Method resolves validation error where there is no such decorator as
+ * configured in beans.xml. It opens quick fix and through finish button
+ * the Decorator Wizard dialog is opened where both parameters are used to create
+ * the new decorator. Interface "java.util.List" is automatically used.
+ * @param name
+ * @param pkg
+ */
+ public void resolveAddNewDecorator(String name, String pkg) {
+
+ openBeanXMLValidationProblem(ValidationType.NO_CLASS);
+ CDIWizardBase cdiWizardBase = new CDIWizardBase(CDIWizardType.DECORATOR);
+ cdiWizardBase.addInterface("java.util.List");
+ if (cdiWizardBase.canFinish()) {
+ cdiWizardBase.setName(name).setPackage(pkg).finish();
+ } else {
+ fail("Dialog can't be finished");
+ }
+
+ }
+
+ /**
+ * Method resolves validation error where there is no such Interceptor as
+ * configured in beans.xml. It opens quick fix and through finish button
+ * the Interceptor Wizard dialog is opened where both parameters are used to create
+ * the new Interceptor
+ * @param name
+ * @param pkg
+ */
+ public void resolveAddNewInterceptor(String name, String pkg) {
+
+ openBeanXMLValidationProblem(ValidationType.NO_CLASS);
+ CDIWizardBase cdiWizardBase = new CDIWizardBase(CDIWizardType.INTERCEPTOR);
+ if (cdiWizardBase.canFinish()) {
+ cdiWizardBase.setName(name).setPackage(pkg).finish();
+ }else {
+ fail("Dialog can't be finished");
+ }
+
+ }
+
+ /**
+ * Method corrects Bean which has no @Alternative annotation in it
+ * by adding these parameter.
+ * @param name
+ * @param pkg
+ */
+ public void resolveAddAlternativeToBean(String name) {
+
+ openBeanXMLValidationProblem(ValidationType.ALTERNATIVE_BEAN_XML);
+ String content = bot.editorByTitle(name + ".java").toTextEditor().getText();
+ assertTrue(content.contains("@Alternative"));
+
+ }
+
+ /**
+ * Method corrects Stereotype which has no @Alternative annotation in it
+ * by adding these parameter.
+ * @param name
+ * @param pkg
+ */
+ public void resolveAddAlternativeToStereotype(String name) {
+
+ openBeanXMLValidationProblem(ValidationType.ALTERNATIVE_STEREOTYPE_BEAN_XML);
+ String content = bot.editorByTitle(name + ".java").toTextEditor().getText();
+ assertTrue(content.contains("@Alternative"));
+
+ }
+
+}
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/EligibleInjectionQuickFixTestBase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/EligibleInjectionQuickFixTestBase.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/EligibleInjectionQuickFixTestBase.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * 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.quickfix;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+import org.jboss.tools.cdi.bot.test.quickfix.injection.QualifierOperation;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.BeanValidationProvider;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
+import org.jboss.tools.cdi.bot.test.uiutils.wizards.QuickFixDialogWizard;
+import org.jboss.tools.cdi.bot.test.uiutils.wizards.SpecifyBeanDialogWizard;
+import org.jboss.tools.ui.bot.ext.Timing;
+
+public class EligibleInjectionQuickFixTestBase extends QuickFixTestBase{
+
+ private static IValidationProvider validationProvider = new BeanValidationProvider();
+
+ public IValidationProvider validationProvider() {
+ return validationProvider;
+ }
+
+ /**
+ * Method resolves multiple bean injection problem. By setting class which
+ * should be more qualified and qualifier name it resolves this problem.
+ * If qualifier doesn't exist, by using qualifier wizard it creates the new
+ * one and uses it to resolve problem
+ * @param classToQualify
+ * @param qualifier
+ */
+ public void resolveMultipleBeans(ValidationType validationType, String classToQualify,
+ String qualifier, QualifierOperation operation) {
+
+ SWTBotTreeItem validationProblem = getProblem(validationType);
+ assertNotNull(validationProblem);
+
+ quickFixHelper.openQuickFix(validationProblem);
+ QuickFixDialogWizard quickFixWizard = new QuickFixDialogWizard();
+ for (String availableFix : quickFixWizard.getAvailableFixes()) {
+ if (availableFix.contains(classToQualify)) {
+ quickFixWizard.setFix(availableFix).
+ setResource(quickFixWizard.getResources().get(0)).
+ finish();
+ }
+ }
+
+ SpecifyBeanDialogWizard spBeanDialogWizard = new SpecifyBeanDialogWizard();
+ if (operation == QualifierOperation.ADD) {
+ boolean qualifFound = false;
+ for (String availQualifer : spBeanDialogWizard.getAvailableQualifiers()) {
+ if (availQualifer.equals(qualifier + " - " + getPackageName())) {
+ qualifFound = true;
+ spBeanDialogWizard.addQualifier(availQualifer);
+ }
+ }
+ // there was no such qualifer, it has to be created, after creation it
+ // has to be added to in Bean qualifiers
+ if (!qualifFound) {
+ spBeanDialogWizard.createNewQualifier(qualifier, getPackageName()).
+ setName(qualifier).finish();
+ bot.sleep(Timing.time2S());
+ for (String availQualifer : spBeanDialogWizard.getAvailableQualifiers()) {
+ if (availQualifer.equals(qualifier + " - " + getPackageName())) {
+ spBeanDialogWizard.addQualifier(availQualifer);
+ }
+ }
+ }
+
+ } else {
+ for (String inBeanQualifer : spBeanDialogWizard.getInBeanQualifiers()) {
+ if (inBeanQualifer.equals(qualifier + " - " + getPackageName())) {
+ spBeanDialogWizard.removeQualifier(inBeanQualifer);
+ }
+ }
+ }
+
+ spBeanDialogWizard.finish();
+
+ bot.sleep(Timing.time1S());
+ util.waitForNonIgnoredJobs();
+ }
+
+}
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QuickFixTestBase.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QuickFixTestBase.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/QuickFixTestBase.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * 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.quickfix;
+
+
+import java.util.List;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.cdi.bot.test.CDITestBase;
+import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
+import org.jboss.tools.cdi.bot.test.uiutils.wizards.QuickFixDialogWizard;
+import org.junit.BeforeClass;
+
+/**
+ * Test base for all QuickFix-like tests
+ *
+ * @author Jaroslav Jankovic
+ */
+
+public abstract class QuickFixTestBase extends CDITestBase {
+
+ @BeforeClass
+ public static void setup() {
+ problems.show();
+ }
+
+ protected abstract IValidationProvider validationProvider();
+
+ /**
+ * checkQuickFix is the most important method in this class. It
+ * gets validation error prior to component type and annotation type,
+ * then it resolve validation error through quick fix
+ * wizard and finally check if validation errors was fixed through
+ * this wizard
+ * @param validationType
+ * @param compType
+ */
+ public void checkQuickFix(ValidationType validationType) {
+ SWTBotTreeItem validationProblem = getProblem(validationType);
+ assertNotNull(validationProblem);
+ resolveQuickFix(validationProblem);
+ validationProblem = getProblem(validationType);
+ assertNull(validationProblem);
+ }
+
+ /**
+ * Methods gets the particular validation problem located in Problems View by
+ * using specific ValidationErrorsProvider
+ * @param validationType
+ * @param compType
+ * @return
+ */
+ protected SWTBotTreeItem getProblem(ValidationType validationType) {
+ IValidationProvider validationErrorsProvider = validationProvider();
+ List<String> validationProblems = null;
+ SWTBotTreeItem[] problemsInProblemsView = null;
+ if (validationErrorsProvider.getAllWarningsAnnotation().contains(validationType)) {
+ validationProblems = validationErrorsProvider.getAllWarningForAnnotationType(validationType);
+ problemsInProblemsView = quickFixHelper.getProblems(ProblemsType.WARNINGS, getProjectName());
+ } else {
+ validationProblems = validationErrorsProvider.getAllErrorsForAnnotationType(validationType);
+ problemsInProblemsView = quickFixHelper.getProblems(ProblemsType.ERRORS, getProjectName());
+ }
+ for (SWTBotTreeItem ti: problemsInProblemsView) {
+ for (String validationProblem: validationProblems) {
+ if (ti.getText().contains(validationProblem)) {
+ return ti;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Method resolves particular validation problem (parameter ti).
+ * It simply open context menu for param "ti", open menu "Quick Fix" and
+ * chooses first option and confirms it (resolve it)
+ * @param ti
+ */
+ private void resolveQuickFix(SWTBotTreeItem ti) {
+ quickFixHelper.openQuickFix(ti);
+
+ QuickFixDialogWizard qfWizard = new QuickFixDialogWizard();
+
+ String firstFix = qfWizard.getAvailableFixes().get(0);
+ String firstResource = qfWizard.getResources().get(0);
+
+ qfWizard.setFix(firstFix).setResource(firstResource).finish();
+
+ util.waitForNonIgnoredJobs();
+ }
+
+}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/injection/ProblemEligibleInjectionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/injection/ProblemEligibleInjectionTest.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/injection/ProblemEligibleInjectionTest.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -12,7 +12,8 @@
package org.jboss.tools.cdi.bot.test.quickfix.injection;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-import org.jboss.tools.cdi.bot.test.quickfix.base.EligibleInjectionQuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+import org.jboss.tools.cdi.bot.test.quickfix.EligibleInjectionQuickFixTestBase;
import org.junit.After;
import org.junit.Test;
@@ -52,14 +53,14 @@
wizard.createCDIComponentWithContent(CDIWizardType.BEAN, DOG,
getPackageName(), null, "/resources/quickfix/" +
- "injection/addQualifier/Dog.java.cdi");
+ "injection/Dog.java.cdi");
wizard.createCDIComponentWithContent(CDIWizardType.BEAN, BROKEN_FARM,
getPackageName(), null, "/resources/quickfix/" +
- "injection/addQualifier/BrokenFarm.java.cdi");
+ "injection/BrokenFarm.java.cdi");
- resolveMultipleBeans(DOG, QUALIFIER, QualifierOperation.ADD);
+ resolveMultipleBeans(ValidationType.MULTIPLE_BEAN_ELIGIBLE, DOG, QUALIFIER, QualifierOperation.ADD);
bot.editorByTitle(BROKEN_FARM + ".java").show();
setEd(bot.activeEditor().toTextEditor());
@@ -70,56 +71,56 @@
}
@Test
- public void testMultipleBeansRemovingExistingQualifier() {
+ public void testMultipleBeansAddingNonExistingQualifier() {
- wizard.createCDIComponent(CDIWizardType.QUALIFIER, QUALIFIER,
+ wizard.createCDIComponent(CDIWizardType.BEAN, ANIMAL,
getPackageName(), null);
- wizard.createCDIComponentWithContent(CDIWizardType.BEAN, ANIMAL,
- getPackageName(), null, "/resources/quickfix/" +
- "injection/removeQualifier/Animal.java.cdi");
-
wizard.createCDIComponentWithContent(CDIWizardType.BEAN, DOG,
getPackageName(), null, "/resources/quickfix/" +
- "injection/removeQualifier/Dog.java.cdi");
+ "injection/Dog.java.cdi");
+
wizard.createCDIComponentWithContent(CDIWizardType.BEAN, BROKEN_FARM,
getPackageName(), null, "/resources/quickfix/" +
- "injection/removeQualifier/BrokenFarm.java.cdi");
+ "injection/BrokenFarm.java.cdi");
+
+ resolveMultipleBeans(ValidationType.MULTIPLE_BEAN_ELIGIBLE, DOG, QUALIFIER, QualifierOperation.ADD);
- resolveMultipleBeans(DOG, QUALIFIER, QualifierOperation.REMOVE);
-
bot.editorByTitle(BROKEN_FARM + ".java").show();
setEd(bot.activeEditor().toTextEditor());
String code = getEd().getText();
- assertTrue(code.contains("@Inject private") || code.contains("@Inject private"));
+ assertTrue(code.contains("@Inject @" + QUALIFIER));
code = bot.editorByTitle(DOG + ".java").toTextEditor().getText();
- assertTrue(!code.contains("@" + QUALIFIER));
+ assertTrue(code.contains("@" + QUALIFIER));
}
@Test
- public void testMultipleBeansAddingNonExistingQualifier() {
+ public void testMultipleBeansRemovingExistingQualifier() {
- wizard.createCDIComponent(CDIWizardType.BEAN, ANIMAL,
+ wizard.createCDIComponent(CDIWizardType.QUALIFIER, QUALIFIER,
getPackageName(), null);
+ wizard.createCDIComponentWithContent(CDIWizardType.BEAN, ANIMAL,
+ getPackageName(), null, "/resources/quickfix/" +
+ "injection/AnimalWithQualifier.java.cdi");
+
wizard.createCDIComponentWithContent(CDIWizardType.BEAN, DOG,
getPackageName(), null, "/resources/quickfix/" +
- "injection/addQualifier/Dog.java.cdi");
+ "injection/DogWithQualifier.java.cdi");
-
wizard.createCDIComponentWithContent(CDIWizardType.BEAN, BROKEN_FARM,
getPackageName(), null, "/resources/quickfix/" +
- "injection/addQualifier/BrokenFarm.java.cdi");
+ "injection/BrokenFarmWithQualifier.java.cdi");
+
+ resolveMultipleBeans(ValidationType.MULTIPLE_BEAN_ELIGIBLE, DOG, QUALIFIER, QualifierOperation.REMOVE);
- resolveMultipleBeans(DOG, QUALIFIER, QualifierOperation.ADD);
-
bot.editorByTitle(BROKEN_FARM + ".java").show();
setEd(bot.activeEditor().toTextEditor());
String code = getEd().getText();
- assertTrue(code.contains("@Inject @" + QUALIFIER));
+ assertTrue(code.contains("@Inject private") || code.contains("@Inject private"));
code = bot.editorByTitle(DOG + ".java").toTextEditor().getText();
- assertTrue(code.contains("@" + QUALIFIER));
+ assertTrue(!code.contains("@" + QUALIFIER));
}
@Test
@@ -133,14 +134,14 @@
wizard.createCDIComponentWithContent(CDIWizardType.BEAN, DOG,
getPackageName(), null, "/resources/quickfix/" +
- "injection/addQualifier/Dog.java.cdi");
+ "injection/Dog.java.cdi");
wizard.createCDIComponentWithContent(CDIWizardType.BEAN, BROKEN_FARM,
getPackageName(), null, "/resources/quickfix/" +
- "injection/addQualifier/BrokenFarmWithQualifier.java.cdi");
+ "injection/BrokenFarmWithQualifier.java.cdi");
- resolveMultipleBeans(DOG, QUALIFIER, QualifierOperation.ADD);
+ resolveMultipleBeans(ValidationType.NO_BEAN_ELIGIBLE, DOG, QUALIFIER, QualifierOperation.ADD);
bot.editorByTitle(BROKEN_FARM + ".java").show();
setEd(bot.activeEditor().toTextEditor());
@@ -152,28 +153,32 @@
}
@Test
- public void testNoBeanEligibleAddingNonExistingQualifier() {
+ public void testNoBeanEligibleRemovingExistingQualifier() {
- wizard.createCDIComponent(CDIWizardType.BEAN, ANIMAL,
+ wizard.createCDIComponent(CDIWizardType.QUALIFIER, QUALIFIER,
getPackageName(), null);
+ wizard.createCDIComponentWithContent(CDIWizardType.BEAN, ANIMAL,
+ getPackageName(), null, "/resources/quickfix/" +
+ "injection/AnimalWithQualifier.java.cdi");
+
wizard.createCDIComponentWithContent(CDIWizardType.BEAN, DOG,
getPackageName(), null, "/resources/quickfix/" +
- "injection/addQualifier/Dog.java.cdi");
+ "injection/DogWithQualifier.java.cdi");
wizard.createCDIComponentWithContent(CDIWizardType.BEAN, BROKEN_FARM,
getPackageName(), null, "/resources/quickfix/" +
- "injection/addQualifier/BrokenFarmWithQualifier.java.cdi");
+ "injection/BrokenFarm.java.cdi");
- resolveMultipleBeans(DOG, QUALIFIER, QualifierOperation.ADD);
+ resolveMultipleBeans(ValidationType.NO_BEAN_ELIGIBLE, DOG, QUALIFIER, QualifierOperation.REMOVE);
bot.editorByTitle(BROKEN_FARM + ".java").show();
setEd(bot.activeEditor().toTextEditor());
String code = getEd().getText();
- assertTrue(code.contains("@Inject @" + QUALIFIER));
+ assertTrue(code.contains("@Inject private") || code.contains("@Inject private"));
code = bot.editorByTitle(DOG + ".java").toTextEditor().getText();
- assertTrue(code.contains("@" + QUALIFIER));
+ assertFalse(code.contains("@" + QUALIFIER));
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeanValidationQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeanValidationQuickFixTest.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeanValidationQuickFixTest.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -12,9 +12,11 @@
package org.jboss.tools.cdi.bot.test.quickfix.test;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-import org.jboss.tools.cdi.bot.test.quickfix.base.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+import org.jboss.tools.cdi.bot.test.quickfix.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.BeanValidationProvider;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
import org.junit.Test;
/**
@@ -25,11 +27,16 @@
public class BeanValidationQuickFixTest extends QuickFixTestBase {
+ private static IValidationProvider validationProvider = new BeanValidationProvider();
@Override
public String getProjectName() {
return "CDIQuickFixBeanTest";
}
+
+ public IValidationProvider validationProvider() {
+ return validationProvider;
+ }
// https://issues.jboss.org/browse/JBIDE-8550
@Test
@@ -41,11 +48,10 @@
getPackageName(), null, "/resources/quickfix/bean/SerializableBean.java.cdi");
editResourceUtil.replaceInEditor("BeanComponent", className);
- checkQuickFix(CDIAnnotationsType.SERIALIZABLE, CDIWizardType.BEAN);
+ checkQuickFix(ValidationType.SERIALIZABLE);
}
-
// https://issues.jboss.org/browse/JBIDE-7664
@Test
public void testConstructor() {
@@ -56,7 +62,7 @@
getPackageName(), null, "/resources/quickfix/bean/ConstructorWithParam.java.cdi");
editResourceUtil.replaceInEditor("BeanComponent", className);
- checkQuickFix(CDIAnnotationsType.DISPOSES, CDIWizardType.BEAN);
+ checkQuickFix(ValidationType.DISPOSES);
editResourceUtil.replaceClassContentByResource(QuickFixTestBase.class
.getResourceAsStream("/resources/quickfix/bean/ConstructorWithParam.java.cdi"), false);
@@ -66,7 +72,7 @@
"import javax.enterprise.event.Observes;");
editResourceUtil.replaceInEditor("BeanComponent", className);
- checkQuickFix(CDIAnnotationsType.OBSERVES, CDIWizardType.BEAN);
+ checkQuickFix(ValidationType.OBSERVES);
}
// https://issues.jboss.org/browse/JBIDE-7665
@@ -80,7 +86,7 @@
editResourceUtil.replaceInEditor("BeanComponent", className);
- checkQuickFix(CDIAnnotationsType.DISPOSES, CDIWizardType.BEAN);
+ checkQuickFix(ValidationType.DISPOSES);
editResourceUtil.replaceClassContentByResource(QuickFixTestBase.class
.getResourceAsStream("/resources/quickfix/bean/ProducerWithParam.java.cdi"), false);
@@ -90,7 +96,7 @@
editResourceUtil.replaceInEditor("import javax.enterprise.inject.Disposes;",
"import javax.enterprise.event.Observes;");
- checkQuickFix(CDIAnnotationsType.OBSERVES, CDIWizardType.BEAN);
+ checkQuickFix(ValidationType.OBSERVES);
}
@@ -105,7 +111,7 @@
editResourceUtil.replaceInEditor("BeanComponent", className);
- checkQuickFix(CDIAnnotationsType.DISPOSES, CDIWizardType.BEAN);
+ checkQuickFix(ValidationType.DISPOSES);
}
@@ -123,7 +129,7 @@
editResourceUtil.replaceInEditor("@Disposes", "@Observes");
editResourceUtil.replaceInEditor("BeanComponent", className);
- checkQuickFix(CDIAnnotationsType.OBSERVES, CDIWizardType.BEAN);
+ checkQuickFix(ValidationType.OBSERVES);
}
@@ -138,7 +144,7 @@
editResourceUtil.replaceInEditor("BeanComponent", className);
- checkQuickFix(CDIAnnotationsType.PRODUCES, CDIWizardType.BEAN);
+ checkQuickFix(ValidationType.PRODUCES);
}
@@ -153,7 +159,7 @@
editResourceUtil.replaceInEditor("BeanComponent", className);
- checkQuickFix(CDIAnnotationsType.OBSERVES, CDIWizardType.BEAN);
+ checkQuickFix(ValidationType.OBSERVES);
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeansXMLValidationQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeansXMLValidationQuickFixTest.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/BeansXMLValidationQuickFixTest.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -12,7 +12,7 @@
package org.jboss.tools.cdi.bot.test.quickfix.test;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-import org.jboss.tools.cdi.bot.test.quickfix.base.BeansXMLQuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.BeansXMLQuickFixTestBase;
import org.junit.Test;
/**
@@ -60,7 +60,7 @@
beansHelper.createBeansXMLWithAlternative(getProjectName(), getPackageName(), bean);
- resolveAddAlternativeToExistingComponent(bean);
+ resolveAddAlternativeToBean(bean);
assertTrue(isBeanXMLValidationProblemsEmpty());
@@ -75,7 +75,7 @@
beansHelper.createBeansXMLWithStereotype(getProjectName(), getPackageName(), stereotype);
- resolveAddAlternativeToExistingComponent(stereotype);
+ resolveAddAlternativeToStereotype(stereotype);
assertTrue(isBeanXMLValidationProblemsEmpty());
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/DecoratorValidationQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/DecoratorValidationQuickFixTest.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/DecoratorValidationQuickFixTest.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -12,9 +12,11 @@
package org.jboss.tools.cdi.bot.test.quickfix.test;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-import org.jboss.tools.cdi.bot.test.quickfix.base.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+import org.jboss.tools.cdi.bot.test.quickfix.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.DecoratorValidationProvider;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
import org.junit.Test;
/**
@@ -25,12 +27,17 @@
public class DecoratorValidationQuickFixTest extends QuickFixTestBase {
+ private static IValidationProvider validationProvider = new DecoratorValidationProvider();
@Override
public String getProjectName() {
return "CDIQuickFixDecoratorTest";
}
+ public IValidationProvider validationProvider() {
+ return validationProvider;
+ }
+
// https://issues.jboss.org/browse/JBIDE-7680
@Test
public void testSessionAnnotation() {
@@ -43,7 +50,7 @@
editResourceUtil.replaceInEditor("DecoratorComponent", className);
- checkQuickFix(CDIAnnotationsType.STATELESS, CDIWizardType.DECORATOR);
+ checkQuickFix(ValidationType.STATELESS);
}
@@ -59,7 +66,7 @@
editResourceUtil.replaceInEditor("DecoratorComponent", className);
- checkQuickFix(CDIAnnotationsType.NAMED, CDIWizardType.DECORATOR);
+ checkQuickFix(ValidationType.NAMED);
}
@@ -75,7 +82,7 @@
editResourceUtil.replaceInEditor("DecoratorComponent", className);
- checkQuickFix(CDIAnnotationsType.PRODUCES, CDIWizardType.DECORATOR);
+ checkQuickFix(ValidationType.PRODUCES);
}
@@ -91,7 +98,7 @@
editResourceUtil.replaceInEditor("DecoratorComponent", className);
- checkQuickFix(CDIAnnotationsType.DISPOSES, CDIWizardType.DECORATOR);
+ checkQuickFix(ValidationType.DISPOSES);
}
@@ -110,7 +117,7 @@
editResourceUtil.replaceInEditor("@Disposes", "@Observes");
editResourceUtil.replaceInEditor("DecoratorComponent", className);
- checkQuickFix(CDIAnnotationsType.OBSERVES, CDIWizardType.DECORATOR);
+ checkQuickFix(ValidationType.OBSERVES);
}
@@ -126,7 +133,7 @@
editResourceUtil.replaceInEditor("DecoratorComponent", className);
- checkQuickFix(CDIAnnotationsType.SPECIALIZES, CDIWizardType.DECORATOR);
+ checkQuickFix(ValidationType.SPECIALIZES);
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/IBindingValidationQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/IBindingValidationQuickFixTest.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/IBindingValidationQuickFixTest.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -12,9 +12,11 @@
package org.jboss.tools.cdi.bot.test.quickfix.test;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-import org.jboss.tools.cdi.bot.test.quickfix.base.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+import org.jboss.tools.cdi.bot.test.quickfix.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.InterceptorBindingValidationProvider;
import org.junit.Test;
/**
@@ -25,12 +27,17 @@
public class IBindingValidationQuickFixTest extends QuickFixTestBase {
+ private static IValidationProvider validationProvider = new InterceptorBindingValidationProvider();
@Override
public String getProjectName() {
return "CDIQuickFixIBindingTest";
}
+ public IValidationProvider validationProvider() {
+ return validationProvider;
+ }
+
// https://issues.jboss.org/browse/JBIDE-7641
@Test
public void testNonbindingAnnotation() {
@@ -44,14 +51,14 @@
editResourceUtil.replaceInEditor("IBindingComponent", className);
- checkQuickFix(CDIAnnotationsType.NONBINDING, CDIWizardType.INTERCEPTOR_BINDING);
+ checkQuickFix(ValidationType.NONBINDING);
editResourceUtil.replaceClassContentByResource(QuickFixTestBase.class
.getResourceAsStream("/resources/quickfix/interceptorBinding/IBindingWithStringArray.java.cdi"),
false);
editResourceUtil.replaceInEditor("IBindingComponent", className);
- checkQuickFix(CDIAnnotationsType.NONBINDING, CDIWizardType.INTERCEPTOR_BINDING);
+ checkQuickFix(ValidationType.NONBINDING);
}
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/InterceptorValidationQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/InterceptorValidationQuickFixTest.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/InterceptorValidationQuickFixTest.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -12,9 +12,11 @@
package org.jboss.tools.cdi.bot.test.quickfix.test;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-import org.jboss.tools.cdi.bot.test.quickfix.base.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+import org.jboss.tools.cdi.bot.test.quickfix.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.InterceptorValidationProvider;
import org.junit.Test;
/**
@@ -25,12 +27,17 @@
public class InterceptorValidationQuickFixTest extends QuickFixTestBase {
-
+ private static IValidationProvider validationProvider = new InterceptorValidationProvider();
+
@Override
public String getProjectName() {
return "CDIQuickFixInterceptorTest";
}
+ public IValidationProvider validationProvider() {
+ return validationProvider;
+ }
+
// https://issues.jboss.org/browse/JBIDE-7680
@Test
public void testSessionAnnotation() {
@@ -43,7 +50,7 @@
editResourceUtil.replaceInEditor("InterceptorComponent", className);
- checkQuickFix(CDIAnnotationsType.STATELESS, CDIWizardType.INTERCEPTOR);
+ checkQuickFix(ValidationType.STATELESS);
}
@@ -59,7 +66,7 @@
editResourceUtil.replaceInEditor("InterceptorComponent", className);
- checkQuickFix(CDIAnnotationsType.NAMED, CDIWizardType.INTERCEPTOR);
+ checkQuickFix(ValidationType.NAMED);
}
@@ -75,7 +82,7 @@
editResourceUtil.replaceInEditor("InterceptorComponent", className);
- checkQuickFix(CDIAnnotationsType.PRODUCES, CDIWizardType.INTERCEPTOR);
+ checkQuickFix(ValidationType.PRODUCES);
}
@@ -91,7 +98,7 @@
editResourceUtil.replaceInEditor("InterceptorComponent", className);
- checkQuickFix(CDIAnnotationsType.DISPOSES, CDIWizardType.INTERCEPTOR);
+ checkQuickFix(ValidationType.DISPOSES);
}
@@ -110,7 +117,7 @@
editResourceUtil.replaceInEditor("@Disposes", "@Observes");
editResourceUtil.replaceInEditor("InterceptorComponent", className);
- checkQuickFix(CDIAnnotationsType.OBSERVES, CDIWizardType.INTERCEPTOR);
+ checkQuickFix(ValidationType.OBSERVES);
}
@@ -126,7 +133,7 @@
editResourceUtil.replaceInEditor("InterceptorComponent", className);
- checkQuickFix(CDIAnnotationsType.SPECIALIZES, CDIWizardType.INTERCEPTOR);
+ checkQuickFix(ValidationType.SPECIALIZES);
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/QualifierValidationQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/QualifierValidationQuickFixTest.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/QualifierValidationQuickFixTest.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -12,9 +12,11 @@
package org.jboss.tools.cdi.bot.test.quickfix.test;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-import org.jboss.tools.cdi.bot.test.quickfix.base.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+import org.jboss.tools.cdi.bot.test.quickfix.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.QualifierValidationProvider;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
import org.junit.Test;
/**
@@ -25,11 +27,17 @@
public class QualifierValidationQuickFixTest extends QuickFixTestBase {
+ private static IValidationProvider validationProvider = new QualifierValidationProvider();
+
@Override
public String getProjectName() {
return "CDIQuickFixQualifierTest";
}
+ public IValidationProvider validationProvider() {
+ return validationProvider;
+ }
+
// https://issues.jboss.org/browse/JBIDE-7630
@Test
public void testTargetAnnotation() {
@@ -41,11 +49,11 @@
editResourceUtil.replaceInEditor("@Target({ TYPE, METHOD, PARAMETER, FIELD })",
"@Target({ TYPE, FIELD })");
- checkQuickFix(CDIAnnotationsType.TARGET, CDIWizardType.QUALIFIER);
+ checkQuickFix(ValidationType.TARGET);
editResourceUtil.replaceInEditor("@Target({TYPE, METHOD, FIELD, PARAMETER})", "");
- checkQuickFix(CDIAnnotationsType.TARGET, CDIWizardType.QUALIFIER);
+ checkQuickFix(ValidationType.TARGET);
}
// https://issues.jboss.org/browse/JBIDE-7631
@@ -58,11 +66,11 @@
editResourceUtil.replaceInEditor("@Retention(RUNTIME)", "@Retention(CLASS)");
- checkQuickFix(CDIAnnotationsType.RETENTION, CDIWizardType.QUALIFIER);
+ checkQuickFix(ValidationType.RETENTION);
editResourceUtil.replaceInEditor("@Retention(RUNTIME)", "");
- checkQuickFix(CDIAnnotationsType.RETENTION, CDIWizardType.QUALIFIER);
+ checkQuickFix(ValidationType.RETENTION);
}
@@ -79,12 +87,12 @@
editResourceUtil.replaceInEditor("QualifierComponent", className);
- checkQuickFix(CDIAnnotationsType.NONBINDING, CDIWizardType.QUALIFIER);
+ checkQuickFix(ValidationType.NONBINDING);
editResourceUtil.replaceClassContentByResource(QuickFixTestBase.class
.getResourceAsStream("/resources/quickfix/qualifier/QualifierWithStringArray.java.cdi"), false);
editResourceUtil.replaceInEditor("QualifierComponent", className);
- checkQuickFix(CDIAnnotationsType.NONBINDING, CDIWizardType.QUALIFIER);
+ checkQuickFix(ValidationType.NONBINDING);
}
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/ScopeValidationQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/ScopeValidationQuickFixTest.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/ScopeValidationQuickFixTest.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -12,9 +12,11 @@
package org.jboss.tools.cdi.bot.test.quickfix.test;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-import org.jboss.tools.cdi.bot.test.quickfix.base.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+import org.jboss.tools.cdi.bot.test.quickfix.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.ScopeValidationProvider;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
import org.junit.Test;
/**
@@ -25,11 +27,17 @@
public class ScopeValidationQuickFixTest extends QuickFixTestBase {
+ private static IValidationProvider validationProvider = new ScopeValidationProvider();
+
@Override
public String getProjectName() {
return "CDIQuickFixScopeTest";
}
+ public IValidationProvider validationProvider() {
+ return validationProvider;
+ }
+
// https://issues.jboss.org/browse/JBIDE-7633
@Test
public void testTargetAnnotation() {
@@ -41,11 +49,11 @@
editResourceUtil.replaceInEditor("@Target({ TYPE, METHOD, FIELD })",
"@Target({ TYPE, FIELD })");
- checkQuickFix(CDIAnnotationsType.TARGET, CDIWizardType.SCOPE);
+ checkQuickFix(ValidationType.TARGET);
editResourceUtil.replaceInEditor("@Target({TYPE, METHOD, FIELD})", "");
- checkQuickFix(CDIAnnotationsType.TARGET, CDIWizardType.SCOPE);
+ checkQuickFix(ValidationType.TARGET);
}
// https://issues.jboss.org/browse/JBIDE-7631
@@ -58,11 +66,11 @@
editResourceUtil.replaceInEditor("@Retention(RUNTIME)", "@Retention(CLASS)");
- checkQuickFix(CDIAnnotationsType.RETENTION, CDIWizardType.SCOPE);
+ checkQuickFix(ValidationType.RETENTION);
editResourceUtil.replaceInEditor("@Retention(RUNTIME)", "");
- checkQuickFix(CDIAnnotationsType.RETENTION, CDIWizardType.SCOPE);
+ checkQuickFix(ValidationType.RETENTION);
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/StereotypeValidationQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/StereotypeValidationQuickFixTest.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/test/StereotypeValidationQuickFixTest.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -12,9 +12,11 @@
package org.jboss.tools.cdi.bot.test.quickfix.test;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-import org.jboss.tools.cdi.bot.test.quickfix.base.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+import org.jboss.tools.cdi.bot.test.quickfix.QuickFixTestBase;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.StereotypeValidationProvider;
+import org.jboss.tools.cdi.bot.test.quickfix.validators.IValidationProvider;
import org.junit.Test;
/**
@@ -25,11 +27,17 @@
public class StereotypeValidationQuickFixTest extends QuickFixTestBase {
+ private static IValidationProvider validationProvider = new StereotypeValidationProvider();
+
@Override
public String getProjectName() {
return "CDIQuickFixStereotypeTest";
}
+ public IValidationProvider validationProvider() {
+ return validationProvider;
+ }
+
// https://issues.jboss.org/browse/JBIDE-7630
@Test
public void testTargetAnnotation() {
@@ -41,11 +49,11 @@
editResourceUtil.replaceInEditor("@Target({ TYPE, METHOD, FIELD })",
"@Target({ TYPE, FIELD })");
- checkQuickFix(CDIAnnotationsType.TARGET, CDIWizardType.STEREOTYPE);
+ checkQuickFix(ValidationType.TARGET);
editResourceUtil.replaceInEditor("@Target({TYPE, METHOD, FIELD})", "");
- checkQuickFix(CDIAnnotationsType.TARGET, CDIWizardType.STEREOTYPE);
+ checkQuickFix(ValidationType.TARGET);
}
// https://issues.jboss.org/browse/JBIDE-7631
@@ -58,11 +66,11 @@
editResourceUtil.replaceInEditor("@Retention(RUNTIME)", "@Retention(CLASS)");
- checkQuickFix(CDIAnnotationsType.RETENTION, CDIWizardType.STEREOTYPE);
+ checkQuickFix(ValidationType.RETENTION);
editResourceUtil.replaceInEditor("@Retention(RUNTIME)", "");
- checkQuickFix(CDIAnnotationsType.RETENTION, CDIWizardType.STEREOTYPE);
+ checkQuickFix(ValidationType.RETENTION);
}
@@ -77,7 +85,7 @@
editResourceUtil.replaceInEditor("StereotypeComponent", className);
- checkQuickFix(CDIAnnotationsType.NAMED, CDIWizardType.STEREOTYPE);
+ checkQuickFix(ValidationType.NAMED);
}
@@ -92,7 +100,7 @@
editResourceUtil.replaceInEditor("StereotypeComponent", className);
- checkQuickFix(CDIAnnotationsType.TYPED, CDIWizardType.STEREOTYPE);
+ checkQuickFix(ValidationType.TYPED);
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/AbstractValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/AbstractValidationProvider.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/AbstractValidationProvider.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -12,54 +12,72 @@
package org.jboss.tools.cdi.bot.test.quickfix.validators;
import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.Map;
+import java.util.List;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
+import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-public abstract class AbstractValidationProvider implements ValidationErrorProvider {
+public abstract class AbstractValidationProvider implements IValidationProvider {
- protected static Map<String, ArrayList<String>> validationErrors = null;
- protected static ArrayList<String> warningsForAnnotationType = null;
- protected static ArrayList<String> errorsForAnnotationType = null;
- protected static ArrayList<CDIAnnotationsType> warningsAnnotation = null;
- protected static ArrayList<CDIAnnotationsType> errorsAnnotation = null;
+ protected static List<ValidationProblem> problems = null;
- public AbstractValidationProvider() {
- validationErrors = new LinkedHashMap<String, ArrayList<String>>();
- warningsForAnnotationType = new ArrayList<String>();
- errorsForAnnotationType = new ArrayList<String>();
- warningsAnnotation = new ArrayList<CDIAnnotationsType>();
- errorsAnnotation = new ArrayList<CDIAnnotationsType>();
-
- validationErrors.put("Warnings", new ArrayList<String>());
- validationErrors.put("Errors", new ArrayList<String>());
-
+ public AbstractValidationProvider() {
+ problems = new ArrayList<ValidationProblem>();
init();
}
abstract void init();
- public Map<String, ArrayList<String>> getAllValidationErrors() {
- return validationErrors;
+ public List<String> getAllErrorsForAnnotationType(
+ ValidationType annotationType) {
+ List<String> messages = new ArrayList<String>();
+ for (ValidationProblem problem: problems) {
+ if (problem.getProblemType() == ProblemsType.ERRORS &&
+ problem.getValidationType() == annotationType) {
+ messages.add(problem.getMessage());
+ }
+ }
+ return messages;
}
- public ArrayList<String> getAllErrorsForAnnotationType(
- CDIAnnotationsType annotationType) {
- return errorsForAnnotationType;
+ public List<String> getAllWarningForAnnotationType(
+ ValidationType annotationType) {
+ List<String> messages = new ArrayList<String>();
+ for (ValidationProblem problem: problems) {
+ if (problem.getProblemType() == ProblemsType.WARNINGS &&
+ problem.getValidationType() == annotationType) {
+ messages.add(problem.getMessage());
+ }
+ }
+ return messages;
}
-
- public ArrayList<String> getAllWarningForAnnotationType(
- CDIAnnotationsType annotationType) {
- return warningsForAnnotationType;
+
+ public List<ValidationType> getAllWarningsAnnotation() {
+ List<ValidationType> annotations = new ArrayList<ValidationType>();
+ for (ValidationProblem problem: problems) {
+ if (problem.getProblemType() == ProblemsType.WARNINGS) {
+ annotations.add(problem.getValidationType());
+ }
+ }
+ return annotations;
}
-
- public ArrayList<CDIAnnotationsType> getAllWarningsAnnotation() {
- return warningsAnnotation;
+
+ public List<ValidationType> getAllErrorsAnnotation() {
+ List<ValidationType> annotations = new ArrayList<ValidationType>();
+ for (ValidationProblem problem: problems) {
+ if (problem.getProblemType() == ProblemsType.ERRORS) {
+ annotations.add(problem.getValidationType());
+ }
+ }
+ return annotations;
}
-
- public ArrayList<CDIAnnotationsType> getAllErrorsAnnotation() {
- return errorsAnnotation;
+
+ public List<ValidationType> getAllValidationProblemsType() {
+ List<ValidationType> annotations = new ArrayList<ValidationType>();
+ for (ValidationProblem problem: problems) {
+ annotations.add(problem.getValidationType());
+ }
+ return annotations;
}
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeanValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeanValidationProvider.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeanValidationProvider.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -11,10 +11,9 @@
package org.jboss.tools.cdi.bot.test.quickfix.validators;
-import java.util.ArrayList;
+import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
-
public class BeanValidationProvider extends AbstractValidationProvider {
public BeanValidationProvider() {
@@ -23,74 +22,39 @@
@Override
void init() {
- validationErrors.get("Warnings").add("which declares a passivating scope SessionScoped " +
- "must be passivation capable");
- validationErrors.get("Warnings").add("Multiple beans are eligible for injection to " +
- "the injection point");
- validationErrors.get("Warnings").add("No bean is eligible for injection to " +
- "the injection point");
- validationErrors.get("Errors").add("Bean constructor cannot have a parameter annotated " +
- "@Disposes");
- validationErrors.get("Errors").add("Bean constructor cannot have a parameter annotated " +
- "@Observes");
- validationErrors.get("Errors").add("Producer method has a parameter annotated @Disposes");
- validationErrors.get("Errors").add("Producer method has a parameter annotated @Observes");
- validationErrors.get("Errors").add("Disposer method cannot be annotated @Inject");
- validationErrors.get("Errors").add("Observer method cannot be annotated @Inject");
- validationErrors.get("Errors").add("Observer method has a parameter annotated @Disposes");
- validationErrors.get("Errors").add("Producer method or field cannot be annotated @Inject");
- warningsAnnotation.add(CDIAnnotationsType.SERIALIZABLE);
- warningsAnnotation.add(CDIAnnotationsType.INJECT);
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.SERIALIZABLE,
+ "which declares a passivating scope SessionScoped "));
- errorsAnnotation.add(CDIAnnotationsType.DISPOSES);
- errorsAnnotation.add(CDIAnnotationsType.OBSERVES);
- errorsAnnotation.add(CDIAnnotationsType.PRODUCES);
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.MULTIPLE_BEAN_ELIGIBLE,
+ "Multiple beans are eligible for injection to the injection point"));
+
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.NO_BEAN_ELIGIBLE,
+ "No bean is eligible for injection to the injection point"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.DISPOSES,
+ "Bean constructor cannot have a parameter annotated @Disposes"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.OBSERVES,
+ "Bean constructor cannot have a parameter annotated @Observes"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.DISPOSES,
+ "Producer method has a parameter annotated @Disposes"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.OBSERVES,
+ "Producer method has a parameter annotated @Observes"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.DISPOSES,
+ "Disposer method cannot be annotated @Inject"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.OBSERVES,
+ "Observer method cannot be annotated @Inject"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.OBSERVES,
+ "Observer method has a parameter annotated @Disposes"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.PRODUCES,
+ "Producer method or field cannot be annotated @Inject"));
}
- public ArrayList<String> getAllErrorsForAnnotationType(
- CDIAnnotationsType annotationType) {
- int errorIndex = 0;
- switch(annotationType) {
- case DISPOSES:
- errorIndex = 0;
- errorsForAnnotationType.add(validationErrors.get("Errors").get(errorIndex));
- errorIndex = 2;
- errorsForAnnotationType.add(validationErrors.get("Errors").get(errorIndex));
- errorIndex = 4;
- break;
- case OBSERVES:
- errorIndex = 1;
- errorsForAnnotationType.add(validationErrors.get("Errors").get(errorIndex));
- errorIndex = 3;
- errorsForAnnotationType.add(validationErrors.get("Errors").get(errorIndex));
- errorIndex = 5;
- errorsForAnnotationType.add(validationErrors.get("Errors").get(errorIndex));
- errorIndex = 6;
- break;
- case PRODUCES:
- errorIndex = 7;
- break;
- }
- errorsForAnnotationType.add(validationErrors.get("Errors").get(errorIndex));
- return errorsForAnnotationType;
- }
-
- public ArrayList<String> getAllWarningForAnnotationType(
- CDIAnnotationsType annotationType) {
- int warningIndex = 0;
- switch(annotationType) {
- case SERIALIZABLE:
- warningIndex = 0;
- break;
- case INJECT:
- warningIndex = 1;
- warningsForAnnotationType.add(validationErrors.get("Warnings").get(warningIndex));
- warningIndex = 2;
- break;
- }
- warningsForAnnotationType.add(validationErrors.get("Warnings").get(warningIndex));
- return warningsForAnnotationType;
- }
-
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeansXmlValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeansXmlValidationProvider.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/BeansXmlValidationProvider.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -11,11 +11,10 @@
package org.jboss.tools.cdi.bot.test.quickfix.validators;
-import java.util.ArrayList;
+import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
-
public class BeansXmlValidationProvider extends AbstractValidationProvider {
public BeansXmlValidationProvider() {
@@ -24,19 +23,19 @@
@Override
void init() {
- validationErrors.get("Errors").add("There is no class with the specified name");
- validationErrors.get("Errors").add("There is no annotation with the specified name");
- validationErrors.get("Errors").add("<class> element must specify the name of an " +
- "alternative bean class");
- validationErrors.get("Errors").add("<stereotype> element must specify the name of " +
- "an @Alternative stereotype annotation");
- errorsAnnotation.add(CDIAnnotationsType.INJECT);
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.NO_CLASS,
+ "There is no class with the specified name"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.NO_ANNOTATION,
+ "There is no annotation with the specified name"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.ALTERNATIVE_BEAN_XML,
+ "<class> element must specify the name of an alternative bean class"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.ALTERNATIVE_STEREOTYPE_BEAN_XML,
+ "<stereotype> element must specify the name of an @Alternative stereotype annotation"));
+
}
- public ArrayList<String> getAllErrorsForAnnotationType(
- CDIAnnotationsType annotationType) {
- return validationErrors.get("Errors");
- }
-
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/DecoratorValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/DecoratorValidationProvider.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/DecoratorValidationProvider.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -11,10 +11,9 @@
package org.jboss.tools.cdi.bot.test.quickfix.validators;
-import java.util.ArrayList;
+import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
-
public class DecoratorValidationProvider extends AbstractValidationProvider {
public DecoratorValidationProvider() {
@@ -23,61 +22,25 @@
@Override
void init() {
- validationErrors.get("Warnings").add("Decorator should not have a name");
- validationErrors.get("Warnings").add("Decorator should not be annotated " +
- "@Specializes");
- validationErrors.get("Errors").add("Producer cannot be declared in a " +
- "decorator");
- validationErrors.get("Errors").add("Decorator has a method annotated " +
- "@Disposes");
- validationErrors.get("Errors").add("Decorator cannot have a method with a " +
- "parameter annotated @Observes");
- validationErrors.get("Errors").add("Bean class of a session bean cannot be annotated " +
- "@Decorator");
- warningsAnnotation.add(CDIAnnotationsType.NAMED);
- warningsAnnotation.add(CDIAnnotationsType.SPECIALIZES);
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.NAMED,
+ "Decorator should not have a name"));
- errorsAnnotation.add(CDIAnnotationsType.PRODUCES);
- errorsAnnotation.add(CDIAnnotationsType.DISPOSES);
- errorsAnnotation.add(CDIAnnotationsType.OBSERVES);
- errorsAnnotation.add(CDIAnnotationsType.STATELESS);
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.SPECIALIZES,
+ "Decorator should not be annotated @Specializes"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.PRODUCES,
+ "Producer cannot be declared in a decorator"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.DISPOSES,
+ "Decorator has a method annotated @Disposes"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.OBSERVES,
+ "Decorator cannot have a method with a parameter annotated @Observes"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.STATELESS,
+ "Bean class of a session bean cannot be annotated @Decorator"));
+
}
- public ArrayList<String> getAllErrorsForAnnotationType(
- CDIAnnotationsType annotationType) {
- int errorIndex = 0;
- switch(annotationType) {
- case PRODUCES:
- errorIndex = 0;
- break;
- case DISPOSES:
- errorIndex = 1;
- break;
- case OBSERVES:
- errorIndex = 2;
- break;
- case STATELESS:
- errorIndex = 3;
- break;
- }
- errorsForAnnotationType.add(validationErrors.get("Errors").get(errorIndex));
- return errorsForAnnotationType;
- }
-
- public ArrayList<String> getAllWarningForAnnotationType(
- CDIAnnotationsType annotationType) {
- int warningIndex = 0;
- switch(annotationType) {
- case NAMED:
- warningIndex = 0;
- break;
- case SPECIALIZES:
- warningIndex = 1;
- break;
- }
- warningsForAnnotationType.add(validationErrors.get("Warnings").get(warningIndex));
- return warningsForAnnotationType;
- }
-
}
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/IValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/IValidationProvider.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/IValidationProvider.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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.quickfix.validators;
+
+import java.util.List;
+
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+
+public interface IValidationProvider {
+
+ /**
+ * Method gets all validation problems type for component
+ *
+ * @param annotationType
+ * @return
+ */
+ List<ValidationType> getAllValidationProblemsType();
+
+ /**
+ * Method gets all validation errors showed in Problems View as warnings
+ * according to entered annotation
+ *
+ * @param annotationType
+ * @return
+ */
+ List<String> getAllWarningForAnnotationType(ValidationType annotationType);
+
+ /**
+ * Method gets all validation errors showed in Problems View as errors
+ * according to entered annotation
+ *
+ * @param annotationType
+ * @return
+ */
+ List<String> getAllErrorsForAnnotationType(ValidationType annotationType);
+
+ /**
+ * Method gets all annotations for which exist validation errors showed in Problems View
+ * marked as warning
+ *
+ * @return
+ */
+ List<ValidationType> getAllWarningsAnnotation();
+
+ /**
+ * Method gets all annotations for which exist validation errors showed in Problems View
+ * marked as errors
+ *
+ * @return
+ */
+ List<ValidationType> getAllErrorsAnnotation();
+
+}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorBindingValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorBindingValidationProvider.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorBindingValidationProvider.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -11,10 +11,9 @@
package org.jboss.tools.cdi.bot.test.quickfix.validators;
-import java.util.ArrayList;
+import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
-
public class InterceptorBindingValidationProvider extends AbstractValidationProvider {
public InterceptorBindingValidationProvider() {
@@ -23,17 +22,13 @@
@Override
void init() {
- validationErrors.get("Warnings").add("Annotation-valued member of an interceptor " +
- "binding type should be annotated @Nonbinding");
- validationErrors.get("Warnings").add("Array-valued member of an interceptor " +
- "binding type must be annotated @Nonbinding");
- warningsAnnotation.add(CDIAnnotationsType.NONBINDING);
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.NONBINDING,
+ "Annotation-valued member of an interceptor binding type should be annotated @Nonbinding"));
+
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.NONBINDING,
+ "Array-valued member of an interceptor binding type must be annotated @Nonbinding"));
+
}
- public ArrayList<String> getAllWarningForAnnotationType(
- CDIAnnotationsType annotationType) {
- return validationErrors.get("Warnings");
- }
-
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorValidationProvider.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/InterceptorValidationProvider.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -11,10 +11,9 @@
package org.jboss.tools.cdi.bot.test.quickfix.validators;
-import java.util.ArrayList;
+import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
-
public class InterceptorValidationProvider extends AbstractValidationProvider {
public InterceptorValidationProvider() {
@@ -23,62 +22,26 @@
@Override
void init() {
- validationErrors.get("Warnings").add("Interceptor should not have a name");
- validationErrors.get("Warnings").add("Interceptor should not be annotated " +
- "@Specializes");
- validationErrors.get("Errors").add("Producer cannot be declared in an " +
- "interceptor");
- validationErrors.get("Errors").add("Interceptor has a method annotated " +
- "@Disposes");
- validationErrors.get("Errors").add("Interceptor cannot have a method with a " +
- "parameter annotated @Observes");
- validationErrors.get("Errors").add("Bean class of a session bean cannot be annotated " +
- "@Interceptor");
- warningsAnnotation.add(CDIAnnotationsType.NAMED);
- warningsAnnotation.add(CDIAnnotationsType.SPECIALIZES);
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.NAMED,
+ "Interceptor should not have a name"));
- errorsAnnotation.add(CDIAnnotationsType.PRODUCES);
- errorsAnnotation.add(CDIAnnotationsType.DISPOSES);
- errorsAnnotation.add(CDIAnnotationsType.OBSERVES);
- errorsAnnotation.add(CDIAnnotationsType.STATELESS);
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.SPECIALIZES,
+ "Interceptor should not be annotated @Specializes"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.PRODUCES,
+ "Producer cannot be declared in an interceptor"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.DISPOSES,
+ "Interceptor has a method annotated @Disposes"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.OBSERVES,
+ "Interceptor cannot have a method with a parameter annotated @Observes"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.STATELESS,
+ "Bean class of a session bean cannot be annotated @Interceptor"));
+
}
- public ArrayList<String> getAllErrorsForAnnotationType(
- CDIAnnotationsType annotationType) {
- int errorIndex = 0;
- switch(annotationType) {
- case PRODUCES:
- errorIndex = 0;
- break;
- case DISPOSES:
- errorIndex = 1;
- break;
- case OBSERVES:
- errorIndex = 2;
- break;
- case STATELESS:
- errorIndex = 3;
- break;
- }
- errorsForAnnotationType.add(validationErrors.get("Errors").get(errorIndex));
- return errorsForAnnotationType;
- }
-
- public ArrayList<String> getAllWarningForAnnotationType(
- CDIAnnotationsType annotationType) {
- int warningIndex = 0;
- switch(annotationType) {
- case NAMED:
- warningIndex = 0;
- break;
- case SPECIALIZES:
- warningIndex = 1;
- break;
- }
- warningsForAnnotationType.add(validationErrors.get("Warnings").get(warningIndex));
- return warningsForAnnotationType;
- }
-
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/QualifierValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/QualifierValidationProvider.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/QualifierValidationProvider.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -11,10 +11,9 @@
package org.jboss.tools.cdi.bot.test.quickfix.validators;
-import java.util.ArrayList;
+import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
-
public class QualifierValidationProvider extends AbstractValidationProvider {
public QualifierValidationProvider() {
@@ -23,23 +22,19 @@
@Override
void init() {
- validationErrors.get("Warnings").add("Qualifier annotation type must be annotated " +
- "with @Retention(RUNTIME)");
- validationErrors.get("Warnings").add("Qualifier annotation type must be annotated with " +
- "@Target");
- validationErrors.get("Warnings").add("Annotation-valued member of a qualifier type " +
- "should be annotated @Nonbinding");
- validationErrors.get("Warnings").add("Array-valued member of a qualifier type " +
- "should be annotated @Nonbinding");
- warningsAnnotation.add(CDIAnnotationsType.RETENTION);
- warningsAnnotation.add(CDIAnnotationsType.TARGET);
- warningsAnnotation.add(CDIAnnotationsType.NONBINDING);
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.RETENTION,
+ "Qualifier annotation type must be annotated with @Retention(RUNTIME)"));
+
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.TARGET,
+ "Qualifier annotation type must be annotated with @Target"));
+
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.NONBINDING,
+ "Annotation-valued member of a qualifier type should be annotated @Nonbinding"));
+
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.NONBINDING,
+ "Array-valued member of a qualifier type should be annotated @Nonbinding"));
+
}
- public ArrayList<String> getAllWarningForAnnotationType(
- CDIAnnotationsType annotationType) {
- return validationErrors.get("Warnings");
- }
-
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ScopeValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ScopeValidationProvider.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ScopeValidationProvider.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -11,10 +11,9 @@
package org.jboss.tools.cdi.bot.test.quickfix.validators;
-import java.util.ArrayList;
+import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
-
public class ScopeValidationProvider extends AbstractValidationProvider {
public ScopeValidationProvider() {
@@ -23,18 +22,13 @@
@Override
void init() {
- validationErrors.get("Warnings").add("Scope annotation type must be annotated " +
- "with @Retention(RUNTIME)");
- validationErrors.get("Warnings").add("Scope annotation type must be annotated with " +
- "@Target");
- warningsAnnotation.add(CDIAnnotationsType.RETENTION);
- warningsAnnotation.add(CDIAnnotationsType.TARGET);
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.RETENTION,
+ "Scope annotation type must be annotated with @Retention(RUNTIME)"));
+
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.TARGET,
+ "Scope annotation type must be annotated with @Target"));
+
}
- public ArrayList<String> getAllWarningForAnnotationType(
- CDIAnnotationsType annotationType) {
- return validationErrors.get("Warnings");
- }
-
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/StereotypeValidationProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/StereotypeValidationProvider.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/StereotypeValidationProvider.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -11,10 +11,9 @@
package org.jboss.tools.cdi.bot.test.quickfix.validators;
-import java.util.ArrayList;
+import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
-
public class StereotypeValidationProvider extends AbstractValidationProvider {
public StereotypeValidationProvider() {
@@ -23,47 +22,19 @@
@Override
void init() {
- validationErrors.get("Warnings").add("Stereotype annotation type must be annotated with one of");
- validationErrors.get("Warnings").add("Stereotype annotation type must be annotated " +
- "with @Retention(RUNTIME)");
- validationErrors.get("Warnings").add("A stereotype should not be annotated @Typed");
- validationErrors.get("Errors").add("Stereotype declares a non-empty @Named annotation");
- warningsAnnotation.add(CDIAnnotationsType.TARGET);
- warningsAnnotation.add(CDIAnnotationsType.RETENTION);
- warningsAnnotation.add(CDIAnnotationsType.TYPED);
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.TARGET,
+ "Stereotype annotation type must be annotated with one of"));
- errorsAnnotation.add(CDIAnnotationsType.NAMED);
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.RETENTION,
+ "Stereotype annotation type must be annotated with @Retention(RUNTIME)"));
+
+ problems.add(new ValidationProblem(ProblemsType.WARNINGS, ValidationType.TYPED,
+ "A stereotype should not be annotated @Typed"));
+
+ problems.add(new ValidationProblem(ProblemsType.ERRORS, ValidationType.NAMED,
+ "Stereotype declares a non-empty @Named annotation"));
+
}
-
- public ArrayList<String> getAllErrorsForAnnotationType(
- CDIAnnotationsType annotationType) {
- int errorIndex = 0;
- switch (annotationType) {
- case NAMED:
- errorIndex = 0;
- break;
- }
- errorsForAnnotationType.add(validationErrors.get("Errors").get(errorIndex));
- return errorsForAnnotationType;
- }
-
- public ArrayList<String> getAllWarningForAnnotationType(
- CDIAnnotationsType annotationType) {
- int warningIndex = 0;
- switch(annotationType) {
- case TARGET:
- warningIndex = 0;
- break;
- case RETENTION:
- warningIndex = 1;
- break;
- case TYPED:
- warningIndex = 2;
- break;
- }
- warningsForAnnotationType.add(validationErrors.get("Warnings").get(warningIndex));
- return warningsForAnnotationType;
- }
}
Deleted: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ValidationErrorProvider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ValidationErrorProvider.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ValidationErrorProvider.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -1,61 +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.quickfix.validators;
-
-import org.jboss.tools.cdi.bot.test.annotations.CDIAnnotationsType;
-
-import java.util.ArrayList;
-import java.util.Map;
-
-public interface ValidationErrorProvider {
-
- /**
- * Method gets all validation errors showed in Problems View for actual component
- * @return
- */
- Map<String, ArrayList<String>> getAllValidationErrors();
-
- /**
- * Method gets all validation errors showed in Problems View as warnings
- * according to entered annotation
- *
- * @param annotationType
- * @return
- */
- ArrayList<String> getAllWarningForAnnotationType(CDIAnnotationsType annotationType);
-
- /**
- * Method gets all validation errors showed in Problems View as errors
- * according to entered annotation
- *
- * @param annotationType
- * @return
- */
- ArrayList<String> getAllErrorsForAnnotationType(CDIAnnotationsType annotationType);
-
- /**
- * Method gets all annotations for which exist validation errors showed in Problems View
- * marked as warning
- *
- * @return
- */
- ArrayList<CDIAnnotationsType> getAllWarningsAnnotation();
-
- /**
- * Method gets all annotations for which exist validation errors showed in Problems View
- * marked as errors
- *
- * @return
- */
- ArrayList<CDIAnnotationsType> getAllErrorsAnnotation();
-
-}
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ValidationProblem.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ValidationProblem.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/validators/ValidationProblem.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.quickfix.validators;
+
+import org.jboss.tools.cdi.bot.test.annotations.ProblemsType;
+import org.jboss.tools.cdi.bot.test.annotations.ValidationType;
+
+public class ValidationProblem {
+
+ private ProblemsType problemType;
+
+ private ValidationType validationType;
+
+ private String message;
+
+ public ValidationProblem(ProblemsType problemType, ValidationType validationType, String message) {
+ this.problemType = problemType;
+ this.validationType = validationType;
+ this.message = message;
+ }
+
+ public ProblemsType getProblemType() {
+ return problemType;
+ }
+
+ public ValidationType getValidationType() {
+ return validationType;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/BeansXMLValidationHelper.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -48,24 +48,9 @@
*/
public boolean checkValidationErrorInBeansXML(String projectName,
BeansXMLValidationErrors validationError) {
- SWTBotTreeItem[] validationErrors = getBeansXMLValidationErrors(projectName);
- String error = null;
- switch (validationError) {
- case NO_SUCH_CLASS:
- error = "There is no class with the specified name";
- break;
- case ALTERNATIVE:
- error = "must specify the name of an alternative bean class";
- break;
- case DECORATOR:
- error = "must specify the name of a decorator bean class";
- break;
- case INTERCEPTOR:
- error = "must specify the name of an interceptor class";
- break;
- }
+ SWTBotTreeItem[] validationErrors = getBeansXMLValidationErrors(projectName);
return ((validationErrors.length == 1) &&
- (validationErrors[0].getText().contains(error)));
+ (validationErrors[0].getText().contains(validationError.message())));
}
/**
@@ -123,7 +108,7 @@
*/
public SWTBotTreeItem[] getBeansXMLValidationErrors(String projectName) {
return ProblemsView.getFilteredErrorsTreeItems(bot, null, "/"
- + projectName + "/WebContent/WEB-INF", "beans.xml", "CDI Problem");
+ + projectName, "beans.xml", "CDI Problem");
}
/**
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/DynamicWebProjectWizard.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/DynamicWebProjectWizard.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/DynamicWebProjectWizard.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -20,10 +20,12 @@
public class DynamicWebProjectWizard extends Wizard {
- private static final String PROJECT_NAME = "Project name:";
- private static final String CDI_PRESET = "Dynamic Web Project " +
+ private final String PROJECT_NAME = "Project name:";
+ private final String CDI_PRESET = "Dynamic Web Project " +
"with CDI (Context and Dependency Injection)";
- private static final String CDI_FACET = "CDI (Contexts and Dependency Injection)";
+ private final String CDI_FACET = "CDI (Contexts and Dependency Injection)";
+ private final String CONFIGURATION = "Configuration";
+ private final String PROJECT_FACETS = "Project Facets";
public DynamicWebProjectWizard() {
super(new SWTBot().activeShell().widget);
@@ -36,7 +38,7 @@
}
public DynamicWebProjectWizard setCDIPreset() {
- bot().comboBoxInGroup("Configuration", 0).
+ bot().comboBoxInGroup(CONFIGURATION, 0).
setSelection(CDI_PRESET);
return this;
}
@@ -49,7 +51,7 @@
}
private void setCDIFacetInFacets(SWTBot bot) {
- assertTrue(bot.activeShell().getText().equals("Project Facets"));
+ assertTrue(bot.activeShell().getText().equals(PROJECT_FACETS));
SWTBot facetsBot = bot.activeShell().bot();
SWTBotTree tree= facetsBot.tree();
for (SWTBotTreeItem ti: tree.getAllItems()) {
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/WizardTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/WizardTest.java 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/wizard/WizardTest.java 2012-01-16 13:48:45 UTC (rev 37861)
@@ -34,7 +34,7 @@
public class WizardTest extends CDITestBase {
public String getProjectName() {
- return "CDIwizardExtTest";
+ return "CDIWizardTest";
}
@Override
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/todo.txt
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/todo.txt 2012-01-16 11:59:04 UTC (rev 37860)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/todo.txt 2012-01-16 13:48:45 UTC (rev 37861)
@@ -2,13 +2,8 @@
what tests have to be done(JBDS50_0010):
* Validations works good for Inconsistent specialization,
Ambiguous EL names, Unproxyable bean types, Decorator resolution
- * Quick fixes for problem markers in beans.xml(https://issues.jboss.org/browse/JBIDE-9833)
- * CDI @Named beans are renamed via refactoring and shows up correctly
- when using Find References for EL Expressions
* Create new decorator from existing Web Bean
- * EL refactoring for @Named beans works
-
what tests have to be done(JBDS50_0015):
* OpenOn works for injected classes
* OpenOn works in Seam Config for given beans
12 years, 12 months
JBoss Tools SVN: r37860 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2012-01-16 06:59:04 -0500 (Mon, 16 Jan 2012)
New Revision: 37860
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ComboContribution.java
Log:
https://issues.jboss.org/browse/JBIDE-10508
Removed hack for the old swt versions problem on mac
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ComboContribution.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ComboContribution.java 2012-01-16 11:26:04 UTC (rev 37859)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ComboContribution.java 2012-01-16 11:59:04 UTC (rev 37860)
@@ -53,13 +53,8 @@
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.widthHint = getComboWidth();
- gd.verticalAlignment = GridData.VERTICAL_ALIGN_FILL;
- gd.horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL;
- if(Platform.getOS().equals(Platform.OS_MACOSX)) gd.verticalIndent=-9;
comboControl.setLayoutData( gd );
-
-
if(getSelectionAdapter()!=null) {
comboControl.addSelectionListener( getSelectionAdapter() );
}
12 years, 12 months
JBoss Tools SVN: r37859 - trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-01-16 06:26:04 -0500 (Mon, 16 Jan 2012)
New Revision: 37859
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/ValidationType.java
Log:
Enum for all CDI validation type added
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/ValidationType.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/ValidationType.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/annotations/ValidationType.java 2012-01-16 11:26:04 UTC (rev 37859)
@@ -0,0 +1,9 @@
+package org.jboss.tools.cdi.bot.test.annotations;
+
+public enum ValidationType {
+
+ SERIALIZABLE, MULTIPLE_BEAN_ELIGIBLE, NO_BEAN_ELIGIBLE, DISPOSES, OBSERVES,
+ PRODUCES, TARGET, RETENTION, TYPED, NAMED, NONBINDING, SPECIALIZES, STATELESS,
+ NO_CLASS, NO_ANNOTATION, ALTERNATIVE_BEAN_XML, ALTERNATIVE_STEREOTYPE_BEAN_XML
+
+}
12 years, 12 months
JBoss Tools SVN: r37858 - in trunk/examples/plugins: org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-01-16 05:04:14 -0500 (Mon, 16 Jan 2012)
New Revision: 37858
Modified:
trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.xml
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java
Log:
JBIDE-10629 : Add a new "tag" attribute to Project Examples xml descriptors
Modified: trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.xml
===================================================================
--- trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.xml 2012-01-16 10:03:51 UTC (rev 37857)
+++ trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.xml 2012-01-16 10:04:14 UTC (rev 37858)
@@ -33,8 +33,7 @@
<extension
point="org.jboss.tools.project.examples.projectExamplesXml"
name="%JBoss_Tools_33_Community_Maven_Examples">
- <!-- TODO : rename to project-examples-maven-3.3.xml once M5 is out the door -->
- <url>http://download.jboss.org/jbosstools/examples/project-examples-maven-3.3....</url>
+ <url>http://download.jboss.org/jbosstools/examples/project-examples-maven-3.3.xml</url>
<experimental>false</experimental>
</extension>
</plugin>
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java 2012-01-16 10:03:51 UTC (rev 37857)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java 2012-01-16 10:04:14 UTC (rev 37858)
@@ -14,7 +14,9 @@
import java.math.BigDecimal;
import java.net.URL;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
@@ -45,6 +47,7 @@
private File file;
private IProjectExampleSite site;
private String defaultProfiles =""; //$NON-NLS-1$
+ private Set<String> tags;
public Project() {
name=""; //$NON-NLS-1$
@@ -265,4 +268,16 @@
public String toString() {
return getName();
}
+
+ public void setTags(Set<String> tags) {
+ this.tags = tags;
+ }
+
+ public Set<String> setTags() {
+ if (tags == null) {
+ tags = new HashSet<String>();
+ }
+ return tags;
+ }
+
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java 2012-01-16 10:03:51 UTC (rev 37857)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java 2012-01-16 10:04:14 UTC (rev 37858)
@@ -353,6 +353,9 @@
else if (nodeName.equals("mavenArchetype")) { //$NON-NLS-1$
parseMavenArchetype(project, child);
}
+ else if (nodeName.equals("tags")) { //$NON-NLS-1$
+ parseTags(project, child);
+ }
}
}
}
@@ -365,7 +368,22 @@
return list;
}
- private static void parseFixes(Project project, Element node) {
+ private static void parseTags(Project project, Element tagElement) {
+ String tagsValue = tagElement.getTextContent();
+ if (tagsValue != null) {
+ StringTokenizer tokenizer = new StringTokenizer(tagsValue.trim(), ",");//$NON-NLS-1$
+ Set<String> tags = new HashSet<String>();
+ while (tokenizer.hasMoreTokens()) {
+ String tag = tokenizer.nextToken().trim();
+ if (tag.length() > 0) {
+ tags.add(tag);
+ }
+ }
+ project.setTags(tags);
+ }
+ }
+
+ private static void parseFixes(Project project, Element node) {
NodeList children = node.getChildNodes();
int cLen = children.getLength();
for (int i = 0; i < cLen; i++) {
@@ -392,28 +410,28 @@
if (nodeName.equals("archetypeGroupId")) { //$NON-NLS-1$
archetypeModel.setArchetypeGroupId(getContent(child));
}
- if (nodeName.equals("archetypeArtifactId")) { //$NON-NLS-1$
+ else if (nodeName.equals("archetypeArtifactId")) { //$NON-NLS-1$
archetypeModel.setArchetypeArtifactId(getContent(child));
}
- if (nodeName.equals("archetypeVersion")) { //$NON-NLS-1$
+ else if (nodeName.equals("archetypeVersion")) { //$NON-NLS-1$
archetypeModel.setArchetypeVersion(getContent(child));
}
- if (nodeName.equals("archetypeRepository")) { //$NON-NLS-1$
+ else if (nodeName.equals("archetypeRepository")) { //$NON-NLS-1$
archetypeModel.setArchetypeRepository(getContent(child));
}
- if (nodeName.equals("groupId")) { //$NON-NLS-1$
+ else if (nodeName.equals("groupId")) { //$NON-NLS-1$
archetypeModel.setGroupId(getContent(child));
}
- if (nodeName.equals("artifactId")) { //$NON-NLS-1$
+ else if (nodeName.equals("artifactId")) { //$NON-NLS-1$
archetypeModel.setArtifactId(getContent(child));
}
- if (nodeName.equals("version")) { //$NON-NLS-1$
+ else if (nodeName.equals("version")) { //$NON-NLS-1$
archetypeModel.setVersion(getContent(child));
}
- if (nodeName.equals("javaPackage")) { //$NON-NLS-1$
+ else if (nodeName.equals("javaPackage")) { //$NON-NLS-1$
archetypeModel.setJavaPackage(getContent(child));
}
- if (nodeName.equals("properties")) { //$NON-NLS-1$
+ else if (nodeName.equals("properties")) { //$NON-NLS-1$
parseProperties(project, child);
}
}
12 years, 12 months
JBoss Tools SVN: r37857 - trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/commands.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2012-01-16 05:03:51 -0500 (Mon, 16 Jan 2012)
New Revision: 37857
Modified:
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/commands/ForgeCommandListHandler.java
Log:
JBIDE-10358: Cmd+4 asks to start another forge if forge console is not open in the perspective
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/commands/ForgeCommandListHandler.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/commands/ForgeCommandListHandler.java 2012-01-16 10:02:59 UTC (rev 37856)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/commands/ForgeCommandListHandler.java 2012-01-16 10:03:51 UTC (rev 37857)
@@ -42,10 +42,15 @@
}
private ForgeRuntime getForgeRuntime(IWorkbenchWindow window) {
- IViewPart part = window.getActivePage().findView(ForgeView.ID);
- if (part != null && part instanceof ForgeView) {
- return ((ForgeView)part).getRuntime();
- } else {
+ try {
+ IViewPart part = window.getActivePage().showView(ForgeView.ID);
+ if (part != null && part instanceof ForgeView) {
+ return ((ForgeView)part).getRuntime();
+ } else {
+ return null;
+ }
+ } catch (PartInitException e) {
+ ForgeUIPlugin.log(e);
return null;
}
}
12 years, 12 months
JBoss Tools SVN: r37856 - trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/fixes.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-01-16 05:02:59 -0500 (Mon, 16 Jan 2012)
New Revision: 37856
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/fixes/WTPRuntimeFix.java
Log:
Use else-if when appropriate
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/fixes/WTPRuntimeFix.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/fixes/WTPRuntimeFix.java 2012-01-16 09:56:38 UTC (rev 37855)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/fixes/WTPRuntimeFix.java 2012-01-16 10:02:59 UTC (rev 37856)
@@ -271,17 +271,17 @@
return null;
}
}
- if (ESB.equals(component)) {
+ else if (ESB.equals(component)) {
if (!isEsbPresent(location, runtime)) {
return null;
}
}
- if (BPEL.equals(component)) {
+ else if (BPEL.equals(component)) {
if (!isBpelPresent(location, runtime)) {
return null;
}
}
- if (TEIID.equals(component)) {
+ else if (TEIID.equals(component)) {
if (!isTeiidPresent(location, runtime)) {
return null;
}
12 years, 12 months
JBoss Tools SVN: r37855 - trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2012-01-16 04:56:38 -0500 (Mon, 16 Jan 2012)
New Revision: 37855
Modified:
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/ForgeView.java
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/SelectionSynchronizer.java
Log:
JBIDE-10359: show in Forge console does not offer to start forge
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/ForgeView.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/ForgeView.java 2012-01-16 09:46:22 UTC (rev 37854)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/ForgeView.java 2012-01-16 09:56:38 UTC (rev 37855)
@@ -10,6 +10,7 @@
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
@@ -267,11 +268,39 @@
return false;
}
if (runtime != null && ForgeRuntime.STATE_RUNNING.equals(runtime.getState())) {
- return goToSelection(context.getSelection());
+ return goToSelection(context.getSelection());
+ } else {
+ return startForgeIsOK(context);
}
- return false;
}
+ private boolean startForgeIsOK(final ShowInContext context) {
+ boolean start = MessageDialog.open(
+ MessageDialog.QUESTION,
+ null,
+ "Forge Not Running",
+ "Forge is not running. Do you want to start the Forge runtime?",
+ SWT.NONE);
+ if (start) {
+ startForge();
+ Thread waitThread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ while (runtime != null && !ForgeRuntime.STATE_RUNNING.equals(runtime.getState())) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ ForgeUIPlugin.log(e);
+ }
+ }
+ goToSelection(context.getSelection());
+ }
+ });
+ waitThread.start();
+ }
+ return start;
+ }
+
public boolean goToSelection(ISelection sel) {
if (sel instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection)sel;
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/SelectionSynchronizer.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/SelectionSynchronizer.java 2012-01-16 09:46:22 UTC (rev 37854)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/SelectionSynchronizer.java 2012-01-16 09:56:38 UTC (rev 37855)
@@ -8,7 +8,6 @@
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IPartService;
import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.ISelectionService;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.jboss.tools.forge.core.process.ForgeRuntime;
@@ -17,29 +16,19 @@
public class SelectionSynchronizer implements ISelectionListener {
private ForgeView forgeView;
- private ISelectionService selectionService;
private IEditorPart selectedPart;
private IPartService partService;
private IPartListener partListener = new IPartListener() {
@Override
- public void partOpened(IWorkbenchPart part) {
- // TODO Auto-generated method stub
-
- }
+ public void partOpened(IWorkbenchPart part) {}
@Override
- public void partDeactivated(IWorkbenchPart part) {
- // TODO Auto-generated method stub
-
- }
+ public void partDeactivated(IWorkbenchPart part) {}
@Override
- public void partClosed(IWorkbenchPart part) {
- // TODO Auto-generated method stub
-
- }
+ public void partClosed(IWorkbenchPart part) {}
@Override
public void partBroughtToTop(IWorkbenchPart part) {
@@ -69,17 +58,13 @@
public SelectionSynchronizer(ForgeView forgeView) {
this.forgeView = forgeView;
IWorkbenchWindow workbenchWindow = forgeView.getSite().getWorkbenchWindow();
- selectionService =
- forgeView.getSite().getWorkbenchWindow().getSelectionService();
partService = workbenchWindow.getPartService();
}
public void setEnabled(boolean enabled) {
if (enabled) {
-// selectionService.addSelectionListener(this);
partService.addPartListener(partListener);
} else {
-// selectionService.removeSelectionListener(this);
partService.removePartListener(partListener);
}
}
12 years, 12 months
JBoss Tools SVN: r37854 - trunk/download.jboss.org/jbosstools/examples.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-01-16 04:46:22 -0500 (Mon, 16 Jan 2012)
New Revision: 37854
Modified:
trunk/download.jboss.org/jbosstools/examples/project-examples-maven-3.3.xml
Log:
JBIDE-10629 : Add a new "tag" attribute to Project Examples xml descriptors
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 2012-01-16 09:23:27 UTC (rev 37853)
+++ trunk/download.jboss.org/jbosstools/examples/project-examples-maven-3.3.xml 2012-01-16 09:46:22 UTC (rev 37854)
@@ -35,6 +35,7 @@
</properties>
-->
</mavenArchetype>
+ <tags>central</tags>
</project>
<project>
@@ -76,6 +77,7 @@
<importType>maven</importType>
<importTypeDescription>The project example requires the m2eclipse, m2eclipse-wtp and JBoss Maven Project Examples feature.</importTypeDescription>
<welcome type="cheatsheets" url="/jboss-as-helloworld/cheatsheets/helloworld.xml"/>
+ <tags>central</tags>
</project>
<project>
@@ -120,6 +122,7 @@
</fixes>
<importType>maven</importType>
<importTypeDescription>The project example requires the m2eclipse, m2eclipse-wtp and JBoss Maven Project Examples feature.</importTypeDescription>
+ <tags>central</tags>
</project>
@@ -162,6 +165,7 @@
<importType>maven</importType>
<importTypeDescription>The project example requires the m2eclipse, m2eclipse-wtp and JBoss Maven Project Examples feature.</importTypeDescription>
<welcome type="cheatsheets" url="/jboss-as-login/cheatsheets/login.xml"/>
+ <tags>central</tags>
</project>
<project>
@@ -203,6 +207,7 @@
<importType>maven</importType>
<importTypeDescription>The project example requires the m2eclipse, m2eclipse-wtp and JBoss Maven Project Examples feature.</importTypeDescription>
<welcome type="cheatsheets" url="/jboss-as-numberguess/cheatsheets/numberguess.xml"/>
+ <tags>central</tags>
</project>
<project>
@@ -245,20 +250,17 @@
<importType>maven</importType>
<importTypeDescription>The project example requires the m2eclipse, m2eclipse-wtp and JBoss Maven Project Examples feature.</importTypeDescription>
<welcome type="cheatsheets" url="/jboss-as-kitchensink/cheatsheets/kitchensink.xml"/>
+ <tags>central</tags>
</project>
-
<project>
- <category>Java EE 6 Quickstarts</category>
- <name>jboss-javaee6-webapp</name>
- <included-projects>jboss-javaee6-webapp</included-projects>
- <shortDescription>Java EE 6 example (Maven archetype)</shortDescription>
- <description>
-This is your project! It's a sample, deployable Maven 3 project to help you get your foot in the door developing with Java EE 6 on JBoss AS 7.
-This project is setup to allow you to create a compliant Java EE 6 application using JSF 2.0, CDI 1.0, EJB 3.1, JPA 2.0 and Bean Validation 1.0.
-It includes a persistence unit and some sample persistence and transaction code to help you get your feet wet with database access in enterprise Java.
- </description>
- <size>8192</size>
- <url/>
+ <category>JBoss AS 7 Quickstarts</category>
+ <name>poh5-helloworld</name>
+ <included-projects>poh5-helloworld</included-projects>
+ <shortDescription>HTML5 Example for mobile devices</shortDescription>
+ <description>This example demonstrates the use of *CDI 1.0* and *JAX-RS* in *JBoss AS 7* using the Plain Old HTML5 (POH5) architecture.
+POH5 is basically a smart, HTML5+CSS3+JavaScript front-end using RESTful services on the backend.</description>
+ <size>7266</size>
+ <url>http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/jbossas7-examp...</url>
<fixes>
<fix type="wtpruntime">
<property name="allowed-types">org.jboss.ide.eclipse.as.runtime.70, org.jboss.ide.eclipse.as.runtime.71</property>
@@ -273,7 +275,7 @@
</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="versions">[0.13.1,0.16.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>
@@ -281,214 +283,15 @@
<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,org.jboss.tools.maven.hibernate.feature,org.jboss.tools.maven.jaxrs.feature,org.jboss.tools.maven.portlet.feature,org.jboss.tools.maven.seam.feature</property>
+ <property name="connectorIds">org.jboss.tools.maven.feature,org.jboss.tools.maven.cdi.feature,org.jboss.tools.maven.hibernate.feature,org.jboss.tools.maven.jaxrs.feature, org.jboss.tools.maven.portlet.feature,org.jboss.tools.maven.seam.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-webapp</archetypeArtifactId>
- <archetypeVersion>7.0.2-SNAPSHOT</archetypeVersion>
- <archetypeRepository>http://anonsvn.jboss.org/repos/jbosstools/workspace/fred/repositories/sna...</archetypeRepository>
- <groupId>org.jboss.tools.examples</groupId>
- <artifactId>jboss-javaee6-webapp</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <javaPackage>org.jboss.tools.examples</javaPackage>
- <properties>
- <property name="name" value="Java EE 6 webapp project"/>
- </properties>
- </mavenArchetype>
+ <importType>maven</importType>
+ <importTypeDescription>The project example requires the m2eclipse, m2eclipse-wtp and JBoss Maven Project Examples feature.</importTypeDescription>
+ <!-- no cheatsheet yet
+ <welcome type="cheatsheets" url="/poh5-helloworld/cheatsheets/poh5-helloworld.xml"/>
+ -->
+ <tags>central, poh5</tags>
</project>
- <!-- Temporary EE6 project - replace with Pete's new archetype when it's ready -->
- <project>
- <category>Java EE 6 Quickstarts</category>
- <name>multi-javaee6-archetype</name>
- <included-projects>multi-javaee6-archetype</included-projects>
- <shortDescription>JBoss AS 7 / Java EE 6 EAR Webapp(Maven archetype)</shortDescription>
- <description>An archetype that generates a starter Java EE 6 webapp project for JBoss AS 7 / EAP 6. The project is an EAR, with an EJB-JAR and WAR</description>
- <size>13806</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-ear-webapp</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>multi</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <javaPackage></javaPackage>
- </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 HTML5 Mobile Webapp (Maven archetype)</shortDescription>
- <description>An archetype that generates a Java EE 6 HTML5 Mobile 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>
- <defaultMavenProfiles>arq-jbossas-remote</defaultMavenProfiles>
- <mavenArchetype>
- <archetypeGroupId>org.jboss.spec.archetypes</archetypeGroupId>
- <archetypeArtifactId>jboss-javaee6-html5-mobile-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>html5-webapp</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <javaPackage>org.jboss.tools.example.html5</javaPackage>
- </mavenArchetype>
- </project>
- <!-- Temporary Spring MVC project - replace with Marius' new archetype when it's ready -->
- <project>
- <category>Java EE 6 Quickstarts</category>
- <name>spring-mvc-webapp</name>
- <included-projects>spring-mvc-webapp</included-projects>
- <shortDescription>Java EE 6 - Spring MVC Application (Maven archetype)</shortDescription>
- <description>An archetype that generates a starter Spring MVC application with Java EE persistence settings (server bootstrapped JPA, JTA transaction management) for JBoss AS7 / 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.spring.archetypes</archetypeGroupId>
- <archetypeArtifactId>spring-mvc-webapp</archetypeArtifactId>
- <archetypeVersion>1.0.0.CR1</archetypeVersion>
- <!-- archetypeRepository>http://anonsvn.jboss.org/repos/jbosstools/workspace/fred/repositories/sna...</archetypeRepository -->
- <groupId>org.jboss.tools.example</groupId>
- <artifactId>springmvc</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <javaPackage>org.jboss.tools.example.springmvc</javaPackage>
- </mavenArchetype>
- </project>
- <!-- Richfaces project -->
- <project>
- <category>Java EE 6 Quickstarts</category>
- <name>richfaces-archetype-simpleapp</name>
- <included-projects>richfaces-archetype-simpleapp</included-projects>
- <shortDescription>Java EE 6 - RichFaces Simple Application (Maven archetype)</shortDescription>
- <description>An archetype that generates a simple Richfaces application</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>
- <defaultMavenProfiles>jee6</defaultMavenProfiles>
- <mavenArchetype>
- <archetypeGroupId>org.richfaces.archetypes</archetypeGroupId>
- <archetypeArtifactId>richfaces-archetype-simpleapp</archetypeArtifactId>
- <archetypeVersion>4.1.0-SNAPSHOT</archetypeVersion>
- <archetypeRepository>http://repository.jboss.org/nexus/content/repositories/snapshots/</archetypeRepository>
- <groupId>org.jboss.tools.example</groupId>
- <artifactId>richfaces-webapp</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <javaPackage>org.jboss.tools.example.richfaces</javaPackage>
- </mavenArchetype>
- </project>
+
</projects>
12 years, 12 months