Examples of ObjectB


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

        File testFile = new File(testFileDir,SimpleAddTest.class.getSimpleName()+(_testCounter++)+".jdb");
        testFile.delete();
       
        JODBSessionContainer sessionContainer = getContainerForFile(testFile);
        ObjectA objectA = new ObjectA((byte)1,(short)2,null);
        ObjectB objectB = new ObjectB();
        Object[] array = new Object[]{objectA,objectB};
       
        sessionContainer.set(objectB);
        sessionContainer.set(array);
        sessionContainer.set(objectA);
       
       
        sessionContainer.commit();
        sessionContainer.close();
       
        sessionContainer = getContainerForFile(testFile);
        //sessionContainer.printFileMap();
        List classes = sessionContainer.getAllObjects();
        if(classes.size()!=3){
            throw new RuntimeException();
        }
        Object arrayObj = null;
        for (int i = 0; i < classes.size(); i++) {
            if(classes.get(i).getClass().isArray()){
                arrayObj = classes.get(i);
            }
        }
        Object[] array1 = (Object[]) arrayObj;
        List<Object> list = Arrays.asList(array1);
        int index = list.indexOf(objectA);
        if(index !=0){
            throw new RuntimeException();
        }
       
        ObjectA objectA2 = (ObjectA) array1[index];
       
       
        index = list.indexOf(objectB);
        if(index != 1){
            throw new RuntimeException();
        }
       
        ObjectB objectB2 = (ObjectB) array1[index];
       
       
        objectA2.setVal3(objectB2);
        objectB2._val3 = objectA2;
       
        sessionContainer.set(objectB2);
        sessionContainer.set(objectA2);
        sessionContainer.set(arrayObj);
       
        sessionContainer.close();
       
        sessionContainer = getContainerForFile(testFile);
        //sessionContainer.printFileMap();
        //sessionContainer.close();
       
        objectA = new ObjectA((byte)2,(short)3,null);
        objectB = new ObjectB();
       
        classes = sessionContainer.getAllObjects();
        if(classes.size()!=3){
            throw new RuntimeException();
        }
View Full Code Here

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

        File testFile = new File(testFileDir,SimpleAddTest.class.getSimpleName()+(_testCounter++)+".jdb");
        testFile.delete();
       
        JODBSessionContainer sessionContainer = getContainerForFile(testFile);
        ObjectA objectA = new ObjectA((byte)1,(short)2,null);
        ObjectB objectB = new ObjectB();
        int[] array = new int[]{10,20,30};
       
        sessionContainer.set(objectB);
        sessionContainer.set(array);
        sessionContainer.set(objectA);
       
       
        sessionContainer.commit();
        sessionContainer.close();
       
        sessionContainer = getContainerForFile(testFile);
        sessionContainer.printFileMap();
        List classes = sessionContainer.getAllObjects();
        if(classes.size()!=3){
            throw new RuntimeException();
        }
        Object arrayObj = null;
        for (int i = 0; i < classes.size(); i++) {
            if(classes.get(i).getClass().isArray()){
                arrayObj = classes.get(i);
            }
        }
        int[] array1 = (int[]) arrayObj;

        if(!Arrays.equals(array, array1)){
            throw new RuntimeException();
        }
        int index = classes.indexOf(objectA);
        if(index == -1){
            throw new RuntimeException();
        }
        ObjectA objectA2 = (ObjectA) classes.get(index);
       
       
        index = classes.indexOf(objectB);
        if(index == -1){
            throw new RuntimeException();
        }
       
        ObjectB objectB2 = (ObjectB) classes.get(index);
       
        array1[0] = 100;
       
        objectA2.setVal3(objectB2);
        objectB2._val3 = objectA2;
