Package org.jboss.metatype.api.types

Examples of org.jboss.metatype.api.types.ImmutableCompositeMetaType


   public void testIsValueComposite() throws Exception
   {
      String[] itemNames = new String[] { "name1", "name2" };
      String[] itemDescriptions = new String[] { "desc1", "desc2" };
      MetaType[] itemTypes = new MetaType[] { SimpleMetaType.STRING, SimpleMetaType.INTEGER };
      CompositeMetaType compositeType = new ImmutableCompositeMetaType("typeName", "description", itemNames, itemDescriptions, itemTypes);
      MockCompositeValue cv = new MockCompositeValue(compositeType);
      MockCompositeValue[][] compData1 = new MockCompositeValue[][]
      {
         { cv, null }, { cv, cv }
      };

      ArrayMetaType compArrayType1 = new ArrayMetaType(2, compositeType);
      assertTrue("compData1 should be a value of array type", compArrayType1.isValue(compData1));

      ArrayMetaType compArrayType2 = new ArrayMetaType(1, compositeType);
      assertFalse("compData1 should not be a value of array type, wrong dimension", compArrayType2.isValue(compData1));

      CompositeMetaType compositeType2 = new ImmutableCompositeMetaType("typeName2", "description", itemNames, itemDescriptions, itemTypes);
      ArrayMetaType compArrayType3 = new ArrayMetaType(2, compositeType2);
      assertFalse("compData1 should not be a value of array type, wrong element type", compArrayType3.isValue(compData1));
   }
