[jboss-cvs] JBossAS SVN: r108167 - in projects/metadata/trunk/src/test: java/org/jboss/test/metadata/jbpapp5040 and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Sep 16 05:25:26 EDT 2010
Author: wolfc
Date: 2010-09-16 05:25:25 -0400 (Thu, 16 Sep 2010)
New Revision: 108167
Added:
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbpapp5040/
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbpapp5040/unit/
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbpapp5040/unit/FileEncodingTestCase.java
projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbpapp5040/
projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbpapp5040/unit/
projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbpapp5040/unit/ejb-jar_utf-8.xml
projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbpapp5040/unit/ejb-jar_windows-1252.xml
Log:
JBPAPP-5040: unit test
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbpapp5040/unit/FileEncodingTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbpapp5040/unit/FileEncodingTestCase.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/jbpapp5040/unit/FileEncodingTestCase.java 2010-09-16 09:25:25 UTC (rev 108167)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.metadata.jbpapp5040.unit;
+
+import org.jboss.metadata.ejb.spec.EjbJarMetaData;
+import org.jboss.test.metadata.ejb.AbstractEJBEverythingTest;
+
+import java.lang.reflect.Field;
+import java.nio.charset.Charset;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class FileEncodingTestCase extends AbstractEJBEverythingTest
+{
+ public FileEncodingTestCase(String name)
+ {
+ super(name);
+ }
+
+ private static void flushCharset() throws Exception
+ {
+ Field field = Charset.class.getDeclaredField("defaultCharset");
+ field.setAccessible(true);
+ field.set(null, null);
+ }
+
+ public void testUTF8() throws Exception
+ {
+ EjbJarMetaData ejbJar = unmarshal("ejb-jar_utf-8.xml", EjbJarMetaData.class);
+
+ String s = ejbJar.getEnterpriseBean("EncodedBean").getEnvironmentEntryByName("encodedCharacter").getValue();
+ assertEquals("é", s);
+ System.out.println(s);
+ }
+
+ public void testWindows1252() throws Exception
+ {
+ EjbJarMetaData ejbJar = unmarshal("ejb-jar_windows-1252.xml", EjbJarMetaData.class);
+
+ String s = ejbJar.getEnterpriseBean("EncodedBean").getEnvironmentEntryByName("encodedCharacter").getValue();
+ assertEquals("é", s);
+ System.out.println(s);
+ }
+}
Added: projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbpapp5040/unit/ejb-jar_utf-8.xml
===================================================================
--- projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbpapp5040/unit/ejb-jar_utf-8.xml (rev 0)
+++ projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbpapp5040/unit/ejb-jar_utf-8.xml 2010-09-16 09:25:25 UTC (rev 108167)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+ <enterprise-beans>
+ <session>
+ <ejb-name>EncodedBean</ejb-name>
+ <env-entry>
+ <env-entry-name>encodedCharacter</env-entry-name>
+ <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>é</env-entry-value>
+ </env-entry>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
Added: projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbpapp5040/unit/ejb-jar_windows-1252.xml
===================================================================
--- projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbpapp5040/unit/ejb-jar_windows-1252.xml (rev 0)
+++ projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/jbpapp5040/unit/ejb-jar_windows-1252.xml 2010-09-16 09:25:25 UTC (rev 108167)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="WINDOWS-1252"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+ <enterprise-beans>
+ <session>
+ <ejb-name>EncodedBean</ejb-name>
+ <env-entry>
+ <env-entry-name>encodedCharacter</env-entry-name>
+ <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>é</env-entry-value>
+ </env-entry>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
More information about the jboss-cvs-commits
mailing list