Package org.prevayler.foundation.serialization

Examples of org.prevayler.foundation.serialization.JavaSerializer


  }


  private Serializer journalSerializer() {
    if (_journalSerializer != null) return _journalSerializer;
    return new JavaSerializer();
  }
View Full Code Here


    PrevaylerDirectory directory = new PrevaylerDirectory(prevalenceDirectory());
    if (!_snapshotSerializers.isEmpty())
      return new GenericSnapshotManager<P>(_snapshotSerializers, _primarySnapshotSuffix, prevalentSystem(), directory, journalSerializer());

    String snapshotSuffix = "snapshot";
    JavaSerializer snapshotSerializer = new JavaSerializer();
    return new GenericSnapshotManager<P>(Collections.singletonMap(snapshotSuffix, snapshotSerializer), snapshotSuffix, prevalentSystem(), directory, journalSerializer());
  }
View Full Code Here

        : readSnapshot(latestSnapshot);
    _recoveredPrevalentSystem = new PrevalentSystemGuard<P>(recoveredPrevalentSystem, recoveredVersion, journalSerializer);
  }

  GenericSnapshotManager(P newPrevalentSystem) {
    _strategies = Collections.singletonMap("snapshot", new JavaSerializer());
    _primarySuffix = "snapshot";
    _directory = null;
    _recoveredPrevalentSystem = new PrevalentSystemGuard<P>(newPrevalentSystem, 0, new JavaSerializer());
  }
View Full Code Here

public class DeepCopierTest extends TestCase {

  public void testNormal() {
    Object original = "foo";
    Object copy = DeepCopier.deepCopy(original, new JavaSerializer());

    assertEquals(original, copy);
    assertNotSame(original, copy);
  }
View Full Code Here

    assertNotSame(original, copy);
  }

  public void testParallel() throws Exception {
    Object original = "foo";
    Object copy = DeepCopier.deepCopyParallel(original, new JavaSerializer());

    assertEquals(original, copy);
    assertNotSame(original, copy);
  }
View Full Code Here

  }

  public void testBadSuffix() {
    PrevaylerFactory factory = new PrevaylerFactory();
    try {
      factory.configureSnapshotSerializer("SNAPSHOT", new JavaSerializer());
      fail();
    } catch (IllegalArgumentException exception) {
      assertEquals("Snapshot filename suffix must match /[a-zA-Z0-9]*[Ss]napshot/, but 'SNAPSHOT' does not", exception.getMessage());
    }
  }
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

import java.io.IOException;

public class GenericSnapshotManagerTest extends FileIOTest {

  public void testNoExistingSnapshot() throws Exception {
    Prevayler<StringBuffer> prevayler = createPrevayler("snapshot", new JavaSerializer());
    assertEquals("initial", prevayler.prevalentSystem().toString());
  }
View Full Code Here

    Prevayler<StringBuffer> prevayler = createPrevayler("snapshot", new JavaSerializer());
    assertEquals("initial", prevayler.prevalentSystem().toString());
  }

  public void testRoundtripJava() throws Exception {
    checkRoundtrip("snapshot", new JavaSerializer());
  }
View Full Code Here

  public void testDetectExistingSnapshotFromUnknownSnapshotManager() throws Exception {
    Prevayler<StringBuffer> first = createPrevayler("xstreamsnapshot", new XStreamSerializer());
    appendTakeSnapshotAndClose(first);

    try {
      createPrevayler("snapshot", new JavaSerializer());
      fail();
    } catch (IOException e) {
      // This is good because if we only looked for .snapshot files we could silently ignore an existing snapshot.
      assertTrue("Actual message was <" + e.getMessage() + ">",
          e.getMessage().endsWith("0000000000000000002.xstreamsnapshot cannot be read; only [snapshot] supported"));
View Full Code Here

TOP

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

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.