[jboss-cvs] JBossAS SVN: r73403 - in projects/ejb3/trunk/common: .settings and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed May 14 21:30:10 EDT 2008


Author: ALRubinger
Date: 2008-05-14 21:30:10 -0400 (Wed, 14 May 2008)
New Revision: 73403

Added:
   projects/ejb3/trunk/common/src/test/java/org/
   projects/ejb3/trunk/common/src/test/java/org/jboss/
   projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/
   projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/
   projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/
   projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/string/
   projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/string/AdjustWhiteSpaceStringToNullTestCase.java
   projects/ejb3/trunk/common/src/test/resources/log4j.xml
Modified:
   projects/ejb3/trunk/common/.classpath
   projects/ejb3/trunk/common/.settings/org.eclipse.jdt.core.prefs
   projects/ejb3/trunk/common/pom.xml
Log:
[EJBTHREE-1365] Added Unit Tests for new StringUtils

Modified: projects/ejb3/trunk/common/.classpath
===================================================================
--- projects/ejb3/trunk/common/.classpath	2008-05-15 01:13:27 UTC (rev 73402)
+++ projects/ejb3/trunk/common/.classpath	2008-05-15 01:30:10 UTC (rev 73403)
@@ -5,5 +5,8 @@
   <classpathentry kind="src" path="src/test/resources" output="target/tests-classes" excluding="**/*.java"/>
   <classpathentry kind="output" path="target/classes"/>
   <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
 </classpath>
\ No newline at end of file

Modified: projects/ejb3/trunk/common/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/ejb3/trunk/common/.settings/org.eclipse.jdt.core.prefs	2008-05-15 01:13:27 UTC (rev 73402)
+++ projects/ejb3/trunk/common/.settings/org.eclipse.jdt.core.prefs	2008-05-15 01:30:10 UTC (rev 73403)
@@ -1,4 +1,4 @@
-#Wed May 14 18:30:31 EDT 2008
+#Wed May 14 21:18:35 EDT 2008
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.source=1.5

Modified: projects/ejb3/trunk/common/pom.xml
===================================================================
--- projects/ejb3/trunk/common/pom.xml	2008-05-15 01:13:27 UTC (rev 73402)
+++ projects/ejb3/trunk/common/pom.xml	2008-05-15 01:30:10 UTC (rev 73403)
@@ -1,4 +1,6 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
   <!-- Define Parent -->
   <parent>
@@ -16,9 +18,34 @@
   <artifactId>jboss-ejb3-common</artifactId>
   <version>0.1.0-SNAPSHOT</version>
   <name>JBoss EJB 3.0 Common Utilities</name>
-  <description>JBoss EJB 3.0 Utilities Common to all Components</description>
+  <description>
+    JBoss EJB 3.0 Utilities Common to all Components
+  </description>
   <url>http://www.jboss.org/jbossejb3/</url>
+  
+  <build>
 
+        <plugins>
+          <!-- Surefire -->
+          <plugin>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <redirectTestOutputToFile>true</redirectTestOutputToFile>
+              <printSummary>true</printSummary>
+              <testFailureIgnore>false</testFailureIgnore>
+              <includes>
+                <include>**/*TestCase.java</include>
+                <include>**/*TestSuite.java</include>
+              </includes>
+              <forkMode>always</forkMode>
+              <argLine>-ea</argLine>
+            </configuration>
+          </plugin>
+
+        </plugins>
+
+  </build>
+
   <!-- Dependencies -->
 
   <!-- 
@@ -36,5 +63,17 @@
       <artifactId>junit</artifactId>
     </dependency>
 
+    <!-- Logging -->
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-spi</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
 </project>

Added: projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/string/AdjustWhiteSpaceStringToNullTestCase.java
===================================================================
--- projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/string/AdjustWhiteSpaceStringToNullTestCase.java	                        (rev 0)
+++ projects/ejb3/trunk/common/src/test/java/org/jboss/ejb3/test/common/string/AdjustWhiteSpaceStringToNullTestCase.java	2008-05-15 01:30:10 UTC (rev 73403)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.ejb3.test.common.string;
+
+import junit.framework.TestCase;
+
+import org.jboss.ejb3.common.string.StringUtils;
+import org.jboss.logging.Logger;
+import org.junit.Test;
+
+/**
+ * AdjustWhiteSpaceStringToNullTestCase
+ * 
+ * A Test Case to ensure that adjusting a whitespace String
+ * to null works as expected
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class AdjustWhiteSpaceStringToNullTestCase
+{
+
+   // --------------------------------------------------------------------------------||
+   // Class Members ------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   private static final Logger logger = Logger.getLogger(AdjustWhiteSpaceStringToNullTestCase.class);
+
+   // --------------------------------------------------------------------------------||
+   // Tests --------------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Test that a null String is not adjusted, and returns as null
+    */
+   @Test
+   public void testNullStringReturnsNull()
+   {
+      String test = null;
+      String result = StringUtils.adjustWhitespaceStringToNull(test);
+      TestCase.assertNull("Adjusted null argument should return as null", result);
+   }
+
+   /**
+    * Test that a String with no whitespace returns as equal by value
+    * to what was passed in
+    */
+   @Test
+   public void testNoWhitespaceStringReturnsSame()
+   {
+      String test = "test";
+      String result = StringUtils.adjustWhitespaceStringToNull(test);
+      TestCase
+            .assertEquals("Adjusted String is not equal by value to input of String with no whitespace", test, result);
+   }
+
+   /**
+    * Tests that a String containing only whitespace returns as null
+    */
+   @Test
+   public void testWhitespaceStringReturnsNull()
+   {
+      String test = "  ";
+      String result = StringUtils.adjustWhitespaceStringToNull(test);
+      TestCase.assertNull("Whitespace String should be adjusted to null", result);
+
+   }
+
+   /**
+    * Tests that a character string with whitespace returns as equal by value 
+    * to what was passed in
+    */
+   @Test
+   public void testWhitespaceWithinCharacterStringReturnsSame()
+   {
+      String test = "test  ";
+      String result = StringUtils.adjustWhitespaceStringToNull(test);
+      TestCase
+            .assertEquals(
+                  "Character string with valid characters and whitespace should return equal by value to input", test,
+                  result);
+   }
+
+}

Added: projects/ejb3/trunk/common/src/test/resources/log4j.xml
===================================================================
--- projects/ejb3/trunk/common/src/test/resources/log4j.xml	                        (rev 0)
+++ projects/ejb3/trunk/common/src/test/resources/log4j.xml	2008-05-15 01:30:10 UTC (rev 73403)
@@ -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.jboss.ejb3.test.common">
+    <priority value="ALL"/>
+  </category>
+  
+  <category name="org.jboss.ejb3.common">
+    <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