use of org.apache.oozie.service.ShareLibService in project oozie by apache.
the class TestOozieSharelibCLI method testOozieSharelibCLICreateConcurrent.
/**
* test parallel copy libraries
*/
public void testOozieSharelibCLICreateConcurrent() throws Exception {
final int testFiles = 7;
final int concurrency = 5;
File libDirectory = tmpFolder.newFolder("lib");
for (int i = 0; i < testFiles; i++) {
writeFile(libDirectory, generateFileName(i), generateFileContent(i));
}
String[] argsCreate = { "create", "-fs", outPath, "-locallib", libDirectory.getParentFile().getAbsolutePath(), "-concurrency", String.valueOf(concurrency) };
assertEquals(0, execOozieSharelibCLICommands(argsCreate));
getTargetFileSysyem();
ShareLibService sharelibService = getServices().get(ShareLibService.class);
Path latestLibPath = sharelibService.getLatestLibPath(getDistPath(), ShareLibService.SHARE_LIB_PREFIX);
for (int i = 0; i < testFiles; i++) {
String fileName = generateFileName(i);
String expectedFileContent = generateFileContent(i);
InputStream in = null;
try {
in = fs.open(new Path(latestLibPath, fileName));
String actualFileContent = IOUtils.toString(in);
assertEquals(fileName, expectedFileContent, actualFileContent);
} finally {
IOUtils.closeQuietly(in);
}
}
}
Aggregations