Examples of StateVertex


Examples of com.crawljax.core.state.StateVertex

   */
  public StateVertex crawlIndex() {
    LOG.debug("Setting up vertex of the index page");
    browser.goToUrl(url);
    plugins.runOnUrlLoadPlugins(context);
    StateVertex index = vertexFactory.createIndex(url.toString(), browser.getStrippedDom(),
                    stateComparator.getStrippedDom(browser));
    Preconditions.checkArgument(index.getId() == StateVertex.INDEX_ID,
            "It seems some the index state is crawled more than once.");

    LOG.debug("Parsing the index for candidate elements");
    ImmutableList<CandidateElement> extract = candidateExtractor.extract(index);

View Full Code Here

Examples of com.crawljax.core.state.StateVertex

    List<Map<String, String>> elements =
            Lists.newArrayListWithCapacity(candidateElements.size());

    for (CandidateElementPosition element : candidateElements) {
      Eventable eventable = getEventableByCandidateElementInState(state, element);
      StateVertex toState = null;
      Map<String, String> elementMap = new HashMap<String, String>();
      elementMap.put("xpath", element.getXpath());
      elementMap
              .put("left", "" + (element.getLeft() - 3));
      elementMap.put("top", "" + (element.getTop() - 3));
      elementMap.put("width", "" + (element.getWidth() + 2));
      elementMap.put("height", "" + (element.getHeight() + 2));
      if (eventable != null) {
        toState = eventable.getTargetStateVertex();
      }
      if (toState != null) {
        elementMap.put("targetname", toState.getName());
        if (getStateNumber(toState.getName()) < getStateNumber(state.getName())) {
          // state already found
          elementMap.put("color", COLOR_A_PREVIOUS_STATE);
        } else {
          // new state
          elementMap.put("color", COLOR_NEW_STATE);
View Full Code Here

Examples of com.crawljax.core.state.StateVertex

    return elements;
  }

  private Eventable getEventableByCandidateElementInState(State state,
          CandidateElementPosition element) {
    StateVertex vertex = visitedStates.get(state.getName());
    for (Eventable eventable : sfg.getOutgoingClickables(vertex)) {
      // TODO Check if element.getIdentification().getValue() is correct replacement for
      // element.getXpath()
      if (eventable.getIdentification().getValue().equals(element.getXpath())) {
        return eventable;
View Full Code Here

Examples of com.crawljax.core.state.StateVertex

  }

  private void pollAndHandleCrawlTasks() throws InterruptedException {
    try {
      LOG.debug("Awaiting task");
      StateVertex crawlTask = candidates.awaitNewTask();
      int activeConsumers = runningConsumers.incrementAndGet();
      LOG.debug("There are {} active consumers", activeConsumers);
      handleTask(crawlTask);
    } catch (RuntimeException e) {
      LOG.error("Cound not complete state crawl: " + e.getMessage(), e);
View Full Code Here

Examples of com.crawljax.core.state.StateVertex

  @Override
  public CrawlSession call() {
    setMaximumCrawlTimeIfNeeded();
    plugins.runPreCrawlingPlugins(config);
    CrawlTaskConsumer firstConsumer = consumerFactory.get();
    StateVertex firstState = firstConsumer.crawlIndex();
    crawlSessionProvider.setup(firstState);
    plugins.runOnNewStatePlugins(firstConsumer.getContext(), firstState);
    executeConsumers(firstConsumer);
    return crawlSessionProvider.get();
  }
View Full Code Here

Examples of com.crawljax.core.state.StateVertex

   */
  private void goBackExact() throws CrawljaxException {
    /**
     * Thread safe
     */
    StateVertex curState = controller.getSession().getInitialState();

    for (Eventable clickable : backTrackPath) {

      if (!controller.getElementChecker().checkCrawlCondition(getBrowser())) {
        return;
View Full Code Here

Examples of com.crawljax.core.state.StateVertex

    }

    LOGGER.info("Executing " + eventable.getEventType() + " on element: " + eventable
            + "; State: " + this.getStateMachine().getCurrentState().getName());
    if (this.fireEvent(eventable)) {
      StateVertex newState =
              new StateVertex(getBrowser().getCurrentUrl(), controller.getSession()
                      .getStateFlowGraph().getNewStateName(), getBrowser().getDom(),
                      this.controller.getStrippedDom(getBrowser()));
      if (isDomChanged(this.getStateMachine().getCurrentState(), newState)) {
        // Dom is changed, so data might need be filled in again
        controller.getSession().addEventableToCrawlPath(eventable);
View Full Code Here

Examples of com.crawljax.core.state.StateVertex

  private ClickResult crawlAction(CandidateCrawlAction action) throws CrawljaxException {
    CandidateElement candidateElement = action.getCandidateElement();
    EventType eventType = action.getEventType();

    StateVertex orrigionalState = this.getStateMachine().getCurrentState();

    if (candidateElement.allConditionsSatisfied(getBrowser())) {
      ClickResult clickResult = clickTag(new Eventable(candidateElement, eventType));
      switch (clickResult) {
        case cloneDetected:
View Full Code Here

Examples of com.crawljax.core.state.StateVertex

    if (!checkConstraints()) {
      return false;
    }

    // Store the currentState to be able to 'back-track' later.
    StateVertex orrigionalState = this.getStateMachine().getCurrentState();

    if (orrigionalState.searchForCandidateElements(candidateExtractor, configurationReader
            .getTagElements(), configurationReader.getExcludeTagElements(),
            configurationReader.getCrawlSpecificationReader().getClickOnce())) {
      // Only execute the preStateCrawlingPlugins when it's the first time
      LOGGER.info("Starting preStateCrawlingPlugins...");
      List<CandidateElement> candidateElements =
              orrigionalState.getUnprocessedCandidateElements();
      CrawljaxPluginsUtil.runPreStateCrawlingPlugins(controller.getSession(),
              candidateElements);
      // update crawlActions
      orrigionalState.filterCandidateActions(candidateElements);
    }

    CandidateCrawlAction action =
            orrigionalState.pollCandidateCrawlAction(this, crawlQueueManager);
    while (action != null) {
      if (depthLimitReached(depth)) {
        return true;
      }

      if (!checkConstraints()) {
        return false;
      }
      ClickResult result = this.crawlAction(action);
      orrigionalState.finishedWorking(this, action);
      switch (result) {
        case newState:
          return newStateDetected(orrigionalState);
        case cloneDetected:
          return true;
        default:
          break;
      }
      action = orrigionalState.pollCandidateCrawlAction(this, crawlQueueManager);
    }
    return true;
  }
View Full Code Here

Examples of edu.brown.designer.partitioners.BranchAndBoundPartitioner.StateVertex

        hints.max_memory_per_partition = 1;
        hints.enable_procparameter_search = false;
        this.partitioner.setParameters(agraph, table_visit_order, proc_visit_order);
        this.partitioner.init(this.hints);
       
        StateVertex start_vertex = StateVertex.getStartVertex(Double.MAX_VALUE, Long.MAX_VALUE);
        TraverseThread thread = this.partitioner.new TraverseThread(info, hints, start_vertex, agraph, table_visit_order, proc_visit_order);
        assertNotNull(thread);
        thread.traverse(start_vertex, 0);
        this.partitioner.getHaltReason();
       
        // Make sure that the solution we pick has a memory and a cost
        StateVertex best_vertex = this.partitioner.getBestVertex();
        assertNotNull(best_vertex);
        assert(best_vertex.getCatalogKeyMap().isEmpty());
//        Map<CatalogType, CatalogType> m = best_vertex.getCatalogMap(catalog_db);
//        for (Table catalog_tbl : orig_partitioning.keySet()) {
//            assert(m.containsKey(catalog_tbl)) : "Missing " + catalog_tbl;
//            assertEquals(orig_partitioning.get(catalog_tbl).fullName(), m.get(catalog_tbl).fullName());
//        } // FOR
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.