Package org.fao.geonet.domain

Examples of org.fao.geonet.domain.SchematronCriteriaGroup


    @Autowired
    private SchematronCriteriaRepository _criteriaRepository;

    @Test
    public void testHasSchematronId() throws Exception {
        SchematronCriteriaGroup group1 = newGroup(_inc, _schematronRepository);
        group1 = _criteriaGroupRepository.saveAndFlush(group1);

        SchematronCriteriaGroup group2 = newGroup(_inc, _schematronRepository);
        group2 = _criteriaGroupRepository.saveAndFlush(group2);

        SchematronCriteriaGroup group3 = newGroup(_inc, _schematronRepository);
        group3.setSchematron(group1.getSchematron());
        group3 = _criteriaGroupRepository.saveAndFlush(group3);

        final List<SchematronCriteria> found = _criteriaRepository.findAll(SchematronCriteriaSpecs.hasSchematronId(group1.getSchematron()
                .getId()));
View Full Code Here


        assertCorrectCriteriaFound(group1, group2, group3, found);
    }

    @Test
    public void testHasGroupName() throws Exception {
        SchematronCriteriaGroup group1 = newGroup(_inc, _schematronRepository);
        group1 = _criteriaGroupRepository.saveAndFlush(group1);

        SchematronCriteriaGroup group2 = newGroup(_inc, _schematronRepository);
        group2 = _criteriaGroupRepository.saveAndFlush(group2);

        SchematronCriteriaGroup group3 = newGroup(_inc, _schematronRepository);
        group3.getId().setName(group1.getId().getName());
        group3 = _criteriaGroupRepository.saveAndFlush(group3);

        final List<SchematronCriteria> found = _criteriaRepository.findAll(SchematronCriteriaSpecs.hasGroupName(group1.getId().getName()));

        assertCorrectCriteriaFound(group1, group2, group3, found);
View Full Code Here

    @Autowired
    private SchematronRepository _schematronRepository;

    @Test
    public void testHasSchematronId() throws Exception {
        SchematronCriteriaGroup group1 = newGroup(_inc, _schematronRepository);
        group1 = _criteriaGroupRepository.saveAndFlush(group1);

        SchematronCriteriaGroup group2 = newGroup(_inc, _schematronRepository);
        group2 = _criteriaGroupRepository.saveAndFlush(group2);

        SchematronCriteriaGroup group3 = newGroup(_inc, _schematronRepository);
        group3.setSchematron(group1.getSchematron());
        group3 = _criteriaGroupRepository.saveAndFlush(group3);

        final List<SchematronCriteriaGroup> found = _criteriaGroupRepository.findAll(SchematronCriteriaGroupSpecs.hasSchematronId(group1.getSchematron()
                .getId()));
View Full Code Here

        assertCorrectCriteriaFound(group1, group2, group3, found);
    }

    @Test
    public void testHasGroupName() throws Exception {
        SchematronCriteriaGroup group1 = newGroup(_inc, _schematronRepository);
        group1 = _criteriaGroupRepository.saveAndFlush(group1);

        SchematronCriteriaGroup group2 = newGroup(_inc, _schematronRepository);
        group2 = _criteriaGroupRepository.saveAndFlush(group2);

        SchematronCriteriaGroup group3 = newGroup(_inc, _schematronRepository);
        group3.getId().setName(group1.getId().getName());
        group3 = _criteriaGroupRepository.saveAndFlush(group3);

        final List<SchematronCriteriaGroup> found = _criteriaGroupRepository.findAll(SchematronCriteriaGroupSpecs.hasGroupName(group1.getId().getName()));

        assertCorrectCriteriaFound(group1, group2, group3, found);
View Full Code Here

    private SchematronCriteriaGroupRepository criteriaGroupRepository;
    private AtomicInteger _inc = new AtomicInteger(10);

    @Test
    public void testFindOne() throws Exception {
        final SchematronCriteriaGroup criteriaGroup = criteriaGroupRepository.save(newGroup(_inc,_schematronRepo));

        final SchematronCriteria criteria = criteriaGroup.getCriteria().get(0);
        final SchematronCriteria found = _repo.findOne(criteria.getId());

        assertSameContents(criteria, found);
    }
View Full Code Here

        assertSameContents(criteria, found);
    }

    @Test
    public void testDelete() throws Exception {
        final SchematronCriteriaGroup criteriaGroup = criteriaGroupRepository.save(newGroup(_inc,_schematronRepo));
        final SchematronCriteria criteria = criteriaGroup.getCriteria().get(0);

        assertTrue(_repo.exists(criteria.getId()));
        _repo.delete(criteria.getId());
        assertFalse(_repo.exists(criteria.getId()));
    }
View Full Code Here

        assertFalse(_repo.exists(criteria.getId()));
    }

    @Test
    public void testDeleteEntity() throws Exception {
        final SchematronCriteriaGroup criteriaGroup = criteriaGroupRepository.save(newGroup(_inc,_schematronRepo));
        final SchematronCriteria criteria = criteriaGroup.getCriteria().get(0);
        assertTrue(_repo.exists(criteria.getId()));
        _repo.delete(criteria);
        assertFalse(_repo.exists(criteria.getId()));
    }
