mirror of
https://github.com/apache/sqoop.git
synced 2025-05-10 20:52:21 +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
|
@Override
|
||||||
public boolean inUseJob(long jobId, Connection conn) {
|
public boolean inUseJob(long jobId, Connection conn) {
|
||||||
// TODO(jarcec): This method will need to be upgraded once submission
|
MSubmission submission = findSubmissionLastForJob(jobId, conn);
|
||||||
// engine will be in place as we can't remove "running" job.
|
|
||||||
|
// We can't remove running job
|
||||||
|
if(submission.getStatus().isRunning()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,6 +147,16 @@ public void testCreateConnection() throws Exception {
|
|||||||
assertCountForTable("SQOOP.SQ_CONNECTION_INPUT", 8);
|
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 {
|
public void testUpdateConnection() throws Exception {
|
||||||
loadConnections();
|
loadConnections();
|
||||||
|
|
||||||
|
@ -125,6 +125,16 @@ public void testExistsJob() throws Exception {
|
|||||||
assertFalse(handler.existsJob(5, getDerbyConnection()));
|
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 {
|
public void testCreateJob() throws Exception {
|
||||||
MJob job = getJob();
|
MJob job = getJob();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user