Examples of Bob1


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

      NoSuchFieldException, IllegalArgumentException,
      IllegalAccessException, ObjectIOException, ClassInfoException {
    final ClassInfo classInfo = classInfoFactory
        .getNoProxyClassInfo(Bob1.class);
    final StorageInfo storageInfo = new StorageInfo();
    final Bob1 proxyObject = (Bob1) proxyManager2.newInstanceConstruct(
        classInfo, storageInfo, objectIOManager,
        DataRecordIdentifier.LAST, true);
    // below no more needed, new instance in loaded state since constructed
    // final IProxyCallBack proxy = (IProxyCallBack) proxyObject;
    // proxy.setLoaded$JOAFIP$(true);
    final Field fieldBob1 = Bob1.class.getDeclaredField("val");
    java.security.AccessController
        .doPrivileged(new java.security.PrivilegedAction<Object>() {
          @Override
          public Object run() {
            fieldBob1.setAccessible(true);
            return null;
          }
        });
    // no PMD want a new object
    fieldBob1.set(proxyObject, new Integer(0));// NOPMD
    assertEquals("bad field value", 0, proxyObject.getVal());
    fieldBob1.set(proxyObject, new Integer(10));// NOPMD
    assertEquals("bad field value", 10, proxyObject.getVal());
  }
View Full Code Here

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

    DataRecordIdentifier idc = store
        .getDataRecordIdentifierAssociatedToObject(bobContainer);
    assertNotNull(BOB_CONTAINER_MUST_HAVE_DATA_RECORD_IDENTIFIER, idc);
    assertObjectLink(BobContainer.class, idc, new DataRecordIdentifier[] {});

    Bob1 bob1 = new Bob1();
    bobContainer.setObject1(bob1);
    store.save(true, false);

    bobContainer = (BobContainer) store.readAndGetRoot();
    idc = store.getDataRecordIdentifierAssociatedToObject(bobContainer);
    assertNotNull(BOB_CONTAINER_MUST_HAVE_DATA_RECORD_IDENTIFIER, idc);
    bob1 = (Bob1) bobContainer.getObject1();
    assertNotNull("bobContainer must reference bob1", bob1);
    DataRecordIdentifier id1 = store
        .getDataRecordIdentifierAssociatedToObject(bob1);
    assertNotNull(BOB1_MUST_HAVE_DATA_RECORD_IDENTIFIER, id1);

    assertObjectLink(BobContainer.class, idc,
        new DataRecordIdentifier[] { id1 });

    bobContainer.setObject2(bob1);
    store.save(true, false);

    DATA_MANAGER_INTEGRITY_CHECKER.checkIntegrity(dataManager);

    bobContainer = (BobContainer) store.readAndGetRoot();
    idc = store.getDataRecordIdentifierAssociatedToObject(bobContainer);
    assertNotNull(BOB_CONTAINER_MUST_HAVE_DATA_RECORD_IDENTIFIER, idc);
    bob1 = (Bob1) bobContainer.getObject1();
    id1 = store.getDataRecordIdentifierAssociatedToObject(bob1);
    assertNotNull(BOB1_MUST_HAVE_DATA_RECORD_IDENTIFIER, id1);
    final Bob1 bob1Bis = (Bob1) bobContainer.getObject2();
    assertSame("bob1 must be uniq", bob1, bob1Bis);

    assertObjectLink(BobContainer.class, idc, new DataRecordIdentifier[] {
        id1, id1 });
