abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject svn commit: r538598 - in /incubator/abdera/java/trunk: core/src/test/java/org/apache/abdera/test/core/CoreTest.java parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java parser/src/test/java/org/apache/abdera/test/parser/EncodingTest.java
Date Wed, 16 May 2007 13:58:48 GMT
Author: ugo
Date: Wed May 16 06:58:46 2007
New Revision: 538598

URL: http://svn.apache.org/viewvc?view=rev&rev=538598
Log:
[ABDERA-47] Moved testcase to abdera-parser module so it can be run within Eclipse

Added:
    incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/EncodingTest.java
  (with props)
Modified:
    incubator/abdera/java/trunk/core/src/test/java/org/apache/abdera/test/core/CoreTest.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java

Modified: incubator/abdera/java/trunk/core/src/test/java/org/apache/abdera/test/core/CoreTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/test/java/org/apache/abdera/test/core/CoreTest.java?view=diff&rev=538598&r1=538597&r2=538598
==============================================================================
--- incubator/abdera/java/trunk/core/src/test/java/org/apache/abdera/test/core/CoreTest.java
(original)
+++ incubator/abdera/java/trunk/core/src/test/java/org/apache/abdera/test/core/CoreTest.java
Wed May 16 06:58:46 2007
@@ -19,15 +19,12 @@
 
 import java.util.Date;
 
-import org.apache.abdera.Abdera;
+import junit.framework.TestCase;
+
 import org.apache.abdera.model.AtomDate;
-import org.apache.abdera.model.Content;
-import org.apache.abdera.model.Entry;
 import org.apache.abdera.util.AbderaConfiguration;
 import org.apache.abdera.util.URIHelper;
 
-import junit.framework.TestCase;
-
 public class CoreTest extends TestCase {
 
   public static void testDefaultConfigurationProperties() {
@@ -73,20 +70,5 @@
     atomNow = AtomDate.valueOf(rfc3339);
     Date parsed = atomNow.getDate();
     assertEquals(now, parsed);
-  }
-  
-  public void testAbderaEncodingHandling() throws Exception {
-      Abdera abdera = new Abdera();
-      Entry entry = abdera.newEntry();
-      entry.setId("http://example.com/entry/1");
-      entry.setTitle("Whatever");
-      entry.setUpdated(new Date());
-      Content content = entry.getFactory().newContent(Content.Type.XML);
-      String s = "<x>" + new Character((char) 224) + "</x>";
-      content.setValue(s);
-      content.setMimeType("application/xml+whatever");
-      entry.setContentElement(content);
-      assertNotNull(entry.getContent());
-      assertEquals(s, entry.getContent());
   }
 }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java?view=diff&rev=538598&r1=538597&r2=538598
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
Wed May 16 06:58:46 2007
@@ -21,6 +21,7 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
@@ -503,11 +504,11 @@
   }
   
   
-  protected Element _parse(String value, IRI baseUri) throws ParseException, IRISyntaxException
{
+  protected Element _parse(String value, IRI baseUri) throws ParseException, IRISyntaxException,
UnsupportedEncodingException {
     if (value == null) return null;
     FOMFactory fomfactory = (FOMFactory) factory;
     Parser parser = fomfactory.newParser();
-    ByteArrayInputStream bais = new ByteArrayInputStream(value.getBytes());
+    ByteArrayInputStream bais = new ByteArrayInputStream(value.getBytes(getXMLStreamReader().getCharacterEncodingScheme()));
     ParserOptions options = parser.getDefaultParserOptions();
     options.setCharset(getXMLStreamReader().getCharacterEncodingScheme());
     options.setFactory(fomfactory);

Added: incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/EncodingTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/EncodingTest.java?view=auto&rev=538598
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/EncodingTest.java
(added)
+++ incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/EncodingTest.java
Wed May 16 06:58:46 2007
@@ -0,0 +1,36 @@
+/*
+ * (c) 2007 Joost Technologies B.V. All rights reserved. This code contains
+ * trade secrets of Joost Technologies B.V. and any unauthorized use or
+ * disclosure is strictly prohibited.
+ * 
+ * $Id$
+ */
+package org.apache.abdera.test.parser;
+
+import java.util.Date;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.model.Content;
+import org.apache.abdera.model.Entry;
+
+import junit.framework.TestCase;
+
+
+public class EncodingTest extends TestCase {
+    
+    public void testContentEncoding() throws Exception {
+        Abdera abdera = new Abdera();
+        Entry entry = abdera.newEntry();
+        entry.setId("http://example.com/entry/1");
+        entry.setTitle("Whatever");
+        entry.setUpdated(new Date());
+        Content content = entry.getFactory().newContent(Content.Type.XML);
+        String s = "<x>" + new Character((char) 224) + "</x>";
+        content.setValue(s);
+        content.setMimeType("application/xml+whatever");
+        entry.setContentElement(content);
+        assertNotNull(entry.getContent());
+        assertEquals(s, entry.getContent());
+    }
+
+}

Propchange: incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/EncodingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/EncodingTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/EncodingTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message