@Test
public void test_maxThreadsFileOverrides() throws Exception
{
final String expected_mtc = "100";
final String expected_mcph = "50";
ConfigTree parent_config = new ConfigTree("parent");
parent_config.setAttribute(ListenerTagNames.MAX_THREADS_TAG, "1");
ConfigTree child_config = new ConfigTree("child", parent_config);
child_config.setAttribute("endpointUrl", "http://localhost"); // required attribute
File file = null;
OutputStream os = null;
try
{
file = File.createTempFile(HttpClientFactory.HTTP_CLIENT_PROPERTY, ".properties");
os = new BufferedOutputStream(new FileOutputStream(file));
Properties fileProperties = new Properties();
fileProperties.setProperty(Connection.MAX_TOTAL_CONNECTIONS, expected_mtc);
fileProperties.setProperty(Connection.MAX_CONNECTIONS_PER_HOST, expected_mcph);
fileProperties.store(os, getClass().getName());
os.flush(); os.close(); os = null;
child_config.setAttribute("file", file.getAbsolutePath());
HttpSOAPProxyTransport transport = new HttpSOAPProxyTransport(child_config, null, null);
Properties httpClientProps = transport.getHttpRouter().getHttpClientProps();
final String actual_mtc = httpClientProps.getProperty(Connection.MAX_TOTAL_CONNECTIONS);
assertEquals(expected_mtc, actual_mtc);
final String actual_mcph = httpClientProps.getProperty(Connection.MAX_CONNECTIONS_PER_HOST);