Package org.apache.isis.runtimes.dflt.objectstores.sql.testsystem.dataclasses

Examples of org.apache.isis.runtimes.dflt.objectstores.sql.testsystem.dataclasses.SqlDataClass


    public List<SqlDataClass> allDataClasses() {
        return allInstances(SqlDataClass.class);
    }

    public SqlDataClass newDataClass() {
        final SqlDataClass object = newTransientInstance(SqlDataClass.class);
        return object;
    }
View Full Code Here


        for (final String tableName : getTableNames()) {
            SqlIntegrationTestSingleton.drop(tableName);
        }

        final SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
        final SqlDataClass sqlDataClass = factory.newDataClass();
        sqlDataClass.setString("Test String");
        sqlDataClass.setDate(applibDate);
        sqlDataClass.setSqlDate(sqlDate);
        sqlDataClass.setMoney(money);
        sqlDataClass.setDateTime(dateTime);
        sqlDataClass.setTimeStamp(timeStamp);
        sqlDataClass.setTime(time);
        sqlDataClass.setColor(color);
        sqlDataClass.setImage(image);
        sqlDataClass.setPassword(password);
        sqlDataClass.setPercentage(percentage);

        // Setup SimpleClassTwo
        simpleClassTwoA = factory.newSimpleClassTwo();
        simpleClassTwoA.setText("A");
        simpleClassTwoA.setIntValue(999);
        simpleClassTwoA.setBooleanValue(true);

        simpleClassTwoB = factory.newSimpleClassTwo();
        simpleClassTwoB.setText("B");

        sqlDataClass.setSimpleClassTwo(simpleClassTwoA);

        // NumericClasses
        // standard min types
        numericTestClassMin = factory.newNumericTestClass();
        LOG.log(Level.INFO, "Bits to represent Double: " + Double.SIZE);
        numericTestClassMin.setIntValue(intMinValue);
        numericTestClassMin.setShortValue(shortMinValue);
        numericTestClassMin.setLongValue(longMinValue);
        numericTestClassMin.setDoubleValue(doubleMinValue);
        numericTestClassMin.setFloatValue(floatMinValue);

        sqlDataClass.setNumericTestClassMin(numericTestClassMin);

        // standard max types
        numericTestClassMax = factory.newNumericTestClass();
        numericTestClassMax.setIntValue(intMaxValue);
        numericTestClassMax.setShortValue(shortMaxValue);
        numericTestClassMax.setLongValue(longMaxValue);
        numericTestClassMax.setDoubleValue(doubleMaxValue);
        numericTestClassMax.setFloatValue(floatMaxValue);

        sqlDataClass.setNumericTestClassMax(numericTestClassMax);

        // Initialise collection1
        boolean bMustAdd = false;
        if (simpleClassList1.size() == 0) {
            bMustAdd = true;
        }
        for (final String string : SqlIntegrationTestCommon.stringList1) {
            final SimpleClass simpleClass = factory.newSimpleClass();
            simpleClass.setString(string);
            simpleClass.setSimpleClassTwoA(simpleClassTwoA);
            sqlDataClass.addToSimpleClasses1(simpleClass);
            if (bMustAdd) {
                simpleClassList1.add(simpleClass);
            }
        }

        // Initialise collection2
        /**/
        for (final String string : SqlIntegrationTestCommon.stringList2) {
            final SimpleClass simpleClass = factory.newSimpleClass();
            simpleClass.setString(string);
            simpleClass.setSimpleClassTwoA(simpleClassTwoB);
            sqlDataClass.addToSimpleClasses2(simpleClass);
            if (bMustAdd) {
                simpleClassList2.add(simpleClass);
            }
        }
        /**/
 
View Full Code Here

     */
    public void testLoad() throws Exception {
        final SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
        final List<SqlDataClass> dataClasses = factory.allDataClasses();
        assertEquals(1, dataClasses.size());
        final SqlDataClass sqlDataClass = dataClasses.get(0);
        SqlIntegrationTestSingleton.setDataClass(sqlDataClass);
        getSingletonInstance().setState(1);
    }
View Full Code Here

     * Test {@link SqlDataClass} {@link String} field.
     *
     * @throws Exception
     */
    public void testString() {
        final SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getDataClass();
        assertEquals("Test String", sqlDataClass.getString());
    }
View Full Code Here

        final SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getDataClass();
        assertEquals("Test String", sqlDataClass.getString());
    }

    public void testSave() {
        final SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getDataClass();
        sqlDataClass.setString("String 2");
    }
