mirror of
https://github.com/apache/sqoop.git
synced 2025-05-08 21:12:12 +08:00
SQOOP-807: Verify whether job object can be safely removed prior removing
(Jarek Jarcec Cecho via Cheolsoo Park)
This commit is contained in:
parent
b9842ebe04
commit
4f8eb43732
@ -717,8 +717,13 @@ public boolean existsJob(long id, Connection conn) {
|
||||
|
||||
@Override
|
||||
public boolean inUseJob(long jobId, Connection conn) {
|
||||
// TODO(jarcec): This method will need to be upgraded once submission
|
||||
// engine will be in place as we can't remove "running" job.
|
||||
MSubmission submission = findSubmissionLastForJob(jobId, conn);
|
||||
|
||||
// We can't remove running job
|
||||
if(submission.getStatus().isRunning()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -147,6 +147,16 @@ public void testCreateConnection() throws Exception {
|
||||
assertCountForTable("SQOOP.SQ_CONNECTION_INPUT", 8);
|
||||
}
|
||||
|
||||
public void testInUseConnection() throws Exception {
|
||||
loadConnections();
|
||||
|
||||
assertFalse(handler.inUseConnection(1, getDerbyConnection()));
|
||||
|
||||
loadJobs();
|
||||
|
||||
assertTrue(handler.inUseConnection(1, getDerbyConnection()));
|
||||
}
|
||||
|
||||
public void testUpdateConnection() throws Exception {
|
||||
loadConnections();
|
||||
|
||||
|
@ -125,6 +125,16 @@ public void testExistsJob() throws Exception {
|
||||
assertFalse(handler.existsJob(5, getDerbyConnection()));
|
||||
}
|
||||
|
||||
public void testInUseJob() throws Exception {
|
||||
loadJobs();
|
||||
loadSubmissions();
|
||||
|
||||
assertTrue(handler.inUseJob(1, getDerbyConnection()));
|
||||
assertFalse(handler.inUseJob(2, getDerbyConnection()));
|
||||
assertFalse(handler.inUseJob(3, getDerbyConnection()));
|
||||
assertFalse(handler.inUseJob(4, getDerbyConnection()));
|
||||
}
|
||||
|
||||
public void testCreateJob() throws Exception {
|
||||
MJob job = getJob();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user