Ejemplo n.º 1
0
  @Test
  public void testFileImportersMerge() throws Exception {
    assertNotNull(harness);
    URL url = getClass().getClassLoader().getResource("nxfilemanager-test-override.xml");
    assertNotNull(url);
    harness.deployTestContrib(FileManagerUTConstants.FILEMANAGER_BUNDLE, url);

    FileManagerService fileManagerService = (FileManagerService) service;

    FileImporter plugin = fileManagerService.getPluginByName("pluginWithDocType4merge");
    assertNotNull(plugin);
    assertNotNull(plugin.getDocType());
    assertEquals("Picture", plugin.getDocType());
    assertEquals(2, plugin.getFilters().size());
    List<String> filters = plugin.getFilters();
    assertTrue(filters.contains("image/jpeg"));
    assertTrue(filters.contains("image/png"));

    plugin = fileManagerService.getPluginByName("plug4merge");
    assertNotNull(plugin.getDocType());
    assertEquals("Note", plugin.getDocType());
    assertEquals(3, plugin.getFilters().size());
    filters = plugin.getFilters();
    assertTrue(filters.contains("text/plain"));
    assertTrue(filters.contains("text/rtf"));
    assertTrue(filters.contains("text/xml"));
  }
Ejemplo n.º 2
0
  @Test
  public void testFileImporterDocType() {
    FileManagerService fileManagerService = (FileManagerService) service;
    FileImporter plugin = fileManagerService.getPluginByName("plug");
    assertNotNull(plugin);
    assertNull(plugin.getDocType());

    plugin = fileManagerService.getPluginByName("pluginWithDocType");
    assertNotNull(plugin.getDocType());
    assertEquals("File", plugin.getDocType());
  }