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);
}
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());
}
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);
}
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);
}
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);
}
}
Aggregations