use of org.dcache.srm.request.PutFileRequest in project dcache by dCache.
the class PutFileRequestStorage method getStatement.
private PreparedStatement getStatement(Connection connection, String query, Job job) throws SQLException {
PutFileRequest request = (PutFileRequest) job;
TRetentionPolicy retentionPolicy = request.getRetentionPolicy();
TAccessLatency accessLatency = request.getAccessLatency();
return getPreparedStatement(connection, query, request.getNextJobId(), request.getCreationTime(), request.getLifetime(), request.getState().getStateId(), request.latestHistoryEvent(), request.getSchedulerId(), request.getSchedulerTimeStamp(), // num of retries
0, request.getLastStateTransitionTime(), request.getRequestId(), request.getStatusCodeString(), request.getSurlString(), request.getTurlString(), request.getFileId(), // parentFileId (unused)
null, request.getSpaceReservationId(), request.getSize(), (retentionPolicy != null ? retentionPolicy.getValue() : null), (accessLatency != null ? accessLatency.getValue() : null), request.getId());
}
use of org.dcache.srm.request.PutFileRequest in project dcache by dCache.
the class PutFileRequestStorage method getFileRequest.
@Override
protected PutFileRequest getFileRequest(Connection _con, long ID, Long NEXTJOBID, long CREATIONTIME, long LIFETIME, int STATE, String SCHEDULERID, long SCHEDULER_TIMESTAMP, int NUMOFRETR, long LASTSTATETRANSITIONTIME, long REQUESTID, Long CREDENTIALID, String STATUSCODE, ResultSet set, int next_index) throws SQLException {
String SURL = set.getString(next_index++);
String TURL = set.getString(next_index++);
String FILEID = set.getString(next_index++);
String PARENTFILEID = set.getString(next_index++);
String SPACERESERVATIONID = set.getString(next_index++);
Long SIZE = set.getLong(next_index++);
if (set.wasNull()) {
SIZE = null;
}
String RETENTIONPOLICY = set.getString(next_index++);
String ACCESSLATENCY = set.getString(next_index++);
TRetentionPolicy retentionPolicy = RETENTIONPOLICY == null || RETENTIONPOLICY.equalsIgnoreCase("null") ? null : TRetentionPolicy.fromString(RETENTIONPOLICY);
TAccessLatency accessLatency = ACCESSLATENCY == null || ACCESSLATENCY.equalsIgnoreCase("null") ? null : TAccessLatency.fromString(ACCESSLATENCY);
Job.JobHistory[] jobHistoryArray = getJobHistory(ID, _con);
return new PutFileRequest(ID, NEXTJOBID, CREATIONTIME, LIFETIME, STATE, SCHEDULERID, SCHEDULER_TIMESTAMP, NUMOFRETR, LASTSTATETRANSITIONTIME, jobHistoryArray, REQUESTID, STATUSCODE, SURL, TURL, FILEID, SPACERESERVATIONID, SIZE, retentionPolicy, accessLatency);
}
use of org.dcache.srm.request.PutFileRequest in project dcache by dCache.
the class SchedulerContainerTests method shouldSchedulePutFileRequest.
@Test
public void shouldSchedulePutFileRequest() throws Exception {
PutFileRequest job = mockJob(PutFileRequest.class);
ArgumentCaptor<Scheduler> schedCapture = ArgumentCaptor.forClass(Scheduler.class);
container.schedule(job);
verify(job, times(1)).scheduleWith(schedCapture.capture());
assertThat(schedCapture.getValue(), is(putScheduler));
}
use of org.dcache.srm.request.PutFileRequest in project dcache by dCache.
the class PutFileRequestStorage method getCreateStatement.
@Override
public PreparedStatement getCreateStatement(Connection connection, Job job) throws SQLException {
if (job == null || !(job instanceof PutFileRequest)) {
throw new IllegalArgumentException("fr is not PutFileRequest");
}
PutFileRequest request = (PutFileRequest) job;
TRetentionPolicy retentionPolicy = request.getRetentionPolicy();
TAccessLatency accessLatency = request.getAccessLatency();
return getPreparedStatement(connection, INSERT_SQL, request.getId(), request.getNextJobId(), request.getCreationTime(), request.getLifetime(), request.getState().getStateId(), request.latestHistoryEvent(), request.getSchedulerId(), request.getSchedulerTimeStamp(), // num of retries
0, request.getLastStateTransitionTime(), request.getRequestId(), request.getStatusCodeString(), request.getSurlString(), request.getTurlString(), request.getFileId(), // parentFileId (unused)
null, request.getSpaceReservationId(), request.getSize(), (retentionPolicy != null ? retentionPolicy.getValue() : null), (accessLatency != null ? accessLatency.getValue() : null));
}
use of org.dcache.srm.request.PutFileRequest in project dcache by dCache.
the class SchedulerContainerTests method shouldScheduleRestoredPutFileRequests.
@Test
public void shouldScheduleRestoredPutFileRequests() throws Exception {
PutFileRequest job = mockJob(PutFileRequest.class, INPROGRESS, "put_localhost");
container.restoreJobsOnSrmStart(Lists.newArrayList(job), false);
ArgumentCaptor<Scheduler> schedCapture = ArgumentCaptor.forClass(Scheduler.class);
verify(job, times(1)).onSrmRestart(schedCapture.capture(), eq(false));
assertThat(schedCapture.getValue(), is(putScheduler));
}
Aggregations