agave-jobs/jobs-core/src/test/java/org/iplantc/service/jobs/managers/JobRequestInputProcessorIT.java
/**
     * Tests job app input validation throws exception for permission denied
     */
Tests job app input validation throws exception for permission denied
Tests job app input validation throws exception for permission denied
@Test(expectedExceptions = JobProcessingException.class)
    public void processPermissionExceptionThrowsPermissionException() throws JobProcessingException
    {
        String inputKey = "testInput";
        String testValue = "https://example.com/index.html";
        try {
            SoftwareInput softwareInput = createInput(inputKey, null, null, false, true);
            JobRequestInputProcessor jobRequestInputProcessor = createMockJobRequestInputProcessor(List.of(softwareInput));
            when(jobRequestInputProcessor.canUserReadUri(any(), any(), any())).thenThrow(new PermissionException("Mocked permission exception should be wrapped as JobProcessingException thrown from process()"));
            HashMap<String, Object> inputMap = jsonObjectToMap(inputKey, mapper.createObjectNode().put(inputKey, testValue));
            jobRequestInputProcessor.process(inputMap);
        } catch (PermissionException e) {
            fail("PermissionException thrown from canUserReadUri should be wrapped and thrown as JobProcessingException from process method", e);
        }
    }
@ Test ( expectedExceptions = JobProcessingException . class ) public void processPermissionExceptionThrowsPermissionException ( ) throws JobProcessingException { String inputKey = "testInput" ; String testValue = "https://example.com/index.html" ; try { SoftwareInput softwareInput = createInput ( inputKey , null , null , false , true ) ; JobRequestInputProcessor jobRequestInputProcessor = createMockJobRequestInputProcessor ( List . of ( softwareInput ) ) ; when ( jobRequestInputProcessor . canUserReadUri ( any ( ) , any ( ) , any ( ) ) ) . thenThrow ( new PermissionException ( "Mocked permission exception should be wrapped as JobProcessingException thrown from process()" ) ) ; HashMap < String , Object > inputMap = jsonObjectToMap ( inputKey , mapper . createObjectNode ( ) . put ( inputKey , testValue ) ) ; jobRequestInputProcessor . process ( inputMap ) ; } catch ( PermissionException e ) { fail ( "PermissionException thrown from canUserReadUri should be wrapped and thrown as JobProcessingException from process method" , e ) ; } }
Tests job app input validation throws exception for permission denied
Tests job app input validation throws exception for permission denied