View Full Code Here

        assertFalse(_repo.exists(criteria.getId()));
    }

    @Test
    public void testSave() throws Exception {
        final SchematronCriteriaGroup criteriaGroup = criteriaGroupRepository.save(newGroup(_inc,_schematronRepo));
        final SchematronCriteria criteria = criteriaGroup.getCriteria().get(0);

        final String newValue = "newValue";
        criteria.setValue(newValue);
        _repo.save(criteria);
        final List<SchematronCriteria> all = _repo.findAll(new Specification<SchematronCriteria>() {
            @Override
            public Predicate toPredicate(Root<SchematronCriteria> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                return cb.equal(root.get(SchematronCriteria_.id), criteria.getId());
            }
        });

        assertEquals(1, all.size());
        assertEquals(newValue, all.get(0).getValue());

        final SchematronCriteria newCriteria = newSchematronCriteria(_inc);
        criteriaGroup.addCriteria(newCriteria);
        _repo.save(newCriteria);

        SchematronCriteriaGroup reloaded = criteriaGroupRepository.findOne(criteriaGroup.getId());
        assertTrue(reloaded.getCriteria().contains(newCriteria));

        final List<SchematronCriteriaGroup> allGroups = criteriaGroupRepository.findAll();

        assertEquals(1, allGroups.size());
        assertTrue(allGroups.get(0).getCriteria().contains(newCriteria));
View Full Code Here



    @Test
    public void testDeleteMany() throws Exception {
        final SchematronCriteriaGroup criteriaGroup1 = criteriaGroupRepository.save(newGroup(_inc,_schematronRepo));
        final SchematronCriteriaGroup criteriaGroup2 = criteriaGroupRepository.save(newGroup(_inc,_schematronRepo));
        final SchematronCriteria criteria1 = criteriaGroup1.getCriteria().get(0);
        final SchematronCriteria criteria2 = criteriaGroup2.getCriteria().get(0);
        assertTrue(_repo.exists(criteria1.getId()));
        assertTrue(_repo.exists(criteria2.getId()));
        _repo.delete(Arrays.asList(criteria1, criteria2));
        assertFalse(_repo.exists(criteria1.getId()));
        assertFalse(_repo.exists(criteria2.getId()));
View Full Code Here

        _schematronCriteriaGroupRepository.deleteAll();
        _schematronRepository.deleteAll();
        assertEquals(0, _schematronCriteriaRepository.count());
        this._group1_Name1_SchematronId1 = _schematronCriteriaGroupRepository.save(newGroup(_inc, _schematronRepository));
        this._group2_Name2_SchematronId2 = _schematronCriteriaGroupRepository.save(newGroup(_inc, _schematronRepository));
        final SchematronCriteriaGroup entity = newGroup(_inc, _schematronRepository);
        entity.setSchematron(_group1_Name1_SchematronId1.getSchematron());
        this._group3_Name3_SchemtronId1 = _schematronCriteriaGroupRepository.save(entity);
        final SchematronCriteriaGroup entity2 = newGroup(_inc, _schematronRepository);
        entity2.getId().setName(_group2_Name2_SchematronId2.getId().getName());
        this._group4_Name2_SchematronId4 = _schematronCriteriaGroupRepository.save(entity2);
    }
View Full Code Here

TOP

Related Classes of org.fao.geonet.domain.SchematronCriteriaGroup

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.