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 compositeType = initCompositeMetaType();

      int myHashCode = "typeName".hashCode();
      myHashCode += SimpleMetaType.STRING.hashCode();
      myHashCode += SimpleMetaType.INTEGER.hashCode();
      myHashCode += "name1".hashCode();
      myHashCode += "name2".hashCode();
      assertTrue("Wrong hash code generated", myHashCode == compositeType.hashCode());
   }
View Full Code Here


    *
    * @throws Exception for any problem
    */
   public void testToString() throws Exception
   {
      CompositeMetaType compositeType = initCompositeMetaType();

      String toString = compositeType.toString();

      assertTrue("toString() should contain the composite type class name", toString.indexOf(compositeType.getClass().getSimpleName()) != -1);
      assertTrue("toString() should contain the item name name1", toString.indexOf("name1") != -1);
      assertTrue("toString() should contain the item name name2", toString.indexOf("name2") != -1);
      assertTrue("toString() should contain " + SimpleMetaType.STRING.getTypeName(), toString.indexOf(SimpleMetaType.STRING.getTypeName()) != -1);
      assertTrue("toString() should contain " + SimpleMetaType.INTEGER.getTypeName(), toString.indexOf(SimpleMetaType.INTEGER.getTypeName()) != -1);
   }
View Full Code Here

    *
    * @throws Exception for any problem
    */
   public void testSerialization() throws Exception
   {
      CompositeMetaType compositeType = initCompositeMetaType();
      byte[] bytes = serialize(compositeType);
      Object result = deserialize(bytes);
      assertEquals(compositeType, result);
   }
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

    *
    * @throws Exception for any problem
    */
   public void testGetRowType() throws Exception
   {
      CompositeMetaType rowType = initRowType();
      TableMetaType tableType = initTableMetaType();

      assertEquals(rowType, tableType.getRowType());
   }
View Full Code Here

    *
    * @throws Exception for any problem
    */
   public void testHashCode() throws Exception
   {
      CompositeMetaType rowType = initRowType();
      TableMetaType tableType = initTableMetaType();

      int myHashCode = "typeName".hashCode() + rowType.hashCode() + "name1".hashCode() + "name2".hashCode();
      assertTrue("Wrong hash code generated", myHashCode == tableType.hashCode());
   }
View Full Code Here

    *
    * @throws Exception for any problem
    */
   public void testToString() throws Exception
   {
      CompositeMetaType rowType = initRowType();
      TableMetaType tableType = initTableMetaType();

      String toString = tableType.toString();

      assertTrue("toString() should contain the tabular type class name", toString.indexOf(TableMetaType.class.getSimpleName()) != -1);
      assertTrue("toString() should contain the type name", toString.indexOf("typeName") != -1);
      assertTrue("toString() should contain the row type " + rowType, toString.indexOf(rowType.toString()) != -1);
      assertTrue("toString() should contain the index name1", toString.indexOf("name1") != -1);
      assertTrue("toString() should contain the index name2", toString.indexOf("name2") != -1);
   }
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.