Examples of Bob2


Examples of net.sf.joafip.store.service.objectfortest.Bob2

      // NOPMD
      throws StoreException, StoreInvalidClassException,
      StoreNotSerializableException, StoreClassNotFoundException,
      StoreDataCorruptedException, StoreTooBigForSerializationException {
    final Bob1 bob1 = new Bob1();
    final Bob2 bob2 = new Bob2();
    final Bob3 bob3 = new Bob3();
    bob1.setBob3(bob3);
    bob1.setBob2(bob2);
    bob2.setBob3(bob3);
    store.setRoot(bob1);
    store.save(true, false);

    final Bob1 bob1Lu = (Bob1) store.readAndGetRoot();
    final Bob2 bob2Lu = bob1Lu.getBob2();
    bob2Lu.setBob3(null);
    store.save(true, false);
    assertNotNull(ROOT_MUST_BE_DEFINED, store.readAndGetRoot());// for
    // PMD
    // warning
  }
View Full Code Here

Examples of net.sf.joafip.store.service.objectfortest.Bob2

    bob1 = new Bob1();
    bob1.setVal(2);
    source.put("b", bob1);
    bob1 = new Bob1();
    bob1.setVal(3);
    Bob2 bob2 = new Bob2();
    bob2.setBob1(bob1);
    bob2.setVal(111);
    bob1.setBob2(bob2);
    source.put("c", bob1);

    final Object copy = DeepCopier.getInstance().deepCopy(source, this,
        true);

    assertEquals("must be equals", source, copy);

    final Map<String, Bob1> mapCopy = (Map<String, Bob1>) copy;
    bob1 = mapCopy.get("a");
    assertNotNull("entry for 'a' must exist", bob1);
    assertEquals(BAD_VALUE, 1, bob1.getVal());

    bob1 = mapCopy.get("b");
    assertNotNull("entry for 'b' must exist", bob1);
    assertEquals(BAD_VALUE, 2, bob1.getVal());

    bob1 = mapCopy.get("c");
    assertNotNull("entry for 'c' must exist", bob1);
    assertEquals(BAD_VALUE, 3, bob1.getVal());
    bob2 = bob1.getBob2();
    assertEquals(BAD_VALUE, 111, bob2.getVal());
    final Bob1 bob1FromBob2 = bob2.getBob1();
    assertSame("must be same object", bob1, bob1FromBob2);
  }
View Full Code Here

Examples of net.sf.joafip.store.service.objectfortest.Bob2

      StoreInvalidClassException, StoreNotSerializableException,
      StoreClassNotFoundException, StoreDataCorruptedException,
      HeapException, StoreTooBigForSerializationException {
    logger.info("testReadObjectSetDataRecord");
    final Bob1 bob1 = new Bob1();
    Bob2 bob2 = new Bob2();
    bob1.setBob2(bob2);
    bob2.setVal(10);
    store.setRoot(bob1);
    store.save(true, false);

    // store.checkIntegrity();
    DATA_MANAGER_INTEGRITY_CHECKER.checkIntegrity(dataManager);
    final Bob1 rootObject = (Bob1) store.readAndGetRoot();
    assertNotNull(MUST_HAVE_ROOT, rootObject);
    bob2 = rootObject.getBob2();
    assertNotNull("root object must have bob2 set", bob2);
    /* force bob 2 loading if lazy mode */
    assertEquals("bob2 value must be 10", 10, bob2.getVal());
  }
View Full Code Here

Examples of net.sf.joafip.store.service.objectfortest.Bob2

      StoreInvalidClassException, StoreNotSerializableException,
      StoreClassNotFoundException, StoreDataCorruptedException,
      StoreTooBigForSerializationException {
    Bob1 bob1 = new Bob1();
    bob1.setVal(0);
    Bob2 bob2 = new Bob2();
    bob1.setBob2(bob2);
    bob2.setVal(0);
    store.setRoot(bob1);
    store.save(true, false);

    bob1 = (Bob1) store.readAndGetRoot();
    bob1.setVal(1);
    bob2.setVal(1);
    store.doNotSave();

    bob1 = (Bob1) store.readAndGetRoot();
    assertEquals("bob1 value must be unchanged", 0, bob1.getVal());
    bob2 = bob1.getBob2();
    assertEquals("bob2 value must be unchanged", 0, bob2.getVal());
  }
View Full Code Here

Examples of net.sf.joafip.store.service.objectfortest.Bob2

  }

  @Override
  public Bob2 getBob2() {
    intercept$JOAFIP$();
    final Bob2 bob22 = super.getBob2();
    methodEnd$JOAFIP$();
    return bob22;
  }
View Full Code Here

