Package br.com.colibri.modelo

Examples of br.com.colibri.modelo.Cliente


  private List<Long> idsCadastrados = new ArrayList<Long>();

  @AfterClass
  public void apagarElementos() throws Exception {
    for (Long id : idsCadastrados) {
      Cliente cliente = new Cliente();
      cliente.setId(id);

      this.clienteDAO.remover(cliente);
    }
  }
View Full Code Here


    }
  }

  @Test
  public void testarInsercaoCliente() throws Exception {
    Cliente filme = new Cliente();
    filme.setNome("Joao Pereira");
    this.clienteDAO.inserirCliente(filme);
    idsCadastrados.add(filme.getId());
    Assert.assertNotNull(filme.getId(), "Erro ao inserir cliente - id null");

  }
View Full Code Here

  public void testarObterClientePorId() throws Exception {
    // recupera os clientes
    List<Cliente> clientes =
        this.clienteDAO.obterTodosClientes();
    // testa obter por id
    Cliente cliente =
        this.clienteDAO.obterPorId(clientes.get(0).getId());
    Assert.assertNotNull(cliente, "Erro ao obter cliente por id - filme null");
    Assert.assertNotNull(cliente.getId(), "Erro ao obter cliente por id - filme.id null");
    Assert.assertNotNull(cliente.getNome(), "Erro ao obter cliente por id - filme.nome null");
  }
View Full Code Here

  @Test(dependsOnMethods = "testarObterClientePorId")
  public void testarAtualizacaoCliente() throws Exception {
    // recupera os filmes
    List<Cliente> filmes =
        this.clienteDAO.obterTodosClientes();
    Cliente cliente = filmes.get(0);
    cliente.setNome("Joao Pereira");
    // atualiza filme
    this.clienteDAO.atualizar(cliente);
    // verifica atualizacao
    Cliente novoCliente =
        this.clienteDAO.obterPorId(cliente.getId());
    Assert.assertTrue("Joao Pereira".equals(novoCliente.getNome()), "Erro ao atualizar cliente - nome n�o atualizado");

  }
View Full Code Here

    }
  }

  @Test
  public void testarInsercaoLocacao() throws Exception {
    Cliente cliente = new Cliente();
    cliente.setNome("Joao Pereira da Silva");
    clienteDAO.inserirCliente(cliente);
   
   
    Filme filme = new Filme();
    filme.setNome("Homen de ferro 3");
View Full Code Here

  }
 
  public String cadastrarCliente() {   
    try {
      clienteDAO.inserirCliente(this.cliente);
      this.cliente = new Cliente();
      obterListagemClientes();
      FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Cliente cadastrado com sucesso.", null);       
      FacesContext.getCurrentInstance().addMessage(null, message);
    } catch (Exception e) {
      FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Ocorreu um erro ao cadastrar o cliente",  e.getMessage());       
View Full Code Here

    this.hibernateTemplate.merge(cliente);
  }
 
  @Transactional
  public Cliente obterPorId(Long id) throws Exception {
    Cliente cliente = (Cliente) hibernateTemplate.get(Cliente.class, id);
    return cliente;
  }
View Full Code Here

TOP

Related Classes of br.com.colibri.modelo.Cliente

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.