JBoss Tools SVN: r37762 - trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-01-11 09:15:05 -0500 (Wed, 11 Jan 2012)
New Revision: 37762
Modified:
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizard.java
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardFirstPage.java
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardPage.java
Log:
JBIDE-10411 : add default values for project name and package
Modified: trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizard.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizard.java 2012-01-11 14:13:42 UTC (rev 37761)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizard.java 2012-01-11 14:15:05 UTC (rev 37762)
@@ -175,7 +175,9 @@
@Override
public void modifyText(ModifyEvent e) {
wizardPage.setArtifactId(simplePage.getProjectName());
- ArchetypeExamplesWizard.this.getContainer().updateButtons();
+ if (ArchetypeExamplesWizard.this.getContainer().getCurrentPage() != null) {
+ ArchetypeExamplesWizard.this.getContainer().updateButtons();
+ }
}
});
@@ -185,7 +187,9 @@
public void modifyText(ModifyEvent e) {
String packageName = ((Combo)e.getSource()).getText();
wizardPage.setPackageName(packageName);
- ArchetypeExamplesWizard.this.getContainer().updateButtons();
+ if (ArchetypeExamplesWizard.this.getContainer().getCurrentPage() != null) {
+ ArchetypeExamplesWizard.this.getContainer().updateButtons();
+ }
}
});
Modified: trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardFirstPage.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardFirstPage.java 2012-01-11 14:13:42 UTC (rev 37761)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardFirstPage.java 2012-01-11 14:15:05 UTC (rev 37762)
@@ -19,6 +19,7 @@
import java.util.Set;
import java.util.regex.Pattern;
+import org.codehaus.plexus.util.StringUtils;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
@@ -124,7 +125,7 @@
if (packageNameModifyListener != null) {
packageCombo.addModifyListener(packageNameModifyListener);
}
-
+
//TODO read facet version from project example metadata
IProjectFacetVersion facetVersion;
try {
@@ -260,12 +261,36 @@
public void setVisible(boolean visible) {
super.setVisible(visible);
- if (visible) {
+ if (visible && !initialized) {
+ //Set defaults values from history here as the history is loaded in super.visible()
+ initDefaultValues();
initialized = true;
- // validate();
+ validate();
}
}
+
+ private void initDefaultValues() {
+ //JBIDE-10411 : provide sensible defaults for project name and package
+ String projectName = projectDescription.getArchetypeModel().getArtifactId();
+ if (StringUtils.isNotBlank(projectName)) {
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (!p.exists()) {
+ projectNameCombo.setText(projectName);
+ }
+ }
+
+ String packageName = null;
+ if (packageCombo.getItemCount() > 0) {
+ packageName = packageCombo.getItem(0);
+ } else {
+ packageName = projectDescription.getArchetypeModel().getJavaPackage();
+ }
+ if (packageName != null) {
+ packageCombo.setText(packageName);
+ }
+ }
+
private void createMissingRepositoriesWarning(Composite parent,
GridData gridData) {
//TODO make that damn component align correctly
Modified: trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardPage.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardPage.java 2012-01-11 14:13:42 UTC (rev 37761)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardPage.java 2012-01-11 14:15:05 UTC (rev 37762)
@@ -77,10 +77,7 @@
Archetype archetype = new Archetype();
ArchetypeModel archetypeModel = projectDescription.getArchetypeModel();
- final String groupId = archetypeModel.getGroupId();
- final String artifactId = archetypeModel.getArtifactId();
final String version = archetypeModel.getVersion();
- final String javaPackage = archetypeModel.getJavaPackage();
archetype.setGroupId(archetypeModel.getArchetypeGroupId());
archetype.setArtifactId(archetypeModel.getArchetypeArtifactId());
@@ -112,19 +109,6 @@
// It needs to be called AFTER setArchetype(archetype) !!!
archetypeChanged = false;
- //Check if project already exists
- IStatus nameStatus = getImportConfiguration().validateProjectName(getModel());
- if(nameStatus.isOK()) {
- artifactIdCombo.setText(artifactId);
- } else {
- //Force the user to change the name if the project exists
- artifactIdCombo.setText("");//$NON-NLS-1$
- }
-
- groupIdCombo.setText(groupId);
- versionCombo.setText(version);
- packageCombo.setText(javaPackage);
-
resolverConfigurationComponent.setExpanded(!resolverConfigurationComponent.getResolverConfiguration().getActiveProfileList().isEmpty());
}
12 years, 12 months
JBoss Tools SVN: r37761 - trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke.
by jbosstools-commits@lists.jboss.org
Author: jgargula
Date: 2012-01-11 09:13:42 -0500 (Wed, 11 Jan 2012)
New Revision: 37761
Added:
trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DroolsViewsTest.java
Log:
Added new tests of Drools views
Added: trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DroolsViewsTest.java
===================================================================
--- trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DroolsViewsTest.java (rev 0)
+++ trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/smoke/DroolsViewsTest.java 2012-01-11 14:13:42 UTC (rev 37761)
@@ -0,0 +1,417 @@
+package org.jboss.tools.drools.ui.bot.test.smoke;
+
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withLabel;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTOpenExt;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.gen.IView;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Test class for testing Drools views.
+ *
+ * @author jgargula
+ */
+public class DroolsViewsTest extends SWTTestExt {
+
+ private static final String PROJECT_NAME = "droolsTest";
+ private static final String RULES_FILE = "Sample.drl";
+ private static final String RULES_FILE_PATH = "src/main/rules";
+ private static final String JAVA_FILE = "DroolsTest.java";
+ private static final String JAVA_FILE_PATH = "src/main/java";
+ private static final String SAMPLE_TREE_NODE = "com.sample";
+ private static final String GLOBAL_VARIABLE_NAME = "globalString";
+ private static final String GLOBAL_VARIABLE_VALUE = "abcd";
+ private static boolean isFirstTimeRun = true;
+
+ /**
+ * Prepares all necessary things.
+ */
+ @Before
+ public void setUp() {
+ if (isFirstTimeRun) {
+ manageProject();
+ setUpOnce();
+ }
+
+ SWTBotTreeItem javaTreeItem = packageExplorer.selectTreeItem(JAVA_FILE, new String[] {PROJECT_NAME, JAVA_FILE_PATH, SAMPLE_TREE_NODE});
+ eclipse.debugTreeItemAsDroolsApplication(javaTreeItem);
+ while (bot.waitForShell(IDELabel.Shell.PROGRESS_INFORMATION, 1) != null) {
+ // nothing to do, waiting time is included in waitForShell method
+ }
+ if (isFirstTimeRun) {
+ bot.waitForShell(IDELabel.Shell.CONFIRM_PERSPECTIVE_SWITCH).activate();
+ eclipse.closeConfirmPerspectiveSwitchShellIfOpened(false, true);
+ }
+
+ bot.sleep(Timing.time2S());
+ isFirstTimeRun = false;
+ }
+
+ /**
+ * This should be executed just before the first test.
+ */
+ private void setUpOnce() {
+ adjustDroolsTestFile();
+ adjustSampleFile();
+ bot.saveAllEditors();
+ }
+
+ /**
+ * Deletes all existing projects
+ * and creates brand new project.
+ */
+ private void manageProject() {
+ packageExplorer.deleteAllProjects();
+ ManageDroolsProject.createDroolsProject(PROJECT_NAME);
+ Widget openingProjectWidget = null;
+ try {
+ openingProjectWidget = bot.widget(withLabel("Drools Runtime"));
+ } catch (WidgetNotFoundException wnfe) {
+ // openingProjectWidget should be null in this case
+ }
+ for (int i = 0; i < 10; i++) {
+ if (openingProjectWidget == null || (openingProjectWidget.isDisposed()
+ && packageExplorer.bot().tree().getAllItems().length > 0)) {
+ break;
+ } else {
+ bot.sleep(Timing.time2S());
+ }
+ }
+ }
+
+ /**
+ * Finishes tests.
+ */
+ @After
+ public void tearDown() {
+ eclipse.closeView(IDELabel.View.AGENDA);
+ eclipse.closeView(IDELabel.View.GLOBAL_DATA);
+ eclipse.finishDebug();
+ }
+
+ /**
+ * Test of Agenda view.
+ */
+ @Test
+ public void agendaTest() {
+ bot.editorByTitle(RULES_FILE).show();
+ eclipse.stepOver();
+ openView(IDELabel.View.AGENDA);
+ HashSet<Activation> expectedSet = new HashSet<Activation>(2);
+ // indicies are not compared
+ expectedSet.add(new Activation(0, "Bye Bye"));
+ expectedSet.add(new Activation(1, "GoodBye"));
+ assertEquals(expectedSet, new HashSet<Activation>(getActivationsFromAgenda()));
+ eclipse.resumeDebug();
+ final String CONSOLE_TEXT_MESSAGE_1 = "Expected console text is:\n";
+ final String CONSOLE_TEXT_MESSAGE_2 = "but was:\n";
+ final String EXPECTED_CONSOLE_TEXT_1 = "Hello World\nGoodbye cruel world\nabcd\n";
+ final String EXPECTED_CONSOLE_TEXT_2 = "JustBye rule\nFinished\n";
+ assertTrue(CONSOLE_TEXT_MESSAGE_1 + EXPECTED_CONSOLE_TEXT_1 + CONSOLE_TEXT_MESSAGE_2 + console.getConsoleText(),
+ EXPECTED_CONSOLE_TEXT_1.equals(console.getConsoleText()));
+ expectedSet.clear();
+ expectedSet.add(new Activation(0, "Finish rule"));
+ showView(IDELabel.View.AGENDA);
+ assertEquals(expectedSet, new HashSet<Activation>(getActivationsFromAgenda()));
+ eclipse.finishDebug();
+ assertTrue(CONSOLE_TEXT_MESSAGE_1 + EXPECTED_CONSOLE_TEXT_1 + EXPECTED_CONSOLE_TEXT_2 + CONSOLE_TEXT_MESSAGE_2
+ + console.getConsoleText(), (EXPECTED_CONSOLE_TEXT_1 + EXPECTED_CONSOLE_TEXT_2).equals(console.getConsoleText()));
+ }
+
+ /**
+ * Tests refreshing of Agenda view.
+ */
+ @Ignore
+ @Test
+ public void refreshAgendaTest() {
+ openView(IDELabel.View.AGENDA);
+ eclipse.stepOver();
+ assertTrue("Agenda is not refreshing automatically.", bot.tree().getAllItems()[0].getItems().length > 0);
+ }
+
+ /**
+ * Test of global variable in Global Data.
+ */
+ @Test
+ public void globalDataTest() {
+ openView(IDELabel.View.GLOBAL_DATA);
+ assertTrue("Global data has wrong number of items. Expected 1 but was "
+ + bot.tree().getAllItems().length, bot.tree().getAllItems().length == 1);
+ assertTrue("Global data does not contain variable '" + GLOBAL_VARIABLE_NAME + "' with value '"
+ + GLOBAL_VARIABLE_VALUE + "'", bot.tree().getAllItems()[0].getText()
+ .contains(GLOBAL_VARIABLE_NAME + "= \"" + GLOBAL_VARIABLE_VALUE + "\""));
+ }
+
+ /**
+ * Adds some pieces of code to DroolsTest.java
+ */
+ private void adjustDroolsTestFile() {
+ packageExplorer.show();
+ SWTBotEclipseEditor droolsTestEditor = packageExplorer.openFile(PROJECT_NAME,
+ JAVA_FILE_PATH, SAMPLE_TREE_NODE, JAVA_FILE).toTextEditor();
+ droolsTestEditor.insertText(46, 0, " public static final int BYE = 2;\n"
+ + " public static final int FINISH = 3;\n");
+ droolsTestEditor.insertText(20, 0, " ksession.setGlobal(\""
+ + GLOBAL_VARIABLE_NAME + "\", \"" + GLOBAL_VARIABLE_VALUE + "\");\n");
+ }
+
+ /**
+ * Adds some source code to Sample.drl
+ */
+ private void adjustSampleFile() {
+ packageExplorer.show();
+ SWTBotEclipseEditor sampleEditor = packageExplorer.openFile(PROJECT_NAME,
+ RULES_FILE_PATH, RULES_FILE).toTextEditor();
+ sampleEditor.insertText(20, 0, "\nrule \"Bye Bye\"\n"
+ + " when\n"
+ + " m : Message(status == Message.BYE || status == Message.GOODBYE, myMessage : message)\n"
+ + " then\n"
+ + " System.out.println(myMessage);\n"
+ + " System.out.println(globalString);\n"
+ + " m.setMessage(\"JustBye rule\");\n"
+ + " m.setStatus(Message.FINISH);\n"
+ + " update(m);\n"
+ + "end\n\n"
+ + "rule \"Finish rule\"\n"
+ + " when\n"
+ + " Message(status == Message.FINISH, myMessage : message)\n"
+ + " then\n"
+ + " System.out.println(myMessage);\n"
+ + " System.out.println(\"Finished\");\n"
+ + "end\n");
+ sampleEditor.insertText(16, 8, "m : ");
+ sampleEditor.insertText(19, 0, " m.setMessage(\"Bye Bye\");\n"
+ + " m.setStatus(Message.BYE);\n"
+ + " update(m);\n");
+ sampleEditor.insertText(4, 0, "global String globalString;\n\n");
+ eclipse.setNewBreakpoints(sampleEditor, 13, 35);
+ }
+
+ /**
+ * This method opens view with given title.
+ *
+ * @param viewTitle Title of desired view.
+ */
+ private void openView(final String viewTitle) {
+ checkViewTitleNull(viewTitle);
+
+ IView iView;
+ try {
+ iView = (IView) Class.forName("org.jboss.tools.ui.bot.ext.gen.ActionItem$View$Drools"
+ + viewTitle.replace(" ", "")).getField("LABEL").get(null);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("It is not possible to get IView object for view with title '"
+ + viewTitle + "'.", e);
+ }
+
+ new SWTOpenExt(bot).viewOpen(iView);
+ }
+
+ /**
+ * Shows view with given title.
+ * It shows and focuses chosen view.
+ * If view is closed then it is opened.
+ *
+ * @param viewTitle Title of desired view.
+ */
+ private void showView(final String viewTitle) {
+ checkViewTitleNull(viewTitle);
+ boolean isViewOpened = false;
+ for (SWTBotView view : bot.views()) {
+ if (viewTitle.equals(view.getTitle())) {
+ view.show();
+ view.setFocus();
+ isViewOpened = true;
+ break;
+ }
+ }
+ if (!isViewOpened) {
+ openView(viewTitle);
+ }
+ }
+
+ /**
+ * Checks if given string is null and if so this method
+ * throws IllegalArgumentException.
+ *
+ * @param viewTitle String to check.
+ */
+ private void checkViewTitleNull(final String viewTitle) {
+ if (viewTitle == null) {
+ throw new IllegalArgumentException("'viewTitle' cannot be null");
+ }
+ }
+
+ /**
+ * Gets list of current activations in working memory.
+ *
+ * @return List of current activations in working memory
+ */
+ private List<Activation> getActivationsFromAgenda() {
+ List<Activation> activations = new ArrayList<Activation>();
+ bot.tree().expandNode(bot.tree().getAllItems()[0].getText(), true);
+ for (SWTBotTreeItem item : bot.tree().getAllItems()[0].getItems()) {
+ Activation activation = new Activation(
+ parseIndex(item.getText()),
+ parseRuleName(item.getItems()[0].getText()));
+ activations.add(activation);
+ }
+ return activations;
+ }
+
+ /**
+ * Parses text for an activation index in working memory.
+ *
+ * @param text Text to parse
+ * @return index of activation in working memory
+ */
+ private int parseIndex(final String text) {
+ int beginIndex = text.indexOf('[');
+ int endIndex = text.indexOf(']');
+ if (beginIndex < 0 || endIndex < 0) {
+ throw new IllegalArgumentException("Given text is not parsable for index. Given text was '" + text + "'");
+ }
+ return Integer.valueOf(text.substring(beginIndex + 1, endIndex));
+ }
+
+ /**
+ * Parses rule name of activation in working memory.
+ *
+ * @param text Text to parse
+ * @return Rule name
+ */
+ private String parseRuleName(final String text) {
+ if (!text.startsWith("ruleName")) {
+ return null;
+ }
+ int i = text.indexOf('"');
+ return text.substring(i + 1, text.indexOf('"', i + 1));
+ }
+
+ /**
+ * This class is representation of activation in working memory.
+ *
+ * @author jgargula
+ */
+ private class Activation {
+ private int index = 0;
+ private String ruleName = null;
+
+ /**
+ * Constructor.
+ */
+ public Activation() {
+ super();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param index Index of activation
+ */
+ public Activation(int index) {
+ this();
+ setIndex(index);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param index Index of activation
+ * @param ruleName Rule name of activation
+ */
+ public Activation(int index, String ruleName) {
+ this(index);
+ setRuleName(ruleName);
+ }
+
+ /**
+ * Getter for <code>index</code>.
+ *
+ * @return index of activation
+ */
+ public int getIndex() {
+ return index;
+ }
+
+ /**
+ * Setter for <code>index</code>.
+ *
+ * @param index Index to be set on the activation
+ */
+ public void setIndex(int index) {
+ this.index = index;
+ }
+
+ /**
+ * Getter for <code>ruleName</code>.
+ *
+ * @return rule name of activation
+ */
+ public String getRuleName() {
+ return ruleName;
+ }
+
+ /**
+ * Setter for <code>ruleName</code>.
+ * @param ruleName
+ */
+ public void setRuleName(String ruleName) {
+ this.ruleName = ruleName;
+ }
+
+ /**
+ * @return String representation of activation.
+ */
+ public String toString() {
+ return "Activation [index=" + getIndex() + "; ruleName=\"" + getRuleName() + "\"]";
+ }
+
+ /**
+ * Hash code.
+ */
+ @Override
+ public int hashCode() {
+ return 31 + ((ruleName == null) ? 0 : ruleName.hashCode());
+ }
+
+ /**
+ * Two activations are equal if they have the same rule name.
+ * Indicies are ignored while comparing.
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null || !(obj instanceof Activation)) {
+ return false;
+ }
+ if (this == obj) {
+ return true;
+ }
+ Activation other = (Activation) obj;
+ if (getRuleName() == null) {
+ if (other.getRuleName() != null) {
+ return false;
+ }
+ }
+ if (getRuleName() == null && other.getRuleName() == null) {
+ return true;
+ }
+ return getRuleName().equals(other.getRuleName());
+ }
+ }
+}
12 years, 12 months
JBoss Tools SVN: r37760 - in trunk/usage: tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-11 07:38:39 -0500 (Wed, 11 Jan 2012)
New Revision: 37760
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/LinuxSystemTest.java
Log:
[JBIDE-10577] now set all linux distros with identical release files to check the content (RedHat/CentOS, Ubuntu/Mint). So no false positive possible for those. If none matches, I return "Unknown".
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java 2012-01-11 12:21:04 UTC (rev 37759)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java 2012-01-11 12:38:39 UTC (rev 37760)
@@ -22,7 +22,7 @@
public class LinuxSystem {
public static final LinuxSystem INSTANCE = new LinuxSystem();
-
+
/**
* @see <a href="http://linuxmafia.com/faq/Admin/release-files.html"> an
* extensive list of release file locations</a>
@@ -31,8 +31,7 @@
* href="http://superuser.com/questions/11008/how-do-i-find-out-what-version-of-li...">
* release-file strings</a>
*/
-
- public final LinuxDistro CENTOS = new CentOSDistro();
+ public final LinuxDistro CENTOS = new ReleaseFileContentCheckedDistro("CentOS", "/etc/redhat-release");
public final LinuxDistro DEBIAN = new LinuxDistro("Debian", "/etc/debian_version");
public final LinuxDistro FEDORA = new LinuxDistro("Fedora", "/etc/fedora-release");
public final LinuxDistro GENTOO = new LinuxDistro("Gentoo", "/etc/gentoo-release");
@@ -40,47 +39,16 @@
public final LinuxDistro KNOPPIX = new LinuxDistro("Knoppix", "knoppix_version");
public final LinuxDistro MANDRAKE = new LinuxDistro("Mandrake", "/etc/mandrake-release");
public final LinuxDistro MANDRIVA = new LinuxDistro("Mandriva", "/etc/mandriva-release");
- public final LinuxDistro MINT = new MintLinuxDistro();
+ public final LinuxDistro MINT = new ReleaseFileContentCheckedDistro("LinuxMint", "/etc/lsb-release");
public final LinuxDistro PLD = new LinuxDistro("PLD", "/etc/pld-release");
- public final LinuxDistro REDHAT = new LinuxDistro("RedHat", "/etc/redhat-release");
+ public final LinuxDistro REDHAT = new ReleaseFileContentCheckedDistro("Red Hat", "/etc/redhat-release");
public final LinuxDistro SLACKWARE = new LinuxDistro("Slackware", "/etc/slackware-version");
public final LinuxDistro SUSE = new LinuxDistro("SUSE", "/etc/SuSE-release");
- public final LinuxDistro UBUNTU = new LinuxDistro("Ubuntu", "/etc/lsb-release");
+ public final LinuxDistro UBUNTU = new ReleaseFileContentCheckedDistro("Ubuntu", "/etc/lsb-release");
private final LinuxDistro[] ALL = new LinuxDistro[] {
- /**
- * Attention: CentOS uses the redhat release file
- * <p>
- * <tt>/etc/redhat-release</tt>
- * <p>
- * We therefore have to check CentOS before we check for Red Hat.
- * It is not reliable to check Red Hat first since that check would
- * result in a false positive on CentOS systems.
- */
CENTOS,
- REDHAT,
- /**
- * Attention: Mint uses the default
- * <p>
- * <tt>/etc/lsb-release</tt>
- * <p>
- * We therefore have to check Mint before we check Ubuntu.
- * Checking Ubuntu first is not reliable since it is resulting in a
- * false positive on Mint systems.
- */
MINT,
- /**
- * Attention: ubuntu has 2 release files
- * <ul>
- * <li>/etc/lsb-release</li>
- * <li>/etc/debian_version</li>
- * </ul>
- * <p>
- * We therefore have to check for Ubuntu before we check for Debian.
- * Checking for Debian results in a false positive on Ubuntu systems.
- * @see https://bugs.launchpad.net/ubuntu/+source/base-files/+bug/19353
- * @see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=444678
- */
UBUNTU,
DEBIAN,
FEDORA,
@@ -89,10 +57,11 @@
MANDRAKE,
MANDRIVA,
PLD,
+ REDHAT,
SLACKWARE,
SUSE,
YELLOWDOG
- };
+ };
public LinuxDistro getDistro() {
for (LinuxDistro distro : ALL) {
@@ -109,55 +78,16 @@
if (distro != null) {
return distro.getNameAndVersion();
} else {
- return "";
+ return "Unknown";
}
}
- protected class CentOSDistro extends LinuxDistro {
- private static final String CENTOS_NAME = "CentOS";
- private static final String REDHAT_RELEASE_FILE = "/etc/redhat-release";
-
- protected CentOSDistro() {
- super(CENTOS_NAME, REDHAT_RELEASE_FILE);
- }
-
- /**
- * Checks if the current system is a CentOS distribution.
- * It checks if /etc/lsb-release contains <tt>CentOS</tt>.
- * @return true if /etc/redhat-release contains CentoOS
- */
- @Override
- protected boolean isDistro() {
- return distroFileContains(CENTOS_NAME);
- }
- }
-
- protected class MintLinuxDistro extends LinuxDistro {
- private static final String MINTLINUX_NAME = "LinuxMint";
- private static final String LSB_RELEASE_FILE = "/etc/lsb-release";
-
- protected MintLinuxDistro() {
- super(MINTLINUX_NAME, LSB_RELEASE_FILE);
- }
-
- /**
- * Checks if the current system is a Mint Linux distribution.
- * It checks if /etc/lsb-release contains <tt>LinuxMint</tt>.
- * We could also check for presence of /etc/linuxmint(/info)
- * @return true if /etc/lsb-release contains LinuxMint
- */
- @Override
- protected boolean isDistro() {
- return distroFileContains(MINTLINUX_NAME);
- }
- }
-
protected boolean exists(String releaseFilePath) {
return releaseFilePath != null
&& releaseFilePath.length() > 0
&& new File(releaseFilePath).exists();
}
-
+
protected String getDistroFileContent(String filePath) throws IOException {
int charachtersToRead = 1024;
StringBuilder builder = new StringBuilder(charachtersToRead);
@@ -192,7 +122,7 @@
protected boolean isDistro() {
return exists(getReleaseFilePath());
}
-
+
public String getName() {
return name;
}
@@ -229,10 +159,25 @@
return false;
}
-
+
@Override
public String toString() {
return name;
}
}
+
+ /**
+ * A distribution definition that checks for presence of the given distro
+ * name in the given release file.
+ */
+ public class ReleaseFileContentCheckedDistro extends LinuxDistro {
+
+ public ReleaseFileContentCheckedDistro(String name, String releaseFilePath) {
+ super(name, releaseFilePath);
+ }
+
+ protected boolean isDistro() {
+ return distroFileContains(getName());
+ }
+ }
}
Modified: trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/LinuxSystemTest.java
===================================================================
--- trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/LinuxSystemTest.java 2012-01-11 12:21:04 UTC (rev 37759)
+++ trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/LinuxSystemTest.java 2012-01-11 12:38:39 UTC (rev 37760)
@@ -60,17 +60,29 @@
LinuxSystem.INSTANCE.DEBIAN.getReleaseFilePath(), "squeeze/sid"),
new ReleaseFile(
LinuxSystem.INSTANCE.UBUNTU.getReleaseFilePath(),
- "DISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=9.04\nDISTRIB_CODENAME=jaunty\nDISTRIB_DESCRIPTION=\"Ubuntu 9.04\""));
+ "DISTRIB_ID=Ubuntu\n" +
+ "DISTRIB_RELEASE=9.04\n" +
+ "DISTRIB_CODENAME=jaunty\n" +
+ "DISTRIB_DESCRIPTION=\"Ubuntu 9.04\""));
assertEquals("Ubuntu 9.04", linuxSystem.getDistroNameAndVersion());
}
@Test
- public void canDetectRed() {
+ public void returnsUnknownIfLSBReleaseWithUnknownContent() {
LinuxSystem linuxSystem = new LinuxSystemFake(
new ReleaseFile(
+ "/etc/lsb-release",
+ "adietish(a)redhat.com"));
+ assertEquals("Unknown", linuxSystem.getDistroNameAndVersion());
+ }
+
+ @Test
+ public void canDetectRedHat() {
+ LinuxSystem linuxSystem = new LinuxSystemFake(
+ new ReleaseFile(
LinuxSystem.INSTANCE.REDHAT.getReleaseFilePath(),
"Red Hat Enterprise Linux Workstation release 6.0 (Santiago)"));
- assertEquals("RedHat 6.0", linuxSystem.getDistroNameAndVersion());
+ assertEquals("Red Hat 6.0", linuxSystem.getDistroNameAndVersion());
}
@Test
@@ -96,4 +108,14 @@
"CentOS release 5.3 (Final)"));
assertEquals("CentOS 5.3", linuxSystem.getDistroNameAndVersion());
}
+
+ @Test
+ public void returnsUnknownIfRedHatReleaseWithUnknownContent() {
+ LinuxSystem linuxSystem = new LinuxSystemFake(
+ new ReleaseFile(
+ LinuxSystem.INSTANCE.REDHAT.getReleaseFilePath(),
+ "adietish(a)redhat.com"));
+ assertEquals("Unknown", linuxSystem.getDistroNameAndVersion());
+ }
+
}
12 years, 12 months
JBoss Tools SVN: r37759 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2012-01-11 07:21:04 -0500 (Wed, 11 Jan 2012)
New Revision: 37759
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractBodyTemplate.java
Log:
https://issues.jboss.org/browse/JBIDE-9975 - applying css style for <BODY> tag was fixed.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractBodyTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractBodyTemplate.java 2012-01-11 10:58:21 UTC (rev 37758)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractBodyTemplate.java 2012-01-11 12:21:04 UTC (rev 37759)
@@ -57,24 +57,27 @@
final Node sourceAttribute = sourceNodeAttributes.item(i);
final String sourceAttributeName = sourceAttribute.getNodeName();
String attributeValue = sourceAttribute.getNodeValue();
-
final String targetAttributeName = getTargetAttributeName(sourceAttributeName);
if (targetAttributeName != null) {
if(HTML.ATTR_ID.equalsIgnoreCase(targetAttributeName)) {
div.setAttribute(HTML.ATTR_ID, attributeValue);
} else {
- // all full path for 'url'
- if (VpeStyleUtil.ATTRIBUTE_STYLE.equalsIgnoreCase(targetAttributeName))
- attributeValue = VpeStyleUtil.addFullPathIntoURLValue(attributeValue, pageContext);
- if (VpeStyleUtil.PARAMETR_BACKGROND.equalsIgnoreCase(targetAttributeName))
- attributeValue = VpeStyleUtil.addFullPathIntoBackgroundValue(attributeValue,
- pageContext.getEditPart().getEditorInput());
+ if (HTML.ATTR_BACKGROUND.equalsIgnoreCase(targetAttributeName)
+ || HTML.ATTR_STYLE.equalsIgnoreCase(targetAttributeName)) {
+ /*
+ * https://issues.jboss.org/browse/JBIDE-9975
+ * Simply set the background style, its correction will be made in
+ * VpeVisualDomBuilder.correctVisualAttribute(..) method.
+ * Wrong URLs won't be set by XULRunner itself.
+ */
+ div.setAttribute(targetAttributeName, attributeValue);
+ }
//FIX FOR JBIDE-1568, added by Max Areshkau
try {
body.setAttribute(targetAttributeName, attributeValue);
} catch(XPCOMException ex ) {
- //jsut ignore it
+ // Ignored
}
}
}
12 years, 12 months
JBoss Tools SVN: r37758 - in trunk/maven/tests/org.jboss.tools.maven.ui.bot.test: projects/simple-jar and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: rawagner
Date: 2012-01-11 05:58:21 -0500 (Wed, 11 Jan 2012)
New Revision: 37758
Added:
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/usersettings/
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/usersettings/settings.xml
Modified:
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/projects/simple-jar/pom.xml
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenProjectsTest.java
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenProfileSelectionTest.java
Log:
Profile selection test now uses custom user settings.xml
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/projects/simple-jar/pom.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/projects/simple-jar/pom.xml 2012-01-11 08:55:39 UTC (rev 37757)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/projects/simple-jar/pom.xml 2012-01-11 10:58:21 UTC (rev 37758)
@@ -6,13 +6,35 @@
<artifactId>simple-jar</artifactId>
<version>1.0.0-SNAPSHOT</version>
<profiles>
- <profile>
- <id>active-profile</id>
- <activation><activeByDefault>true</activeByDefault></activation>
- </profile>
- <profile>
- <id>inactive-profile</id>
- </profile>
+ <profile>
+ <id>active-profile</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ </profile>
+ <profile>
+ <id>inactive-profile</id>
+ </profile>
+ <profile>
+ <id>common-profile</id>
+ </profile>
</profiles>
+
+ <repositories>
+ <repository>
+ <id>jboss-public-repository-group</id>
+ <name>JBoss Public Maven Repository Group</name>
+ <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
+ <layout>default</layout>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
</project>
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenProjectsTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenProjectsTest.java 2012-01-11 08:55:39 UTC (rev 37757)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenProjectsTest.java 2012-01-11 10:58:21 UTC (rev 37758)
@@ -48,6 +48,7 @@
buildProject(projectName,"5 Maven build...", "jar");
}
+
@Test
public void createSimpleJarProjectArchetype() throws Exception {
String projectName = "ArchetypeQuickstart";
@@ -59,6 +60,7 @@
}
+
@Test
public void createSimpleJarMavenizedProject() throws InterruptedException, CoreException{
String projectName = "JarMavenized";
@@ -142,7 +144,7 @@
shell.button("Next >").click();
Thread.sleep(2000);
shell.comboBox().setSelection(catalog);
- Thread.sleep(1000);
+ Thread.sleep(2000);
int index = botExt.table(0).indexOf(projectType, "Artifact Id");
if (index == -1) {
fail(projectType + " not found");
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java 2012-01-11 08:55:39 UTC (rev 37757)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java 2012-01-11 10:58:21 UTC (rev 37758)
@@ -26,7 +26,9 @@
@Test
public void createEARProject() throws Exception{
createWarProject(WAR_PROJECT_NAME);
+ Thread.sleep(500);
createEJBProject(EJB_PROJECT_NAME);
+ Thread.sleep(500);
botext.menu("File").menu("Enterprise Application Project").click();
botext.textWithLabel("Project name:").setText(EAR_PROJECT_NAME);
botext.button("Modify...").click();
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java 2012-01-11 08:55:39 UTC (rev 37757)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java 2012-01-11 10:58:21 UTC (rev 37758)
@@ -21,12 +21,12 @@
*/
@RunWith(RequirementAwareSuite.class)
@Suite.SuiteClasses({
- MavenProfileSelectionTest.class,
CreateMavenizedSeamProjectTest.class,
- CreateMavenProjectsTest.class,
CreateMavenizedEARProjectTest.class,
CreateMavenizedJSFProjectTest.class,
- MaterializeLibraryTest.class
+ MavenProfileSelectionTest.class,
+ MaterializeLibraryTest.class,
+ CreateMavenProjectsTest.class
})
public class MavenAllBotTests {
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenProfileSelectionTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenProfileSelectionTest.java 2012-01-11 08:55:39 UTC (rev 37757)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenProfileSelectionTest.java 2012-01-11 10:58:21 UTC (rev 37758)
@@ -1,11 +1,14 @@
package org.jboss.tools.maven.ui.bot.test;
+import java.io.File;
+import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.apache.maven.model.Profile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.jface.bindings.keys.ParseException;
import org.eclipse.m2e.core.MavenPlugin;
@@ -17,6 +20,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -26,9 +30,11 @@
public static final String AUTOACTIVATED_PROFILE_IN_POM = "active-profile";
public static final String AUTOACTIVATED_PROFILE_IN_USER_SETTINGS = "jboss.repository";
-
+ public static final String COMMON_PROFILE = "common-profile";
+
@Test
public void testOpenMavenProfiles() throws Exception {
+ setUserSettings();
IProject project = importProject("projects/simple-jar/pom.xml");
waitForJobsToComplete();
testAutoActivatedProfiles();
@@ -46,7 +52,7 @@
String selectedProfiles = shell.textWithLabel("Active profiles for simple-jar :").getText();
shell.button("OK").click();
- testActivatedProfiles(project.getName(), selectedProfiles);
+ testActivatedProfiles(project.getName(), selectedProfiles, false);
Thread.sleep(1000);
openProfilesDialog(projectItem);
@@ -56,9 +62,38 @@
selectedProfiles = bot.textWithLabel("Active profiles for simple-jar :").getText();
bot.button("OK").click();
- testActivatedProfiles(project.getName(), selectedProfiles);
+ testActivatedProfiles(project.getName(), selectedProfiles, true);
}
+ @Test
+ public void testOpenMultipleMavenProfiles() throws Exception{
+ IProject project = importProject("projects/simple-jar/pom.xml");
+ IProject project1 = importProject("projects/simple-jar1/pom.xml");
+ IProject project2 = importProject("projects/simple-jar2/pom.xml");
+ waitForJobsToComplete();
+ final SWTBotView packageExplorer = bot.viewByTitle("Project Explorer");
+ SWTBot innerBot = packageExplorer.bot();
+ innerBot.activeShell().activate();
+ SWTBotTree tree = innerBot.tree();
+ tree.select("simple-jar","simple-jar1","simple-jar2").pressShortcut(Keystrokes.CTRL, Keystrokes.ALT,KeyStroke.getInstance("P"));
+ SWTBot shell = bot.shell("Select Maven profiles").activate().bot();
+ shell.button("Select All").click();
+ shell.button("Activate").click();
+ shell.button("OK").click();
+ testActivatedProfiles(project.getName(), COMMON_PROFILE+", "+AUTOACTIVATED_PROFILE_IN_USER_SETTINGS, false);
+ testActivatedProfiles(project1.getName(), COMMON_PROFILE+", "+AUTOACTIVATED_PROFILE_IN_USER_SETTINGS, false);
+ testActivatedProfiles(project2.getName(), COMMON_PROFILE+", "+AUTOACTIVATED_PROFILE_IN_USER_SETTINGS, false);
+ }
+
+ private void setUserSettings() throws InterruptedException, IOException, CoreException{
+ SWTBotExt botExt = new SWTBotExt();
+ botExt.menu("Window").menu("Preferences").click();
+ botExt.tree().expandNode("Maven").select("User Settings").click();
+ File f = new File("usersettings/settings.xml");
+ botExt.text(1).setText(f.getAbsolutePath());
+ botExt.button("OK").click();
+ }
+
private void openProfilesDialog(SWTBotTreeItem projectItem) throws ParseException, InterruptedException{
projectItem.pressShortcut(Keystrokes.CTRL, Keystrokes.ALT,KeyStroke.getInstance("P"));
//projectItem.pressShortcut(Keystrokes.DOWN);
@@ -68,7 +103,7 @@
Thread.sleep(1000);
}
- private void testActivatedProfiles(String projectName, String profilesToCheck){
+ private void testActivatedProfiles(String projectName, String profilesToCheck, boolean defaultProfile){
IMavenProjectFacade facade = MavenPlugin.getMavenProjectRegistry().getMavenProject("org.jboss.tools.maven.tests", "simple-jar", "1.0.0-SNAPSHOT");
assertNotNull("facade is null",facade);
@@ -76,16 +111,19 @@
String empty = "";
Set<String> setOfProfiles = new HashSet<String>();
Collections.addAll(setOfProfiles, parsedProfiles);
- setOfProfiles.add(AUTOACTIVATED_PROFILE_IN_POM);
setOfProfiles.add(AUTOACTIVATED_PROFILE_IN_USER_SETTINGS);
+ if(defaultProfile){
+ setOfProfiles.add(AUTOACTIVATED_PROFILE_IN_POM);
+ }
setOfProfiles.remove(empty);
Set<String> setOfProfilesFacade = new HashSet<String>();
for(Profile profile : facade.getMavenProject().getActiveProfiles()){
+ System.out.println(profile.getId());
setOfProfilesFacade.add(profile.getId());
}
- assertEquals("Selected profiles doesn't match", setOfProfilesFacade, setOfProfiles);
+ assertEquals("Selected profiles in project " +projectName+ " doesn't match", setOfProfilesFacade, setOfProfiles);
}
private void testAutoActivatedProfiles(){
Added: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/usersettings/settings.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/usersettings/settings.xml (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/usersettings/settings.xml 2012-01-11 10:58:21 UTC (rev 37758)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<settings>
+ <profiles>
+ <profile>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <id>jboss.repository</id>
+ </profile>
+ </profiles>
+</settings>
\ No newline at end of file
12 years, 12 months
JBoss Tools SVN: r37757 - in trunk/ws: plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-01-11 03:55:39 -0500 (Wed, 11 Jan 2012)
New Revision: 37757
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessor.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactory.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java
trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessorTestCase.java
Log:
Fixing JBIDE-10509 - JAX-RS validation error/warning doesn't reappear (https://issues.jboss.org/browse/JBIDE-10509)
Fixing JBIDE-10510 - JAX-RS validation error doesn't appear after changing @PathParam parameter from correct to incorrect value (https://issues.jboss.org/browse/JBIDE-10510)
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessor.java 2012-01-11 08:02:44 UTC (rev 37756)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessor.java 2012-01-11 08:55:39 UTC (rev 37757)
@@ -46,6 +46,8 @@
import org.jboss.tools.ws.jaxrs.core.internal.utils.CollectionUtils;
import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
import org.jboss.tools.ws.jaxrs.core.internal.utils.WtpUtils;
+import org.jboss.tools.ws.jaxrs.core.jdt.CompilationUnitsRepository;
+import org.jboss.tools.ws.jaxrs.core.jdt.JavaMethodSignature;
import org.jboss.tools.ws.jaxrs.core.jdt.JaxrsAnnotationsScanner;
import org.jboss.tools.ws.jaxrs.core.jdt.JdtUtils;
import org.jboss.tools.ws.jaxrs.core.metamodel.EnumKind;
@@ -583,7 +585,7 @@
}
private List<JaxrsElementDelta> postProcessResource(final JaxrsElementDelta event,
- final IProgressMonitor progressMonitor) {
+ final IProgressMonitor progressMonitor) throws JavaModelException {
final List<JaxrsElementDelta> results = new ArrayList<JaxrsElementDelta>();
final JaxrsResource eventResource = (JaxrsResource) event.getElement();
final JaxrsMetamodel metamodel = eventResource.getMetamodel();
@@ -666,7 +668,7 @@
}
private List<JaxrsElementDelta> mergeResourceMethods(final JaxrsResource existingResource,
- final JaxrsResource matchingResource, final JaxrsMetamodel metamodel) {
+ final JaxrsResource matchingResource, final JaxrsMetamodel metamodel) throws JavaModelException {
final List<JaxrsElementDelta> changes = new ArrayList<JaxrsElementDelta>();
final Map<String, JaxrsResourceMethod> addedMethods = CollectionUtils.difference(matchingResource.getMethods(),
existingResource.getMethods());
@@ -685,6 +687,9 @@
final JaxrsResourceMethod existingMethod = entry.getValue();
final JaxrsResourceMethod matchingMethod = matchingResource.getMethods().get(entry.getKey());
int flags = existingMethod.mergeAnnotations(matchingMethod.getAnnotations());
+ final CompilationUnit matchingResourceAST = CompilationUnitsRepository.getInstance().getAST(matchingResource.getResource());
+ final JavaMethodSignature matchingResourceMethodSignature = JdtUtils.resolveMethodSignature(matchingMethod.getJavaElement(), matchingResourceAST);
+ flags += existingMethod.update(matchingResourceMethodSignature);
if ((flags & F_ELEMENT_KIND) > 0 && existingMethod.getKind() == EnumKind.UNDEFINED) {
metamodel.remove(existingMethod);
changes.add(new JaxrsElementDelta(existingMethod, REMOVED));
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactory.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactory.java 2012-01-11 08:02:44 UTC (rev 37756)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsElementFactory.java 2012-01-11 08:55:39 UTC (rev 37757)
@@ -231,7 +231,7 @@
final Annotation producesAnnotation = annotations.get(Produces.class.getName());
final Annotation consumesAnnotation = annotations.get(Consumes.class.getName());
final JavaMethodSignature methodSignature = JdtUtils.resolveMethodSignature(javaMethod, ast);
- // avoid creating Resource Method when the Java Method cannot be parsed (ie, syntax/compilation error)
+ // avoid creating Resource Method when the Java Method cannot be parsed (ie, syntax/compilation error)P
if (methodSignature != null) {
final Builder builder = new JaxrsResourceMethod.Builder(javaMethod, parentResource, metamodel)
.pathTemplate(pathAnnotation).consumes(consumesAnnotation).produces(producesAnnotation)
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java 2012-01-11 08:02:44 UTC (rev 37756)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsResourceMethod.java 2012-01-11 08:55:39 UTC (rev 37757)
@@ -198,7 +198,7 @@
message.setAttribute(IMarker.CHAR_END, annotation.getRegion().getOffset()
+ annotation.getRegion().getLength());
messages.add(message);
- Logger.debug("Validation message for {}: {}", this.getJavaElement().getElementName(), message);
+ Logger.debug("Validation message for {}: {}", this.getJavaElement().getElementName(), message.getAttribute(IMarker.MESSAGE));
}
}
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java 2012-01-11 08:02:44 UTC (rev 37756)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JavaMethodSignaturesVisitor.java 2012-01-11 08:55:39 UTC (rev 37757)
@@ -139,6 +139,7 @@
/** @return the methodDeclarations */
public JavaMethodSignature getMethodSignature() {
if (this.methodSignatures.size() == 0) {
+ Logger.debug("*** no method signature found ?!? ***");
return null;
}
return this.methodSignatures.get(0);
Modified: trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessorTestCase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessorTestCase.java 2012-01-11 08:02:44 UTC (rev 37756)
+++ trunk/ws/tests/org.jboss.tools.ws.jaxrs.core.test/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/ResourceChangedProcessorTestCase.java 2012-01-11 08:55:39 UTC (rev 37757)
@@ -59,6 +59,7 @@
import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsResourceMethod;
import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsWebxmlApplication;
import org.jboss.tools.ws.jaxrs.core.jdt.Annotation;
+import org.jboss.tools.ws.jaxrs.core.jdt.CompilationUnitsRepository;
import org.jboss.tools.ws.jaxrs.core.jdt.JdtUtils;
import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementKind;
import org.jboss.tools.ws.jaxrs.core.metamodel.EnumKind;
@@ -90,6 +91,7 @@
metamodel = spy(JaxrsMetamodel.create(javaProject));
// replace the normal metamodel instance with the one spied by Mockito
javaProject.getProject().setSessionProperty(JaxrsMetamodel.METAMODEL_QUALIFIED_NAME, metamodel);
+ CompilationUnitsRepository.getInstance().clear();
}
/**
12 years, 12 months
JBoss Tools SVN: r37756 - trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-01-11 03:02:44 -0500 (Wed, 11 Jan 2012)
New Revision: 37756
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/ExportedClassFolderReferenceResolver.java
Log:
http://community.jboss.org/message/643854 - null check
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/ExportedClassFolderReferenceResolver.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/ExportedClassFolderReferenceResolver.java 2012-01-11 03:17:39 UTC (rev 37755)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/wtp/core/vcf/ExportedClassFolderReferenceResolver.java 2012-01-11 08:02:44 UTC (rev 37756)
@@ -34,7 +34,7 @@
ReferencedComponent referencedComponent) {
URI handle = referencedComponent.getHandle();
String s = handle.toString();
- if(s.startsWith(OUTPUT_FOLDER_PROTOCOL))
+ if(s != null && s.startsWith(OUTPUT_FOLDER_PROTOCOL))
return true;
return false;
}
12 years, 12 months
JBoss Tools SVN: r37755 - in trunk/ws/docs/restful_reference/en-US: images and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2012-01-10 22:17:39 -0500 (Tue, 10 Jan 2012)
New Revision: 37755
Added:
trunk/ws/docs/restful_reference/en-US/JAX-RS_Validation.xml
trunk/ws/docs/restful_reference/en-US/images/JAX-RS_Validaiton_01.png
Modified:
trunk/ws/docs/restful_reference/en-US/Book_Info.xml
trunk/ws/docs/restful_reference/en-US/JBoss_RESTful_Web_Services_User_Guide.xml
trunk/ws/docs/restful_reference/en-US/master.xml
Log:
added new chapter with validator content for 3.3.0.M5
Modified: trunk/ws/docs/restful_reference/en-US/Book_Info.xml
===================================================================
--- trunk/ws/docs/restful_reference/en-US/Book_Info.xml 2012-01-11 01:54:58 UTC (rev 37754)
+++ trunk/ws/docs/restful_reference/en-US/Book_Info.xml 2012-01-11 03:17:39 UTC (rev 37755)
@@ -7,7 +7,7 @@
<productname>JBoss Developer Studio</productname>
<productnumber>5.0</productnumber>
<edition>5.0.0</edition>
- <pubsnumber>4</pubsnumber>
+ <pubsnumber>5</pubsnumber>
<abstract>
<para>The JBoss RESTful Web Services User Guide explains how to use RESTful Web Services to implement web services in Java.</para>
</abstract>
Added: trunk/ws/docs/restful_reference/en-US/JAX-RS_Validation.xml
===================================================================
--- trunk/ws/docs/restful_reference/en-US/JAX-RS_Validation.xml (rev 0)
+++ trunk/ws/docs/restful_reference/en-US/JAX-RS_Validation.xml 2012-01-11 03:17:39 UTC (rev 37755)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<chapter id="JAX-RS_Validation">
+ <title>JAX-RS Validation</title>
+ <para>
+ JAX-RS validation is enabled by default. Validation allows your project to be checked for errors. If an error is discovered a <guilabel>Problems</guilabel> tab will appear in the bottom section of your workbench, outlining the errors found.
+ </para>
+ <para>
+ If you wish to turn off JAX-RS Validation, you can do so by first navigating to <menuchoice><guimenuitem>Window</guimenuitem><guimenuitem>Preferences</guimenuitem><guimenuitem>Validation</guimenuitem></menuchoice>. In the <guilabel>Validator</guilabel> section of the dialog, deselect the checkboxes for <guilabel>JAX-RS Metamodel Validator</guilabel> and click the <guibutton>Apply</guibutton> button, followed by <guibutton>OK</guibutton>.
+ </para>
+ <figure id="Validator_preferences">
+ <title>Validator preferences</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/JAX-RS_Validaiton_01.png" format="PNG"/>
+ </imageobject>
+ <textobject>
+ <para>Validator preferences</para>
+ </textobject>
+ </mediaobject>
+ </figure>
+</chapter>
\ No newline at end of file
Modified: trunk/ws/docs/restful_reference/en-US/JBoss_RESTful_Web_Services_User_Guide.xml
===================================================================
--- trunk/ws/docs/restful_reference/en-US/JBoss_RESTful_Web_Services_User_Guide.xml 2012-01-11 01:54:58 UTC (rev 37754)
+++ trunk/ws/docs/restful_reference/en-US/JBoss_RESTful_Web_Services_User_Guide.xml 2012-01-11 03:17:39 UTC (rev 37755)
@@ -13,6 +13,7 @@
<xi:include href="sample_web_service_wizards.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="resteasy_simple_project_example.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="web_service_test_view.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+<xi:include href="JAX-RS_Validation.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="Revision_History.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
</book>
Added: trunk/ws/docs/restful_reference/en-US/images/JAX-RS_Validaiton_01.png
===================================================================
(Binary files differ)
Property changes on: trunk/ws/docs/restful_reference/en-US/images/JAX-RS_Validaiton_01.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/ws/docs/restful_reference/en-US/master.xml
===================================================================
--- trunk/ws/docs/restful_reference/en-US/master.xml 2012-01-11 01:54:58 UTC (rev 37754)
+++ trunk/ws/docs/restful_reference/en-US/master.xml 2012-01-11 03:17:39 UTC (rev 37755)
@@ -6,6 +6,7 @@
<!ENTITY samplewizard SYSTEM "sample_web_service_wizards.xml">
<!ENTITY resteasyexample SYSTEM "resteasy_simple_project_example.xml">
<!ENTITY testview SYSTEM "web_service_test_view.xml">
+<!ENTITY validation SYSTEM "JAX-RS_Validation.xml">
]>
<book>
@@ -31,11 +32,7 @@
<author>
<firstname>Brian </firstname>
<surname>Fitzpatrick</surname>
- </author>
- <author>
- <firstname>Ben</firstname>
- <surname>Clare</surname>
- </author>
+ </author>
<editor>
<firstname>Isaac</firstname>
<surname>Rooskov</surname>
@@ -62,4 +59,5 @@
&samplewizard;
&resteasyexample;
&testview;
+ &validation;
</book>
12 years, 12 months
JBoss Tools SVN: r37754 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-10 20:54:58 -0500 (Tue, 10 Jan 2012)
New Revision: 37754
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/Libs.java
Log:
JBIDE-10601
https://issues.joss.org/browse/JBIDE-10601
When checking what has changed in classpath, we should take into account 'excluded' attribute.
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/Libs.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/Libs.java 2012-01-11 01:51:33 UTC (rev 37753)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/Libs.java 2012-01-11 01:54:58 UTC (rev 37754)
@@ -49,6 +49,7 @@
Set<String> projects = new HashSet<String>();
LibraryNames libraryNames = new LibraryNames();
+ int excudedState = 0;
List<LibsListener> listeners = new ArrayList<LibsListener>();
@@ -83,10 +84,16 @@
}
public boolean update() {
+ boolean result = false;
int cpv = classpathVersion;
- boolean result = hasToUpdatePaths() && updatePaths(getNewPaths(), cpv);
- if(result) fire();
- if(paths == null && result) return true;
+ if(hasToUpdatePaths()) {
+ result = updatePaths(getNewPaths(), cpv);
+ if(isExcludedStateChanged()) {
+ result = true;
+ }
+ if(result) fire();
+ if(paths == null && result) return true;
+ }
if(paths != null) updateFileSystems(paths);
fsVersion = pathsVersion;
@@ -132,6 +139,38 @@
projects = result;
}
+ private boolean isExcludedStateChanged() {
+ try {
+ int es = computeExcludedState();
+ if(es != excudedState) {
+ excudedState = es;
+ return true;
+ }
+ } catch (JavaModelException e) {
+ ModelPlugin.getDefault().logError(e);
+ }
+ return false;
+ }
+
+ private int computeExcludedState() throws JavaModelException {
+ int result = 0;
+ IJavaProject javaProject = EclipseResourceUtil.getJavaProject(getProjectResource());
+ if(javaProject != null) {
+ IClasspathEntry[] es = javaProject.getResolvedClasspath(true);
+ for (int i = 0; i < es.length; i++) {
+ IPath p = es[i].getPath();
+ IPath[] ps = es[i].getExclusionPatterns();
+ if(ps != null && ps.length > 0) {
+ for (int j = 0; j < ps.length; j++) {
+ String key = p.toString() + "/" + ps[j].toString();
+ result += key.hashCode();
+ }
+ }
+ }
+ }
+ return result;
+ }
+
private synchronized boolean updatePaths(List<String> newPaths, int cpv) {
if(cpv <= pathsVersion) {
return false;
12 years, 12 months
JBoss Tools SVN: r37753 - trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-10 20:51:33 -0500 (Tue, 10 Jan 2012)
New Revision: 37753
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderLoggerExtension.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderServiceHandlerExtension.java
Log:
JBIDE-10601
https://issues.joss.org/browse/JBIDE-10601
When copying context, we should check if definition exists. Alternatively, we would have to do clean build.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderLoggerExtension.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderLoggerExtension.java 2012-01-11 01:50:47 UTC (rev 37752)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderLoggerExtension.java 2012-01-11 01:51:33 UTC (rev 37753)
@@ -123,8 +123,18 @@
LoggerDefinitionContext copy = new LoggerDefinitionContext();
copy.root = root;
if(!clean) {
- copy.messageLoggers.putAll(messageLoggers);
- copy.messageBundles.putAll(messageBundles);
+ for (String qn: messageLoggers.keySet()) {
+ TypeDefinition d = messageLoggers.get(qn);
+ if(d.exists()) {
+ copy.messageLoggers.put(qn, d);
+ }
+ }
+ for (String qn: messageBundles.keySet()) {
+ TypeDefinition d = messageBundles.get(qn);
+ if(d.exists()) {
+ copy.messageBundles.put(qn, d);
+ }
+ }
}
return copy;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderServiceHandlerExtension.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderServiceHandlerExtension.java 2012-01-11 01:50:47 UTC (rev 37752)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.solder.core/src/org/jboss/tools/cdi/seam/solder/core/CDISeamSolderServiceHandlerExtension.java 2012-01-11 01:51:33 UTC (rev 37753)
@@ -110,7 +110,12 @@
ServiceHandlerDefinitionContext copy = new ServiceHandlerDefinitionContext();
copy.root = root;
if(!clean) {
- copy.services.putAll(services);
+ for (String qn: services.keySet()) {
+ TypeDefinition d = services.get(qn);
+ if(d.exists()) {
+ copy.services.put(qn, d);
+ }
+ }
copy.serviceAnnotations.addAll(serviceAnnotations);
}
12 years, 12 months