我正在使用Java 6,JaxB 2和SpringSource Tool Suite(与Eclipse相同).我有几个我编写的Java类,我从中使用JaxB生成XML模式.但是,我注意到为了使用JaxB从Java对象生成XML文档的能力,我需要一个ObjectFactory.
final Marshaller marshaller = jaxbContext.createMarshaller();
// Here is where I don't have an ObjectFactory defined
final JAXBElement<WebLeads> webLeadsElement
= (new ObjectFactory()).createWebLeads(webLeadsJavaObj);
Run Code Online (Sandbox Code Playgroud)
如何在不吹走现有类的情况下生成ObjectFactory?
我在Windows XP(sp2)上使用Selenium独立服务器v2.3.0.我注意到当我尝试针对Firefox运行我的html套件时,只有第一个测试被执行,然后Selenium Runner就坐在那里而没有做任何事情.我使用的命令是
java -debug -jar c:/selenium/selenium-server-standalone-2.3.0.jar -port 4444 -userExtensions c:/selenium/user-extensions.js -htmlSuite *chrome http://www.stage.mycliusa.com c:/selenium/test/suite.html c:/selenium/report2.html
Run Code Online (Sandbox Code Playgroud)
HTML套件文件内容如下.有趣的是,当我运行相同的命令切换"*chrome"和"*iehta"时,一切运行正常.任何想法为什么Firefox测试在第一次测试后停止? - 戴夫
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<title>mycli USA Tests - Critical Path/Live/EX</title>
</head>
<body>
<table id="suiteTable" cellpadding="1" cellspacing="1" border="1" class="selenium"><tbody>
<tr><td><b>mycli USA Tests - Critical Path/Live/EX</b></td></tr>
<tr><td><a href="mycliConfigNewEXJourneyAWD">mycliConfigNewEXJourneyAWD</a></td></tr>
<tr><td><a href="mycliContactRetailerOldEX">mycliContactRetailerOldEX</a></td></tr>
<tr><td><a href="mycliRAQOldEX35Base">mycliRAQOldEX35Base</a></td></tr>
<tr><td><a href="mycliPreApprovedEX35">mycliPreApprovedEX35</a></td></tr>
<tr><td><a href="mycliContactRetailerNewEX35AWD">mycliContactRetailerNewEX35AWD</a></td></tr>
<tr><td><a href="mycliJMLHandraiserEX">mycliJMLHandraiserEX</a></td></tr>
<tr><td><a href="mycliRABEBrochureEX">mycliRABEBrochureEX</a></td></tr>
<tr><td><a href="mycliContactRetailerNewEXJourneyAWD">mycliContactRetailerNewEXJourneyAWD</a></td></tr>
<tr><td><a href="mycliConfigNewEX35Base">mycliConfigNewEX35Base</a></td></tr>
<tr><td><a href="mycliConfigNewEX35AWD">mycliConfigNewEX35AWD</a></td></tr>
<tr><td><a href="mycliRABMailEX">mycliRABMailEX</a></td></tr>
<tr><td><a …
Run Code Online (Sandbox Code Playgroud) 我正在使用Maven 3.0.3.我正在尝试从属性文件中测试读取属性(这是更大努力的一部分,我希望首先使这部分正确).我在我的pom.xml文件中有这个...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>maven-properties-plugin</artifactId>
<version>1.0</version>
<configuration>
<files>
<file>${basedir}/build.properties</file>
</files>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
但遗憾的是,运行"mvn properties:read-project-properties"会失败,并显示以下错误.我如何重新配置我正在做的事情? - 戴夫
davea-mbp2:socialmediaproxy davea$ mvn properties:read-project-properties
[INFO] Scanning for projects...
[WARNING] The POM for org.codehaus.mojo:maven-properties-plugin:jar:1.0 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.codehaus.mojo:maven-properties-plugin:1.0: Plugin org.codehaus.mojo:maven-properties-plugin:1.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:maven-properties-plugin:jar:1.0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building socialmediaproxy 0.1
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.codehaus.mojo:maven-properties-plugin:jar:1.0 is missing, no dependency information …
Run Code Online (Sandbox Code Playgroud) 我在Mac 10.6.6上使用VM Ware Fusion 3.1.2.我创建了一个Windows 7图像,但是当我检查构成图像的文件时,有21个"范围"文件 - 例如文件名如
Windows 7-s001.vmdk Windows 7-s002.vmdk Windows 7-s003.vmdk ...
最终我想将其转换为VirtualBox使用的东西,所以要做到这一点,我需要获得一个vmdk(-flat.vmdk)文件.鉴于我现在有多个文件,有谁知道如何生成单个文件?
谢谢, - 戴夫
我在Mac 10.6.6上使用Perl 5.10.6.我想执行一个简单的搜索并替换文件,所以我尝试:
my $searchAndReplaceCmd = "perl -pi -e 's/\\Q${localTestDir}\\E//g' ${testSuiteFile}";
system( $searchAndReplaceCmd );
Run Code Online (Sandbox Code Playgroud)
但上面的问题是变量$localTestDir
包含目录分隔符("/"
),这搞砸了正则表达式...
Bareword发现运营商预期在-e line 1,靠近"s /\Q/home/selenium"
反斜杠发现其中运营商预计将在-e 1号线,靠近"活\"语法错误在-e行1,近"S /\Q /家/硒"
搜索模式未在-e第1行终止.
当有问题的变量包含正则表达式字符时,如何对文件进行搜索和替换?谢谢.
有没有办法,使用基本的Unix命令,找到下一个未使用的端口号,从端口4444开始向上?我是(通过openssh)进入Windows XP机器,运行Cygwin工具并使用bash shell.
谢谢, - 戴夫
我正在使用Maven 3.0.3和Tomcat插件.使用Maven和Tomcat,我想部署一个嵌入的站点实例.我的问题是如何在嵌入式Tomcat服务器中配置其他上下文路径?下面是我的Tomcat配置,但我的""规范无效或该文件的内容(如下)无效......
<Context path="/all-new-jx-web" docBase="/Users/davea/Documents/workspace/NissanUSA2/Technology/nna/mycousa/jx/target/web">
Run Code Online (Sandbox Code Playgroud)
因为当我调用时
mvn clean -Dmaven.test.skip=true verify -Ptomcat tomcat:run
Run Code Online (Sandbox Code Playgroud)
,没有映射到"/ all-new-jx-web"(我的附加上下文路径)的URL被映射(资产不由Tomcat提供).有什么想法吗?下面是我的pom.xml文件中的tomcat配置文件...
<profile>
<id>tomcat</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<contextFile>config/tomcat/context.xml</contextFile>
<mode>context</mode>
<addContextWarDependencies>true</addContextWarDependencies>
<charset>UTF-8</charset>
<path>/all-new-jx</path>
<update>true</update>
<warDirectory>target/${project.artifactId}-${project.version}.${project.packaging}</warDirectory>
<systemProperties>
<JAVA_OPTS>-Xms256m -Xmx512m -XX:MaxPermSize=256m -XX:NewRatio=6
-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
-verbose:gc"</JAVA_OPTS>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Run Code Online (Sandbox Code Playgroud)
感谢任何解决方案和其他故障排除步骤, - 戴夫
我正在使用Grails 1.3.7.我正在尝试在集成测试中测试重定向.这是我的控制器和方法问题......
class HomeController {
def design = {
....
if (params.page) {
redirect(uri: "/#/design/${params.page}")
}
else {
redirect(uri: "/#/design")
}
break;
}
}
Run Code Online (Sandbox Code Playgroud)
但是在我的集成测试中,对"controller.response.redirectedUrl"的调用失败(总是返回null),即使我知道正在进行重定向调用(通过日志记录验证).下面的集成测试有什么问题?
class HomeControllerTests extends grails.test.ControllerUnitTestCase {
....
void testHomePageDesign() {
def controller = new HomeController()
// Call action without any parameters
controller.design()
assert controller.response.redirectedUrl != null
assertTrue( responseStr != "" )
}
Run Code Online (Sandbox Code Playgroud)
谢谢, - 戴夫
我正在使用Grails 1.2.1.如何访问我的grailsApplication.config变量?我有这堂课......
public class Utility {
def grailsApplication
...
public static boolean isAuthorizedHost(String hostIpAddr) {
// Simple validation
if (hostIpAddr == null || hostIpAddr.length() == 0)
return false;
//
def allowedDomains = grailsApplication.config.proxy.allowedDomains
Run Code Online (Sandbox Code Playgroud)
但是我得到了这个编译错误......
[groovyc] /Users/davea/Documents/workspace-sts-2.6.0.SR1/socialmediaproxy/src/groovy/com/nna/tool/proxy/Utility/Utility.groovy: 26: Apparent variable 'grailsApplication' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
[groovyc] You attempted to reference a variable in the binding or an instance variable from a static context.
[groovyc] You misspelled …
Run Code Online (Sandbox Code Playgroud) 我正在使用Ant 1.8,JUnit 4.8.2.我正在尝试加载属性文件并遇到一些问题.属性文件位于源目录的根目录下,我将其加载到类路径中,并在类路径中显式加载属性文件.下面是我的ant build.xml文件.这是我试图加载属性的方式......
private void loadTestProperties() {
try {
Properties prop = new Properties();
InputStream in = getClass().getResourceAsStream("db.properties");
prop.load(in);
in.close();
} catch (Exception e) {
fail("Failed to load properties: " + e.getMessage());
} // try
} // loadTestProperties
Run Code Online (Sandbox Code Playgroud)
它总是以null为失败(未加载属性).
<project name="leads-testing" default="build" basedir=".">
<property name="tst-dir" location="/Users/davea/Documents/workspace-sts-2.6.0.SR1/infinitiusa_leads_testing/test" />
<property name="db-props-file" location="/Users/davea/Documents/workspace-sts-2.6.0.SR1/infinitiusa_leads_testing/test/db.properties" />
<property name="TALK" value="true" />
<path id="classpath.base">
</path>
<path id="classpath.test">
<pathelement location="lib/junit-4.8.2.jar" />
<pathelement location="lib/selenium-java-client-driver.jar" />
<pathelement location="lib/classes12.jar" />
<pathelement location="${tst-dir}" />
<pathelement location="${db-props-file}" />
<path refid="classpath.base" />
</path> …
Run Code Online (Sandbox Code Playgroud)