Package com.crawljax.core.state

Examples of com.crawljax.core.state.StateFlowGraph


  /**
   * The general shutdown procedure without running plugins or using browsers.
   */
  private void shutdown(long timeCrawlCalc) {
    StateFlowGraph stateFlowGraph = this.getSession().getStateFlowGraph();
    for (Eventable c : stateFlowGraph.getAllEdges()) {
      LOGGER.info("Interaction Element= " + c.toString());
    }
    LOGGER.info("Total Crawling time(" + timeCrawlCalc + "ms) ~= "
            + formatRunningTime(timeCrawlCalc));
    LOGGER.info("EXAMINED ELEMENTS: " + elementChecker.numberOfExaminedElements());
    LOGGER.info("CLICKABLES: " + stateFlowGraph.getAllEdges().size());
    LOGGER.info("STATES: " + stateFlowGraph.getAllStates().size());
    LOGGER.info("Dom average size (byte): " + stateFlowGraph.getMeanStateStringSize());
    LOGGER.info("DONE!!!");
  }
View Full Code Here


  /**
   * @return the state-flow graph from the saved CrawlSession
   */
  public StateFlowGraph getStateFlowGraph() {
    StateFlowGraph sfg = null;
    for (StateVertex state : savedCrawlSession.getMapStates().values()) {
      if (sfg == null) {
        sfg = new StateFlowGraph(state);
      } else {
        sfg.addState(state, false);
      }
    }
    for (Transition transition : savedCrawlSession.getTransitions()) {
      sfg.addEdge(savedCrawlSession.getMapStates().get(transition.getFromState()),
              savedCrawlSession.getMapStates().get(transition.getToState()),
              savedCrawlSession.getMapEventables().get(transition.getEventableId()));
    }
    return sfg;
  }
View Full Code Here

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

  private ImmutableList<Eventable> shortestPathTo(StateVertex crawlTask) {
    StateFlowGraph graph = context.getSession().getStateFlowGraph();
    return graph.getShortestPath(graph.getInitialState(), crawlTask);
  }
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

   * 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

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

  private ImmutableList<Eventable> shortestPathTo(StateVertex crawlTask) {
    StateFlowGraph graph = context.getSession().getStateFlowGraph();
    return graph.getShortestPath(graph.getInitialState(), crawlTask);
  }
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

  /**
   * @return the state-flow graph from the saved CrawlSession
   */
  public StateFlowGraph getStateFlowGraph() {
    StateFlowGraph sfg = null;
    for (StateVertix state : savedCrawlSession.getMapStates().values()) {
      if (sfg == null) {
        sfg = new StateFlowGraph(state);
      } else {
        sfg.addState(state, false);
      }
    }
    for (Transition transition : savedCrawlSession.getTransitions()) {
      sfg.addEdge(savedCrawlSession.getMapStates().get(transition.getFromState()),
              savedCrawlSession.getMapStates().get(transition.getToState()),
              savedCrawlSession.getMapEventables().get(transition.getEventableId()));
    }
    return sfg;
  }
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.