Package net.azib.ipscan.core.ScanningResultList

Examples of net.azib.ipscan.core.ScanningResultList.ScanInfo


      throw new UserErrorException("commands.noResults");
    }
  }

  String prepareText() {
    ScanInfo scanInfo = scanningResults.getScanInfo();
    title2 = Labels.getLabel(scanInfo.isCompletedNormally() ?
        "text.scan.completed" : "text.scan.incomplete");
       
    String ln = System.getProperty("line.separator");
    StringBuilder text = new StringBuilder();
    text.append(Labels.getLabel("text.scan.time.total"))
      .append(timeToText(scanInfo.getScanTime())).append(ln);
    text.append(Labels.getLabel("text.scan.time.average"))
      .append(timeToText((double)scanInfo.getScanTime() / scanInfo.getHostCount())).append(ln);
   
    text.append(ln).append(scanningResults.getFeederName()).append(ln)
      .append(scanningResults.getFeederInfo()).append(ln).append(ln);
   
    text.append(Labels.getLabel("text.scan.hosts.total")).append(scanInfo.getHostCount()).append(ln);
    text.append(Labels.getLabel("text.scan.hosts.alive")).append(scanInfo.getAliveCount()).append(ln);
    if (scanInfo.getWithPortsCount() > 0)
      text.append(Labels.getLabel("text.scan.hosts.ports")).append(scanInfo.getWithPortsCount()).append(ln);
    return text.toString();
  }
View Full Code Here


    assertEquals(2, scanningResults.getScanInfo().getHostCount());
    assertEquals(2, scanningResults.getScanInfo().getAliveCount());
    assertEquals(2, scanningResults.getScanInfo().getWithPortsCount());
   
    // rescan: result is already registered, thus updated twice
    scanningResults.info = new ScanInfo();
    result = scanningResults.createResult(InetAddress.getByName("6.6.6.6"));
    result.setType(ResultType.ALIVE);
    result.reset();
    assertFalse(result.isReady());
    assertTrue(scanningResults.isRegistered(result));
View Full Code Here

    assertEquals(5, scanningResults.findText("0.0.", 2));
  }
 
  @Test
  public void testScanTime() throws Exception {
    ScanInfo scanInfo = scanningResults.getScanInfo();

    assertFalse(scanInfo.isCompletedNormally());
    long scanTime1 = scanInfo.getScanTime();
    assertTrue("Scanning has just begun", scanTime1 >= 0 && scanTime1 <= 10);
   
    Thread.sleep(10);
    scanningResults.new StopScanningListener().transitionTo(ScanningState.IDLE, Transition.COMPLETE);
    assertTrue(scanInfo.isCompletedNormally());
    long scanTime2 = scanInfo.getScanTime();
    assertTrue("Scanning has just finished", scanTime2 >= 10 && scanTime1 <= 20);
    assertTrue(scanTime1 != scanTime2);
    Thread.sleep(10);
    assertEquals(scanTime2, scanInfo.getScanTime());
  }
View Full Code Here

    Feeder feeder = mock(Feeder.class);
    when(feeder.getInfo()).thenReturn("info");
    when(feeder.getName()).thenReturn("text.ip");

    ScanningResultList scanningResults = new ScanningResultList(registry);
    scanningResults.info = new ScanInfo(); // initialize info so we can add a dummy result
    scanningResults.registerAtIndex(0, scanningResults.createResult(InetAddress.getLocalHost()));
   
    ScannerConfig config = mock(ScannerConfig.class);
    config.maxThreads = 10;
   
View Full Code Here

  }
 
  @Test
  public void dialogContent() throws Exception {
    ScanningResultList results = mock(ScanningResultList.class);
    ScanInfo scanInfo = new ScanInfo() {
      {
        this.startTime = System.currentTimeMillis();
        this.endTime = this.startTime + 10000;
        this.numScanned = 20;
        this.numAlive = 10;
View Full Code Here

TOP

Related Classes of net.azib.ipscan.core.ScanningResultList.ScanInfo

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.