Package net.azib.ipscan.core

Examples of net.azib.ipscan.core.ScanningResultList


    protected int startIndex() {
      return resultTable.getSelectionIndex();
    }

    public final void handleEvent(Event event) {
      ScanningResultList results = resultTable.getScanningResults();
     
      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


        statusBar.setStatusText(null);       
      }
    }

    private void findText(String text, Shell activeShell) {
      ScanningResultList results = resultTable.getScanningResults();
     
      int startIndex = resultTable.getSelectionIndex() + 1;
     
      int foundIndex = results.findText(text, startIndex);         
     
      if (foundIndex >= 0) {
        // if found, then select and finish
        resultTable.setSelection(foundIndex);
        resultTable.setFocus();
View Full Code Here

    when(fetcherRegistry.getSelectedFetcherIndex(HostnameFetcher.ID)).thenReturn(1);
    when(fetcherRegistry.getSelectedFetcherIndex(PingFetcher.ID)).thenReturn(2);
    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));
View Full Code Here

    assertEquals("2.5\u00A0h", StatisticsDialog.timeToText(9036000));
  }
 
  @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;
        this.numWithPorts = 5;
      }
    };
   
    when(results.getScanInfo()).thenReturn(scanInfo);
    when(results.getFeederName()).thenReturn("SomeFeeder");
    when(results.getFeederInfo()).thenReturn("SomeInfoHere");

    String text = new StatisticsDialog(results).prepareText();
   
    assertNotNull(text);
    assertTrue(text.contains(Labels.getLabel("text.scan.time.total") + "10"));
View Full Code Here

  @Test
  public void testProcess() throws Exception {
    File file = File.createTempFile("exportTest", "txt");
    ExportProcessor exportProcessor = new ExportProcessor(new TXTExporter(), file, false);
   
    ScanningResultList scanningResultList = new ScanningResultList(fetcherRegistry);
    scanningResultList.initNewScan(mockFeeder("megaFeeder"));
    scanningResultList.registerAtIndex(0, scanningResultList.createResult(InetAddress.getByName("192.168.0.13")));
    exportProcessor.process(scanningResultList, null);
   
    String content = readFileContent(file);
   
    assertTrue(content.indexOf("megaFeeder") > 0);
View Full Code Here

  @Test
  public void testProcessWithFilter() throws Exception {
    File file = File.createTempFile("exportTest", "txt");
    ExportProcessor exportProcessor = new ExportProcessor(new TXTExporter(), file, false);
   
    ScanningResultList scanningResultList = new ScanningResultList(fetcherRegistry);
    scanningResultList.initNewScan(mockFeeder("feeder2"));
   
    scanningResultList.registerAtIndex(0, scanningResultList.createResult(InetAddress.getByName("192.168.13.66")));
    scanningResultList.registerAtIndex(1, scanningResultList.createResult(InetAddress.getByName("192.168.13.67")));
    scanningResultList.registerAtIndex(2, scanningResultList.createResult(InetAddress.getByName("192.168.13.76")));
   
    exportProcessor.process(scanningResultList, new ScanningResultFilter() {
      public boolean apply(int index, ScanningResult result) {
        // select only IP addresses ending with 6
        return ((String)result.getValues().get(0)).endsWith("6");
View Full Code Here

TOP

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

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.