|
| 1 | +package org.apache.hadoop.fs.test.unit; |
| 2 | + |
| 3 | +import java.io.IOException; |
| 4 | + |
| 5 | +import junit.framework.Assert; |
| 6 | + |
| 7 | +import org.apache.hadoop.conf.Configuration; |
| 8 | +import org.apache.hadoop.fs.FileSystem; |
| 9 | +import org.apache.hadoop.fs.Path; |
| 10 | +import org.apache.hadoop.fs.test.connector.HcfsTestConnectorFactory; |
| 11 | +import org.apache.hadoop.fs.test.connector.HcfsTestConnectorInterface; |
| 12 | +import org.junit.After; |
| 13 | +import org.junit.AfterClass; |
| 14 | +import org.junit.BeforeClass; |
| 15 | +import org.junit.Test; |
| 16 | +import org.slf4j.Logger; |
| 17 | +import org.slf4j.LoggerFactory; |
| 18 | + |
| 19 | +public class GlusterMultipleVolumeTest { |
| 20 | + |
| 21 | + Logger log = LoggerFactory.getLogger(HCFSPerformanceIOTests.class); |
| 22 | + static Configuration config = null; |
| 23 | + |
| 24 | + |
| 25 | + @BeforeClass |
| 26 | + public static void setup() throws Exception { |
| 27 | + HcfsTestConnectorInterface connector = HcfsTestConnectorFactory.getHcfsTestConnector(); |
| 28 | + config = connector.createConfiguration(); |
| 29 | + } |
| 30 | + |
| 31 | + public static FileSystem getFileSystem(Path p) throws IOException{ |
| 32 | + return FileSystem.get(p.toUri(), config); |
| 33 | + } |
| 34 | + |
| 35 | + @Test |
| 36 | + public void testDefaultPath() throws IOException{ |
| 37 | + Path p1 = new Path("glusterfs:///test1.txt"); |
| 38 | + Path p2 = new Path("glusterfs://gv0/test1.txt"); |
| 39 | + Path p3 = new Path("glusterfs://gv1/test1.txt"); |
| 40 | + |
| 41 | + FileSystem fs1 = getFileSystem(p1); |
| 42 | + FileSystem fs2 = getFileSystem(p2); |
| 43 | + FileSystem fs3 = getFileSystem(p3); |
| 44 | + fs1.create(p1); |
| 45 | + |
| 46 | + /* the gluster volume and default is based on configuration settings, but expected that default = gv0 */ |
| 47 | + Assert.assertTrue(fs1.exists(p1)); |
| 48 | + Assert.assertTrue(fs2.exists(p2)); |
| 49 | + Assert.assertFalse(fs3.exists(p3)); |
| 50 | + |
| 51 | + fs1.delete(p1); |
| 52 | + } |
| 53 | + |
| 54 | + |
| 55 | +} |
0 commit comments