Examples of HarvestHistory


Examples of org.fao.geonet.domain.HarvestHistory

                setAttribute("recordsRemoved", numberOfRecordsRemoved + ""));
        final String lastRun = new DateTime().withZone(DateTimeZone.forID("UTC")).toString();
        ISODate lastRunDate = new ISODate(lastRun);

        HarvestHistoryRepository historyRepository = context.getBean(HarvestHistoryRepository.class);
        HarvestHistory history = new HarvestHistory();
        history.setDeleted(true);
        history.setElapsedTime((int) elapsedTime);
        history.setHarvestDate(lastRunDate);
        history.setHarvesterName(ah.getParams().name);
        history.setHarvesterType(ah.getType());
        history.setHarvesterUuid(ah.getParams().uuid);
        history.setInfo(historyEl);
        history.setParams(ah.getParams().node);

        historyRepository.save(history);
        return OperResult.OK;
    }}
View Full Code Here

Examples of org.fao.geonet.domain.HarvestHistory

    @Autowired
    HarvestHistoryRepository _repo;

    @Test
    public void testHasHarvesterUuid() throws Exception {
        HarvestHistory history1 = newHarvestHistory();
        history1 = _repo.save(history1);

        HarvestHistory history2 = newHarvestHistory();
        _repo.save(history2);


        final List<HarvestHistory> found = _repo.findAll(hasHarvesterUuid(history1.getHarvesterUuid()));
        assertEquals(1, found.size());
View Full Code Here

Examples of org.fao.geonet.domain.HarvestHistory

    @Autowired
    HarvestHistoryRepository _repo;

    @Test
    public void testFindOne() {
        HarvestHistory history1 = newHarvestHistory();
        history1 = _repo.save(history1);

        HarvestHistory history2 = newHarvestHistory();
        history2 = _repo.save(history2);


        assertEquals(history2, _repo.findOne(history2.getId()));
        assertEquals(history1, _repo.findOne(history1.getId()));
    }
View Full Code Here

Examples of org.fao.geonet.domain.HarvestHistory

        assertEquals(history1, _repo.findOne(history1.getId()));
    }

    @Test
    public void testFindCustomFindAllAsXml() {
        HarvestHistory history1 = newHarvestHistory();
        String infoText = "this is the info string";
        String paramText = "this is the param string";
        history1.setInfo(new Element("infodata").setText(infoText));
        history1.setParams(new Element("params").addContent(new Element("param1").setText(paramText)));
        _repo.save(history1);

        Element xml = _repo.findAllAsXml();

        Element history1AsEl = (Element) xml.getChildren().get(0);
View Full Code Here

Examples of org.fao.geonet.domain.HarvestHistory

        assertEquals(paramText, param1.getText());
    }

    @Test
    public void testFindByEmailCswServerCapabilitiesInfo() {
        HarvestHistory history1 = newHarvestHistory();
        history1 = _repo.save(history1);

        HarvestHistory history2 = newHarvestHistory();
        history2 = _repo.save(history2);

        List<HarvestHistory> histories = _repo.findAllByHarvesterType(history1.getHarvesterType());

        assertEquals(history1.getHarvesterType(), histories.get(0).getHarvesterType());

        histories = _repo.findAllByHarvesterType(history2.getHarvesterType());

        assertEquals(history2.getHarvesterType(), histories.get(0).getHarvesterType());
    }
View Full Code Here

Examples of org.fao.geonet.domain.HarvestHistory

        assertEquals(history2.getHarvesterType(), histories.get(0).getHarvesterType());
    }

    @Test
    public void testMarkAllAsDeleted() {
        HarvestHistory history1 = newHarvestHistory();
        history1.setDeleted(false);
        history1 = _repo.save(history1);

        HarvestHistory history2 = newHarvestHistory();
        history2.setDeleted(false);
        history2 = _repo.save(history2);

        _repo.markAllAsDeleted(history1.getHarvesterUuid());

        List<HarvestHistory> found = _repo.findAll(Collections.singleton(history1.getId()));
        assertTrue(found.get(0).isDeleted());
        List<HarvestHistory> found2 = _repo.findAll(Collections.singleton(history2.getId()));
        assertFalse(found2.get(0).isDeleted());
        assertTrue(_repo.findOne(history1.getId()).isDeleted());
        assertFalse(_repo.findOne(history2.getId()).isDeleted());
    }