View Full Code Here

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

        factory.intersectionInit(null, Integer.MAX_VALUE, false);
       
        sessionContainer = getContainerForFile(testFile);
        //factory.setIntersectEnabled(true);
        ObjectA objectA = new ObjectA((byte)1,(short)2,null);
        ObjectB objectB = new ObjectB();
        int[] array = new int[]{10,20,30};
       
       
        sessionContainer.set(objectB);
        //sessionContainer.set(array);
        sessionContainer.set(objectA);
        sessionContainer.close();
       
        sessionContainer = getContainerForFile(testFile);
        factory.setIntersectEnabled(true);
        sessionContainer.set(array);
        sessionContainer.close();
       
        Vector verificationObjects = new Vector();
        verificationObjects.add(objectA);
        verificationObjects.add(objectB);
       
        int maxOperationsCount = factory.getCounter();
       
        testFile = new File(testFileDir,SimpleAddTest.class.getSimpleName()+(_testCounter++)+".jdb");
       
        for (int i = 0; i < maxOperationsCount; i++) {
            System.err.println("Iteration ="+i);
            //System.gc();
//            try {
//                Thread.sleep(200);
//            } catch (InterruptedException e1) {
//            }
            factory.intersectionInit(null, i, true);
            testFile.delete();
            if(testFile.exists()){
                throw new RuntimeException();
            }
           
            sessionContainer = getContainerForFile(testFile);
            sessionContainer.set(objectB);
            sessionContainer.set(objectA);
           
            sessionContainer.close();
           
//            testFile.delete();
//            if(testFile.exists()){
//                System.err.println();
//            }
           
            factory.setIntersectEnabled(true);
            sessionContainer = getContainerForFile(testFile);
           
            sessionContainer.set(array);
           
            try {
                sessionContainer.close();
                throw new RuntimeException("Test Framework Error");
            } catch (Exception e) {
//                if(i==25){
//                    factory.printUnclosedBuffers();
//                }
                e.printStackTrace();
            }
           
//            testFile.delete();
//            if(testFile.exists()){
//                System.err.println();
//            }
           
            factory.setIntersectEnabled(false);
            if (factory._bufferedType == BUFFER_TYPE.MAIN) {
                byte[] incompleteTransaction = factory.getBuffer();
                verifyDataReadable(incompleteTransaction, verificationObjects,2,3);
            }           
            sessionContainer = getContainerForFile(testFile);
           
            List classes = sessionContainer.getAllObjects();
            if(classes.size()!=2){
                throw new RuntimeException(""+classes.size()+"  "+i);
            }
//            Object arrayObj = null;
//            for (int j = 0; j < classes.size(); j++) {
//                if(classes.get(j).getClass().isArray()){
//                    arrayObj = classes.get(j);
//                }
//            }
//            int[] array1 = (int[]) arrayObj;
//
//            if(!Arrays.equals(array, array1)){
//                throw new RuntimeException();
//            }
            int index = classes.indexOf(objectA);
            if(index == -1){
                throw new RuntimeException();
            }
            ObjectA objectA2 = (ObjectA) classes.get(index);
           
           
            index = classes.indexOf(objectB);
            if(index == -1){
                throw new RuntimeException();
            }
            ObjectB objectB2 = (ObjectB) classes.get(index);
            sessionContainer.close();
        }
       
    }
View Full Code Here

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

        File testFile = new File(testFileDir,NQTests.class.getSimpleName()+(_testCounter++)+".jdb");
        testFile.delete();
        JODBSessionContainer sessionContainer = getContainerForFile(testFile);
        ObjectA objectA = new ObjectA((byte)2,(byte)3,null);
        ObjectA objectA1 = new ObjectA((byte)4,(byte)3,null);
        ObjectB objectB = new ObjectB();
        objectB._val3 = objectA;
        sessionContainer.set(objectA);
        sessionContainer.set(objectA1);
        sessionContainer.set(objectB);
        sessionContainer.commit();
