Пример #1
0
 @Override
 public void onStart(Application app) {
   // Check if the database is empty
   if (User.finder.findRowCount() == 0) {
     Map<String, List<Object>> all = (Map<String, List<Object>>) Yaml.load("initial-data.yml");
     Ebean.save(all.get("users"));
     Ebean.save(all.get("projects"));
     Ebean.save(all.get("tasks"));
   }
 }
Пример #2
0
    public static void insert(Application app) {
      if (Ebean.find(User.class).findRowCount() == 0) {

        Map<String, List<Object>> all = (Map<String, List<Object>>) Yaml.load("initial-data.yml");

        // Insert users first
        Ebean.save(all.get("users"));

        // Insert tapps
        Ebean.save(all.get("apps"));

        //                // Insert projects
        //                Ebean.save(all.get("projects"));
        //                for(Object project: all.get("projects")) {
        //                    // Insert the project/user relation
        //                    Ebean.saveManyToManyAssociations(project, "members");
        //                }
        //
        //

      }
    }
 @Before
 public void setUp() {
   start(fakeApplication(inMemoryDatabase(), fakeGlobal()));
   Ebean.save((List) Yaml.load("test-data.yml"));
 }