Package uk.gov.nationalarchives.droid.core.interfaces

Examples of uk.gov.nationalarchives.droid.core.interfaces.IdentificationException


        Thread.sleep(50);

        ArgumentCaptor<IdentificationException> captor = ArgumentCaptor.forClass(IdentificationException.class);
        verify(resultHandler).handleError(captor.capture());

        IdentificationException e = captor.getValue();
        assertEquals("I failed", e.getMessage());
        assertSame(request, e.getRequest());
        assertEquals(RuntimeException.class, e.getCause().getClass());
        assertEquals("I failed", e.getCause().getMessage());

    }
View Full Code Here


        fileEventHandler.onEvent(file, new ResourceId(1L, ""), null);
       
        ArgumentCaptor<IdentificationException> exCaptor = ArgumentCaptor.forClass(IdentificationException.class);
        verify(resultHandler).handleError(exCaptor.capture());
       
        final IdentificationException thrown = exCaptor.getValue();
        assertTrue(thrown.getCause() instanceof FileNotFoundException);
        assertEquals(request, thrown.getRequest());
        assertEquals(IdentificationErrorType.FILE_NOT_FOUND, thrown.getErrorType());
    }
View Full Code Here

        fileEventHandler.onEvent(file, new ResourceId(1L, ""), null);
       
        ArgumentCaptor<IdentificationException> exCaptor = ArgumentCaptor.forClass(IdentificationException.class);
        verify(resultHandler).handleError(exCaptor.capture());
       
        final IdentificationException thrown = exCaptor.getValue();
        assertEquals(ioException, thrown.getCause());
        assertEquals("Can't read me!", thrown.getMessage());
        assertEquals(request, thrown.getRequest());
        assertEquals(IdentificationErrorType.ACCESS_DENIED, thrown.getErrorType());
       
        file.delete();
    }
View Full Code Here

                    causeMessage = e.getCause().getMessage();
                }
                final String message = String.format(ARCHIVE_ERROR,
                        archiveFormat, request.getIdentifier().getUri().toString(), e.getMessage(), causeMessage);
                log.warn(message);
                resultHandler.handleError(new IdentificationException(
                        request, IdentificationErrorType.OTHER, e));
            } finally {
                submissionQueue.remove(request.getIdentifier());
                jobCounter.decrementPostProcess();
            }
View Full Code Here

                    request.getIdentifier().setResourceId(id);
                }
            } catch (ExecutionException e) {
                final Throwable cause = e.getCause();
                log.error(cause.getStackTrace(), cause);
                resultHandler.handleError(new IdentificationException(
                        request, IdentificationErrorType.OTHER, cause));
            } catch (InterruptedException e) {
                log.debug(e);
            } catch (IOException e) {
                resultHandler.handleError(new IdentificationException(
                        request, IdentificationErrorType.OTHER, e));
            } finally {
                closeRequest();
                if (!jobCountDecremented) {
                    jobCounter.decrement();
View Full Code Here

            if (error.equals(IdentificationErrorType.ACCESS_DENIED)) {
                log.warn(String.format("Access was denied to the file: [%s]", file.getAbsolutePath()));
            } else {
                log.warn(String.format("File not found: [%s]", file.getAbsolutePath()));
            }
            resultHandler.handleError(new IdentificationException(request, error, e));
        } catch (InterruptedException e) {
            log.debug("Interrupted while throttle active.", e);
        }
    }
View Full Code Here

TOP

Related Classes of uk.gov.nationalarchives.droid.core.interfaces.IdentificationException

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.