Search in sources :

Example 1 with LsRequest

use of org.dcache.srm.request.LsRequest in project dcache by dCache.

the class SchedulerContainerTests method shouldScheduleLsRequest.

@Test
public void shouldScheduleLsRequest() throws Exception {
    LsRequest job = mockJob(LsRequest.class);
    ArgumentCaptor<Scheduler> schedCapture = ArgumentCaptor.forClass(Scheduler.class);
    container.schedule(job);
    verify(job, times(1)).scheduleWith(schedCapture.capture());
    assertThat(schedCapture.getValue(), is(lsScheduler));
}
Also used : LsRequest(org.dcache.srm.request.LsRequest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 2 with LsRequest

use of org.dcache.srm.request.LsRequest in project dcache by dCache.

the class SrmLs method srmLs.

private SrmLsResponse srmLs() throws SRMInvalidRequestException, SRMInternalErrorException {
    int numOfLevels = Math.min(getNumOfLevels(request), maxNumOfLevels);
    int offset = getOffset(request);
    int count = getCount(request);
    boolean longFormat = getFullDetailedList(request);
    URI[] surls = getSurls(request);
    LsRequest r = new LsRequest(srm.getSrmId(), user, surls, TimeUnit.HOURS.toMillis(1), configuration.getLsMaxPollPeriod(), clientHost, count, offset, numOfLevels, longFormat, max_results_num);
    try (JDC ignored = r.applyJdc()) {
        srm.acceptNewJob(r);
        return r.getSrmLsResponse(configuration.getLsSwitchToAsynchronousModeDelay());
    } catch (InterruptedException e) {
        throw new SRMInternalErrorException("Operation interrupted", e);
    } catch (IllegalStateTransition e) {
        throw new SRMInternalErrorException("Scheduling failure", e);
    }
}
Also used : SRMInternalErrorException(org.dcache.srm.SRMInternalErrorException) IllegalStateTransition(org.dcache.srm.scheduler.IllegalStateTransition) LsRequest(org.dcache.srm.request.LsRequest) SrmLsRequest(org.dcache.srm.v2_2.SrmLsRequest) JDC(org.dcache.srm.util.JDC) URI(java.net.URI)

Aggregations

LsRequest (org.dcache.srm.request.LsRequest)2 URI (java.net.URI)1 SRMInternalErrorException (org.dcache.srm.SRMInternalErrorException)1 IllegalStateTransition (org.dcache.srm.scheduler.IllegalStateTransition)1 JDC (org.dcache.srm.util.JDC)1 SrmLsRequest (org.dcache.srm.v2_2.SrmLsRequest)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1