Package org.jsoup.nodes

Examples of org.jsoup.nodes.Document


        Map<String, Object> root = createInspectionResultWrapper(ENTITY_NAME, DATE_PROP);

        Resource<URL> templateResource = resourceFactory.create(getClass().getResource(Deployments.BASE_PACKAGE_PATH + Deployments.BASIC_PROPERTY_DETAIL_INCLUDE));
        Template processor = processorFactory.create(templateResource, FreemarkerTemplate.class);
        String output = processor.process(root);
        Document html = Jsoup.parseBodyFragment(output);
        assertThat(output.trim(), not(equalTo("")));
       
        Elements container = html.select("div.form-group");
        assertThat(container, notNullValue());
        assertThat(container.attr("ng-class"), not(equalTo("")));
       
        Elements formInputElement = html.select("div.form-group date");
        assertThat(formInputElement.attr("id"), equalTo("dateOfBirth"));
        assertThat(formInputElement.attr("ng-model"), equalTo(StringUtils.camelCase(ENTITY_NAME)+"."+"dateOfBirth"));
    }
View Full Code Here


        Map<String, Object> root = createInspectionResultWrapper(ENTITY_NAME, TIME_PROP);

        Resource<URL> templateResource = resourceFactory.create(getClass().getResource(Deployments.BASE_PACKAGE_PATH + Deployments.BASIC_PROPERTY_DETAIL_INCLUDE));
        Template processor = processorFactory.create(templateResource, FreemarkerTemplate.class);
        String output = processor.process(root);
        Document html = Jsoup.parseBodyFragment(output);
        assertThat(output.trim(), not(equalTo("")));
       
        Elements container = html.select("div.form-group");
        assertThat(container, notNullValue());
        assertThat(container.attr("ng-class"), not(equalTo("")));
       
        Elements formInputElement = html.select("div.form-group time");
        assertThat(formInputElement.attr("id"), equalTo("alarmTime"));
        assertThat(formInputElement.attr("ng-model"), equalTo(StringUtils.camelCase(ENTITY_NAME)+"."+"alarmTime"));
    }
View Full Code Here

    public void testGenerateBasicDatetimeProperty() throws Exception {
        Map<String, Object> root = createInspectionResultWrapper(ENTITY_NAME, DATETIME_PROP);
        Resource<URL> templateResource = resourceFactory.create(getClass().getResource(Deployments.BASE_PACKAGE_PATH + Deployments.BASIC_PROPERTY_DETAIL_INCLUDE));
        Template processor = processorFactory.create(templateResource, FreemarkerTemplate.class);
        String output = processor.process(root);
        Document html = Jsoup.parseBodyFragment(output);
        assertThat(output.trim(), not(equalTo("")));
       
        Elements container = html.select("div.form-group");
        assertThat(container, notNullValue());
        assertThat(container.attr("ng-class"), not(equalTo("")));
       
        Elements formInputElement = html.select("div.form-group datetime");
        assertThat(formInputElement.attr("id"), equalTo("auditTimestamp"));
        assertThat(formInputElement.attr("ng-model"), equalTo(StringUtils.camelCase(ENTITY_NAME)+"."+"auditTimestamp"));
    }
View Full Code Here

        Map<String, Object> root = createInspectionResultWrapper(ENTITY_NAME, BOOLEAN_PROP);

        Resource<URL> templateResource = resourceFactory.create(getClass().getResource(Deployments.BASE_PACKAGE_PATH + Deployments.BASIC_PROPERTY_DETAIL_INCLUDE));
        Template processor = processorFactory.create(templateResource, FreemarkerTemplate.class);
        String output = processor.process(root);
        Document html = Jsoup.parseBodyFragment(output);
        assertThat(output.trim(), not(equalTo("")));
       
        Elements container = html.select("div.form-group");
        assertThat(container, notNullValue());
        assertThat(container.attr("ng-class"), not(equalTo("")));
       
        Elements formInputElement = html.select("div.form-group input");
        assertThat(formInputElement.attr("id"), equalTo("optForMail"));
        assertThat(formInputElement.attr("type"), equalTo("checkbox"));
        assertThat(formInputElement.attr("ng-model"), equalTo(StringUtils.camelCase(ENTITY_NAME)+"."+"optForMail"));
    }
