Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / java / test / com / ceph / fs / CephUnmountedTest.java
1 /*
2  * Permission is hereby granted, free of charge, to any person obtaining a
3  * copy of this software and associated documentation files (the "Software"),
4  * to deal in the Software without restriction, including without limitation
5  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
6  * and/or sell copies of the Software, and to permit persons to whom the
7  * Software is furnished to do so, subject to the following conditions:
8  *
9  * The above copyright notice and this permission notice shall be included in
10  * all copies or substantial portions of the Software.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18  * DEALINGS IN THE SOFTWARE.
19  */
20 package com.ceph.fs;
21
22 import org.junit.*;
23 import static org.junit.Assert.*;
24
25 public class CephUnmountedTest {
26
27   private CephMount mount;
28
29   @Before
30   public void setup() throws Exception {
31     mount = new CephMount("admin");
32   }
33
34   @Test(expected=CephNotMountedException.class)
35   public void test_unmount() throws Exception {
36     mount.unmount();
37   }
38
39   @Test(expected=CephNotMountedException.class)
40   public void test_statfs() throws Exception {
41     CephStatVFS stat = new CephStatVFS();
42     mount.statfs("/a/path", stat);
43   }
44
45   @Test(expected=CephNotMountedException.class)
46   public void test_getcwd() throws Exception {
47     mount.getcwd();
48   }
49
50   @Test(expected=CephNotMountedException.class)
51   public void test_chdir() throws Exception {
52     mount.chdir("/a/path");
53   }
54
55   @Test(expected=CephNotMountedException.class)
56   public void test_listdir() throws Exception {
57     mount.listdir("/a/path");
58   }
59
60   @Test(expected=CephNotMountedException.class)
61   public void test_unlink() throws Exception {
62     mount.unlink("/a/path");
63   }
64
65   @Test(expected=CephNotMountedException.class)
66   public void test_rename() throws Exception {
67     mount.rename("/a/path", "/another/path");
68   }
69
70   @Test(expected=CephNotMountedException.class)
71   public void test_mkdirs() throws Exception {
72     mount.mkdirs("/a/path", 0);
73   }
74
75   @Test(expected=CephNotMountedException.class)
76   public void test_rmdir() throws Exception {
77     mount.rmdir("/a/path");
78   }
79
80   @Test(expected=CephNotMountedException.class)
81   public void test_stat() throws Exception {
82     CephStat stat = new CephStat();
83     mount.stat("/a/path", stat);
84   }
85
86   @Test(expected=CephNotMountedException.class)
87   public void test_lstat() throws Exception {
88     CephStat stat = new CephStat();
89     mount.lstat("/a/path", stat);
90   }
91
92   @Test(expected=CephNotMountedException.class)
93   public void test_setattr() throws Exception {
94     CephStat stat = new CephStat();
95     mount.setattr("/a/path", stat, 0);
96   }
97
98   @Test(expected=CephNotMountedException.class)
99   public void test_open() throws Exception {
100     mount.open("/a/path", 0, 0);
101   }
102
103   @Test(expected=CephNotMountedException.class)
104   public void test_open_layout() throws Exception {
105     mount.open("/a/path", 0, 0, 0, 0, 0, null);
106   }
107
108   @Test(expected=CephNotMountedException.class)
109   public void test_close() throws Exception {
110     mount.close(0);
111   }
112
113   @Test(expected=CephNotMountedException.class)
114   public void test_lseek() throws Exception {
115     mount.lseek(0, 0, CephMount.SEEK_CUR);
116   }
117
118   @Test(expected=CephNotMountedException.class)
119   public void test_read() throws Exception {
120     byte[] buf = new byte[1];
121     mount.read(0, buf, 1, 0);
122   }
123
124   @Test(expected=CephNotMountedException.class)
125   public void test_write() throws Exception {
126     byte[] buf = new byte[1];
127     mount.write(0, buf, 1, 0);
128   }
129
130   @Test(expected=CephNotMountedException.class)
131   public void test_get_stripe_unit() throws Exception {
132     mount.get_file_stripe_unit(0);
133   }
134
135   @Test(expected=CephNotMountedException.class)
136   public void test_get_repl() throws Exception {
137     mount.get_file_replication(0);
138   }
139
140   @Test(expected=CephNotMountedException.class)
141   public void test_get_stripe_unit_gran() throws Exception {
142     mount.get_stripe_unit_granularity();
143   }
144
145   @Test(expected=CephNotMountedException.class)
146   public void test_get_pool_id() throws Exception {
147     mount.get_pool_id("data");
148   }
149
150   @Test(expected=CephNotMountedException.class)
151   public void test_get_pool_replication() throws Exception {
152     mount.get_pool_replication(1);
153   }
154
155   @Test(expected=CephNotMountedException.class)
156   public void test_fchmod() throws Exception {
157     mount.fchmod(1, 0);
158   }
159
160   @Test(expected=CephNotMountedException.class)
161   public void test_chmod() throws Exception {
162     mount.chmod("/foo", 0);
163   }
164 }