View Full Code Here

        final SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getDataClass();
        sqlDataClass.setString("String 2");
    }

    public void testSimpleClassCollection1Lazy() {
        final SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getDataClass();
        final List<SimpleClass> collection = sqlDataClass.simpleClasses1;

        assertEquals("collection size is not equal!", collection.size(), simpleClassList1.size());
    }
View Full Code Here

     * Test {@link SqlDataClass} {@link Date} field.
     *
     * @throws Exception
     */
    public void testApplibDate() {
        final SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getDataClass();

        LOG.log(Level.INFO, "Test: testDate() '2010-3-5' = 1267747200000");

        // 2010-3-5 = 1267747200000
        LOG.log(Level.INFO, "applibDate.dateValue() as String: " + applibDate);
        LOG.log(Level.INFO, "applibDate.dateValue() as Long: " + applibDate.getMillisSinceEpoch());

        // 2010-3-5 = 1267747200000
        LOG.log(Level.INFO, "sqlDataClass.getDate() as String: " + sqlDataClass.getDate());
        LOG.log(Level.INFO, "sqlDataClass.getDate().getTime() as Long: " + sqlDataClass.getDate().getMillisSinceEpoch());

        if (!applibDate.isEqualTo(sqlDataClass.getDate())) {
            fail("Applib date: Test '2010-3-5', expected " + applibDate.toString() + ", but got " + sqlDataClass.getDate().toString() + ". Check log for more info.");
            // LOG.log(Level.INFO, "Applib date: Test '2011-3-5', expected " +
            // applibDate.toString() + ", but got "
            // +
            // sqlDataClass.getDate().toString()+". Check log for more info.");
        } else {
View Full Code Here

     * @throws Exception
     */
    /* */
    @Test
    public void testSqlDate() {
        final SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getDataClass();

        LOG.log(Level.INFO, "Test: testSqlDate() '2011-4-8' == 1302220800000");

        // 2011-4-8 = 1302220800000
        LOG.log(Level.INFO, "sqlDate.toString() as String:" + sqlDate); // shows
                                                                        // as
                                                                        // 2011-04-07
        LOG.log(Level.INFO, "sqlDate.getTime() as Long:" + sqlDate.getTime());

        // 2011-4-8 = 1302220800000
        LOG.log(Level.INFO, "sqlDataClass.getSqlDate() as String:" + sqlDataClass.getSqlDate()); // shows
                                                                                                 // as
        // 2011-04-07
        LOG.log(Level.INFO, "sqlDataClass.getSqlDate().getTime() as Long:" + sqlDataClass.getSqlDate().getTime());

        if (sqlDate.compareTo(sqlDataClass.getSqlDate()) != 0) {
            fail("SQL date: Test '2011-4-8', expected " + sqlDate.toString() + ", but got " + sqlDataClass.getSqlDate().toString() + ". Check log for more info.");
            // LOG.log(Level.INFO, "SQL date: Test '2011-4-8', expected " +
            // sqlDate.toString() + ", and got "
            // + sqlDataClass.getSqlDate().toString()
            // +". Check log for more info.");
        } else {
View Full Code Here

    /**
     * Test {@link Money} type.
     */

    public void testMoney() {
        final SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getDataClass();
        assertEquals(money, sqlDataClass.getMoney());
        // assertTrue("Money " + money.toString() + " is not equal to " +
        // sqlDataClass.getMoney().toString(),
        // money.equals(sqlDataClass.getMoney()));
    }
View Full Code Here

    /**
     * Test {@link DateTime} type.
     */
    public void testDateTime() {
        final SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getDataClass();

        LOG.log(Level.INFO, "Test: testDateTime()");
        LOG.log(Level.INFO, "sqlDataClass.getDateTime() as String:" + sqlDataClass.getDateTime());
        LOG.log(Level.INFO, "dateTime.toString() as String:" + dateTime);

        LOG.log(Level.INFO, "sqlDataClass.getDateTime().getTime() as Long:" + sqlDataClass.getDateTime().millisSinceEpoch());
        LOG.log(Level.INFO, "dateTime.getTime() as Long:" + dateTime.millisSinceEpoch());

        if (!dateTime.equals(sqlDataClass.getDateTime())) {
            fail("DateTime " + dateTime.toString() + " is not equal to " + sqlDataClass.getDateTime().toString());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.runtimes.dflt.objectstores.sql.testsystem.dataclasses.SqlDataClass

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.