View Full Code Here

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

        File testFile = new File(testFileDir,NQTests.class.getSimpleName()+(_testCounter++)+".jdb");
        testFile.delete();
        JODBSessionContainer sessionContainer = getContainerForFile(testFile);
        ObjectA objectA = new ObjectA((byte)2,(byte)3,null);
        ObjectA objectA1 = new ObjectA((byte)4,(byte)3,null);
        ObjectB objectB = new ObjectB();
        objectB._val3 = objectA;
        objectB._val1 = 4;
       
        ObjectB objectB2 = new ObjectB();
        objectB2._val1 =10;
        sessionContainer.set(objectA);
        sessionContainer.set(objectA1);
        sessionContainer.set(objectB);
        sessionContainer.set(objectB2);
        sessionContainer.commit();
       
        if(reopen){
            sessionContainer.close();
            sessionContainer = getContainerForFile(testFile);
        }
       
        Predicate<ObjectB> predicate = new Predicate<ObjectB>(){
            @Override
            public boolean match(ObjectB candidate) throws IOException {
                if(candidate._val1==10){
                    return true;
                }
                return false;
            }
           
        };
       
        if(_checkOptimization && !sessionContainer.isOptimizedQuery(predicate, null)){
            throw new RuntimeException();
        }
       
        ObjectSet<ObjectB> result = sessionContainer.query(predicate);
        if(result.size() != 1){
            throw new RuntimeException(""+result.size());
        }
        ObjectB objectB3 = result.get(0);
        if(!objectB3.equals(objectB2)){
            throw new RuntimeException();
        }
       
        sessionContainer.close();
    }
View Full Code Here

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

       
        //sessionContainer.configureIndex(ObjectB.class, "_val4", true);
       
        Random random = new Random(237468);
        for (int i = 0; i < 1000; ++i) {
            ObjectB objectB = new ObjectB();
            objectB._val4 =  random.nextInt(1000);
            sessionContainer.set(objectB);
        }

        sessionContainer.commit();
       
        if(reopen){
            sessionContainer.close();
            sessionContainer = getContainerForFile(testFile);
        }
       
        Predicate<ObjectB> predicate = new Predicate<ObjectB>(){
            @Override
            public boolean match(ObjectB candidate) throws IOException {
                if(candidate._val4>100){
                    return true;
                }
                return false;
            }
           
        };
        Comparator<ObjectB> comparatorForward = new Comparator<ObjectB>(){

            public int compare(ObjectB o1, ObjectB o2) {
                return o1._val4 - o2._val4;
            }
           
        };
        if(_checkOptimization && !sessionContainer.isOptimizedQuery(predicate, comparatorForward)){
            throw new RuntimeException();
        }
        ObjectSet<ObjectB> result = sessionContainer.query(predicate, comparatorForward);
        if(result.size() == 0){
            throw new RuntimeException(""+result.size());
        }
        ObjectB prev = null;
        while (result.hasNext()) {
            ObjectB next = result.next();
            if(prev != null && prev._val4>next._val4){
                throw new RuntimeException();
            }
            prev = next;
        }
       
        Comparator<ObjectB> comparatorBackward = new Comparator<ObjectB>(){

            public int compare(ObjectB o1, ObjectB o2) {
                return o2._val4 - o1._val4;
            }
           
        };
       
        if(_checkOptimization && !sessionContainer.isOptimizedQuery(predicate, comparatorBackward)){
            throw new RuntimeException();
        }
       
        result = sessionContainer.query(predicate, comparatorBackward);
        if(result.size() == 0){
            throw new RuntimeException(""+result.size());
        }
        prev = null;
        while (result.hasNext()) {
            ObjectB next = result.next();
            if(prev != null && prev._val4<next._val4){
                throw new RuntimeException();
            }
            prev = next;
        }
