Package org.jboss.metatype.api.types

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


    *
    * @throws Exception for any problem
    */
   public void testHashCode() throws Exception
   {
      TableMetaType tableType = initTableType();

      TableValueSupport data = new TableValueSupport(tableType);

      CompositeValue compData = initCompositeValue(data);
      CompositeValue compData2 = initCompositeValue2(data);
      CompositeValue compData3 = initCompositeValue4(data);

      data.putAll(new CompositeValue[] { compData, compData2, compData3 });

      int myHashCode = tableType.hashCode() + compData.hashCode() + compData2.hashCode() + compData3.hashCode();
      assertEquals("Wrong hash code generated", myHashCode, data.hashCode());
   }
View Full Code Here


    *
    * @throws Exception for any problem
    */
   public void testToString() throws Exception
   {
      TableMetaType tableType = initTableType();

      TableValueSupport data = new TableValueSupport(tableType);

      CompositeValue compData = initCompositeValue(data);
      CompositeValue compData2 = initCompositeValue2(data);
      CompositeValue compData3 = initCompositeValue4(data);

      data.putAll(new CompositeValue[] { compData, compData2, compData3 });

      String toString = data.toString();

      assertTrue("toString() should contain the tabular type", toString.indexOf(tableType.toString()) != -1);
      assertTrue("toString() should contain index=compositeValue for compData",
         toString.indexOf(Arrays.asList(data.calculateIndex(compData)) + "=" + compData) != -1);
      assertTrue("toString() should contain index=compositeValue for compData2",
         toString.indexOf(Arrays.asList(data.calculateIndex(compData2)) + "=" + compData2) != -1);
      assertTrue("toString() should contain index=compositeValue for compData3",
View Full Code Here

    *
    * @throws Exception for any problem
    */
   public void testSerialization() throws Exception
   {
      TableMetaType tableType = initTableType();

      TableValueSupport data = new TableValueSupport(tableType);

      CompositeValue compData = initCompositeValue(data);
      CompositeValue compData2 = initCompositeValue2(data);
View Full Code Here

    *
    * @throws Exception for any problem
    */
   public void testErrors() throws Exception
   {
      TableMetaType tableType = initTableType();

      CompositeValue compData = initCompositeValue(tableType.getRowType());
      CompositeValue compData2 = initCompositeValue2(initCompositeMetaType2());

      try
      {
         new TableValueSupport(null);
View Full Code Here

   protected TableMetaType initTableType()
   {
      CompositeMetaType rowType = initCompositeMetaType();

      String[] indexNames = new String[] { "name1", "name2" };
      TableMetaType tableType = new ImmutableTableMetaType("typeName", "description", rowType, indexNames);
      return tableType;
   }
View Full Code Here

   protected TableMetaType initTableType2()
   {
      CompositeMetaType rowType = initCompositeMetaType();

      String[] indexNames = new String[] { "name1", "name2" };
      TableMetaType tableType = new ImmutableTableMetaType("typeName2", "description", rowType, indexNames);
      return tableType;
   }
View Full Code Here

    *
    * @throws Exception for any problem
    */
   public void testTableMetaType() throws Exception
   {
      TableMetaType tableType = initTableMetaType();

      assertEquals(TableValue.class.getName(), tableType.getClassName());
      assertEquals("description", tableType.getDescription());
      assertEquals("typeName", tableType.getTypeName());
      assertTrue("Tabular type should not be an array", tableType.isArray() == false);
   }
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 testIndexNames() throws Exception
   {
      TableMetaType tableType = initTableMetaType();

      List<String> indexList = tableType.getIndexNames();
      assertTrue("wrong number of index names", indexList.size() == 2);
      assertTrue("index list should contain name1", indexList.contains("name1"));
      assertTrue("index list should contain name2", indexList.contains("name2"));
      Iterator<String> i = indexList.iterator();
      assertTrue("first index is name1", i.next().equals("name1"));
View Full Code Here

    *
    * @throws Exception for any problem
    */
   public void testEquals() throws Exception
   {
      TableMetaType tableType = initTableMetaType();

      assertNotSame("null is not equal to table type", tableType, null);
      assertNotSame("object is not a equal to table type", tableType, new Object());

      TableMetaType tableType2 = initTableMetaType();
      assertEquals("Should be equal, even though the table type is a different instance", tableType, tableType2);
      assertEquals("Should be equal, even though the table type is a different instance", tableType2, tableType);

      tableType2 = initTableMetaTypeDifferentTypeName();
      assertNotSame("should not be equal, they have different type names", tableType, tableType2);
View Full Code Here

TOP

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

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.