KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > xmloutput > test > TestMacEncodings


1 /*
2  * (c) Copyright 2005 Hewlett-Packard Development Company, LP
3  * [See end of file]
4  */

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 /**
22  * @author Jeremy J. Carroll
23  *
24  */

25 public class TestMacEncodings extends ModelTestBase
26 {
27     private static Log logger = LogFactory.getLog( TestMacEncodings.class );
28
29     public TestMacEncodings( String JavaDoc 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 JavaDoc 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     /*
54     public void test00InitMacTests() {
55         try {
56             OutputStream out = new ByteArrayOutputStream();
57             
58             Writer wrtr = new OutputStreamWriter(out,"MacRoman");
59             InUse = true;
60         } catch (Exception e){
61             InUse = false;
62         }
63      if (!InUse){
64          logger.warn("MacRoman not supported on this Java installation: mac encoding tests suppressed.");
65          
66      }
67         
68     }
69      */

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 /*
99  * (c) Copyright 2005 Hewlett-Packard Development Company, LP
100  * All rights reserved.
101  *
102  * Redistribution and use in source and binary forms, with or without
103  * modification, are permitted provided that the following conditions
104  * are met:
105  * 1. Redistributions of source code must retain the above copyright
106  * notice, this list of conditions and the following disclaimer.
107  * 2. Redistributions in binary form must reproduce the above copyright
108  * notice, this list of conditions and the following disclaimer in the
109  * documentation and/or other materials provided with the distribution.
110  * 3. The name of the author may not be used to endorse or promote products
111  * derived from this software without specific prior written permission.
112  *
113  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
114  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
115  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
116  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
117  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
118  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
119  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
120  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
121  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
122  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
123  */

124  
125
Popular Tags