コード例 #1
0
  @Test
  public void testNormal() throws Exception {
    // create a context
    URL url =
        new URL(
            "http://demo.opengeo.org/geoserver/wms?Service=WMS&Version=1.1.1&Request=GetCapabilities"); //$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 != 0;
          }
        };
    Object[] actions = new Object[] {IDialogConstants.NEXT_ID, a1, IDialogConstants.CANCEL_ID};

    DialogDriver driver = new DialogDriver(dialog, actions);
    driver.schedule();

    dialog.open();

    assertFalse(a1.fail);
    driver.cancel();
  }
コード例 #2
0
  @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);
  }
コード例 #3
0
  @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);
  }
コード例 #4
0
  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);
  }