Search in sources :

Example 1 with ProjectException

use of org.omegat.core.data.ProjectException in project omegat by omegat-org.

the class ProjectFileStorageTest method testLoadDefaults.

@Test
public void testLoadDefaults() throws Exception {
    ProjectProperties props = ProjectFileStorage.loadPropertiesFile(tempDir, new File(PROJECT_DIR, "defaultdirs.project"));
    try {
        props.verifyProject();
        fail("Project props should fail verification when dirs don't exist yet");
    } catch (ProjectException ex) {
    }
    props.autocreateDirectories();
    props.verifyProject();
    assertTrue(props.getSourceRoot().endsWith("source/"));
    assertTrue(props.getTargetRoot().endsWith("target/"));
    assertTrue(props.getGlossaryRoot().endsWith("glossary/"));
    assertTrue(props.getWriteableGlossary().endsWith("glossary/glossary.txt"));
    assertTrue(props.getTMRoot().endsWith("tm/"));
    assertTrue(props.getDictRoot().endsWith("dictionary/"));
    assertEquals(tempDir.getName(), props.getProjectName());
    assertEquals(new Language("en-us"), props.getSourceLanguage());
    assertEquals(new Language("fr-fr"), props.getTargetLanguage());
    assertEquals(LuceneEnglishTokenizer.class, props.getSourceTokenizer());
    assertEquals(LuceneFrenchTokenizer.class, props.getTargetTokenizer());
    assertTrue(props.isSentenceSegmentingEnabled());
    assertTrue(props.isSupportDefaultTranslations());
    assertFalse(props.isRemoveTags());
    assertTrue(props.getExternalCommand().isEmpty());
    List<String> excludes = props.getSourceRootExcludes();
    assertEquals(6, excludes.size());
    assertEquals("**/.svn/**", excludes.get(0));
}
Also used : ProjectException(org.omegat.core.data.ProjectException) ProjectProperties(org.omegat.core.data.ProjectProperties) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)1 Test (org.junit.Test)1 ProjectException (org.omegat.core.data.ProjectException)1 ProjectProperties (org.omegat.core.data.ProjectProperties)1