use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class RangeQueryBuilderTest method test.
private void test(final String fileName) throws Exception {
final String queryString = load("range/query/" + fileName + ".json");
final PropertyTree dslExpression = readJson(queryString);
final QueryBuilder builder = new RangeQueryBuilder(dslExpression.getSet("range")).create();
assertJson("range/result/" + fileName + ".json", builder.toString());
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class RepositoryServiceImplTest method update_data.
@Test
void update_data() {
final String repoId = "repo-with-data";
doCreateRepo(repoId);
Context mockCurrentContext = ContextBuilder.create().branch("master").repositoryId(repoId).authInfo(REPO_TEST_DEFAULT_USER_AUTHINFO).build();
PropertyTree data = new PropertyTree();
data.setString("myProp", "b");
mockCurrentContext.callWith(() -> repositoryService.updateRepository(UpdateRepositoryParams.create().repositoryId(RepositoryId.from(repoId)).editor(edit -> edit.data = data).build()));
final Repository persistedRepo = getPersistedRepoWithoutCache(repoId);
assertEquals("b", persistedRepo.getData().getString("myProp"));
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class ValueCountAggregationTest method createNode.
private Node createNode(final String categoryValue, final String name, final NodePath parent) {
final PropertyTree data = new PropertyTree();
data.addString("category", categoryValue);
return createNode(CreateNodeParams.create().parent(parent).name(name).data(data).build());
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class RepositoryNodeTranslatorTest method values_not_duplicated.
@Test
public void values_not_duplicated() throws Exception {
final PropertyTree indexMapping = new PropertyTree();
indexMapping.addString("myMapping", "myMappingValue");
final PropertyTree indexSettings = new PropertyTree();
indexSettings.addString("mySetting", "mySettingValue");
final Repository repo = Repository.create().branches(Branch.from("master")).id(RepositoryId.from("myrepoid")).settings(RepositorySettings.create().indexDefinitions(IndexDefinitions.create().add(IndexType.VERSION, IndexDefinition.create().mapping(IndexMapping.from(indexMapping)).settings(IndexSettings.from(indexSettings)).build()).add(IndexType.BRANCH, IndexDefinition.create().mapping(IndexMapping.from(indexMapping)).settings(IndexSettings.from(indexSettings)).build()).add(IndexType.COMMIT, IndexDefinition.create().mapping(IndexMapping.from(indexMapping)).settings(IndexSettings.from(indexSettings)).build()).build()).build()).build();
final Node node = RepositoryNodeTranslator.toNode(repo);
final PropertyTree data = node.data();
assertNotNull(data.getProperty("indexConfigs.version.mapping.myMapping"));
assertNull(data.getProperty("indexConfigs.version.mapping.myMapping[1]"));
assertNotNull(data.getProperty("indexConfigs.version.settings.mySetting"));
assertNull(data.getProperty("indexConfigs.version.settings.mySetting[1]"));
assertNotNull(data.getProperty("indexConfigs.branch.mapping.myMapping"));
assertNull(data.getProperty("indexConfigs.branch.mapping.myMapping[1]"));
assertNotNull(data.getProperty("indexConfigs.branch.settings.mySetting"));
assertNull(data.getProperty("indexConfigs.branch.settings.mySetting[1]"));
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class DateRangeAggregationTest method createNode.
private Node createNode(final Instant instantValue, final String name, final NodePath parent) {
final PropertyTree data = new PropertyTree();
data.addInstant("instant", instantValue);
return createNode(CreateNodeParams.create().parent(parent).name(name).data(data).build());
}
Aggregations