Exemple #1
0
  @Test
  public void canValidateBackUp() {
    Snapshot backUp = Fixture.createSnapshot();

    assertValid(backUp);
    // make member first name invalid.
    backUp.getMembers().get(3).setFirstName("");
    assertInvalid(backUp, "members[3].firstName");
  }
Exemple #2
0
 @Test
 public void canPopulateEntityManagerFromSnapshot() throws Exception {
   EntityManager manager = createEntityManager();
   Snapshot source = Fixture.createSnapshot();
   manager.getTransaction().begin();
   source.persistTo(manager);
   manager.flush();
   manager.getTransaction().commit();
   assertDataAsExpected("backup.dbunit.xml");
 }
Exemple #3
0
  @Test
  public void canExportXml() throws JAXBException, IOException {
    Snapshot backUp = Fixture.createSnapshot();
    JAXBContext context = JAXBContext.newInstance(getClass().getPackage().getName());

    Marshaller marshaller = context.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
    StringWriter dest = new StringWriter();

    marshaller.marshal(backUp, dest);
    dest.close();
    String actual = dest.toString();
    System.out.println(actual);

    // TODO compare actual with expected.
  }
Exemple #4
0
 @Test
 public void toStringContainsCaptureDate() {
   String actual = Fixture.createSnapshot().toString();
   assertThat(actual, is("Snapshot@1316905200000"));
 }