Package org.conserve.select

Examples of org.conserve.select.All


    persistTwo.close();

    // re-open the target persistence manager
    persistTwo = new PersistenceManager(driver, secondDatabase, login, password);
    // assert that there is 3 objects in all
    List<Object> allObjects = persistTwo.getObjects(Object.class, new All());
    assertEquals(3, allObjects.size());
    // assert that there is one LessSimpleObject
    List<LessSimpleObject> lessSimpleObjects = persistTwo.getObjects(LessSimpleObject.class, new All());
    assertEquals(1, lessSimpleObjects.size());
    // assert that the LessSimpleObject has "name" as name.
    LessSimpleObject first = lessSimpleObjects.get(0);
    assertEquals("name", first.getName());
  }
View Full Code Here


    System.out.println(d);

    // save the calendar
    persist.saveObject(cal);

    List<Calendar> cals = persist.getObjects(Calendar.class, new All());

    // verify that we have at least one calendar stored
    assertTrue(cals.size() > 0);

    persist.close();
View Full Code Here

    oo.setRedundantObject(redundantObject);
    pm.saveObject(oo);
    // rename the table
    pm.changeName(OriginalObject.class, NewName.class);
    // get all NewName objects
    List<NewName> res = pm.getObjects(NewName.class, new All());
    assertEquals(res.size(), 1);
    // make sure all properties match
    NewName nn = res.get(0);
    assertEquals(nn.getValue(), value);
    assertEquals(nn.getName(), name);
View Full Code Here

    pm.changeName(OriginalObject.class, RenamedColumn.class);
    // update schema
    pm.renameProperties(RenamedColumn.class);

    // get all RenamedColumn objects
    List<RenamedColumn> res1 = pm.getObjects(RenamedColumn.class, new All());
    assertEquals(res1.size(), 1);
    // make sure all properties match
    RenamedColumn nn = res1.get(0);
    assertEquals(value, nn.getValue());
    assertEquals(name, nn.getName());
    assertEquals(otherObject, nn.getOtherObject());
    assertEquals(redundantObject, nn.getRenamedObject());

    // change everything back
    pm.changeName(RenamedColumn.class, OriginalObject.class);
    pm.renameProperties(OriginalObject.class);

    // get all OriginalObject objects
    List<OriginalObject> res2 = pm.getObjects(OriginalObject.class, new All());
    assertEquals(res2.size(), 1);
    // make sure all properties match
    oo = res2.get(0);
    assertEquals(value, oo.getValue());
    assertEquals(name, oo.getName());
View Full Code Here

    pm.changeName(OriginalObject.class, RemovedColumn.class);
    // update schema
    pm.updateSchema(RemovedColumn.class);

    // get all RemovedColumn objects
    List<RemovedColumn> res1 = pm.getObjects(RemovedColumn.class, new All());
    assertEquals(res1.size(), 1);
    // make sure all properties match
    RemovedColumn nn = res1.get(0);
    assertEquals(value, nn.getValue());
    assertEquals(otherObject, nn.getOtherObject());
    assertEquals(name, nn.getName());

    // make sure no SimplestObject entries are left
    List<SimplestObject> simpleRes = pm.getObjects(SimplestObject.class, new All());
    assertEquals(0, simpleRes.size());

    // change everything back
    pm.changeName(RemovedColumn.class, OriginalObject.class);
    pm.updateSchema(OriginalObject.class);

    // get all OriginalObject objects
    List<OriginalObject> res2 = pm.getObjects(OriginalObject.class, new All());
    assertEquals(res2.size(), 1);
    // make sure all properties match
    oo = res2.get(0);
    assertEquals(value, oo.getValue());
    assertEquals(name, oo.getName());
View Full Code Here

    pm = new PersistenceManager(driver, database, login, password);
    pm.updateSchema(ObjectToLong.class);
    pm.close();
    //check that objects exist/not exist
    pm = new PersistenceManager(driver, database, login, password);
    List<ObjectToLong>res = pm.getObjects(ObjectToLong.class, new All());
    assertEquals(1,res.size());
    ObjectToLong tmp = res.get(0);
    assertTrue(tmp.getName().equals(name));
    assertNull(tmp.getOtherObject());
    tmp.setOtherObject(42L);
    pm.saveObject(tmp);
    //check that the dependent object has been dropped
    List<SimpleObject>dependents = pm.getObjects(SimpleObject.class, new All());
    assertEquals(0,dependents.size());
    pm.close();
    // change long to object
    pm = new PersistenceManager(driver, database, login, password);
    pm.changeName(ObjectToLong.class, OriginalObject.class);
    pm.close();
    pm = new PersistenceManager(driver, database, login, password);
    pm.updateSchema(OriginalObject.class);
    pm.close();
    pm = new PersistenceManager(driver, database, login, password);
    List<OriginalObject>res1 = pm.getObjects(OriginalObject.class, new All());
    assertEquals(1,res1.size());
    OriginalObject tmp1 = res1.get(0);
    assertNull(tmp1.getOtherObject());
    tmp1.setOtherObject(new SimpleObject());
    pm.saveObject(tmp1);