View Full Code Here

        Map<String, Object> root = createInspectionResultWrapper(ENTITY_NAME, ONE_TO_MANY_PROP);

        Resource<URL> templateResource = resourceFactory.create(getClass().getResource(Deployments.BASE_PACKAGE_PATH + Deployments.N_TO_MANY_PROPERTY_DETAIL_INCLUDE));
        Template processor = processorFactory.create(templateResource, FreemarkerTemplate.class);
        String output = processor.process(root);
        Document html = Jsoup.parseBodyFragment(output);
        assertThat(output.trim(), not(equalTo("")));
       
        Elements container = html.select("div.form-group");
        assertThat(container, notNullValue());
        assertThat(container.attr("ng-class"), not(equalTo("")));
       
        Elements nToManyWidgetElement = html.select("div.form-group > div.col-sm-10");
        assertThat(nToManyWidgetElement, notNullValue());

        Elements selectElement = nToManyWidgetElement.select(" > select");
        assertThat(selectElement.attr("id"), equalTo(oneToManyProperty));
        assertThat(selectElement.attr("multiple"), notNullValue());
View Full Code Here

        Map<String, Object> root = createInspectionResultWrapper(ENTITY_NAME, MANY_TO_MANY_PROP);

        Resource<URL> templateResource = resourceFactory.create(getClass().getResource(Deployments.BASE_PACKAGE_PATH + Deployments.N_TO_MANY_PROPERTY_DETAIL_INCLUDE));
        Template processor = processorFactory.create(templateResource, FreemarkerTemplate.class);
        String output = processor.process(root);
        Document html = Jsoup.parseBodyFragment(output);
        assertThat(output.trim(), not(equalTo("")));
       
        Elements container = html.select("div.form-group");
        assertThat(container, notNullValue());
        assertThat(container.attr("ng-class"), not(equalTo("")));
       
        Elements nToManyWidgetElement = html.select("div.form-group > div.col-sm-10");
        assertThat(nToManyWidgetElement, notNullValue());

        Elements selectElement = nToManyWidgetElement.select(" > select");
        assertThat(selectElement.attr("id"), equalTo(manyToManyProperty));
        assertThat(selectElement.attr("multiple"), notNullValue());
View Full Code Here

  private String getStringContents(final Object contentObject) throws CRException {
    String htmlString = getContents(contentObject);
    String result = "";
    try {
      if (htmlString != null) {
        Document documentFragment = Jsoup.parseBodyFragment(htmlString);
        result = retrieveContent(documentFragment);

        if (result.equals("")) {
          String fragmentText = documentFragment.text();
          if (fragmentText != null) {
            result = fragmentText;
          }
        }
      }
View Full Code Here

  @Override
  public List<Account> getAccounts() {
    List<Account> vAccounts = new ArrayList<Account>();
    BankResponse vAccountsRequest = mBankClient.get(new BankRequest(ACCOUNTS_URL));
    String response = vAccountsRequest.body();
    Document doc = Jsoup.parse(response);
    Element el = doc.getElementById("summaryImageHeaderRow");

    if (el != null) {
      Account account = new Account();
      account.setName(el.getElementById("headerSectionLeft").select("span.cardTitle a").text());
      account.setAccountType(AccountType.LIABILITY);
      Element link = el.select("div.summaryTitles a").first();
      account.setAccountNumber(link.text());
      account.setCurrency(Currency.getInstance("SEK"));
      account.setId(parseAccountId(link));

      String balance = doc.getElementById("colOSBalance").select("div.summaryValues").text();
      balance = balance.replaceAll("[^\\d-,]", "").replace(",", ".");
      account.setBalance(new BigDecimal(balance));
      account.setAvailable(account.getBalance());
      vAccounts.add(account);
    }
View Full Code Here

  @Override
  public Pagination parsePagination(BankResponse pBankResponse) {
    Pagination pagination = new Pagination();

    Document doc = Jsoup.parse(pBankResponse.body());
    Element element = doc.select("#viewPeriod option[selected]").first();

    Element previous = element.previousElementSibling();
    if (previous != null) {
      pagination.setPrev(Integer.parseInt(previous.val()));
    }
View Full Code Here

  }

  private List<Transaction> parseTransactions(BankResponse pResponse) {
    List<Transaction> transactions = new ArrayList<Transaction>();

    Document doc = Jsoup.parse(pResponse.body());
    Element transactionTable = doc.getElementById("table-txnsCard0");
    if (transactionTable != null) {
      for (Element transaction : transactionTable.select("tbody tr")) {
        transactions.add(parseTransaction(transaction));
      }
    }
View Full Code Here

TOP

Related Classes of org.jsoup.nodes.Document

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.