use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class ScriptValueTranslatorTest method mapTest.
@Test
public void mapTest() throws Exception {
final PropertyTree properties = getPropertyTree("map");
assertNotNull(properties.getSet("myMap"));
assertNotNull(properties.getSet("myMap.a"));
assertNotNull(properties.getLong("myMap.a.b"));
validateType(properties, "myMap", ValueTypes.PROPERTY_SET);
validateType(properties, "myMap.a", ValueTypes.PROPERTY_SET);
validateType(properties, "myMap.a.b", ValueTypes.LONG);
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class ScriptValueTranslatorTest method localDateFromDate.
@Test
public void localDateFromDate() throws Exception {
final PropertyTree properties = getPropertyTree("localDateFromDate");
assertNotNull(properties.getLocalDate("myLocalDate"));
assertEquals(properties.getLocalDate("myLocalDateExpected"), properties.getLocalDate("myLocalDate"));
validateType(properties, "myLocalDate", ValueTypes.LOCAL_DATE);
assertEquals(properties.getLocalDate("myLocalDateExpected"), properties.getLocalDate("myLocalDate"));
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class JsonToPropertyTreeTranslatorTest method map_array_values.
@Test
public void map_array_values() throws Exception {
final JsonNode node = loadJson("allInputTypes");
final PropertyTree data = new JsonToPropertyTreeTranslator(null, false).translate(node);
final Property myArray = data.getProperty("stringArray");
assertNotNull(myArray);
assertEquals(ValueTypes.STRING.getName(), myArray.getType().getName());
final Property myArray0 = data.getProperty("stringArray[0]");
assertNotNull(myArray0);
final Property myArray1 = data.getProperty("stringArray[1]");
assertNotNull(myArray1);
final Property myArray2 = data.getProperty("stringArray[2]");
assertNotNull(myArray2);
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class JsonToPropertyTreeTranslatorTest method all_input_types.
@Test
public void all_input_types() throws Exception {
final JsonNode node = loadJson("allInputTypes");
final PropertyTree data = new JsonToPropertyTreeTranslator(createFormForAllInputTypes(), true).translate(node);
final Property media = data.getProperty("media");
assertNotNull(media);
assertEquals(ValueTypes.PROPERTY_SET.getName(), media.getType().getName());
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class ApplicationInfoServiceImplTest method mockIdProviderApplication.
private void mockIdProviderApplication(final ApplicationKey applicationKey) {
final IdProviderDescriptor idProviderDescriptor = IdProviderDescriptor.create().config(Form.create().build()).key(applicationKey).mode(IdProviderDescriptorMode.EXTERNAL).build();
final IdProvider idProvider1 = IdProvider.create().displayName("idProvider1").key(IdProviderKey.from("idProvider1")).idProviderConfig(IdProviderConfig.create().applicationKey(applicationKey).config(new PropertyTree()).build()).build();
final IdProvider idProvider2 = IdProvider.create().displayName("idProvider2").key(IdProviderKey.from("idProvider2" + "")).idProviderConfig(IdProviderConfig.create().applicationKey(applicationKey).config(new PropertyTree()).build()).build();
Mockito.when(this.idProviderDescriptorService.getDescriptor(applicationKey)).thenReturn(idProviderDescriptor);
Mockito.when(this.securityService.getIdProviders()).thenReturn(IdProviders.from(idProvider1, idProvider2));
}
Aggregations