use of org.apache.ignite.igfs.IgfsPath in project ignite by apache.
the class IgfsAbstractSelfTest method testMoveRenameFileSourceParentRoot.
/**
* Test file move and rename when source parent is the root.
*
* @throws Exception If failed.
*/
public void testMoveRenameFileSourceParentRoot() throws Exception {
IgfsPath file = new IgfsPath("/" + FILE_NEW.name());
create(igfs, paths(DIR_NEW, SUBDIR_NEW), paths(file));
igfs.rename(file, FILE_NEW);
checkExist(igfs, igfsSecondary, FILE_NEW);
checkNotExist(igfs, igfsSecondary, file);
}
use of org.apache.ignite.igfs.IgfsPath in project ignite by apache.
the class DefaultIgfsSecondaryFileSystemTestAdapter method openOutputStream.
/** {@inheritDoc} */
@Override
public OutputStream openOutputStream(String path, boolean append) throws IOException {
IgfsPath igfsPath = new IgfsPath(path);
final IgfsOutputStream igfsOutputStream;
if (append)
igfsOutputStream = igfsEx.append(igfsPath, true);
else
igfsOutputStream = igfsEx.create(igfsPath, true);
return igfsOutputStream;
}
use of org.apache.ignite.igfs.IgfsPath in project ignite by apache.
the class IgfsAbstractSelfTest method testMoveDirectory.
/**
* Test move in case both local and remote file systems have the same folder structure and the path being renamed is
* a directory.
*
* @throws Exception If failed.
*/
public void testMoveDirectory() throws Exception {
create(igfs, paths(DIR, SUBDIR, SUBSUBDIR, DIR_NEW, SUBDIR_NEW), null);
igfs.rename(SUBSUBDIR, SUBDIR_NEW);
checkExist(igfs, igfsSecondary, new IgfsPath(SUBDIR_NEW, SUBSUBDIR.name()));
checkNotExist(igfs, igfsSecondary, SUBSUBDIR);
}
use of org.apache.ignite.igfs.IgfsPath in project ignite by apache.
the class IgfsAbstractSelfTest method testCreateConsistency.
/**
* Ensure consistency of data during file creation.
*
* @throws Exception If failed.
*/
public void testCreateConsistency() throws Exception {
final AtomicInteger ctr = new AtomicInteger();
final AtomicReference<Exception> err = new AtomicReference<>();
final int threadCnt = 10;
multithreaded(new Runnable() {
@Override
public void run() {
int idx = ctr.incrementAndGet();
final IgfsPath path = new IgfsPath("/file" + idx);
try {
for (int i = 0; i < REPEAT_CNT; i++) {
IgfsOutputStream os = igfs.create(path, 128, true, /*overwrite*/
null, 0, 256, null);
os.write(chunk);
os.close();
assert igfs.exists(path);
}
awaitFileClose(igfs, path);
checkFileContent(igfs, path, chunk);
} catch (IOException | IgniteCheckedException e) {
// Log the very first error.
err.compareAndSet(null, e);
}
}
}, threadCnt);
if (err.get() != null)
throw err.get();
}
use of org.apache.ignite.igfs.IgfsPath in project ignite by apache.
the class IgfsAbstractSelfTest method testMoveFileDestinationRoot.
/**
* Test file move when destination is the root.
*
* @throws Exception If failed.
*/
public void testMoveFileDestinationRoot() throws Exception {
create(igfs, paths(DIR, SUBDIR), paths(FILE));
igfs.rename(FILE, IgfsPath.ROOT);
checkExist(igfs, igfsSecondary, new IgfsPath("/" + FILE.name()));
checkNotExist(igfs, igfsSecondary, FILE);
}
Aggregations