Package org.apache.torque.test.dbobject

Examples of org.apache.torque.test.dbobject.TypesPrimitive


        // "ODouble"
        assertTrue(eMsg + OBJECT_COLUMN_NAMES[iValue],
                OBJECT_TEST_VALUES[iValue++].equals(((TypesObject) objectTypes)
                        .getODouble()));
        // Test Primitive Types
        ColumnAccessByName primitiveTypes = new TypesPrimitive();
        try
        {
            for (int i = 0; i < PRIMITIVE_COLUMN_NAMES.length; i++)
            {
                boolean status = primitiveTypes.setByName(
                        PRIMITIVE_COLUMN_NAMES[i], PRIMITIVE_TEST_VALUES[i]);
                assertTrue("setByName returned false setting column "
                        + PRIMITIVE_COLUMN_NAMES[i], status);
            }
        }
View Full Code Here


            assertTrue(eMsg + OBJECT_COLUMN_NAMES[i], OBJECT_TEST_VALUES[i]
                    .equals(objectTypes.getByName(OBJECT_COLUMN_NAMES[i])));
        }

        // Test Primative Types
        ColumnAccessByName primitiveTypes = new TypesPrimitive();
        try
        {
            for (int i = 0; i < PRIMITIVE_COLUMN_NAMES.length; i++)
            {
                primitiveTypes.setByName(PRIMITIVE_COLUMN_NAMES[i],
                        PRIMITIVE_TEST_VALUES[i]);
            }
        }
        catch (TorqueException e)
        {
            fail("Exception caught trying to call TypesObject.setByName() "
                 + "method!\nWas OM generated with torque.addGetByNameMethod "
                 + "property = true?\nError message was: '" + e.getMessage()
                 + "'");
        }
        for (int i = 0; i < PRIMITIVE_COLUMN_NAMES.length; i++)
        {
            assertTrue(eMsg + PRIMITIVE_COLUMN_NAMES[i],
                  PRIMITIVE_TEST_VALUES[i].equals(
                  primitiveTypes.getByName(PRIMITIVE_COLUMN_NAMES[i])));
        }
    }
View Full Code Here

            assertTrue(eMsg + OBJECT_COLUMN_NAMES[i], OBJECT_TEST_VALUES[i]
                    .equals(objectTypes.getByName(OBJECT_COLUMN_NAMES[i])));
        }

        // Test Primitive Types
        ColumnAccessByName primitiveTypes = new TypesPrimitive();
        try
        {
            for (int i = 0; i < PRIMITIVE_PEER_NAMES.length; i++)
            {
                boolean status = primitiveTypes.setByPeerName(
                        PRIMITIVE_PEER_NAMES[i].getSqlExpression(),
                        OBJECT_TEST_VALUES[i]);
                assertTrue("setByPeerName returned false setting column "
                        + PRIMITIVE_PEER_NAMES[i], status);
            }
        }
        catch (TorqueException e)
        {
            fail("Exception caught trying to call TypesObject.setByName() "
                 + "method!\nWas OM generated with torque.addGetByNameMethod "
                 + "property = true?\nError message was: '" + e.getMessage()
                 + "'");
        }
        for (int i = 0; i < PRIMITIVE_COLUMN_NAMES.length; i++)
        {
            assertTrue(eMsg + PRIMITIVE_COLUMN_NAMES[i],
                           PRIMITIVE_TEST_VALUES[i].equals(
                           primitiveTypes.getByName(PRIMITIVE_COLUMN_NAMES[i])));
        }
    }
View Full Code Here

            assertTrue(eMsg + OBJECT_COLUMN_NAMES[i], OBJECT_TEST_VALUES[i]
                    .equals(objectTypes.getByName(OBJECT_COLUMN_NAMES[i])));
        }

        // Test Primitive Types
        ColumnAccessByName primitiveTypes = new TypesPrimitive();
        try
        {
            for (int i = 0; i < PRIMITIVE_PEER_NAMES.length; i++)
            {
                boolean status = primitiveTypes.setByPosition(i + 1,
                        OBJECT_TEST_VALUES[i]);
                assertTrue("primitiveTypes.setByPosition(int, Object) returned "
                                + "false setting position " + (i + 1), status);
            }
        }
        catch (TorqueException e)
        {
            fail("Exception caught trying to call TypesPrimitive.setByName() "
                 + "method!\nWas OM generated with torque.addGetByNameMethod "
                 + "property = true?\nError message was: '" + e.getMessage()
                 + "'");
        }
        for (int i = 0; i < PRIMITIVE_COLUMN_NAMES.length; i++)
        {
            assertTrue(eMsg + PRIMITIVE_COLUMN_NAMES[i],
                  PRIMITIVE_TEST_VALUES[i].equals(
                  primitiveTypes.getByName(PRIMITIVE_COLUMN_NAMES[i])));
        }

    }
View Full Code Here

     * Object type of the value is not correct.
     */
    public void testInvalidObjectErrors() throws Exception
    {
        ColumnAccessByName objectTypes = new TypesObject();
        ColumnAccessByName primitiveTypes = new TypesPrimitive();
        // Test catching invalid object types
        boolean error = false;
        try
        {
            objectTypes.setByName("OBit", new Integer(1));
        }
        catch (IllegalArgumentException e)
        {
            error = true;
        }
        assertTrue(
                "setByName for OBit column did not catch illegal object type!",
                error);

        error = false;
        try
        {
            primitiveTypes.setByName("PBit", new Integer(99));
        }
        catch (IllegalArgumentException e)
        {
            error = true;
        }
View Full Code Here

     *  Verify that null handling (can't use them for primitives) works.
     */
    public void testNullHandling() throws Exception
    {
        ColumnAccessByName objectTypes = new TypesObject();
        ColumnAccessByName primitiveTypes = new TypesPrimitive();
        // Object type fields should allow nulls
        boolean error = false;
        try
        {
            objectTypes.setByName("OBit", null);
        }
        catch (IllegalArgumentException e)
        {
            error = true;
        }
        assertFalse("objectTypes.setByName(\"OBit\",null) did not allow "
                        "a null value!", error);

    // Primitive types should not allow null values
        error = false;
        try
        {
            primitiveTypes.setByName("PBit", null);
        }
        catch (IllegalArgumentException e)
        {
            error = true;
        }
View Full Code Here

TOP

Related Classes of org.apache.torque.test.dbobject.TypesPrimitive

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.