本文整理汇总了Java中org.mortbay.jetty.testing.ServletTester类的典型用法代码示例。如果您正苦于以下问题:Java ServletTester类的具体用法?Java ServletTester怎么用?Java ServletTester使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServletTester类属于org.mortbay.jetty.testing包,在下文中一共展示了ServletTester类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setup
import org.mortbay.jetty.testing.ServletTester; //导入依赖的package包/类
@Before
public void setup() {
// setup the test data and the set of services
td = new TestData();
serviceTestManager = new ServiceTestManager(td);
assertNotNull(serviceTestManager);
assertNotNull(serviceTestManager.entityBrokerManager);
assertNotNull(serviceTestManager.entityEncodingManager);
assertNotNull(serviceTestManager.entityBatchHandler);
this.tester = new ServletTester();
this.tester.setContextPath(DIRECT_PREFIX);
this.tester.addServlet(MockDirectServlet.class, "/*");
try {
this.tester.start();
} catch (Exception e) {
fail("Could not start the jetty server: " + e.getMessage());
}
this.response = new HttpTester();
prepareRequest();
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:24,代码来源:EntityBrokerServletTest.java
示例2: before
import org.mortbay.jetty.testing.ServletTester; //导入依赖的package包/类
@Before
public void before() {
tester = new ServletTester();
tester.addServlet(GetRootServlet.class, "/*");
tester.addServlet(GetStatusServlet.class, GetStatusServlet.CONTEXT_PATH);
tester.addServlet(AddTransServlet.class, AddTransServlet.CONTEXT_PATH);
tester.addServlet(StartTransServlet.class, StartTransServlet.CONTEXT_PATH);
tester.addServlet(PauseTransServlet.class, PauseTransServlet.CONTEXT_PATH);
try {
tester.start();
System.out.println("Started");
} catch (Exception ex) {
ex.printStackTrace();
Assert.fail(ex.getMessage());
}
}
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:17,代码来源:CarteTest.java
示例3: setup
import org.mortbay.jetty.testing.ServletTester; //导入依赖的package包/类
@Before
public void setup() throws Exception {
tester = new ServletTester();
tester.setContextPath("/");
tester.addServlet(TaskLogServlet.class, "/tasklog");
tester.start();
}
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:8,代码来源:TestTaskLogServlet.java
示例4: setUp
import org.mortbay.jetty.testing.ServletTester; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.servletTester = new ServletTester();
this.servletTester.addServlet(VcardServlet.class, "/");
this.servletTester.start();
this.location = this.servletTester.createSocketConnector(true);
}
开发者ID:e-Contract,项目名称:eid-applet,代码行数:9,代码来源:VcardServletTest.java
示例5: setUp
import org.mortbay.jetty.testing.ServletTester; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.servletTester = new ServletTester();
this.servletTester.addServlet(JSONServlet.class, "/");
this.servletTester.start();
this.location = this.servletTester.createSocketConnector(true);
}
开发者ID:e-Contract,项目名称:eid-applet,代码行数:9,代码来源:JSONServletTest.java
示例6: setUp
import org.mortbay.jetty.testing.ServletTester; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.servletTester = new ServletTester();
this.servletTester.addServlet(KmlServlet.class, "/");
this.servletTester.start();
this.location = this.servletTester.createSocketConnector(true);
}
开发者ID:e-Contract,项目名称:eid-applet,代码行数:9,代码来源:KmlServletTest.java
示例7: setUp
import org.mortbay.jetty.testing.ServletTester; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.servletTester = new ServletTester();
this.servletTester.addServlet(AppletServiceServlet.class, "/");
Security.addProvider(new BouncyCastleProvider());
KeyPair keyPair = generateKeyPair();
DateTime notBefore = new DateTime();
DateTime notAfter = notBefore.plusMonths(1);
X509Certificate certificate = generateSelfSignedCertificate(keyPair, "CN=localhost", notBefore, notAfter);
File tmpP12File = File.createTempFile("ssl-", ".p12");
LOG.debug("p12 file: " + tmpP12File.getAbsolutePath());
persistKey(tmpP12File, keyPair.getPrivate(), certificate, "secret".toCharArray(), "secret".toCharArray());
SslSocketConnector sslSocketConnector = new SslSocketConnector();
sslSocketConnector.setKeystore(tmpP12File.getAbsolutePath());
sslSocketConnector.setTruststore(tmpP12File.getAbsolutePath());
sslSocketConnector.setTruststoreType("pkcs12");
sslSocketConnector.setKeystoreType("pkcs12");
sslSocketConnector.setPassword("secret");
sslSocketConnector.setKeyPassword("secret");
sslSocketConnector.setTrustPassword("secret");
sslSocketConnector.setMaxIdleTime(30000);
int sslPort = getFreePort();
sslSocketConnector.setPort(sslPort);
this.servletTester.getContext().getServer().addConnector(sslSocketConnector);
this.sslLocation = "https://localhost:" + sslPort + "/";
this.servletTester.start();
this.location = this.servletTester.createSocketConnector(true);
SSLContext sslContext = SSLContext.getInstance("TLS");
TrustManager trustManager = new TestTrustManager(certificate);
sslContext.init(null, new TrustManager[] { trustManager }, null);
SSLContext.setDefault(sslContext);
}
开发者ID:e-Contract,项目名称:eid-applet,代码行数:38,代码来源:AppletServiceServletTest.java
示例8: setUp
import org.mortbay.jetty.testing.ServletTester; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.servletTester = new ServletTester();
this.servletTester.addServlet(PdfServlet.class, "/");
this.servletTester.start();
this.location = this.servletTester.createSocketConnector(true);
}
开发者ID:e-Contract,项目名称:eid-applet,代码行数:9,代码来源:PdfServletTest.java
示例9: setUp
import org.mortbay.jetty.testing.ServletTester; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.servletTester = new ServletTester();
this.servletHolder = this.servletTester.addServlet(AppletServiceServlet.class, "/");
Security.addProvider(new BouncyCastleProvider());
KeyPair keyPair = generateKeyPair();
DateTime notBefore = new DateTime();
DateTime notAfter = notBefore.plusMonths(1);
this.certificate = generateSelfSignedCertificate(keyPair, "CN=localhost", notBefore, notAfter);
File tmpP12File = File.createTempFile("ssl-", ".p12");
LOG.debug("p12 file: " + tmpP12File.getAbsolutePath());
persistKey(tmpP12File, keyPair.getPrivate(), this.certificate, "secret".toCharArray(), "secret".toCharArray());
SslSocketConnector sslSocketConnector = new SslSocketConnector();
sslSocketConnector.setKeystore(tmpP12File.getAbsolutePath());
sslSocketConnector.setTruststore(tmpP12File.getAbsolutePath());
sslSocketConnector.setTruststoreType("pkcs12");
sslSocketConnector.setKeystoreType("pkcs12");
sslSocketConnector.setPassword("secret");
sslSocketConnector.setKeyPassword("secret");
sslSocketConnector.setTrustPassword("secret");
sslSocketConnector.setMaxIdleTime(30000);
int sslPort = getFreePort();
sslSocketConnector.setPort(sslPort);
this.servletTester.getContext().getServer().addConnector(sslSocketConnector);
this.sslLocation = "https://localhost:" + sslPort + "/";
this.servletTester.start();
SSLContext sslContext = SSLContext.getInstance("TLS");
TrustManager trustManager = new TestTrustManager(this.certificate);
sslContext.init(null, new TrustManager[] { trustManager }, null);
SSLContext.setDefault(sslContext);
}
开发者ID:e-Contract,项目名称:eid-applet,代码行数:37,代码来源:ControllerTest.java
示例10: setUp
import org.mortbay.jetty.testing.ServletTester; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.servletTester = new ServletTester();
String pathSpec = "/test.crl";
this.servletTester.addServlet(CrlRepositoryTestServlet.class, pathSpec);
this.servletTester.start();
String servletUrl = this.servletTester.createSocketConnector(true);
this.crlUri = new URI(servletUrl + pathSpec);
this.validationDate = new Date();
this.testedInstance = new OnlineCrlRepository();
CrlRepositoryTestServlet.reset();
}
开发者ID:e-Contract,项目名称:jtrust,代码行数:16,代码来源:OnlineCrlRepositoryTest.java
示例11: setUp
import org.mortbay.jetty.testing.ServletTester; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
this.servletTester = new ServletTester();
String pathSpec = "/test.ocsp";
this.servletTester.addServlet(OcspResponderTestServlet.class, pathSpec);
this.servletTester.start();
String servletUrl = this.servletTester.createSocketConnector(true);
this.ocspUri = new URI(servletUrl + pathSpec);
this.testedInstance = new OnlineOcspRepository();
OcspResponderTestServlet.reset();
this.rootKeyPair = PKITestUtils.generateKeyPair();
DateTime notBefore = new DateTime();
DateTime notAfter = notBefore.plusMonths(1);
this.rootCertificate = PKITestUtils.generateSelfSignedCertificate(
this.rootKeyPair, "CN=TestRoot", notBefore, notAfter);
KeyPair keyPair = PKITestUtils.generateKeyPair();
this.certificate = PKITestUtils.generateCertificate(
keyPair.getPublic(), "CN=Test", notBefore, notAfter,
this.rootCertificate, this.rootKeyPair.getPrivate());
// required for org.bouncycastle.ocsp.CertificateID
Security.addProvider(new BouncyCastleProvider());
}
开发者ID:e-Contract,项目名称:jtrust,代码行数:29,代码来源:OnlineOcspRepositoryTest.java
示例12: setUp
import org.mortbay.jetty.testing.ServletTester; //导入依赖的package包/类
protected void setUp() throws Exception
{
tester = new ServletTester();
tester.setContextPath("/");
tester.addServlet(InfoServlet.class, contextPath);
baseURL = tester.createSocketConnector(true);
tester.start();
}
开发者ID:wso2,项目名称:andes,代码行数:9,代码来源:HttpPosterTest.java
示例13: setUp
import org.mortbay.jetty.testing.ServletTester; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
servletTester = new ServletTester();
servletTester.setContextPath("/");
servletTester.setResourceBase("src/main/webapp");
servletTester.addServlet(RetrievePDF.class, "/RetrievePDF");
servletTester.addServlet(org.mortbay.jetty.servlet.DefaultServlet.class, "/*");
servletTester.start();
request = new HttpTester();
request.setMethod("GET");
request.setURI("/RetrievePDF");
request.setVersion("HTTP/1.0");
}
开发者ID:graeme-lockley,项目名称:ddd-fop-service-initial,代码行数:15,代码来源:RetrievePDFTest.java
示例14: init
import org.mortbay.jetty.testing.ServletTester; //导入依赖的package包/类
@Before
public void init() throws Exception {
tester = new ServletTester();
XmlWebApplicationContext wac;
tester.setAttribute(Servlet.springCtxAttrName, wac = (XmlWebApplicationContext) FrameworkServlet.DEFAULT_CONTEXT_CLASS.newInstance());
wac.setConfigLocation("classpath:/com/griddynamics/banshun/controllers-test/parent-context.xml");
wac.refresh();
tester.addServlet(Servlet.class, "*.html");
tester.start();
}
开发者ID:jirutka,项目名称:spring-modular,代码行数:11,代码来源:NestedControllerTest.java
示例15: init
import org.mortbay.jetty.testing.ServletTester; //导入依赖的package包/类
@Before
public void init() throws Exception {
tester = new ServletTester();
XmlWebApplicationContext wac;
tester.setAttribute(Servlet.springCtxAttrName, wac = (XmlWebApplicationContext) FrameworkServlet.DEFAULT_CONTEXT_CLASS.newInstance());
wac.setConfigLocation("classpath:/com/griddynamics/banshun/scan-test/parent-context.xml");
wac.refresh();
tester.addServlet(Servlet.class, "*.html");
tester.start();
}
开发者ID:jirutka,项目名称:spring-modular,代码行数:11,代码来源:ScanningTest.java
注:本文中的org.mortbay.jetty.testing.ServletTester类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论