Package com.avaje.tests.model.basic

Examples of com.avaje.tests.model.basic.PersistentFileContent


public class TestDeleteOneToOne extends BaseTestCase {

  @Test
  public void testCreateDeletePersistentFile() {

    PersistentFile persistentFile = new PersistentFile("test.txt", new PersistentFileContent(
        "test".getBytes()));

    Ebean.save(persistentFile);
    Integer id = persistentFile.getId();
    Integer contentId = persistentFile.getPersistentFileContent().getId();

    // should delete file and fileContent
    Ebean.delete(PersistentFile.class, id);

    PersistentFile file1 = Ebean.find(PersistentFile.class, id);
    PersistentFileContent content1 = Ebean.find(PersistentFileContent.class, contentId);

    Assert.assertNull(file1);
    Assert.assertNull(content1);

  }
View Full Code Here


public class TestSaveDeleteOneToOne extends BaseTestCase {

  @Test
  public void testCreateDeletePersistentFile() {
    PersistentFile persistentFile = new PersistentFile("test.txt",
        new PersistentFileContent("test".getBytes()));

    Ebean.save(persistentFile);
    Ebean.delete(persistentFile);
  }
View Full Code Here

  }

  @Test
  public void testCreateLoadDeletePersistentFile() {
    PersistentFile persistentFile = new PersistentFile("test.txt",
        new PersistentFileContent("test".getBytes()));

    Ebean.save(persistentFile);

    persistentFile = Ebean.find(PersistentFile.class, persistentFile.getId());
   
    PersistentFileContent persistentFileContent = persistentFile.getPersistentFileContent();
   
    Assert.assertNotNull(persistentFileContent);
   
    Assert.assertNotNull("load byte content", persistentFileContent.getContent());
   
    Ebean.delete(persistentFile);
  }
View Full Code Here

TOP

Related Classes of com.avaje.tests.model.basic.PersistentFileContent

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.