/** * @param b - new Usable state (used by ISOMUX internals to * flag as unusable in order to force a reconnection) */ public void setUsable(boolean b) { Logger.log (new LogEvent (this, "usable", b)); usable = b; } /**
@Override public void handleUnpackError(ISOComponent isoComponent, byte[] msg, ISOException e) { StringBuilder sb = new StringBuilder("Error unpacking message:\n"); sb.append(e.toString()).append("\n"); sb.append("Raw data:\n").append(new String(msg)).append("\n"); LogEvent logEvent = new LogEvent(this, "unpack-error"); logEvent.addMessage(sb.toString()); logEvent.addMessage(e); Logger.log(logEvent); } }
public void info (String detail, Object obj) { LogEvent evt = new LogEvent (this, "info", detail); evt.addMessage (obj); Logger.log (evt); } public void warning (String detail) {
public void run() { for (int i = 0; i < numMessages; i++) { LogEvent ev = new LogEvent(); ev.addMessage(name + " " + i); Logger.log(ev); } p.checkPoint (name); done.countDown(); } }.start();
@Override protected int getMessageLength() throws IOException, ISOException { int len = super.getMessageLength(); LogEvent evt = new LogEvent (this, "fsd-channel-debug"); evt.addMessage ("received message length: " + len); Logger.log (evt); return len; } }
@Test public void testPrepare5() throws Throwable { int result = transactionManager.prepare(1, 100L, new File("testTransactionManagerParam1"), new ArrayList(), new ArrayList( 1000).iterator(), true, new LogEvent("testTransactionManagerTag"), null); assertEquals("result", TransactionConstants.ABORTED, result); }
public void send (byte[] b) throws IOException,ISOException { if (!isConnected()) throw new ISOException ("unconnected ISOChannel"); LogEvent evt = new LogEvent (this, "loopback-send", b); queue.enqueue (b); cnt[TX]++; notifyObservers(); Logger.log (evt); }
@Test public void testDump2() throws Throwable { LogEvent logEvent = new LogEvent("testLogEventTag", null); logEvent.addMessage("testString", "1s"); PrintStream p = new PrintStream(new ByteArrayOutputStream()); logEvent.dump(p, "testLogEventIndent"); assertTrue("Test completed without Exception", true); }
public void send (ISOMsg m) throws IOException,ISOException { if (!isConnected()) throw new ISOException ("unconnected ISOChannel"); LogEvent evt = new LogEvent (this, "loopback-send", m); m = applyOutgoingFilters (m, evt); queue.enqueue (m); cnt[TX]++; notifyObservers(); Logger.log (evt); }
@Test public void testExecuteMethod2() throws Throwable { BSHTransactionParticipant bSHGroupSelector = new BSHGroupSelector(); Boolean result = (Boolean) bSHGroupSelector.executeMethod(new BSHMethod("testBSHTransactionParticipantBshData", false), 100L, new UnsupportedEncodingException(), new LogEvent("testBSHTransactionParticipantTag"), "bsh.evalOnly"); assertTrue("result", result.booleanValue()); }
@Test public void testAbort3() throws Throwable { LogEvent evt = new LogEvent("testTransactionManagerTag", Integer.valueOf(2)); transactionManager.abort(1, 100L, Boolean.TRUE, members, members.add(new Forward()), evt, null); assertEquals("evt.payLoad.size()", 2, evt.getPayLoad().size()); assertEquals("evt.payLoad.get(1)", " abort: org.jpos.transaction.participant.Forward", evt.getPayLoad().get(1)); }
@Test public void testLog2() throws Throwable { Logger.log(new LogEvent(null, "testLoggerTag", "")); assertTrue("Test completed without Exception", true); }
@Test public void testAbort4() throws Throwable { members.add(new Debug()); LogEvent evt = new LogEvent("testTransactionManagerTag"); transactionManager.abort(1, 100L, "", members, false, evt, null); assertEquals("evt.payLoad.size()", 1, evt.getPayLoad().size()); assertEquals("evt.payLoad.get(0)", " abort: org.jpos.transaction.participant.Debug", evt.getPayLoad().get(0)); }
@Test public void testConstructor() throws Throwable { LogEvent logEvent = new LogEvent("testLogEventTag"); assertEquals("logEvent.payLoad.size()", 0, logEvent.getPayLoad().size()); assertEquals("logEvent.tag", "testLogEventTag", logEvent.getTag()); }
@Test public void testDefaultPrepare() throws Throwable { BSHTransactionParticipant bSHTransactionParticipant = new BSHTransactionParticipant(); int result = bSHTransactionParticipant.defaultPrepare(100L, new CharConversionException(), new LogEvent()); assertEquals("result", 129, result); }
@Test public void testExecuteMethodThrowsFileNotFoundException() throws Throwable { BSHTransactionParticipant source = new BSHTransactionParticipant(); try { source.executeMethod(new BSHMethod("testBSHTransactionParticipantBshData", true), 100L, new CharConversionException(), new LogEvent(source, "testBSHTransactionParticipantTag"), "testBSHTransactionParticipantResultName"); fail("Expected FileNotFoundException to be thrown"); } catch (FileNotFoundException ex) { assertEquals("ex.getClass()", FileNotFoundException.class, ex.getClass()); } }
@Test public void testLog1() throws Throwable { Logger.log(new LogEvent(new Log(), "testLoggerTag", "testString")); assertTrue("Test completed without Exception", true); }
@Test public void testLog() throws Throwable { Logger.log(new LogEvent(new SimpleLogSource(Logger.getLogger("testLoggerName"), "testLoggerRealm"), "testLoggerTag", "testString")); assertTrue("Test completed without Exception", true); }
@Test public void testSetSource() throws Throwable { LogEvent logEvent = new LogEvent(new Log(), "testLogEventTag"); LogSource source = new ISOBaseValidatingPackager(); logEvent.setSource(source); assertSame("logEvent.source", source, logEvent.getSource()); }
@Test public void testGetRealm1() throws Throwable { LogSource source = new SystemMonitor(-100, new Logger(), "testLogEventRealm"); LogEvent logEvent = new LogEvent(source, "testLogEventTag", ""); String result = logEvent.getRealm(); assertEquals("result", "testLogEventRealm", result); assertSame("logEvent.source", source, logEvent.getSource()); }