Search in sources :

Example 81 with PropertyTree

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

the class FulltextQueryBuilderTest method test.

private void test(final String fileName) throws Exception {
    final String queryString = load("fulltext/query/" + fileName + ".json");
    final PropertyTree dslExpression = readJson(queryString);
    final QueryBuilder builder = new FulltextQueryBuilder(dslExpression.getSet("fulltext")).create();
    assertJson("fulltext/result/" + fileName + ".json", builder.toString());
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) QueryBuilder(org.elasticsearch.index.query.QueryBuilder)

Example 82 with PropertyTree

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

the class InQueryBuilderTest method test.

private void test(final String fileName) throws Exception {
    final String queryString = load("in/query/" + fileName + ".json");
    final PropertyTree dslExpression = readJson(queryString);
    final QueryBuilder builder = new InQueryBuilder(dslExpression.getSet("in")).create();
    assertJson("in/result/" + fileName + ".json", builder.toString());
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) QueryBuilder(org.elasticsearch.index.query.QueryBuilder)

Example 83 with PropertyTree

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

the class LikeQueryBuilderTest method test.

private void test(final String fileName) throws Exception {
    final String queryString = load("like/query/" + fileName + ".json");
    final PropertyTree dslExpression = readJson(queryString);
    final QueryBuilder builder = new LikeQueryBuilder(dslExpression.getSet("like")).create();
    assertJson("like/result/" + fileName + ".json", builder.toString());
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) QueryBuilder(org.elasticsearch.index.query.QueryBuilder)

Example 84 with PropertyTree

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

the class RepoDumperTest method binaries_with_versions.

@Test
public void binaries_with_versions() throws Exception {
    final BinaryReference ref1 = BinaryReference.from("fisk");
    final BinaryReference ref2 = BinaryReference.from("fisk2");
    final PropertyTree data = new PropertyTree();
    data.addBinaryReference("myBinaryRef", ref1);
    final Node node1 = createNode(CreateNodeParams.create().parent(NodePath.ROOT).name("myName").data(data).attachBinary(ref1, ByteSource.wrap("myBinaryData".getBytes())).build());
    final AttachedBinary originalBinary = node1.getAttachedBinaries().getByBinaryReference(ref1);
    final Node updatedNode = updateNode(UpdateNodeParams.create().id(node1.id()).editor((e) -> {
    }).attachBinary(ref2, ByteSource.wrap("myOtherBinaryData".getBytes())).build());
    final AttachedBinary updateBinary = updatedNode.getAttachedBinaries().getByBinaryReference(ref1);
    final TestDumpWriter writer = new TestDumpWriter();
    doDump(writer);
    assertTrue(writer.getBinaries().contains(BlobKey.from(originalBinary.getBlobKey())));
    assertTrue(writer.getBinaries().contains(BlobKey.from(updateBinary.getBlobKey())));
}
Also used : BinaryReference(com.enonic.xp.util.BinaryReference) BeforeEach(org.junit.jupiter.api.BeforeEach) CreateNodeParams(com.enonic.xp.node.CreateNodeParams) BranchDumpEntry(com.enonic.xp.repo.impl.dump.model.BranchDumpEntry) Node(com.enonic.xp.node.Node) NodePath(com.enonic.xp.node.NodePath) BlobKey(com.enonic.xp.blob.BlobKey) AttachedBinary(com.enonic.xp.node.AttachedBinary) NodeHelper(com.enonic.xp.repo.impl.node.NodeHelper) UpdateNodeParams(com.enonic.xp.node.UpdateNodeParams) Test(org.junit.jupiter.api.Test) List(java.util.List) AbstractNodeTest(com.enonic.xp.repo.impl.node.AbstractNodeTest) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) ByteSource(com.google.common.io.ByteSource) PropertyTree(com.enonic.xp.data.PropertyTree) PropertyTree(com.enonic.xp.data.PropertyTree) Node(com.enonic.xp.node.Node) BinaryReference(com.enonic.xp.util.BinaryReference) AttachedBinary(com.enonic.xp.node.AttachedBinary) Test(org.junit.jupiter.api.Test) AbstractNodeTest(com.enonic.xp.repo.impl.node.AbstractNodeTest)

Example 85 with PropertyTree

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

the class PathMatchQueryBuilderTest method test.

private void test(final String fileName) throws Exception {
    final String queryString = load("pathMatch/query/" + fileName + ".json");
    final PropertyTree dslExpression = readJson(queryString);
    final QueryBuilder builder = new PathMatchQueryBuilder(dslExpression.getSet("pathMatch")).create();
    assertJson("pathMatch/result/" + fileName + ".json", builder.toString());
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) QueryBuilder(org.elasticsearch.index.query.QueryBuilder)

Aggregations

PropertyTree (com.enonic.xp.data.PropertyTree)660 Test (org.junit.jupiter.api.Test)405 PropertySet (com.enonic.xp.data.PropertySet)150 Content (com.enonic.xp.content.Content)126 Node (com.enonic.xp.node.Node)112 CreateContentParams (com.enonic.xp.content.CreateContentParams)64 Form (com.enonic.xp.form.Form)37 Page (com.enonic.xp.page.Page)32 AbstractNodeTest (com.enonic.xp.repo.impl.node.AbstractNodeTest)31 DescriptorKey (com.enonic.xp.page.DescriptorKey)30 GetContentTypeParams (com.enonic.xp.schema.content.GetContentTypeParams)30 CreateNodeParams (com.enonic.xp.node.CreateNodeParams)28 PrincipalKey (com.enonic.xp.security.PrincipalKey)28 BinaryReference (com.enonic.xp.util.BinaryReference)28 Property (com.enonic.xp.data.Property)26 UpdateContentParams (com.enonic.xp.content.UpdateContentParams)24 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)23 ByteSource (com.google.common.io.ByteSource)22 ExtraData (com.enonic.xp.content.ExtraData)21 Instant (java.time.Instant)21