Пример #1
0
 public JComponent create(UI ui, Element e) {
   try {
     TransactionManager tm =
         (TransactionManager) NameRegistrar.get(e.getAttributeValue("transaction-manager"));
     return new TMMonitor(ui, tm);
   } catch (NameRegistrar.NotFoundException ex) {
     return new JTextArea(ex.toString());
   }
 }
Пример #2
0
 @Test
 public void testAddChannelThrowsNotFoundException() throws Throwable {
   ChannelPool channelPool = new ChannelPool();
   try {
     channelPool.addChannel("testChannelPoolName1");
     fail("Expected NotFoundException to be thrown");
   } catch (NameRegistrar.NotFoundException ex) {
     assertEquals("ex.getMessage()", "channel.testChannelPoolName1", ex.getMessage());
     assertEquals("channelPool.pool.size()", 0, channelPool.pool.size());
   }
 }