@Test public void testSetConfigurationThrowsNullPointerException() throws Throwable { Connector connector = new Connector(); Configuration cfg = new SubConfiguration(); try { connector.setConfiguration(cfg); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"org.jpos.core.Configuration.getInt(String)\" because \"this.cfg\" is null", ex.getMessage(), "ex.getMessage()"); } assertEquals(0, connector.timeout, "connector.timeout"); assertNull(connector.channelName, "connector.channelName"); assertNull(connector.muxName, "connector.muxName"); } }
public void setConfiguration (Configuration cfg) throws ConfigurationException { timeout = cfg.getInt ("timeout"); if (pool == null) pool = new ThreadPool (1, cfg.getInt ("poolsize", 10)); muxName = cfg.get ("destination-mux", null); channelName = cfg.get ("destination-channel", null); preserveSourceHeader = cfg.getBoolean ("preserve-source-header", true); if (muxName == null && channelName == null) { throw new ConfigurationException("Neither destination mux nor channel were specified."); } }
Connector implements ISORequestListener, LogSource, Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { timeout = cfg.getInt ("timeout"); if (pool == null) pool = new ThreadPool (1, cfg.getInt ("poolsize", 10)); muxName = cfg.get ("destination-mux", null); channelName = cfg.get ("destination-channel", null); preserveSourceHeader = cfg.getBoolean ("preserve-source-header", true); if (muxName == null && channelName == null) { throw new ConfigurationException("Neither destination mux nor channel were specified."); } } }
Connector implements ISORequestListener, LogSource, Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { timeout = cfg.getInt ("timeout"); if (pool == null) pool = new ThreadPool (1, cfg.getInt ("poolsize", 10)); muxName = cfg.get ("destination-mux", null); channelName = cfg.get ("destination-channel", null); preserveSourceHeader = cfg.getBoolean ("preserve-source-header", true); if (muxName == null && channelName == null) { throw new ConfigurationException("Neither destination mux nor channel were specified."); } } Connector(); }
Connector implements ISORequestListener, LogSource, Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { timeout = cfg.getInt ("timeout"); if (pool == null) pool = new ThreadPool (1, cfg.getInt ("poolsize", 10)); muxName = cfg.get ("destination-mux", null); channelName = cfg.get ("destination-channel", null); preserveSourceHeader = cfg.getBoolean ("preserve-source-header", true); if (muxName == null && channelName == null) { throw new ConfigurationException("Neither destination mux nor channel were specified."); } } Connector(); void setLogger(Logger logger, String realm); String getRealm(); Logger getLogger(); void setConfiguration(Configuration cfg); boolean process(ISOSource source, ISOMsg m); }
Connector implements ISORequestListener, LogSource, Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { timeout = cfg.getInt ("timeout"); if (pool == null) pool = new ThreadPool (1, cfg.getInt ("poolsize", 10)); muxName = cfg.get ("destination-mux", null); channelName = cfg.get ("destination-channel", null); preserveSourceHeader = cfg.getBoolean ("preserve-source-header", true); if (muxName == null && channelName == null) { throw new ConfigurationException("Neither destination mux nor channel were specified."); } } Connector(); void setLogger(Logger logger, String realm); String getRealm(); Logger getLogger(); void setConfiguration(Configuration cfg); boolean process(ISOSource source, ISOMsg m);  }