0

我正在尝试在 Eclipse 上使用 JUnit 测试 servlet。我们的 servlet 基于 google 应用引擎教程中的留言簿 servlet。我的团队目前没有数据存储(虽然我们有一个前端工作),所以我在网上四处寻找,发现http://tinyurl.com/lvfhrnq,它似乎创建了一个测试服务器来运行他们的 servlet允许一些更好的测试。

但是,我无法确定要添加构建路径的 jar,因此我可以使用上一个链接中提到的 ServletTestSupport。我从 camel.apache 网站下载了 apache-camel-2.11.0.tar.gz 并首先添加了 jar 文件 slf4j-api.jar 和 camel-core.jar,因为似乎唯一需要的依赖项是 slf4j-api。罐子。但是,Eclipse 仍然无法识别 ServletTestSupport 的导入或来自 org.apache.camel.component.gae.support 的任何内容

谢谢!

4

1 回答 1

0

如果您使用 Maven,它会为您解决这个问题。

虽然这里是来自主干上的骆驼盖的依赖树。你也许可以用它来找到你需要的 JAR

INFO] ------------------------------------------------------------------------
[INFO] Building Camel :: GAE 2.12-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.6:tree (default-cli) @ camel-gae ---
[INFO] org.apache.camel:camel-gae:bundle:2.12-SNAPSHOT
[INFO] +- org.apache.camel:camel-servlet:jar:2.12-SNAPSHOT:compile
[INFO] |  +- org.apache.camel:camel-core:jar:2.12-SNAPSHOT:compile (version managed from 2.12-SNAPSHOT)
[INFO] |  \- org.apache.camel:camel-http:jar:2.12-SNAPSHOT:compile (version managed from 2.12-SNAPSHOT)
[INFO] |     +- commons-httpclient:commons-httpclient:jar:3.1:compile (version managed from 3.1)
[INFO] |     \- commons-codec:commons-codec:jar:1.6:compile
[INFO] +- org.apache.geronimo.specs:geronimo-servlet_2.5_spec:jar:1.2:provided
[INFO] +- com.google.appengine:appengine-api-1.0-sdk:jar:1.7.4:compile
[INFO] +- com.google.appengine:appengine-api-labs:jar:1.7.4:compile
[INFO] +- org.openengsb.wrapped:com.google.gdata:jar:1.41.5.w1:compile
[INFO] |  +- com.google.gdata:gdata-contacts-3.0:jar:1.41.5:compile
[INFO] |  +- com.google.gdata:gdata-calendar-2.0:jar:1.41.5:compile
[INFO] |  +- com.google.gdata:gdata-client-1.0:jar:1.41.5:compile
[INFO] |  \- com.google.gdata:gdata-core-1.0:jar:1.41.5:compile
[INFO] |     +- com.google.collections:google-collections:jar:1.0-rc1:compile
[INFO] |     \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] +- com.google.appengine:appengine-api-stubs:jar:1.7.4:test
[INFO] +- com.google.appengine:appengine-testing:jar:1.7.4:test
[INFO] +- org.eclipse.jetty:jetty-server:jar:7.6.8.v20121106:test
[INFO] |  +- org.eclipse.jetty.orbit:javax.servlet:jar:2.5.0.v201103041518:test
[INFO] |  +- org.eclipse.jetty:jetty-continuation:jar:7.6.8.v20121106:test
[INFO] |  \- org.eclipse.jetty:jetty-http:jar:7.6.8.v20121106:test
[INFO] |     \- org.eclipse.jetty:jetty-io:jar:7.6.8.v20121106:test
[INFO] |        \- org.eclipse.jetty:jetty-util:jar:7.6.8.v20121106:test (version managed from 7.6.8.v20121106)
[INFO] +- org.eclipse.jetty:jetty-servlet:jar:7.6.8.v20121106:test
[INFO] |  \- org.eclipse.jetty:jetty-security:jar:7.6.8.v20121106:test (version managed from 7.6.8.v20121106)
[INFO] +- org.apache.camel:camel-test:jar:2.12-SNAPSHOT:test
[INFO] +- org.springframework:spring-test:jar:3.2.3.RELEASE:test
[INFO] |  \- org.springframework:spring-core:jar:3.2.3.RELEASE:test (version managed from 3.2.3.RELEASE)
[INFO] |     \- commons-logging:commons-logging:jar:1.1.2:compile (version managed from 1.1.1)
[INFO] +- org.apache.camel:camel-spring:jar:2.12-SNAPSHOT:test
[INFO] |  +- org.springframework:spring-context:jar:3.2.3.RELEASE:test (version managed from 3.2.3.RELEASE)
[INFO] |  |  \- org.springframework:spring-expression:jar:3.2.3.RELEASE:test (version managed from 3.2.3.RELEASE)
[INFO] |  +- org.springframework:spring-aop:jar:3.2.3.RELEASE:test (version managed from 3.2.3.RELEASE)
[INFO] |  \- org.springframework:spring-tx:jar:3.2.3.RELEASE:test (version managed from 3.2.3.RELEASE)
[INFO] +- org.springframework:spring-web:jar:3.2.3.RELEASE:test
[INFO] |  +- aopalliance:aopalliance:jar:1.0:test
[INFO] |  \- org.springframework:spring-beans:jar:3.2.3.RELEASE:test (version managed from 3.2.3.RELEASE)
[INFO] +- httpunit:httpunit:jar:1.7:test
[INFO] |  +- javax.servlet:servlet-api:jar:2.3:test
[INFO] |  \- jtidy:jtidy:jar:4aug2000r7-dev:test
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.5:test
[INFO] |  +- org.slf4j:slf4j-api:jar:1.6.6:compile (version managed from 1.7.5)
[INFO] |  \- log4j:log4j:jar:1.2.17:test (version managed from 1.2.17)
[INFO] +- junit:junit:jar:4.11:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.apache.camel:apt:jar:2.12-SNAPSHOT:provided
[INFO] |  \- org.apache.camel:spi-annotations:jar:2.12-SNAPSHOT:provided
[INFO] \- com.sun.xml.bind:jaxb-impl:jar:2.2.6:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
于 2013-06-04T15:16:07.263 回答