private void newChannel () throws ConfigurationException { Element persist = getPersist (); Element e = persist.getChild ("channel"); if (e == null) { throw new ConfigurationException ("channel element missing"); } ChannelAdaptor adaptor = new ChannelAdaptor (); channel = adaptor.newChannel (e, getFactory ()); }
@Test public void testDestroyQBeanThrowsNullPointerException1() throws Throwable { String[] args = new String[0]; Hashtable<String, String> hashtable = new Hashtable<String, String>(100, 100.0F); hashtable.put("testString", "testString"); try { new QFactory(ObjectName.getInstance("testQFactoryParam1", hashtable), null).destroyQBean(new Q2(args), new ObjectName( "testQFactoryParam1", "testQFactoryParam2", "testQFactoryParam3"), new ChannelAdaptor()); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); } }
private BaseChannel getChannel(QServer server) throws ConfigurationException { Element persist = server.getPersist(); Element e = persist.getChild("channel"); if (e == null) { throw new ConfigurationException("channel element missing"); } ChannelAdaptor adaptor = new ChannelAdaptor(); BaseChannel channel = (BaseChannel) adaptor.newChannel(e, server.getFactory()); if (channel == null) { throw new ConfigurationException("Could not instanciate ISOChannel"); } return channel; }