@Test public void testNormalSelectedGeoResource() throws Exception { // create a workbench selection URL url = new URL( "http://demo.opengeo.org/geoserver/wms?Service=WMS&Version=1.1.1&Request=GetCapabilities#topp:tasmania_cities"); //$NON-NLS-1$ workflow.setContext(url); Assertion a1 = new Assertion() { @Override public void run() { fail = page.getViewer().getTree().getItemCount() != 1; if (!fail) { fail = page.getViewer().getTree().getItem(0).getItemCount() < 1; } if (!fail) fail = page.getViewer().getCheckedElements().length != 2; } }; Object[] actions = new Object[] {IDialogConstants.NEXT_ID, a1, IDialogConstants.CANCEL_ID}; DialogDriver driver = new DialogDriver(dialog, actions); driver.schedule(); dialog.setBlockOnOpen(true); dialog.open(); assertFalse(a1.fail); driver.cancel(); }
@Before public void setUp() throws Exception { ArrayList<String> l = new ArrayList<String>(); l.add("net.refractions.udig.catalog.ui.WMS"); // $NON-NLS-1$ UDIGConnectionFactoryDescriptor d = ConnectionFactoryManager.instance().getConnectionFactoryDescriptors(l).get(0); conn = new EndConnectionState(d, true); state = new ResourceSelectionState(); connPage = new ConnectionPageDecorator(); page = new ResourceSelectionPage("foo"); // $NON-NLS-1$ Map<Class<? extends State>, WorkflowWizardPageProvider> map = new HashMap<Class<? extends State>, WorkflowWizardPageProvider>(); map.put(state.getClass(), new BasicWorkflowWizardPageFactory(page)); map.put(conn.getClass(), new BasicWorkflowWizardPageFactory(connPage)); workflow = new Workflow(); workflow.setStates(new State[] {conn, state}); wizard = new WorkflowWizard(workflow, map); shell = new Shell(Display.getDefault()); dialog = new WorkflowWizardDialog(shell, wizard); dialog.setBlockOnOpen(true); }
public void testSelection() { // turn on and off a viewer selection Runnable r1 = new Runnable() { public void run() { page.getViewer().setSelection(new StructuredSelection()); SelectionChangedEvent event = new SelectionChangedEvent(page.getViewer(), new StructuredSelection()); page.selectionChanged(event); } }; Assertion a1 = new Assertion() { @Override public void run() { Button next = DialogDriver.findButton(dialog, IDialogConstants.NEXT_ID); fail = next.isEnabled(); } }; Runnable r2 = new Runnable() { public void run() { List l = page.getDescriptors(); page.getViewer().setSelection(new StructuredSelection(l.get(0))); } }; Assertion a2 = new Assertion() { @Override public void run() { Button next = DialogDriver.findButton(dialog, IDialogConstants.NEXT_ID); fail = !next.isEnabled(); } }; Object[] actions = new Object[] {r1, a1, r2, a2, IDialogConstants.CANCEL_ID}; DialogDriver driver = new DialogDriver(dialog, actions); driver.schedule(); dialog.open(); driver.cancel(); driver.cancel(); assertFalse(a1.fail); assertFalse(a2.fail); }
@Override protected void setUp() throws Exception { super.setUp(); state = new DataSourceSelectionState(true); page = new DataSourceSelectionPage(); Map<Class<? extends State>, WorkflowWizardPageProvider> map = new HashMap<Class<? extends State>, WorkflowWizardPageProvider>(); map.put(state.getClass(), new BasicWorkflowWizardPageFactory(page)); workflow = new Workflow(); workflow.setStates(new State[] {state}); wizard = new WorkflowWizard(workflow, map); shell = new Shell(Display.getDefault()); dialog = new WorkflowWizardDialog(shell, wizard); dialog.setBlockOnOpen(true); }
public void testWorkbenchSelection() { try { URL url = new URL( "http://wms.jpl.nasa.gov/wms.cgi?Service=WMS&Version=1.1.1&Request=GetCapabilities"); //$NON-NLS-1$ workflow.setContext(url); } catch (Exception e) { e.printStackTrace(); fail(); } Assertion a1 = new Assertion() { @Override public void run() { IStructuredSelection sselection = (IStructuredSelection) page.getViewer().getSelection(); UDIGConnectionFactoryDescriptor d = (UDIGConnectionFactoryDescriptor) sselection.getFirstElement(); fail = !d.getId().equals("net.refractions.udig.catalog.ui.WMS"); // $NON-NLS-1$ if (!fail) { Button button = DialogDriver.findButton(dialog, IDialogConstants.NEXT_ID); fail = !button.isEnabled(); } } }; Object[] actions = new Object[] {a1, IDialogConstants.CANCEL_ID}; DialogDriver driver = new DialogDriver(dialog, actions); driver.schedule(); dialog.open(); driver.cancel(); assertFalse(a1.fail); }