|
|
|
@ -25,7 +25,10 @@ import org.apache.dolphinscheduler.server.worker.task.sqoop.generator.SqoopJobGe
|
|
|
|
|
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; |
|
|
|
|
import org.apache.dolphinscheduler.service.process.ProcessService; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Collections; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
import org.junit.Assert; |
|
|
|
|
import org.junit.Before; |
|
|
|
@ -37,7 +40,6 @@ import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springframework.context.ApplicationContext; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* sqoop task test |
|
|
|
|
*/ |
|
|
|
@ -201,4 +203,25 @@ public class SqoopTaskTest {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void testLogHandler() throws InterruptedException { |
|
|
|
|
List<String> list = Collections.synchronizedList(new ArrayList<>()); |
|
|
|
|
Thread thread1 = new Thread(() -> { |
|
|
|
|
for (int i = 0; i < 10; i++) { |
|
|
|
|
list.add("test add log"); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
Thread thread2 = new Thread(() -> { |
|
|
|
|
for (int i = 0; i < 10; i++) { |
|
|
|
|
sqoopTask.logHandle(list); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
thread1.start(); |
|
|
|
|
thread2.start(); |
|
|
|
|
thread1.join(); |
|
|
|
|
thread2.join(); |
|
|
|
|
// if no exception throw, assert true
|
|
|
|
|
Assert.assertTrue(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|