View Full Code Here

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

       
        sessionContainer.configureIndex(ObjectB.class, "_val4", true);
       
        Random random = new Random(237468);
        for (int i = 0; i < 1000; ++i) {
            ObjectB objectB = new ObjectB();
            objectB._val4 =  random.nextInt(1000);
            sessionContainer.set(objectB);
        }

        sessionContainer.commit();
       
        if(reopen){
            sessionContainer.close();
            sessionContainer = getContainerForFile(testFile);
        }
       
        Predicate<ObjectB> predicate = new Predicate<ObjectB>() {
            @Override
            public boolean match(ObjectB candidate) throws IOException {
                if(candidate._val4>100){
                    return true;
                }
                return false;
            }
           
        } ;
        Comparator<ObjectB> comparatorForward = new Comparator<ObjectB>(){

            public int compare(ObjectB o1, ObjectB o2) {
                return o1._val4 - o2._val4;
            }
           
        };
        if(_checkOptimization && !sessionContainer.isOptimizedQuery(predicate, comparatorForward)){
            throw new RuntimeException();
        }
        ObjectSet<ObjectB> result = sessionContainer.query(predicate, comparatorForward);
        if(result.size() == 0){
            throw new RuntimeException(""+result.size());
        }
        ObjectB prev = null;
        while (result.hasNext()) {
            ObjectB next = result.next();
            if(prev != null && prev._val4>next._val4){
                throw new RuntimeException();
            }
            prev = next;
        }
       
        Comparator<ObjectB> comparatorBackward = new Comparator<ObjectB>(){

            public int compare(ObjectB o1, ObjectB o2) {
                return o2._val4 - o1._val4;
            }
           
        };
       
        if(_checkOptimization && !sessionContainer.isOptimizedQuery(predicate, comparatorBackward)){
            throw new RuntimeException();
        }
       
        result = sessionContainer.query(predicate, comparatorBackward);
        if(result.size() == 0){
            throw new RuntimeException(""+result.size());
        }
        prev = null;
        while (result.hasNext()) {
            ObjectB next = result.next();
            if(prev != null && prev._val4<next._val4){
                throw new RuntimeException();
            }
            prev = next;
        }
View Full Code Here

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

        File testFile = new File(testFileDir,NQTests.class.getSimpleName()+(_testCounter++)+".jdb");
        testFile.delete();
        JODBSessionContainer sessionContainer = getContainerForFile(testFile);
        ObjectA objectA = new ObjectA((byte)2,(byte)3,null);
        ObjectA objectA1 = new ObjectA((byte)4,(byte)3,null);
        ObjectB objectB = new ObjectB();
        objectB._val3 = objectA;
        objectB._val1 = 4;
        objectB._var5 = findString;
       
        ObjectB objectB2 = new ObjectB();
        objectB2._val1 =10;
        sessionContainer.set(objectA);
        sessionContainer.set(objectA1);
        sessionContainer.set(objectB);
        sessionContainer.set(objectB2);
        sessionContainer.commit();
       
        if(reopen){
            sessionContainer.close();
            sessionContainer = getContainerForFile(testFile);
        }
       
        Predicate<ObjectB> predicate = new Predicate<ObjectB>(){
            @Override
            public boolean match(ObjectB candidate) throws IOException {
                unoptimize(candidate);
                if(candidate._var5!=null && candidate._var5.equals(findString)){
                    return true;
                }
                return false;
            }
           
            public void unoptimize(ObjectB predicate){
               
            }
           
        };
        if(_checkOptimization && sessionContainer.isOptimizedQuery(predicate, null)){
            throw new RuntimeException();
        }
        ObjectSet<ObjectB> result = sessionContainer.query(predicate);
        if(result.size() != 1){
            throw new RuntimeException(""+result.size());
        }
        ObjectB objectB3 = result.get(0);
        if(!findString.equals(objectB3._var5)){
            throw new RuntimeException();
        }
       
        sessionContainer.close();