View Full Code Here

    pm = new PersistenceManager(driver, database, login, password);
    pm.changeName(ObjectToSubclass.class, OriginalObject.class);
    pm.close();
    pm = new PersistenceManager(driver, database, login, password);
    pm.updateSchema(OriginalObject.class);
    List<OriginalObject>res2 = pm.getObjects(OriginalObject.class, new All());
    assertEquals(2,res2.size());
    pm.close();
  }
View Full Code Here

    pm = new PersistenceManager(driver, database, login, password);
    pm.updateSchema(IntToLong.class);
    pm.close();
    //check that the integer has been changed into a long
    pm = new PersistenceManager(driver, database, login, password);
    List<IntToLong>res1 = pm.getObjects(IntToLong.class,new All());
    assertEquals(1,res1.size());
    IntToLong obj1 = res1.get(0);
    assertTrue(obj1.getName().equals(name));
    assertEquals(1,obj1.getValue());
    pm.close();
   
    //change long to int
    pm = new PersistenceManager(driver, database, login, password);
    pm.changeName(IntToLong.class, OriginalObject.class);
    pm.close();
    pm = new PersistenceManager(driver, database, login, password);
    pm.updateSchema(OriginalObject.class);
    pm.close();
    //check that the long is now null, since long can not fit in int
    pm = new PersistenceManager(driver, database, login, password);
    List<OriginalObject>res2 = pm.getObjects(OriginalObject.class,new All());
    assertEquals(1,res2.size());
    OriginalObject obj2 = res2.get(0);
    assertNull(obj2.getValue());
    pm.close();
   
View Full Code Here

    pm = new PersistenceManager(driver, database, login, password);
    pm.updateSchema(StringToLong.class);
    pm.close();
    //check that the long no longer exist
    pm = new PersistenceManager(driver, database, login, password);
    List<StringToLong>res1 = pm.getObjects(StringToLong.class, new All());
    assertEquals(1,res1.size());
    StringToLong obj1 = res1.get(0);
    assertNull(obj1.getName());
    //save a long
    obj1.setName(1);
    pm.saveObject(obj1);
    pm.close();

    // change long to string
    pm = new PersistenceManager(driver, database, login, password);
    pm.changeName(StringToLong.class, OriginalObject.class);
    pm.close();
    pm = new PersistenceManager(driver, database, login, password);
    pm.updateSchema(OriginalObject.class);
    pm.close();
    // check that the string no longer exist
    pm = new PersistenceManager(driver, database, login, password);
    List<OriginalObject>res2 = pm.getObjects(OriginalObject.class, new All());
    assertEquals(1,res2.size());
    OriginalObject obj2 = res2.get(0);
    assertNull(obj2.getName());
    pm.close();
  }
View Full Code Here

    pm = new PersistenceManager(driver, database, login, password);
    pm.updateSchema(ArrayToLong.class);
    pm.close();
    //check that array no longer exist
    pm = new PersistenceManager(driver, database, login, password);
    List<ArrayToLong>res1 = pm.getObjects(ArrayToLong.class, new All());
    assertEquals(1,res1.size());
    ArrayToLong obj1 = res1.get(0);
    assertEquals(0,obj1.getArray());
    //save a long
    obj1.setArray(1);
    pm.saveObject(obj1);
    pm.close();

    //change long to array
    pm = new PersistenceManager(driver, database, login, password);
    pm.changeName(ArrayToLong.class, OriginalObject.class);
    pm.close();
    pm = new PersistenceManager(driver, database, login, password);
    pm.updateSchema(OriginalObject.class);
    pm.close();
    //make sure the array is null
    pm = new PersistenceManager(driver, database, login, password);
    List<OriginalObject>res2 = pm.getObjects(OriginalObject.class, new All());
    assertEquals(1,res2.size());
    OriginalObject obj2  = res2.get(0);
    assertNull(obj2.getArray());
    pm.close();
  }
View Full Code Here

TOP

Related Classes of org.conserve.select.All

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.