You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by al...@apache.org on 2007/01/22 21:24:10 UTC

svn commit: r498784 - /incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearEncodingTest.java

Author: alally
Date: Mon Jan 22 12:24:09 2007
New Revision: 498784

URL: http://svn.apache.org/viewvc?view=rev&rev=498784
Log:
Disable BOM tests on Sun Java 1.4
UIMA-193: https://issues.apache.org/jira/browse/UIMA-193

Modified:
    incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearEncodingTest.java

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearEncodingTest.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearEncodingTest.java?view=diff&rev=498784&r1=498783&r2=498784
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearEncodingTest.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/pear/util/PearEncodingTest.java Mon Jan 22 12:24:09 2007
@@ -1,82 +1,96 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.uima.pear.util;
-
-import java.io.File;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.uima.test.junit_extension.JUnitExtension;
-
-/**
- * Pear encoding tests
- * 
- */
-public class PearEncodingTest extends TestCase {
-
-  public void testUTF8NoSignature() throws Exception {
-    // get XML file
-    File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF8_no_signature.xml");
-    // get encoding
-    String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
-
-    // normalize encoding
-    encoding = encoding.toUpperCase();
-
-    Assert.assertTrue(encoding.equals("UTF-8"));
-  }
-
-  public void testUTF8WithSignature() throws Exception {
-    // get XML file
-    File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF8_with_signature.xml");
-    // get encoding
-    String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
-
-    // normalize encoding
-    encoding = encoding.toUpperCase();
-
-    Assert.assertTrue(encoding.equals("UTF-8"));
-  }
-
-  public void testUTF16NoSignature() throws Exception {
-    // get XML file
-    File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF16_no_signature.xml");
-    // get encoding
-    String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
-
-    // normalize encoding
-    encoding = encoding.toUpperCase();
-
-    Assert.assertTrue(encoding.equals("UTF-16LE"));
-  }
-
-  public void testUTF16WithSignature() throws Exception {
-    // get XML file
-    File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF16_with_signature.xml");
-    // get encoding
-    String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
-
-    // normalize encoding
-    encoding = encoding.toUpperCase();
-
-    Assert.assertTrue(encoding.equals("UTF-16"));
-  }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.pear.util;
+
+import java.io.File;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.uima.test.junit_extension.JUnitExtension;
+
+/**
+ * Pear encoding tests
+ * 
+ */
+public class PearEncodingTest extends TestCase {
+
+  public void testUTF8NoSignature() throws Exception {
+    // get XML file
+    File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF8_no_signature.xml");
+    // get encoding
+    String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
+
+    // normalize encoding
+    encoding = encoding.toUpperCase();
+
+    Assert.assertTrue(encoding.equals("UTF-8"));
+  }
+
+  public void testUTF8WithSignature() throws Exception {
+	// cancel this test for Sun's Java 1.3.x or 1.4.x - it does not support BOM
+    String javaVendor = System.getProperty("java.vendor");
+    if( javaVendor.startsWith("Sun") ) {
+        String javaVersion = System.getProperty("java.version");
+        if( javaVersion.startsWith("1.3") || javaVersion.startsWith("1.4") )
+            return;
+    }
+    // get XML file
+    File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF8_with_signature.xml");
+    // get encoding
+    String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
+
+    // normalize encoding
+    encoding = encoding.toUpperCase();
+
+    Assert.assertTrue(encoding.equals("UTF-8"));
+  }
+
+  public void testUTF16NoSignature() throws Exception {
+    // get XML file
+    File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF16_no_signature.xml");
+    // get encoding
+    String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
+
+    // normalize encoding
+    encoding = encoding.toUpperCase();
+
+    Assert.assertTrue(encoding.equals("UTF-16LE"));
+  }
+
+  public void testUTF16WithSignature() throws Exception {
+    // cancel this test for Sun's Java 1.3.x or 1.4.x - it does not support BOM
+    String javaVendor = System.getProperty("java.vendor");
+    if( javaVendor.startsWith("Sun") ) {
+        String javaVersion = System.getProperty("java.version");
+        if( javaVersion.startsWith("1.3") || javaVersion.startsWith("1.4") )
+            return;
+    }
+    // get XML file
+    File xmlFile = JUnitExtension.getFile("pearTests/encodingTests/UTF16_with_signature.xml");
+    // get encoding
+    String encoding = XMLUtil.detectXmlFileEncoding(xmlFile);
+
+    // normalize encoding
+    encoding = encoding.toUpperCase();
+
+    Assert.assertTrue(encoding.equals("UTF-16"));
+  }
+}