package com.rj;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.junit.Before;
import org.junit.Test;
public class Hdfs_hellos {
FileSystem fs = null;
@Before
public void init() throws IOException{
Configuration conf = new Configuration();
conf.set("fs.defaultFS","hdfs://192.168.200.13:8020");
System.setProperty("HADOOP_USER_NAME","root");
fs=FileSystem.get(conf);
}
@Test
public void testFileExsits() throws IllegalArgumentException,IOException
{
if(fs.exists(new Path("/tmp")))
{
System.out.println("File exists!");
}
else {
System.out.println("Error!!!");
}
}
}