use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class ScriptValueTranslatorTest method localTimeFromDate.
@Test
public void localTimeFromDate() throws Exception {
final PropertyTree properties = getPropertyTree("localTimeFromDate");
assertNotNull(properties.getLocalTime("myLocalTime"));
validateType(properties, "myLocalTime", ValueTypes.LOCAL_TIME);
assertEquals(properties.getLocalTime("myLocalTimeExpected"), properties.getLocalTime("myLocalTime"));
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class ScriptValueTranslatorTest method doubleTest.
@Test
public void doubleTest() throws Exception {
final PropertyTree properties = getPropertyTree("double");
assertNotNull(properties.getDouble("myDouble"));
validateType(properties, "myDouble", ValueTypes.DOUBLE);
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class SubmitTaskHandler method submitTask.
public String submitTask() {
descriptor = descriptor == null ? "" : descriptor;
final DescriptorKey taskKey;
if (descriptor.contains(":")) {
taskKey = DescriptorKey.from(descriptor);
} else {
final ApplicationKey app = getApplication();
if (app == null) {
throw new RuntimeException("Could not resolve current application for descriptord task: '" + descriptor + "'");
}
taskKey = DescriptorKey.from(app, descriptor);
}
final TaskService taskService = taskServiceSupplier.get();
PropertyTree data = propertyTreeMarshallerServiceSupplier.get().marshal(Optional.ofNullable(config).map(ScriptValue::getMap).orElse(Map.of()));
final SubmitTaskParams params = SubmitTaskParams.create().descriptorKey(taskKey).data(data).build();
final TaskId taskId = taskService.submitTask(params);
return taskId.toString();
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class ScriptValueTranslatorTest method binary.
@Test
public void binary() throws Exception {
final ScriptValueTranslatorResult params = getCreateNodeHandlerParams("binary");
final PropertyTree properties = params.getPropertyTree();
assertNotNull(properties.getBinaryReference("myBinary"));
validateType(properties, "myBinary", ValueTypes.BINARY_REFERENCE);
final BinaryAttachments binaryAttachments = params.getBinaryAttachments();
assertEquals(1, binaryAttachments.getSize());
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class ScriptValueTranslatorTest method integer.
@Test
public void integer() throws Exception {
final PropertyTree properties = getPropertyTree("integer");
assertNotNull(properties.getLong("myInteger"));
validateType(properties, "myInteger", ValueTypes.LONG);
}
Aggregations