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

Examples of org.apache.isis.runtimes.dflt.objectstores.sql.testsystem.SqlDataClassFactory


        assertEquals(1, classes.size());

    }

    public void testFindByMatchEntity() {
        final SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
        final List<SimpleClassTwo> classTwos = factory.allSimpleClassTwos();

        final SimpleClass simpleClassMatch = new SimpleClass();
        simpleClassMatch.setSimpleClassTwoA(classTwos.get(0));

        final List<SimpleClass> classes = factory.allSimpleClassesThatMatch(simpleClassMatch);
        // TODO: Why is this hack required?
        if (getProperties().getProperty("isis.persistor") != "in-memory") {
            assertEquals(stringList1.size(), classes.size());
        } else {
            assertEquals(stringList1.size() + 2, classes.size());
View Full Code Here


        configuration.add(properties);
        persistorName = configuration.getString("isis.persistor");

        resetPersistorState(configuration);

        sqlDataClassFactory = new SqlDataClassFactory();
        if (system != null) {
            system.shutDown();
        }
        system = new TestProxySystemIII();
        system.setConfiguration(configuration);
View Full Code Here

    public void testCreate() throws Exception {
        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);
            }
        }
        /**/
        factory.save(sqlDataClass);

        // For in-memory only!
        if (getProperties().getProperty("isis.persistor") == "in-memory") {
            getSingletonInstance().setState(1);
        }
View Full Code Here

     * Test loading a persisted {@link SqlDataClass} from the sql store.
     *
     * @throws Exception
     */
    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

            }
        }
    }

    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

        factory.resolve(a);
        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());
            assertEquals(simpleClassTwoA.getBooleanValue(), a.getBooleanValue());
        }
    }
View Full Code Here

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

    public void testSimpleClassTwo() {
        final SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
        final List<SimpleClassTwo> classes = factory.allSimpleClassTwos();
        assertEquals(1, classes.size());
        for (final SimpleClassTwo simpleClass : classes) {
            assertEquals(simpleClassTwoA.getText(), simpleClass.getText());
        }
    }
View Full Code Here

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

    public void testUpdate1() {
        final SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
        final List<SimpleClassTwo> classes = factory.allSimpleClassTwos();
        assertEquals(1, classes.size());

        final SimpleClassTwo simpleClass = classes.get(0);
        simpleClass.setText("XXX");
        simpleClass.setBooleanValue(false);
View Full Code Here

        simpleClass.setBooleanValue(false);
        simpleClassTwoA.setBooleanValue(false);
    }

    public void testUpdate2() {
        final SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
        final List<SimpleClassTwo> classes = factory.allSimpleClassTwos();
        assertEquals(1, classes.size());

        final SimpleClassTwo simpleClass = classes.get(0);
        assertEquals("XXX", simpleClass.getText());
        assertEquals(simpleClassTwoA.getBooleanValue(), simpleClass.getBooleanValue());
View Full Code Here

TOP

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

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.