@@ -0,0 +1,2037 @@
+/**%0D%0A * %0D%0A */%0D%0Apackage net.winstone.testCase;%0D%0A%0D%0Aimport java.io.IOException;%0D%0Aimport java.util.HashMap;%0D%0Aimport java.util.Map;%0D%0A%0D%0Aimport net.winstone.testCase.load.Launcher;%0D%0A%0D%0Aimport org.slf4j.Logger;%0D%0Aimport org.slf4j.LoggerFactory;%0D%0Aimport org.xml.sax.SAXException;%0D%0A%0D%0Aimport com.meterware.httpunit.GetMethodWebRequest;%0D%0Aimport com.meterware.httpunit.HttpException;%0D%0Aimport com.meterware.httpunit.WebConversation;%0D%0Aimport com.meterware.httpunit.WebRequest;%0D%0Aimport com.meterware.httpunit.WebResponse;%0D%0A%0D%0Aimport junit.framework.Assert;%0D%0Aimport junit.framework.TestCase;%0D%0A%0D%0A/**%0D%0A * SpringAccessTest. %0D%0A *%0D%0A * @author JGT%0D%0A *%0D%0A */%0D%0Apublic class SpringAccessTest extends TestCase%7B%0D%0A%09protected Logger logger = LoggerFactory.getLogger(getClass());%0D%0A%09%0D%0A%09/**%0D%0A%09 * Test the keep alive case%0D%0A%09 */%0D%0A%09public void testJndiAccessServlet() throws IOException, InterruptedException, SAXException %7B%0D%0A%09%09// Initialise container%0D%0A%09%09final Map%3CString, String%3E args = new HashMap%3CString, String%3E();%0D%0A%09%09args.put(%22webroot%22,%22../test-webapp-spring/target/test-webapp-spring%22);%0D%0A%09%09args.put(%22prefix%22, %22/examples%22);%0D%0A%09%09args.put(%22httpPort%22, %2210006%22);%0D%0A%09%09args.put(%22ajp13Port%22, %22-1%22);%0D%0A%09%09args.put(%22controlPort%22, %22-1%22);%0D%0A%09%09args.put(%22debug%22, %228%22);%0D%0A%09%09args.put(%22logThrowingLineNo%22, %22true%22);%0D%0A%09%09args.put(%22useJNDI%22, %22true%22);%0D%0A%0D%0A%09%09args.put(%22useJNDI%22, %22true%22);%0D%0A%09%09args.put(%22jndi.resource.jdbc/testDatasource%22, %22javax.sql.DataSource%22);%0D%0A%09%09args.put(%22jndi.param.jdbc/testDatasource.url%22, %22jdbc:h2:~/test%22);%0D%0A%0D%0A%09%09//%0D%0A%09%09final Launcher winstone = new Launcher(args);%0D%0A%09%09winstone.launch();%0D%0A%09%09// Check for a simple connection%0D%0A%09%09final WebConversation wc = new WebConversation();%0D%0A%09%09final WebRequest wreq = new GetMethodWebRequest(%22http://localhost:10006/examples/index.html%22);%0D%0A%09%09try %7B%0D%0A%09%09%09final WebResponse wresp1 = wc.getResponse(wreq);%0D%0A%09%09%09logger.info(%22ResponseCode: %22 + wresp1.getResponseCode());%0D%0A%09%09%7D catch (final HttpException exception) %7B%0D%0A%09%09%09Assert.fail(%22Datasource must be found. %22 + exception.getMessage());%0D%0A%09%09%7D%0D%0A%0D%0A%09%09winstone.shutdown();%0D%0A%09%09Thread.sleep(500);%0D%0A%09%7D%0D%0A%7D%0D%0A%0D%0A

add spring test case