use of org.springframework.batch.core.JobExecution in project RecordManager2 by moravianlibrary.
the class ZakonyProLidiFacadeImpl method runZakonyProLidiHarvestJob.
@Override
public void runZakonyProLidiHarvestJob() {
Map<String, JobParameter> parameters = new HashMap<>();
parameters.put(Constants.JOB_PARAM_CONF_ID, new JobParameter(Constants.IMPORT_CONF_ID_ZAKONY));
parameters.put(Constants.JOB_PARAM_REPEAT, new JobParameter(Constants.JOB_PARAM_ONE_VALUE));
JobParameters params = new JobParameters(parameters);
JobExecution exec = jobExecutor.execute(Constants.JOB_ID_HARVEST_ZAKONYPROLIDI, params);
if (!ExitStatus.COMPLETED.equals(exec.getExitStatus())) {
throw new JobExecutionFailure("ZakonyProLidi harvest failed", exec);
}
}
use of org.springframework.batch.core.JobExecution in project RecordManager2 by moravianlibrary.
the class ZakonyProLidiFacadeImpl method runZakonyProLidiFulltextJob.
@Override
public void runZakonyProLidiFulltextJob() {
Map<String, JobParameter> parameters = new HashMap<>();
parameters.put(Constants.JOB_PARAM_CONF_ID, new JobParameter(Constants.IMPORT_CONF_ID_ZAKONY));
parameters.put(Constants.JOB_PARAM_REPEAT, new JobParameter(Constants.JOB_PARAM_ONE_VALUE));
JobParameters params = new JobParameters(parameters);
JobExecution exec = jobExecutor.execute(Constants.JOB_ID_FULLTEXT_ZAKONYPROLIDI, params);
if (!ExitStatus.COMPLETED.equals(exec.getExitStatus())) {
throw new JobExecutionFailure("ZakonyProLidi fulltext failed", exec);
}
}
use of org.springframework.batch.core.JobExecution in project RecordManager2 by moravianlibrary.
the class CosmotronHarvestJobTest method testCosmotronArticle.
@Test
public void testCosmotronArticle() throws Exception {
reset(httpClient);
InputStream response0 = this.getClass().getResourceAsStream("/sample/Identify.xml");
InputStream response1 = this.getClass().getResourceAsStream("/sample/cosmotron/Article.xml");
expect(httpClient.executeGet("http://katalog.cbvk.cz/i2/i2.ws.oai.cls?verb=Identify")).andReturn(response0);
expect(httpClient.executeGet("http://katalog.cbvk.cz/i2/i2.ws.oai.cls?verb=ListRecords&metadataPrefix=oai_marcxml_cpk")).andReturn(response1);
replay(httpClient);
final Long confID = 328L;
Map<String, JobParameter> params = new HashMap<>();
params.put(Constants.JOB_PARAM_CONF_ID, new JobParameter(confID));
JobExecution exec = jobExecutor.execute(Constants.JOB_ID_HARVEST_COSMOTRON, new JobParameters(params));
Assert.assertEquals(exec.getExitStatus(), ExitStatus.COMPLETED);
OAIHarvestConfiguration config = configDao.get(confID);
HarvestedRecord hr = recordDao.findByIdAndHarvestConfiguration("LiUsCat_r011834", config);
Assert.assertNotNull(hr);
Assert.assertNull(hr.getDeleted());
}
use of org.springframework.batch.core.JobExecution in project RecordManager2 by moravianlibrary.
the class CosmotronHarvestJobTest method testDeleted996.
@Test
public void testDeleted996() throws Exception {
reset(httpClient);
InputStream response0 = this.getClass().getResourceAsStream("/sample/Identify.xml");
InputStream response1 = this.getClass().getResourceAsStream("/sample/cosmotron/RecordAnd996.xml");
InputStream response2 = this.getClass().getResourceAsStream("/sample/cosmotron/Deleted996.xml");
expect(httpClient.executeGet("http://katalog.cbvk.cz/i2/i2.ws.oai.cls?verb=Identify")).andReturn(response0);
expect(httpClient.executeGet("http://katalog.cbvk.cz/i2/i2.ws.oai.cls?verb=ListRecords&metadataPrefix=oai_marcxml_cpk")).andReturn(response1);
expect(httpClient.executeGet("http://katalog.cbvk.cz/i2/i2.ws.oai.cls?verb=ListRecords&resumptionToken=123456")).andReturn(response2);
replay(httpClient);
final Long confID = 328L;
Map<String, JobParameter> params = new HashMap<>();
params.put(Constants.JOB_PARAM_CONF_ID, new JobParameter(confID));
JobExecution exec = jobExecutor.execute(Constants.JOB_ID_HARVEST_COSMOTRON, new JobParameters(params));
Assert.assertEquals(exec.getExitStatus(), ExitStatus.COMPLETED);
OAIHarvestConfiguration config = configDao.get(confID);
Assert.assertNotNull(recordDao.findByIdAndHarvestConfiguration("CbvkUsCat" + Constants.COSMOTRON_RECORD_ID_CHAR + "m0000002", config));
Cosmotron996 cosmo = cosmotronDao.findByIdAndHarvestConfiguration("CbvkUsCat" + Constants.COSMOTRON_RECORD_ID_CHAR + "0000003", config);
Assert.assertNotNull(cosmo);
Assert.assertNotNull(cosmo.getDeleted());
}
use of org.springframework.batch.core.JobExecution in project RecordManager2 by moravianlibrary.
the class CosmotronHarvestJobTest method testUpdated996.
@Test
public void testUpdated996() throws Exception {
reset(httpClient);
InputStream response0 = this.getClass().getResourceAsStream("/sample/Identify.xml");
InputStream response1 = this.getClass().getResourceAsStream("/sample/cosmotron/RecordAnd996.xml");
InputStream response2 = this.getClass().getResourceAsStream("/sample/cosmotron/Updated996.xml");
expect(httpClient.executeGet("http://katalog.cbvk.cz/i2/i2.ws.oai.cls?verb=Identify")).andReturn(response0);
expect(httpClient.executeGet("http://katalog.cbvk.cz/i2/i2.ws.oai.cls?verb=ListRecords&metadataPrefix=oai_marcxml_cpk")).andReturn(response1);
expect(httpClient.executeGet("http://katalog.cbvk.cz/i2/i2.ws.oai.cls?verb=ListRecords&resumptionToken=123456")).andReturn(response2);
replay(httpClient);
final Long confID = 328L;
Map<String, JobParameter> params = new HashMap<>();
params.put(Constants.JOB_PARAM_CONF_ID, new JobParameter(confID));
JobExecution exec = jobExecutor.execute(Constants.JOB_ID_HARVEST_COSMOTRON, new JobParameters(params));
Assert.assertEquals(exec.getExitStatus(), ExitStatus.COMPLETED);
OAIHarvestConfiguration config = configDao.get(confID);
Assert.assertNotNull(recordDao.findByIdAndHarvestConfiguration("CbvkUsCat" + Constants.COSMOTRON_RECORD_ID_CHAR + "m0000002", config));
Cosmotron996 cosmo = cosmotronDao.findByIdAndHarvestConfiguration("CbvkUsCat" + Constants.COSMOTRON_RECORD_ID_CHAR + "0000003", config);
Assert.assertNotNull(cosmo);
InputStream is = new ByteArrayInputStream(cosmo.getRawRecord());
Record record = marcXmlParser.parseUnderlyingRecord(is);
MarcRecord marcRecord = new MarcRecordImpl(record);
Assert.assertNotNull(marcRecord.getDataFields("100"));
}
Aggregations