javaclient.svn-base

来自「cqME :java framework for TCK test.」· SVN-BASE 代码 · 共 82 行

SVN-BASE
82
字号
/* * @@CLASS_NAME@@.java * * Created on @@DATE@@, @@TIME@@ */@@PACKAGE_HEADER@@import java.io.IOException;import java.io.PrintStream;import com.sun.tck.cldc.lib.Status;import javax.microedition.lcdui.Form;import javax.microedition.lcdui.Display;import javax.microedition.lcdui.Alert;import com.sun.tck.midp.javatest.agent.MIDletAgent;public class @@CLASS_NAME@@ extends MIDPDistributedInteractiveTest {    public @@CLASS_NAME@@() {        super("@@CLASS_NAME@@");    }    protected void runTestCases() {        if ( isSelected("test1()")) {            addStatus(test1());        }    }    public Status test1() {        String testCaseID = "test1";        try {            send("@@CLASS_NAME@@Server", new String[] {"runTestCase", testCaseID});        } catch (IOException e) {            return Status.failed("failed: " + e);        }        String instruction = "Please follow instructions in the main window.";        addInfo(instruction);        setFormTitle("Alert class tests");                return Status.passed(""); // will be ignored    }    protected void handleMessage(String from, String[] args) {        if ("test1".equals(args[2])) {            handle_test1(from, args);        }else if ("done".equals(args[2])) {            handle_done(from, args);        } else if ("endRun".equals(args[2])) {            messageReceived();        } else if ("runTestCase".equals(args[2])) {            messageReceived();        } else {            handleUnknownMessage(from, args);        }    }    public void handle_test1(String from, String[] args) {        Alert testAlert = new Alert("Hello test");        testAlert.setTimeout(5000);        display.setCurrent(testAlert);        synchronized(this) {            while (!testAlert.isShown()) {                try {                    wait(100);                } catch(InterruptedException ie) {                }            }        }        testAlert.setString("Hello test.");        try {            send("@@CLASS_NAME@@Server", new String[] {"test1", "done"});        } catch (IOException e) {            log.println("Unexpected IOException thrown while sending alertTest - done:" + e);        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?