Examples of net.sf.joafip.store.service.objectfortest.Bob2

    assertTrue("must be a proxy", ProxyManager2.isProxyOrEnhanced(bob1));
    assertFalse("must not be loaded",
        ProxyManager2.proxiedObjectIsLoaded(bob1));
    assertFalse("must not change", saveDoneFlag);// check proxy manager not
    // alter state
    bob1.setBob2(new Bob2());// must trigger auto save
    assertTrue(MUST_SAVE, saveDoneFlag);
    // assert not loaded, not loaded because of auto save
    assertFalse("must not be loaded",
        ProxyManager2.proxiedObjectIsLoaded(bob1));

    Bob2 bob2 = bob1.getBob2();
    assertFalse("must not be a proxy " + bob2.toString(),
        ProxyManager2.isProxyOrEnhanced(bob2));
    // bob2 = null;// NOPMD
    /* save to erase bob2 persistence state => bob2 no more referenced */
    session.save();
    final ObjectAndPersistInfo opiBob2 = filePersistence
View Full Code Here

Examples of net.sf.joafip.store.service.objectfortest.Bob2

  private BobContainer initialBobContainer() throws FilePersistenceException {
    final BobContainer bobContainer = new BobContainer();
    final Bob1 bob1 = new Bob1();
    bob1.setVal(1);
    bobContainer.setObject1(bob1);
    final Bob2 bob2 = new Bob2();
    bob2.setVal(1);
    bobContainer.setObject2(bob2);
    return (BobContainer) filePersistence.newProxyInstance(bobContainer);
  }
View Full Code Here

Examples of net.sf.joafip.store.service.objectfortest.Bob2

    builder.setCrashSafeMode(false);
    final IFilePersistence filePersistence = builder.build();

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

    final IDataAccessSession session = filePersistence
        .createDataAccessSession();
View Full Code Here

Examples of net.sf.joafip.store.service.objectfortest.Bob2

     * creation of object graph
     */
    BobContainer bobContainer = new BobContainer();
    Bob1 bob1 = new Bob1();
    bobContainer.setObject1(bob1);
    Bob2 bob2 = new Bob2();
    bob1.setBob2(bob2);
    store.setRoot(bobContainer);
    logger.debug("initial save");
    store.save(false, false);
    logAllDataIdentifier();
View Full Code Here

Examples of net.sf.joafip.store.service.objectfortest.Bob2

     * creation of object graph with a cycle
     */
    BobContainer bobContainer = new BobContainer();
    Bob1 bob1 = new Bob1();
    bobContainer.setObject1(bob1);
    Bob2 bob2 = new Bob2();
    bob1.setBob2(bob2);
    Bob3 bob3 = new Bob3();
    bob2.setBob3(bob3);
    bob3.setBob1(bob1);
    store.setRoot(bobContainer);
    logger.debug("initial save");
    store.save(false, false);
    Map<DataRecordIdentifier, String> map = objectClassMap(new DataRecordIdentifier[] {});
    objectIoManager.clearObjectState();
    final String links1 = links(map);
    // logAllDataIdentifier();
    // objectIoManager.clearObjectState();
    // heapRecordableManager.clear();

    /*
     * assert garbage information after initial creation
     */
    String expectedLinks = sortString(
    /**/"StoreRoot4 -> BobContainer\n" +
    /**/"BobContainer -> Bob1\n" +
    /**/"Bob1 -> Bob2\n" +
    /**/"Bob2 -> Bob3\n" +
    /**/"Bob3 -> Bob1\n");

    assertEquals("not expected link", expectedLinks, links1);

    int numberToGarbage = toGarbageRecordManager.getNumberOfToGarbage();
    assertEquals("must not have object to garbage", 0, numberToGarbage);

    int numberOfGarbageCandidate = garbageCandidateRecordManager
        .getNumberOfGarbageCandidate();
    assertEquals(MUST_NOT_HAVE_OBJECT_MARKED_GARBAGE_CANDIDATE, 0,
        numberOfGarbageCandidate);

    final int initialNumberOfDataRecord = dataManager
        .getNumberOfDataRecord();

    /*
     * read, check data record identifier, detach object, save
     */
    bobContainer = (BobContainer) store.readAndGetRoot();
    final DataRecordIdentifier idBobContainer = store
        .getDataRecordIdentifierAssociatedToObject(bobContainer);
    logger.debug("id bob container " + idBobContainer);
    assertNotNull("bobContainer must have associated data record",
        idBobContainer);

    bob1 = (Bob1) bobContainer.getObject1();
    final DataRecordIdentifier idBob1 = store
        .getDataRecordIdentifierAssociatedToObject(bob1);
    logger.debug("id bob1 " + idBob1);
    assertNotNull("bob1 must have associated data record", idBob1);

    bob2 = bob1.getBob2();
    final DataRecordIdentifier idBob2 = store
        .getDataRecordIdentifierAssociatedToObject(bob2);
    logger.debug("id bob2 " + idBob2);
    assertNotNull("bob2 must have associated data record", idBob2);

    bob3 = bob2.getBob3();
    final DataRecordIdentifier idBob3 = store
        .getDataRecordIdentifierAssociatedToObject(bob3);
    logger.debug("id bob3 " + idBob3);
    assertNotNull("bob3 must have associated data record", idBob3);

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.