testmeinterview.java.svn-base
来自「cqME :java framework for TCK test.」· SVN-BASE 代码 · 共 142 行
SVN-BASE
142 行
/*
* $Id$
*
* Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 only, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details (a copy is
* included at /legal/license.txt).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 or visit www.sun.com if you need additional
* information or have any questions.
*
*/
package com.sun.testme.framework;
import com.sun.interview.Interview;
import com.sun.interview.NullQuestion;
import com.sun.interview.Question;
import com.sun.javatest.TestEnvironment;
import com.sun.javatest.TestSuite;
import com.sun.tck.j2me.interview.MidpTckBaseInterview;
import com.sun.tck.j2me.interview.VmInterview;
import com.sun.tck.j2me.javatest.J2meBaseTestSuite;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
public class TestMEInterview extends MidpTckBaseInterview
implements com.sun.javatest.Parameters.EnvParameters {
public TestMEInterview() throws Interview.Fault {
super("TestMEInterview");
setDistrMode(true);
setResourceBundle("i18n");
}
public TestMEInterview(TestSuite ts) throws Interview.Fault {
super("TestMEInterview", (J2meBaseTestSuite)ts, true);
setDistrMode(true);
setResourceBundle("i18n");
vmInterview = new VmInterview(this, false, true, 100000);
this.ts = ts;
}
protected Question getEnvFirstQuestion() {
return callInterview(vmInterview, qBasicParams);
}
public com.sun.javatest.Parameters.EnvParameters getEnvParameters() {
return this;
}
private NullQuestion qBasicParams = new NullQuestion(this, "parameters") {
public Question getNext() {
return getEnvSuccessorQuestion();
}
public void export(Map map) {
if(!vmInterview.isExport()) {
map.put("script", "com.sun.tck.midp.javatest.MidTCKScript");
}
String classPath = (ts == null ? null : ts.getTestSuiteInfo("testclasspath"));
if (classPath != null) {
classPath = classPath.replace("$testSuiteRootDir", ts.getRootDir().getAbsolutePath());
map.put("testPath", classPath);
}
// String agent = (String)map.get("agent");
// agent = agent.replace("com.sun.tck.midp.javatest.agent.MIDletAgent", "hello.HelloMidlet");
// map.put("agent", agent);
map.put("remote.networkAgent", "-host localhost -port $passivePort " +
"-classpath $testSuiteRootDir$/lib$/server_tests.jar$:$testSuiteRootDir$/lib$/j2mefw_jt.jar");
map.put("passivePort", "8198");
map.put("remoteVerbose", "true");
}
};
public TestEnvironment getEnv() {
HashMap envProps = new HashMap();
export(envProps);
// values coming in from elsewhere
// done before export so that questions override any values in
// the backdoor map
// NOTE: positioned here after the export(), backdoor values will override
// those produced by the interview
loadBackdoorValues(envProps);
// cache work
String envName = "AAA";
File f = getFile();
cachedEnvName = envName;
cachedMap = envProps;
cachedFile = f;
try {
String name = "AAA";
if (name == null || name.length() == 0 && getResourceBundle() != null)
// need to wait for a nicer way to get the I18N string
// coming in JT 3.1.1+ API
name = getResourceBundle().getString("main.error.noName");
cachedEnv = new TestEnvironment(name, envProps, "AAA");
return cachedEnv;
}
catch (TestEnvironment.Fault e) {
throw new Error("Unexpected problem creating the CHAPI TCK environment");
}
}
// cached values
private String cachedEnvName;
private TestEnvironment cachedEnv;
private File cachedFile;
private Map cachedMap;
private TestSuite ts;
private VmInterview vmInterview;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?