1 5 6 package com.hp.hpl.jena.xmloutput.test; 7 8 9 10 import java.io.*; 11 12 import org.apache.commons.logging.Log; 13 import org.apache.commons.logging.LogFactory; 14 15 import junit.framework.*; 16 17 import com.hp.hpl.jena.rdf.arp.test.MoreTests; 18 import com.hp.hpl.jena.rdf.model.*; 19 import com.hp.hpl.jena.rdf.model.test.ModelTestBase; 20 21 25 public class TestMacEncodings extends ModelTestBase 26 { 27 private static Log logger = LogFactory.getLog( TestMacEncodings.class ); 28 29 public TestMacEncodings( String name ) 30 { super( name ); } 31 32 public static TestSuite suite() 33 { 34 TestSuite suite = new TestSuite( TestMacEncodings.class ); 35 suite.setName("Encodings (particular MacRoman etc.)"); 36 37 try { 38 OutputStream out = new ByteArrayOutputStream(); 39 40 Writer wrtr = new OutputStreamWriter(out,"MacRoman"); 41 InUse = true; 42 } catch (Exception e){ 43 InUse = false; 44 } 45 if (!InUse){ 46 logger.warn("MacRoman not supported on this Java installation: mac encoding tests suppressed."); 47 return suite; 48 } 49 suite.addTest(new MoreTests("testARPMacRoman")); 50 suite.addTest(new MoreTests("testARPMacArabic")); 51 return suite; } 52 static private boolean InUse = false; 53 70 71 public void testXMLWriterMacRoman() throws IOException { 72 if (!InUse) return; 73 TestXMLFeatures.blockLogger(); 74 Model m = createMemModel(); 75 OutputStream fos = new ByteArrayOutputStream(); 76 Writer w = new OutputStreamWriter(fos,"MacRoman"); 77 m.write(w, "RDF/XML"); 78 assertTrue(TestXMLFeatures.unblockLogger()); 79 } 80 81 82 public void testXMLWriteMacArabic() throws IOException { 83 if (!InUse) return; 84 TestXMLFeatures.blockLogger(); 85 Model m = createMemModel(); 86 OutputStream fos = new ByteArrayOutputStream(); 87 Writer w = new OutputStreamWriter(fos,"MacRoman"); 88 m.write(w, "RDF/XML"); 89 assertTrue(TestXMLFeatures.unblockLogger()); 90 } 91 92 93 94 95 } 96 97 98 124 125 | Popular Tags |