Exemplo n.º 1
0
  @Test
  public void testFileCreatedCustom() throws Exception {

    String datePath = formatter.format(new Date());
    Record record = new Record();
    record.setFormat("MP3");
    store.setBaseFolder("/tmp/recordings2");
    File f = store.createRecording(record);

    assertTrue(f.getAbsolutePath().endsWith(".mp3"));
    System.out.println("Path: " + f.getAbsolutePath() + " vs. " + "/tmp/recordings2/" + datePath);
    assertTrue(f.getAbsolutePath().startsWith("/tmp/recordings2/" + datePath));
  }
Exemplo n.º 2
0
  @Test
  public void testFileCreatedDefault() throws Exception {

    Record record = new Record();
    File f = store.createRecording(record);
    assertTrue(f.exists());
    assertTrue(f.getAbsolutePath().endsWith(".wav"));
    assertTrue(f.getAbsolutePath().startsWith("/tmp/recordings"));
  }
Exemplo n.º 3
0
  @Test
  public void testFileCleanup() throws Exception {

    Record record = new Record();
    store.setBaseFolder("/tmp/recordings");
    store.setDeleteAfter(1); // delete after 1 second
    store.setCleanupInterval(2);
    store.init();

    File f = store.createRecording(record);

    FileOutputStream fos = new FileOutputStream(f);
    fos.write("test".getBytes());
    fos.flush();
    fos.close();
    assertTrue(f.exists());

    Thread.sleep(3000);

    assertFalse(f.exists());
  }