/*
* 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.
*/
/*
* $Header: /cvs/glassfish/admin/mbeanapi-impl/tests/org.glassfish.admin.amxtest/base/GenericTest.java,v 1.8 2007/05/05 05:23:53 tcfujii Exp $
* $Revision: 1.8 $
* $Date: 2007/05/05 05:23:53 $
*/
/**
*/
public final class GenericTest
extends AMXTestBase {
final boolean mDoInfo;
final boolean mDoAttributes;
final boolean mDoOperations;
final boolean mwarnings;
public GenericTest()
throws IOException {
mDoInfo = true;
mDoAttributes = true;
mDoOperations = true;
mwarnings = true;
}
public static Capabilities
getCapabilities() {
return getOfflineCapableCapabilities(true);
}
final ObjectName objectName,
throws Exception {
try {
if (a == null) {
// null is legal, apparently
}
}
catch (NotSerializableException e) {
}
catch (IOException e) {
}
catch (Exception e) {
}
}
return (failures);
}
private String
if (e instanceof IOException) {
if (shouldPrintStackTraces()) {
}
} else {
msg = "threw an Exception of type " +
if (shouldPrintStackTraces()) {
}
}
if (rootCause != e) {
if (shouldPrintStackTraces()) {
}
}
return (msg);
}
final MBeanAttributeInfo[] infos,
break;
}
}
return (info);
}
private void
final boolean failure,
final ObjectName objectName,
final MBeanAttributeInfo[] infos,
throws Exception {
trace("");
int i = 0;
if (t == null) {
} else {
}
++i;
}
}
private boolean
final ObjectName objectName,
boolean valid = true;
valid = false;
}
valid = false;
}
valid = false;
}
valid = false;
}
return (valid);
}
"--------------------------------------------------------------------------------";
private void
final ObjectName objectName,
final MBeanAttributeInfo a = attrInfos[i];
}
}
}
private boolean
final ObjectName objectName,
boolean valid = true;
final MBeanAttributeInfo[] infos =
valid = false;
} else {
}
}
}
return (valid);
}
private boolean
boolean valid = true;
try {
" returned NULL for an empty AttributeList");
valid = false;
" returned attributes for an empty AttributeList");
valid = false;
}
}
catch (Exception e) {
valid = false;
" threw an exception getting an empty attribute list");
}
try {
" returned NULL for a missing Attribute");
valid = false;
" returned attributes for a non-existent name");
valid = false;
}
}
catch (Exception e) {
valid = false;
" threw an exception when getAttributes() was called with a " +
"non-existent Attribute, exception class = " +
}
return (valid);
}
private boolean
final ObjectName objectName,
final AttributeList attrs,
final MBeanAttributeInfo[] attrInfos)
throws Exception {
boolean valid = true;
valid = false;
"declared in its MBeanInfo: " + name);
valid = false;
valid = false;
}
}
}
}
return (valid);
}
private boolean
final ObjectName objectName,
final MBeanAttributeInfo[] attrInfos)
throws Exception {
boolean valid = true;
// if we can fetch all the attributes, then the MBean is OK;
// try this first for efficiency
try {
//trace( objectName.getKeyProperty( "j2eeType" ) + ": " + attrNames.length );
valid = false;
// mismatch between claimed number of attributes and actual
" did not supply the " +
}
}
catch (Exception e) {
if (e instanceof NotSerializableException) {
} else {
valid = false;
}
// do them one-at-a time to see where failure occurs
warning(" during getAttributes(" +
" (but Attributes work when queried one-at-a-time).\nIt " +
getExceptionMsg(e));
}
}
}
}
} else {
valid = true;
}
valid = false;
}
valid = false;
}
return (valid);
}
void
throws Exception {
try {
}
catch (InstanceNotFoundException e) {
}
catch (Exception e) {
"() can't supply MBeanInfo: " + getExceptionMsg(e)
);
if (e instanceof IOException) {
throw (IOException) e;
}
}
}
void
throws Exception {
if (resultOfCall instanceof ObjectName) {
} else if (resultOfCall instanceof ObjectName[]) {
}
}
}
private boolean
final ObjectName objectName,
final MBeanOperationInfo[] operationInfos)
throws Exception {
boolean valid = true;
boolean opValid = false;
try {
}
catch (Exception e) {
": " + getExceptionMsg(e));
if (e instanceof IOException) {
throw ((IOException) e);
}
valid = false;
}
}
}
return (valid);
}
boolean
return (true);
}
private boolean
throws Exception {
boolean valid = true;
try {
}
catch (Exception e) {
valid = false;
" message = " + e.getMessage());
// abort--the connection has died
throw e;
}
valid = false;
}
if (mDoAttributes &&
valid = false;
}
if (mDoOperations &&
valid = false;
}
return (valid);
}
private void
throws Exception {
int failureCount = 0;
trace("Validating: ");
if (mDoInfo) {
trace("- MBeanInfo");
}
if (mDoAttributes) {
trace("- Attributes");
}
if (mDoOperations) {
trace("- Operations (getters)");
}
trace("");
if (!shouldTest(objectName)) {
continue;
}
if (!valid) {
++failureCount;
}
}
}
public void
throws Exception {
}
}