[jboss-cvs] JBossAS SVN: r81388 - in projects/ejb3/trunk/testsuite/src/test: resources and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Nov 21 00:00:09 EST 2008
Author: ALRubinger
Date: 2008-11-21 00:00:08 -0500 (Fri, 21 Nov 2008)
New Revision: 81388
Added:
projects/ejb3/trunk/testsuite/src/test/resources/log4j.xml
Modified:
projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/schema/unit/SchemaTestCase.java
Log:
[EJBTHREE-1241] Rework "schema" tests so the true failure is shown
Modified: projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/schema/unit/SchemaTestCase.java
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/schema/unit/SchemaTestCase.java 2008-11-21 03:48:00 UTC (rev 81387)
+++ projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/schema/unit/SchemaTestCase.java 2008-11-21 05:00:08 UTC (rev 81388)
@@ -27,6 +27,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import junit.framework.Test;
+import junit.framework.TestCase;
import org.jboss.logging.Logger;
import org.jboss.test.JBossTestCase;
@@ -42,8 +43,6 @@
*/
public class SchemaTestCase extends JBossTestCase implements ErrorHandler
{
- Exception caughtException = null;
-
private static final Logger log = Logger.getLogger(SchemaTestCase.class);
private static final String LOCATION_RESOURCES_TEST = "../src/test/resources/test";
@@ -114,11 +113,9 @@
validateFile(SchemaTestCase.LOCATION_RESOURCES_TEST + "/securitydomain/META-INF/ejb-jar.xml", builder);
validateFile(SchemaTestCase.LOCATION_RESOURCES_TEST + "/security/META-INF/ejb-jar.xml", builder);
validateFile(SchemaTestCase.LOCATION_RESOURCES_TEST + "/service/META-INF/ejb-jar.xml", builder);
- validateFile(SchemaTestCase.LOCATION_RESOURCES_TEST + "/standalone/META-INF/ejb-jar.xml", builder);
validateFile(SchemaTestCase.LOCATION_RESOURCES_TEST + "/stateful/META-INF/ejb-jar.xml", builder);
validateFile(SchemaTestCase.LOCATION_RESOURCES_TEST + "/txexceptions/META-INF/ejb-jar.xml", builder);
validateFile(SchemaTestCase.LOCATION_RESOURCES_TEST + "/unauthenticatedprincipal/META-INF/ejb-jar.xml", builder);
- validateFile(SchemaTestCase.LOCATION_RESOURCES_TEST + "/webservices/META-INF/ejb-jar.xml", builder);
}
/*
@@ -154,7 +151,6 @@
validateFile(SchemaTestCase.LOCATION_RESOURCES_TEST + "/clusteredsession/META-INF/jboss.xml", builder);
validateFile(SchemaTestCase.LOCATION_RESOURCES_TEST + "/clusteredsession/scoped/META-INF/jboss.xml", builder);
validateFile(SchemaTestCase.LOCATION_RESOURCES_TEST + "/consumer/META-INF/jboss.xml", builder);
- validateFile(SchemaTestCase.LOCATION_RESOURCES_TEST + "/dd/jboss.xml", builder);
validateFile(SchemaTestCase.LOCATION_RESOURCES_TEST + "/dd/mdb/META-INF/jboss.xml", builder);
validateFile(SchemaTestCase.LOCATION_RESOURCES_TEST + "/dd/web/META-INF/jboss.xml", builder);
validateFile(SchemaTestCase.LOCATION_RESOURCES_TEST + "/dependency/META-INF/jboss.xml", builder);
@@ -197,39 +193,20 @@
}
- /*
- * This test has been removed as the documentation is
- * now in Freezone on JBoss Labs, and outside of EJB3 Core
- */
-// public void testTutorialJBoss() throws Exception
-// {
-// DocumentBuilder builder = getDocumentBuilder();
-//
-// validateFile("../docs/tutorial/consumer_deployment_descriptor/META-INF/jboss.xml", builder);
-// validateFile("../docs/tutorial/dependency/META-INF/jboss.xml", builder);
-// validateFile("../docs/tutorial/ejb21_client_adaptors/META-INF/jboss.xml", builder);
-// validateFile("../docs/tutorial/jboss_deployment_descriptor/META-INF/jboss.xml", builder);
-// validateFile("../docs/tutorial/jboss_resource_ref/META-INF/jboss.xml", builder);
-// validateFile("../docs/tutorial/jca/inflow/quartz/META-INF/jboss.xml", builder);
-// validateFile("../docs/tutorial/jca/inflow/swiftmq/resources/META-INF/jboss.xml", builder);
-// validateFile("../docs/tutorial/mdb_deployment_descriptor/META-INF/jboss.xml", builder);
-// validateFile("../docs/tutorial/reference21_30/META-INF/jboss2.xml", builder);
-// validateFile("../docs/tutorial/reference21_30/META-INF/jboss3.xml", builder);
-// validateFile("../docs/tutorial/service_deployment_descriptor/META-INF/jboss.xml", builder);
-// validateFile("../docs/tutorial/stateful_deployment_descriptor/META-INF/jboss.xml", builder);
-// validateFile("../docs/tutorial/stateless_deployment_descriptor/META-INF/jboss.xml", builder);
-// }
-
private void validateFile(String filename, DocumentBuilder builder) throws Exception
{
File xmlFile = new File(filename);
- System.out.println("Parsing and validating " + filename);
- Document dom = builder.parse(xmlFile);
-
- if (caughtException != null)
- throw caughtException;
-
- System.out.println("Success parsing " + filename);
+ log.info("Parsing and validating " + filename);
+ try
+ {
+ builder.parse(xmlFile);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Exception parsing " + filename, e);
+ }
+
+ log.info("Success parsing " + filename);
}
private DocumentBuilder getDocumentBuilder() throws Exception
@@ -256,19 +233,19 @@
public void fatalError(SAXParseException e)
{
- System.out.println("fatalError " + e);
- caughtException = e;
+ this.error(e);
}
public void error(SAXParseException e)
{
- System.out.println("Error " + e);
- caughtException = e;
+ log.error("Error: " + e);
+ TestCase.fail(e.toString());
}
public void warning(SAXParseException e)
{
- System.out.println("Warning " + e);
+ log.info("Warning: " + e);
+ TestCase.fail(e.toString());
}
}
Added: projects/ejb3/trunk/testsuite/src/test/resources/log4j.xml
===================================================================
--- projects/ejb3/trunk/testsuite/src/test/resources/log4j.xml (rev 0)
+++ projects/ejb3/trunk/testsuite/src/test/resources/log4j.xml 2008-11-21 05:00:08 UTC (rev 81388)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 68671 2008-01-08 10:04:25Z wolfc $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+ <param name="File" value="target/test.log"/>
+ <param name="Threshold" value="INFO"/>
+ <param name="Append" value="false"/>
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <!-- Rollover at the top of each hour
+ <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+ -->
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+ <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+ <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jboss">
+ <priority value="INFO"/>
+ </category>
+
+ <category name="org.jnp">
+ <priority value="INFO"/>
+ </category>
+
+ <category name="org.jboss.ejb3">
+ <priority value="ALL"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
More information about the jboss-cvs-commits
mailing list