Package com.crawljax.core.state

Examples of com.crawljax.core.state.StateFlowGraph


   * Shows <a href='https://github.com/crawljax/crawljax/issues/97'>Issue 97</a>
   */
  @Test
  public void whenHiddenElementsOfItShouldntCrawl() throws Exception {
    CrawlSession crawl = new BaseCrawler("hidden-elements-site").crawl();
    StateFlowGraph stateFlowGraph = crawl.getStateFlowGraph();

    // this includes the bug of #97
    int expectedStates = 3 - 2;
    assertThat(stateFlowGraph, hasStates(expectedStates));
  }
View Full Code Here


      candidateActionCache.purgeActionsForState(ex.getTarget());
    }
  }

  private ImmutableList<Eventable> shortestPathTo(StateVertex crawlTask) {
    StateFlowGraph graph = context.getSession().getStateFlowGraph();
    return graph.getShortestPath(graph.getInitialState(), crawlTask);
  }
View Full Code Here

    verifyGraphSize(SimpleInputSiteCrawl.NUMBER_OF_STATES,
            SimpleInputSiteCrawl.NUMBER_OF_EDGES);
  }

  private void verifyGraphSize(int numberOfStates, int numberOfEdges) throws Exception {
    StateFlowGraph stateFlowGraph = crawl.getStateFlowGraph();
    assertThat(stateFlowGraph, hasStates(numberOfStates));
    assertThat(stateFlowGraph, hasEdges(numberOfEdges));
  }
View Full Code Here

  public Statistics(CrawlSession session, StateStatistics stateStats, Date startDate,
          int failedEvents) {
    this.stateStats = stateStats;
    this.failedEvents = failedEvents;
    this.startDate = new Date(startDate.getTime());
    StateFlowGraph stateFlowGraph = session.getStateFlowGraph();
    this.duration = calculateDuration(session);
    this.edges = stateFlowGraph.getAllEdges().size();
    this.crawlPaths = session.getCrawlPaths().size();
    double bytes = stateFlowGraph.getMeanStateStringSize();
    this.averageDomSize = new DecimalFormat().format(bytes / 1000) + " kB";
  }
View Full Code Here

      LOG.debug("Domain escape was {}", e.getMessage());
    }
  }

  private ImmutableList<Eventable> shortestPathTo(StateVertex crawlTask) {
    StateFlowGraph graph = context.getSession().getStateFlowGraph();
    return graph.getShortestPath(graph.getInitialState(), crawlTask);
  }
View Full Code Here

   * Generated the report.
   */
  @Override
  public void postCrawling(CrawlSession session, ExitStatus exitStatus) {
    LOG.debug("postCrawling");
    StateFlowGraph sfg = session.getStateFlowGraph();
    result = outModelCache.close(session, exitStatus);
    outputBuilder.write(result, session.getConfig());
    StateWriter writer = new StateWriter(outputBuilder, sfg,
            ImmutableMap.copyOf(visitedStates));
    for (State state : result.getStates().values()) {
View Full Code Here

        builder.crawlRules().crawlHiddenAnchors(true);
        return builder;
      }
    }.crawl();

    StateFlowGraph stateFlowGraph = crawl.getStateFlowGraph();
    /*
     * TODO Fix issue #97 https://github.com/crawljax/crawljax/issues/97 It is now party hacked
     * by following HREF links.
     */
    int withIssue97 = 3 - 1;
View Full Code Here

   * Shows <a href='https://github.com/crawljax/crawljax/issues/97'>Issue 97</a>
   */
  @Test
  public void whenHiddenElementsOfItShouldntCrawl() throws Exception {
    CrawlSession crawl = new BaseCrawler("hidden-elements-site").crawl();
    StateFlowGraph stateFlowGraph = crawl.getStateFlowGraph();

    // this includes the bug of #97
    int expectedStates = 3 - 2;
    assertThat(stateFlowGraph, hasStates(expectedStates));
  }
View Full Code Here

      LOGGER.info("Max time " + maxCrawlTime + " seconds passed!");
      /* stop crawling */
      return false;
    }
    StateFlowGraph graph = controller.getSession().getStateFlowGraph();
    int maxNumberOfStates =
            configurationReader.getCrawlSpecificationReader().getMaxNumberOfStates();
    if ((maxNumberOfStates != 0) && (graph.getAllStates().size() >= maxNumberOfStates)) {
      LOGGER.info("Max number of states " + maxNumberOfStates + " reached!");
      /* stop crawling */
      return false;
    }
    /* continue crawling */
 
View Full Code Here

                    .getDom(), controller.getStrippedDom(this.getBrowser()));

    /**
     * Build the StateFlowGraph
     */
    StateFlowGraph stateFlowGraph = new StateFlowGraph(indexState);

    /**
     * Build the StateMachine
     */
    stateMachine =
View Full Code Here

TOP

Related Classes of com.crawljax.core.state.StateFlowGraph

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.