View Full Code Here

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

       
        //sessionContainer.configureIndex(ObjectB.class, "_val4", true);
       
        Random random = new Random(237468);
        for (int i = 0; i < 1000; ++i) {
            ObjectB objectB = new ObjectB();
            objectB._val4 =  random.nextInt(1000);
            sessionContainer.set(objectB);
        }

        sessionContainer.commit();
       
        if(reopen){
            sessionContainer.close();
            sessionContainer = getContainerForFile(testFile);
        }
       
        Predicate<ObjectB> predicate = new Predicate<ObjectB>(){
            @Override
            public boolean match(ObjectB candidate) throws IOException {
                unoptimize(candidate);
                if(candidate._val4>100){
                    return true;
                }
                return false;
            }
           
            void unoptimize(ObjectB candidate){
               
            }
           
        };
        Comparator<ObjectB> comparatorForward = new Comparator<ObjectB>(){

            public int compare(ObjectB o1, ObjectB o2) {
                return o1._val4 - o2._val4;
            }
           
        };
        if(_checkOptimization && sessionContainer.isOptimizedQuery(predicate, comparatorForward)){
            throw new RuntimeException();
        }
        ObjectSet<ObjectB> result = sessionContainer.query(predicate, comparatorForward);
        if(result.size() == 0){
            throw new RuntimeException(""+result.size());
        }
        ObjectB prev = null;
        while (result.hasNext()) {
            ObjectB next = result.next();
            if(prev != null && prev._val4>next._val4){
                throw new RuntimeException();
            }
            prev = next;
        }
       
        Comparator<ObjectB> comparatorBackward = new Comparator<ObjectB>(){

            public int compare(ObjectB o1, ObjectB o2) {
                return o2._val4 - o1._val4;
            }
           
        };
       
        if(_checkOptimization && sessionContainer.isOptimizedQuery(predicate, comparatorBackward)){
            throw new RuntimeException();
        }
       
        result = sessionContainer.query(predicate, comparatorBackward);
        if(result.size() == 0){
            throw new RuntimeException(""+result.size());
        }
        prev = null;
        while (result.hasNext()) {
            ObjectB next = result.next();
            if(prev != null && prev._val4<next._val4){
                throw new RuntimeException();
            }
            prev = next;
        }
View Full Code Here

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

       
        sessionContainer.configureIndex(ObjectB.class, "_val4", true);
       
        Random random = new Random(237468);
        for (int i = 0; i < 1000; ++i) {
            ObjectB objectB = new ObjectB();
            objectB._val4 =  random.nextInt(1000);
            sessionContainer.set(objectB);
        }

        sessionContainer.commit();
       
        if(reopen){
            sessionContainer.close();
            sessionContainer = getContainerForFile(testFile);
        }
       
        Predicate<ObjectB> predicate = new Predicate<ObjectB>(){
            @Override
            public boolean match(ObjectB candidate) throws IOException {
                unoptimize(candidate);
                if(candidate._val4>100){
                    return true;
                }
                return false;
            }
           
            void unoptimize(ObjectB candidate){
               
            }
           
        };
        Comparator<ObjectB> comparatorForward = new Comparator<ObjectB>(){

            public int compare(ObjectB o1, ObjectB o2) {
                return o1._val4 - o2._val4;
            }
           
        };
        if(_checkOptimization && sessionContainer.isOptimizedQuery(predicate, comparatorForward)){
            throw new RuntimeException();
        }
        ObjectSet<ObjectB> result = sessionContainer.query(predicate, comparatorForward);
        if(result.size() == 0){
            throw new RuntimeException(""+result.size());
        }
        ObjectB prev = null;
        while (result.hasNext()) {
            ObjectB next = result.next();
            if(prev != null && prev._val4>next._val4){
                throw new RuntimeException();
            }
            prev = next;
        }
       
        Comparator<ObjectB> comparatorBackward = new Comparator<ObjectB>(){

            public int compare(ObjectB o1, ObjectB o2) {
                return o2._val4 - o1._val4;
            }
           
        };
       
        if(_checkOptimization && sessionContainer.isOptimizedQuery(predicate, comparatorBackward)){
            throw new RuntimeException();
        }
       
        result = sessionContainer.query(predicate, comparatorBackward);
        if(result.size() == 0){
            throw new RuntimeException(""+result.size());
        }
        prev = null;
        while (result.hasNext()) {
            ObjectB next = result.next();
            if(prev != null && prev._val4<next._val4){
                throw new RuntimeException();
            }
            prev = next;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.