Skip to content

Commit b038a9c

Browse files
Move InputType default to config #11418
save changes
1 parent d5200b3 commit b038a9c

File tree

35 files changed

+19
-1484
lines changed

35 files changed

+19
-1484
lines changed

modules/core/core-api/src/main/java/com/enonic/xp/inputtype/InputTypeDefault.java

Lines changed: 0 additions & 139 deletions
This file was deleted.

modules/core/core-api/src/main/java/com/enonic/xp/page/PageDefaultValuesProcessor.java

Lines changed: 0 additions & 6 deletions
This file was deleted.

modules/core/core-api/src/test/java/com/enonic/xp/inputtype/BaseInputTypeTest.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import com.enonic.xp.data.Property;
99
import com.enonic.xp.data.PropertyTree;
10-
import com.enonic.xp.form.Input;
1110
import com.enonic.xp.util.GeoPoint;
1211
import com.enonic.xp.util.Reference;
1312

@@ -79,14 +78,4 @@ protected final Property longProperty( final long value )
7978
final PropertyTree tree = new PropertyTree();
8079
return tree.addLong( "test", value );
8180
}
82-
83-
protected final Input.Builder getDefaultInputBuilder( final InputTypeName inputTypeName, final String defaultValue )
84-
{
85-
final InputTypeProperty defaultProperty = InputTypeProperty.create( "default", PropertyValue.stringValue( defaultValue ) ).build();
86-
87-
final InputTypeDefault inputTypeDefault = InputTypeDefault.create().property( defaultProperty ).build();
88-
89-
return Input.create().name( "inputName" ).label( "label" ).inputType( inputTypeName ).defaultValue( inputTypeDefault );
90-
91-
}
9281
}

modules/core/core-api/src/test/java/com/enonic/xp/inputtype/CheckBoxTypeTest.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.enonic.xp.data.Value;
66
import com.enonic.xp.data.ValueFactory;
77
import com.enonic.xp.data.ValueTypes;
8-
import com.enonic.xp.form.Input;
98

109
import static org.junit.jupiter.api.Assertions.assertEquals;
1110
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -42,18 +41,6 @@ public void testCreateProperty()
4241
assertSame( ValueTypes.BOOLEAN, value.getType() );
4342
}
4443

45-
@Test
46-
public void testCreateDefaultValue()
47-
{
48-
final Input input = getDefaultInputBuilder( InputTypeName.CHECK_BOX, "checked" ).build();
49-
50-
final Value value = this.type.createDefaultValue( input );
51-
52-
assertNotNull( value );
53-
assertEquals( "true", value.toString() );
54-
55-
}
56-
5744
@Test
5845
public void testValidate()
5946
{

modules/core/core-api/src/test/java/com/enonic/xp/inputtype/ComboBoxTypeTest.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.enonic.xp.data.Value;
88
import com.enonic.xp.data.ValueFactory;
99
import com.enonic.xp.data.ValueTypes;
10-
import com.enonic.xp.form.Input;
1110

1211
import static org.junit.jupiter.api.Assertions.assertEquals;
1312
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -44,18 +43,6 @@ public void testCreateProperty()
4443
assertSame( ValueTypes.STRING, value.getType() );
4544
}
4645

47-
@Test
48-
public void testCreateDefaultValue()
49-
{
50-
final Input input = getDefaultInputBuilder( InputTypeName.COMBO_BOX, "testOption" ).build();
51-
52-
final Value value = this.type.createDefaultValue( input );
53-
54-
assertNotNull( value );
55-
assertEquals( "testOption", value.toString() );
56-
57-
}
58-
5946
@Test
6047
public void testValidate()
6148
{

modules/core/core-api/src/test/java/com/enonic/xp/inputtype/CustomSelectorTypeTest.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.enonic.xp.data.Value;
66
import com.enonic.xp.data.ValueFactory;
77
import com.enonic.xp.data.ValueTypes;
8-
import com.enonic.xp.form.Input;
98

109
import static org.junit.jupiter.api.Assertions.assertEquals;
1110
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -42,17 +41,6 @@ public void testCreateProperty()
4241
assertSame( ValueTypes.STRING, value.getType() );
4342
}
4443

45-
@Test
46-
public void testCreateDefaultValue()
47-
{
48-
final Input input = getDefaultInputBuilder( InputTypeName.CUSTOM_SELECTOR, "testValue" ).build();
49-
final Value value = this.type.createDefaultValue( input );
50-
51-
assertNotNull( value );
52-
assertEquals( "testValue", value.toString() );
53-
54-
}
55-
5644
@Test
5745
public void testValidate()
5846
{

modules/core/core-api/src/test/java/com/enonic/xp/inputtype/DateTimeTypeTest.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.enonic.xp.data.Value;
66
import com.enonic.xp.data.ValueFactory;
77
import com.enonic.xp.data.ValueTypes;
8-
import com.enonic.xp.form.Input;
98

109
import static org.junit.jupiter.api.Assertions.assertEquals;
1110
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -42,26 +41,6 @@ public void testCreateProperty()
4241
assertSame( ValueTypes.LOCAL_DATE_TIME, value.getType() );
4342
}
4443

