JBoss Tools SVN: r36712 - trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-11-28 16:26:19 -0500 (Mon, 28 Nov 2011)
New Revision: 36712
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java
Log:
JBIDE-10190
https://issues.jboss.org/browse/JBIDE-10190
Partially migrated validation for faces-config.xml.
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java 2011-11-28 19:26:32 UTC (rev 36711)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java 2011-11-28 21:26:19 UTC (rev 36712)
@@ -49,8 +49,6 @@
if(attr == null) return;
String value = object.getAttributeValue(attr);
if(value == null) {
- System.out.println("Entity=" + object.getModelEntity().getName());
- System.out.println("Attr=" + attr);
return;
}
if(value.length() == 0 || isJavaLang(value)) return;
13 years, 1 month
JBoss Tools SVN: r36711 - in trunk: examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-11-28 14:26:32 -0500 (Mon, 28 Nov 2011)
New Revision: 36711
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/Messages.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/messages.properties
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/AbstractImportProjectExample.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencesInitializer.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java
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
Log:
JBIDE-10009 project examples should provide way to set the output direcotry
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/Messages.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/Messages.java 2011-11-28 18:45:41 UTC (rev 36710)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/Messages.java 2011-11-28 19:26:32 UTC (rev 36711)
@@ -69,6 +69,7 @@
public static String ProjectExamplesPreferencePage_Show_experimental_sites;
public static String ProjectExamplesPreferencePage_Show_invalid_sites;
public static String ProjectExamplesPreferencePage_Sites;
+ public static String ProjectExamplesPreferencePage_Use_default_workspace_location;
public static String ProjectFix_Missing_Drools_Runtime;
public static String ProjectFix_Missing_plugin;
public static String ProjectFix_Missing_Seam_Runtime;
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java 2011-11-28 18:45:41 UTC (rev 36710)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java 2011-11-28 19:26:32 UTC (rev 36711)
@@ -116,6 +116,8 @@
public static final String MAVEN_ARCHETYPE = "mavenArchetype"; //$NON-NLS-1$
public static final Object PROJECT_EXAMPLES_FAMILY = new Object();
public static final String PROJECT_EXAMPLES_OUTPUT_DIRECTORY = "projectExamplesOutputDirectory"; //$NON-NLS-1$
+ public static final String PROJECT_EXAMPLES_DEFAULT = "projectExamplesDefaultLocation"; //$NON-NLS-1$
+ public static final boolean PROJECT_EXAMPLES_DEFAULT_VALUE = true;
private static final String IMPORT_PROJECT_EXAMPLES_EXTENSION_ID = "org.jboss.tools.project.examples.importProjectExamples"; //$NON-NLS-1$
private static final String NAME = "name"; //$NON-NLS-1$
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/messages.properties
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/messages.properties 2011-11-28 18:45:41 UTC (rev 36710)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/messages.properties 2011-11-28 19:26:32 UTC (rev 36711)
@@ -51,11 +51,12 @@
ProjectExamplesActivator_Waiting=Waiting...
ProjectExamplesPreferencePage_Add=Add
ProjectExamplesPreferencePage_Edit=Edit
-ProjectExamplesPreferencePage_Output_directory=Output directory:
+ProjectExamplesPreferencePage_Output_directory=Output directory
ProjectExamplesPreferencePage_Remove=Remove
ProjectExamplesPreferencePage_Show_experimental_sites=Show experimental sites
ProjectExamplesPreferencePage_Show_invalid_sites=Show invalid sites
ProjectExamplesPreferencePage_Sites=Sites
+ProjectExamplesPreferencePage_Use_default_workspace_location=Use default workspace location
ProjectFix_Missing_Drools_Runtime=Missing Drools Runtime
ProjectFix_Missing_plugin=Missing plugin
ProjectFix_Missing_Seam_Runtime=Missing Seam Runtime
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/AbstractImportProjectExample.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/AbstractImportProjectExample.java 2011-11-28 18:45:41 UTC (rev 36710)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/AbstractImportProjectExample.java 2011-11-28 19:26:32 UTC (rev 36711)
@@ -51,11 +51,17 @@
@Override
public IPath getLocation() {
- String location = ProjectExamplesActivator.getDefault().getPreferenceStore().getString(ProjectExamplesActivator.PROJECT_EXAMPLES_OUTPUT_DIRECTORY);
- if (location == null || location.isEmpty()) {
- return Platform.getLocation();
+ boolean isWorkspace = ProjectExamplesActivator.getDefault().getPreferenceStore().
+ getBoolean(ProjectExamplesActivator.PROJECT_EXAMPLES_DEFAULT);
+ if (!isWorkspace) {
+ String location = ProjectExamplesActivator.getDefault().getPreferenceStore().
+ getString(ProjectExamplesActivator.PROJECT_EXAMPLES_OUTPUT_DIRECTORY);
+ if (location == null || location.isEmpty()) {
+ return Platform.getLocation();
+ }
+ return new Path(location);
}
- return new Path(location);
+ return Platform.getLocation();
}
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java 2011-11-28 18:45:41 UTC (rev 36710)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java 2011-11-28 19:26:32 UTC (rev 36711)
@@ -25,6 +25,7 @@
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
@@ -60,48 +61,43 @@
private ProjectExampleSite selectedSite;
private Button showInvalidSites;
private Text outputDirectoryText;
+ private Button isWorkspace;
@Override
protected Control createContents(Composite parent) {
+
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, false);
layout.marginWidth = 0;
layout.marginHeight = 0;
composite.setLayout(layout);
- showExperimentalSites = new Button(composite,SWT.CHECK);
- showExperimentalSites.setText(Messages.ProjectExamplesPreferencePage_Show_experimental_sites);
- IPreferenceStore store = ProjectExamplesActivator.getDefault().getPreferenceStore();
- showExperimentalSites.setSelection(store.getBoolean(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES));
-
- showInvalidSites = new Button(composite,SWT.CHECK);
- showInvalidSites.setText(Messages.ProjectExamplesPreferencePage_Show_invalid_sites);
- showInvalidSites.setSelection(store.getBoolean(ProjectExamplesActivator.SHOW_INVALID_SITES));
-
- Composite outputDirectoryComposite = new Composite(composite, SWT.NONE);
- layout = new GridLayout(3, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- outputDirectoryComposite.setLayout(layout);
+ Group outputDirectoryGroup = new Group(composite, SWT.NONE);
+ layout = new GridLayout(2, false);
+ outputDirectoryGroup.setLayout(layout);
+ outputDirectoryGroup.setText(Messages.ProjectExamplesPreferencePage_Output_directory);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- outputDirectoryComposite.setLayoutData(gd);
+ outputDirectoryGroup.setLayoutData(gd);
- Label outputDirectoryLabel = new Label(outputDirectoryComposite,SWT.NONE);
- gd = new GridData(SWT.FILL, SWT.FILL, false, false);
- gd.verticalAlignment = SWT.CENTER;
- outputDirectoryLabel.setLayoutData(gd);
- outputDirectoryLabel.setText(Messages.ProjectExamplesPreferencePage_Output_directory);
+ isWorkspace = new Button(outputDirectoryGroup, SWT.CHECK);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ gd.horizontalSpan = 2;
+ isWorkspace.setLayoutData(gd);
+ isWorkspace.setText(Messages.ProjectExamplesPreferencePage_Use_default_workspace_location);
+ isWorkspace.setSelection(ProjectExamplesActivator.getDefault().getPreferenceStore().getBoolean(ProjectExamplesActivator.PROJECT_EXAMPLES_DEFAULT));
- outputDirectoryText = new Text(outputDirectoryComposite, SWT.SINGLE|SWT.BORDER);
+ outputDirectoryText = new Text(outputDirectoryGroup, SWT.SINGLE|SWT.BORDER);
gd = new GridData(SWT.FILL, SWT.FILL, true, false);
gd.verticalAlignment = SWT.CENTER;
outputDirectoryText.setLayoutData(gd);
+ IPreferenceStore store = ProjectExamplesActivator.getDefault().getPreferenceStore();
String outputDirectoryValue = store.getString(ProjectExamplesActivator.PROJECT_EXAMPLES_OUTPUT_DIRECTORY);
outputDirectoryText.setText(outputDirectoryValue == null ? "" : outputDirectoryValue); //$NON-NLS-1$
- Button outputDirectoryBrowse = new Button(outputDirectoryComposite, SWT.PUSH);
+ final Button outputDirectoryBrowse = new Button(outputDirectoryGroup, SWT.PUSH);
outputDirectoryBrowse.setText(Messages.Browse);
- outputDirectoryBrowse.addSelectionListener(new SelectionListener(){
+ outputDirectoryBrowse.addSelectionListener(new SelectionAdapter(){
+ @Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.SINGLE);
String value = outputDirectoryText.getText();
@@ -118,11 +114,28 @@
}
- public void widgetDefaultSelected(SelectionEvent e) {
-
+ });
+ enableControls(outputDirectoryBrowse);
+
+ isWorkspace.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ enableControls(outputDirectoryBrowse);
}
+
});
+ showExperimentalSites = new Button(composite,SWT.CHECK);
+ showExperimentalSites.setText(Messages.ProjectExamplesPreferencePage_Show_experimental_sites);
+ showExperimentalSites.setSelection(store.getBoolean(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES));
+
+ showInvalidSites = new Button(composite,SWT.CHECK);
+ showInvalidSites.setText(Messages.ProjectExamplesPreferencePage_Show_invalid_sites);
+ showInvalidSites.setSelection(store.getBoolean(ProjectExamplesActivator.SHOW_INVALID_SITES));
+
+
+
Group sitesGroup = new Group(composite,SWT.NONE);
sitesGroup.setText(Messages.ProjectExamplesPreferencePage_Sites);
GridLayout gl = new GridLayout(2,false);
@@ -165,9 +178,7 @@
viewer.refresh();
}
}
- }
-
-
+ }
});
final Button editButton = new Button(buttonComposite, SWT.PUSH);
editButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -240,6 +251,11 @@
return composite;
}
+ protected void enableControls(Button outputDirectoryBrowse) {
+ outputDirectoryText.setEnabled(!isWorkspace.getSelection());
+ outputDirectoryBrowse.setEnabled(!isWorkspace.getSelection());
+ }
+
public void init(IWorkbench workbench) {
}
@@ -247,6 +263,7 @@
protected void performDefaults() {
showExperimentalSites.setSelection(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES_VALUE);
showInvalidSites.setSelection(ProjectExamplesActivator.SHOW_INVALID_SITES_VALUE);
+ isWorkspace.setSelection(ProjectExamplesActivator.PROJECT_EXAMPLES_DEFAULT_VALUE);
outputDirectoryText.setText(""); //$NON-NLS-1$
sites.getUserSites().clear();
storePreferences();
@@ -263,6 +280,7 @@
IPreferenceStore store = ProjectExamplesActivator.getDefault().getPreferenceStore();
store.setValue(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES, showExperimentalSites.getSelection());
store.setValue(ProjectExamplesActivator.SHOW_INVALID_SITES, showInvalidSites.getSelection());
+ store.setValue(ProjectExamplesActivator.PROJECT_EXAMPLES_DEFAULT, isWorkspace.getSelection());
String value = outputDirectoryText.getText();
if (!value.isEmpty()) {
store.setValue(ProjectExamplesActivator.PROJECT_EXAMPLES_OUTPUT_DIRECTORY, value);
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencesInitializer.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencesInitializer.java 2011-11-28 18:45:41 UTC (rev 36710)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencesInitializer.java 2011-11-28 19:26:32 UTC (rev 36711)
@@ -35,6 +35,9 @@
node.putBoolean(
ProjectExamplesActivator.SHOW_INVALID_SITES,
ProjectExamplesActivator.SHOW_INVALID_SITES_VALUE);
+ node.putBoolean(
+ ProjectExamplesActivator.PROJECT_EXAMPLES_DEFAULT,
+ ProjectExamplesActivator.PROJECT_EXAMPLES_DEFAULT_VALUE);
}
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java 2011-11-28 18:45:41 UTC (rev 36710)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java 2011-11-28 19:26:32 UTC (rev 36711)
@@ -45,6 +45,7 @@
@Override
public boolean performFinish() {
+ page.finishPage();
final List<Project> selectedProjects = new ArrayList<Project>();
if (page.getSelection() == null || page.getSelection().size() <= 0) {
return false;
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java 2011-11-28 18:45:41 UTC (rev 36710)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java 2011-11-28 19:26:32 UTC (rev 36711)
@@ -19,6 +19,7 @@
import java.util.TreeSet;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
@@ -36,6 +37,8 @@
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.GC;
@@ -47,7 +50,9 @@
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Monitor;
import org.eclipse.swt.widgets.Shell;
@@ -72,7 +77,7 @@
*/
public class NewProjectExamplesWizardPage extends WizardPage {
- private static final int DEFAULT_HEIGHT = 400;
+ private static final int DEFAULT_HEIGHT = 430;
private static final int DEFAULT_WIDTH = 600;
private IStructuredSelection selection;
private Button showQuickFixButton;
@@ -84,6 +89,8 @@
private Composite noteComposite;
private List<Category> categories;
private Text descriptionText;
+ private Button isWorkspace;
+ private Text outputDirectoryText;
public NewProjectExamplesWizardPage() {
super("org.jboss.tools.project.examples"); //$NON-NLS-1$
@@ -93,14 +100,65 @@
}
public void createControl(Composite parent) {
-
Composite composite = new Composite(parent,SWT.NONE);
composite.setLayout(new GridLayout(1,false));
-
GridData gd = new GridData(SWT.FILL, SWT.FILL, false, false);
-
composite.setLayoutData(gd);
+ Group outputDirectoryGroup = new Group(composite, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ outputDirectoryGroup.setLayout(layout);
+ outputDirectoryGroup.setText(Messages.ProjectExamplesPreferencePage_Output_directory);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ outputDirectoryGroup.setLayoutData(gd);
+
+ isWorkspace = new Button(outputDirectoryGroup, SWT.CHECK);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ gd.horizontalSpan = 2;
+ isWorkspace.setLayoutData(gd);
+ isWorkspace.setText(Messages.ProjectExamplesPreferencePage_Use_default_workspace_location);
+ isWorkspace.setSelection(ProjectExamplesActivator.getDefault().getPreferenceStore().getBoolean(ProjectExamplesActivator.PROJECT_EXAMPLES_DEFAULT));
+
+ outputDirectoryText = new Text(outputDirectoryGroup, SWT.SINGLE|SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ gd.verticalAlignment = SWT.CENTER;
+ outputDirectoryText.setLayoutData(gd);
+ final IPreferenceStore store = ProjectExamplesActivator.getDefault().getPreferenceStore();
+ String outputDirectoryValue = store.getString(ProjectExamplesActivator.PROJECT_EXAMPLES_OUTPUT_DIRECTORY);
+ outputDirectoryText.setText(outputDirectoryValue == null ? "" : outputDirectoryValue); //$NON-NLS-1$
+ final Button outputDirectoryBrowse = new Button(outputDirectoryGroup, SWT.PUSH);
+ outputDirectoryBrowse.setText(Messages.Browse);
+ outputDirectoryBrowse.addSelectionListener(new SelectionAdapter(){
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.SINGLE);
+ String value = outputDirectoryText.getText();
+ if (value.trim().length() == 0) {
+ value = Platform.getLocation().toOSString();
+ }
+ dialog.setFilterPath(value);
+
+ String result = dialog.open();
+ if (result == null || result.trim().length() == 0) {
+ return;
+ }
+ outputDirectoryText.setText(result);
+
+ }
+
+ });
+ enableControls(outputDirectoryBrowse);
+
+ isWorkspace.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ enableControls(outputDirectoryBrowse);
+ }
+
+ });
+
Composite siteComposite = new Composite(composite,SWT.NONE);
GridLayout gridLayout = new GridLayout(2,false);
gridLayout.marginHeight = 0;
@@ -114,7 +172,6 @@
gd.horizontalSpan = 2;
button.setLayoutData(gd);
button.setText(Messages.ProjectExamplesPreferencePage_Show_experimental_sites);
- IPreferenceStore store = ProjectExamplesActivator.getDefault().getPreferenceStore();
button.setSelection(store.getBoolean(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES));
new Label(siteComposite,SWT.NONE).setText(Messages.NewProjectExamplesWizardPage_Site);
@@ -304,6 +361,11 @@
refresh(viewer, true);
siteCombo.setText(ProjectExamplesActivator.ALL_SITES);
}
+
+ protected void enableControls(Button outputDirectoryBrowse) {
+ outputDirectoryText.setEnabled(!isWorkspace.getSelection());
+ outputDirectoryBrowse.setEnabled(!isWorkspace.getSelection());
+ }
private void configureSizeAndLocation() {
Shell shell = getContainer().getShell();
@@ -575,4 +637,12 @@
noteText.setText(Messages.NewProjectExamplesWizardPage_Note);
details.setEnabled(true);
}
+
+ public void finishPage() {
+ final IPreferenceStore store = ProjectExamplesActivator.getDefault().getPreferenceStore();
+ store.setValue(ProjectExamplesActivator.PROJECT_EXAMPLES_DEFAULT, isWorkspace.getSelection());
+ if (outputDirectoryText.getText().trim().length() > 0) {
+ store.setValue(ProjectExamplesActivator.PROJECT_EXAMPLES_OUTPUT_DIRECTORY, outputDirectoryText.getText());
+ }
+ }
}
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 2011-11-28 18:45:41 UTC (rev 36710)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizard.java 2011-11-28 19:26:32 UTC (rev 36711)
@@ -42,10 +42,12 @@
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkingSet;
+import org.jboss.tools.maven.project.examples.ImportMavenArchetypeProjectExample;
import org.jboss.tools.maven.project.examples.MavenProjectExamplesActivator;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
import org.jboss.tools.project.examples.model.Project;
@@ -58,7 +60,6 @@
public class ArchetypeExamplesWizard extends Wizard implements INewWizard {
private Project projectDescription;
- //private File location;
private ProjectImportConfiguration configuration;
private ArchetypeExamplesWizardFirstPage simplePage;
private ArchetypeExamplesWizardPage wizardPage;
@@ -66,13 +67,11 @@
private String projectName;
private String artifactId;
-
public ArchetypeExamplesWizard(File location, Project projectDescription) {
super();
setWindowTitle("New JBoss project");
setDefaultPageImageDescriptor(MavenImages.WIZ_NEW_PROJECT);
setNeedsProgressMonitor(true);
- //this.location = location;
this.projectDescription = projectDescription;
}
@@ -167,7 +166,11 @@
configuration.getResolverConfiguration().setActiveProfiles(profiles);
}
simplePage = new ArchetypeExamplesWizardFirstPage(configuration, projectDescription, workingSets);
- addPage(simplePage);
+ addPage(simplePage);
+ String location = ProjectExamplesActivator.getDefault().getPreferenceStore().getString(ProjectExamplesActivator.PROJECT_EXAMPLES_OUTPUT_DIRECTORY);
+ if (location != null && location.trim().length() > 0) {
+ simplePage.setLocationPath(new Path(location));
+ }
wizardPage = new ArchetypeExamplesWizardPage(configuration, projectDescription);
wizardPage.setPageComplete(true);//We want to enable the finish button early
addPage(wizardPage);
@@ -210,4 +213,10 @@
public String getArtifactId() {
return artifactId;
}
+
+ @Override
+ public void createPageControls(Composite pageContainer) {
+ super.createPageControls(pageContainer);
+ simplePage.setUseDefaultWorkspaceLocation(ProjectExamplesActivator.getDefault().getPreferenceStore().getBoolean(ProjectExamplesActivator.PROJECT_EXAMPLES_DEFAULT));
+ }
}
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 2011-11-28 18:45:41 UTC (rev 36710)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizardFirstPage.java 2011-11-28 19:26:32 UTC (rev 36711)
@@ -10,6 +10,7 @@
************************************************************************************/
package org.jboss.tools.maven.project.examples.wizard;
+import java.lang.reflect.Field;
import java.net.URL;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -37,8 +38,10 @@
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.ui.IWorkingSet;
@@ -49,6 +52,7 @@
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.internal.facets.FacetUtil;
import org.jboss.ide.eclipse.as.core.util.RuntimeUtils;
+import org.jboss.tools.maven.project.examples.MavenProjectExamplesActivator;
import org.jboss.tools.maven.project.examples.Messages;
import org.jboss.tools.project.examples.model.Project;
@@ -326,4 +330,19 @@
this.propertyModifyListener = propertyModifyListener;
}
+ public void setUseDefaultWorkspaceLocation(boolean value) {
+ Class clazz = MavenProjectWizardLocationPage.class;
+ try {
+ Field field = clazz.getDeclaredField("useDefaultWorkspaceLocationButton"); //$NON-NLS-1$
+ field.setAccessible(true);
+ Object useDefaultWorkspaceLocation = field.get(this);
+ if (useDefaultWorkspaceLocation instanceof Button) {
+ Button useDefaultWorkspaceLocationButton = (Button) useDefaultWorkspaceLocation;
+ useDefaultWorkspaceLocationButton.setSelection(value);
+ useDefaultWorkspaceLocationButton.notifyListeners(SWT.Selection, new Event());
+ }
+ } catch (Exception e) {
+ MavenProjectExamplesActivator.log(e);
+ }
+ }
}
13 years, 1 month
JBoss Tools SVN: r36710 - in trunk/forge/plugins/org.jboss.tools.forge.ui: src/org/jboss/tools/forge/ui/console and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-11-28 13:45:41 -0500 (Mon, 28 Nov 2011)
New Revision: 36710
Modified:
trunk/forge/plugins/org.jboss.tools.forge.ui/META-INF/MANIFEST.MF
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/OpenPostProcessor.java
Log:
JBIDE-10203: Open Command Should Show File in Editor or Expand Folder in Explorer
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/META-INF/MANIFEST.MF 2011-11-28 17:27:12 UTC (rev 36709)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/META-INF/MANIFEST.MF 2011-11-28 18:45:41 UTC (rev 36710)
@@ -17,7 +17,11 @@
org.eclipse.ui.views,
org.jboss.tools.forge.core;bundle-version="1.0.0",
org.eclipse.core.filesystem;bundle-version="1.3.100",
- org.eclipse.ui.navigator;bundle-version="3.5.100"
+ org.eclipse.ui.navigator;bundle-version="3.5.100",
+ org.eclipse.rse.ui;bundle-version="3.2.1",
+ org.eclipse.rse.core;bundle-version="3.2.1",
+ org.eclipse.rse.subsystems.files.core;bundle-version="3.2.101",
+ org.eclipse.rse.subsystems.files.local;bundle-version="2.1.200"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.jboss.tools.forge.ui.ForgeUIPlugin
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/OpenPostProcessor.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/OpenPostProcessor.java 2011-11-28 17:27:12 UTC (rev 36709)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/OpenPostProcessor.java 2011-11-28 18:45:41 UTC (rev 36710)
@@ -1,18 +1,24 @@
package org.jboss.tools.forge.ui.console;
import java.io.File;
+import java.util.ArrayList;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.ui.view.IRSEViewPart;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.rse.ui.view.SystemAdapterHelpers;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
@@ -24,34 +30,45 @@
public class OpenPostProcessor {
public void postProcess(String line, String currentResourcePath) {
- String resourceToOpen = currentResourcePath + File.separator + line.substring(5).trim();
+ String resourceToOpen = line.substring(5).trim();
+ if (!resourceToOpen.startsWith("/")) {
+ resourceToOpen = currentResourcePath + File.separator + resourceToOpen;
+ }
IPath path = new Path(resourceToOpen);
IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(resourceToOpen));
if (fileStore.fetchInfo().isDirectory()) {
- expandDirectoryInExplorer(path);
+ IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(path);
+ if (container != null) {
+ expandWorkspaceDirectory(container);
+ } else {
+ expandSystemDirectory(fileStore);
+ }
} else {
openFileInEditor(fileStore);
}
}
- private void openFileInEditor(IFileStore fileStore) {
- try {
- IWorkbenchPage workbenchPage = ForgeCommandPostProcessorHelper.getActiveWorkbenchPage();
- if (workbenchPage != null) {
- IDE.openEditorOnFileStore(workbenchPage, fileStore);
+ private void expandSystemDirectory(IFileStore fileStore) {
+ IWorkbenchPage workbenchPage = ForgeCommandPostProcessorHelper.getActiveWorkbenchPage();
+ IViewPart remoteSystemView = workbenchPage.findView("org.eclipse.rse.ui.view.systemView");
+ if (remoteSystemView == null) {
+ try {
+ remoteSystemView = workbenchPage.showView("org.eclipse.rse.ui.view.systemView");
+ } catch (PartInitException e) {
+ ForgeUIPlugin.log(e);
}
- } catch (PartInitException e) {
- ForgeUIPlugin.log(e);
}
+ if (remoteSystemView != null) {
+ expandInRemoteSystemView(remoteSystemView, fileStore);
+ }
}
- private void expandDirectoryInExplorer(IPath path) {
+ private void expandWorkspaceDirectory(IContainer container) {
IWorkbenchPage workbenchPage = ForgeCommandPostProcessorHelper.getActiveWorkbenchPage();
- IContainer objectToSelect = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(path);
- if (objectToSelect != null && workbenchPage != null) {
+ if (workbenchPage != null) {
IViewPart projectExplorer = workbenchPage.findView("org.eclipse.ui.navigator.ProjectExplorer");
if (projectExplorer != null && projectExplorer instanceof CommonNavigator) {
- expandInProjectExplorer((CommonNavigator)projectExplorer, objectToSelect);
+ expandInProjectExplorer((CommonNavigator)projectExplorer, container);
}
IViewPart packageExplorer = workbenchPage.findView("org.eclipse.jdt.ui.PackageExplorer");
if (packageExplorer == null && projectExplorer == null) {
@@ -62,11 +79,22 @@
}
}
if (packageExplorer != null) {
- expandInPackageExplorer(packageExplorer, objectToSelect);
+ expandInPackageExplorer(packageExplorer, container);
}
}
}
+ private void openFileInEditor(IFileStore fileStore) {
+ try {
+ IWorkbenchPage workbenchPage = ForgeCommandPostProcessorHelper.getActiveWorkbenchPage();
+ if (workbenchPage != null) {
+ IDE.openEditorOnFileStore(workbenchPage, fileStore);
+ }
+ } catch (PartInitException e) {
+ ForgeUIPlugin.log(e);
+ }
+ }
+
private void expandInProjectExplorer(CommonNavigator projectExplorer, IContainer container) {
projectExplorer.selectReveal(new StructuredSelection(container));
TreeViewer treeViewer = projectExplorer.getCommonViewer();
@@ -83,4 +111,58 @@
}
}
+ private Viewer getViewer(IViewPart remoteSystemView) {
+ if (remoteSystemView instanceof IRSEViewPart) {
+ return ((IRSEViewPart)remoteSystemView).getRSEViewer();
+ } else {
+ return null;
+ }
+ }
+
+ private ArrayList<String> createSegmentNames(IFileStore fileStore) {
+ ArrayList<String> result = new ArrayList<String>();
+ while (fileStore.getParent() != null) {
+ result.add(0, fileStore.getName());
+ fileStore = fileStore.getParent();
+ }
+ result.add(0, "/");
+ result.add(0, "Root");
+ result.add(0, "Local Files");
+ result.add(0, "Local");
+ return result;
+ }
+
+ private void expandInRemoteSystemView(
+ IViewPart remoteSystemView,
+ IFileStore fileStore) {
+ Viewer viewer = getViewer(remoteSystemView);
+ Object input = viewer.getInput();
+ ArrayList<String> names = createSegmentNames(fileStore);
+ ArrayList<Object> treeSegments = new ArrayList<Object>();
+ for (String name : names) {
+ if (input != null && input instanceof IAdaptable) {
+ ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(input);
+ for (Object object : adapter.getChildren((IAdaptable)input, null)) {
+ if (object instanceof IAdaptable) {
+ adapter = SystemAdapterHelpers.getViewAdapter(object);
+ if (name.equals(adapter.getText(object))) {
+ input = object;
+ treeSegments.add(input);
+ break;
+ }
+ }
+ }
+ } else {
+ treeSegments.clear();
+ break;
+ }
+ }
+ TreePath treePath = new TreePath(treeSegments.toArray());
+ viewer.setSelection(new StructuredSelection(treePath));
+ if (viewer instanceof TreeViewer) {
+ ((TreeViewer)viewer).expandToLevel(treePath, 1);
+
+ }
+ }
+
}
13 years, 1 month
JBoss Tools SVN: r36709 - trunk/build/target-platform.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-11-28 12:27:12 -0500 (Mon, 28 Nov 2011)
New Revision: 36709
Modified:
trunk/build/target-platform/jbds.target
trunk/build/target-platform/jbds.target.p2mirror.xml
trunk/build/target-platform/multiple.target
trunk/build/target-platform/multiple.target.p2mirror.xml
trunk/build/target-platform/unified.target
trunk/build/target-platform/unified.target.p2mirror.xml
Log:
remove org.eclipse.objectteams.otdt.core.patch.feature.group from TPs - should not have been added as hackaround
Modified: trunk/build/target-platform/jbds.target
===================================================================
--- trunk/build/target-platform/jbds.target 2011-11-28 17:14:32 UTC (rev 36708)
+++ trunk/build/target-platform/jbds.target 2011-11-28 17:27:12 UTC (rev 36709)
@@ -83,7 +83,6 @@
<unit id="org.eclipse.platform.feature.group" version="3.7.1.r37x_v20110729-9gF7UHOxFtniV7mI3T556iZN9AU8bEZ1lHMcVK"/>
<unit id="org.eclipse.cvs.feature.group" version="1.3.100.v20110520-0800-7B78FHk8sF7BB7VAH5AYC5"/>
<unit id="org.eclipse.jdt.feature.group" version="3.7.1.r371_v20110810-0800-7z8gFcoFMLfTabvKsR5Qm9rBGEBK"/>
- <unit id="org.eclipse.objectteams.otdt.core.patch.feature.group" version="2.0.1.201109101025"/>
<unit id="org.eclipse.equinox.executable.feature.group" version="3.5.0.v20110530-7P7NFUFFLWUl76mart"/>
<unit id="org.eclipse.equinox.p2.user.ui.feature.group" version="2.1.2.R37x_v20110815-1155-6-Bj9JXOeQxOURYC-l9BL7rDEQO7"/>
<unit id="org.eclipse.rcp.feature.group" version="3.7.1.r37x_v20110729-9DB5FmNFnFLSFCtLxnRfMqt15A4A"/>
Modified: trunk/build/target-platform/jbds.target.p2mirror.xml
===================================================================
--- trunk/build/target-platform/jbds.target.p2mirror.xml 2011-11-28 17:14:32 UTC (rev 36708)
+++ trunk/build/target-platform/jbds.target.p2mirror.xml 2011-11-28 17:27:12 UTC (rev 36709)
@@ -83,7 +83,6 @@
<iu id="org.eclipse.platform.feature.group" version=""/>
<iu id="org.eclipse.cvs.feature.group" version=""/>
<iu id="org.eclipse.jdt.feature.group" version=""/>
-<iu id="org.eclipse.objectteams.otdt.core.patch.feature.group" version=""/>
<iu id="org.eclipse.equinox.executable.feature.group" version=""/>
<iu id="org.eclipse.equinox.p2.user.ui.feature.group" version=""/>
<iu id="org.eclipse.rcp.feature.group" version=""/>
Modified: trunk/build/target-platform/multiple.target
===================================================================
--- trunk/build/target-platform/multiple.target 2011-11-28 17:14:32 UTC (rev 36708)
+++ trunk/build/target-platform/multiple.target 2011-11-28 17:27:12 UTC (rev 36709)
@@ -97,7 +97,6 @@
<unit id="org.eclipse.sdk.examples.source.feature.group" version="3.4.0.v20110121"/>
<unit id="org.eclipse.cvs.feature.group" version="1.3.100.v20110207-7B78FGB8sF7BB7I8H58WG5"/>
<unit id="org.eclipse.jdt.feature.group" version="3.7.0.v20110208-0800-7z8gFb7FMTfEULpkdZIlQtX9H155"/>
- <unit id="org.eclipse.objectteams.otdt.core.patch.feature.group" version="2.0.1.201109101025"/>
<unit id="org.eclipse.equinox.server.core.feature.group" version="1.1.1.R37x_v20110907-7K7TFBYDzbeA3ypK_98cDL15A4A"/>
<unit id="org.eclipse.equinox.executable.feature.group" version="3.5.0.v20101220-7P7NFUFFLWUl6m499UD1941"/>
<unit id="org.eclipse.equinox.compendium.sdk.feature.group" version="3.7.1.R37x_v20110909-7X7XGA3FNKoMz-UVh-nB7ZBJ"/>
Modified: trunk/build/target-platform/multiple.target.p2mirror.xml
===================================================================
--- trunk/build/target-platform/multiple.target.p2mirror.xml 2011-11-28 17:14:32 UTC (rev 36708)
+++ trunk/build/target-platform/multiple.target.p2mirror.xml 2011-11-28 17:27:12 UTC (rev 36709)
@@ -96,7 +96,6 @@
<iu id="org.eclipse.sdk.examples.source.feature.group" version=""/>
<iu id="org.eclipse.cvs.feature.group" version=""/>
<iu id="org.eclipse.jdt.feature.group" version=""/>
-<iu id="org.eclipse.objectteams.otdt.core.patch.feature.group" version=""/>
<iu id="org.eclipse.equinox.server.core.feature.group" version=""/>
<iu id="org.eclipse.equinox.executable.feature.group" version=""/>
<iu id="org.eclipse.equinox.compendium.sdk.feature.group" version=""/>
Modified: trunk/build/target-platform/unified.target
===================================================================
--- trunk/build/target-platform/unified.target 2011-11-28 17:14:32 UTC (rev 36708)
+++ trunk/build/target-platform/unified.target 2011-11-28 17:27:12 UTC (rev 36709)
@@ -97,7 +97,6 @@
<unit id="org.eclipse.sdk.examples.source.feature.group" version="3.4.0.v20110121"/>
<unit id="org.eclipse.cvs.feature.group" version="1.3.100.v20110207-7B78FGB8sF7BB7I8H58WG5"/>
<unit id="org.eclipse.jdt.feature.group" version="3.7.0.v20110208-0800-7z8gFb7FMTfEULpkdZIlQtX9H155"/>
- <unit id="org.eclipse.objectteams.otdt.core.patch.feature.group" version="2.0.1.201109101025"/>
<unit id="org.eclipse.equinox.server.core.feature.group" version="1.1.1.R37x_v20110907-7K7TFBYDzbeA3ypK_98cDL15A4A"/>
<unit id="org.eclipse.equinox.executable.feature.group" version="3.5.0.v20101220-7P7NFUFFLWUl6m499UD1941"/>
<unit id="org.eclipse.equinox.compendium.sdk.feature.group" version="3.7.1.R37x_v20110909-7X7XGA3FNKoMz-UVh-nB7ZBJ"/>
Modified: trunk/build/target-platform/unified.target.p2mirror.xml
===================================================================
--- trunk/build/target-platform/unified.target.p2mirror.xml 2011-11-28 17:14:32 UTC (rev 36708)
+++ trunk/build/target-platform/unified.target.p2mirror.xml 2011-11-28 17:27:12 UTC (rev 36709)
@@ -116,7 +116,6 @@
<iu id="org.eclipse.cvs.feature.group" version=""/>
<iu id="org.eclipse.help.feature.group" version=""/>
<iu id="org.eclipse.jdt.feature.group" version=""/>
-<iu id="org.eclipse.objectteams.otdt.core.patch.feature.group" version=""/>
<iu id="org.eclipse.platform.feature.group" version=""/>
<iu id="org.eclipse.platform.ide" version=""/>
<iu id="org.eclipse.equinox.executable.feature.group" version=""/>
13 years, 1 month
JBoss Tools SVN: r36708 - in trunk/openshift/plugins: org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2011-11-28 12:14:32 -0500 (Mon, 28 Nov 2011)
New Revision: 36708
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.client/org.jboss.tools.openshift.express.client-2.3.0-SNAPSHOT.jar
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java
Log:
Resolved JBIDE-9929 Check if the newly created DNS entry actually starts responding a few times before giving control back to user
https://issues.jboss.org/browse/JBIDE-9929
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.client/org.jboss.tools.openshift.express.client-2.3.0-SNAPSHOT.jar
===================================================================
(Binary files differ)
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardModel.java 2011-11-28 16:58:13 UTC (rev 36707)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardModel.java 2011-11-28 17:14:32 UTC (rev 36708)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
+import java.net.MalformedURLException;
+
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
import org.jboss.tools.openshift.express.client.IApplication;
import org.jboss.tools.openshift.express.client.ICartridge;
@@ -23,6 +25,12 @@
public static final String PROPERTY_APPLICATION = "application";
+ /**
+ * Timeout in seconds when trying to contact an application after it had
+ * been created.
+ */
+ private static final int APP_CREATION_TIMEOUT = 10;
+
private IUser user;
private IApplication application;
private String name;
@@ -40,7 +48,7 @@
public IUser getUser() {
return user;
}
-
+
public String getName() {
return name;
}
@@ -48,14 +56,20 @@
public String setName(String name) {
return this.name = name;
}
-
+
public void setCartridge(ICartridge cartridge) {
this.cartridge = cartridge;
}
public void createApplication() throws OpenShiftException {
IApplication application = createApplication(name, cartridge);
- setApplication(application);
+ final boolean isApplicationAvailable = application.waitForAccessible(APP_CREATION_TIMEOUT * 1000);
+ if (isApplicationAvailable) {
+ setApplication(application);
+ } else {
+ throw new OpenShiftException("The URL {0} did not respond within {1}s after the application creation.",
+ application.getApplicationUrl(), APP_CREATION_TIMEOUT);
+ }
}
public void setApplication(IApplication application) {
@@ -65,11 +79,11 @@
public IApplication getApplication() {
return application;
}
-
+
public IApplication createApplication(String name, ICartridge cartridge) throws OpenShiftException {
return getUser().createApplication(name, cartridge);
}
-
+
public boolean hasApplication(String name) throws OpenShiftException {
return user.hasApplication(name);
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java 2011-11-28 16:58:13 UTC (rev 36707)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java 2011-11-28 17:14:32 UTC (rev 36708)
@@ -174,7 +174,7 @@
return Status.OK_STATUS;
} catch (OpenShiftException e) {
applicationCreated.offer(false);
- return OpenShiftUIActivator.createErrorStatus("Could not create application \"{0}\"", e,
+ return OpenShiftUIActivator.createErrorStatus("Could not create application \"{0}\"", (Throwable)e,
wizardModel.getName());
}
}
13 years, 1 month
JBoss Tools SVN: r36707 - trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-11-28 11:58:13 -0500 (Mon, 28 Nov 2011)
New Revision: 36707
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
Log:
JBIDE-10224 JBIDE-10253 - revert of source path modification
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath 2011-11-28 16:57:32 UTC (rev 36706)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath 2011-11-28 16:58:13 UTC (rev 36707)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="jboss-as-controller-client-7.0.0.Final.jar"/>
- <classpathentry exported="true" kind="lib" path="jboss-as-protocol-7.0.0.Final.jar" sourcepath="/home/rob/code/jboss/as7/jboss-as/protocol"/>
+ <classpathentry exported="true" kind="lib" path="jboss-as-protocol-7.0.0.Final.jar"/>
<classpathentry exported="true" kind="lib" path="jboss-dmr-1.0.0.Final.jar"/>
<classpathentry exported="true" kind="lib" path="jboss-logging-3.0.0.GA.jar"/>
<classpathentry exported="true" kind="lib" path="jboss-marshalling-1.3.0.GA.jar"/>
13 years, 1 month
JBoss Tools SVN: r36706 - in trunk/as: plugins/org.jboss.ide.eclipse.as.management.as7 and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-11-28 11:57:32 -0500 (Mon, 28 Nov 2011)
New Revision: 36706
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/IJBoss7ManagerService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerServiceProxy.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/JBoss71ManagerService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java
Log:
JBIDE-10224 JBIDE-10253 - work for as7.1 incompatible with 7.0 jars
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/IJBoss7ManagerService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/IJBoss7ManagerService.java 2011-11-28 16:37:54 UTC (rev 36705)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/IJBoss7ManagerService.java 2011-11-28 16:57:32 UTC (rev 36706)
@@ -22,6 +22,8 @@
public static final String AS_VERSION_710_Beta = "710.beta1"; //$NON-NLS-1$
public static final int MGMT_PORT = 9999;
+ public void init() throws Exception;
+
/**
* Asynchronously deploy a file to a server
* @param host
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerServiceProxy.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerServiceProxy.java 2011-11-28 16:37:54 UTC (rev 36705)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerServiceProxy.java 2011-11-28 16:57:32 UTC (rev 36706)
@@ -31,6 +31,10 @@
.format("(&(objectClass={0})(as.version={1}))", IJBoss7ManagerService.class.getCanonicalName(), asVersion)), null); //$NON-NLS-1$
}
+ public void init() throws Exception {
+ checkedGetService().init();
+ }
+
public IJBoss7DeploymentResult deployAsync(String host, int port, String deploymentName, File file,
IProgressMonitor monitor) throws Exception {
return checkedGetService().deployAsync(host, port, deploymentName, file, monitor);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerUtil.java 2011-11-28 16:37:54 UTC (rev 36705)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/v7/management/JBoss7ManagerUtil.java 2011-11-28 16:57:32 UTC (rev 36706)
@@ -20,7 +20,9 @@
private static final String JBOSS7_RUNTIME = "org.jboss.ide.eclipse.as.runtime.70"; //$NON-NLS-1$
private static final String JBOSS71_RUNTIME = "org.jboss.ide.eclipse.as.runtime.71"; //$NON-NLS-1$
private static final String EAP6_RUNTIME = "org.jboss.ide.eclipse.as.runtime.eap.60"; //$NON-NLS-1$
+ private static final int UNLIKELY_PORT = 65401;
+
public static IJBoss7ManagerService getService(IServer server) throws InvalidSyntaxException {
BundleContext context = JBossServerCorePlugin.getContext();
JBoss7ManagerServiceProxy proxy = new JBoss7ManagerServiceProxy(context, getRequiredVersion(server));
@@ -33,22 +35,25 @@
/* HUUUUUUUUGE HACK */
private synchronized static void skipLazyInit() {
if( !initialized ) {
+
// Testing to see if forcing the proxy open will
BundleContext context = JBossServerCorePlugin.getContext();
JBoss7ManagerServiceProxy proxy = null;
try {
proxy = new JBoss7ManagerServiceProxy(context, IJBoss7ManagerService.AS_VERSION_710_Beta);
proxy.open();
- proxy.getServerState("localhost", 9999); //$NON-NLS-1$
+ //proxy.getServerState("localhost", UNLIKELY_PORT); //$NON-NLS-1$
+ proxy.init();
} catch( Exception e ) {
- e.printStackTrace();
+ // ignore, expected failure
}
try {
proxy = new JBoss7ManagerServiceProxy(context, IJBoss7ManagerService.AS_VERSION_700);
proxy.open();
- proxy.getServerState("localhost", 9999); //$NON-NLS-1$
+ //proxy.getServerState("localhost", UNLIKELY_PORT); //$NON-NLS-1$
+ proxy.init();
} catch(Exception e ) {
- e.printStackTrace();
+ // ignore, expected failure
}
initialized = true;
}
@@ -84,9 +89,7 @@
}
public static interface IServiceAware<RESULT> {
-
public RESULT execute(IJBoss7ManagerService service) throws Exception;
-
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath 2011-11-28 16:37:54 UTC (rev 36705)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath 2011-11-28 16:57:32 UTC (rev 36706)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="jboss-as-controller-client-7.0.0.Final.jar"/>
- <classpathentry exported="true" kind="lib" path="jboss-as-protocol-7.0.0.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="jboss-as-protocol-7.0.0.Final.jar" sourcepath="/home/rob/code/jboss/as7/jboss-as/protocol"/>
<classpathentry exported="true" kind="lib" path="jboss-dmr-1.0.0.Final.jar"/>
<classpathentry exported="true" kind="lib" path="jboss-logging-3.0.0.GA.jar"/>
<classpathentry exported="true" kind="lib" path="jboss-marshalling-1.3.0.GA.jar"/>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java 2011-11-28 16:37:54 UTC (rev 36705)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java 2011-11-28 16:57:32 UTC (rev 36706)
@@ -65,9 +65,6 @@
public AS7Manager(String host, int port) throws UnknownHostException {
this.client = ModelControllerClient.Factory.create(host, port);
this.manager = ServerDeploymentManager.Factory.create(client);
- System.out.println("70 client class: " + client.getClass());
- System.out.println("70 manager class: " + manager.getClass());
-
}
public IJBoss7DeploymentResult undeploySync(String name, IProgressMonitor monitor)
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java 2011-11-28 16:37:54 UTC (rev 36705)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/JBoss7ManagerService.java 2011-11-28 16:57:32 UTC (rev 36706)
@@ -23,6 +23,9 @@
* @author Rob Stryker
*/
public class JBoss7ManagerService implements IJBoss7ManagerService {
+ public void init() throws Exception {
+ }
+
public IJBoss7DeploymentResult deployAsync(String host, int port, String deploymentName,
File file, IProgressMonitor monitor) throws Exception {
AS7Manager manager = new AS7Manager(host, port);
@@ -116,7 +119,7 @@
}
}
- @Override
public void dispose() {
}
+
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java 2011-11-28 16:37:54 UTC (rev 36705)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java 2011-11-28 16:57:32 UTC (rev 36706)
@@ -33,6 +33,14 @@
import java.util.Set;
import java.util.concurrent.Future;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.sasl.RealmCallback;
+import javax.security.sasl.RealmChoiceCallback;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osgi.util.NLS;
import org.jboss.as.controller.client.ModelControllerClient;
@@ -63,12 +71,39 @@
}
public AS71Manager(String host, int port) throws UnknownHostException {
- this.client = ModelControllerClient.Factory.create(host, port);
+ this.client = ModelControllerClient.Factory.create(host, port,getCallbackHandler());
this.manager = ServerDeploymentManager.Factory.create(client);
- System.out.println("71 client class: " + client.getClass());
- System.out.println("71 client class: " + manager.getClass());
}
+ protected CallbackHandler getCallbackHandler() {
+ return new Tools71CallbackHandler();
+ }
+
+ protected class Tools71CallbackHandler implements CallbackHandler {
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ if (callbacks.length == 1 && callbacks[0] instanceof NameCallback) {
+ ((NameCallback) callbacks[0]).setName("anonymous JBossTools user");
+ return;
+ }
+
+ NameCallback name = null;
+ PasswordCallback pass = null;
+ for (Callback current : callbacks) {
+ if (current instanceof NameCallback) {
+ name = (NameCallback) current;
+ } else if (current instanceof PasswordCallback) {
+ pass = (PasswordCallback) current;
+ }
+ }
+ // TODO get the username
+ String username, password;
+ username = password = "test";
+ name.setName(username);
+ pass.setPassword(password.toCharArray());
+ }
+ }
+
public IJBoss7DeploymentResult undeploySync(String name, IProgressMonitor monitor)
throws JBoss7ManangerException {
IJBoss7DeploymentResult result = undeploy(name);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/JBoss71ManagerService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/JBoss71ManagerService.java 2011-11-28 16:37:54 UTC (rev 36705)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/JBoss71ManagerService.java 2011-11-28 16:57:32 UTC (rev 36706)
@@ -11,18 +11,27 @@
package org.jboss.ide.eclipse.as.internal.management.as71;
import java.io.File;
+import java.security.Security;
import org.eclipse.core.runtime.IProgressMonitor;
import org.jboss.ide.eclipse.as.core.server.v7.management.IJBoss7DeploymentResult;
import org.jboss.ide.eclipse.as.core.server.v7.management.IJBoss7ManagerService;
import org.jboss.ide.eclipse.as.core.server.v7.management.JBoss7DeploymentState;
import org.jboss.ide.eclipse.as.core.server.v7.management.JBoss7ServerState;
+import org.jboss.sasl.JBossSaslProvider;
/**
* @author Rob Stryker
*/
public class JBoss71ManagerService implements IJBoss7ManagerService {
+ public void init() throws Exception {
+ JBossSaslProvider saslProvider = new JBossSaslProvider();
+ if (Security.getProvider(saslProvider.getName()) == null) {
+ Security.insertProviderAt(saslProvider, 1);
+ }
+ }
+
public IJBoss7DeploymentResult deployAsync(String host, int port, String deploymentName,
File file, IProgressMonitor monitor) throws Exception {
AS71Manager manager = new AS71Manager(host, port);
@@ -119,4 +128,5 @@
@Override
public void dispose() {
}
+
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2011-11-28 16:37:54 UTC (rev 36705)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2011-11-28 16:57:32 UTC (rev 36706)
@@ -59,6 +59,7 @@
public static String rwf_homeMissingFiles;
public static String rwf_jboss7homeNotValid;
public static String rwf_homeIncorrectVersion;
+ public static String rwf_homeIncorrectVersionError;
public static String rwf_nameTextBlank;
public static String rwf_homeDirBlank;
public static String rwf_NoVMSelected;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2011-11-28 16:37:54 UTC (rev 36705)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2011-11-28 16:57:32 UTC (rev 36706)
@@ -17,6 +17,7 @@
rwf_homeMissingFiles=The home directory does not exist or is missing a required file or folder: {0}
rwf_jboss7homeNotValid=The home directory does not point to a valid JBoss installation.
rwf_homeIncorrectVersion=This server type expects a version of {0} but the server directory is of version {1}.
+rwf_homeIncorrectVersionError=This server type expects a version of {0} but the server directory is of version {1}. This combination may cause critical errors.
rwf_nameTextBlank=The name field must not be blank
rwf_homeDirBlank=The directory field must not be blank
rwf_NoVMSelected=No VM selected
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java 2011-11-28 16:37:54 UTC (rev 36705)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java 2011-11-28 16:57:32 UTC (rev 36706)
@@ -183,6 +183,11 @@
configDirTextVal = configDirText.getText();
updateErrorMessage();
}
+ protected String getWarningString() {
+ if( getHomeVersionWarning() != null )
+ return getHomeVersionWarning();
+ return null;
+ }
protected String getErrorString() {
if (nameText == null)
@@ -207,6 +212,21 @@
return Messages.bind(Messages.rwf7_ConfigFileError, actualPath.toString());
}
}
+
+ // Forced error strings for as7.0 and 7.1 incompatabilities.
+ File loc = new File(homeDir, getSystemJarPath() );
+ String version = getVersionString(loc);
+ IRuntime rt = (IRuntime) getTaskModel().getObject(
+ TaskModel.TASK_RUNTIME);
+ String adapterVersion = rt.getRuntimeType().getVersion();
+
+ if(!isEAP() && (adapterVersion.equals("7.0") && !version.startsWith("7.0."))
+ || (adapterVersion.equals("7.1") && version.startsWith("7.0."))) {
+ return NLS.bind(Messages.rwf_homeIncorrectVersionError, adapterVersion, version);
+ }
+ if( isEAP() && (adapterVersion.equals("6.0") && version.startsWith("7.0.")))
+ return NLS.bind(Messages.rwf_homeIncorrectVersionError, adapterVersion, version);
+
return null;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2011-11-28 16:37:54 UTC (rev 36705)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2011-11-28 16:57:32 UTC (rev 36706)
@@ -664,7 +664,10 @@
IRuntime rt = (IRuntime) getTaskModel().getObject(
TaskModel.TASK_RUNTIME);
String v = rt.getRuntimeType().getVersion();
-
+ return getHomeVersionWarning(version, v);
+ }
+
+ protected String getHomeVersionWarning(String version, String v) {
/*
* CHEAP WARNING HACK -
* EAP 5.0 was started as named 5.0, but is now 5.x.
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java 2011-11-28 16:37:54 UTC (rev 36705)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/JBossManagerTest.java 2011-11-28 16:57:32 UTC (rev 36706)
@@ -117,5 +117,8 @@
public void dispose() {
}
+
+ public void init() throws Exception {
+ }
}
}
13 years, 1 month
JBoss Tools SVN: r36704 - in trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test: src/org/jboss/tools/portlet/ui/bot/task/wizard/web and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2011-11-28 11:20:45 -0500 (Mon, 28 Nov 2011)
New Revision: 36704
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/web/seam/
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/web/seam/Seam2FacetWizardPageFillingTask.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/SeamPortletTestSuite.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletProject.java
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/resources/aaa
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletProject.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletProjectTemplate.java
Log:
Created new test for Seam project portlet
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/resources/aaa
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/resources/aaa 2011-11-28 16:20:04 UTC (rev 36703)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/resources/aaa 2011-11-28 16:20:45 UTC (rev 36704)
@@ -1 +1,3 @@
SERVER=EPP,5.1.0,default,/home/ljelinko/programs/jboss/jboss-epp-5.1/jboss-as
+SEAM=2.2,/home/ljelinko/programs/jboss/jboss-epp-5.1/seam
+DB=hsqldb18,internal, , , , ,
\ No newline at end of file
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/web/seam/Seam2FacetWizardPageFillingTask.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/web/seam/Seam2FacetWizardPageFillingTask.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/web/seam/Seam2FacetWizardPageFillingTask.java 2011-11-28 16:20:45 UTC (rev 36704)
@@ -0,0 +1,47 @@
+package org.jboss.tools.portlet.ui.bot.task.wizard.web.seam;
+
+import org.jboss.tools.portlet.ui.bot.task.AbstractSWTTask;
+import org.jboss.tools.portlet.ui.bot.task.wizard.WizardPageFillingTask;
+
+/**
+ * Fills in the Seam configuration on the Seam Facet wizard page.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class Seam2FacetWizardPageFillingTask extends AbstractSWTTask
+ implements WizardPageFillingTask {
+
+ private String runtime;
+
+ private String databaseType;
+
+ private String connectionProfile;
+
+ @Override
+ public void perform() {
+ if (runtime != null){
+ getBot().comboBoxWithLabel("Seam 2 Runtime:").setSelection(runtime);
+ }
+
+ if (databaseType != null){
+ getBot().comboBoxWithLabel("Database Type:").setSelection(databaseType);
+ }
+
+ if (connectionProfile != null){
+ getBot().comboBoxWithLabel("Connection profile:").setSelection(connectionProfile);
+ }
+ }
+
+ public void setRuntime(String runtime) {
+ this.runtime = runtime;
+ }
+
+ public void setDatabaseType(String databaseType) {
+ this.databaseType = databaseType;
+ }
+
+ public void setConnectionProfile(String connectionProfile) {
+ this.connectionProfile = connectionProfile;
+ }
+}
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java 2011-11-28 16:20:04 UTC (rev 36703)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java 2011-11-28 16:20:45 UTC (rev 36704)
@@ -6,6 +6,7 @@
import org.jboss.tools.portlet.ui.bot.test.jsf.CreateJSFPortlet;
import org.jboss.tools.portlet.ui.bot.test.jsf.CreateJSFPortletProject;
import org.jboss.tools.portlet.ui.bot.test.jsf.RunJSFPortletOnServer;
+import org.jboss.tools.portlet.ui.bot.test.seam.CreateSeamPortletProject;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -16,7 +17,8 @@
RunJavaPortletOnServer.class,
CreateJSFPortletProject.class,
CreateJSFPortlet.class,
- RunJSFPortletOnServer.class
+ RunJSFPortletOnServer.class,
+ CreateSeamPortletProject.class
})
public class AllTestsSuite {
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/SeamPortletTestSuite.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/SeamPortletTestSuite.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/SeamPortletTestSuite.java 2011-11-28 16:20:45 UTC (rev 36704)
@@ -0,0 +1,13 @@
+package org.jboss.tools.portlet.ui.bot.test;
+
+import org.jboss.tools.portlet.ui.bot.test.seam.CreateSeamPortletProject;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+(a)RunWith(RequirementAwareUsageWindowClosingSuite.class)
+(a)Suite.SuiteClasses({
+ CreateSeamPortletProject.class,
+ })
+public class SeamPortletTestSuite {
+
+}
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletProject.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletProject.java 2011-11-28 16:20:04 UTC (rev 36703)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortletProject.java 2011-11-28 16:20:45 UTC (rev 36704)
@@ -22,14 +22,6 @@
public static final String PROJECT_NAME = "jsf-portlet";
- protected static final FacetDefinition JSF_PORTLET_FACET = new FacetDefinition("JBoss JSF Portlet", JBOSS_FACET_CATEGORY);
-
- protected static final FacetDefinition JSF_FACET = new FacetDefinition("JavaServer Faces");
-
- protected static final String FACES_CONFIG_XML = "WebContent/WEB-INF/faces-config.xml";
-
- protected static final String WEB_APP_LIBRARIES = "Web App Libraries";
-
@Override
public String getProjectName() {
return PROJECT_NAME;
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletProject.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletProject.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/seam/CreateSeamPortletProject.java 2011-11-28 16:20:45 UTC (rev 36704)
@@ -0,0 +1,75 @@
+package org.jboss.tools.portlet.ui.bot.test.seam;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.tools.portlet.ui.bot.entity.FacetDefinition;
+import org.jboss.tools.portlet.ui.bot.task.wizard.WizardPageDefaultsFillingTask;
+import org.jboss.tools.portlet.ui.bot.task.wizard.WizardPageFillingTask;
+import org.jboss.tools.portlet.ui.bot.task.wizard.web.jboss.JBossJSFPortletCapabilitiesWizardPageFillingTask;
+import org.jboss.tools.portlet.ui.bot.task.wizard.web.jboss.JBossPortletCapabilitiesWizardPageFillingTask;
+import org.jboss.tools.portlet.ui.bot.task.wizard.web.seam.Seam2FacetWizardPageFillingTask;
+import org.jboss.tools.portlet.ui.bot.test.template.CreatePortletProjectTemplate;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+
+
+/**
+ * Creates a new Dynamic Web Project with the specific JBoss Seam Portlet facet.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class CreateSeamPortletProject extends CreatePortletProjectTemplate{
+
+ public static final String PROJECT_NAME = "seam-portlet";
+
+ @Override
+ public String getProjectName() {
+ return PROJECT_NAME;
+ }
+
+ @Override
+ public List<FacetDefinition> getRequiredFacets() {
+ List<FacetDefinition> facets = new ArrayList<FacetDefinition>();
+ facets.add(JAVA_FACET);
+ facets.add(JSF_FACET);
+ facets.add(SEAM_2_FACET);
+ facets.add(CORE_PORTLET_FACET);
+ facets.add(JSF_PORTLET_FACET);
+ facets.add(SEAM_PORTLET_FACET);
+ return facets;
+ }
+
+ @Override
+ public List<WizardPageFillingTask> getAdditionalWizardPages() {
+ List<WizardPageFillingTask> tasks = new ArrayList<WizardPageFillingTask>();
+ tasks.add(new WizardPageDefaultsFillingTask());
+ tasks.add(new WizardPageDefaultsFillingTask());
+ tasks.add(new JBossPortletCapabilitiesWizardPageFillingTask(JBossPortletCapabilitiesWizardPageFillingTask.Type.RUNTIME_PROVIDER));
+ tasks.add(new WizardPageDefaultsFillingTask());
+ tasks.add(getSeamFacetPageFillingTask());
+ tasks.add(new JBossJSFPortletCapabilitiesWizardPageFillingTask(JBossJSFPortletCapabilitiesWizardPageFillingTask.Type.RUNTIME_PROVIDER));
+ return tasks;
+ }
+
+ private WizardPageFillingTask getSeamFacetPageFillingTask() {
+ Seam2FacetWizardPageFillingTask task = new Seam2FacetWizardPageFillingTask();
+ task.setDatabaseType("HSQL");
+ task.setConnectionProfile(SWTTestExt.configuredState.getDB().name);
+ return task;
+ }
+
+ @Override
+ public List<String> getExpectedFiles() {
+ return Arrays.asList(
+ WEB_XML,
+ PORTLET_XML,
+ PORTLET_LIBRARIES,
+ FACES_CONFIG_XML,
+ WEB_APP_LIBRARIES,
+ PAGES_XML,
+ COMPONENTS_XML,
+ JBOSS_WEB_XML);
+ }
+}
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletProjectTemplate.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletProjectTemplate.java 2011-11-28 16:20:04 UTC (rev 36703)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletProjectTemplate.java 2011-11-28 16:20:45 UTC (rev 36704)
@@ -16,7 +16,9 @@
import org.jboss.tools.portlet.ui.bot.task.wizard.web.DynamicWebProjectCreationTask;
import org.jboss.tools.portlet.ui.bot.test.testcase.SWTTaskBasedTestCase;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.config.Annotations.DB;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Seam;
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
@@ -29,39 +31,59 @@
* @author Lucia Jelinkova
*
*/
-@Require(server=@Server(required=true, state=ServerState.Present, type=ServerType.EPP))
+@Require(db=@DB(required=true), seam=@Seam(version="2.2"), server=@Server(required=true, state=ServerState.Present, type=ServerType.EPP))
public abstract class CreatePortletProjectTemplate extends SWTTaskBasedTestCase {
+ protected static final FacetDefinition JAVA_FACET = new FacetDefinition("Java", null, "1.6");
+
+ protected static final FacetDefinition JSF_FACET = new FacetDefinition("JavaServer Faces");
+
+ public static final FacetDefinition SEAM_2_FACET = new FacetDefinition("Seam 2");
+
protected static final String JBOSS_FACET_CATEGORY = "JBoss Portlets";
-
+
protected static final FacetDefinition CORE_PORTLET_FACET = new FacetDefinition("JBoss Core Portlet", JBOSS_FACET_CATEGORY);
+
+ protected static final FacetDefinition JSF_PORTLET_FACET = new FacetDefinition("JBoss JSF Portlet", JBOSS_FACET_CATEGORY);
- protected static final FacetDefinition JAVA_FACET = new FacetDefinition("Java", null, "1.6");
+ public static final FacetDefinition SEAM_PORTLET_FACET = new FacetDefinition("JBoss Seam Portlet", JBOSS_FACET_CATEGORY);
- protected static final String WEB_XML = "WebContent/WEB-INF/web.xml";
+ protected static final String WEB_INF = "WebContent/WEB-INF/";
- protected static final String PORTLET_XML = "WebContent/WEB-INF/portlet.xml";
+ protected static final String FACES_CONFIG_XML = WEB_INF + "faces-config.xml";
+
+ protected static final String WEB_XML = WEB_INF + "web.xml";
+
+ protected static final String PORTLET_XML = WEB_INF + "portlet.xml";
+ protected static final String COMPONENTS_XML = WEB_INF + "components.xml";
+
+ protected static final String PAGES_XML = WEB_INF + "pages.xml";
+
+ protected static final String JBOSS_WEB_XML = WEB_INF + "jboss-web.xml";
+
protected static final String PORTLET_LIBRARIES = "JBoss Portlet Libraries";
+ protected static final String WEB_APP_LIBRARIES = "Web App Libraries";
+
public abstract String getProjectName();
-
+
public abstract List<FacetDefinition> getRequiredFacets();
-
+
public abstract List<WizardPageFillingTask> getAdditionalWizardPages();
-
+
public abstract List<String> getExpectedFiles();
-
+
@Test
public void testcreate(){
doPerform(getCreateDynamicWebProjectTask());
-
+
doAssertThat(0, isNumberOfErrors());
doAssertThat(getProjectName(), isExistingProject());
doAssertThat(getProjectName(), hasFacets(getRequiredFacets()));
doAssertThat(getExpectedWorkspaceFiles(), exist());
}
-
+
protected AbstractSWTTask getCreateDynamicWebProjectTask() {
DynamicWebProjectCreationTask task = new DynamicWebProjectCreationTask();
task.setProjectName(getProjectName());
@@ -71,20 +93,20 @@
task.addAllWizardPages(getAdditionalWizardPages());
return task;
}
-
+
protected FacetsSelectionTask getSelectFacetsTask() {
FacetsSelectionTask task = new FacetsSelectionTask();
task.addAllFacets(getRequiredFacets());
return task;
}
-
+
private List<WorkspaceFile> getExpectedWorkspaceFiles(){
List<WorkspaceFile> expectedWorkspaceFiles = new ArrayList<WorkspaceFile>();
-
+
for (String file : getExpectedFiles()){
expectedWorkspaceFiles.add(new WorkspaceFile(getProjectName(), file));
}
-
+
return expectedWorkspaceFiles;
}
}
13 years, 1 month
JBoss Tools SVN: r36703 - in trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task: progress and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2011-11-28 11:20:04 -0500 (Mon, 28 Nov 2011)
New Revision: 36703
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/progress/
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/progress/AllJobsFinishedWaitingTask.java
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/WizardFillingTask.java
Log:
Created own waiting task.
Added: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/progress/AllJobsFinishedWaitingTask.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/progress/AllJobsFinishedWaitingTask.java (rev 0)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/progress/AllJobsFinishedWaitingTask.java 2011-11-28 16:20:04 UTC (rev 36703)
@@ -0,0 +1,57 @@
+package org.jboss.tools.portlet.ui.bot.task.progress;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
+import org.jboss.tools.portlet.ui.bot.task.AbstractSWTTask;
+
+/**
+ * Waits until there is no job running.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class AllJobsFinishedWaitingTask extends AbstractSWTTask {
+
+ public enum JobDuration {
+ SHORT(1 * 1000), NORMAL(10 * 1000), LONG(1 * 60 * 1000), VERY_LONG(10 * 60 * 1000);
+
+ private long timeout;
+
+ private JobDuration(long timeout) {
+ this.timeout = timeout;
+ }
+
+ public long getTimeout() {
+ return timeout;
+ }
+ }
+
+ private JobDuration jobDuration;
+
+ public AllJobsFinishedWaitingTask(JobDuration timeout) {
+ super();
+ this.jobDuration = timeout;
+ }
+
+ @Override
+ public void perform() {
+ getBot().waitUntil(new ICondition() {
+
+ @Override
+ public boolean test() throws Exception {
+ return Job.getJobManager().isIdle();
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return null;
+ }
+ }, jobDuration.getTimeout());
+ }
+}
Modified: trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/WizardFillingTask.java
===================================================================
--- trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/WizardFillingTask.java 2011-11-28 16:11:30 UTC (rev 36702)
+++ trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/WizardFillingTask.java 2011-11-28 16:20:04 UTC (rev 36703)
@@ -4,7 +4,7 @@
import java.util.List;
import org.jboss.tools.portlet.ui.bot.task.CompositeSWTTask;
-import org.jboss.tools.ui.bot.ext.SWTBotFactory;
+import org.jboss.tools.portlet.ui.bot.task.progress.AllJobsFinishedWaitingTask;
/**
*
@@ -29,7 +29,7 @@
super.perform();
getBot().button("Finish").click();
- SWTBotFactory.getUtil().waitForAll();
+ performInnerTask(new AllJobsFinishedWaitingTask(AllJobsFinishedWaitingTask.JobDuration.LONG));
}
public void addWizardPage(WizardPageFillingTask task){
13 years, 1 month
JBoss Tools SVN: r36702 - in trunk: jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2011-11-28 11:11:30 -0500 (Mon, 28 Nov 2011)
New Revision: 36702
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AbstractFacesConfigEditingTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/FacesConfigEditingTestJSF2.java
Removed:
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/utils/DndSupport.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AddRemoveJSFCapabilitiesTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/FacesConfigEditingTest.java
trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/tutorial/TutorialTest.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
Log:
Added test of faces-config.xml file editing within JSF2 project
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java 2011-11-28 15:48:05 UTC (rev 36701)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java 2011-11-28 16:11:30 UTC (rev 36702)
@@ -14,6 +14,7 @@
import org.jboss.tools.jsf.ui.bot.test.smoke.CreateNewJSFProjectTest;
import org.jboss.tools.jsf.ui.bot.test.smoke.FacesConfigCodeCompletionTest;
import org.jboss.tools.jsf.ui.bot.test.smoke.FacesConfigEditingTest;
+import org.jboss.tools.jsf.ui.bot.test.smoke.FacesConfigEditingTestJSF2;
import org.jboss.tools.jsf.ui.bot.test.smoke.MarkersTest;
import org.jboss.tools.jsf.ui.bot.test.smoke.OpenOnTest;
import org.jboss.tools.jsf.ui.bot.test.smoke.WebXmlEditorTest;
@@ -47,6 +48,7 @@
OpenOnTest.class,
CodeCompletionTest.class,
FacesConfigEditingTest.class,
+ FacesConfigEditingTestJSF2.class,
FacesConfigCodeCompletionTest.class,
MarkersTest.class,
WebXmlEditorTest.class,
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AbstractFacesConfigEditingTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AbstractFacesConfigEditingTest.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AbstractFacesConfigEditingTest.java 2011-11-28 16:11:30 UTC (rev 36702)
@@ -0,0 +1,565 @@
+/*******************************************************************************
+ * Copyright (c) 2007-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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.ui.bot.test.smoke;
+
+import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefViewer;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.jsf.ui.bot.test.JSFAutoTestCase;
+import org.jboss.tools.jsf.ui.bot.test.smoke.gefutils.FacesConfigGefEditorBot;
+import org.jboss.tools.jsf.ui.bot.test.smoke.gefutils.FacesConfigGefEditorPartMatcher;
+import org.jboss.tools.jsf.ui.bot.test.smoke.gefutils.FacesConfigGefEditorUtil;
+import org.jboss.tools.ui.bot.ext.Assertions;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.helper.DragAndDropHelper;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.view.ProblemsView;
+/** Parent test for editing of faces-config.xml file
+ * @author Vladimir Pakan
+ *
+ */
+public abstract class AbstractFacesConfigEditingTest extends JSFAutoTestCase{
+
+ protected static final String FACES_CONFIG_FILE_NAME = "faces-config.xml";
+ private SWTBotEditor facesConfigEditor;
+ private String originalContent;
+ private SWTBotEditorExt facesConfigEditorExt;
+ private SWTBotExt botExt;
+ private SWTBotGefEditPart gefObjectAddedViaViewTool = null;
+ private SWTBotGefEditPart gefObjectAddedViaDnDTool = null;
+ private SWTBotGefViewer gefViewer = null;
+ private String testProjectName = null;
+
+ protected static enum TestProjectType {
+ JSF,
+ JSF2;
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ eclipse.closeAllEditors();
+ intializeTestProject();
+ facesConfigEditor = getFacesConfigEditor();
+ testProjectName = getTestProjectName();
+ originalContent = facesConfigEditor.toTextEditor().getText();
+ facesConfigEditorExt = new SWTBotEditorExt(facesConfigEditor.toTextEditor().getReference(),bot);
+ botExt = new SWTBotExt();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ if (gefViewer != null){
+ if (gefObjectAddedViaViewTool != null){
+ gefObjectAddedViaViewTool.click();
+ bot.sleep(Timing.time1S());
+ gefViewer.clickContextMenu(IDELabel.Menu.DELETE);
+ confirmViewDelete();
+ bot.sleep(Timing.time1S());
+ }
+ if (gefObjectAddedViaDnDTool != null){
+ gefObjectAddedViaDnDTool.click();
+ bot.sleep(Timing.time1S());
+ gefViewer.clickContextMenu(IDELabel.Menu.DELETE);
+ confirmViewDelete();
+ bot.sleep(Timing.time1S());
+ }
+ }
+ if (facesConfigEditor != null) {
+ facesConfigEditor.toTextEditor().setText(originalContent);
+ facesConfigEditor.saveAndClose();
+ bot.sleep(Timing.time1S());
+ }
+ super.tearDown();
+ }
+ /**
+ * Test Managed Bean editing
+ */
+ public void testManagedBean(){
+ facesConfigEditorExt.selectPage(IDELabel.FacesConfigEditor.TREE_TAB_LABEL);
+ SWTBot editorBot = facesConfigEditorExt.bot();
+ SWTBotTree tree = editorBot.tree();
+ final String managedBeanName = "TestBean";
+ final String managedBeanClass = "TestBeanClass";
+ SWTBotTreeItem tiFacesConfigXml = tree.expandNode(AbstractFacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
+ SWTBotTreeItem tiManagedbean = tiFacesConfigXml.getNode(IDELabel.FacesConfigEditor.MANAGED_BEANS_NODE);
+ tiManagedbean.select();
+ bot.sleep(Timing.time1S());
+ // Add managed bean
+ editorBot.button(IDELabel.Button.ADD).click();
+ bot.shell(AbstractFacesConfigEditingTest.getAddManagedBeanDialogTitle(getTestProjectType())).activate();
+ bot.textWithLabel(IDELabel.FacesConfigEditor.NEW_MANAGED_BEAN_CLASS_LABEL)
+ .setText(managedBeanClass);
+ bot.textWithLabel(IDELabel.FacesConfigEditor.NEW_MANAGED_BEAN_NAME_LABEL)
+ .setText(managedBeanName);
+ bot.button(IDELabel.Button.FINISH).click();
+ facesConfigEditorExt.save();
+ bot.sleep(Timing.time1S());
+ assertFacesConfigXmlHasNoErrors(botExt);
+ final String selectedNode = tree.selection().get(0,0);
+ assertTrue ("Selected node has to have label '" + managedBeanName +"'\n" +
+ "but has '" + selectedNode + "'.",
+ selectedNode.equals(managedBeanName));
+ Assertions.assertFileExistsInWorkspace(managedBeanClass + ".java",
+ testProjectName,"JavaSource");
+ Assertions.assertSourceEditorContains(stripXMLSourceText(facesConfigEditorExt.getText()),
+ "<managed-bean><managed-bean-name>" + managedBeanName + "</managed-bean-name>" +
+ "<managed-bean-class>" + managedBeanClass + "</managed-bean-class>" +
+ "<managed-bean-scope>request</managed-bean-scope></managed-bean>",
+ AbstractFacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
+ // Modify Managed Bean
+ editorBot.textWithLabel(IDELabel.FacesConfigEditor.MANAGED_BEAN_CLASS_LABEL)
+ .setText(managedBeanClass + "xxqq");
+ facesConfigEditorExt.save();
+ bot.sleep(Timing.time1S());
+ if (getCheckForExistingManagedBeanClass()){
+ assertFacesConfigXmlHasErrors(botExt);
+ }
+ editorBot.textWithLabel(IDELabel.FacesConfigEditor.MANAGED_BEAN_CLASS_LABEL)
+ .setText(managedBeanClass);
+ facesConfigEditorExt.save();
+ bot.sleep(Timing.time1S());
+ // Delete Managed Bean
+ tiManagedbean.select();
+ editorBot.table().select(managedBeanName);
+ editorBot.button(IDELabel.Button.REMOVE_WITH_DOTS).click();
+ bot.shell(IDELabel.Shell.CONFIRMATION).activate();
+ bot.checkBox(IDELabel.FacesConfigEditor.DELETE_JAVA_SOURCE_CHECK_BOX).select();
+ bot.button(IDELabel.Button.OK).click();
+ boolean managedBeanWasDeleted = false;
+ try{
+ editorBot.table().select(managedBeanName);
+ } catch (WidgetNotFoundException wnfe){
+ managedBeanWasDeleted = true;
+ } catch (IllegalArgumentException iae){
+ managedBeanWasDeleted = true;
+ }
+ assertTrue("Managed bean " + managedBeanName + " was not deleted properly.",
+ managedBeanWasDeleted);
+ Assertions.assertFileNotExistsInWorkspace(managedBeanClass + ".java",
+ testProjectName,"JavaSource");
+ Assertions.assertSourceEditorNotContain(facesConfigEditorExt.getText(),
+ "<managed-bean-name>" + managedBeanName + "</managed-bean-name>",
+ AbstractFacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
+ Assertions.assertSourceEditorNotContain(facesConfigEditorExt.getText(),
+ "<managed-bean-class>" + managedBeanClass + "</managed-bean-class>",
+ AbstractFacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
+ }
+ /**
+ * Tests Component editing
+ */
+ public void testComponent (){
+ checkFacesConfigNodeEditing(IDELabel.FacesConfigEditor.COMPONENTS_NODE,
+ IDELabel.Shell.ADD_COMPONENT,
+ IDELabel.FacesConfigEditor.NEW_COMPONENT_TYPE_LABEL,
+ "TestComponentType",
+ IDELabel.FacesConfigEditor.NEW_COMPONENT_CLASS_LABEL,
+ "TestComponentClass",
+ "component",
+ "component-type",
+ "component-class",
+ true);
+ }
+ /**
+ * Tests Converter editing
+ */
+ public void testConverter (){
+ checkFacesConfigNodeEditing(IDELabel.FacesConfigEditor.CONVERTERS_NODE,
+ IDELabel.Shell.ADD_CONVERTER,
+ IDELabel.FacesConfigEditor.NEW_CONVERTER_ID_LABEL,
+ "TestConverterID",
+ IDELabel.FacesConfigEditor.NEW_CONVERTER_CLASS_LABEL,
+ "TestConverterClass",
+ "converter",
+ "converter-id",
+ "converter-class",
+ true);
+ }
+ /**
+ * Tests Referenced Bean editing
+ */
+ public void testReferencedBean (){
+ checkFacesConfigNodeEditing(IDELabel.FacesConfigEditor.REFERENCED_BEAN_NODE,
+ IDELabel.Shell.ADD_REFERENCED_BEAN,
+ IDELabel.FacesConfigEditor.NEW_REFERENCED_BEAN_NAME_LABEL,
+ "TestReferencedBeanName",
+ IDELabel.FacesConfigEditor.NEW_REFERENCED_BEAN_CLASS_LABEL,
+ "TestReferencedBeanClass",
+ "referenced-bean",
+ "referenced-bean-name",
+ "referenced-bean-class",
+ true);
+ }
+ /**
+ * Tests Render Kit editing
+ */
+ public void testRenderKit (){
+ checkFacesConfigNodeEditing(IDELabel.FacesConfigEditor.RENDER_KITS_NODE,
+ AbstractFacesConfigEditingTest.getAddRenderKitDialogTitle(getTestProjectType()),
+ IDELabel.FacesConfigEditor.NEW_RENDER_KIT_ID_LABEL,
+ "TestRenderKitID",
+ IDELabel.FacesConfigEditor.NEW_RENDER_KIT_CLASS_LABEL,
+ "TestRenderKitClass",
+ "render-kit",
+ "render-kit-id",
+ "render-kit-class",
+ false);
+ }
+ /**
+ * Tests Validator editing
+ */
+ public void testValidator (){
+ checkFacesConfigNodeEditing(IDELabel.FacesConfigEditor.VALIDATOR_NODE,
+ IDELabel.Shell.ADD_VALIDATOR,
+ IDELabel.FacesConfigEditor.NEW_VALIDATOR_ID_LABEL,
+ "TestValidatorID",
+ IDELabel.FacesConfigEditor.NEW_VALIDATOR_CLASS_LABEL,
+ "TestValidatorClass",
+ "validator",
+ "validator-id",
+ "validator-class",
+ false);
+ }
+ /**
+ * Asserts if faces-config.xml has no errors
+ * @param botExt
+ */
+ protected static void assertFacesConfigXmlHasNoErrors (SWTBotExt botExt){
+
+ SWTBotTreeItem[] errors = ProblemsView.getFilteredErrorsTreeItems(botExt, null, null, AbstractFacesConfigEditingTest.FACES_CONFIG_FILE_NAME, null);
+ boolean areThereNoErrors = ((errors == null) || (errors.length == 0));
+ assertTrue("There are errors in Problems view: " +
+ (areThereNoErrors ? "" : errors[0].getText()),
+ areThereNoErrors);
+ }
+ /**
+ * Asserts if faces-config.xml has errors
+ * @param botExt
+ */
+ protected static void assertFacesConfigXmlHasErrors (SWTBotExt botExt){
+
+ SWTBotTreeItem[] errors = ProblemsView.getFilteredErrorsTreeItems(botExt, null, null, AbstractFacesConfigEditingTest.FACES_CONFIG_FILE_NAME, null);
+ boolean areThereErrors = ((errors != null) && (errors.length > 0));
+ assertTrue("There are missing errors in Problems view for " + AbstractFacesConfigEditingTest.FACES_CONFIG_FILE_NAME + " file.",
+ areThereErrors);
+ }
+ /**
+ * Check editing of particular tree node within Face Config Editor Tree
+ * @param treeNodeLabel
+ * @param addWizardTitle
+ * @param nameTextLabel
+ * @param typeTextValue
+ * @param classTextLabel
+ * @param classTextValue
+ * @param xmlNodeName
+ * @param nameXmlNodeName
+ * @param classXmlNodeName
+ * @param checkForValdiationErrors
+ */
+ protected void checkFacesConfigNodeEditing(String treeNodeLabel,
+ String addWizardTitle,
+ String nameTextLabel,
+ String typeTextValue,
+ String classTextLabel,
+ String classTextValue,
+ String xmlNodeName,
+ String nameXmlNodeName,
+ String classXmlNodeName,
+ boolean checkForValdiationErrors){
+
+ facesConfigEditorExt.selectPage(IDELabel.FacesConfigEditor.TREE_TAB_LABEL);
+ SWTBot editorBot = facesConfigEditorExt.bot();
+ SWTBotTree tree = editorBot.tree();
+ SWTBotTreeItem tiFacesConfigXml = tree.expandNode(AbstractFacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
+ SWTBotTreeItem tiNodeToCheck = tiFacesConfigXml.getNode(treeNodeLabel);
+ tiNodeToCheck.select();
+ bot.sleep(Timing.time1S());
+ // Add Node
+ editorBot.button(IDELabel.Button.ADD).click();
+ bot.shell(addWizardTitle).activate();
+ bot.textWithLabel(nameTextLabel).setText(typeTextValue);
+ bot.textWithLabel(classTextLabel).setText(classTextValue);
+ bot.button(IDELabel.Button.FINISH).click();
+ facesConfigEditorExt.save();
+ bot.sleep(Timing.time1S());
+ if (checkForValdiationErrors){
+ assertFacesConfigXmlHasErrors(botExt);
+ }
+ final String selectedNode = tree.selection().get(0,0);
+ assertTrue ("Selected node has to have label '" + typeTextValue +"'\n" +
+ "but has '" + selectedNode + "'.",
+ selectedNode.equals(typeTextValue));
+ Assertions.assertSourceEditorContains(stripXMLSourceText(facesConfigEditorExt.getText()),
+ "<" + xmlNodeName + ">" +
+ "<" + nameXmlNodeName + ">" + typeTextValue + "</" + nameXmlNodeName +">" +
+ "<" + classXmlNodeName + ">" + classTextValue + "</" + classXmlNodeName +">" +
+ "</" + xmlNodeName + ">",
+ AbstractFacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
+ // Delete Node
+ tiNodeToCheck.select();
+ editorBot.table().select(typeTextValue);
+ editorBot.button(IDELabel.Button.REMOVE_WITH_DOTS).click();
+ bot.shell(IDELabel.Shell.CONFIRMATION).activate();
+ bot.button(IDELabel.Button.OK).click();
+ boolean nodeWasDeleted = false;
+ try{
+ editorBot.table().select(typeTextValue);
+ } catch (WidgetNotFoundException wnfe){
+ nodeWasDeleted = true;
+ } catch (IllegalArgumentException iae){
+ nodeWasDeleted = true;
+ }
+ assertTrue(typeTextValue + " was not deleted properly.",
+ nodeWasDeleted);
+ Assertions.assertSourceEditorNotContain(facesConfigEditorExt.getText(),
+ "<" + nameXmlNodeName + ">" + typeTextValue + "</" + nameXmlNodeName +">",
+ AbstractFacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
+ Assertions.assertSourceEditorNotContain(facesConfigEditorExt.getText(),
+ "<" + classXmlNodeName + ">" + classTextValue + "</" + classXmlNodeName +">",
+ AbstractFacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
+ }
+ /**
+ * Test editing via Diagram tab
+ */
+ public void testDiagramEditing(){
+ final int verticalSpacing = 100;
+ facesConfigEditorExt.selectPage(IDELabel.FacesConfigEditor.DIAGRAM_TAB_LABEL);
+ final FacesConfigGefEditorBot gefEditorBot = new FacesConfigGefEditorBot(facesConfigEditorExt.getReference());
+ gefViewer = gefEditorBot.getViewer();
+ SWTBotGefEditPart mainPart = gefViewer.mainEditPart();
+ // add View to diagram via pallete tool
+ gefViewer.activateTool(IDELabel.FacesConfigEditor.GEF_VIEW_TEMPLATE_TOOL);
+ SWTBotGefEditPart gefObjectPart = mainPart.descendants(
+ new FacesConfigGefEditorPartMatcher(AbstractFacesConfigEditingTest.getInputNamePageName(getTestProjectType()))).get(0);
+ gefViewer.click(FacesConfigGefEditorUtil.getGefPartPosition(gefObjectPart).x,
+ FacesConfigGefEditorUtil.getGefPartPosition(gefObjectPart).y + verticalSpacing);
+ final String viewAddedViaToolName = "addedViaTool";
+ handleNewViewWizard(viewAddedViaToolName +
+ AbstractFacesConfigEditingTest.getNewPagesExtension(getTestProjectType()));
+ bot.sleep(Timing.time3S());
+ facesConfigEditor.save();
+ bot.sleep(Timing.time3S());
+ assertFacesConfigXmlHasNoErrors(botExt);
+ Assertions.assertFileExistsInWorkspace(viewAddedViaToolName +
+ AbstractFacesConfigEditingTest.getNewPagesExtension(getTestProjectType()),
+ getTestProjectName(),
+ "WebContent");
+ gefViewer.activateTool(IDELabel.FacesConfigEditor.GEF_CREATE_NEW_CONNECTION_TOOL);
+ gefObjectPart.click();
+ bot.sleep(Timing.time1S());
+ gefObjectAddedViaViewTool = mainPart.descendants(new FacesConfigGefEditorPartMatcher("/" + viewAddedViaToolName +
+ AbstractFacesConfigEditingTest.getNewPagesExtension(getTestProjectType()))).get(0);
+ gefObjectAddedViaViewTool.click();
+ bot.sleep(Timing.time1S());
+ facesConfigEditor.save();
+ bot.sleep(Timing.time3S());
+ Assertions.assertSourceEditorContains(AbstractFacesConfigEditingTest.stripXMLSourceText(facesConfigEditorExt.getText()),
+ "<navigation-case><from-outcome>" + viewAddedViaToolName +
+ "</from-outcome><to-view-id>/" + viewAddedViaToolName +
+ AbstractFacesConfigEditingTest.getNewPagesExtension(getTestProjectType()) +
+ "</to-view-id></navigation-case>",
+ AbstractFacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
+ // add View to Diagram via D'n'D
+ final String dndPageName = "testDnDPage";
+ createTestPage(dndPageName +
+ AbstractFacesConfigEditingTest.getNewPagesExtension(getTestProjectType()));
+ facesConfigEditor.show();
+ facesConfigEditor.setFocus();
+ SWTBotTreeItem tiPage = SWTEclipseExt.selectTreeLocation(open.viewOpen(ActionItem.View.JBossToolsWebWebProjects.LABEL).bot(),
+ getTestProjectName(),
+ "WebContent",
+ "pages",
+ dndPageName + AbstractFacesConfigEditingTest.getNewPagesExtension(getTestProjectType()));
+ DragAndDropHelper.dnd((TreeItem)tiPage.widget, (FigureCanvas) gefEditorBot.getControl());
+ facesConfigEditor.save();
+ bot.sleep(Timing.time3S());
+ assertFacesConfigXmlHasNoErrors(botExt);
+ gefViewer.activateTool(IDELabel.FacesConfigEditor.GEF_CREATE_NEW_CONNECTION_TOOL);
+ gefObjectPart.click();
+ bot.sleep(Timing.time1S());
+ gefObjectAddedViaDnDTool = mainPart.descendants(new FacesConfigGefEditorPartMatcher("/pages/" + dndPageName +
+ AbstractFacesConfigEditingTest.getNewPagesExtension(getTestProjectType()))).get(0);
+ gefObjectAddedViaDnDTool.click();
+ bot.sleep(Timing.time1S());
+ gefViewer.click(FacesConfigGefEditorUtil.getGefPartPosition(gefObjectAddedViaDnDTool).x,
+ FacesConfigGefEditorUtil.getGefPartPosition(gefObjectAddedViaDnDTool).y + verticalSpacing);
+ gefViewer.clickContextMenu(IDELabel.Menu.AUTO_LAYOUT);
+ bot.shell(IDELabel.Shell.AUTO_LAYOUT).activate();
+ bot.button(IDELabel.Button.OK).click();
+ facesConfigEditor.save();
+ bot.sleep(Timing.time3S());
+ Assertions.assertSourceEditorContains(AbstractFacesConfigEditingTest.stripXMLSourceText(facesConfigEditorExt.getText()),
+ "<navigation-case><from-outcome>" + dndPageName +
+ "</from-outcome><to-view-id>/pages/" + dndPageName +
+ AbstractFacesConfigEditingTest.getNewPagesExtension(getTestProjectType()) +
+ "</to-view-id></navigation-case>",
+ AbstractFacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
+ }
+ /**
+ * Handle adding new View
+ * @param fromViewID
+ */
+ protected void handleNewViewWizard(String fromViewID){
+ SWTBot dialogBot = bot.shell(IDELabel.Shell.NEW_VIEW).activate().bot();
+ dialogBot.textWithLabel(IDELabel.NewViewDialog.FROM_VIEW_ID_TEXT_LABEL)
+ .setText(fromViewID);
+ dialogBot.checkBox(IDELabel.NewViewDialog.CREATE_FILE_ON_DISK_CHECKBOX_LABEL)
+ .select();
+ dialogBot.button(IDELabel.Button.FINISH).click();
+
+ }
+ /**
+ * Returns XNL Source striped from spaces, tabs and EOL
+ *
+ * @return String
+ */
+ protected static String stripXMLSourceText(String editorText) {
+ return editorText.replaceAll("\n", "").replaceAll("\t", "")
+ .replaceAll("\b", "").replaceAll(" ", "").replaceAll("\r", "")
+ .replaceAll("\f", "");
+ }
+ /**
+ * Confirm deletion of View from Diagram Editor
+ */
+ protected void confirmViewDelete(){
+ bot.shell(IDELabel.Shell.CONFIRMATION).activate();
+ bot.checkBox(IDELabel.FacesConfigEditor.DELETE_FILE_FROM_DISK_CHECK_BOX).select();
+ bot.button(IDELabel.Button.OK).click();
+ }
+ /**
+ * Returns proper Add Managed Bean Dialog Title
+ * @param testProjectType
+ * @return
+ */
+ private static String getAddManagedBeanDialogTitle(TestProjectType testProjectType){
+ String result;
+ if (testProjectType.equals(TestProjectType.JSF)){
+ result = IDELabel.Shell.NEW_MANAGED_BEAN;
+ }
+ else if (testProjectType.equals(TestProjectType.JSF2)){
+ result = IDELabel.Shell.NEW_MANAGED_BEAN_JSF2;
+ }
+ else {
+ throw new IllegalArgumentException("Not supported TestProjectType " + testProjectType);
+ }
+
+ return result;
+
+ }
+ /**
+ * Returns proper Add Render Kit Dialog Title
+ * @param testProjectType
+ * @return
+ */
+ private static String getAddRenderKitDialogTitle(TestProjectType testProjectType){
+ String result;
+ if (testProjectType.equals(TestProjectType.JSF)){
+ result = IDELabel.Shell.ADD_RENDER_KIT;
+ }
+ else if (testProjectType.equals(TestProjectType.JSF2)){
+ result = IDELabel.Shell.ADD_RENDER_KIT_JSF2;
+ }
+ else {
+ throw new IllegalArgumentException("Not supported TestProjectType " + testProjectType);
+ }
+
+ return result;
+
+ }
+ /**
+ * Returns proper Input Name Page Name
+ * @param testProjectType
+ * @return
+ */
+ private static String getInputNamePageName(TestProjectType testProjectType){
+ String result;
+ if (testProjectType.equals(TestProjectType.JSF)){
+ result = "/pages/inputUserName.jsp";
+ }
+ else if (testProjectType.equals(TestProjectType.JSF2)){
+ result = "/pages/inputname.xhtml";
+ }
+ else {
+ throw new IllegalArgumentException("Not supported TestProjectType " + testProjectType);
+ }
+
+ return result;
+
+ }
+ /**
+ * Returns proper Extension for new Web Pages
+ * @param testProjectType
+ * @return
+ */
+ private static String getNewPagesExtension(TestProjectType testProjectType){
+ String result;
+ if (testProjectType.equals(TestProjectType.JSF)){
+ result = ".jsp";
+ }
+ else if (testProjectType.equals(TestProjectType.JSF2)){
+ result = ".xhtml";
+ }
+ else {
+ throw new IllegalArgumentException("Not supported TestProjectType " + testProjectType);
+ }
+
+ return result;
+
+ }
+
+ private void createTestPage (String testPageName){
+ if (testPageName.endsWith(".jsp")){
+ createJspPage(testPageName, getTestProjectName(), "WebContent", "pages");
+ }
+ else if (testPageName.endsWith(".xhtml")){
+ createXhtmlPage(testPageName, getTestProjectName(), "WebContent", "pages");
+ }
+ else {
+ throw new IllegalArgumentException("Not supported Test Page Extension when creating page " + testPageName);
+ }
+ }
+ /**
+ * Returns current SWTBotEditor
+ * @return
+ */
+ protected abstract SWTBotEditor getFacesConfigEditor();
+ /**
+ * Returns Test Project Name
+ * @return
+ */
+ protected abstract String getTestProjectName();
+ /**
+ * Initializes Test Project
+ */
+ protected abstract void intializeTestProject();
+ /**
+ * Returns Test Project Type
+ * @return
+ */
+ protected abstract TestProjectType getTestProjectType();
+ /**
+ * Returns true when test has to check if Managed Class exists
+ * @return
+ */
+ protected abstract boolean getCheckForExistingManagedBeanClass();
+
+}
+
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AbstractFacesConfigEditingTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AddRemoveJSFCapabilitiesTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AddRemoveJSFCapabilitiesTest.java 2011-11-28 15:48:05 UTC (rev 36701)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/AddRemoveJSFCapabilitiesTest.java 2011-11-28 16:11:30 UTC (rev 36702)
@@ -200,6 +200,10 @@
IDELabel.Menu.ADD_JSF_CAPABILITIES).click();
}
+ bot.shell("Add JSF Capabilities").activate();
+ bot.button(WidgetVariables.NEXT_BUTTON).click();
+ bot.button(WidgetVariables.FINISH_BUTTON).click();
+
delay();
assertTrue("JSF Capabilities were not added to project "
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/FacesConfigEditingTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/FacesConfigEditingTest.java 2011-11-28 15:48:05 UTC (rev 36701)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/FacesConfigEditingTest.java 2011-11-28 16:11:30 UTC (rev 36702)
@@ -10,418 +10,36 @@
******************************************************************************/
package org.jboss.tools.jsf.ui.bot.test.smoke;
-import org.eclipse.draw2d.FigureCanvas;
-import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
-import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
-import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefViewer;
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.jsf.ui.bot.test.JSFAutoTestCase;
-import org.jboss.tools.jsf.ui.bot.test.smoke.gefutils.FacesConfigGefEditorBot;
-import org.jboss.tools.jsf.ui.bot.test.smoke.gefutils.FacesConfigGefEditorPartMatcher;
-import org.jboss.tools.jsf.ui.bot.test.smoke.gefutils.FacesConfigGefEditorUtil;
-import org.jboss.tools.ui.bot.ext.Assertions;
-import org.jboss.tools.ui.bot.ext.SWTBotExt;
-import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
-import org.jboss.tools.ui.bot.ext.Timing;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem;
-import org.jboss.tools.ui.bot.ext.helper.DragAndDropHelper;
-import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.jboss.tools.ui.bot.ext.view.ProblemsView;
import org.jboss.tools.vpe.ui.bot.test.VPEAutoTestCase;
-/** Test Editing of faces-config.xml file
+/** Test Editing of faces-config.xml file for JSF 1.2 project
* @author Vladimir Pakan
*
*/
-public class FacesConfigEditingTest extends JSFAutoTestCase{
+public class FacesConfigEditingTest extends AbstractFacesConfigEditingTest{
- private static final String FACES_CONFIG_FILE_NAME = "faces-config.xml";
- private SWTBotEditor facesConfigEditor;
- private String originalContent;
- private SWTBotEditorExt facesConfigEditorExt;
- private SWTBotExt botExt;
- private SWTBotGefEditPart gefObjectAddedViaViewTool = null;
- private SWTBotGefEditPart gefObjectAddedViaDnDTool = null;
- private SWTBotGefViewer gefViewer = null;
-
@Override
- public void setUp() throws Exception {
- super.setUp();
- facesConfigEditor = eclipse.openFile(VPEAutoTestCase.JBT_TEST_PROJECT_NAME,
+ protected SWTBotEditor getFacesConfigEditor() {
+ return eclipse.openFile(getTestProjectName(),
"WebContent",
"WEB-INF",
FacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
- originalContent = facesConfigEditor.toTextEditor().getText();
- facesConfigEditorExt = new SWTBotEditorExt(facesConfigEditor.toTextEditor().getReference(),bot);
- botExt = new SWTBotExt();
}
-
@Override
- public void tearDown() throws Exception {
- if (gefViewer != null){
- if (gefObjectAddedViaViewTool != null){
- gefObjectAddedViaViewTool.click();
- bot.sleep(Timing.time1S());
- gefViewer.clickContextMenu(IDELabel.Menu.DELETE);
- confirmViewDelete();
- bot.sleep(Timing.time1S());
- }
- if (gefObjectAddedViaDnDTool != null){
- gefObjectAddedViaDnDTool.click();
- bot.sleep(Timing.time1S());
- gefViewer.clickContextMenu(IDELabel.Menu.DELETE);
- confirmViewDelete();
- bot.sleep(Timing.time1S());
- }
- }
- if (facesConfigEditor != null) {
- facesConfigEditor.toTextEditor().setText(originalContent);
- facesConfigEditor.saveAndClose();
- bot.sleep(Timing.time1S());
- }
- super.tearDown();
+ protected String getTestProjectName(){
+ return VPEAutoTestCase.JBT_TEST_PROJECT_NAME;
}
- /**
- * Test Managed Bean editing
- */
- public void testManagedBean(){
- facesConfigEditorExt.selectPage(IDELabel.FacesConfigEditor.TREE_TAB_LABEL);
- SWTBot editorBot = facesConfigEditorExt.bot();
- SWTBotTree tree = editorBot.tree();
- final String managedBeanName = "TestBean";
- final String managedBeanClass = "TestBeanClass";
- SWTBotTreeItem tiFacesConfigXml = tree.expandNode(FacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
- SWTBotTreeItem tiManagedbean = tiFacesConfigXml.getNode(IDELabel.FacesConfigEditor.MANAGED_BEANS_NODE);
- tiManagedbean.select();
- bot.sleep(Timing.time1S());
- // Add managed bean
- editorBot.button(IDELabel.Button.ADD).click();
- bot.shell(IDELabel.Shell.NEW_MANAGED_BEAN).activate();
- bot.textWithLabel(IDELabel.FacesConfigEditor.NEW_MANAGED_BEAN_CLASS_LABEL)
- .setText(managedBeanClass);
- bot.textWithLabel(IDELabel.FacesConfigEditor.NEW_MANAGED_BEAN_NAME_LABEL)
- .setText(managedBeanName);
- bot.button(IDELabel.Button.FINISH).click();
- facesConfigEditorExt.save();
- bot.sleep(Timing.time1S());
- assertFacesConfigXmlHasNoErrors(botExt);
- final String selectedNode = tree.selection().get(0,0);
- assertTrue ("Selected node has to have label '" + managedBeanName +"'\n" +
- "but has '" + selectedNode + "'.",
- selectedNode.equals(managedBeanName));
- Assertions.assertFileExistsInWorkspace(managedBeanClass + ".java",
- JBT_TEST_PROJECT_NAME,"JavaSource");
- Assertions.assertSourceEditorContains(stripXMLSourceText(facesConfigEditorExt.getText()),
- "<managed-bean><managed-bean-name>" + managedBeanName + "</managed-bean-name>" +
- "<managed-bean-class>" + managedBeanClass + "</managed-bean-class>" +
- "<managed-bean-scope>request</managed-bean-scope></managed-bean>",
- FacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
- // Modify Managed Bean
- editorBot.textWithLabel(IDELabel.FacesConfigEditor.MANAGED_BEAN_CLASS_LABEL)
- .setText(managedBeanClass + "xxqq");
- facesConfigEditorExt.save();
- bot.sleep(Timing.time1S());
- assertFacesConfigXmlHasErrors(botExt);
- editorBot.textWithLabel(IDELabel.FacesConfigEditor.MANAGED_BEAN_CLASS_LABEL)
- .setText(managedBeanClass);
- facesConfigEditorExt.save();
- bot.sleep(Timing.time1S());
- // Delete Managed Bean
- tiManagedbean.select();
- editorBot.table().select(managedBeanName);
- editorBot.button(IDELabel.Button.REMOVE_WITH_DOTS).click();
- bot.shell(IDELabel.Shell.CONFIRMATION).activate();
- bot.checkBox(IDELabel.FacesConfigEditor.DELETE_JAVA_SOURCE_CHECK_BOX).select();
- bot.button(IDELabel.Button.OK).click();
- boolean managedBeanWasDeleted = false;
- try{
- editorBot.table().select(managedBeanName);
- } catch (WidgetNotFoundException wnfe){
- managedBeanWasDeleted = true;
- } catch (IllegalArgumentException iae){
- managedBeanWasDeleted = true;
- }
- assertTrue("Managed bean " + managedBeanName + " was not deleted properly.",
- managedBeanWasDeleted);
- Assertions.assertFileNotExistsInWorkspace(managedBeanClass + ".java",
- JBT_TEST_PROJECT_NAME,"JavaSource");
- Assertions.assertSourceEditorNotContain(facesConfigEditorExt.getText(),
- "<managed-bean-name>" + managedBeanName + "</managed-bean-name>",
- FacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
- Assertions.assertSourceEditorNotContain(facesConfigEditorExt.getText(),
- "<managed-bean-class>" + managedBeanClass + "</managed-bean-class>",
- FacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
+ @Override
+ protected void intializeTestProject() {
+ // This test is using default JSF 1.2 project which is already created
}
- /**
- * Tests Component editing
- */
- public void testComponent (){
- checkFacesConfigNodeEditing(IDELabel.FacesConfigEditor.COMPONENTS_NODE,
- IDELabel.Shell.ADD_COMPONENT,
- IDELabel.FacesConfigEditor.NEW_COMPONENT_TYPE_LABEL,
- "TestComponentType",
- IDELabel.FacesConfigEditor.NEW_COMPONENT_CLASS_LABEL,
- "TestComponentClass",
- "component",
- "component-type",
- "component-class",
- true);
+ @Override
+ protected TestProjectType getTestProjectType() {
+ return TestProjectType.JSF;
}
- /**
- * Tests Converter editing
- */
- public void testConverter (){
- checkFacesConfigNodeEditing(IDELabel.FacesConfigEditor.CONVERTERS_NODE,
- IDELabel.Shell.ADD_CONVERTER,
- IDELabel.FacesConfigEditor.NEW_CONVERTER_ID_LABEL,
- "TestConverterID",
- IDELabel.FacesConfigEditor.NEW_CONVERTER_CLASS_LABEL,
- "TestConverterClass",
- "converter",
- "converter-id",
- "converter-class",
- true);
+ @Override
+ protected boolean getCheckForExistingManagedBeanClass() {
+ return true;
}
- /**
- * Tests Referenced Bean editing
- */
- public void testReferencedBean (){
- checkFacesConfigNodeEditing(IDELabel.FacesConfigEditor.REFERENCED_BEAN_NODE,
- IDELabel.Shell.ADD_REFERENCED_BEAN,
- IDELabel.FacesConfigEditor.NEW_REFERENCED_BEAN_NAME_LABEL,
- "TestReferencedBeanName",
- IDELabel.FacesConfigEditor.NEW_REFERENCED_BEAN_CLASS_LABEL,
- "TestReferencedBeanClass",
- "referenced-bean",
- "referenced-bean-name",
- "referenced-bean-class",
- true);
- }
- /**
- * Tests Render Kit editing
- */
- public void testRenderKit (){
- checkFacesConfigNodeEditing(IDELabel.FacesConfigEditor.RENDER_KITS_NODE,
- IDELabel.Shell.ADD_RENDER_KIT,
- IDELabel.FacesConfigEditor.NEW_RENDER_KIT_ID_LABEL,
- "TestRenderKitID",
- IDELabel.FacesConfigEditor.NEW_RENDER_KIT_CLASS_LABEL,
- "TestRenderKitClass",
- "render-kit",
- "render-kit-id",
- "render-kit-class",
- false);
- }
- /**
- * Tests Validator editing
- */
- public void testValidator (){
- checkFacesConfigNodeEditing(IDELabel.FacesConfigEditor.VALIDATOR_NODE,
- IDELabel.Shell.ADD_VALIDATOR,
- IDELabel.FacesConfigEditor.NEW_VALIDATOR_ID_LABEL,
- "TestValidatorID",
- IDELabel.FacesConfigEditor.NEW_VALIDATOR_CLASS_LABEL,
- "TestValidatorClass",
- "validator",
- "validator-id",
- "validator-class",
- false);
- }
- /**
- * Asserts if faces-config.xml has no errors
- * @param botExt
- */
- private static void assertFacesConfigXmlHasNoErrors (SWTBotExt botExt){
-
- SWTBotTreeItem[] errors = ProblemsView.getFilteredErrorsTreeItems(botExt, null, null, FacesConfigEditingTest.FACES_CONFIG_FILE_NAME, null);
- boolean areThereNoErrors = ((errors == null) || (errors.length == 0));
- assertTrue("There are errors in Problems view: " +
- (areThereNoErrors ? "" : errors[0].getText()),
- areThereNoErrors);
- }
- /**
- * Asserts if faces-config.xml has errors
- * @param botExt
- */
- private static void assertFacesConfigXmlHasErrors (SWTBotExt botExt){
-
- SWTBotTreeItem[] errors = ProblemsView.getFilteredErrorsTreeItems(botExt, null, null, FacesConfigEditingTest.FACES_CONFIG_FILE_NAME, null);
- boolean areThereErrors = ((errors != null) && (errors.length > 0));
- assertTrue("There are missing errors in Problems view for " + FacesConfigEditingTest.FACES_CONFIG_FILE_NAME + " file.",
- areThereErrors);
- }
- /**
- * Check editing of particular tree node within Face Config Editor Tree
- * @param treeNodeLabel
- * @param addWizardTitle
- * @param nameTextLabel
- * @param typeTextValue
- * @param classTextLabel
- * @param classTextValue
- * @param xmlNodeName
- * @param nameXmlNodeName
- * @param classXmlNodeName
- * @param checkForValdiationErrors
- */
- private void checkFacesConfigNodeEditing(String treeNodeLabel,
- String addWizardTitle,
- String nameTextLabel,
- String typeTextValue,
- String classTextLabel,
- String classTextValue,
- String xmlNodeName,
- String nameXmlNodeName,
- String classXmlNodeName,
- boolean checkForValdiationErrors){
-
- facesConfigEditorExt.selectPage(IDELabel.FacesConfigEditor.TREE_TAB_LABEL);
- SWTBot editorBot = facesConfigEditorExt.bot();
- SWTBotTree tree = editorBot.tree();
- SWTBotTreeItem tiFacesConfigXml = tree.expandNode(FacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
- SWTBotTreeItem tiNodeToCheck = tiFacesConfigXml.getNode(treeNodeLabel);
- tiNodeToCheck.select();
- bot.sleep(Timing.time1S());
- // Add Node
- editorBot.button(IDELabel.Button.ADD).click();
- bot.shell(addWizardTitle).activate();
- bot.textWithLabel(nameTextLabel).setText(typeTextValue);
- bot.textWithLabel(classTextLabel).setText(classTextValue);
- bot.button(IDELabel.Button.FINISH).click();
- facesConfigEditorExt.save();
- bot.sleep(Timing.time1S());
- if (checkForValdiationErrors){
- assertFacesConfigXmlHasErrors(botExt);
- }
- final String selectedNode = tree.selection().get(0,0);
- assertTrue ("Selected node has to have label '" + typeTextValue +"'\n" +
- "but has '" + selectedNode + "'.",
- selectedNode.equals(typeTextValue));
- Assertions.assertSourceEditorContains(stripXMLSourceText(facesConfigEditorExt.getText()),
- "<" + xmlNodeName + ">" +
- "<" + nameXmlNodeName + ">" + typeTextValue + "</" + nameXmlNodeName +">" +
- "<" + classXmlNodeName + ">" + classTextValue + "</" + classXmlNodeName +">" +
- "</" + xmlNodeName + ">",
- FacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
- // Delete Node
- tiNodeToCheck.select();
- editorBot.table().select(typeTextValue);
- editorBot.button(IDELabel.Button.REMOVE_WITH_DOTS).click();
- bot.shell(IDELabel.Shell.CONFIRMATION).activate();
- bot.button(IDELabel.Button.OK).click();
- boolean nodeWasDeleted = false;
- try{
- editorBot.table().select(typeTextValue);
- } catch (WidgetNotFoundException wnfe){
- nodeWasDeleted = true;
- } catch (IllegalArgumentException iae){
- nodeWasDeleted = true;
- }
- assertTrue(typeTextValue + " was not deleted properly.",
- nodeWasDeleted);
- Assertions.assertSourceEditorNotContain(facesConfigEditorExt.getText(),
- "<" + nameXmlNodeName + ">" + typeTextValue + "</" + nameXmlNodeName +">",
- FacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
- Assertions.assertSourceEditorNotContain(facesConfigEditorExt.getText(),
- "<" + classXmlNodeName + ">" + classTextValue + "</" + classXmlNodeName +">",
- FacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
- }
- /**
- * Test editing via Diagram tab
- */
- public void testDiagramEditing(){
- final int verticalSpacing = 100;
- facesConfigEditorExt.selectPage(IDELabel.FacesConfigEditor.DIAGRAM_TAB_LABEL);
- final FacesConfigGefEditorBot gefEditorBot = new FacesConfigGefEditorBot(facesConfigEditorExt.getReference());
- gefViewer = gefEditorBot.getViewer();
- SWTBotGefEditPart mainPart = gefViewer.mainEditPart();
- // add View to diagram via pallete tool
- gefViewer.activateTool(IDELabel.FacesConfigEditor.GEF_VIEW_TEMPLATE_TOOL);
- SWTBotGefEditPart gefObjectPart = mainPart.descendants(new FacesConfigGefEditorPartMatcher("/pages/inputUserName.jsp")).get(0);
- gefViewer.click(FacesConfigGefEditorUtil.getGefPartPosition(gefObjectPart).x,
- FacesConfigGefEditorUtil.getGefPartPosition(gefObjectPart).y + verticalSpacing);
- final String viewAddedViaToolName = "addedViaTool";
- handleNewViewWizard(viewAddedViaToolName + ".jsp");
- bot.sleep(Timing.time3S());
- facesConfigEditor.save();
- bot.sleep(Timing.time3S());
- assertFacesConfigXmlHasNoErrors(botExt);
- Assertions.assertFileExistsInWorkspace(viewAddedViaToolName + ".jsp",
- JBT_TEST_PROJECT_NAME,"WebContent");
- gefViewer.activateTool(IDELabel.FacesConfigEditor.GEF_CREATE_NEW_CONNECTION_TOOL);
- gefObjectPart.click();
- bot.sleep(Timing.time1S());
- gefObjectAddedViaViewTool = mainPart.descendants(new FacesConfigGefEditorPartMatcher("/" + viewAddedViaToolName + ".jsp")).get(0);
- gefObjectAddedViaViewTool.click();
- bot.sleep(Timing.time1S());
- facesConfigEditor.save();
- bot.sleep(Timing.time3S());
- Assertions.assertSourceEditorContains(FacesConfigEditingTest.stripXMLSourceText(facesConfigEditorExt.getText()),
- "<navigation-case><from-outcome>" + viewAddedViaToolName +
- "</from-outcome><to-view-id>/" + viewAddedViaToolName + ".jsp</to-view-id></navigation-case>",
- FacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
- // add View to Diagram via D'n'D
- final String dndPageName = "testDnDPage";
- createJspPage(dndPageName + ".jsp");
- facesConfigEditor.show();
- facesConfigEditor.setFocus();
- SWTBotTreeItem tiPage = SWTEclipseExt.selectTreeLocation(open.viewOpen(ActionItem.View.JBossToolsWebWebProjects.LABEL).bot(),
- VPEAutoTestCase.JBT_TEST_PROJECT_NAME,"WebContent","pages",dndPageName + ".jsp");
- DragAndDropHelper.dnd((TreeItem)tiPage.widget, (FigureCanvas) gefEditorBot.getControl());
- facesConfigEditor.save();
- bot.sleep(Timing.time3S());
- assertFacesConfigXmlHasNoErrors(botExt);
- gefViewer.activateTool(IDELabel.FacesConfigEditor.GEF_CREATE_NEW_CONNECTION_TOOL);
- gefObjectPart.click();
- bot.sleep(Timing.time1S());
- gefObjectAddedViaDnDTool = mainPart.descendants(new FacesConfigGefEditorPartMatcher("/pages/" + dndPageName + ".jsp")).get(0);
- gefObjectAddedViaDnDTool.click();
- bot.sleep(Timing.time1S());
- gefViewer.click(FacesConfigGefEditorUtil.getGefPartPosition(gefObjectAddedViaDnDTool).x,
- FacesConfigGefEditorUtil.getGefPartPosition(gefObjectAddedViaDnDTool).y + verticalSpacing);
- gefViewer.clickContextMenu(IDELabel.Menu.AUTO_LAYOUT);
- bot.shell(IDELabel.Shell.AUTO_LAYOUT).activate();
- bot.button(IDELabel.Button.OK).click();
- facesConfigEditor.save();
- bot.sleep(Timing.time3S());
- Assertions.assertSourceEditorContains(FacesConfigEditingTest.stripXMLSourceText(facesConfigEditorExt.getText()),
- "<navigation-case><from-outcome>" + dndPageName +
- "</from-outcome><to-view-id>/pages/" + dndPageName + ".jsp</to-view-id></navigation-case>",
- FacesConfigEditingTest.FACES_CONFIG_FILE_NAME);
- }
- /**
- * Handle adding new View
- * @param fromViewID
- */
- private void handleNewViewWizard(String fromViewID){
- SWTBot dialogBot = bot.shell(IDELabel.Shell.NEW_VIEW).activate().bot();
- dialogBot.textWithLabel(IDELabel.NewViewDialog.FROM_VIEW_ID_TEXT_LABEL)
- .setText(fromViewID);
- dialogBot.checkBox(IDELabel.NewViewDialog.CREATE_FILE_ON_DISK_CHECKBOX_LABEL)
- .select();
- dialogBot.button(IDELabel.Button.FINISH).click();
-
- }
- /**
- * Returns XNL Source striped from spaces, tabs and EOL
- *
- * @return String
- */
- protected static String stripXMLSourceText(String editorText) {
- return editorText.replaceAll("\n", "").replaceAll("\t", "")
- .replaceAll("\b", "").replaceAll(" ", "").replaceAll("\r", "")
- .replaceAll("\f", "");
- }
- /**
- * Confirm deletion of View from Diagram Editor
- */
- private void confirmViewDelete(){
- bot.shell(IDELabel.Shell.CONFIRMATION).activate();
- bot.checkBox(IDELabel.FacesConfigEditor.DELETE_FILE_FROM_DISK_CHECK_BOX).select();
- bot.button(IDELabel.Button.OK).click();
- }
}
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/FacesConfigEditingTestJSF2.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/FacesConfigEditingTestJSF2.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/FacesConfigEditingTestJSF2.java 2011-11-28 16:11:30 UTC (rev 36702)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007-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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.ui.bot.test.smoke;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+/** Test Editing of faces-config.xml file for JSF 1.2 project
+ * @author Vladimir Pakan
+ *
+ */
+public class FacesConfigEditingTestJSF2 extends AbstractFacesConfigEditingTest{
+
+ @Override
+ protected SWTBotEditor getFacesConfigEditor() {
+ return eclipse.openFile(getTestProjectName(),
+ "WebContent",
+ "WEB-INF",
+ FacesConfigEditingTestJSF2.FACES_CONFIG_FILE_NAME);
+ }
+ @Override
+ protected String getTestProjectName(){
+ return JSF2_TEST_PROJECT_NAME;
+ }
+ @Override
+ protected void intializeTestProject() {
+ createJSF2Project(getTestProjectName());
+ }
+ @Override
+ protected TestProjectType getTestProjectType() {
+ return TestProjectType.JSF2;
+ }
+ @Override
+ protected boolean getCheckForExistingManagedBeanClass() {
+ return false;
+ }
+}
+
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/FacesConfigEditingTestJSF2.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/tutorial/TutorialTest.java
===================================================================
--- trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/tutorial/TutorialTest.java 2011-11-28 15:48:05 UTC (rev 36701)
+++ trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/tutorial/TutorialTest.java 2011-11-28 16:11:30 UTC (rev 36702)
@@ -45,7 +45,6 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.ui.IEditorReference;
import org.hamcrest.Description;
-import org.jboss.tools.struts.ui.bot.test.utils.DndSupport;
import org.jboss.tools.struts.ui.bot.test.utils.PartMatcher;
import org.jboss.tools.struts.ui.bot.test.utils.StrutsUIEditorBot;
import org.jboss.tools.struts.ui.bot.test.utils.ValidationUIEditorBot;
@@ -58,6 +57,7 @@
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.helper.DragAndDropHelper;
import org.jboss.tools.ui.bot.ext.parts.SWTBotBrowserExt;
import org.jboss.tools.ui.bot.ext.types.EntityType;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
@@ -158,11 +158,11 @@
Widget w1 = s.widget;
s.select();
- DndSupport.dnd((TreeItem) w1, (FigureCanvas) c);
+ DragAndDropHelper.dnd((TreeItem) w1, (FigureCanvas) c);
s = webRootNode.getNode("pages").getNode("greeting.jsp");
s.select();
w1 = s.widget;
- DndSupport.dnd((TreeItem) w1, (FigureCanvas) c);
+ DragAndDropHelper.dnd((TreeItem) w1, (FigureCanvas) c);
bot.sleep(500);
ge.clickContextMenu("Auto-Layout");
SWTBotShell sh = bot.activeShell();
@@ -375,7 +375,7 @@
sh.bot().button("Finish").click();
SWTBotTreeItem item = projectNode.getNode("Resource Bundles").getNode("sample.applResources");
nodeContextMenu(tree, item, "New", "Default Error Messages").click();
- DndSupport.dnd(item.widget, config.getNode("resources").widget);
+ DragAndDropHelper.dnd(item.widget, config.getNode("resources").widget);
nodeContextMenu(tree, projectNode.expandNode("Validation").getNode("validation.xml"), "Open").click();
SWTBotEditor editor = bot.activeEditor();
@@ -392,7 +392,7 @@
return config.expandNode("form-beans");
}
}).getNode("GetNameForm").select();
- DndSupport.dnd(item.widget, ti.widget);
+ DragAndDropHelper.dnd(item.widget, ti.widget);
ti = t.expandNode("formset (default)").getNode("GetNameForm").select();
vb.toolbarButton("Create Field").click();
sh = bot.activeShell();
Deleted: trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/utils/DndSupport.java
===================================================================
--- trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/utils/DndSupport.java 2011-11-28 15:48:05 UTC (rev 36701)
+++ trunk/struts/tests/org.jboss.tools.struts.ui.bot.test/src/org/jboss/tools/struts/ui/bot/test/utils/DndSupport.java 2011-11-28 16:11:30 UTC (rev 36702)
@@ -1,169 +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.struts.ui.bot.test.utils;
-
-import java.awt.AWTException;
-import java.awt.Robot;
-import java.awt.event.InputEvent;
-import java.text.MessageFormat;
-
-import org.apache.log4j.Logger;
-import org.eclipse.draw2d.FigureCanvas;
-import org.eclipse.jface.util.Geometry;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
-import org.eclipse.swtbot.swt.finder.results.Result;
-import org.eclipse.swtbot.swt.finder.results.VoidResult;
-
-/**
- * Drag and Drop implementation based on the last patch available
- * at https://bugs.eclipse.org/bugs/show_bug.cgi?id=285271
- *
- * @author jlukas
- * @see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=285271#c10">Original Patch</a>
- */
-public class DndSupport {
-
- private static final Logger L = Logger.getLogger(DndSupport.class.getName());
- private static final int robotDelay = Integer.getInteger("org.jboss.tools.struts.ui.bot.test.dndDelay", 150);
-
- public static void dnd(final TreeItem ti, final TreeItem ti2) {
- Rectangle r1 = UIThreadRunnable.syncExec(new Result<Rectangle>() {
-
- public Rectangle run() {
- return ti.getDisplay().map(ti.getParent(), null, ti.getBounds());
- }
- });
- final Point slightOffset = Geometry.add(Geometry.getLocation(r1),
- new Point(10, 10));
-
- Rectangle r2 = UIThreadRunnable.syncExec(new Result<Rectangle>() {
-
- public Rectangle run() {
- return ti2.getDisplay().map(ti2.getParent(), null,
- ti2.getBounds());
- }
- });
-
- doDragAndDrop(Geometry.min(Geometry.centerPoint(r1), slightOffset),
- Geometry.centerPoint(r2));
- }
-
- public static void dnd(final TreeItem ti, final FigureCanvas fc) {
- Rectangle r1 = UIThreadRunnable.syncExec(new Result<Rectangle>() {
-
- public Rectangle run() {
- return ti.getDisplay().map(ti.getParent(), null, ti.getBounds());
- }
- });
- final Point slightOffset = Geometry.add(Geometry.getLocation(r1),
- new Point(10, 10));
-
- Rectangle r2 = UIThreadRunnable.syncExec(new Result<Rectangle>() {
-
- public Rectangle run() {
- return fc.getDisplay().map(fc.getParent(), null, fc.getBounds());
- }
- });
-
- doDragAndDrop(Geometry.min(Geometry.centerPoint(r1), slightOffset),
- Geometry.centerPoint(r2));
- }
-
- public static void dnd(final TreeItem ti, final Control fc, final int x,
- final int y) {
- Rectangle r1 = UIThreadRunnable.syncExec(new Result<Rectangle>() {
-
- public Rectangle run() {
- return ti.getDisplay().map(ti.getParent(), null, ti.getBounds());
- }
- });
- final Point slightOffset = Geometry.add(Geometry.getLocation(r1),
- new Point(10, 10));
-
- Point r2 = UIThreadRunnable.syncExec(new Result<Point>() {
-
- public Point run() {
- L.info("xxx: " + fc.getLocation().x + ":"
- + fc.getLocation().y);
- return fc.getDisplay().map(fc, null, x, y);
- }
- });
-
- doDragAndDrop(Geometry.min(Geometry.centerPoint(r1), slightOffset), r2);
- }
-
- /**
- *
- */
- private static void doDragAndDrop(final Point source, final Point dest) {
- L.info(MessageFormat.format(
- "Drag-and-dropping from ({0},{1}) to ({2},{3})", source.x,
- source.y, dest.x, dest.y));
- try {
- final Robot awtRobot = new Robot();
- awtRobot.setAutoDelay(robotDelay);
- // the x+10 motion is needed to let native functions register a drag
- // detect. It did not work under Windows
- // otherwise and has been reported to be required for linux, too.
- // But I could not test that.
- UIThreadRunnable.syncExec(new VoidResult() {
-
- public void run() {
- awtRobot.mouseMove(source.x, source.y);
- awtRobot.mousePress(InputEvent.BUTTON1_MASK);
- awtRobot.mouseMove((source.x + 10), source.y);
- }
- });
-
- // now pause the test until all runnables on the Display thread have
- // run this is necessary for the pick up
- // to register on linux
- waitForIdle(awtRobot);
-
- UIThreadRunnable.syncExec(new VoidResult() {
-
- public void run() {
- awtRobot.mouseMove((dest.x + 10), dest.y);
- awtRobot.mouseMove(dest.x, dest.y);
- }
- });
-
- waitForIdle(awtRobot);
-
- UIThreadRunnable.syncExec(new VoidResult() {
-
- public void run() {
- awtRobot.mouseRelease(InputEvent.BUTTON1_MASK);
- }
- });
- waitForIdle(awtRobot);
- } catch (final AWTException e) {
- L.info(e.getMessage(), e);
- throw new RuntimeException(e);
- }
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- //ignore
- }
- }
-
- private static void waitForIdle(final Robot robot) {
- if (SWT.getPlatform().equals("gtk")) {
- robot.waitForIdle();
- }
- }
-}
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2011-11-28 15:48:05 UTC (rev 36701)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2011-11-28 16:11:30 UTC (rev 36702)
@@ -169,10 +169,12 @@
public static final String SECURE_STORAGE = "Secure Storage";
public static final String ADD_JSF_PROJECT_TEMPLATE = "Add JSF Project Template";
public static final String NEW_MANAGED_BEAN = "New Managed Bean";
+ public static final String NEW_MANAGED_BEAN_JSF2 = "Managed Bean...";
public static final String ADD_COMPONENT = "Add Component";
public static final String ADD_CONVERTER = "Add Converter";
public static final String ADD_REFERENCED_BEAN = "Add Referenced Bean";
public static final String ADD_RENDER_KIT = "Add Render Kit";
+ public static final String ADD_RENDER_KIT_JSF2 = "Render Kit...";
public static final String ADD_VALIDATOR = "Add Validator";
public static final String NEW_VIEW = "New View";
public static final String AUTO_LAYOUT = "Auto Layout";
13 years, 1 month