@Test
  public void pullFileProjectUsingFileMapping() throws Exception {
    PullOptionsImpl opts = mockServerRule.getPullOpts();
    opts.setPullType("trans");
    File pullBaseDir = tempFolder.newFolder("file-pull-test");
    opts.setSrcDir(pullBaseDir);
    opts.setTransDir(pullBaseDir);
    log.debug("pull base dir is: {}", pullBaseDir);
    // we define our own rule
    opts.setFileMappingRules(
        Lists.newArrayList(
            new FileMappingRule("**/*.odt", "{extension}/{path}/{locale}/{filename}.{extension}"),
            new FileMappingRule(
                "**/*.ods", "{extension}/{locale_with_underscore}/{filename}.{extension}")));

    InputStream sourceFileStream = IOUtils.toInputStream("source content", Charsets.UTF_8);
    InputStream transFileStream = IOUtils.toInputStream("translation content", Charsets.UTF_8);
    ArrayList<ResourceMeta> remoteDocList =
        Lists.newArrayList(new ResourceMeta("test-ods.ods"), new ResourceMeta("test-odt.odt"));

    RawPullCommand pullCommand =
        mockServerRule.createRawPullCommand(remoteDocList, sourceFileStream, transFileStream);

    pullCommand.run();

    assertThat(new File(pullBaseDir, "odt/zh-CN/test-odt.odt").exists(), is(true));
    assertThat(new File(pullBaseDir, "ods/zh_CN/test-ods.ods").exists(), is(true));
  }
  @Test
  public void pullFileProject() throws Exception {
    PullOptionsImpl opts = mockServerRule.getPullOpts();
    opts.setPullType("both");
    File pullBaseDir = tempFolder.newFolder("file-pull-test");
    opts.setSrcDir(pullBaseDir);
    opts.setTransDir(pullBaseDir);
    log.debug("pull base dir is: {}", pullBaseDir);

    InputStream sourceFileStream = IOUtils.toInputStream("source content", Charsets.UTF_8);
    InputStream transFileStream = IOUtils.toInputStream("translation content", Charsets.UTF_8);
    ArrayList<ResourceMeta> remoteDocList =
        Lists.newArrayList(new ResourceMeta("test-ods.ods"), new ResourceMeta("test-odt.odt"));

    RawPullCommand pullCommand =
        mockServerRule.createRawPullCommand(remoteDocList, sourceFileStream, transFileStream);

    pullCommand.run();

    assertThat(new File(pullBaseDir, "test-ods.ods").exists(), is(true));
    assertThat(new File(pullBaseDir, "test-odt.odt").exists(), is(true));
    assertThat(new File(pullBaseDir, "zh-CN/test-odt.odt").exists(), is(true));
    assertThat(new File(pullBaseDir, "zh-CN/test-ods.ods").exists(), is(true));
  }