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

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


            assertEquals(simpleClass.getString(), collection.get(i++).getString());
        }
    }

    public void testSimpleClassTwoReferenceLazy() {
        final SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getDataClass();
        final List<SimpleClass> collection = sqlDataClass.getSimpleClasses1();
        if (getProperties().getProperty("isis.persistor") != "in-memory") {
            for (final SimpleClass simpleClass : collection) {
                final SimpleClassTwo a = simpleClass.getSimpleClassTwoA();
                assertEquals(null, a.text); // must check direct value, as
                                            // framework can auto-resolve, if
View Full Code Here


        }
    }

    public void testSingleReferenceResolve() {
        final SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
        final SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getDataClass();
        final SimpleClassTwo a = sqlDataClass.getSimpleClassTwo();
        factory.resolve(a);
        assertEquals(simpleClassTwoA.getText(), a.getText());
    }
View Full Code Here

        assertEquals(simpleClassTwoA.getText(), a.getText());
    }

    public void testSimpleClassTwoReferenceResolve() {
        final SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
        final SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getDataClass();
        final List<SimpleClass> collection = sqlDataClass.getSimpleClasses1();
        for (final SimpleClass simpleClass : collection) {
            final SimpleClassTwo a = simpleClass.getSimpleClassTwoA();
            factory.resolve(a);
            assertEquals(simpleClassTwoA.getText(), a.getText());
            assertEquals(simpleClassTwoA.getIntValue(), a.getIntValue());
View Full Code Here

    public void testUpdateCollectionIsDirty() {
        final SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();

        final List<SqlDataClass> sqlDataClasses = factory.allDataClasses();
        final SqlDataClass sqlDataClass = sqlDataClasses.get(0);

        final List<SimpleClass> collection = sqlDataClass.getSimpleClasses1();
        final SimpleClass simpleClass1 = collection.get(0);
        // simpleClass1.setString(stringList1.get(3));

        collection.remove(simpleClass1);
        // XML objectstore doesn't support this.
View Full Code Here

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

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

        SqlIntegrationTestSingleton.drop(getPersonTableName());
        SqlIntegrationTestSingleton.drop(getSimpleClassTableName());
        SqlIntegrationTestSingleton.drop(getSimpleClassTwoTableName());

        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.setString("A");

        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(simpleClassTwoA);
            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

        SqlIntegrationTestSingleton.setDataClass(sqlDataClass);
        getSingletonInstance().setState(1);
    }

    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 String} field.
     *
     * @throws Exception
     */
    public void testString() {
        final SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getDataClass();
        assertEquals("Test String", sqlDataClass.getString());
    }
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 {
            // LOG.log(Level.INFO, "SQL applib.value.date: test passed! Woohoo!");
        }
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.