Package org.prevayler.foundation.serialization

Examples of org.prevayler.foundation.serialization.Serializer


  private P readSnapshot(File snapshotFile) throws Exception {
    String suffix = snapshotFile.getName().substring(snapshotFile.getName().indexOf('.') + 1);
    if (!_strategies.containsKey(suffix)) throw new IOException(
        snapshotFile.toString() + " cannot be read; only " + _strategies.keySet().toString() + " supported");

    Serializer serializer = (Serializer) _strategies.get(suffix);
    FileInputStream in = new FileInputStream(snapshotFile);
    try {
      return (P) (serializer.readObject(in));
    } finally {
      in.close();
    }
  }
View Full Code Here


  }

  public void testParallelPathological() throws Exception {
    Object original = new Byte((byte) 17);

    Object copy = DeepCopier.deepCopyParallel(original, new Serializer() {

      public void writeObject(OutputStream stream, Object object) throws Exception {
        stream.write(((Byte) object).byteValue());
        stream.flush();
View Full Code Here

import java.io.*;

public class SnapshotSerializerTest extends FileIOTest {

  public void testConfigureSnapshotSerializer() throws Exception {
    Serializer serializer = new MySerializer();

    takeSnapshot(serializer);

    assertEquals("Yes, this is MySerializationStrategy!\n" +
        "the system first second third\n", snapshotContents());
View Full Code Here

      assertEquals("Snapshot filename suffix must match /[a-zA-Z0-9]*[Ss]napshot/, but 'SNAPSHOT' does not", exception.getMessage());
    }
  }

  public void testXStreamSnapshot() throws Exception {
    Serializer serializer = new XStreamSerializer();

    takeSnapshot(serializer);
    recover(serializer);
  }
View Full Code Here

import org.prevayler.foundation.serialization.XStreamSerializer;

public class TransactionWithQueryTest extends FileIOTest {

  public void testJavaJournal() throws Exception {
    Serializer strategy = new JavaSerializer();

    startAndCrash(strategy);
    recover(strategy);
  }
View Full Code Here

    startAndCrash(strategy);
    recover(strategy);
  }

  public void testXStreamJournal() throws Exception {
    Serializer strategy = new XStreamSerializer();

    startAndCrash(strategy);
    recover(strategy);
  }
View Full Code Here

TOP

Related Classes of org.prevayler.foundation.serialization.Serializer

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.