1 package org.ogf.saga.namespace;
2
3 import org.junit.Test;
4 import org.ogf.saga.error.*;
5 import org.ogf.saga.namespace.abstracts.AbstractDataMovement;
6 import org.ogf.saga.url.URL;
7
8
9
10
11
12
13
14
15
16
17
18
19
20 public abstract class DataMovementTest extends DataReadOnlyMovementTest {
21 protected DataMovementTest(String protocol, String targetProtocol) throws Exception {
22 super(protocol, targetProtocol);
23 }
24
25 @Test(expected = DoesNotExistException.class)
26 public void test_move() throws Exception {
27 URL target = createURL(m_dirUrl2, DEFAULT_FILENAME);
28 m_file.move(m_dirUrl2, Flags.NONE.getValue());
29 checkCopied(target, DEFAULT_CONTENT);
30 NSFactory.createNSEntry(m_session, m_fileUrl, Flags.NONE.getValue());
31 }
32
33 @Test(expected = DoesNotExistException.class)
34 public void test_rename() throws Exception {
35 URL target = createURL(m_dirUrl, DEFAULT_FILENAME);
36 m_file.move(m_dirUrl, Flags.NONE.getValue());
37 checkCopied(target, DEFAULT_CONTENT);
38 NSFactory.createNSEntry(m_session, m_fileUrl, Flags.NONE.getValue());
39 }
40
41 @Test(expected = DoesNotExistException.class)
42 public void test_move_recurse() throws Exception {
43 URL target = createURL(m_subDirUrl2, DEFAULT_SUBDIRNAME +DEFAULT_FILENAME);
44 m_subDir.move(m_subDirUrl2, Flags.RECURSIVE.getValue());
45 checkCopied(target, DEFAULT_CONTENT);
46 NSFactory.createNSDirectory(m_session, m_subDirUrl, Flags.NONE.getValue());
47 }
48
49 @Test(expected = DoesNotExistException.class)
50 public void test_move_recurse_overwrite() throws Exception {
51 URL target = createURL(m_subDirUrl2, DEFAULT_SUBDIRNAME +DEFAULT_FILENAME);
52 m_subDir.move(m_subDirUrl2, Flags.RECURSIVE.getValue()+Flags.OVERWRITE.getValue());
53 checkCopied(target, DEFAULT_CONTENT);
54 NSFactory.createNSDirectory(m_session, m_subDirUrl, Flags.NONE.getValue());
55 }
56
57 @Test(expected = DoesNotExistException.class)
58 public void test_rename_directory() throws Exception {
59 URL newSubDirUrl = createURL(m_dirUrl,"newsubdir/");
60 URL target = createURL(newSubDirUrl, DEFAULT_FILENAME);
61 m_subDir.move(newSubDirUrl, Flags.RECURSIVE.getValue());
62 checkCopied(target, DEFAULT_CONTENT);
63 NSFactory.createNSDirectory(m_session, m_subDirUrl, Flags.NONE.getValue());
64 }
65 }