本文整理汇总了Java中com.meterware.httpunit.WebResponse.getInputStream方法的典型用法代码示例。如果您正苦于以下问题:Java WebResponse.getInputStream方法的具体用法?Java WebResponse.getInputStream怎么用?Java WebResponse.getInputStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.meterware.httpunit.WebResponse
的用法示例。
在下文中一共展示了WebResponse.getInputStream方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSimpleConnection
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
/**
* Test the simple case of connecting, retrieving and disconnecting
*/
public void testSimpleConnection() throws IOException, SAXException, InterruptedException {
// Initialise container
final Map<String, String> args = new HashMap<String, String>();
args.put("webroot", HttpConnectorTest.WEBROOT);
args.put("prefix", "/examples");
args.put("httpPort", "10003");
args.put("ajp13Port", "-1");
args.put("controlPort", "-1");
args.put("debug", "8");
args.put("logThrowingLineNo", "true");
final Launcher winstone = new Launcher(args);
winstone.launch();
// Check for a simple connection
final WebConversation wc = new WebConversation();
final WebRequest wreq = new GetMethodWebRequest("http://localhost:10003/examples/CountRequestsServlet");
final WebResponse wresp = wc.getResponse(wreq);
final InputStream content = wresp.getInputStream();
Assert.assertTrue("Loading CountRequestsServlet", content.available() > 0);
content.close();
winstone.shutdown();
Thread.sleep(500);
}
示例2: setUp
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception
{
try
{
wc = new WebConversation();
WebRequest req = new GetMethodWebRequest(TEST_URL);
WebResponse resp = wc.getResponse(req);
DataInputStream inputStream = new DataInputStream(resp.getInputStream());
buffer = new byte[resp.getContentLength()];
inputStream.readFully(buffer);
visited = new HashMap<String, String>();
}
catch (Exception notfound)
{
enabled = false;
}
}
示例3: test_imageBuildMonthToDateResponceOK
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void test_imageBuildMonthToDateResponceOK() throws Exception {
InputStream inputStream = null;
try {
final WebResponse webResponse = TestHelper.assertPageSmokes(WebuiUtils.makeStatisticsChartURL(TEST_BUILD_ID,
StatisticsImageServlet.STATISTICS_BUILD_IMAGE_MONTH_TO_DATE), null);
inputStream = webResponse.getInputStream();
IoUtils.copyInputToOuputStream(inputStream, new NullOutputStream());
} finally {
IoUtils.closeHard(inputStream);
}
}
示例4: test_imageBuildYearToDateResponceOK
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void test_imageBuildYearToDateResponceOK() throws Exception {
InputStream inputStream = null;
final WebResponse webResponse = TestHelper.assertPageSmokes(WebuiUtils.makeStatisticsChartURL(TEST_BUILD_ID,
StatisticsImageServlet.STATISTICS_BUILD_IMAGE_YEAR_TO_DATE), null);
inputStream = webResponse.getInputStream();
IoUtils.copyInputToOuputStream(inputStream, new NullOutputStream());
}
示例5: test_imageTestMonthToDateResponceOK
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void test_imageTestMonthToDateResponceOK() throws Exception {
InputStream inputStream = null;
try {
final WebResponse webResponse = TestHelper.assertPageSmokes(WebuiUtils.makeStatisticsChartURL(TEST_BUILD_ID,
StatisticsImageServlet.STATISTICS_TESTS_IMAGE_MONTH_TO_DATE), null);
inputStream = webResponse.getInputStream();
IoUtils.copyInputToOuputStream(inputStream, new NullOutputStream());
} finally {
IoUtils.closeHard(inputStream);
}
}
示例6: test_imageTestYearToDateResponceOK
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void test_imageTestYearToDateResponceOK() throws Exception {
InputStream inputStream = null;
try {
final WebResponse webResponse = TestHelper.assertPageSmokes(WebuiUtils.makeStatisticsChartURL(TEST_BUILD_ID,
StatisticsImageServlet.STATISTICS_TESTS_IMAGE_YEAR_TO_DATE), null);
inputStream = webResponse.getInputStream();
IoUtils.copyInputToOuputStream(inputStream, new NullOutputStream());
} finally {
IoUtils.closeHard(inputStream);
}
}
示例7: test_recentBuildTimesImageResponceOK
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void test_recentBuildTimesImageResponceOK() throws Exception {
InputStream inputStream = null;
try {
final WebResponse webResponse = TestHelper.assertPageSmokes(WebuiUtils.makeStatisticsChartURL(TEST_BUILD_ID,
StatisticsImageServlet.STATISTICS_RECENT_BUILD_TIMES_IMAGE), null);
inputStream = webResponse.getInputStream();
IoUtils.copyInputToOuputStream(inputStream, new NullOutputStream());
} finally {
IoUtils.closeHard(inputStream);
}
}
示例8: test_recentPMDViolationsImageResponceOK
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void test_recentPMDViolationsImageResponceOK() throws Exception {
InputStream inputStream = null;
try {
final WebResponse webResponse = TestHelper.assertPageSmokes(WebuiUtils.makeStatisticsChartURL(TEST_BUILD_ID,
StatisticsImageServlet.STATISTICS_PMD_IMAGE_RECENT_BUILDS), null);
inputStream = webResponse.getInputStream();
IoUtils.copyInputToOuputStream(inputStream, new NullOutputStream());
} finally {
IoUtils.closeHard(inputStream);
}
}
示例9: test_recentCheckstyleViolationsImageResponceOK
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void test_recentCheckstyleViolationsImageResponceOK() throws Exception {
InputStream inputStream = null;
try {
final WebResponse webResponse = TestHelper.assertPageSmokes(WebuiUtils.makeStatisticsChartURL(TEST_BUILD_ID,
StatisticsImageServlet.STATISTICS_CHECKSTYLE_IMAGE_RECENT_BUILDS), null);
inputStream = webResponse.getInputStream();
IoUtils.copyInputToOuputStream(inputStream, new NullOutputStream());
} finally {
IoUtils.closeHard(inputStream);
}
}
示例10: test_recentFindbugsViolationsImageResponceOK
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void test_recentFindbugsViolationsImageResponceOK() throws Exception {
InputStream inputStream = null;
try {
final WebResponse webResponse = TestHelper.assertPageSmokes(WebuiUtils.makeStatisticsChartURL(TEST_BUILD_ID,
StatisticsImageServlet.STATISTICS_FINDBUGS_IMAGE_RECENT_BUILDS), null);
inputStream = webResponse.getInputStream();
IoUtils.copyInputToOuputStream(inputStream, new NullOutputStream());
} finally {
IoUtils.closeHard(inputStream);
}
}
示例11: testKeepAliveConnection
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
/**
* Test the keep alive case
*/
public void testKeepAliveConnection() throws IOException, InterruptedException, SAXException {
// Initialise container
final Map<String, String> args = new HashMap<String, String>();
args.put("webroot", HttpConnectorTest.WEBROOT);
args.put("prefix", "/examples");
args.put("httpPort", "10004");
args.put("ajp13Port", "-1");
args.put("controlPort", "-1");
args.put("debug", "8");
args.put("logThrowingLineNo", "true");
final Launcher winstone = new Launcher(args);
winstone.launch();
// Check for a simple connection
final WebConversation wc = new WebConversation();
final WebRequest wreq = new GetMethodWebRequest("http://localhost:10004/examples/CountRequestsServlet");
final WebResponse wresp1 = wc.getResponse(wreq);
final WebImage img[] = wresp1.getImages();
for (int n = 0; n < img.length; n++) {
wc.getResponse(img[n].getRequest());
}
// Thread.sleep(2000);
// WebResponse wresp2 = wc.getResponse(wreq);
// Thread.sleep(2000);
// WebResponse wresp3 = wc.getResponse(wreq);
final InputStream content = wresp1.getInputStream();
Assert.assertTrue("Loading CountRequestsServlet + child images", content.available() > 0);
content.close();
winstone.shutdown();
Thread.sleep(500);
}