Examples of IDataAccessSession


Examples of net.sf.joafip.service.IDataAccessSession

    Bob1 bob1 = new Bob1();
    bob1.setVal(1000);
    final Bob2 bob2 = new Bob2();
    bob1.setBob2(bob2);

    final IDataAccessSession session = filePersistence
        .createDataAccessSession();

    session.open();
    session.setObject("key", bob1);
    session.close(EnumFilePersistenceCloseAction.SAVE);

    filePersistence.setChangeLogEnabled(true, 1);

    session.open();
    bob1 = (Bob1) session.getObject("key");
    bob1.setBob2(null);
    final Bob3 bob3 = new Bob3();
    bob1.setBob3(bob3);
    session.close(EnumFilePersistenceCloseAction.SAVE);

    // changeFileName = filePersistence.getChangeFileName();

    storageFileName = filePersistence.getStorageFileName();
View Full Code Here

Examples of net.sf.joafip.service.IDataAccessSession

      FilePersistenceInvalidClassException,
      FilePersistenceNotSerializableException,
      FilePersistenceClassNotFoundException,
      FilePersistenceDataCorruptedException,
      FilePersistenceTooBigForSerializationException {
    final IDataAccessSession session = filePersistence
        .createDataAccessSession();
    ArraySerializable arraySerializable;
    session.open();
    arraySerializable = new ArraySerializable();
    Bob1[] bob1s = new Bob1[1];
    bob1s[0] = new Bob1();
    bob1s[0].setVal(10);
    arraySerializable.setArray(bob1s);
    session.setObject(KEY, arraySerializable);
    session.close(EnumFilePersistenceCloseAction.SAVE);

    session.open();
    arraySerializable = (ArraySerializable) session.getObject(KEY);
    bob1s = (Bob1[]) arraySerializable.getArray();
    assertEquals("bad value", 10, bob1s[0].getVal());
  }
View Full Code Here

Examples of net.sf.joafip.service.IDataAccessSession

      FilePersistenceInvalidClassException,
      FilePersistenceNotSerializableException,
      FilePersistenceClassNotFoundException,
      FilePersistenceDataCorruptedException,
      FilePersistenceTooBigForSerializationException {
    final IDataAccessSession session = filePersistence
        .createDataAccessSession();
    ArrayExternalizable arrayExternalizable;
    session.open();
    arrayExternalizable = new ArrayExternalizable();
    Bob1[] bob1s = new Bob1[1];
    bob1s[0] = new Bob1();
    bob1s[0].setVal(10);
    arrayExternalizable.setArray(bob1s);
    session.setObject(KEY, arrayExternalizable);
    session.close(EnumFilePersistenceCloseAction.SAVE);

    session.open();
    arrayExternalizable = (ArrayExternalizable) session.getObject(KEY);
    bob1s = (Bob1[]) arrayExternalizable.getArray();
    assertEquals("bad value", 10, bob1s[0].getVal());
  }
View Full Code Here

Examples of net.sf.joafip.service.IDataAccessSession

    final ForThisTest forThisTest = new ForThisTest(bob1s, bob1);
    assertEquals("bad value", 15,
        ((Bob1) forThisTest.getObject1()).getVal());
    assertEquals("bad value", 20,
        ((Bob1) forThisTest.getObject2()).getVal());
    final IDataAccessSession session = filePersistence
        .createDataAccessSession();
    session.open();
    session.setObject(KEY, forThisTest);
    session.close(EnumFilePersistenceCloseAction.SAVE);
  }
View Full Code Here

Examples of net.sf.joafip.service.IDataAccessSession

      FilePersistenceNotSerializableException,
      FilePersistenceTooBigForSerializationException, TestException {
    final IFilePersistence filePersistence = newFilePersistence(
    /**/false/* cache disk */,
    /**/false/* crash safe mode */);
    final IDataAccessSession session = filePersistence
        .createDataAccessSession();
    session.open();
    assertTrue(SESION_MUST_BE_OPENED, session.isOpened());// just for PMD
    // warning
    session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
    filePersistence.close();
  }
