Package org.jboss.metatype.api.types

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


    *
    * @throws Exception for any problem
    */
   public void testHashCode() throws Exception
   {
      CompositeMetaType compositeMetaType = initCompositeMetaType();
      Map<String, MetaValue> map = initMapValues();
      CompositeValue v = new CompositeValueSupport(compositeMetaType, map);

      int myHashCode = compositeMetaType.hashCode() + "value1".hashCode() + new Integer(2).hashCode();
      assertEquals("Wrong hash code generated", myHashCode, v.hashCode());
   }
View Full Code Here


    *
    * @throws Exception for any problem
    */
   public void testToString() throws Exception
   {
      CompositeMetaType compositeMetaType = initCompositeMetaType();
      Map<String, MetaValue> map = initMapValues();
      CompositeValue v = new CompositeValueSupport(compositeMetaType, map);

      String toString = v.toString();

      assertTrue("toString() should contain the composite type", toString.indexOf(compositeMetaType.toString()) != -1);
      assertTrue("toString() should contain name1", toString.indexOf("name1") != -1);
      assertTrue("toString() should contain value1", toString.indexOf("value1") != -1);
      assertTrue("toString() should contain name2=", toString.indexOf("name2") != -1);
      assertTrue(toString + " should contain " + new Integer(2), toString.indexOf(new Integer(2).toString()) != -1);
   }
View Full Code Here

    *
    * @throws Exception for any problem
    */
   public void testSerialization() throws Exception
   {
      CompositeMetaType compositeMetaType = initCompositeMetaType();
      Map<String, MetaValue> map = initMapValues();
      CompositeValue v = new CompositeValueSupport(compositeMetaType, map);
      byte[] bytes = serialize(v);
      Object result = deserialize(bytes);
      assertEquals(v, result);
View Full Code Here

    *
    * @throws Exception for any problem
    */
   public void testErrorsArray() throws Exception
   {
      CompositeMetaType compositeMetaType = initCompositeMetaType();
      String[] itemNames = initKeys();
      MetaValue[] itemValues = initValues();

      try
      {
View Full Code Here

    *
    * @throws Exception for any problem
    */
   public void testErrorsMap() throws Exception
   {
      CompositeMetaType compositeMetaType = initCompositeMetaType();
      Map<String, MetaValue> map = initMapValues();

      try
      {
         new CompositeValueSupport(null, map);
View Full Code Here

    *
    * @throws Exception for any problem
    */
   public void testErrors() throws Exception
   {
      CompositeMetaType compositeMetaType = initCompositeMetaType();
      Map<String, MetaValue> map = initMapValues();
      CompositeValue data = new CompositeValueSupport(compositeMetaType, map);

      try
      {
View Full Code Here

   {
      TestSimpleComposite hello = new TestSimpleComposite("Hello");
      TestSimpleComposite goodbye = new TestSimpleComposite("Goodbye");
      TestSimpleComposite[] array = { hello, goodbye };
      ArrayMetaType arrayType = assertInstanceOf(resolve(array.getClass()), ArrayMetaType.class);
      CompositeMetaType compositeType = assertInstanceOf(resolve(TestSimpleComposite.class), CompositeMetaType.class);
      String[] itemNames = { "something" };
      MetaValue[] itemValues = { SimpleValueSupport.wrap("Hello") };
      CompositeValue helloValue = new CompositeValueSupport(compositeType, itemNames, itemValues);
      itemValues = new MetaValue[] { SimpleValueSupport.wrap("Goodbye") };
      CompositeValue goodbyeValue = new CompositeValueSupport(compositeType, itemNames, itemValues);
View Full Code Here

   {
      Method method = getClass().getMethod("simpleMap", (Class[]) null);
      Type collectionType = method.getGenericReturnType();
      Map<StringKey, Integer> map = simpleMap();
     
      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

   {
      Method method = getClass().getMethod("compositeValueMap", (Class[]) null);
      Type collectionType = method.getGenericReturnType();
      Map<StringKey, TestSimpleComposite> map = compositeValueMap();
     
      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

TOP

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

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.