Package com.agiletec.plugins.jpwtt.aps.system.services.ticket.model

Examples of com.agiletec.plugins.jpwtt.aps.system.services.ticket.model.Ticket


    return ticketIds;
  }
 
  @Override
  public Ticket getTicket(String code) throws ApsSystemException {
    Ticket ticket = null;
    try {
      ticket = this.getTicketDAO().loadTicket(code);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "getTicket");
      throw new ApsSystemException("Error loading ticket", t);
View Full Code Here


  public void testList() throws Throwable {
    String username = "mainEditor";
    try {
      assertEquals(0, this._ticketManager.searchTicketIds(null).size());
      Ticket t1 = this._helper.createTicket(null, new Date(), "subject1", "message1", username, 0, 0, "pageManagerCustomers", null, Ticket.STATES_OPENED, null, false);
      this._ticketManager.addTicket(t1);
      Ticket t2 = this._helper.createTicket(null, new Date(), "subject2", "message2", username, 1, 1, "mainEditor", null, Ticket.STATES_ASSIGNED, new Date(), false);
      this._ticketManager.addTicket(t2);
      Ticket t3 = this._helper.createTicket(null, new Date(), "subject3", "message3", username, 2, 2, "editorCustomers", null, Ticket.STATES_CLOSED, null, false);
      this._ticketManager.addTicket(t3);

      this.setUserOnSession(username);
      this.initAction("/do/jpwtt/Ticket/User", "list");
      String result = this.executeAction();
      assertEquals(Action.SUCCESS, result);

      AbstractTicketFinderAction action = (AbstractTicketFinderAction) this.getAction();

      List<String> ticketIds = action.getTicketIds();
      assertEquals(3, ticketIds.size());
      assertTrue(ticketIds.contains(t1.getCode()));
      assertTrue(ticketIds.contains(t2.getCode()));
      assertTrue(ticketIds.contains(t3.getCode()));
    } catch (Throwable t) {
      throw t;
    } finally {
      this._helper.deleteTickets();
    }
View Full Code Here

  public void testSearch() throws Throwable {
    String username = "mainEditor";
    try {
      assertEquals(0, this._ticketManager.searchTicketIds(null).size());
      Ticket t1 = this._helper.createTicket(null, new Date(), null, "message1", username, 0, 0, "pageManagerCustomers", null, Ticket.STATES_OPENED, null, false);
      this._ticketManager.addTicket(t1);
      Ticket t2 = this._helper.createTicket(null, new Date(), null, "message2", username, 1, 1, "mainEditor", null, Ticket.STATES_ASSIGNED, new Date(), false);
      this._ticketManager.addTicket(t2);
      Ticket t3 = this._helper.createTicket(null, new Date(), null, "message3", username, 2, 2, "editorCustomers", null, Ticket.STATES_ASSIGNABLE, null, true);
      this._ticketManager.addTicket(t3);
      Ticket t4 = this._helper.createTicket(null, new Date(), null, "message4", "pageManagerCustomers", 1, 0, "editorCustomers", null, Ticket.STATES_CLOSED, new Date(), false);
      this._ticketManager.addTicket(t4);

      Map<String, String> params = this.prepareParams("message2", "", "", "", "", "", "", "");
      String result = this.executeSearch(username, params); // message2 = 'message2'
      assertEquals(Action.SUCCESS, result);
View Full Code Here

public class TestUserTicketAction extends ApsAdminPluginBaseTestCase {

  public void testView() throws Throwable {
    try {
      assertEquals(0, this._ticketManager.searchTicketIds(null).size());
      Ticket t1 = this._helper.createTicket(null, new Date(), null, "message1", "mainEditor", 0, 0, "pageManagerCustomers", null, Ticket.STATES_OPENED, null, false);
      this._ticketManager.addTicket(t1);

      String result = this.executeView("pageManagerCustomers", t1.getCode());
      assertEquals("ticketNotFound", result);

      result = this.executeView("mainEditor", t1.getCode());
      assertEquals(Action.SUCCESS, result);

      UserTicketAction action = (UserTicketAction) this.getAction();
      Ticket ticket = action.getTicket();
      this.compareTickets(t1, ticket);
      assertEquals(0, action.getTicketOperations().size());
    } catch (Throwable t) {
      throw t;
    } finally {
View Full Code Here

      String result = this.executeSave(username, params);
      assertEquals(Action.SUCCESS, result);

      List<String> ticketIds = this._ticketManager.searchTicketIds(null);
      assertEquals(1, ticketIds.size());
      Ticket ticket = this._ticketManager.getTicket(ticketIds.get(0));
      assertEquals("nome", ticket.getNome());
      assertEquals("cognome", ticket.getCognome());
      assertEquals("codFisc890123456", ticket.getCodFisc());
      assertEquals("comune", ticket.getComune());
      assertEquals("indirizzo", ticket.getIndirizzo());
      assertEquals("email@email.it", ticket.getEmail());
      assertEquals(1, ticket.getUserInterventionType());
      assertNull(ticket.getMessage());
      assertNull(ticket.getTelefono());
      assertNull(ticket.getNumeroIndirizzo());
      assertNull(ticket.getTipoIndirizzo());
      assertNull(ticket.getLocalita());

      assertEquals(Ticket.STATES_OPENED, ticket.getStatus());
      assertEquals(username, ticket.getAuthor());
      assertNotNull(ticket.getCreationDate());
      assertNull(ticket.getClosingDate());
      assertNull(ticket.getWttOperator());
      assertFalse(ticket.isResolved());
      assertEquals(0, ticket.getPriority());
    } catch (Throwable t) {
      throw t;
    } finally {
      this._helper.deleteTickets();
    }
View Full Code Here

  public Ticket createTicket(String code, Date creationDate, String nome, String cognome, String codFisc,
      String comune, String localita, String tipoIndirizzo, String indirizzo, String numeroIndirizzo,
      String telefono, String email, String message, String author, int userInterventionType,
      int opInterventionType, int priority, String operator, String wttRole, int status, Date closingDate, boolean resolved) {
    Ticket ticket = new Ticket();
    ticket.setCode(code);
    ticket.setCreationDate(creationDate);
    ticket.setNome(nome);
    ticket.setCognome(cognome);
    ticket.setCodFisc(codFisc);
    ticket.setComune(comune);
    ticket.setLocalita(localita);
    ticket.setTipoIndirizzo(tipoIndirizzo);
    ticket.setIndirizzo(indirizzo);
    ticket.setNumeroIndirizzo(numeroIndirizzo);
    ticket.setTelefono(telefono);
    ticket.setEmail(email);
    ticket.setMessage(message);
    ticket.setAuthor(author);
    ticket.setUserInterventionType(userInterventionType);
    ticket.setOpInterventionType(opInterventionType);
    ticket.setPriority(priority);
    ticket.setWttOperator(operator);
    ticket.setWttRole(wttRole);
    ticket.setStatus(status);
    ticket.setClosingDate(closingDate);
    ticket.setResolved(resolved);
    return ticket;
  }
View Full Code Here

    this.init();
  }

  public void testAddLoadTicket() throws Throwable {
    String code = "code";
    Ticket ticket = this._helper.createTicket(code, new Date(), "nome", "cognome", "codFisc", "comune", "localita", "indT",
        "indirizzo", "numInd", "telefono", "email@email.itte", "message", "mainEditor", 0, 0, 0, null, null, Ticket.STATES_OPENED, null, false);
    try {
      assertEquals(0, this._ticketDAO.searchTicketIds(null).size());
      this._ticketDAO.addTicket(ticket);
      assertEquals(1, this._ticketDAO.searchTicketIds(null).size());
      Ticket addedTicket = this._ticketDAO.loadTicket(code);
      this.compareTickets(ticket, addedTicket);
    } catch (Throwable t) {
      throw t;
    } finally {
      this._helper.deleteTickets();
View Full Code Here

    }
  }

  public void testAddLoadTicketOperation() throws Throwable {
    String code = "code";
    Ticket ticket = this._helper.createTicket(code, new Date(), "nome", "cognome", "codFisc", "comune",
        "localita", "indT", "indirizzo", "numInd", "telefono", "email@email.itte", "message",
        "mainEditor", 0, 1, 0, "admin", "pageManager", Ticket.STATES_OPENED, null, false);
    try {
      assertEquals(0, this._ticketDAO.searchTicketIds(null).size());
      this._ticketDAO.addTicket(ticket);
      assertEquals(1, this._ticketDAO.searchTicketIds(null).size());

      Ticket modifiedTicket = this._helper.createTicket(code, new Date(), "nome2", "cognome2", "codFisc2", "comune2",
          "localita2", "ind2", "indirizzo2", "num2", "telefono2", "email2@email.itte", "message2", "editorCustomers",
          1, 0, 1, "mainEditor", null, Ticket.STATES_ASSIGNED, new Date(), true);
      TicketOperation operation1 = this._helper.createTicketOperation(1, code, "editorCustomers", TicketOperation.OPERATIONS_ANSWER, "note1", 0, 0, "pageManager", new Date());
      this._ticketDAO.updateTicketWithOperation(modifiedTicket, operation1);
      Ticket updatedTicket = this._ticketDAO.loadTicket(code);
      this.compareTickets(modifiedTicket, updatedTicket);

      TicketOperation operation2 = this._helper.createTicketOperation(2, code, "mainEditor", TicketOperation.OPERATIONS_UPDATE, "note2", 0, 0, null, new Date());
      this._ticketDAO.updateTicketWithOperation(ticket, operation2);
      updatedTicket = this._ticketDAO.loadTicket(code);
View Full Code Here

  }

  public void testLoadTickets() throws Throwable {
    try {
      assertEquals(0, this._ticketDAO.searchTicketIds(null).size());
      Ticket t1 = this._helper.createTicket("code1", new Date(), "nome1", "cognome1", "codFisc1", "comune1",
          "localita1", "ind1", "indirizzo1", "num1", "telefono1", "email1@email.itte", "message1",
          "mainEditor", 0, 1, 0, "pageManagerCustomers", "pageManager", Ticket.STATES_OPENED, null, false);
      this._ticketDAO.addTicket(t1);
      Ticket t2 = this._helper.createTicket("code2", new Date(), null, "message2", "editorCustomers",
          1, 1, "mainEditor", null, Ticket.STATES_ASSIGNED, new Date(), false);
      this._ticketDAO.addTicket(t2);
      Ticket t3 = this._helper.createTicket("code3", new Date(), null, "message3", "mainEditor",
          2, 2, "editorCustomers", null, Ticket.STATES_CLOSED, null, false);
      this._ticketDAO.addTicket(t3);
      Ticket t4 = this._helper.createTicket("code4", new Date(), null, "message4", "pageManagerCustomers",
          1, 0, "editorCustomers", null, Ticket.STATES_ASSIGNABLE, new Date(), true);
      this._ticketDAO.addTicket(t4);

      List<Ticket> tickets = this._ticketDAO.loadTickets();
      assertEquals(4, tickets.size());
View Full Code Here

  }

  public void testSearchTicketIds() throws Throwable {
    try {
      assertEquals(0, this._ticketDAO.searchTicketIds(null).size());
      Ticket t1 = this._helper.createTicket("code1", new Date(), "nome1", "cognome1", "codFisc1", "comune1",
          "localita1", "ind1", "indirizzo1", "num1", "telefono1", "email1@email.itte", "message1",
          "mainEditor", 0, 1, 0, "pageManagerCustomers", "pageManager", Ticket.STATES_OPENED, null, false);
      this._ticketDAO.addTicket(t1);
      Ticket t2 = this._helper.createTicket("code2", new Date(), null, "message2", "editorCustomers",
          1, 1, "mainEditor", null, Ticket.STATES_ASSIGNED, new Date(), false);
      this._ticketDAO.addTicket(t2);
      Ticket t3 = this._helper.createTicket("code3", new Date(), null, "message3", "mainEditor",
          2, 2, "editorCustomers", null, Ticket.STATES_CLOSED, null, false);
      this._ticketDAO.addTicket(t3);
      Ticket t4 = this._helper.createTicket("code4", new Date(), null, "message4", "pageManagerCustomers",
          1, 0, "editorCustomers", null, Ticket.STATES_WORKING, new Date(), true);
      this._ticketDAO.addTicket(t4);

      // message = 'message2'
      TicketSearchBean searchBean = this._helper.createSearchBean("message2", null, null, null, null, null, null, null, null);
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jpwtt.aps.system.services.ticket.model.Ticket

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.