throws Exception
{
boolean caught = false;
try
{
new OpenMBeanParameterInfoSupport(
null, "description", SimpleType.INTEGER, new Integer(3));
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Expected IllegalArgumentException for null name");
caught = false;
try
{
new OpenMBeanParameterInfoSupport(
"", "description", SimpleType.INTEGER, new Integer(3));
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Expected IllegalArgumentException for an empty name");
caught = false;
try
{
new OpenMBeanParameterInfoSupport(
"name", null, SimpleType.INTEGER, new Integer(3));
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Expected IllegalArgumentException for null description");
caught = false;
try
{
new OpenMBeanParameterInfoSupport(
"name", "", SimpleType.INTEGER, new Integer(3));
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Expected IllegalArgumentException for an empty description");
caught = false;
try
{
new OpenMBeanParameterInfoSupport(
"", "description", SimpleType.INTEGER, new Integer(3));
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Expected IllegalArgumentException for an empty name");
caught = false;
try
{
new OpenMBeanParameterInfoSupport(
"name", "description", null, new Integer(3));
}
catch (IllegalArgumentException e)
{
caught = true;
}
if (caught == false)
fail("Expected IllegalArgumentException for null simple type");
caught = false;
try
{
ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
new OpenMBeanParameterInfoSupport(
"name", "description", arrayType, new String[0]);
}
catch (OpenDataException e)
{
caught = true;
}
if (caught == false)
fail("Expected OpenDataException for array type and default value");
caught = false;
try
{
ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
new OpenMBeanParameterInfoSupport(
"name", "description", arrayType, (String[]) null);
}
catch (OpenDataException e)
{
caught = true;
}
if (caught == true)
fail("Didn't execpt OpenDataException for array type and no default value");
caught = false;
try
{
String[] itemNames = new String[] { "name1", "name2" };
String[] itemDescriptions = new String[] { "desc1", "desc2" };
OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
itemNames, itemDescriptions, itemTypes);
String[] indexNames = new String[] { "name1", "name2" };
TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);
TabularDataSupport data = new TabularDataSupport(tabularType);
new OpenMBeanParameterInfoSupport(
"name", "description", tabularType, data);
}
catch (OpenDataException e)
{
caught = true;
}
if (caught == false)
fail("Expected OpenDataException for tabular type and default value");
caught = false;
try
{
String[] itemNames = new String[] { "name1", "name2" };
String[] itemDescriptions = new String[] { "desc1", "desc2" };
OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
itemNames, itemDescriptions, itemTypes);
String[] indexNames = new String[] { "name1", "name2" };
TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);
new OpenMBeanParameterInfoSupport(
"name", "description", tabularType, (TabularData) null);
}
catch (OpenDataException e)
{
caught = true;