/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/**
* every Serializable class in the Java DTrace API by creating a dummy
* instance, writing it to a file, then reading it back in and comparing
* the string values of the object before and after, as well as
* verifying object equality before and after if the class overrides the
* equals() method.
*/
public class TestBean {
"ExitRecord",
"AggregationRecord",
"Aggregation",
"Tuple",
"ScalarRecord",
"KernelStackRecord",
"LogDistribution",
"LinearDistribution",
"LogLinearDistribution",
"Option",
"ProcessState",
"ProbeDescription",
"PrintaRecord",
"PrintfRecord",
"ProbeData",
"Aggregate",
"UserStackRecord",
"AvgValue",
"CountValue",
"SumValue",
"MinValue",
"MaxValue",
"Error",
"Drop",
"InterfaceAttributes",
"ProgramInfo",
"ProbeInfo",
"Probe",
"Flow",
"KernelSymbolRecord",
"UserSymbolRecord",
"UserSymbolRecord$Value",
"Program",
"Program$File",
"StddevValue"
};
static void
{
}
public static XMLEncoder
{
try {
(new FileOutputStream(file));
} catch (Exception e) {
e.printStackTrace();
exit(1);
}
return encoder;
}
public static XMLDecoder
{
}
public static XMLDecoder
{
try {
(new FileInputStream(file));
} catch (Exception e) {
e.printStackTrace();
exit(1);
}
return decoder;
}
public static ExitRecord
{
return r;
}
public static AggregationRecord
{
return r;
}
public static Aggregation
{
new ArrayList < AggregationRecord > ();
r = getAggregationRecord();
(byte)3}, 3);
return a;
}
public static Tuple
getTuple()
{
new StackFrame[] {
new StackFrame("has"),
new StackFrame("nine"),
new StackFrame("lives")},
new byte[] { (byte)0, (byte)1, (byte)2 });
(byte)3}, 3);
return tuple;
}
public static ScalarRecord
{
return r;
}
public static KernelStackRecord
{
new StackFrame("Frame 1"),
new StackFrame("Frame 2"),
new StackFrame("Frame 3")
};
new byte[] { (byte)0, (byte)1, (byte)2 });
return r;
}
public static LogDistribution
{
int n = 0;
long base = 0;
long i;
long sign;
long nextSign;
long power;
long nextPower;
long lowerBound;
long upperBound;
for (i = -62; i <= 62; ++i) {
if (i == 0) {
continue;
}
}
}
return d;
}
public static LinearDistribution
{
int n = 10; // number of buckets
int base = 1;
int step = 10;
((i - 1) / step));
}
return d;
}
public static LogLinearDistribution
{
long low = 0;
long high = 6;
long factor = 2;
long nsteps = 2;
int value = 1;
int order;
continue;
order++;
}
return d;
}
public static Option
{
return option;
}
public static ProcessState
{
3, "SIGSTOP",
-2, "Process stopped on dime");
return p;
}
public static ProbeDescription
{
"malloc", "entry");
return d;
}
public static PrintaRecord
{
Aggregation a = getAggregation();
aggregations.add(a);
aggregations.add(a);
}
}
"Yes, this is the formatted printa() output");
return r;
}
public static PrintfRecord
{
"long formatted string");
return r;
}
public static ProbeData
{
return d;
}
public static Aggregate
{
new ArrayList < AggregationRecord > ();
return a;
}
public static UserStackRecord
{
new StackFrame("User Stack Frame 1"),
new StackFrame("User Stack Frame 2"),
new StackFrame("User Stack Frame 3")
};
new byte[] { (byte)0, (byte)1, (byte)2 });
return r;
}
public static AvgValue
{
return v;
}
public static CountValue
{
return v;
}
public static MinValue
{
return v;
}
public static MaxValue
{
return v;
}
public static SumValue
{
return v;
}
getError()
{
1, 20, "DTRACEFLT_BADALIGN", -1, "error on enabled probe ID 8 " +
"(0x33ef) in action #1 at DIF offset 20");
return e;
}
public static Drop
getDrop()
{
"Guess we dropped stuff all over the place.");
return drop;
}
public static InterfaceAttributes
{
InterfaceAttributes a = new InterfaceAttributes(
return a;
}
public static ProgramInfo
{
getInterfaceAttributes(), 256);
return info;
}
public static ProbeInfo
{
return info;
}
public static Probe
getProbe()
{
return p;
}
public static Flow
getFlow()
{
return f;
}
public static KernelSymbolRecord
{
return r;
}
public static UserSymbolRecord
{
return r;
}
public static UserSymbolRecord.Value
{
return v;
}
public static Program
{
Program p;
try {
} catch (DTraceException e) {
e.printStackTrace();
p = null;
}
return p;
}
{
Program p;
try {
} catch (Exception e) {
e.printStackTrace();
p = null;
}
}
public static StddevValue
{
return v;
}
@SuppressWarnings("unchecked")
static String
{
String s;
if (o instanceof ScalarRecord) {
o = ((ScalarRecord)o).getValue();
}
if (o instanceof byte[]) {
} else if (o instanceof Object[]) {
} else {
try {
} catch (Exception e) {
s = o.toString();
}
}
return s;
}
static void
{
// If the class overrides equals(), make sure the re-created
// object still equals the original object
try {
Object.class);
if (ret != true) {
exit(1);
}
} catch (Exception e) {
// Does not override equals(), although a super-class might.
// A better test would check for any superclass other than
// Object.class.
}
}
static void
throws IOException, ClassNotFoundException
{
try {
} catch (Exception e) {
e.printStackTrace();
exit(1);
}
exit(1);
}
}
static void
{
try {
} catch (Exception e) {
e.printStackTrace();
exit(1);
}
return;
}
exit(1);
}
}
public static void
{
"[ < classname > ]");
exit(1);
}
}
try {
try {
} catch (Exception e) {
exit(1);
}
}
} catch (SecurityException e) {
exit(1);
}
try {
}
} catch (IOException e) {
e.printStackTrace();
exit(1);
} catch (ClassNotFoundException e) {
e.printStackTrace();
exit(1);
}
}
}