Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #4559 fixed FsUtil to behave more consistently regarding target …
…directories when copying (#4560) refs #4557 implemented an event-based data provider for the FtpPoller module
- Loading branch information
Showing
50 changed files
with
2,830 additions
and
534 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
examples/test/qlib/FileDataProvider/FileDataProvider.qtest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env qore | ||
# -*- mode: qore; indent-tabs-mode: nil -*- | ||
|
||
%require-types | ||
%enable-all-warnings | ||
%new-style | ||
%strict-args | ||
%allow-injection | ||
|
||
%requires ../../../../qlib/Util.qm | ||
%requires ../../../../qlib/QUnit.qm | ||
%requires ../../../../qlib/Logger.qm | ||
%requires ../../../../qlib/DataProvider | ||
%requires ../../../../qlib/FsUtil.qm | ||
%requires ../../../../qlib/FileDataProvider | ||
|
||
%exec-class FileDataProviderTest | ||
|
||
public class FileDataProviderTest inherits QUnit::Test { | ||
constructor() : Test("FileDataProvider Test", "1.0") { | ||
addTestCase("test", \fileDataProviderTest()); | ||
|
||
# Return for compatibility with test harness that checks return value. | ||
set_return_value(main()); | ||
} | ||
|
||
fileDataProviderTest() { | ||
# create test file | ||
TmpFile tmp("FileDataProviderTest-"); | ||
string str = get_random_string(); | ||
tmp.file.write(str); | ||
|
||
FileDataProvider fdp(); | ||
|
||
AbstractDataProvider prov = fdp.getChildProviderEx("stat"); | ||
hash<auto> h = prov.doRequest({ | ||
"path": tmp.path, | ||
}); | ||
assertEq(tmp.path, h.filepath); | ||
assertEq("REGULAR", h.type); | ||
|
||
prov = fdp.getChildProviderEx("copy"); | ||
string targ = join_paths(tmp_location(), get_random_string()); | ||
h = prov.doRequest({ | ||
"source": tmp.path, | ||
"target": targ, | ||
}); | ||
assertEq(targ, h.target); | ||
assertTrue(is_file(targ)); | ||
|
||
prov = fdp.getChildProviderEx("move"); | ||
string new_targ = join_paths(tmp_location(), get_random_string()); | ||
assertNeq(new_targ, targ); | ||
h = prov.doRequest({ | ||
"source": targ, | ||
"target": new_targ, | ||
}); | ||
assertEq(new_targ, h.target); | ||
assertFalse(is_file(targ)); | ||
assertTrue(is_file(new_targ)); | ||
|
||
prov = fdp.getChildProviderEx("delete"); | ||
h = prov.doRequest({ | ||
"path": new_targ, | ||
}); | ||
assertEq(new_targ, h.path); | ||
assertFalse(is_file(new_targ)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.