throws Exception
{
String[] itemNames = new String[] { "name1", "name2" };
String[] itemDescriptions = new String[] { "desc1", "desc2" };
OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
CompositeType compositeType = new CompositeType("typeName", "description",
itemNames, itemDescriptions, itemTypes);
assertTrue("null is not a value of composite type", compositeType.isValue(null) == false);
assertTrue("object is not a value of composite type", compositeType.isValue(new Object()) == false);
Object[] itemValues = new Object[] { "string", new Integer(2) };
CompositeDataSupport data = new CompositeDataSupport(compositeType, itemNames, itemValues);
assertTrue("data should be a value of composite type", compositeType.isValue(data));
CompositeType compositeType2 = new CompositeType("typeName", "description",
itemNames, itemDescriptions, itemTypes);
data = new CompositeDataSupport(compositeType2, itemNames, itemValues);
assertTrue("data should be a value of composite type, even though not the object instance",
compositeType.isValue(data));
OpenType[] itemTypes2 = new OpenType[] { SimpleType.STRING, SimpleType.LONG };
compositeType2 = new CompositeType("typeName", "description",
itemNames, itemDescriptions, itemTypes2);
Object[] itemValues2 = new Object[] { "string", new Long(2) };
data = new CompositeDataSupport(compositeType2, itemNames, itemValues2);
assertTrue("data should not be a value of composite type, it has different types",
compositeType.isValue(data) == false);
compositeType2 = new CompositeType("typeName2", "description",
itemNames, itemDescriptions, itemTypes);
data = new CompositeDataSupport(compositeType2, itemNames, itemValues);
assertTrue("data should not be a value of composite type, it has a different type name",
compositeType.isValue(data) == false);
String[] itemNames2 = new String[] { "nameX", "name2" };
compositeType2 = new CompositeType("typeName", "description",
itemNames2, itemDescriptions, itemTypes);
data = new CompositeDataSupport(compositeType2, itemNames2, itemValues);
assertTrue("data should not be a value of composite type, it has different item names",
compositeType.isValue(data) == false);
}