testsuiteservice.java
来自「cqME :java framework for TCK test.」· Java 代码 · 共 143 行
JAVA
143 行
/* * $Id$ * * Copyright 1996-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.tck.j2me.javatest;import com.sun.tck.j2me.services.Service;import com.sun.tck.j2me.services.ServiceFault;import com.sun.javatest.TestEnvironment;import com.sun.javatest.Harness;import com.sun.javatest.TestSuite;import com.sun.javatest.util.I18NResourceBundle;/** * A Service class which provides APIs to set and get TestEnvironment and * Harness required by certain services. */ public class TestSuiteService extends Service { private TestEnvironment env = null; private Harness harness = null ; private TestSuite ts = null; private ClassLoader loader = null; /** * i18n instance for the TestSuite service class and its sub class. * By default it gets the I18N resource bundle from * the same directory of TestSuiteService class. */ protected I18NResourceBundle i18n = I18NResourceBundle.getBundleForClass(TestSuiteService.class); public static class TestSuiteServiceFault extends ServiceFault { /** * Create a Fault. * @param i18n A resource bundle in which to find the detail message. * @param s The key for the detail message. */ public TestSuiteServiceFault(I18NResourceBundle i18n, String s) { super(i18n.getString(s)); } /** * Create a Fault. * @param i18n A resource bundle in which to find the detail message. * @param s The key for the detail message. * @param o An argument to be formatted with the detail message by * {@link java.text.MessageFormat#format} */ public TestSuiteServiceFault(I18NResourceBundle i18n, String s, Object o) { super(i18n.getString(s, o)); } /** * Create a Fault. * @param i18n A resource bundle in which to find the detail message. * @param s The key for the detail message. * @param o An array of arguments to be formatted with the detail message by * {@link java.text.MessageFormat#format} */ public TestSuiteServiceFault(I18NResourceBundle i18n, String s, Object[] o) { super(i18n.getString(s, o)); } } /** * Creates a TestSuiteService. * * @param harness Harness where the service will be running * @throws NullPointerException if harness is null */ public TestSuiteService(Harness harness) throws NullPointerException { if (harness == null) { throw new NullPointerException("Harness is null!"); } this.harness = harness; env = harness.getEnv(); ts = harness.getParameters().getTestSuite(); } /** * Creates a TestSuiteService. * * @param harness Harness where the service will be running * @param loader ClassLoader for the TestSuite * @throws NullPointerException if harness is null */ public TestSuiteService(Harness harness, ClassLoader loader) { this(harness); this.loader = loader; } /** * Get associated TestEnvironment from the harness. */ public final TestEnvironment getTestEnvironment() { return env; } /** * Get the harness instance which is passed to the constructor. */ public final Harness getHarness() { return harness; } /** * Get associated TestSuite from the harness. */ public final TestSuite getTestSuite() { return ts; } /** * Get associated class loader which is passed to the constructor. */ public final ClassLoader getClassLoader() { return loader; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?