示例#1
0
 public static void main(String[] args) throws IOException {
   Morphia m = new Morphia();
   MongoClient mc = new MongoClient();
   TestDao dao = new TestDao(mc, m);
   dao.deleteByQuery(dao.createQuery());
   List<String> res =
       listFilesForFolder(
           new File("templates/hotels"),
           new File("templates/retail"),
           new File("templates/travel"));
   for (String file : res) {
     String text = FileUtils.readFileToString(new File(file));
     Test t = new Test();
     t.setData(text);
     t.setName(file);
     String[] fileNameSpit = file.split("/");
     String cananicalName = fileNameSpit[fileNameSpit.length - 1];
     String[] bannserSizeAndLayout =
         cananicalName.replace("bannerLayout", "").replace(".html", "").split("_");
     t.setBannerSize(bannserSizeAndLayout[0]);
     t.setLayoutId(Integer.parseInt(bannserSizeAndLayout[1]));
     if (file.contains("retail")) {
       t.setVertical(1);
     } else if (file.contains("travel")) {
       t.setVertical(3);
     } else if (file.contains("hotels")) {
       t.setVertical(8);
     }
     dao.save(t);
   }
 }
示例#2
0
 // Test methods //--------------------------------------------
 @Override
 @Test
 public final void testEntityClassMatch() {
   super.testEntityClassMatch();
 }