Search in sources :

Example 6 with ProcessingDetailsImpl

use of ddf.catalog.operation.impl.ProcessingDetailsImpl in project ddf by codice.

the class ProcessingDetailsImplTest method testEqualityOfHashCodes.

@Test
public void testEqualityOfHashCodes() {
    Exception exception = new UnsupportedQueryException("We do not support this query");
    ProcessingDetails processingDetails = new ProcessingDetailsImpl("test source", exception, "warning");
    ProcessingDetails identicalProcessingDetails = new ProcessingDetailsImpl("test source", exception, "warning");
    assertThat("\nThe hashCodes of ProcessingDetails with equal sourceIds, equal\n" + "exceptions, and equal warnings should have been equal, but were not.\n", processingDetails.hashCode(), is(identicalProcessingDetails.hashCode()));
}
Also used : UnsupportedQueryException(ddf.catalog.source.UnsupportedQueryException) UnsupportedQueryException(ddf.catalog.source.UnsupportedQueryException) ProcessingDetailsImpl(ddf.catalog.operation.impl.ProcessingDetailsImpl) Test(org.junit.Test)

Example 7 with ProcessingDetailsImpl

use of ddf.catalog.operation.impl.ProcessingDetailsImpl in project ddf by codice.

the class ProcessingDetailsImplTest method testEqualityOfHashCodesForNullSourceIds.

@Test
public void testEqualityOfHashCodesForNullSourceIds() {
    List<String> warnings = Collections.singletonList("warning");
    Exception exception = new UnsupportedQueryException("We do not support this query");
    ProcessingDetails processingDetails = new ProcessingDetailsImpl(null, exception, warnings);
    ProcessingDetails identicalProcessingDetails = new ProcessingDetailsImpl(null, exception, warnings);
    assertThat("\nThe hashCodes of ProcessingDetails with null sourceIds, equal\n" + "exceptions, and equal warnings should have been equal, but were not.\n", processingDetails.hashCode(), is(identicalProcessingDetails.hashCode()));
}
Also used : UnsupportedQueryException(ddf.catalog.source.UnsupportedQueryException) UnsupportedQueryException(ddf.catalog.source.UnsupportedQueryException) ProcessingDetailsImpl(ddf.catalog.operation.impl.ProcessingDetailsImpl) Test(org.junit.Test)

Example 8 with ProcessingDetailsImpl

use of ddf.catalog.operation.impl.ProcessingDetailsImpl in project ddf by codice.

the class SortedQueryMonitor method timeoutRemainingSources.

private void timeoutRemainingSources(Set<ProcessingDetails> processingDetails) {
    for (QueryRequest expiredSource : futures.values()) {
        if (expiredSource != null) {
            String sourceId = getSourceIdFromRequest(expiredSource);
            LOGGER.info("Search timed out for {}", sourceId);
            processingDetails.add(new ProcessingDetailsImpl(sourceId, new TimeoutException()));
        }
    }
}
Also used : QueryRequest(ddf.catalog.operation.QueryRequest) ProcessingDetailsImpl(ddf.catalog.operation.impl.ProcessingDetailsImpl) TimeoutException(java.util.concurrent.TimeoutException)

Example 9 with ProcessingDetailsImpl

use of ddf.catalog.operation.impl.ProcessingDetailsImpl in project ddf by codice.

the class SortedQueryMonitor method interruptRemainingSources.

private void interruptRemainingSources(Set<ProcessingDetails> processingDetails, InterruptedException interruptedException) {
    for (QueryRequest interruptedSource : futures.values()) {
        if (interruptedSource != null) {
            String sourceId = getSourceIdFromRequest(interruptedSource);
            LOGGER.info("Search interrupted for {}", sourceId);
            processingDetails.add(new ProcessingDetailsImpl(sourceId, interruptedException));
        }
    }
}
Also used : QueryRequest(ddf.catalog.operation.QueryRequest) ProcessingDetailsImpl(ddf.catalog.operation.impl.ProcessingDetailsImpl)

Example 10 with ProcessingDetailsImpl

use of ddf.catalog.operation.impl.ProcessingDetailsImpl in project ddf by codice.

the class CreateOperations method doRemoteCreate.

private CreateResponse doRemoteCreate(CreateRequest createRequest) {
    HashSet<ProcessingDetails> exceptions = new HashSet<>();
    Map<String, Serializable> properties = new HashMap<>();
    List<CatalogStore> stores = opsCatStoreSupport.getCatalogStoresForRequest(createRequest, exceptions);
    for (CatalogStore store : stores) {
        try {
            if (!store.isAvailable()) {
                exceptions.add(new ProcessingDetailsImpl(store.getId(), null, "CatalogStore is not available"));
            } else {
                CreateResponse response = store.create(createRequest);
                properties.put(store.getId(), new ArrayList<>(response.getCreatedMetacards()));
            }
        } catch (IngestException e) {
            INGEST_LOGGER.error("Error creating metacards for CatalogStore {}", store.getId(), e);
            exceptions.add(new ProcessingDetailsImpl(store.getId(), e));
        }
    }
    return new CreateResponseImpl(createRequest, properties, createRequest.getMetacards(), exceptions);
}
Also used : Serializable(java.io.Serializable) HashMap(java.util.HashMap) CreateResponse(ddf.catalog.operation.CreateResponse) ProcessingDetailsImpl(ddf.catalog.operation.impl.ProcessingDetailsImpl) ProcessingDetails(ddf.catalog.operation.ProcessingDetails) CatalogStore(ddf.catalog.source.CatalogStore) InternalIngestException(ddf.catalog.source.InternalIngestException) IngestException(ddf.catalog.source.IngestException) HashSet(java.util.HashSet) CreateResponseImpl(ddf.catalog.operation.impl.CreateResponseImpl)

Aggregations

ProcessingDetailsImpl (ddf.catalog.operation.impl.ProcessingDetailsImpl)37 Test (org.junit.Test)19 UnsupportedQueryException (ddf.catalog.source.UnsupportedQueryException)18 ProcessingDetails (ddf.catalog.operation.ProcessingDetails)13 QueryResponseImpl (ddf.catalog.operation.impl.QueryResponseImpl)8 IngestException (ddf.catalog.source.IngestException)8 HashSet (java.util.HashSet)8 QueryRequest (ddf.catalog.operation.QueryRequest)7 SourceResponse (ddf.catalog.operation.SourceResponse)6 Serializable (java.io.Serializable)6 HashMap (java.util.HashMap)6 Tag (io.micrometer.core.instrument.Tag)5 ArrayList (java.util.ArrayList)5 Metacard (ddf.catalog.data.Metacard)4 QueryResponse (ddf.catalog.operation.QueryResponse)4 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)4 CatalogStore (ddf.catalog.source.CatalogStore)3 SourceUnavailableException (ddf.catalog.source.SourceUnavailableException)3 ExecutionException (java.util.concurrent.ExecutionException)3 TimeoutException (java.util.concurrent.TimeoutException)3