Search in sources :

Example 6 with PnfsCreateUploadPath

use of diskCacheV111.vehicles.PnfsCreateUploadPath in project dcache by dCache.

the class PnfsManagerTest method testCancelUploadRecursively.

@Test
public void testCancelUploadRecursively() throws ChimeraFsException {
    FsPath root = FsPath.ROOT;
    FsPath path = FsPath.create("/test");
    PnfsCreateUploadPath create = new PnfsCreateUploadPath(Subjects.ROOT, Restrictions.none(), path, root, null, null, null, null, EnumSet.noneOf(CreateOption.class));
    _pnfsManager.createUploadPath(create);
    assertThat(create.getReturnCode(), is(0));
    _fs.createFile(create.getUploadPath().toString());
    _fs.mkdir(create.getUploadPath().parent() + "/bar");
    _fs.mkdir(create.getUploadPath().parent() + "/baz");
    _fs.createFile(create.getUploadPath().parent() + "/baz/baz");
    PnfsCancelUpload cancel = new PnfsCancelUpload(Subjects.ROOT, Restrictions.none(), create.getUploadPath(), path, EnumSet.noneOf(FileAttribute.class), "request aborted");
    _pnfsManager.cancelUpload(cancel);
    assertThat(cancel.getReturnCode(), is(0));
    assertNotExists(create.getUploadPath().toString());
    assertNotExists("/test");
}
Also used : PnfsCreateUploadPath(diskCacheV111.vehicles.PnfsCreateUploadPath) PnfsCancelUpload(diskCacheV111.vehicles.PnfsCancelUpload) CreateOption(org.dcache.namespace.CreateOption) FsPath(diskCacheV111.util.FsPath) FileAttribute(org.dcache.namespace.FileAttribute) Test(org.junit.Test)

Aggregations

FsPath (diskCacheV111.util.FsPath)4 PnfsCreateUploadPath (diskCacheV111.vehicles.PnfsCreateUploadPath)4 CreateOption (org.dcache.namespace.CreateOption)4 PnfsCancelUpload (diskCacheV111.vehicles.PnfsCancelUpload)3 FileAttribute (org.dcache.namespace.FileAttribute)3 CacheException (diskCacheV111.util.CacheException)2 PermissionDeniedCacheException (diskCacheV111.util.PermissionDeniedCacheException)2 Test (org.junit.Test)2 Space (diskCacheV111.services.space.Space)1 AccessLatency (diskCacheV111.util.AccessLatency)1 FileExistsCacheException (diskCacheV111.util.FileExistsCacheException)1 FileNotFoundCacheException (diskCacheV111.util.FileNotFoundCacheException)1 InvalidMessageCacheException (diskCacheV111.util.InvalidMessageCacheException)1 MissingResourceCacheException (diskCacheV111.util.MissingResourceCacheException)1 NotDirCacheException (diskCacheV111.util.NotDirCacheException)1 RetentionPolicy (diskCacheV111.util.RetentionPolicy)1 NoRouteToCellException (dmg.cells.nucleus.NoRouteToCellException)1 ExecutionException (java.util.concurrent.ExecutionException)1 Subject (javax.security.auth.Subject)1 Restriction (org.dcache.auth.attributes.Restriction)1