View Full Code Here

Examples of org.fao.geonet.domain.HarvestHistory

        assertFalse(_repo.findOne(history2.getId()).isDeleted());
    }

    @Test
    public void testDeleteAllById() {
        HarvestHistory history1 = newHarvestHistory();
        history1.setDeleted(false);
        history1 = _repo.save(history1);

        HarvestHistory history2 = newHarvestHistory();
        history2.setDeleted(false);
        history2 = _repo.save(history2);

        _repo.deleteAllById(Arrays.asList(history1.getId()));

        List<HarvestHistory> found = _repo.findAll();
        assertEquals(1, found.size());
        assertEquals(history2.getId(), found.get(0).getId());

        assertNull(_repo.findOne(history1.getId()));
    }
View Full Code Here

Examples of org.fao.geonet.domain.HarvestHistory

        return createHarvestHistory(_inc);
    }

    public static HarvestHistory createHarvestHistory(AtomicInteger inc) {
        int val = inc.incrementAndGet();
        HarvestHistory customElementSet = new HarvestHistory()
                .setDeleted(val % 2 == 0)
                .setHarvesterName("name" + val)
                .setHarvesterType("type" + val)
                .setHarvesterUuid("uuid" + val);
        return customElementSet;
View Full Code Here

Examples of org.fao.geonet.domain.HarvestHistory

        CswHarvesterIntegrationTest.addCswSpecificParams(csw);
        final String id = _harvestManager.addHarvesterReturnId(csw, context.getUserSession().getUserId());
        final Element harvesterConfig = _harvestManager.get(id, context, null);
        final String harvesterName = "Name";
        final String harvesterUuid = Xml.selectString(harvesterConfig, "*//uuid");
        final HarvestHistory history = createHistory(harvesterName, harvesterUuid, new ISODate("1980-01-01T10:00:00"));
        final HarvestHistory history2 = createHistory(harvesterName, harvesterUuid, new ISODate("1980-02-01T10:00:00"));
        final HarvestHistory history3 = createHistory(harvesterName, harvesterUuid, new ISODate("1979-02-01T10:00:00"));

        final History historyService = new History();
        Element params = Xml.loadString("<request><id>"+id+"</id><uuid>"+harvesterUuid+"</uuid></request>", false);
        final Element results = historyService.exec(params, context);


        assertEquals(1, results.getChildren("harvesthistory").size());
        final List<Element> harvestHistory = results.getChild("harvesthistory").getChildren();
        assertEquals(3, harvestHistory.size());
        assertEquals(history2.getHarvestDate(), new ISODate(harvestHistory.get(0).getChildText("harvestdate")));
        assertEquals(history2.getId(), Integer.parseInt(harvestHistory.get(0).getChildText("id")));
        assertEquals(history.getHarvestDate(), new ISODate(harvestHistory.get(1).getChildText("harvestdate")));
        assertEquals(history.getId(), Integer.parseInt(harvestHistory.get(1).getChildText("id")));
        assertEquals(history3.getHarvestDate(), new ISODate(harvestHistory.get(2).getChildText("harvestdate")));
        assertEquals(history3.getId(), Integer.parseInt(harvestHistory.get(2).getChildText("id")));
    }
View Full Code Here

Examples of org.fao.geonet.domain.HarvestHistory

        assertEquals(1, results.getChildren("harvesthistory").size());
        assertEquals(0, results.getChild("harvesthistory").getChildren().size());
    }

    private HarvestHistory createHistory(String harvesterName, String harvesterUuid, ISODate harvestDate) throws IOException, JDOMException {
        return _repo.save(new HarvestHistory()
                    .setDeleted(false)
                    .setElapsedTime((int) TimeUnit.SECONDS.toMillis(3))
                    .setHarvestDate(harvestDate)
                    .setHarvesterName(harvesterName)
                    .setHarvesterType("csw")
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.