Package com.mobixess.jodb.tests.testobjects

Examples of com.mobixess.jodb.tests.testobjects.ObjectWithPrimitiveWrappers


        testFileDir.mkdirs();
        File testFile = new File(testFileDir,SimpleAddTest.class.getSimpleName()+(_testCounter++)+".jdb");
        testFile.delete();
       
        JODBSessionContainer sessionContainer = getContainerForFile(testFile);
        ObjectWithPrimitiveWrappers initialObject = new ObjectWithPrimitiveWrappers();
        initialObject._boolean = true;
        initialObject._byte = Byte.MAX_VALUE;
        initialObject._character = Character.MAX_VALUE;
        initialObject._double = Double.MAX_VALUE;
        initialObject._float = Float.MAX_VALUE;
        initialObject._integer = Integer.MAX_VALUE;
        initialObject._long = Long.MAX_VALUE;
        initialObject._short = Short.MAX_VALUE;
        sessionContainer.set(initialObject);
        sessionContainer.commit();
        if (reopen) {
            sessionContainer.close();
            sessionContainer = getContainerForFile(testFile);
        }
//        List classes = sessionContainer.getAllObjects();
        Query query = sessionContainer.query();
        query.constrain(initialObject.getClass());
        List classes = query.execute();
        if (classes.size() != 1) {
            throw new RuntimeException();
        }
        Object obj = classes.get(0);
        if(obj.getClass() != initialObject.getClass()){
            throw new RuntimeException();
        }
        ObjectWithPrimitiveWrappers persistedObject = (ObjectWithPrimitiveWrappers) obj;
        if(!initialObject._boolean.equals(persistedObject._boolean)){
            throw new RuntimeException();
        }
        if(!initialObject._byte.equals(persistedObject._byte)){
            throw new RuntimeException();
View Full Code Here

TOP

Related Classes of com.mobixess.jodb.tests.testobjects.ObjectWithPrimitiveWrappers

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.