/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
/**
Main class that runs all the unit tests
*/
public final class TestMain
implements NotificationListener {
private static void
printUsage() {
println("USAGE: java " + TestMain.class.getName() + " <properties-file> [name=value [name=value]*]");
"\n\nAdditional properties may be included and will be placed into a Map " +
"for use by any unit test.";
println("");
" may contain the name of a file which specifies which test classes to run. " +
"Files should be listed with fully-qualified classnames, one per line. " +
"The # character may be used to comment-out classnames."
);
println("");
println("Additional properties may also be passed directly on the command line.");
println("These override any properties found in the specified properties file.");
println("[all properties intended for permanent use should be defined in PropertyKeys.java]");
println("EXAMPLE:");
println("java TestMain amxtest.properties amxtest.verbose=true my-temp=true");
}
private static boolean
}
protected static void
checkAssertsOn() {
try {
assert (false);
throw new Error("TestMain(): Assertions must be enabled for unit tests!");
}
catch (AssertionError a) {
}
}
if (delimIndex < 0) {
} else {
}
}
return params;
}
private static DomainRoot
return domainRoot;
}
public static void
throws Exception {
// for friendlier output via Stringifiers
printUsage();
}
try {
}
catch (Throwable t) {
} else {
}
}
}
}
public static String
return (SmartStringifier.toString(o));
}
private final DomainRoot
getDomainRoot() {
return (mDomainRoot);
}
private TLSParams
final File trustStoreFile,
return (tlsParams);
}
/**
Read connect properties from a file.
*/
throws IOException {
} else {
println("Using default properties.");
}
return (props);
}
/**
@param host hostname or IP address of Domain Admin Server
@param port RMI administrative port
@param user admin user
@param password admin user password
@param tlsParams TLS parameters, may be null
@return AppserverConnectionSource
*/
public static AppserverConnectionSource
final int port,
throws IOException {
final AppserverConnectionSource conn =
conn.getJMXConnector(false);
//println( "Connected: " + info );
return (conn);
}
private final class PropertyGetter {
}
public Object
}
return (result);
}
}
public boolean getboolean(final String key) { return (Boolean.valueOf(getString(key)).booleanValue()); }
}
;
private AppserverConnectionSource
final PropertyGetter getter,
final int port)
throws IOException {
try {
if (mHandshakeCompletedListener != null) {
println("HandshakeCompletedEvent: " +
}
}
catch (IOException e) {
if (useTLS) {
// try without TLS
println("Attempting connection without TLS...");
}
}
}
return (conn);
}
private AppserverConnectionSource
throws IOException {
}
private AppserverConnectionSource
final PropertyGetter getter,
boolean retry)
throws Exception {
for (int i = 0; i < 5; ++i) {
try {
break;
}
catch (Exception e) {
"...retry...");
continue;
}
throw e;
}
}
return (conn);
}
public void
final Notification notifIn,
if (notifIn instanceof JMXConnectionNotification) {
}
}
}
private void
}
}
private String[]
int i = 0;
++i;
}
return names;
}
private void
println("\nWARNING: the following tests WILL NOT BE RUN:");
}
println("");
}
println("\nNOTE: the following non-default tests WILL BE RUN:");
println("");
}
}
private void
"----------------------------------------\n" +
"- -\n" +
"- NOTE: -\n" +
"- Generic tests currently disabled for -\n" +
"- AMX MBeans which reside in non-DAS -\n" +
"- server instances eg Logging, CallFlow.-\n" +
"- Denoted by 'remoteIncomplete' -\n" +
"- -\n" +
"- -\n" +
"----------------------------------------";
}
throws FileNotFoundException, IOException {
} else {
try
{
}
catch( final IOException e )
{
throw e;
}
try {
// println( "Looking for class " + StringUtil.quote(classname) );
}
catch (Throwable t) {
}
}
}
}
return (testClasses);
}
private void
println("\nNOTE: the following properties are not recognized but " +
"will be included in the environment for use by unit tests:");
println("");
}
}
final DomainRoot domainRoot,
final PropertyGetter getter) {
println("");
println("Contacting node agents...");
if (! r.resolveBoolean("Enabled") ) {
continue;
}
continue;
}
// See if we can connect
try {
final AppserverConnectionSource asConn =
final boolean alive =
assert (alive);
}
catch (Exception e) {
continue;
}
}
println("");
return nodeAgentConnections;
}
private Capabilities
try {
}
catch (Exception e) {
}
return capabilities;
}
final DomainRoot domainRoot,
final PropertyGetter getter,
final boolean monitorsSupported = !offline;
boolean include = true;
try {
capabilities = getCapabilities(c);
}
catch( Throwable t )
{
continue;
}
if ((!monitorsSupported) &&
AMXMonitorTestBase.class.isAssignableFrom(c)) {
include = false;
include = false;
} else if (ClusterSupportRequired.class.isAssignableFrom(c) &&
include = false;
} else if (MultipleServerSupportRequired.class.isAssignableFrom(c) &&
include = false;
}
if (include) {
} else {
}
}
return included;
}
{
{
}
else
{
}
return dir;
}
/**
*/
public TestMain(
final String optionalPropertiesFile,
throws Exception {
println("");
println("");
if (testOffline) {
//println( "\n\n------------------------------------------" );
//println( "MBeans registered:" );
//println( CollectionUtil.toString( mbeans, "\n" ) );
//println( "\n\n" );
} else {
throw new IOException("Can't connect to server");
}
} else {
mDomainRoot = null;
}
}
if (mDomainRoot != null) {
}
final boolean expandedTesting = testOffline ?
}
println("VERBOSE mode enabled");
if (threaded) {
println("NOTE: timings displayed when running " +
"threaded tests will be impacted by other concurrent tests.");
}
}
conn,
println("");
println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
println(">>>> Please inspect amxtest.coverage <<<<");
println(" ^ ");
println(" ^ ");
println(" ^ ");
println(" ^ ");
}
private void
final int iterations,
final ConnectionSource conn,
final boolean threaded,
throws Exception {
for (int i = 0; i < iterations; ++i) {
if (iterations != 1) {
println("#########################################################");
println("#########################################################");
}
}
}
}