use of org.apache.ignite.igfs.IgfsPath in project ignite by apache.
the class IgfsDualAbstractSelfTest method testMoveDirectorySourceParentRootDestinationMissing.
/**
* Test directory move when source parent is the root and destination is missing.
*
* @throws Exception If failed.
*/
public void testMoveDirectorySourceParentRootDestinationMissing() throws Exception {
IgfsPath dir = new IgfsPath("/" + SUBSUBDIR.name());
create(igfsSecondary, paths(DIR_NEW, SUBDIR_NEW, dir), null);
create(igfs, null, null);
igfs.rename(dir, SUBDIR_NEW);
checkExist(igfs, DIR_NEW, SUBDIR_NEW);
checkExist(igfs, igfsSecondary, new IgfsPath(SUBDIR_NEW, SUBSUBDIR.name()));
checkNotExist(igfs, igfsSecondary, dir);
}
use of org.apache.ignite.igfs.IgfsPath in project ignite by apache.
the class IgfsDualAbstractSelfTest method testMoveFileDestinationMissingPartially.
/**
* Test move in case destination exists partially and the path being renamed is a file.
*
* @throws Exception If failed.
*/
public void testMoveFileDestinationMissingPartially() throws Exception {
create(igfsSecondary, paths(DIR, SUBDIR, DIR_NEW, SUBDIR_NEW), paths(FILE));
create(igfs, paths(DIR, SUBDIR, DIR_NEW), paths(FILE));
igfs.rename(FILE, SUBDIR_NEW);
checkExist(igfs, SUBDIR_NEW);
checkExist(igfs, igfsSecondary, new IgfsPath(SUBDIR_NEW, FILE.name()));
checkNotExist(igfs, igfsSecondary, FILE);
}
use of org.apache.ignite.igfs.IgfsPath in project ignite by apache.
the class IgfsLocalSecondaryFileSystemDualAbstractSelfTest method testSymlinkToFile.
/**
* @throws Exception If failed.
*/
public void testSymlinkToFile() throws Exception {
if (U.isWindows())
return;
createSymlinks();
checkFileContent(igfs, new IgfsPath("/file"), chunk);
}
use of org.apache.ignite.igfs.IgfsPath in project ignite by apache.
the class IgfsLocalSecondaryFileSystemProxySelfTest method testSymlinkToFile.
/**
* @throws Exception If failed.
*/
public void testSymlinkToFile() throws Exception {
if (U.isWindows())
return;
createSymlinks();
checkFileContent(igfs, new IgfsPath("/file"), chunk);
}
use of org.apache.ignite.igfs.IgfsPath in project ignite by apache.
the class IgfsLocalSecondaryFileSystemProxySelfTest method testAffinityMaxLen.
/**
* @throws Exception If failed.
*/
public void testAffinityMaxLen() throws Exception {
awaitPartitionMapExchange();
long fileSize = 32 * 1024 * 1024;
IgfsPath filePath = new IgfsPath("/file");
try (OutputStream os = igfs.create(filePath, true)) {
for (int i = 0; i < fileSize / chunk.length; ++i) os.write(chunk);
}
Collection<IgfsBlockLocation> blocks;
long len = igfs.info(filePath).length();
int start = 0;
// Check default maxLen (maxLen = 0)
for (int i = 0; i < igfs.context().data().groupBlockSize() / 1024; i++) {
Collection<IgfsBlockLocation> blocks0 = igfs.affinity(filePath, start, len, 0);
blocks = igfs.affinity(filePath, start, len, Long.MAX_VALUE);
assertTrue(blocks0.size() > 1);
assertEquals(blocks0.size(), blocks.size());
assertEquals(F.first(blocks).start(), start);
assertEquals(start + len, F.last(blocks).start() + F.last(blocks).length());
assertEquals(blocks0, blocks);
len -= 1024 * 2;
start += 1024;
}
len = igfs.info(filePath).length();
start = 0;
long maxLen = igfs.context().data().groupBlockSize() * 2;
// Different cases of start, len and maxLen
for (int i = 0; i < igfs.context().data().groupBlockSize() / 1024; i++) {
blocks = igfs.affinity(filePath, start, len, maxLen);
assertEquals(F.first(blocks).start(), start);
assertEquals(start + len, F.last(blocks).start() + F.last(blocks).length());
long totalLen = 0;
for (IgfsBlockLocation block : blocks) {
totalLen += block.length();
assert block.length() <= maxLen : "block.length() <= maxLen. [block.length=" + block.length() + ", maxLen=" + maxLen + ']';
assert block.length() + block.start() <= start + len : "block.length() + block.start() < start + len. [block.length=" + block.length() + ", block.start()=" + block.start() + ", start=" + start + ", len=" + len + ']';
for (IgfsBlockLocation block0 : blocks) if (!block0.equals(block))
assert block.start() < block0.start() && block.start() + block.length() <= block0.start() || block.start() > block0.start() && block0.start() + block0.length() <= block.start() : "Blocks cross each other: block0=" + block + ", block1= " + block0;
}
assert totalLen == len : "Summary length of blocks must be: " + len + " actual: " + totalLen;
len -= 1024 * 2;
start += 1024;
maxLen -= igfs.context().data().groupBlockSize() * 2 / 1024;
}
}
Aggregations