package com.wsheng.cms.cms.test;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import org.junit.Test;
public class FileSyncTest {
// change to the real file path
private final static String PRO_FILE = "C:/cloudvipzonefile.txt";
private final static String LOCAL_FILE = "\\src\\test\\resources\\dnsfiles\\testzonefile.txt";
@Test
public void copyContents() {
try {
String projectPath = System.getProperty("user.dir");
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(PRO_FILE)));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(projectPath + LOCAL_FILE)));
String currentLineData = null;
while ((currentLineData = br.readLine()) != null) {
bw.write(currentLineData);
bw.newLine(); // line feed, need to wrap
}
bw.close();
br.close();
} catch (FileNotFoundException e) {
e.printStackTrace ();
} catch (IOException ioe) {
yes.printStackTrace ();
}
}
}