@Before
  public void initialData() throws Exception {
    initialTestDatabaseCreator.dropDatabaseForJunit().checkDatabase();
    // save fileState
    fileStateModel = new FileStateModel();
    fileStateModel.setClientName("emprofMediaHandleTest");
    fileStateModel.setCustomerFormat("emprof");
    fileStateModel.setFileName("502833__49963125_urlescaped_49963171.xml.xml");
    fileStateModel.setFileSize(1L);
    // new column
    fileStateModel.setFileType(FileType.XML);
    fileStateModel.setFilePath("/a/b/c/d");
    fileStateModel.setParentFileState(null);
    fileStateModel = fileStateManager.save(fileStateModel);
    // save adstate
    adStateModel = new AdStateModel();
    adStateModel.setFileStateModel(fileStateModel);
    adStateModel.setZadObjectId(1);
    adStateModel.setzClientId(21912);
    adStateModel.setAdExternalRef("2011068");
    adStateModel = adStateManager.save(adStateModel);

    // save mediaStateModel
    mediaStateModel = new MediaStateModel();
    mediaStateModel.setAdStateModel(adStateModel);
    mediaStateModel.setContentType(MediaStateContentType.IMAGE);
    mediaStateModel.setMd5hash("730A1E3FEE8ACA06F14A4D9B1D9C0241");
    mediaStateModel.setSequenceNum(1);
    mediaStateModel.setTitle("Front Moslingsvei 44");
    mediaStateModel.setMediaStatus(MediaStatus.PRODUCTION);
    mediaStateModel.setProdref("73/0A/730A1E3FEE8ACA06F14A4D9B1D9C0241");
    // Media is not used:
    mediaStateModel.setExtref(
        "http://att.emprof.no/images/Megler-Forum/Megler%20Forum/Pictures/1024/20110681.JPG");
    mediaStateModel = mediaStateManager.save(mediaStateModel);

    mediaStateModel = new MediaStateModel();
    mediaStateModel.setAdStateModel(adStateModel);
    mediaStateModel.setContentType(MediaStateContentType.IMAGE);
    mediaStateModel.setMd5hash("md5hash1");
    mediaStateModel.setSequenceNum(99);
    mediaStateModel.setTitle("title2");
    mediaStateModel.setMediaStatus(MediaStatus.MISSING);
    mediaStateModel.setProdref("prodef");
    mediaStateModel.setExtref("pic2.jpg");
    mediaStateModel = mediaStateManager.save(mediaStateModel);

    mediaStateModel = new MediaStateModel();
    mediaStateModel.setAdStateModel(adStateModel);
    mediaStateModel.setContentType(MediaStateContentType.IMAGE);
    mediaStateModel.setMd5hash("md5hash1");
    mediaStateModel.setSequenceNum(99);
    mediaStateModel.setTitle("title3");
    mediaStateModel.setMediaStatus(MediaStatus.MISSING);
    mediaStateModel.setProdref("prodef");
    mediaStateModel.setExtref("pic3.jpg");
    mediaStateModel = mediaStateManager.save(mediaStateModel);
  }
예제 #2
0
 public FileStateModel saveFileState(
     String clientName,
     String clientFormat,
     String filePathOnly,
     String fileName,
     Long fileSize,
     FileType type,
     FileStateModel parent)
     throws DAOException {
   FileStateModel fileStateModel = new FileStateModel();
   fileStateModel.setClientName(clientName);
   fileStateModel.setCustomerFormat(clientFormat);
   fileStateModel.setFileName(fileName);
   fileStateModel.setFileSize(fileSize);
   fileStateModel.setFileType(type);
   // use the same zip path as the filepath for the media entry
   fileStateModel.setFilePath(filePathOnly);
   fileStateModel.setParentFileState(parent);
   fileStateModel = fileStateManager.save(fileStateModel);
   return fileStateModel;
 }