Search in sources :

Example 11 with Value

use of com.enonic.xp.data.Value in project xp by enonic.

the class DateTimeTypeTest method testRelativeDefaultValue_date_time.

@Test
public void testRelativeDefaultValue_date_time() {
    final Input input = getDefaultInputBuilder(InputTypeName.DATE_TIME, "+1year -5months -36d +2minutes -1h").inputTypeConfig(InputTypeConfig.create().property(InputTypeProperty.create("timezone", "true").build()).build()).build();
    final Value value = this.type.createDefaultValue(input);
    assertNotNull(value);
    assertSame(ValueTypes.DATE_TIME, value.getType());
}
Also used : Input(com.enonic.xp.form.Input) Value(com.enonic.xp.data.Value) Test(org.junit.jupiter.api.Test)

Example 12 with Value

use of com.enonic.xp.data.Value in project xp by enonic.

the class DateTimeTypeTest method testRelativeDefaultValue_only_relative_time_exists.

@Test
public void testRelativeDefaultValue_only_relative_time_exists() {
    final Input input = getDefaultInputBuilder(InputTypeName.DATE_TIME, "+1hour -5minutes -36s").inputTypeConfig(InputTypeConfig.create().property(InputTypeProperty.create("timezone", "false").build()).build()).build();
    final Value value = this.type.createDefaultValue(input);
    assertNotNull(value);
    assertSame(ValueTypes.LOCAL_DATE_TIME, value.getType());
}
Also used : Input(com.enonic.xp.form.Input) Value(com.enonic.xp.data.Value) Test(org.junit.jupiter.api.Test)

Example 13 with Value

use of com.enonic.xp.data.Value in project xp by enonic.

the class DateTypeTest method testRelativeDefaultValue.

@Test
public void testRelativeDefaultValue() {
    final Input input = getDefaultInputBuilder(InputTypeName.DATE, "+1year -5months -36d").build();
    final Value value = this.type.createDefaultValue(input);
    assertNotNull(value);
    assertSame(ValueTypes.LOCAL_DATE, value.getType());
    assertEquals(value.getObject(), LocalDate.now().plusYears(1).plusMonths(-5).plusDays(-36));
}
Also used : Input(com.enonic.xp.form.Input) Value(com.enonic.xp.data.Value) Test(org.junit.jupiter.api.Test)

Example 14 with Value

use of com.enonic.xp.data.Value in project xp by enonic.

the class ImageUploaderTypeTest method testCreateProperty.

@Test
public void testCreateProperty() {
    final InputTypeConfig config = InputTypeConfig.create().build();
    final Value value = this.type.createValue(ValueFactory.newPropertySet(new PropertySet()), config);
    assertNotNull(value);
    assertSame(ValueTypes.PROPERTY_SET, value.getType());
}
Also used : Value(com.enonic.xp.data.Value) PropertySet(com.enonic.xp.data.PropertySet) Test(org.junit.jupiter.api.Test)

Example 15 with Value

use of com.enonic.xp.data.Value in project xp by enonic.

the class MediaUploaderTypeTest method testCreateProperty.

@Test
public void testCreateProperty() {
    final InputTypeConfig config = InputTypeConfig.create().build();
    final Value value = this.type.createValue(ValueFactory.newPropertySet(new PropertySet()), config);
    assertNotNull(value);
    assertSame(ValueTypes.PROPERTY_SET, value.getType());
}
Also used : Value(com.enonic.xp.data.Value) PropertySet(com.enonic.xp.data.PropertySet) Test(org.junit.jupiter.api.Test)

Aggregations

Value (com.enonic.xp.data.Value)62 Test (org.junit.jupiter.api.Test)48 Input (com.enonic.xp.form.Input)24 Property (com.enonic.xp.data.Property)4 PropertySet (com.enonic.xp.data.PropertySet)4 PropertyTree (com.enonic.xp.data.PropertyTree)3 InputType (com.enonic.xp.inputtype.InputType)2 Instant (java.time.Instant)2 PropertyPath (com.enonic.xp.data.PropertyPath)1 FieldSet (com.enonic.xp.form.FieldSet)1 FormOptionSetOption (com.enonic.xp.form.FormOptionSetOption)1 IndexConfig (com.enonic.xp.index.IndexConfig)1 IndexValueProcessor (com.enonic.xp.index.IndexValueProcessor)1 AttachedBinary (com.enonic.xp.node.AttachedBinary)1 FindNodesByQueryResult (com.enonic.xp.node.FindNodesByQueryResult)1 Node (com.enonic.xp.node.Node)1 NodePath (com.enonic.xp.node.NodePath)1 NodeQuery (com.enonic.xp.node.NodeQuery)1 NodeVersion (com.enonic.xp.node.NodeVersion)1 NodeVersionQuery (com.enonic.xp.node.NodeVersionQuery)1