Package net.sf.joafip.store.service.objectfortest

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();
    assertTrue("must be a proxy", ProxyManager2.isProxyOrEnhanced(bob1));
    assertNull("must not intercept bob1 method call", intercepted);
    final Bob1 bob1bis = (Bob1) proxyManager2.newInstanceNoConstruction(
        classInfo, storageInfo, this, null, false).getObject();
    assertTrue("must be a proxy", ProxyManager2.isProxyOrEnhanced(bob1bis));
    assertNull("must not intercept bob1bis method call", intercepted);
    bob1.setBob1(bob1bis);
    assertSame("must intercept bob1 method call", bob1, intercepted);
View Full Code Here


  public void testBob1() throws StoreException, StoreInvalidClassException,
      StoreNotSerializableException, StoreClassNotFoundException,
      StoreDataCorruptedException, HeapException,
      StoreTooBigForSerializationException {
    logger.debug("testBob1");
    Bob1 bob1 = new Bob1();
    bob1.setVal(0);
    store.setRoot(bob1);
    store.save(true, false);
    assertEquals("no more object state expected", 0,
        store.getNumberOfObjectState());
    bob1 = (Bob1) store.readAndGetRoot();
    final Bob2 bob2 = new Bob2();
    bob1.setBob2(bob2);
    bob2.setVal(1);
    final Bob3 bob3 = new Bob3();
    bob3.setVal(2);
    bob2.setBob3(bob3);
View Full Code Here

  public void testBob1PostModif() throws StoreException,
      StoreInvalidClassException, StoreNotSerializableException,
      StoreClassNotFoundException, StoreDataCorruptedException,
      HeapException, StoreTooBigForSerializationException {
    logger.debug("testBob1PostModif");
    final Bob1 bob1 = new Bob1();
    bob1.setVal(0);
    store.setRoot(bob1);
    store.save(true, false);
    // store.checkIntegrity();
    DATA_MANAGER_INTEGRITY_CHECKER.checkIntegrity(dataManager);

    final Bob1 bob1Lu = (Bob1) store.readAndGetRoot();
    assertNotNull(MUST_FIND_OBJECT, bob1Lu);

    final Bob2 bob2 = new Bob2();
    bob1Lu.setBob2(bob2);
    bob2.setVal(1);
    final Bob3 bob3 = new Bob3();
    bob3.setVal(2);
    bob2.setBob3(bob3);
View Full Code Here

   */
  private void assertLuOk(final Bob2 bob2, final Bob3 bob3)
      throws StoreException, StoreInvalidClassException,
      StoreNotSerializableException, StoreClassNotFoundException,
      StoreDataCorruptedException {
    Bob1 bob1Lu;
    bob1Lu = (Bob1) store.readAndGetRoot();
    assertNotNull(MUST_FIND_OBJECT, bob1Lu);
    final Bob2 bob2Lu = bob1Lu.getBob2();
    assertNotNull("read bob1 must contains bob2", bob2Lu);
    assertNotSame("read bob2 must be a copy", bob2, bob2Lu);
    assertEquals(BAD_VALUE, 1, bob2.getVal());
    final Bob3 bob3Lu = bob2Lu.getBob3();
    assertNotNull("read bob2 must contains bob3", bob3Lu);
View Full Code Here

  public void testLazyLoad() throws StoreException,
      StoreInvalidClassException, StoreNotSerializableException,
      StoreClassNotFoundException, StoreDataCorruptedException,
      HeapException, StoreTooBigForSerializationException {
    final Bob1 bob1 = new Bob1();
    bob1.setVal(0);
    final Bob2 bob2 = new Bob2();
    bob1.setBob2(bob2);
    bob2.setVal(1);
    final Bob3 bob3 = new Bob3();
    bob2.setBob3(bob3);
    bob3.setVal(2);
    bob3.setBob1(bob1);
    bob3.setBob2(bob2);
    store.setRoot(bob1);
    store.save(true, false);
    // store.checkIntegrity();
    DATA_MANAGER_INTEGRITY_CHECKER.checkIntegrity(dataManager);

    final Bob1 bob1Lu = (Bob1) store.readAndGetRoot();
    assertNotNull(MUST_FIND_OBJECT, bob1Lu);
    final Bob2 Bob2Lu = bob1Lu.getBob2();
    /* Bob2Lu.getVal() should load object */
    assertEquals("read bob2 value must be 1", 1, Bob2Lu.getVal());
    final Bob3 bob3Lu = Bob2Lu.getBob3();
    assertEquals("read bob3 value must be 2", 2, bob3Lu.getVal());
    assertSame("must be same object", bob1Lu, bob3Lu.getBob1());
View Full Code Here

  public void testAlreadyLoaded() throws StoreException,
      StoreInvalidClassException, StoreNotSerializableException,
      StoreClassNotFoundException, StoreDataCorruptedException,
      HeapException, StoreTooBigForSerializationException {
    final Bob1 bob1 = new Bob1();
    final Bob2 bob2 = new Bob2();
    final Bob3 bob3 = new Bob3();
    bob1.setBob2(bob2);
    bob1.setBob3(bob3);
    bob2.setBob3(bob3);

    bob1.setVal(1);
    bob2.setVal(2);
    bob3.setVal(3);

    store.setRoot(bob1);
    store.save(true, false);
    // store.checkIntegrity();
    DATA_MANAGER_INTEGRITY_CHECKER.checkIntegrity(dataManager);

    final Bob1 bob1Lu = (Bob1) store.readAndGetRoot();
    assertNotNull(MUST_FIND_OBJECT, bob1Lu);
    final Bob3 bob3Lu = bob1Lu.getBob3();
    final Bob2 bob2Lu = bob1Lu.getBob2();
    final Bob3 bob3LuBis = bob2Lu.getBob3();
    assertEquals("value for read bob1 must be 1", 1, bob1Lu.getVal());
    assertEquals("value for read bob2 must be 2", 2, bob2Lu.getVal());
    assertEquals("value for read bob3 must be 3", 3, bob3Lu.getVal());
    assertEquals("value for second read of bob3 must be 3", 3,
        bob3LuBis.getVal());
    bob3Lu.setVal(0);
View Full Code Here

   */
  @SuppressWarnings("PMD")
  public void testObjectCycle() throws StoreException,
      StoreInvalidClassException, StoreNotSerializableException,
      StoreClassNotFoundException, StoreDataCorruptedException {
    final Bob1 bob1 = new Bob1();
    final Bob2 bob2 = new Bob2();
    bob2.setBob1(bob1);
    bob1.setBob2(bob2);
    final Bob3 bob3 = new Bob3();
    bob3.setBob1(bob1);
    bob3.setBob2(bob2);
    store.setRoot(bob1);
  }
View Full Code Here

   */
  public void testAddLink() 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);
    store.setRoot(bob1);
    store.save(true, false);

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

  public void testRemoveLink()
      // 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

  }

  @SuppressWarnings("unchecked")
  public void testDeepCopyWithHashMap() throws CopierException {
    final HashMap<String, Bob1> source = new HashMap<String, Bob1>();
    Bob1 bob1 = new Bob1();
    bob1.setVal(1);
    source.put("a", bob1);
    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

TOP

Related Classes of net.sf.joafip.store.service.objectfortest.Bob1

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.