Search in sources :

Example 11 with Ticket

use of org.opennms.api.integration.ticketing.Ticket in project opennms by OpenNMS.

the class CentricTicketerPluginTest method testSave.

public void testSave() {
    Ticket ticket = new Ticket();
    ticket.setState(Ticket.State.OPEN);
    ticket.setSummary("This is the summary");
    ticket.setDetails("These are the details");
    m_ticketer.saveOrUpdate(ticket);
    assertNotNull(ticket.getId());
    Ticket newTicket = m_ticketer.get(ticket.getId());
    assertNotNull(newTicket);
    assertTicketEquals(ticket, newTicket);
}
Also used : Ticket(org.opennms.api.integration.ticketing.Ticket)

Example 12 with Ticket

use of org.opennms.api.integration.ticketing.Ticket in project opennms by OpenNMS.

the class CentricTicketerPluginTest method testGet.

public void testGet() {
    //This may need to be changed ;-)
    String ticketId = "92";
    Ticket newTicket = m_ticketer.get(ticketId);
    assertNotNull(newTicket);
    assertEquals(ticketId, newTicket.getId());
    assertTrue(newTicket.getSummary().startsWith("A Ticket at"));
//TODO: Implement this later when we need 2 way retrieval of comments/details
//assertEquals("These are the details", newTicket.getDetails());
}
Also used : Ticket(org.opennms.api.integration.ticketing.Ticket)

Example 13 with Ticket

use of org.opennms.api.integration.ticketing.Ticket in project opennms by OpenNMS.

the class CentricTicketerPluginTest method testUpdate.

public void testUpdate() throws Exception {
    String summary = "A Ticket at " + new Date();
    Ticket ticket = new Ticket();
    ticket.setState(Ticket.State.OPEN);
    ticket.setSummary(summary);
    ticket.setDetails("Ticket details for ticket: " + new Date());
    m_ticketer.saveOrUpdate(ticket);
    assertNotNull(ticket.getId());
    Ticket newTicket = m_ticketer.get(ticket.getId());
    assertNotNull(newTicket);
    assertTicketEquals(ticket, newTicket);
    newTicket.setState(Ticket.State.CANCELLED);
    newTicket.setDetails("These details have changed");
    System.err.println("TicketId = " + newTicket.getId());
    m_ticketer.saveOrUpdate(newTicket);
    Thread.sleep(500);
    Ticket newerTicket = m_ticketer.get(newTicket.getId());
    assertTicketEquals(newTicket, newerTicket);
}
Also used : Ticket(org.opennms.api.integration.ticketing.Ticket) Date(java.util.Date)

Example 14 with Ticket

use of org.opennms.api.integration.ticketing.Ticket in project opennms by OpenNMS.

the class QuickBaseTicketerPluginTest method testSave.

public void testSave() {
    Ticket ticket = new Ticket();
    ticket.setState(Ticket.State.OPEN);
    ticket.setSummary("This is the summary");
    ticket.setDetails("These are the details");
    m_ticketer.saveOrUpdate(ticket);
    assertNotNull(ticket.getId());
    Ticket newTicket = m_ticketer.get(ticket.getId());
    assertNotNull(newTicket);
    assertTicketEquals(ticket, newTicket);
}
Also used : Ticket(org.opennms.api.integration.ticketing.Ticket)

Example 15 with Ticket

use of org.opennms.api.integration.ticketing.Ticket in project opennms by OpenNMS.

the class QuickBaseTicketerPlugin method get.

public Ticket get(String ticketId) {
    try {
        Properties props = getProperties();
        MyQuickBaseClient qdb = createClient(getUserName(props), getPassword(props), getUrl(props));
        String dbId = qdb.findDbByName(getApplicationName(props));
        HashMap<String, String> record = qdb.getRecordInfo(dbId, ticketId);
        Ticket ticket = new Ticket();
        ticket.setId(ticketId);
        ticket.setModificationTimestamp(record.get(getModificationTimeStampFile(props)));
        ticket.setSummary(record.get(getSummaryField(props)));
        ticket.setDetails(record.get(getDetailsField(props)));
        ticket.setState(getTicketStateValue(record.get(getStateField(props)), props));
        return ticket;
    } catch (Throwable e) {
        throw new DataRetrievalFailureException("Failed to commit QuickBase transaction: " + e.getMessage(), e);
    }
}
Also used : Ticket(org.opennms.api.integration.ticketing.Ticket) DataRetrievalFailureException(org.springframework.dao.DataRetrievalFailureException) Properties(java.util.Properties)

Aggregations

Ticket (org.opennms.api.integration.ticketing.Ticket)46 PluginException (org.opennms.api.integration.ticketing.PluginException)15 Date (java.util.Date)9 Test (org.junit.Test)7 OnmsAlarm (org.opennms.netmgt.model.OnmsAlarm)4 MXStringType (com.ibm.maximo.MXStringType)3 Properties (java.util.Properties)3 Plugin (org.opennms.api.integration.ticketing.Plugin)3 DataRetrievalFailureException (org.springframework.dao.DataRetrievalFailureException)3 BasicIssue (com.atlassian.jira.rest.client.api.domain.BasicIssue)2 Issue (com.atlassian.jira.rest.client.api.domain.Issue)2 QuerySHSIMPINCResponseType (com.ibm.maximo.QuerySHSIMPINCResponseType)2 QuerySHSIMPINCType (com.ibm.maximo.QuerySHSIMPINCType)2 SHSIMPINCINCIDENTType (com.ibm.maximo.SHSIMPINCINCIDENTType)2 File (java.io.File)2 IOException (java.io.IOException)2 BigInteger (java.math.BigInteger)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Ignore (org.junit.Ignore)2