本文整理汇总了Java中org.apache.catalina.core.StandardHost.backgroundProcess方法的典型用法代码示例。如果您正苦于以下问题:Java StandardHost.backgroundProcess方法的具体用法?Java StandardHost.backgroundProcess怎么用?Java StandardHost.backgroundProcess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.catalina.core.StandardHost
的用法示例。
在下文中一共展示了StandardHost.backgroundProcess方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doTestUnpackWAR
import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
private void doTestUnpackWAR(boolean unpackWARs, boolean unpackWAR,
boolean external, boolean resultDir) throws Exception {
Tomcat tomcat = getTomcatInstance();
StandardHost host = (StandardHost) tomcat.getHost();
host.setUnpackWARs(unpackWARs);
tomcat.start();
File war;
if (unpackWAR) {
war = createWar(WAR_XML_UNPACKWAR_TRUE_SOURCE, !external);
} else {
war = createWar(WAR_XML_UNPACKWAR_FALSE_SOURCE, !external);
}
if (external) {
createXmlInConfigBaseForExternal(war);
}
host.backgroundProcess();
File dir = new File(host.getAppBase(), APP_NAME.getBaseName());
Assert.assertEquals(
Boolean.valueOf(resultDir), Boolean.valueOf(dir.isDirectory()));
}
示例2: doTestCopyXML
import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
private void doTestCopyXML(boolean copyXmlHost, boolean copyXmlWar,
boolean external, boolean resultXml) throws Exception {
Tomcat tomcat = getTomcatInstance();
StandardHost host = (StandardHost) tomcat.getHost();
host.setCopyXML(copyXmlHost);
tomcat.start();
File war;
if (copyXmlWar) {
war = createWar(WAR_XML_COPYXML_TRUE_SOURCE, !external);
} else {
war = createWar(WAR_XML_COPYXML_FALSE_SOURCE, !external);
}
if (external) {
createXmlInConfigBaseForExternal(war);
}
host.backgroundProcess();
File xml = new File(getConfigBaseFile(host),
APP_NAME.getBaseName() + ".xml");
Assert.assertEquals(
Boolean.valueOf(resultXml), Boolean.valueOf(xml.isFile()));
Context context = (Context) host.findChild(APP_NAME.getName());
if (external) {
Assert.assertEquals(XML_COOKIE_NAME,
context.getSessionCookieName());
} else {
Assert.assertEquals(WAR_COOKIE_NAME,
context.getSessionCookieName());
}
}
示例3: doTestDeployment
import org.apache.catalina.core.StandardHost; //导入方法依赖的package包/类
private void doTestDeployment(boolean deployXML, boolean copyXML,
boolean unpackWARs, LifecycleState resultState, String cookieName,
boolean resultXml, boolean resultWar, boolean resultDir)
throws Exception {
Tomcat tomcat = getTomcatInstance();
// Start the instance
tomcat.start();
// Set the attributes
StandardHost host = (StandardHost) tomcat.getHost();
host.setDeployXML(deployXML);
host.setCopyXML(copyXML);
host.setUnpackWARs(unpackWARs);
// Trigger automatic deployment
host.backgroundProcess();
// Test the results
Context ctxt = (Context) tomcat.getHost().findChild(APP_NAME.getPath());
if (resultState == null) {
Assert.assertNull(ctxt);
} else {
Assert.assertNotNull(ctxt);
Assert.assertEquals(resultState, ctxt.getState());
Assert.assertEquals(cookieName, ctxt.getSessionCookieName());
}
File xml = new File(
getConfigBaseFile(host), APP_NAME.getBaseName() + ".xml");
Assert.assertEquals(
Boolean.valueOf(resultXml), Boolean.valueOf(xml.isFile()));
File war = new File(
getAppBaseFile(host), APP_NAME.getBaseName() + ".war");
Assert.assertEquals(
Boolean.valueOf(resultWar), Boolean.valueOf(war.isFile()));
File dir = new File(host.getAppBase(), APP_NAME.getBaseName());
Assert.assertEquals(
Boolean.valueOf(resultDir), Boolean.valueOf(dir.isDirectory()));
}