use of com.enonic.xp.page.DescriptorKey in project xp by enonic.
the class TaskServiceImplTest method submitTask_DescriptorKey_offload_to_clustered_wait_fail.
@Test
void submitTask_DescriptorKey_offload_to_clustered_wait_fail() {
final DescriptorKey descriptorKey = DescriptorKey.from("module:my-admin-tool");
when(taskConfig.distributable_acceptInbound()).thenReturn(false);
taskService.activate(taskConfig);
assertThrows(RuntimeException.class, () -> {
taskService.submitTask(SubmitTaskParams.create().descriptorKey(descriptorKey).build());
});
}
use of com.enonic.xp.page.DescriptorKey in project xp by enonic.
the class AdminToolPortalHandler method createPortalRequest.
@Override
protected PortalRequest createPortalRequest(final WebRequest webRequest, final WebResponse webResponse) {
final PortalRequest portalRequest = new PortalRequest(webRequest);
final DescriptorKey descriptorKey = getDescriptorKey(webRequest);
if (descriptorKey == null) {
portalRequest.setBaseUri(ADMIN_TOOL_START);
portalRequest.setApplicationKey(DEFAULT_DESCRIPTOR_KEY.getApplicationKey());
} else {
portalRequest.setBaseUri(ADMIN_TOOL_PREFIX + descriptorKey.getApplicationKey() + "/" + descriptorKey.getName());
portalRequest.setApplicationKey(descriptorKey.getApplicationKey());
}
portalRequest.setMode(RenderMode.ADMIN);
return portalRequest;
}
use of com.enonic.xp.page.DescriptorKey in project xp by enonic.
the class LayoutComponentDataSerializer method fromData.
public LayoutComponent fromData(final PropertySet layoutData, final List<PropertySet> componentsAsData) {
final LayoutComponent.Builder layoutComponent = LayoutComponent.create();
final LayoutRegions.Builder layoutRegionsBuilder = LayoutRegions.create();
final PropertySet specialBlockSet = layoutData.getSet(LayoutComponentType.INSTANCE.toString());
if (specialBlockSet != null && specialBlockSet.isNotNull(DESCRIPTOR)) {
final DescriptorKey descriptorKey = DescriptorKey.from(specialBlockSet.getString(DESCRIPTOR));
layoutComponent.descriptor(descriptorKey);
layoutComponent.config(getConfigFromData(specialBlockSet, descriptorKey));
final LayoutDescriptor layoutDescriptor = layoutDescriptorService.getByKey(descriptorKey);
final String layoutPath = layoutData.getString(PATH);
if (layoutDescriptor.getRegions() != null && layoutDescriptor.getRegions().numberOfRegions() > 0) {
layoutDescriptor.getRegions().forEach(regionDescriptor -> {
layoutRegionsBuilder.add(regionDataSerializer.fromData(regionDescriptor, layoutPath, componentsAsData));
});
}
}
layoutComponent.regions(layoutRegionsBuilder.build());
return layoutComponent.build();
}
use of com.enonic.xp.page.DescriptorKey in project xp by enonic.
the class TaskDescriptorLoaderTest method testCreateDefault.
@Test
public void testCreateDefault() {
final DescriptorKey key = DescriptorKey.from("myapp1:task1");
final TaskDescriptor descriptor = this.loader.createDefault(key);
assertEquals(key, descriptor.getKey());
assertEquals("task1", descriptor.getName());
}
use of com.enonic.xp.page.DescriptorKey in project xp by enonic.
the class ServiceDescriptorServiceImplTest method testGetByKey_default.
@Test
public void testGetByKey_default() throws Exception {
final DescriptorKey key = DescriptorKey.from("myapp1:unknown");
final ServiceDescriptor descriptor = this.service.getByKey(key);
assertNotNull(descriptor);
}
Aggregations