JUnit/Ant in Hudson: How to start tests in headless mode? -
JUnit/Ant in Hudson: How to start tests in headless mode? -
i having problem setting unit tests project developed under netbeans in hudson. far, hudson running fine, monitoring git repository, , automatically starting builds.
but when building finished, hudson starts unit tests. , here lies problem: classes utilize awt, , when started within hudson, tests fail this:
[junit] testcase: testparse_simpletextandsymbols(com.dua3.util.text.latexparsertest): caused error [junit] can't connect x11 window server using ':0' value of display variable. [junit] java.lang.internalerror: can't connect x11 window server using ':0' value of display variable. [junit] @ sun.awt.x11graphicsenvironment.initdisplay(native method) [junit] @ sun.awt.x11graphicsenvironment.access$200(x11graphicsenvironment.java:65) [junit] @ sun.awt.x11graphicsenvironment$1.run(x11graphicsenvironment.java:110) [junit] @ java.security.accesscontroller.doprivileged(native method) [junit] @ sun.awt.x11graphicsenvironment.<clinit>(x11graphicsenvironment.java:74) [junit] @ java.lang.class.forname0(native method) [junit] @ java.lang.class.forname(class.java:190) [junit] @ java.awt.graphicsenvironment.createge(graphicsenvironment.java:102) [junit] @ java.awt.graphicsenvironment.getlocalgraphicsenvironment(graphicsenvironment.java:81) [junit] @ sun.awt.x11.xtoolkit.<clinit>(xtoolkit.java:119) [junit] @ java.lang.class.forname0(native method) [junit] @ java.lang.class.forname(class.java:190) [junit] @ java.awt.toolkit$2.run(toolkit.java:868) [junit] @ java.security.accesscontroller.doprivileged(native method) [junit] @ java.awt.toolkit.getdefaulttoolkit(toolkit.java:860) [junit] @ sun.swing.swingutilities2.getsystemmnemonickeymask(swingutilities2.java:1877) [junit] @ javax.swing.plaf.basic.basiclookandfeel.initcomponentdefaults(basiclookandfeel.java:752) [junit] @ javax.swing.plaf.metal.metallookandfeel.initcomponentdefaults(metallookandfeel.java:434) [junit] @ javax.swing.plaf.basic.basiclookandfeel.getdefaults(basiclookandfeel.java:148) [junit] @ javax.swing.plaf.metal.metallookandfeel.getdefaults(metallookandfeel.java:1589) [junit] @ javax.swing.uimanager.setlookandfeel(uimanager.java:536) [junit] @ javax.swing.uimanager.setlookandfeel(uimanager.java:576) [junit] @ javax.swing.uimanager.initializedefaultlaf(uimanager.java:1345) [junit] @ javax.swing.uimanager.initialize(uimanager.java:1455) [junit] @ javax.swing.uimanager.maybeinitialize(uimanager.java:1422) [junit] @ javax.swing.uimanager.getlookandfeeldefaults(uimanager.java:1034) [junit] @ com.dua3.util.graph.javase.swing.swingfont$swingfontprovider.getdefaultfont(swingfont.java:50) [junit] @ com.dua3.util.graph.font.getdefault(font.java:52) [junit] @ com.dua3.util.text.latexparser$settings.<init>(latexparser.java:39) [junit] @ com.dua3.util.text.latexparser.parse(latexparser.java:61) [junit] @ com.dua3.util.text.latexparsertest.testparse_simpletextandsymbols(latexparsertest.java:49)
i thought should plenty check graphicsenvironment.isheadless()
, isn't. code snippet goes wrong:
if(!graphicsenvironment.isheadless()) { final uidefaults lookandfeeldefaults = uimanager.getlookandfeeldefaults(); // swingfont.java:50 if (lookandfeeldefaults!=null) { swingfont = lookandfeeldefaults.getfont("defaultfont"); } }
i tried in next in hudson:
setting java options -djava.awt.headless=true
in "build" section
entering line "java.awt.headless=true" in build properties
all of doesn't work. seems passed on ant
, not onwards when invoking java
run junit tests.
is there way tell ant want tests run in headless mode?
i spend time looking , found answer. in short: setting java.awt.headless=true
not plenty on linux. have unset display
. so, go "manage hudson", "configure system", create sure "environment variables" checked under "global properties" , add together new variable of name display
(leave value field blank).
ant junit awt hudson headless
Comments
Post a Comment