Package net.azib.ipscan.core

Examples of net.azib.ipscan.core.ScanningResult


  protected void populateShell() {
    shell.setText(Labels.getLabel("title.details"));
    shell.setLayout(LayoutHelper.formLayout(3, 3, 3));
    shell.setSize(guiConfig.detailsWindowSize);
   
    ScanningResult result = resultTable.getSelectedResult();
   
    commentsText = new Text(shell, SWT.BORDER); // TODO: change to SWT.SEARCH in SWT 3.5
    commentsText.pack();
    commentsText.setLayoutData(LayoutHelper.formData(new FormAttachment(0), new FormAttachment(100), null, new FormAttachment(100)));
    CommentsTextListener commentsTextListener = new CommentsTextListener();
    commentsText.addFocusListener(commentsTextListener);
    commentsText.addModifyListener(commentsTextListener);
    String comment = commentsConfig.getComment(result.getAddress());
    if (comment != null) {
      commentsText.setText(comment);
    }
    else {
      commentsTextListener.focusLost(null);
    }

    Text detailsText = new Text(shell, SWT.BORDER | SWT.READ_ONLY | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
    detailsText.setText(result.toString());
    detailsText.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    detailsText.setTabs(32);
    detailsText.setLayoutData(LayoutHelper.formData(new FormAttachment(0), new FormAttachment(100), new FormAttachment(0), new FormAttachment(commentsText)));
           
    Listener traverseListener = new TraverseListener();
View Full Code Here


    public void handleEvent(Event event) {
      TableItem item = (TableItem)event.item;
      int tableIndex = indexOf(item);
     
      ScanningResult scanningResult = scanningResults.getResult(tableIndex);
      List<?> values = scanningResult.getValues();
      String[] resultStrings = new String[values.size()];
      for (int i = 0; i < values.size(); i++) {       
        Object value = values.get(i);
        if (value != null)
          resultStrings[i] = value.toString();
      }      
      item.setText(resultStrings);
      item.setImage(0, listImages[scanningResult.getType().ordinal()]);
    }
View Full Code Here

     
      int numElements = resultTable.getItemCount();
      int startIndex = startIndex();
     
      for (int i = inc(startIndex); i < numElements && i >= 0; i = inc(i)) {
        ScanningResult scanningResult = results.getResult(i);
       
        if (whatToSearchFor.matches(scanningResult.getType())) {
          resultTable.setSelection(i);
          resultTable.setFocus();
          return;
        }
       
View Full Code Here

    when(fetcherRegistry.getSelectedFetcherIndex("fetcher.comment")).thenReturn(3);
    when(fetcherRegistry.getSelectedFetcherIndex("noSuchFetcher")).thenReturn(-1);

    ScanningResultList scanningResults = new ScanningResultList(fetcherRegistry);
    scanningResults.initNewScan(mockFeeder("info"));
    ScanningResult result = scanningResults.createResult(InetAddress.getByName("127.0.0.1"));
    result.setValue(0, new InetAddressHolder(InetAddress.getByName("127.0.0.1")));
    result.setValue(1, "HOSTNAME");
    result.setValue(2, new IntegerWithUnit(10, "ms"));
    scanningResults.registerAtIndex(0, result);
   
    OpenerLauncher ol = new OpenerLauncher(fetcherRegistry, scanningResults);
   
    assertEquals("\\\\127.0.0.1", ol.prepareOpenerStringForItem("\\\\${fetcher.ip}", 0));
    assertEquals("HOSTNAME$$$127.0.0.1xxx${}", ol.prepareOpenerStringForItem("${fetcher.hostname}$$$${fetcher.ip}xxx${}", 0));
    assertEquals("http://127.0.0.1:80/www", ol.prepareOpenerStringForItem("http://${fetcher.ip}:80/www", 0));
    assertEquals(result.getValues().get(2) + ", xx", ol.prepareOpenerStringForItem("${fetcher.ping}, xx", 0));
       
    try {
      ol.prepareOpenerStringForItem("${noSuchFetcher}", 0);
      fail();
    }
    catch (UserErrorException e) {
      assertEquals(Labels.getLabel("exception.UserErrorException.opener.unknownFetcher") + "noSuchFetcher", e.getMessage());
    }

    try {
      ol.prepareOpenerStringForItem("${fetcher.comment}", 0);
      fail();
    }
    catch (UserErrorException e) {
      assertEquals(Labels.getLabel("exception.UserErrorException.opener.nullFetcherValue") + "fetcher.comment", e.getMessage());
    }

    try {
      result.setValue(3, NotAvailable.VALUE);
      ol.prepareOpenerStringForItem("${fetcher.comment}", 0);
      fail();
    }
    catch (UserErrorException e) {
      assertEquals(Labels.getLabel("exception.UserErrorException.opener.nullFetcherValue") + "fetcher.comment", e.getMessage());
    }
   
    result.setValue(1, null);
    assertEquals("Hostname opening should fall back to the IP", "127.0.0.1", ol.prepareOpenerStringForItem("${" + HostnameFetcher.ID + "}", 0));
    result.setValue(1, NotAvailable.VALUE);
    assertEquals("Hostname opening should fall back to the IP", "127.0.0.1", ol.prepareOpenerStringForItem("${" + HostnameFetcher.ID + "}", 0));
  }
View Full Code Here

        if (sp.length < 3 || i < 8) continue;

        InetAddress addr = InetAddress.getByName(sp[ipIndex]);
        startIPAfterLoad = sp[ipIndex];

        ScanningResult r = new ScanningResult(addr, sp.length);
        if (portsIndex > 0 && sp[portsIndex].matches("\\d.*")) r.setType(WITH_PORTS);
        else if (pingIndex > 0 && sp[pingIndex].matches("\\d.*")) r.setType(ALIVE);
        else r.setType(DEAD);

        r.setValues(sp);
        results.add(r);
      }

      feeder.unserialize(startIPAfterLoad, endIp);
      return results;
View Full Code Here

TOP

Related Classes of net.azib.ipscan.core.ScanningResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.