Search in sources :

Example 1 with LaunchServicesApplicationFinder

use of ch.cyberduck.core.local.LaunchServicesApplicationFinder in project cyberduck by iterate-ch.

the class SharedFileListApplicationLoginRegistryTest method testRegister.

@Test
@Ignore
public void testRegister() {
    final SharedFileListApplicationLoginRegistry registry = new SharedFileListApplicationLoginRegistry(new LaunchServicesApplicationFinder());
    final Application application = new Application("ch.sudo.cyberduck");
    assertTrue(registry.register(application));
    assertTrue(new FinderSidebarService(SidebarService.List.login).contains(new FinderLocal(NSWorkspace.sharedWorkspace().absolutePathForAppBundleWithIdentifier(application.getIdentifier()))));
    assertTrue(registry.unregister(application));
}
Also used : LaunchServicesApplicationFinder(ch.cyberduck.core.local.LaunchServicesApplicationFinder) FinderLocal(ch.cyberduck.core.local.FinderLocal) Application(ch.cyberduck.core.local.Application) FinderSidebarService(ch.cyberduck.core.local.FinderSidebarService) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with LaunchServicesApplicationFinder

use of ch.cyberduck.core.local.LaunchServicesApplicationFinder in project cyberduck by iterate-ch.

the class LaunchServicesSchemeHandlerTest method testSetDefaultHandlerForURLScheme.

@Test
public void testSetDefaultHandlerForURLScheme() {
    final SchemeHandler l = new LaunchServicesSchemeHandler(new LaunchServicesApplicationFinder());
    l.setDefaultHandler(new Application("none.app", null), Collections.singletonList(Scheme.ftp.name()));
    assertEquals(new Application("com.apple.finder"), l.getDefaultHandler(Scheme.ftp.name()));
    assertFalse(l.isDefaultHandler(Collections.singletonList(Scheme.ftp.name()), new Application("other.app", null)));
    l.setDefaultHandler(new Application("ch.sudo.cyberduck", null), Collections.singletonList(Scheme.ftp.name()));
    assertEquals("ch.sudo.cyberduck", l.getDefaultHandler(Scheme.ftp.name()).getIdentifier());
    assertTrue(l.getAllHandlers(Scheme.ftp.name()).contains(new Application("ch.sudo.cyberduck")));
    assertNotSame("ch.sudo.cyberduck", l.getDefaultHandler(Scheme.http.name()).getIdentifier());
    assertTrue(l.isDefaultHandler(Collections.singletonList(Scheme.ftp.name()), new Application("ch.sudo.cyberduck", null)));
}
Also used : LaunchServicesApplicationFinder(ch.cyberduck.core.local.LaunchServicesApplicationFinder) Application(ch.cyberduck.core.local.Application) Test(org.junit.Test)

Aggregations

Application (ch.cyberduck.core.local.Application)2 LaunchServicesApplicationFinder (ch.cyberduck.core.local.LaunchServicesApplicationFinder)2 Test (org.junit.Test)2 FinderLocal (ch.cyberduck.core.local.FinderLocal)1 FinderSidebarService (ch.cyberduck.core.local.FinderSidebarService)1 Ignore (org.junit.Ignore)1