use of com.enonic.xp.resource.ResourceKey in project xp by enonic.
the class RequireResolverTest method resolve_relative.
@Test
public void resolve_relative() throws Exception {
touchFile("a/b/dummy.js");
final ResourceKey key2 = resolve("/a/b/c.js", "dummy");
assertEquals("/a/b/dummy.js", key2.getPath());
}
use of com.enonic.xp.resource.ResourceKey in project xp by enonic.
the class ResourceResolverTest method resolve_relative.
@Test
public void resolve_relative() throws Exception {
touchFile("dir1/dir2/dummy.txt");
touchFile("dir1/dummy.txt");
final ResourceKey key1 = resolve("/dir1/dir2/c.txt", "./dummy.txt");
assertEquals("/dir1/dir2/dummy.txt", key1.getPath());
final ResourceKey key2 = resolve("/dir1/dir2/c.txt", "../dummy.txt");
assertEquals("/dir1/dummy.txt", key2.getPath());
final ResourceKey key3 = resolve("/dir1/dir2/c.txt", "dummy.txt");
assertEquals("/dir1/dir2/dummy.txt", key3.getPath());
}
use of com.enonic.xp.resource.ResourceKey in project xp by enonic.
the class ResourceResolverTest method resolve_absolute.
@Test
public void resolve_absolute() throws Exception {
touchFile("dummy.txt");
final ResourceKey key1 = resolve("/a/b/c.txt", "/dummy.txt");
assertEquals("/dummy.txt", key1.getPath());
touchFile("site/dummy.txt");
final ResourceKey key2 = resolve("/a/b/c.txt", "/dummy.txt");
assertEquals("/site/dummy.txt", key2.getPath());
}
use of com.enonic.xp.resource.ResourceKey in project xp by enonic.
the class ScriptRuntimeImplTest method executeAsync.
@Test
void executeAsync() {
final ApplicationKey applicationKey = ApplicationKey.from("myApp");
when(scriptExecutorFactory.apply(applicationKey)).thenReturn(scriptExecutor);
final ScriptRuntimeImpl scriptRuntime = new ScriptRuntimeImpl(scriptExecutorFactory);
final ResourceKey resourceKey = ResourceKey.from(applicationKey, "/main.js");
scriptRuntime.executeAsync(resourceKey);
verify(scriptExecutor, Mockito.times(1)).executeMainAsync(resourceKey);
}
use of com.enonic.xp.resource.ResourceKey in project xp by enonic.
the class IOHandlerBean method getResource.
public Resource getResource(final Object key) {
final ResourceKey resourceKey = toResourceKey(key);
final ResourceService service = this.context.getService(ResourceService.class).get();
return service.getResource(resourceKey);
}
Aggregations