@Test public void pushFileProjectUsingFileMapping() throws Exception { PushOptionsImpl opts = mockServerRule.getPushOpts(); opts.setPushType("trans"); File baseDir = testProjectGenerator.getProjectBaseDir(ProjectType.File); log.debug("testing project is at: {}", baseDir); opts.setFileTypes("odt,ods"); opts.setSrcDir(new File(baseDir, "src")); opts.setTransDir(baseDir); opts.setFileMappingRules( Lists.newArrayList(new FileMappingRule("{locale}/{path}/{filename}.{extension}"))); RawPushCommand pushCommand = mockServerRule.createRawPushCommand(); pushCommand.run(); mockServerRule.verifyPushRawFileTranslation(1); assertThat(mockServerRule.getDocIdCaptor().getValue(), equalTo("test-odt.odt")); }
@Test public void pushFileTypeProject() throws Exception { PushOptionsImpl opts = mockServerRule.getPushOpts(); opts.setPushType("both"); File baseDir = testProjectGenerator.getProjectBaseDir(ProjectType.File); log.debug("testing project is at: {}", baseDir); opts.setFileTypes("odt,ods"); opts.setSrcDir(new File(baseDir, "src")); opts.setTransDir(baseDir); RawPushCommand pushCommand = mockServerRule.createRawPushCommand(); pushCommand.run(); mockServerRule.verifyPushRawFileSource(2); assertThat( mockServerRule.getDocIdCaptor().getAllValues(), contains("test-ods.ods", "test-odt.odt")); mockServerRule.verifyPushRawFileTranslation(1); assertThat(mockServerRule.getDocIdCaptor().getValue(), equalTo("test-odt.odt")); }