本文整理汇总了Java中org.netbeans.jemmy.TestOut类的典型用法代码示例。如果您正苦于以下问题:Java TestOut类的具体用法?Java TestOut怎么用?Java TestOut使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TestOut类属于org.netbeans.jemmy包,在下文中一共展示了TestOut类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.netbeans.jemmy.TestOut; //导入依赖的package包/类
/**
* Sets up logging facilities.
*/
public void setUp() throws IOException {
System.out.println("######## " + getName() + " #######");
openDataProjects("JunitTestProject");
new Action("Run|Set Main Project|JunitTestProject", null).perform();
ProjectSupport.waitScanFinished();
err = getLog();
log = getRef();
JemmyProperties.getProperties().setOutput(new TestOut(null,
new PrintWriter(err, true), new PrintWriter(err, false), null));
try {
File wd = getWorkDir();
workDir = wd.toString();
} catch (IOException e) { }
// set up filters for author and date
filter = new StringFilter();
filter.addReplaceFilter("@author ", "\n", "@author Tester\n");
filter.addReplaceFilter("Created on ", "\n", "Created on Date\n");
}
示例2: initEnvironment
import org.netbeans.jemmy.TestOut; //导入依赖的package包/类
/** Inits environment before test case is executed. It can be overridden
* in sub class but it is recommended to call super.initEnvironment() at
* the beginning.
* <br>
* Default initialization: output messages from jemmy are redirected
* to jemmy.log file in workdir; jemmy timeouts are loaded from
* org.netbeans.jellytools.timeouts and if system property jelly.timeouts_resource
* or jelly.timeouts_file are set, timeouts are loaded from specified
* resource/file;
*/
protected void initEnvironment() {
// redirect log messages from jemmy to jemmy.log file in workdir
PrintStream jemmyLog = getLog("jemmy.log");
JemmyProperties.setCurrentOutput(new TestOut(System.in, jemmyLog, jemmyLog));
// load timeouts
String timeoutsResource = System.getProperty("jelly.timeouts_resource");
String timeoutsFile = System.getProperty("jelly.timeouts_file");
try {
JemmyProperties.getCurrentTimeouts().load(getClass().getClassLoader().
getResourceAsStream("org/netbeans/jellytools/timeouts"));
if (timeoutsResource != null && !"".equals(timeoutsResource)) {
JemmyProperties.getCurrentTimeouts().load(
getClass().getClassLoader().getResourceAsStream(timeoutsResource));
} else if (timeoutsFile != null && !"".equals(timeoutsFile)) {
JemmyProperties.getCurrentTimeouts().load(timeoutsFile);
}
} catch (Exception e) {
throw new JemmyException("Initialization of timeouts failed.", e);
}
}
示例3: checkSubchooser
import org.netbeans.jemmy.TestOut; //导入依赖的package包/类
/** If subchooser is null, return TopComponent.
* Else if c is instance of MultiViewCloneableTopComponent try to find
* and return sub component in MVCTC corresponding to sub chooser. Else
* check TC in sub chooser and return it if matches. MVCTC can host
* several views, e.g. source and design view in form editor or xml, servlets,
* overview views in web.xml editor. Then EditorOperator is able to find
* appropriate CloneableEditor in MVCTC.
* @param c TopComponent to check
* @param subchooser ComponentChooser to check if matches
* @return given TopComponent or appropriate sub component
*/
private static JComponent checkSubchooser(TopComponent c, ComponentChooser subchooser) {
if (subchooser == null) {
return c;
} else {
boolean isMultiView = false;
try {
//isMultiView = c instanceof MultiViewCloneableTopComponent;
isMultiView = isMultyView(c);
} catch (Throwable t) {
// ignore possible NoClassDefFoundError because org.netbeans.core.multiview module is not enabled in IDE
}
if (isMultiView) {
TopComponentOperator tco = new TopComponentOperator((JComponent) c);
// suppress output when finding sub component
tco.setOutput(TestOut.getNullOutput());
return (JComponent) tco.findSubComponent(subchooser);
} else {
if (subchooser.checkComponent(c)) {
return c;
}
}
}
return null;
}
示例4: actionProduced
import org.netbeans.jemmy.TestOut; //导入依赖的package包/类
@Override
public Component actionProduced(Void obj) {
Window popupWindow = null;
if (pChooser.checkComponent(getWindow())) {
popupWindow = getWindow();
} else {
popupWindow = WindowWaiter.getWindow(getWindow(), pChooser);
}
if (popupWindow != null) {
ComponentSearcher sc = new ComponentSearcher(popupWindow);
sc.setOutput(TestOut.getNullOutput());
return sc.findComponent(cChooser);
} else {
return null;
}
}
示例5: setUp
import org.netbeans.jemmy.TestOut; //导入依赖的package包/类
public void setUp() {
//err = System.out;
err = getLog();
log = getRef();
try {
JemmyProperties.getProperties().setOutput(new TestOut(null, new PrintWriter(err, true), new PrintWriter(err, true), null));
initializeWorkplace();
}catch(Exception exc) {
failTest(exc, "SetUp failed. It seems like initializeWorkplace cause exception:"+exc.getMessage());
}
}
示例6: setUp
import org.netbeans.jemmy.TestOut; //导入依赖的package包/类
public @Override void setUp() {
// err = System.out;
err = getLog();
log = getRef();
try {
// set defaults
JemmyProperties.getProperties().setOutput(new TestOut(null, new PrintWriter(err, true), new PrintWriter(err, true), null));
}catch(Exception exc) {
failTest(exc, "Fail setUp() - maybe MainFrame hasn't menubar");
}
}
示例7: checkComponent
import org.netbeans.jemmy.TestOut; //导入依赖的package包/类
public boolean checkComponent(Component comp) {
WindowOperator winOper = new WindowOperator((Window)comp);
winOper.setOutput(TestOut.getNullOutput());
if(winOper.findSubComponent(jHelpChooser) != null) {
if(title != null) {
return compareTitle(winOper, title);
} else {
return true;
}
}
return false;
}
示例8: testPrintDump
import org.netbeans.jemmy.TestOut; //导入依赖的package包/类
/**
* Tests printDump method.
*/
public void testPrintDump() {
StringWriter stringWriter = new StringWriter();
WidgetOperator sceneOper = new WidgetOperator(scene);
sceneOper.setOutput(new TestOut(null, new PrintWriter(stringWriter), new PrintWriter(stringWriter)));
sceneOper.printDump();
assertTrue("Dump of widgets should contain LabelWidget", stringWriter.toString().contains("LabelWidget"));
}
示例9: setUp
import org.netbeans.jemmy.TestOut; //导入依赖的package包/类
/**
* Sets up logging facilities.
*/
@Override
public void setUp() throws Exception {
super.setUp();
System.out.println("######## "+getName()+" #######");
err = getLog();
log = getRef();
JemmyProperties.getProperties().setOutput(new TestOut(null,
new PrintWriter(err, true), new PrintWriter(err, false), null));
try {
File wd = getWorkDir();
workDir = wd.toString();
} catch (IOException e) { }
openDefaultProject();
}
示例10: setUp
import org.netbeans.jemmy.TestOut; //导入依赖的package包/类
/**
* Sets up logging facilities.
*/
public void setUp() throws Exception {
super.setUp();
System.out.println("######## "+getName()+" #######");
err = getLog();
log = getRef();
JemmyProperties.getProperties().setOutput(new TestOut(null,
new PrintWriter(err, true), new PrintWriter(err, false), null));
try {
File wd = getWorkDir();
workDir = wd.toString();
} catch (IOException e) { }
}
示例11: setUp
import org.netbeans.jemmy.TestOut; //导入依赖的package包/类
/**
* Sets up logging facilities.
*/
@Override
public void setUp() {
System.out.println("######## "+getName()+" #######");
err = getLog();
log = getRef();
JemmyProperties.getProperties().setOutput(new TestOut(null,
new PrintWriter(err, true), new PrintWriter(err, false), null));
try {
File wd = getWorkDir();
workDir = wd.toString();
} catch (IOException e) { }
openDefaultProject();
}
示例12: setUp
import org.netbeans.jemmy.TestOut; //导入依赖的package包/类
/**
* Sets up logging facilities.
*/
public void setUp() {
System.out.println("######## "+getName()+" #######");
err = getLog();
log = getRef();
JemmyProperties.getProperties().setOutput(new TestOut(null,
new PrintWriter(err, true), new PrintWriter(err, false), null));
try {
File wd = getWorkDir();
workDir = wd.toString();
} catch (IOException e) { }
}
示例13: RobotDriver
import org.netbeans.jemmy.TestOut; //导入依赖的package包/类
/**
* Constructs a RobotDriver object.
*
* @param autoDelay Time for {@code Robot.setAutoDelay(long)} method.
* @param supported an array of supported class names
*/
public RobotDriver(Timeout autoDelay, String[] supported) {
super(supported);
qtool = new QueueTool();
qtool.setOutput(TestOut.getNullOutput());
this.autoDelay = autoDelay;
}
示例14: waitComponent
import org.netbeans.jemmy.TestOut; //导入依赖的package包/类
/**
* A method to be used from subclasses. Uses timeouts and output passed as
* parameters during the waiting.
*
* @param cont Container to search component in.
* @param chooser org.netbeans.jemmy.ComponentChooser implementation.
* @param index Ordinal component index.
* @param timeouts timeouts to be used during the waiting.
* @param output an output to be used during the waiting.
* @return Component instance or null if component was not found.
* @throws TimeoutExpiredException
*/
protected static Component waitComponent(final Container cont,
final ComponentChooser chooser,
final int index,
Timeouts timeouts, final TestOut output) {
try {
Waiter<Component, Void> waiter = new Waiter<>(new Waitable<Component, Void>() {
@Override
public Component actionProduced(Void obj) {
return findComponent(cont, new VisibleComponentFinder(chooser), index,
output.createErrorOutput());
}
@Override
public String getDescription() {
return "Wait " + chooser.getDescription() + " loaded";
}
@Override
public String toString() {
return "ComponentOperator.waitComponent.Waitable{description = " + getDescription() + '}';
}
});
waiter.setTimeoutsToCloneOf(timeouts, "ComponentOperator.WaitComponentTimeout");
waiter.setOutput(output);
return waiter.waitAction(null);
} catch (InterruptedException e) {
return null;
}
}
示例15: setOutput
import org.netbeans.jemmy.TestOut; //导入依赖的package包/类
@Override
public void setOutput(TestOut out) {
super.setOutput(out);
this.output = out;
if (dispatcher != null) {
dispatcher.setOutput(output.createErrorOutput());
}
}