View Full Code Here

Examples of net.sf.joafip.service.IDataAccessSession

      FilePersistenceNotSerializableException,
      FilePersistenceTooBigForSerializationException, TestException {// NOPMD
    final IFilePersistence filePersistence = newFilePersistence(
    /**/true/* cache disk */,
    /**/false/* crash safe mode */);
    final IDataAccessSession session = filePersistence
        .createDataAccessSession();
    session.open();
    assertTrue(SESION_MUST_BE_OPENED, session.isOpened());// just for PMD
    // warning
    session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
    filePersistence.close();
  }
View Full Code Here

Examples of net.sf.joafip.service.IDataAccessSession

      FilePersistenceNotSerializableException,
      FilePersistenceTooBigForSerializationException, TestException {// NOPMD
    final IFilePersistence filePersistence = newFilePersistence(
    /**/false/* cache disk */,
    /**/true/* crash safe mode */);
    final IDataAccessSession session = filePersistence
        .createDataAccessSession();
    session.open();
    assertTrue(SESION_MUST_BE_OPENED, session.isOpened());// just for PMD
    // warning
    session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
    filePersistence.close();
  }
View Full Code Here

Examples of net.sf.joafip.service.IDataAccessSession

      FilePersistenceDataCorruptedException,
      FilePersistenceTooBigForSerializationException, TestException {// NOPMD
    final IFilePersistence filePersistence = newFilePersistence(
    /**/true/* cache disk */,
    /**/true/* crash safe mode */);
    final IDataAccessSession session = filePersistence
        .createDataAccessSession();
    session.open();
    assertTrue(SESION_MUST_BE_OPENED, session.isOpened());// just for PMD
    // warning
    session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
    filePersistence.close();
  }
View Full Code Here

Examples of net.sf.joafip.service.IDataAccessSession

      FilePersistenceInvalidClassException,
      FilePersistenceDataCorruptedException,
      FilePersistenceNotSerializableException,
      FilePersistenceTooBigForSerializationException {

    final IDataAccessSession dataAccessSession = filePersistence
        .createDataAccessSession();

    dataAccessSession.open();
    dataAccessSession.closeAndWait(EnumFilePersistenceCloseAction.SAVE);

    dataAccessSession.open();
    dataAccessSession.closeAndWait(EnumFilePersistenceCloseAction.SAVE);

    dataAccessSession.open();
    dataAccessSession.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
  }
View Full Code Here

Examples of net.sf.joafip.service.IDataAccessSession

      FilePersistenceNotSerializableException,
      FilePersistenceTooBigForSerializationException {
    filePersistence.addToNotCheckMethod(Bob1.class);
    final Object keptInMemoryObject = new Object();
    filePersistence.keptInMemory("object", keptInMemoryObject);
    final IDataAccessSession dataAccessSession = filePersistence
        .createDataAccessSession();

    BobContainer bobContainer1 = new BobContainer();
    bobContainer1.setObject1(keptInMemoryObject);
    final Bob1 bob1 = new Bob1();
    bob1.setVal(10);
    bobContainer1.setObject2(bob1);
    BobContainer bobContainer2 = new BobContainer();
    bobContainer2.setObject1(keptInMemoryObject);
    dataAccessSession.open();
    dataAccessSession.setObject(KEY1, bobContainer1);
    dataAccessSession.setObject(KEY2, bobContainer2);
    dataAccessSession.close(EnumFilePersistenceCloseAction.SAVE);

    dataAccessSession.open();
    bobContainer1 = (BobContainer) dataAccessSession.getObject(KEY1);
    assertSame(MUST_BE_SAME_INSTANCE, keptInMemoryObject,
        bobContainer1.getObject1());
    final Bob1 bob1Read = (Bob1) bobContainer1.getObject2();
    assertNotSame("must no be same object", bob1, bob1Read);
    bobContainer2 = (BobContainer) dataAccessSession.getObject(KEY2);
    assertSame(MUST_BE_SAME_INSTANCE, keptInMemoryObject,
        bobContainer2.getObject1());
  }
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.