use of org.eclipse.wst.sse.core.internal.encoding.CodedReaderCreator in project webtools.sourceediting by eclipse.
the class CreateCodedReaderTester method testCreateAllFiles.
public void testCreateAllFiles() throws CoreException, IOException {
if (RECREATE_FILES) {
List allFiles = TestsPlugin.getAllTestFiles(TEST_FILE_DIR);
URL outputDirURL = TestsPlugin.getInstallLocation();
File zipoutFile = new File(outputDirURL.getPath(), TESTFILES_ZIPFILE_NAME);
java.io.FileOutputStream zipOut = new FileOutputStream(zipoutFile);
ZipOutputStream zipOutputStream = new ZipOutputStream(zipOut);
int count = 1;
for (Iterator iter = allFiles.iterator(); iter.hasNext(); ) {
File file = (File) iter.next();
createZipEntry(zipOutputStream, file);
CodedReaderCreator codedReaderCreator = new CodedReaderCreator();
codedReaderCreator.set(file.getName(), new FileInputStream(file));
String detectedCharsetName = null;
String javaCharsetName = null;
String expectedException = null;
try {
// just used for debug info, but can throw exception
javaCharsetName = codedReaderCreator.getEncodingMemento().getJavaCharsetName();
detectedCharsetName = codedReaderCreator.getEncodingMemento().getDetectedCharsetName();
} catch (UnsupportedCharsetExceptionWithDetail e) {
// ignore for simply creating tests
expectedException = e.getClass().getName() + ".class";
} catch (MalformedInputException e) {
// ignore for simply creating tests
expectedException = e.getClass().getName() + ".class";
} catch (IllegalCharsetNameException e) {
// ignore for simply creating tests
expectedException = e.getClass().getName() + ".class";
}
String subpath = getSubPathName(file);
createTestMethodSource(count, subpath, detectedCharsetName, javaCharsetName, expectedException);
count++;
}
zipOutputStream.close();
zipOut.close();
assertTrue(true);
}
}
Aggregations