Package org.springframework.data.repository.query.parser

Examples of org.springframework.data.repository.query.parser.Part


        assertThat(queryString, is("MATCH (`person`:`Person`) WHERE `person`.`name` = {0} RETURN `person` ORDER BY person.name ASC,person.age DESC"));
    }

    @Test
    public void buildsQueryWithPage() {
        query.addRestriction(new Part("name",Person.class));
        Pageable pageable = new PageRequest(3,10,new Sort("person.name"));
        String queryString = query.buildQuery().toQueryString(pageable);
        assertThat(queryString, is("MATCH (`person`:`Person`) WHERE `person`.`name` = {0} RETURN `person` ORDER BY person.name ASC SKIP 30 LIMIT 10"));
    }
View Full Code Here


        assertThat(queryString, is("MATCH (`person`:`Person`) WHERE `person`.`name` = {0} RETURN `person` ORDER BY person.name ASC SKIP 30 LIMIT 10"));
    }

    @Test
    public void shouldFindByNodeEntity() throws Exception {
        query.addRestriction(new Part("pet", Person.class));
        assertThat(query.toString(), is( getExpectedQuery("trs-specific-test-subclass-expected-to-set-value")));
    }
View Full Code Here

        assertThat(query.toString(), is( getExpectedQuery("trs-specific-test-subclass-expected-to-set-value")));
    }

    @Test
    public void shouldFindByNodeEntityForIncomingRelationship() {
        query.addRestriction(new Part("group", Person.class));
        assertThat(query.toString(), is( getExpectedQuery("trs-specific-test-subclass-expected-to-set-value")));
    }
View Full Code Here

    protected Object[] trsSpecificExpectedParams;

    @Test
    public void testCypherQueryBuilderWithTwoIndexedParams() throws Exception {
        CypherQueryBuilder builder = new CypherQueryBuilder(ctx, Thing.class, template);
        builder.addRestriction(new Part("firstName",Thing.class));
        builder.addRestriction(new Part("lastName",Thing.class));
        CypherQueryDefinition query = builder.buildQuery();
        assertEquals(
                getExpectedQuery("START `thing`=node:`Thing`({0}) RETURN `thing`"),
                query.toQueryString());
View Full Code Here

        assertThat(query.toString(), is( trsSpecificExpectedQuery));
    }

    @Override
    public void createsQueryForSimplePropertyReference() {
        Part part = new Part("name2", Person.class);
        query.addRestriction(part);
        assertThat(query.toString(),
                is("START `person`=node:`Person`(`name2`={0}) RETURN `person`"));
    }
View Full Code Here

        this.trsSpecificExpectedQuery =
                        "START `person`=node:`Person`(`name2`={0}), `person_group`=node:`Group`(`name2`={1}) " +
                        "MATCH (`person`)<-[:`members`]-(`person_group`), (`person`)<-[:`members`]-(`person_group`)-[:`members`]->(`person_group_members`) " +
                        "WHERE `person`.`age` > {2} AND `person_group_members`.`age` = {3} " +
                        "RETURN `person`";
        query.addRestriction(new Part("name2", Person.class));
        query.addRestriction(new Part("group_Name2", Person.class));
        query.addRestriction(new Part("ageGreaterThan", Person.class));
        query.addRestriction(new Part("groupMembersAge", Person.class));
        assertThat(query.toString(), is( trsSpecificExpectedQuery ));
    }
View Full Code Here

        super.shouldFindByNodeEntityForIncomingRelationship();
    }

    @Override
    public void buildsQueryWithSort() {
        query.addRestriction(new Part("name2",Person.class));
        String queryString = query.buildQuery(new Sort("person.name2")).toQueryString();
        assertThat(queryString, is("START `person`=node:`Person`(`name2`={0}) RETURN `person` ORDER BY person.name2 ASC"));
    }
View Full Code Here

        assertThat(queryString, is("START `person`=node:`Person`(`name2`={0}) RETURN `person` ORDER BY person.name2 ASC"));
    }

    @Override
    public void buildsQueryWithTwoSorts() {
        query.addRestriction(new Part("name2",Person.class));
        Sort sort = new Sort(new Sort.Order("person.name2"),new Sort.Order(Sort.Direction.DESC, "person.age"));
        String queryString = query.buildQuery(sort).toQueryString();
        assertThat(queryString, is("START `person`=node:`Person`(`name2`={0}) RETURN `person` ORDER BY person.name2 ASC,person.age DESC"));
    }
View Full Code Here

        assertThat(queryString, is("START `person`=node:`Person`(`name2`={0}) RETURN `person` ORDER BY person.name2 ASC,person.age DESC"));
    }

    @Override
    public void buildsQueryWithPage() {
        query.addRestriction(new Part("name2",Person.class));
        Pageable pageable = new PageRequest(3,10,new Sort("person.name2"));
        String queryString = query.buildQuery().toQueryString(pageable);
        assertThat(queryString, is("START `person`=node:`Person`(`name2`={0}) RETURN `person` ORDER BY person.name2 ASC SKIP 30 LIMIT 10"));
    }
View Full Code Here

    @Override
    @Test
    public void createsQueryForPropertyOnRelationShipReference() {
        this.trsSpecificExpectedQuery = "START `person_group`=node:`Group`(`name2`={0}) MATCH (`person`)<-[:`members`]-(`person_group`) RETURN `person`";
        Part part = new Part("group.name2", Person.class);
        query.addRestriction(part);
        assertThat(query.toString(), is( trsSpecificExpectedQuery));
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.repository.query.parser.Part

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.