Examples of BobForExport


Examples of net.sf.joafip.entity.BobForExport

      StoreDataCorruptedException, StoreNotSerializableException {
    if (stackSize(0) > 500) {
      smallStackTestExportObject();
    } else {
      final XmlExporter xmlExporter = new XmlExporter(store);
      final BobForExport bobForExport = new BobForExport();
      final List<Integer> list = new LinkedList<Integer>();
      for (int value = 0; value < 1000; value++) {
        list.add(value);
      }
      bobForExport.setObject(list);
      xmlExporter.export(RUNTIME, RUNTIME + "/tmp", bobForExport);
    }
  }
View Full Code Here

Examples of net.sf.joafip.entity.BobForExport

      return bobKey1.getValue() - bobKey2.getValue();
    }
  }

  public void testNewBobForExport() {// NOPMD
    new BobForExport();
  }
View Full Code Here

Examples of net.sf.joafip.entity.BobForExport

        .createDataAccessSession();

    /*
     * create object to persist
     */
    final BobForExport bobForExport = createObjectForExport();

    /*
     * persist
     */

    dataAccessSession.open();
    dataAccessSession.setObject("bob", bobForExport);
    dataAccessSession.close(EnumFilePersistenceCloseAction.SAVE);

    assertEquals("", 'a', bobForExport.getCharValue());

    /*
     * export
     */

    filePersistence.xmlExport(RUNTIME, RUNTIME + "/tmp", true);

    assertEquals("", 'a', bobForExport.getCharValue());

    /*
     * Forbidden import
     */
    try {
      filePersistence.xmlImport(RUNTIME, true);
      fail("must fail");// NOPMD
    } catch (final FilePersistenceException exception) {// NOPMD
      // expected
      if (!"have stored object, not empty".equals(exception.getMessage())) {
        // failure
        throw exception;
      }
    }
    filePersistence.close();

    assertEquals("", 'a', bobForExport.getCharValue());

    /*
     * test import
     */
    // filePersistence = new FilePersistence(1, null, RUNTIME, true, false);
    final FilePersistenceBuilder builder = new FilePersistenceBuilder();
    builder.setPathName(TestConstant.getWinRamDiskRuntimeDir());
    builder.setFileAccessMode(EnumFileAccessMode.MAPPED_RANDOM_FILE_ACCESS);
    builder.setMaxBufferSize(8 * 1024);
    builder.setMaxNumberOfBuffer(32);
    builder.setProxyMode(true);
    builder.setRemoveFiles(true);
    builder.setGarbageManagement(false);
    builder.setCrashSafeMode(false);
    filePersistence = builder.build();
    filePersistence.setSubstitutionOfJavaUtilCollection(true);
    filePersistence.storedMutableEnum(EnumForTest.class);

    HelperFileUtil.getInstance().copyFile(new File("runtime/export.xml"),
        new File("runtime/tmp/export.xml"));

    /* import */

    filePersistence.xmlImport(RUNTIME, true);

    assertEquals("", 'a', bobForExport.getCharValue());

    /* do an export to visit all object graph in store */

    filePersistence.xmlExport("runtime2", "runtime2", false);

    assertEquals("", 'a', bobForExport.getCharValue());

    dataAccessSession = filePersistence.createDataAccessSession();

    dataAccessSession.open();
    final BobForExport bobForExportRead = (BobForExport) dataAccessSession
        .getObject("bob");

    assertEquals("", 'a', bobForExport.getCharValue());
    assertEquals("", 'a', bobForExportRead.getCharValue());

    assertEquals("bad read value", bobForExport.toString(),
        bobForExportRead.toString());
    assertEquals("bad read value", bobForExport, bobForExportRead);

    dataAccessSession.close(EnumFilePersistenceCloseAction.DO_NOT_SAVE);
    filePersistence.close();
  }
View Full Code Here

Examples of net.sf.joafip.entity.BobForExport

    dataAccessSession.close(EnumFilePersistenceCloseAction.DO_NOT_SAVE);
    filePersistence.close();
  }

  private BobForExport createObjectForExport() {
    final BobForExport bobForExport;
    bobForExport = new BobForExport();
    bobForExport.setByteValue((byte) 1);
    bobForExport.setByteValue2(Byte.valueOf((byte) 2));
    bobForExport.setShortValue((short) 3); // NOPMD
    bobForExport.setShortValue(Short.valueOf((short) 4)); // NOPMD
    bobForExport.setIntValue(5);
    bobForExport.setIntValue2(Integer.valueOf(6));
    bobForExport.setLongValue(7);
    bobForExport.setLongValue2(Long.valueOf(7));
    bobForExport.setCharValue('a');
    bobForExport.setCharValue2(Character.valueOf('b'));
    bobForExport.setFloatValue((float) 8.1);
    bobForExport.setFloatValue2(Float.valueOf((float) 9.2));
    bobForExport.setDoubleValue(10.3);
    bobForExport.setDoubleValue2(11.4);
    final int[] intArray = new int[] { 12, 13 };
    bobForExport.setIntArray(intArray);
    final BobForExport bobForExport2 = new BobForExport();
    bobForExport2.setStringValue("\0");
    final BobForExport[] bobForExportArray = new BobForExport[] { null,
        bobForExport2 };
    bobForExport.setBobForExportArray(bobForExportArray);
    bobForExport.setStringValue("hello");
    bobForExport.setEnumForTest(EnumForTest.VAL1);
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.