Search in sources :

Example 1 with IndexerRelatedIndexingException

use of eu.europeana.indexing.exception.IndexerRelatedIndexingException in project metis-sandbox by europeana.

the class IndexingServiceImplTest method indexPreview_IndexingIssue_expectFail.

@Test
void indexPreview_IndexingIssue_expectFail() throws IndexingException {
    var record = Record.builder().recordId("1").content("".getBytes()).language(Language.IT).country(Country.ITALY).datasetName("").datasetId("").build();
    doThrow(new IndexerRelatedIndexingException("Failed")).when(previewIndexer).index(any(InputStream.class), any());
    assertThrows(RecordProcessingException.class, () -> service.index(record, IndexEnvironment.PREVIEW));
}
Also used : InputStream(java.io.InputStream) IndexerRelatedIndexingException(eu.europeana.indexing.exception.IndexerRelatedIndexingException) Test(org.junit.jupiter.api.Test)

Example 2 with IndexerRelatedIndexingException

use of eu.europeana.indexing.exception.IndexerRelatedIndexingException in project metis-framework by europeana.

the class FullBeanPublisher method getSolrDocuments.

private SolrDocumentList getSolrDocuments(Map<String, String> queryParamMap) throws IndexerRelatedIndexingException, RecordRelatedIndexingException {
    MapSolrParams queryParams = new MapSolrParams(queryParamMap);
    QueryResponse response;
    try {
        response = solrServer.query(queryParams);
    } catch (SolrServerException e) {
        throw new IndexerRelatedIndexingException(SOLR_SERVER_SEARCH_ERROR, e);
    } catch (IOException e) {
        throw new RecordRelatedIndexingException(SOLR_SERVER_SEARCH_ERROR, e);
    }
    return response.getResults();
}
Also used : MapSolrParams(org.apache.solr.common.params.MapSolrParams) QueryResponse(org.apache.solr.client.solrj.response.QueryResponse) SolrServerException(org.apache.solr.client.solrj.SolrServerException) IndexerRelatedIndexingException(eu.europeana.indexing.exception.IndexerRelatedIndexingException) RecordRelatedIndexingException(eu.europeana.indexing.exception.RecordRelatedIndexingException) IOException(java.io.IOException)

Example 3 with IndexerRelatedIndexingException

use of eu.europeana.indexing.exception.IndexerRelatedIndexingException in project metis-framework by europeana.

the class IndexerPool method indexRecord.

private void indexRecord(IndexTask indexTask) throws IndexingException {
    // Obtain indexer from the pool.
    final Indexer indexer;
    try {
        indexer = pool.borrowObject();
    } catch (IndexingException e) {
        throw e;
    } catch (Exception e) {
        throw new IndexerRelatedIndexingException("Error while obtaining indexer from the pool.", e);
    }
    // Perform indexing and release indexer.
    try {
        indexTask.performTask(indexer);
    } catch (IndexerRelatedIndexingException e) {
        invalidateAndSwallowException(indexer);
        throw e;
    } catch (IndexingException e) {
        // If any other indexing exception occurs we want to return the indexer to the pool
        pool.returnObject(indexer);
        throw e;
    }
    // Return indexer to the pool if it has not been invalidated.
    pool.returnObject(indexer);
}
Also used : IndexingException(eu.europeana.indexing.exception.IndexingException) SetupRelatedIndexingException(eu.europeana.indexing.exception.SetupRelatedIndexingException) IndexerRelatedIndexingException(eu.europeana.indexing.exception.IndexerRelatedIndexingException) IndexerRelatedIndexingException(eu.europeana.indexing.exception.IndexerRelatedIndexingException) IndexingException(eu.europeana.indexing.exception.IndexingException) SetupRelatedIndexingException(eu.europeana.indexing.exception.SetupRelatedIndexingException) IndexerRelatedIndexingException(eu.europeana.indexing.exception.IndexerRelatedIndexingException)

Example 4 with IndexerRelatedIndexingException

use of eu.europeana.indexing.exception.IndexerRelatedIndexingException in project metis-sandbox by europeana.

the class IndexingServiceImplTest method indexPublish_IndexingIssue_expectFail.

@Test
void indexPublish_IndexingIssue_expectFail() throws IndexingException {
    var record = Record.builder().recordId(1L).content("".getBytes()).language(Language.IT).country(Country.ITALY).datasetName("").datasetId("").build();
    doThrow(new IndexerRelatedIndexingException("Failed")).when(publishIndexer).index(any(InputStream.class), any());
    assertThrows(RecordProcessingException.class, () -> service.index(record));
}
Also used : InputStream(java.io.InputStream) IndexerRelatedIndexingException(eu.europeana.indexing.exception.IndexerRelatedIndexingException) Test(org.junit.jupiter.api.Test)

Example 5 with IndexerRelatedIndexingException

use of eu.europeana.indexing.exception.IndexerRelatedIndexingException in project metis-sandbox by europeana.

the class IndexingServiceImplTest method remove_indexingException_expectFail.

@Test
void remove_indexingException_expectFail() throws IndexingException {
    when(publishIndexer.removeAll("1", null)).thenThrow(new IndexerRelatedIndexingException("failed"));
    assertThrows(DatasetIndexRemoveException.class, () -> service.remove("1"));
}
Also used : IndexerRelatedIndexingException(eu.europeana.indexing.exception.IndexerRelatedIndexingException) Test(org.junit.jupiter.api.Test)

Aggregations

IndexerRelatedIndexingException (eu.europeana.indexing.exception.IndexerRelatedIndexingException)10 IOException (java.io.IOException)5 SolrServerException (org.apache.solr.client.solrj.SolrServerException)5 RecordRelatedIndexingException (eu.europeana.indexing.exception.RecordRelatedIndexingException)3 Test (org.junit.jupiter.api.Test)3 FullBeanImpl (eu.europeana.corelib.solr.bean.impl.FullBeanImpl)2 IndexingException (eu.europeana.indexing.exception.IndexingException)2 SetupRelatedIndexingException (eu.europeana.indexing.exception.SetupRelatedIndexingException)2 InputStream (java.io.InputStream)2 MongoClientException (com.mongodb.MongoClientException)1 MongoConfigurationException (com.mongodb.MongoConfigurationException)1 MongoIncompatibleDriverException (com.mongodb.MongoIncompatibleDriverException)1 MongoInternalException (com.mongodb.MongoInternalException)1 MongoInterruptedException (com.mongodb.MongoInterruptedException)1 MongoSecurityException (com.mongodb.MongoSecurityException)1 MongoSocketException (com.mongodb.MongoSocketException)1 Datastore (dev.morphia.Datastore)1 RdfToFullBeanConverter (eu.europeana.indexing.fullbean.RdfToFullBeanConverter)1 FullBeanUpdater (eu.europeana.indexing.mongo.FullBeanUpdater)1 SolrDocumentPopulator (eu.europeana.indexing.solr.SolrDocumentPopulator)1