Package org.conserve.objects

Examples of org.conserve.objects.ComplexArrayObject


    ComplexObject co1 = new ComplexObject(new double[] { 1.1, 2.2, 3.3, 4.4 });
    persist.saveObject(co1);

    // create an array of complex objects
    ComplexArrayObject cao = new ComplexArrayObject();
    ComplexObject[] coArray = new ComplexObject[3];
    for (int x = 0; x < coArray.length; x++)
    {
      ComplexObject co = new ComplexObject();
      co.setData(new double[] { x, x * 2, x * 3 });
      SimpleObject so = new SimpleObject();
      so.setAge((long) x);
      co.setObject(so);
      coArray[x] = co;
    }
    cao.setData(coArray);
    persist.saveObject(cao);
    persist.close();
    persist = new PersistenceManager(driver, database, login, password);
    List<ComplexArrayObject> res = persist.getObjectsMatching(new ComplexArrayObject());
    assertEquals(1, res.size());
    ComplexArrayObject ob1 = res.get(0);
    assertEquals(3, ob1.getData().length);
    persist.close();

  }
View Full Code Here


      coArray[x] = co;
    }
    // one of the complex objects in the array has an outside reference
    coArray[2] = co1;

    ComplexArrayObject cao = new ComplexArrayObject();
    cao.setData(coArray);
    persist.saveObject(cao);
    persist.close();

    // check that there is one ComplexArrayObject
    persist = new PersistenceManager(driver, database, login, password);
    List<ComplexArrayObject> res = persist.getObjectsMatching(new ComplexArrayObject());
    assertEquals(1, res.size());
    ComplexArrayObject ob1 = res.get(0);
    // check that the ComplexArrayObject contains 3 ComplexObjects
    assertEquals(3, ob1.getData().length);
    persist.close();

    persist = new PersistenceManager(driver, database, login, password);
    persist.deleteObjects(new ComplexArrayObject());
    List<ComplexObject> tmp = persist.getObjectsMatching(new ComplexObject());
    assertEquals(1, tmp.size());
    persist.close();
  }
View Full Code Here

TOP

Related Classes of org.conserve.objects.ComplexArrayObject

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.