View Full Code Here


   public void testIsValueTable() throws Exception
   {
      String[] itemNames = new String[] { "name1", "name2" };
      String[] itemDescriptions = new String[] { "desc1", "desc2" };
      MetaType[] itemTypes = new MetaType[] { SimpleMetaType.STRING, SimpleMetaType.INTEGER };
      CompositeMetaType compositeType = new ImmutableCompositeMetaType("typeName", "description", itemNames, itemDescriptions, itemTypes);
      TableMetaType tableType = new ImmutableTableMetaType("typeName", "description", compositeType, new String[] { "name1" });
      TableValue tv = new MockTableValue(tableType);
      TableValue[][] tabData1 = new TableValue[][]
      {
         { tv, null }, { tv, tv }
View Full Code Here

     
      CompositeMetaType keyType = (CompositeMetaType) resolve(StringKey.class);
      MetaType valueType = resolve(Integer.class);
      MetaType[] itemTypes = { keyType, valueType };
      String entryName = Map.Entry.class.getName();
      CompositeMetaType entryType = new ImmutableCompositeMetaType(entryName, entryName, DefaultMetaTypeFactory.MAP_ITEM_NAMES, DefaultMetaTypeFactory.MAP_ITEM_NAMES, itemTypes);
      TableMetaType tableType = new ImmutableTableMetaType(Map.class.getName(), Map.class.getName(), entryType, DefaultMetaTypeFactory.MAP_INDEX_NAMES);
     
      TableValue expected = new TableValueSupport(tableType);
      String[] itemNames = DefaultMetaTypeFactory.MAP_ITEM_NAMES;
     
View Full Code Here

     
      MetaType keyType = resolve(TestSimpleComposite.class);
      MetaType valueType = resolve(Integer.class);
      MetaType[] itemTypes = { keyType, valueType };
      String entryName = Map.Entry.class.getName();
      CompositeMetaType entryType = new ImmutableCompositeMetaType(entryName, entryName, DefaultMetaTypeFactory.MAP_ITEM_NAMES, DefaultMetaTypeFactory.MAP_ITEM_NAMES, itemTypes);
      TableMetaType tableType = new ImmutableTableMetaType(Map.class.getName(), Map.class.getName(), entryType, DefaultMetaTypeFactory.MAP_INDEX_NAMES);
     
      TableValue expected = new TableValueSupport(tableType);
      String[] itemNames = DefaultMetaTypeFactory.MAP_ITEM_NAMES;
     
View Full Code Here

     
      CompositeMetaType keyType = (CompositeMetaType) resolve(StringKey.class);
      MetaType valueType = resolve(TestSimpleComposite.class);
      MetaType[] itemTypes = { keyType, valueType };
      String entryName = Map.Entry.class.getName();
      CompositeMetaType entryType = new ImmutableCompositeMetaType(entryName, entryName, DefaultMetaTypeFactory.MAP_ITEM_NAMES, DefaultMetaTypeFactory.MAP_ITEM_NAMES, itemTypes);
      TableMetaType tableType = new ImmutableTableMetaType(Map.class.getName(), Map.class.getName(), entryType, DefaultMetaTypeFactory.MAP_INDEX_NAMES);
     
      TableValue expected = new TableValueSupport(tableType);
      String[] itemNames = DefaultMetaTypeFactory.MAP_ITEM_NAMES;
     
View Full Code Here

      String[] itemDescriptions = new String[] { "desc1", "desc2" };
      MetaType[] itemTypes = new MetaType[] { SimpleMetaType.STRING, SimpleMetaType.INTEGER };

      try
      {
         new ImmutableCompositeMetaType(null, "description", itemNames, itemDescriptions, itemTypes);
         fail("Excepted IllegalArgumentException for null typeName");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      try
      {
         new ImmutableCompositeMetaType("", "description", itemNames, itemDescriptions, itemTypes);
         fail("Excepted IllegalArgumentException for empty typeName");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      try
      {
         new ImmutableCompositeMetaType("typeName", null, itemNames, itemDescriptions, itemTypes);
         fail("Excepted IllegalArgumentException for null description");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      try
      {
         new ImmutableCompositeMetaType("typeName", "", itemNames, itemDescriptions, itemTypes);
         fail("Excepted IllegalArgumentException for empty description");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      try
      {
         new ImmutableCompositeMetaType("typeName", "description", null, itemDescriptions, itemTypes);
         fail("Excepted IllegalArgumentException for null item names");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      try
      {
         new ImmutableCompositeMetaType("typeName", "description", itemNames, null, itemTypes);
         fail("Excepted IllegalArgumentException for null item descriptions");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      try
      {
         new ImmutableCompositeMetaType("typeName", "description", itemNames, itemDescriptions, null);
         fail("Excepted IllegalArgumentException for null item types");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }

      String[] nullItemNames = new String[] { "name1", null };
      try
      {
         new ImmutableCompositeMetaType("typeName", "description", nullItemNames, itemDescriptions, itemTypes);
         fail("Excepted IllegalArgumentException for null element of item names");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      String[] nullItemDescriptions = new String[] { "desc1", null };
      try
      {
         new ImmutableCompositeMetaType("typeName", "description", itemNames, nullItemDescriptions, itemTypes);
         fail("Excepted IllegalArgumentException for null element of item descriptions");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      MetaType[] nullItemTypes = new MetaType[] { SimpleMetaType.STRING, null };
      try
      {
         new ImmutableCompositeMetaType("typeName", "description", itemNames, itemDescriptions, nullItemTypes);
         fail("Excepted IllegalArgumentException for null element of item types");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      String[] wrongItemNames = new String[] { "name1" };
      try
      {
         new ImmutableCompositeMetaType("typeName", "description", wrongItemNames, itemDescriptions, itemTypes);
         fail("Excepted IllegalArgumentException for wrong number of elements for item names");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      String[] wrongItemDescriptions = new String[] { "desc1"};
      try
      {
         new ImmutableCompositeMetaType("typeName", "description", itemNames, wrongItemDescriptions, itemTypes);
         fail("Excepted IllegalArgumentException for wrong number of elements for item descriptions");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      MetaType[] wrongItemTypes = new MetaType[] { SimpleMetaType.STRING };
      try
      {
         new ImmutableCompositeMetaType("typeName", "description", itemNames, itemDescriptions, wrongItemTypes);
         fail("Excepted IllegalArgumentException for wrong number of elements for item types");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }
     
      String[] duplicateItemNames = new String[] { "desc1", "desc1" };
      try
      {
         new ImmutableCompositeMetaType("typeName", "description", duplicateItemNames, itemDescriptions, itemTypes);
         fail("Excepted OpenDataException for duplicate item names");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }

      duplicateItemNames = new String[] { "desc1", " desc1 " };
      try
      {
         new ImmutableCompositeMetaType("typeName", "description", duplicateItemNames, itemDescriptions, itemTypes);
         fail("Excepted OpenDataException for duplicate item names");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
View Full Code Here

   protected CompositeMetaType initCompositeMetaType()
   {
      String[] itemNames = new String[] { "name1", "name2" };
      String[] itemDescriptions = new String[] { "desc1", "desc2" };
      MetaType[] itemTypes = new MetaType[] { SimpleMetaType.STRING, SimpleMetaType.INTEGER };
      CompositeMetaType compositeType = new ImmutableCompositeMetaType("typeName", "description", itemNames, itemDescriptions, itemTypes);
      return compositeType;
   }
View Full Code Here

   protected CompositeMetaType initCompositeMetaTypeDifferentItemTypes()
   {
      String[] itemNames = new String[] { "name1", "name2" };
      String[] itemDescriptions = new String[] { "desc1", "desc2" };
      MetaType[] itemTypes = new MetaType[] { SimpleMetaType.STRING, SimpleMetaType.LONG };
      CompositeMetaType compositeType = new ImmutableCompositeMetaType("typeName", "description", itemNames, itemDescriptions, itemTypes);
      return compositeType;
   }
View Full Code Here

   protected CompositeMetaType initCompositeMetaTypeDifferentTypeName()
   {
      String[] itemNames = new String[] { "name1", "name2" };
      String[] itemDescriptions = new String[] { "desc1", "desc2" };
      MetaType[] itemTypes = new MetaType[] { SimpleMetaType.STRING, SimpleMetaType.INTEGER };
      CompositeMetaType compositeType = new ImmutableCompositeMetaType("typeName2", "description", itemNames, itemDescriptions, itemTypes);
      return compositeType;
   }
View Full Code Here

   protected CompositeMetaType initCompositeMetaTypeDifferentItemNames()
   {
      String[] itemNames = new String[] { "nameX", "name2" };
      String[] itemDescriptions = new String[] { "desc1", "desc2" };
      MetaType[] itemTypes = new MetaType[] { SimpleMetaType.STRING, SimpleMetaType.INTEGER };
      CompositeMetaType compositeType = new ImmutableCompositeMetaType("typeName", "description", itemNames, itemDescriptions, itemTypes);
      return compositeType;
   }
View Full Code Here

TOP

Related Classes of org.jboss.metatype.api.types.ImmutableCompositeMetaType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.