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);
OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
"name", "description", tabularType, true, true, false, data, null);
}
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);
OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
"name", "description", tabularType, true, true, false, null, null);
}
catch (OpenDataException e)
{
caught = true;
}
if (caught == true)
fail("Didn't expect OpenDataException for tabular type and null default value and legals");
caught = false;
try
{
ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
"name", "description", arrayType, true, true, false, null, new String[] { "hello", "goodbye" });
}
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);
OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
"name", "description", arrayType, true, true, false, null, new String[0]);
}
catch (OpenDataException e)
{
caught = true;
}
if (caught == true)
fail("Didn't expect OpenDataException for array type and no default value and empty legals");
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);
OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
"name", "description", tabularType, true, true, false, null, new TabularDataSupport[] { data });
}
catch (OpenDataException e)
{
caught = true;
}
if (caught == false)
fail("Expected OpenDataException for tabular type and legal values");
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);
OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
"name", "description", tabularType, true, true, false, null, new TabularDataSupport[0]);
}
catch (OpenDataException e)