コード例 #1
0
 @Test
 public final void testSoapRequest() {
   SoapRequest request = null;
   try {
     request = new SoapRequest("getAdMedium");
   } catch (Exception e) {
     Assert.fail("Could not load document getAdMedium.xml due to error: " + e.getMessage());
   }
   Assert.assertNotNull("Request object should not be null.", request);
   Assert.assertNotNull("Document object should not be null.", request.getDocument());
 }
コード例 #2
0
  public List<Partido> consultaPartidos() {

    Type t = new TypeToken<List<Partido>>() {}.getType();
    List<Partido> partidos = soap.executeSoapRequest(EleicoesSOAP.METHOD_PARTIDOS, t);

    return partidos;
  }
コード例 #3
0
  public List<SetorEconomico> consultaSetoresEconomico() {

    Type t = new TypeToken<List<SetorEconomico>>() {}.getType();
    List<SetorEconomico> setores = soap.executeSoapRequest(EleicoesSOAP.METHOD_SETORES, t);

    return setores;
  }
コード例 #4
0
  public String consultaApplicationPath() {

    Type t = new TypeToken<String>() {}.getType();
    String result = soap.executeSoapRequest(EleicoesSOAP.METHOD_APP_PATH, t);

    return result;
  }
コード例 #5
0
  public List<Candidato> consultaCandidatos() {

    Type t = new TypeToken<List<Candidato>>() {}.getType();
    List<Candidato> candidatos = soap.executeSoapRequest(EleicoesSOAP.METHOD_CANDIDATOS, t);

    return candidatos;
  }
コード例 #6
0
  public List<Bem> consultaBens(String sequencialCandidato) {
    Type t = new TypeToken<List<Bem>>() {}.getType();
    List<PropertyInfo> params = new ArrayList<PropertyInfo>();
    params.add(createParam("sequencialCandidato", sequencialCandidato));
    List<Bem> bens = soap.executeSoapRequest(EleicoesSOAP.METHOD_BENS, t, params);

    return bens;
  }
コード例 #7
0
 public List<PessoaFisicaDoador> rankingMaioresDoadoresPessoaFisica(String UF) {
   Type t = new TypeToken<List<PessoaFisicaDoador>>() {}.getType();
   List<PropertyInfo> params = new ArrayList<PropertyInfo>();
   params.add(createParam("UF", UF));
   List<PessoaFisicaDoador> doadores =
       soap.executeSoapRequest(
           EleicoesSOAP.METHOD_RANKING_MAIORES_DOADORES_PESSOA_FISICA, t, params);
   return doadores;
 }
コード例 #8
0
  public List<Candidato> consultaCandidatos(int numero, String UF) {
    Type t = new TypeToken<List<Candidato>>() {}.getType();
    List<PropertyInfo> params = new ArrayList<PropertyInfo>();
    params.add(createParam("numero", numero, Integer.class));
    params.add(createParam("UF", UF));
    List<Candidato> candidatos = soap.executeSoapRequest(EleicoesSOAP.METHOD_CANDIDATOS, t, params);

    return candidatos;
  }
コード例 #9
0
  @Test
  public final void testCleanupUnsetValues() {
    try {
      request = new SoapRequest("getAdMedium");
    } catch (Exception e) {
      Assert.fail(e.getMessage());
    }

    Assert.assertNotNull(request);
    Assert.assertNotNull(request.getDocument());

    request.setValue("//ns:admediumId", "3096");

    Document document = request.getDocument();

    Namespace namespace =
        Namespace.getNamespace("ns", "http://api.zanox.com/namespace/2011-03-01/");
    document.getRootElement().addNamespaceDeclaration(namespace);

    XPathFactory xpfac = XPathFactory.instance();

    XPathExpression xp =
        xpfac.compile(
            "//ns:adspaceId",
            Filters.element(),
            null,
            document.getRootElement().getNamespacesInScope());

    List<Element> elements = xp.evaluate(document);

    Assert.assertNotNull("Result is null.", elements);
    Assert.assertTrue(
        "There should be at least the ns:adspaceId node in elements.", elements.size() == 1);
    Assert.assertTrue(
        "The text of the element should be '?'", elements.get(0).getText().toString().equals("?"));

    request.cleanupUnsetValues();

    elements = xp.evaluate(document);

    Assert.assertNotNull("Result is null.", elements);
    Assert.assertTrue(
        "There should be at least the ns:adspaceId node in elements.", elements.size() == 0);
  }
コード例 #10
0
  public float consultaTransacaoCandidato(String sequencialCandidato, String tipoTransacao) {

    Type t = new TypeToken<Float>() {}.getType();
    List<PropertyInfo> params = new ArrayList<PropertyInfo>();
    params.add(createParam("sequencialCandidato", sequencialCandidato));
    params.add(createParam("tipoTransacao", tipoTransacao));
    float valor = soap.executeSoapRequest(EleicoesSOAP.METHOD_PREST_CONTAS_CANDIDATOS, t, params);

    return valor;
  }
コード例 #11
0
  public String parserDados() {
    Type t = new TypeToken<String>() {}.getType();

    List<PropertyInfo> params = new ArrayList<PropertyInfo>();
    params.add(createParam("chaveSeguranca", AUTH_KEY));

    String result = soap.executeSoapRequest(EleicoesSOAP.METHOD_PARSER, t, params);

    return result;
  }
コード例 #12
0
  /**
   * @param sigla - Sigla do Partido
   * @param UF - Unidade Federada
   * @param tipo F - Física , J - Jurídica
   * @return Valor
   */
  public float consultaDoacoes(int numero, String UF, String tipo) {
    Type t = new TypeToken<List<Transacao>>() {}.getType();
    List<PropertyInfo> params = new ArrayList<PropertyInfo>();
    params.add(createParam("numero", numero, Integer.class));
    params.add(createParam("uf", UF));
    params.add(createParam("tipo", tipo));
    float valor = soap.executeSoapRequest(EleicoesSOAP.METHOD_BENS, t, params);

    return valor;
  }
コード例 #13
0
  public float consultaTransacaoPartido(int numero, String UF, String tipoTransacao) {

    Type t = new TypeToken<Float>() {}.getType();
    List<PropertyInfo> params = new ArrayList<PropertyInfo>();
    params.add(createParam("numero", numero, Integer.class));
    params.add(createParam("UF", UF));
    params.add(createParam("tipoTransacao", tipoTransacao));
    float valor = soap.executeSoapRequest(EleicoesSOAP.METHOD_PREST_CONTAS_PARTIDO, t, params);

    return valor;
  }
コード例 #14
0
  public List<Candidato> consultaCandidatosPorPartido(String siglaPartido, String UF) {
    Type t = new TypeToken<List<Candidato>>() {}.getType();

    List<PropertyInfo> params = new ArrayList<PropertyInfo>();
    params.add(createParam("siglaPartido", siglaPartido));
    params.add(createParam("UF", UF));

    List<Candidato> candidatos =
        soap.executeSoapRequest(EleicoesSOAP.METHOD_CANDIDATOS_POR_PARTIDO, t, params);

    return candidatos;
  }
コード例 #15
0
 public boolean lastRequestSucess() {
   return !soap.isError();
 }
コード例 #16
0
 public String getLastErrorMessage() {
   return soap.getLastError();
 }