Filed By : J2SE-SQA
JDK : JDK1.4.2 b27 was tested
Platform[s] : Red Hat Linux Advanced Server release 2.1AS (Derry)
(Kernel 2.4.18-e.12smp on an ia64)
switch/Mode : -server -Xmixed
testbase : /net/cady/export/dtf/unified/knight-ws/suites/libs/mantis/testbase
testcase name : java_io/CharacterEncoding/DataFile
test machines : clie, encarta (both are Itanium II machines in J2SE system test lab in SCA14)
This testcase takes less than 1 minute to complete when running with linux-i586 AS21 (32bit) but it takes longer than 1 hour to complete with linux-ia64 on AS21 (64bit) Itanium.
DataFile.java: (also in attachment)
=================
* @(#)DataFile.java
* @author Vishal Byakod
*/
import java.util.*;
import java.io.*;
/**
*
*/
public class DataFile {
public static String sBaseDir;
public static String dateDir = "datafile"+File.separator;
public static void main(String[] args) throws Exception {
boolean status[];
int passcount = 0, failcount = 0;
int numTests = 1;
int i, j = 0;
status = new boolean[numTests];
if (args.length != 0) {
sBaseDir = args[0];
} else {
sBaseDir = System.getProperty("user.dir");
}
// add file separator to end of path
if ( !(sBaseDir.endsWith(File.separator)) ) {
sBaseDir = sBaseDir.concat(File.separator);
}
System.out.println("Total tests for Exec01 : "+numTests);
for(i = 0; i < numTests; ++i) {
// Put all tests in try... catch block
try {
++j;
switch (j) {
case 1:
status[i] = DataFileTest01();
break;
}
} catch (Exception e) {
status[i] = false;
System.out.println ("Exception in test "+j+": "+e.getMessage());
e.printStackTrace();
}
} // end for
// Get pass and fail totals
for(i = 0; i < numTests; ++i) {
if (status[i] == true)
passcount++;
else
failcount++;
}
System.out.println("Pass count: " + passcount);
System.out.println("Fail count: " + failcount);
// check if tests passed
if ( failcount < 1 ) {
System.out.println("Test for DataFile.java Passed");
TestHelper.exit(0);
} else {
System.out.println("Test for DataFile.java Failed");
TestHelper.exit(1);
}
} // end main
/**
*
*/
public static boolean DataFileTest01() {
boolean bReturn = false;
try {
String srcFile1 = sBaseDir + dateDir +"ISO2022JP.trailEsc";
String destFile1 = "ISO2022JP.trailEsc";
CopyFile(srcFile1,destFile1);
String srcFile2 = sBaseDir + dateDir +"tradChinese.po";
String destFile2 = "tradChinese.po";
CopyFile(srcFile2,destFile2);
String srcFile3 = sBaseDir + dateDir +"tradChinese.win.po";
String destFile3 = "tradChinese.win.po";
CopyFile(srcFile3,destFile3);
bReturn = true;
System.out.println ("DataFileTest01 Pass");
} catch (Exception e) {
bReturn = false;
System.out.println ("Exception thrown in DataFileTest01 Fail " + e);
e.printStackTrace();
}
return bReturn;
}
public static void CopyFile(String sourceFileName, String destFileName) throws Exception {
FileInputStream in = new FileInputStream(sourceFileName);
FileOutputStream out = new FileOutputStream(destFileName);
try {
int by;
while ( (by = in.read()) != -1)
{
out.write(by);
}
} catch (IOException e) {
}
in.close();
out.close();
}
}
###@###.### 2003-06-19
JDK : JDK1.4.2 b27 was tested
Platform[s] : Red Hat Linux Advanced Server release 2.1AS (Derry)
(Kernel 2.4.18-e.12smp on an ia64)
switch/Mode : -server -Xmixed
testbase : /net/cady/export/dtf/unified/knight-ws/suites/libs/mantis/testbase
testcase name : java_io/CharacterEncoding/DataFile
test machines : clie, encarta (both are Itanium II machines in J2SE system test lab in SCA14)
This testcase takes less than 1 minute to complete when running with linux-i586 AS21 (32bit) but it takes longer than 1 hour to complete with linux-ia64 on AS21 (64bit) Itanium.
DataFile.java: (also in attachment)
=================
* @(#)DataFile.java
* @author Vishal Byakod
*/
import java.util.*;
import java.io.*;
/**
*
*/
public class DataFile {
public static String sBaseDir;
public static String dateDir = "datafile"+File.separator;
public static void main(String[] args) throws Exception {
boolean status[];
int passcount = 0, failcount = 0;
int numTests = 1;
int i, j = 0;
status = new boolean[numTests];
if (args.length != 0) {
sBaseDir = args[0];
} else {
sBaseDir = System.getProperty("user.dir");
}
// add file separator to end of path
if ( !(sBaseDir.endsWith(File.separator)) ) {
sBaseDir = sBaseDir.concat(File.separator);
}
System.out.println("Total tests for Exec01 : "+numTests);
for(i = 0; i < numTests; ++i) {
// Put all tests in try... catch block
try {
++j;
switch (j) {
case 1:
status[i] = DataFileTest01();
break;
}
} catch (Exception e) {
status[i] = false;
System.out.println ("Exception in test "+j+": "+e.getMessage());
e.printStackTrace();
}
} // end for
// Get pass and fail totals
for(i = 0; i < numTests; ++i) {
if (status[i] == true)
passcount++;
else
failcount++;
}
System.out.println("Pass count: " + passcount);
System.out.println("Fail count: " + failcount);
// check if tests passed
if ( failcount < 1 ) {
System.out.println("Test for DataFile.java Passed");
TestHelper.exit(0);
} else {
System.out.println("Test for DataFile.java Failed");
TestHelper.exit(1);
}
} // end main
/**
*
*/
public static boolean DataFileTest01() {
boolean bReturn = false;
try {
String srcFile1 = sBaseDir + dateDir +"ISO2022JP.trailEsc";
String destFile1 = "ISO2022JP.trailEsc";
CopyFile(srcFile1,destFile1);
String srcFile2 = sBaseDir + dateDir +"tradChinese.po";
String destFile2 = "tradChinese.po";
CopyFile(srcFile2,destFile2);
String srcFile3 = sBaseDir + dateDir +"tradChinese.win.po";
String destFile3 = "tradChinese.win.po";
CopyFile(srcFile3,destFile3);
bReturn = true;
System.out.println ("DataFileTest01 Pass");
} catch (Exception e) {
bReturn = false;
System.out.println ("Exception thrown in DataFileTest01 Fail " + e);
e.printStackTrace();
}
return bReturn;
}
public static void CopyFile(String sourceFileName, String destFileName) throws Exception {
FileInputStream in = new FileInputStream(sourceFileName);
FileOutputStream out = new FileOutputStream(destFileName);
try {
int by;
while ( (by = in.read()) != -1)
{
out.write(by);
}
} catch (IOException e) {
}
in.close();
out.close();
}
}
###@###.### 2003-06-19