45-
@Test
46-
public void testCreateDefaultValue()
47-
{
48-
final Input input = getDefaultInputBuilder( InputTypeName.DATE_TIME, "2014-08-16T05:03:45" ).build();
49-
50-
final Value value = this.type.createDefaultValue( input );
51-
52-
assertNotNull( value );
53-
assertSame( ValueTypes.LOCAL_DATE_TIME, value.getType() );
54-
assertEquals( "2014-08-16T05:03:45", value.toString() );
55-
}
56-
57-
@Test
58-
public void testRelativeDefaultValue_date_time_invalid()
59-
{
60-
final Input input = getDefaultInputBuilder( InputTypeName.DATE_TIME, "+1year -5months -36d +2minutes -1haaur" ).build();
61-
62-
assertThrows( IllegalArgumentException.class, () -> this.type.createDefaultValue( input ) );
63-
}
64-
6544
@Test
6645
public void testValidate_dateTime()
6746
{

modules/core/core-api/src/test/java/com/enonic/xp/inputtype/DateTypeTest.java

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
package com.enonic.xp.inputtype;
22

3-
import java.time.LocalDate;
4-
53
import org.junit.jupiter.api.Test;
64

75
import com.enonic.xp.data.Value;
86
import com.enonic.xp.data.ValueFactory;
97
import com.enonic.xp.data.ValueTypes;
10-
import com.enonic.xp.form.Input;
118

129
import static org.junit.jupiter.api.Assertions.assertEquals;
1310
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -44,38 +41,6 @@ public void testCreateProperty()
4441
assertSame( ValueTypes.LOCAL_DATE, value.getType() );
4542
}
4643

47-
@Test
48-
public void testCreateDefaultValue()
49-
{
50-
final Input input = getDefaultInputBuilder( InputTypeName.DATE, "2014-08-16" ).build();
51-
52-
final Value value = this.type.createDefaultValue( input );
53-
54-
assertNotNull( value );
55-
assertSame( ValueTypes.LOCAL_DATE, value.getType() );
56-
assertEquals( value.toString(), "2014-08-16" );
57-
}
58-
59-
@Test
60-
public void testRelativeDefaultValue()
61-
{
62-
final Input input = getDefaultInputBuilder( InputTypeName.DATE, "+1year -5months -36d" ).build();
63-
64-
final Value value = this.type.createDefaultValue( input );
65-
66-
assertNotNull( value );
67-
assertSame( ValueTypes.LOCAL_DATE, value.getType() );
68-
assertEquals( value.getObject(), LocalDate.now().plusYears( 1 ).plusMonths( -5 ).plusDays( -36 ) );
69-
}
70-
71-
@Test
72-
public void testCreateDefaultValue_invalid()
73-
{
74-
final Input input = getDefaultInputBuilder( InputTypeName.DATE, "2014-18-16" ).build();
75-
76-
assertThrows(IllegalArgumentException.class, () -> this.type.createDefaultValue( input ) );
77-
}
78-
7944
@Test
8045
public void testValidate()
8146
{

modules/core/core-api/src/test/java/com/enonic/xp/inputtype/DoubleTypeTest.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.enonic.xp.data.Value;
66
import com.enonic.xp.data.ValueFactory;
77
import com.enonic.xp.data.ValueTypes;
8-
import com.enonic.xp.form.Input;
98

109
import static org.junit.jupiter.api.Assertions.assertEquals;
1110
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -41,17 +40,6 @@ public void testCreateProperty()
4140
assertSame( ValueTypes.DOUBLE, value.getType() );
4241
}
4342

44-
@Test
45-
public void testCreateDefaultValue()
46-
{
47-
final Input input = getDefaultInputBuilder( InputTypeName.DOUBLE, "1.3" ).build();
48-
49-
final Value value = this.type.createDefaultValue( input );
50-
51-
assertNotNull( value );
52-
assertEquals( 1.3D, value.asDouble(), Double.MIN_NORMAL );
53-
}
54-
5543
@Test
5644
public void testValidate()
5745
{

modules/core/core-api/src/test/java/com/enonic/xp/inputtype/GeoPointTypeTest.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.enonic.xp.data.Value;
66
import com.enonic.xp.data.ValueFactory;
77
import com.enonic.xp.data.ValueTypes;
8-
import com.enonic.xp.form.Input;
98

109
import static org.junit.jupiter.api.Assertions.assertEquals;
1110
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -42,25 +41,6 @@ public void testCreateProperty()
4241
assertSame( ValueTypes.GEO_POINT, value.getType() );
4342
}
4443

45-
@Test
46-
public void testCreateDefaultValue()
47-
{
48-
final Input input = getDefaultInputBuilder( InputTypeName.GEO_POINT, "41.387588,2.169994" ).build();
49-
50-
final Value value = this.type.createDefaultValue( input );
51-
52-
assertNotNull( value );
53-
assertEquals( "41.387588,2.169994", value.toString() );
54-
55-
}
56-
57-
@Test
58-
public void testCreateDefaultValue_invalid()
59-
{
60-
final Input input = getDefaultInputBuilder( InputTypeName.GEO_POINT, "41.387588;2.169994" ).build();
61-
assertThrows(IllegalArgumentException.class, () -> this.type.createDefaultValue( input ) );
62-
}
63-
6444
@Test
6545
public void testValidate()
6646
{

0 commit comments

Comments
 (0)