Skip to content

Commit 4122fce

Browse files
committed
Merge pull request #117 from jayunit100/test4null
regression testable create method for gluster volume
2 parents 5b8534a + 798d1a2 commit 4122fce

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

src/main/java/org/apache/hadoop/fs/glusterfs/GlusterVolume.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,15 @@ public GlusterVolume(Configuration conf){
6969
this.setConf(conf);
7070
}
7171

72+
public URI getUriOrCreate(URI u) {
73+
if(NAME==null)
74+
return URI.create("glusterfs:///");
75+
return NAME;
76+
}
77+
7278
public URI getUri() {
73-
if(NAME==null) return URI.create("glusterfs:///");
74-
return NAME;
75-
}
79+
return getUriOrCreate(NAME);
80+
}
7681

7782
public void initialize(URI uri, Configuration conf) throws IOException {
7883
/* we only really care about the URI up to the path, so strip other things off */
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package org.apache.hadoop.fs.test;
2+
3+
import java.io.IOException;
4+
import junit.framework.Assert;
5+
import org.apache.hadoop.conf.Configuration;
6+
import org.junit.Test;
7+
import org.slf4j.Logger;
8+
import org.slf4j.LoggerFactory;
9+
import org.apache.hadoop.fs.glusterfs.*;
10+
/**
11+
* This class is for tests which are gluster specific.
12+
*/
13+
public class GlusterVolumeTest {
14+
15+
Logger log = LoggerFactory.getLogger(GlusterVolumeTest.class);
16+
static Configuration config = null;
17+
18+
@org.junit.Test
19+
public void testNullURI() {
20+
Assert.assertNotNull(new org.apache.hadoop.fs.glusterfs.GlusterVolume().getUriOrCreate(null));
21+
}
22+
23+
}

0 commit comments

Comments
 (0)