@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); }
@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(); }
@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); }