@Test public void testPrepareThrowsNullPointerException3() throws Throwable { List<TransactionParticipant> members = new ArrayList(); List<TransactionParticipant> arrayList = new ArrayList(); arrayList.add(new Forward()); LogEvent evt = new LogEvent(); try { transactionManager.prepare(1, 100L, Boolean.FALSE, members, arrayList.iterator(), false, evt, null); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertEquals(1, evt.getPayLoad().size(), "evt.payLoad.size()"); assertEquals(" prepare: org.jpos.transaction.participant.Forward ABORTED", evt.getPayLoad() .get(0), "evt.payLoad.get(0)"); if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"String.length()\" because \"str\" is null", ex.getMessage(), "ex.getMessage()"); } assertNull(transactionManager.psp, "transactionManager.psp"); assertNull(transactionManager.groups, "transactionManager.groups"); assertEquals(0, members.size(), "(ArrayList) members.size()"); } }
protected int prepare (TransactionParticipant p, long id, Serializable context) { Chronometer c = new Chronometer(); try { setThreadName(id, "prepare", p); return p.prepare (id, context); } catch (Throwable t) { getLog().warn ("PREPARE: " + Long.toString (id), t); } finally { if (metrics != null) metrics.record(getName(p) + "-prepare", c.elapsed()); } return ABORTED; }
TransactionManager extends QBeanSupport implements Runnable, TransactionConstants, TransactionManagerMBean, Loggeable, MetricsProvider { protected int prepare (TransactionParticipant p, long id, Serializable context) { Chronometer c = new Chronometer(); try { setThreadName(id, "prepare", p); return p.prepare (id, context); } catch (Throwable t) { getLog().warn ("PREPARE: " + Long.toString (id), t); } finally { if (metrics != null) metrics.record(getName(p) + "-prepare", c.elapsed()); } return ABORTED; } }
TransactionManager extends QBeanSupport implements Runnable, TransactionConstants, TransactionManagerMBean, Loggeable, MetricsProvider { protected int prepare (TransactionParticipant p, long id, Serializable context) { Chronometer c = new Chronometer(); try { setThreadName(id, "prepare", p); return p.prepare (id, context); } catch (Throwable t) { getLog().warn ("PREPARE: " + Long.toString (id), t); } finally { if (metrics != null) metrics.record(getName(p) + "-prepare", c.elapsed()); } return ABORTED; }  }
TransactionManager extends QBeanSupport implements Runnable, TransactionConstants, TransactionManagerMBean, Loggeable, MetricsProvider { protected int prepare (TransactionParticipant p, long id, Serializable context) { Chronometer c = new Chronometer(); try { setThreadName(id, "prepare", p); return p.prepare (id, context); } catch (Throwable t) { getLog().warn ("PREPARE: " + Long.toString (id), t); } finally { if (metrics != null) metrics.record(getName(p) + "-prepare", c.elapsed()); } return ABORTED; }  @Override void initService(); @Override void startService(); @Override void stopService(); void queue(Serializable context); void push(Serializable context); @SuppressWarnings("unused") String getQueueName(); Space getSpace(); Space getInputSpace(); Space getPersistentSpace(); @Override void run(); @Override long getTail(); @Override long getHead(); long getInTransit(); @Override void setConfiguration(Configuration cfg); void addListener(TransactionStatusListener l); void removeListener(TransactionStatusListener l); TPS getTPS(); @Override String getTPSAsString(); @Override float getTPSAvg(); @Override int getTPSPeak(); @Override Date getTPSPeakWhen(); @Override long getTPSElapsed(); @Override void resetTPS(); @Override Metrics getMetrics(); @Override void dump(PrintStream ps, String indent); TransactionParticipant createParticipant(Element e); @Override int getOutstandingTransactions(); @Override void setDebug(boolean debug); @Override boolean getDebugContext(); @Override void setDebugContext(boolean debugContext); @Override boolean getDebug(); @Override int getActiveSessions(); int getPausedCounter(); int getActiveTransactions(); int getMaxSessions(); static Serializable getSerializable(); static T getContext(); static Long getId(); }
TransactionManager extends QBeanSupport implements Runnable, TransactionConstants, TransactionManagerMBean, Loggeable, MetricsProvider { protected int prepare (TransactionParticipant p, long id, Serializable context) { Chronometer c = new Chronometer(); try { setThreadName(id, "prepare", p); return p.prepare (id, context); } catch (Throwable t) { getLog().warn ("PREPARE: " + Long.toString (id), t); } finally { if (metrics != null) metrics.record(getName(p) + "-prepare", c.elapsed()); } return ABORTED; }  @Override void initService(); @Override void startService(); @Override void stopService(); void queue(Serializable context); void push(Serializable context); @SuppressWarnings("unused") String getQueueName(); Space getSpace(); Space getInputSpace(); Space getPersistentSpace(); @Override void run(); @Override long getTail(); @Override long getHead(); long getInTransit(); @Override void setConfiguration(Configuration cfg); void addListener(TransactionStatusListener l); void removeListener(TransactionStatusListener l); TPS getTPS(); @Override String getTPSAsString(); @Override float getTPSAvg(); @Override int getTPSPeak(); @Override Date getTPSPeakWhen(); @Override long getTPSElapsed(); @Override void resetTPS(); @Override Metrics getMetrics(); @Override void dump(PrintStream ps, String indent); TransactionParticipant createParticipant(Element e); @Override int getOutstandingTransactions(); @Override void setDebug(boolean debug); @Override boolean getDebugContext(); @Override void setDebugContext(boolean debugContext); @Override boolean getDebug(); @Override int getActiveSessions(); int getPausedCounter(); int getActiveTransactions(); int getMaxSessions(); static Serializable getSerializable(); static T getContext(); static Long getId(); static final String HEAD; static final String TAIL; static final String CONTEXT; static final String STATE; static final String GROUPS; static final String TAILLOCK; static final String RETRY_QUEUE; static final Integer PREPARING; static final Integer COMMITTING; static final Integer DONE; static final String DEFAULT_GROUP; static final long MAX_PARTICIPANTS; static final long MAX_WAIT; static final long TIMER_PURGE_INTERVAL; }