Package org.conserve.objects

Examples of org.conserve.objects.SimpleObject


  @Test
  public void testRenameColumn() throws Exception
  {
    String name = "foo";
    int value = 42;
    Object otherObject = new SimpleObject();
    Object redundantObject = new SimplestObject();
    PersistenceManager pm = new PersistenceManager(driver, database, login, password);
    // drop all tables
    pm.dropTable(Object.class);
View Full Code Here


  @Test
  public void testAddRemoveColumns() throws Exception
  {
    String name = "foo";
    int value = 42;
    Object otherObject = new SimpleObject();
    Object redundantObject = new SimplestObject();
    PersistenceManager pm = new PersistenceManager(driver, database, login, password);
    // drop all tables
    pm.dropTable(Object.class);
View Full Code Here

  @Test
  public void testChangeColumnTypeLongAndObject() throws Exception
  {
    String name = "foo";
    int value = 1;
    Object otherObject = new SimpleObject();
    Object redundantObject = new SimplestObject();
    PersistenceManager pm = new PersistenceManager(driver, database, login, password);
    // drop all tables
    pm.dropTable(Object.class);

    // create original objects
    OriginalObject oo = new OriginalObject();
    oo.setName(name);
    oo.setValue(value);
    oo.setOtherObject(otherObject);
    oo.setRedundantObject(redundantObject);
    pm.saveObject(oo);
    pm.close();

    // change object to long
    pm = new PersistenceManager(driver, database, login, password);
    pm.changeName(OriginalObject.class, ObjectToLong.class);
    pm.close();
    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);
    pm.close();
  }
View Full Code Here

  @Test
  public void testChangeColumnTypeLongAndInt() throws Exception
  {
    String name = "foo";
    int value = 1;
    Object otherObject = new SimpleObject();
    Object redundantObject = new SimplestObject();
    PersistenceManager pm = new PersistenceManager(driver, database, login, password);
    // drop all tables
    pm.dropTable(Object.class);
View Full Code Here

  @Test
  public void testChangeColumnTypeLongAndString() throws Exception
  {
    String name = "foo";
    int value = 1;
    Object otherObject = new SimpleObject();
    Object redundantObject = new SimplestObject();
    PersistenceManager pm = new PersistenceManager(driver, database, login, password);
    // drop all tables
    pm.dropTable(Object.class);
View Full Code Here

  @Test
  public void testChangeColumnTypeLongAndArray() throws Exception
  {
    String name = "foo";
    int value = 1;
    Object otherObject = new SimpleObject();
    Object redundantObject = new SimplestObject();
    PersistenceManager pm = new PersistenceManager(driver, database, login, password);
    // drop all tables
    pm.dropTable(Object.class);
View Full Code Here

TOP

Related Classes of org.conserve.objects.SimpleObject

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.