View Full Code Here

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

    Object[] objects = bobObjectArray.getValues();
    assertNull("no values must be setted", objects);
    assertObjectLink(BobObjectArray.class, idObjectArray,
        new DataRecordIdentifier[] {});

    Bob1 bob1 = new Bob1();
    Bob2 bob2 = new Bob2();
    objects = new Object[] { bob1, bob2, bob1 };
    bobObjectArray.setValues(objects);
    store.save(true, false);
    DATA_MANAGER_INTEGRITY_CHECKER.checkIntegrity(dataManager);

    bobObjectArray = (BobObjectArray) store.readAndGetRoot();
    idObjectArray = store
        .getDataRecordIdentifierAssociatedToObject(bobObjectArray);
    assertNotNull("bobObjectArray must have data record identifier",
        idObjectArray);
    objects = bobObjectArray.getValues();
    assertNotNull("values be setted", objects);
    final DataRecordIdentifier idArray = store
        .getDataRecordIdentifierAssociatedToObject(objects);
    assertNotNull("array must have data record identifier", idArray);
    bob1 = (Bob1) objects[0];
    final DataRecordIdentifier id1 = store
        .getDataRecordIdentifierAssociatedToObject(bob1);
    assertNotNull(BOB1_MUST_HAVE_DATA_RECORD_IDENTIFIER, id1);
    bob2 = (Bob2) objects[1];
    final DataRecordIdentifier id2 = store
        .getDataRecordIdentifierAssociatedToObject(bob2);
    assertNotNull(BOB2_MUST_HAVE_DATA_RECORD_IDENTIFIER, id2);
    final Bob1 bob1Bis = (Bob1) objects[2];
    assertSame("bob1 must be uniq", bob1, bob1Bis);

    assertObjectLink(BobObjectArray.class, idObjectArray,
        new DataRecordIdentifier[] { idArray });
    assertObjectLink(objects.getClass(), idArray,
View Full Code Here

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

    assertNotNull("enum must have data record identifier", idEnum);

    assertObjectLink(BobContainer.class, idc,
        new DataRecordIdentifier[] { idEnum });

    Bob1 bob1 = new Bob1();
    enumForTest.setObject(bob1);
    store.save(true, false);

    DATA_MANAGER_INTEGRITY_CHECKER.checkIntegrity(dataManager);
View Full Code Here

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

  public void testLoad() throws ObjectIOException, ProxyException,
      ObjectIOInvalidClassException, ObjectIONotSerializableException,
      ObjectIOClassNotFoundException, ObjectIODataCorruptedException,
      ObjectIODataRecordNotFoundException, ClassInfoException,
      ObjectIOTooBigForSerializationException {
    final Bob1 bob1 = new Bob1();
    bob1.setVal(10);
    final ClassInfo bob1ClassInfo = classInfoFactory
        .getNoProxyClassInfo(Bob1.class);
    // FIXMELUC ___must use objectStateMap as factory
    // final ObjectAndPersistInfo objectAndItsClassInfo = new
    // ObjectAndPersistInfo(
View Full Code Here

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

      StoreNotSerializableException, StoreClassNotFoundException,
      StoreDataCorruptedException, ProxyException, SecurityException,
      NoSuchFieldException, IllegalArgumentException,
      IllegalAccessException, ObjectIOException,
      ObjectIOInvalidClassException, StoreTooBigForSerializationException {
    Bob1 rootBob1 = new Bob1();
    storeForTest.setRoot(rootBob1);
    rootBob1.setBob1(new Bob1());
    // use storeForTest.newInstance(Bob2.class) because rootBob1 will be
    // never unreferenced
    // Bob2 bob2RefByRootBob1 = new Bob2();
    Bob2 bob2RefByRootBob1 = (Bob2) storeForTest.newInstance(Bob2.class);
    Bob3 bob3RefByBob2RefByRootBob1 = new Bob3();
    bob2RefByRootBob1.setBob3(bob3RefByBob2RefByRootBob1);
    rootBob1.setBob2(bob2RefByRootBob1);
    rootBob1.setBob3(new Bob3());
    rootBob1 = null;// NOPMD want to unreference
    // save not for close
    storeForTest.save(false, false);
    final ObjectAndPersistInfo opiBob3 = storeForTest
        .getObjectAndPersistInfoOfObjectFromQueue(bob3RefByBob2RefByRootBob1);
    assertTrue("must be weaked", opiBob3.isWeak());
    bob2RefByRootBob1 = null;// NOPMD want to unreference
    rootBob1 = null;// NOPMD want to unreference
    bob3RefByBob2RefByRootBob1 = null;// NOPMD want to unreference
    storeForTest.save(false, false);
    assertTrue("must be weaked", opiBob3.isWeak());
    MemoryEater.useAllMemoryThenRelease();
    assertTrue("must be free", opiBob3.hasNoReferences());

    rootBob1 = (Bob1) storeForTest.readAndGetRoot();
    assertNotNull("must be set", rootBob1.getBob1());// NOPMD
    bob2RefByRootBob1 = rootBob1.getBob2();
    assertNotNull("must be set", bob2RefByRootBob1);
    assertNotNull("must be set", rootBob1.getBob3());
    // not below assert because load bob2RefByRootBob1
    // assertNotNull("must be set", bob2RefByRootBob1.getBob3());

    // test can not work with bob1 because read of root record
    // assertTrue("must be a proxy: "+bob1.getClass(),
View Full Code Here

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

      StoreTooBigForSerializationException {
    /*
     * 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);
    store.save(true, false);
    logger.debug("initial save");

    /*
     * assert garbage information after initial creation
     */
    logReferenceLink();
    int numberOfLinkRecord = linkRecordManager.getNumberOfLinkRecord();
    /* no link record created */
    assertEquals("0 link record expected", 0, numberOfLinkRecord);

    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);

    logAllDataIdentifier();
    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);

View Full Code Here

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

        .getNoProxyClassInfo(objectClass);
    final StorageInfo storageInfo = new StorageInfo();
    final ClassLoaderProvider classLoaderProvider = new ClassLoaderProvider();
    final ProxyManager2 proxyManager2 = new ProxyManager2(
        classLoaderProvider, classInfoFactory);
    final Bob1 bob1 = (Bob1) proxyManager2.newInstanceNoConstruction(
        classInfo, storageInfo, this, DataRecordIdentifier.LAST, true)
        .getObject();
    assertNull("must not intercept bob1 method call", intercepted);
    final Bob1 bob1bis = (Bob1) proxyManager2.newInstanceNoConstruction(
        classInfo, storageInfo, this, DataRecordIdentifier.LAST, true)
        .getObject();
    assertNull("must not intercept bob1bis method call", intercepted);
    bob1.setBob1(bob1bis);
    assertSame("must intercept bob1 method call", bob1, intercepted);
View Full Code Here

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

  }

  @Override
  protected Object[] modifyObjectToSerialize(final Object object) {
    final BobWithSerializeMethod bobWithSerializeMethod = (BobWithSerializeMethod) object;
    bobWithSerializeMethod.setObject2(new Bob1());
    return new Object[] { bobWithSerializeMethod.getObject1(),
        bobWithSerializeMethod.getObject2() };
  }
View Full Code Here

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

  @Override
  protected Object[] modifyObjectToSerialize(final Object object) {
    final BobWithSerialPersistentFieldsUnshared bobWithSerialPersistentFieldsUnshared =
    /**/(BobWithSerialPersistentFieldsUnshared) object;
    bobWithSerialPersistentFieldsUnshared.setField1(new Bob1());
    return new Object[] {
        bobWithSerialPersistentFieldsUnshared.getField1(),
        bobWithSerialPersistentFieldsUnshared.getField2() };
  }
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.