[jboss-svn-commits] JBL Code SVN: r7466 - in labs/jbossesb/trunk: product/core/rosetta/tests/src/org/jboss/soa/esb/testutils product/core/services/tests/src/org/jboss/internal/soa/esb/services/registry product/core/services/tests/src/org/jboss/soa/esb/services/registry product/core/services/tests/src/org/jboss/soa/esb/services/util qa/junit/src/org/jboss/soa/esb/actions qa/junit/src/org/jboss/soa/esb/listeners/gateway qa/junit/src/org/jboss/soa/esb/listeners/message
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Nov 8 09:18:28 EST 2006
Author: kurt.stam at jboss.com
Date: 2006-11-08 09:18:24 -0500 (Wed, 08 Nov 2006)
New Revision: 7466
Added:
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/testutils/FileUtil.java
Removed:
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/util/FileUtil.java
Modified:
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryUnitTest.java
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/RegistryUnitTest.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/CbrProxyActionUnitTest.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListenerUnitTest.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListenerTest.java
Log:
making qa compile
Copied: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/testutils/FileUtil.java (from rev 7464, labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/util/FileUtil.java)
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/util/FileUtil.java 2006-11-08 13:35:33 UTC (rev 7464)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/testutils/FileUtil.java 2006-11-08 14:18:24 UTC (rev 7466)
@@ -0,0 +1,83 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.soa.esb.testutils;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+/**
+ * Utility class for reading a file into a String and back.
+ * @author kstam
+ */
+public class FileUtil {
+ /**
+ * Read the file into a String.
+ * @param file - the file to be read
+ * @return String with the content of the file
+ * @throws IOException - when we can't read the file
+ */
+ public static String readTextFile(File file) throws IOException
+ {
+ StringBuffer sb = new StringBuffer(1024);
+ BufferedReader reader = new BufferedReader(new FileReader(file.getPath()));
+ char[] chars = new char[1];
+ while( (reader.read(chars)) > -1){
+ sb.append(String.valueOf(chars));
+ chars = new char[1];
+ }
+ reader.close();
+ return sb.toString();
+ }
+ /**
+ *
+ */
+ public static String readStream(InputStream inputStream) throws IOException
+ {
+ StringBuffer sb = new StringBuffer(1024);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+ char[] chars = new char[1];
+ while( (reader.read(chars)) > -1){
+ sb.append(String.valueOf(chars));
+ chars = new char[1];
+ }
+ reader.close();
+ return sb.toString();
+ }
+ /**
+ * Write a String into a file.
+ * @param file - File to which we write the String
+ * @param str - string which will be written
+ * @throws IOException - when we can't write to the file
+ */
+ public static void writeTextFile(File file, String str) throws IOException
+ {
+ BufferedWriter writer = new BufferedWriter(new FileWriter(file.getPath()));
+ writer.write(str);
+ writer.close();
+ }
+
+}
Modified: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryUnitTest.java 2006-11-08 14:03:45 UTC (rev 7465)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryUnitTest.java 2006-11-08 14:18:24 UTC (rev 7466)
@@ -55,7 +55,7 @@
import org.jboss.internal.soa.esb.addressing.helpers.EPRHelper;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.services.registry.RegistryException;
-import org.jboss.soa.esb.services.util.FileUtil;
+import org.jboss.soa.esb.testutils.FileUtil;
import org.jboss.soa.esb.testutils.HsqldbUtil;
import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
import org.junit.AfterClass;
Modified: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/RegistryUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/RegistryUnitTest.java 2006-11-08 14:03:45 UTC (rev 7465)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/RegistryUnitTest.java 2006-11-08 14:18:24 UTC (rev 7466)
@@ -38,7 +38,7 @@
import org.apache.log4j.Priority;
import org.apache.log4j.xml.DOMConfigurator;
import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.services.util.FileUtil;
+import org.jboss.soa.esb.testutils.FileUtil;
import org.jboss.soa.esb.testutils.HsqldbUtil;
import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
import org.junit.AfterClass;
Deleted: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/util/FileUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/util/FileUtil.java 2006-11-08 14:03:45 UTC (rev 7465)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/util/FileUtil.java 2006-11-08 14:18:24 UTC (rev 7466)
@@ -1,83 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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.soa.esb.services.util;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-/**
- * Utility class for reading a file into a String and back.
- * @author kstam
- */
-public class FileUtil {
- /**
- * Read the file into a String.
- * @param file - the file to be read
- * @return String with the content of the file
- * @throws IOException - when we can't read the file
- */
- public static String readTextFile(File file) throws IOException
- {
- StringBuffer sb = new StringBuffer(1024);
- BufferedReader reader = new BufferedReader(new FileReader(file.getPath()));
- char[] chars = new char[1];
- while( (reader.read(chars)) > -1){
- sb.append(String.valueOf(chars));
- chars = new char[1];
- }
- reader.close();
- return sb.toString();
- }
- /**
- *
- */
- public static String readStream(InputStream inputStream) throws IOException
- {
- StringBuffer sb = new StringBuffer(1024);
- BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
- char[] chars = new char[1];
- while( (reader.read(chars)) > -1){
- sb.append(String.valueOf(chars));
- chars = new char[1];
- }
- reader.close();
- return sb.toString();
- }
- /**
- * Write a String into a file.
- * @param file - File to which we write the String
- * @param str - string which will be written
- * @throws IOException - when we can't write to the file
- */
- public static void writeTextFile(File file, String str) throws IOException
- {
- BufferedWriter writer = new BufferedWriter(new FileWriter(file.getPath()));
- writer.write(str);
- writer.close();
- }
-
-}
Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/CbrProxyActionUnitTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/CbrProxyActionUnitTest.java 2006-11-08 14:03:45 UTC (rev 7465)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/actions/CbrProxyActionUnitTest.java 2006-11-08 14:18:24 UTC (rev 7466)
@@ -43,7 +43,7 @@
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.format.MessageFactory;
import org.jboss.soa.esb.services.routing.MessageRouter;
-import org.jboss.soa.esb.services.util.FileUtil;
+import org.jboss.soa.esb.testutils.FileUtil;
import org.jboss.soa.esb.testutils.HsqldbUtil;
import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
import org.junit.AfterClass;
Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java 2006-11-08 14:03:45 UTC (rev 7465)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListenerUnitTest.java 2006-11-08 14:18:24 UTC (rev 7466)
@@ -22,19 +22,25 @@
package org.jboss.soa.esb.listeners.gateway;
+import static org.junit.Assert.assertEquals;
+
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
+import junit.framework.JUnit4TestAdapter;
+
import org.apache.log4j.Logger;
-import org.jboss.soa.esb.common.tests.BaseTest;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.message.EsbListenerController;
import org.jboss.soa.esb.message.Message;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
-public class FileGatewayListenerUnitTest extends BaseTest
+public class FileGatewayListenerUnitTest
{
private static final String TMP_DIR = System.getProperty("java.io.tmpdir","/tmp");
@@ -54,6 +60,7 @@
EsbListenerController _esbListController;
GatewayListenerController _gatewayController;
+ @BeforeClass
public void setUp() throws Exception
{
_logger.info("Writing temp files to "+TMP_DIR);
@@ -66,6 +73,7 @@
_returnFile.delete();
}
+ @AfterClass
public void tearDown() throws Exception
{
_gatewayConfig.delete();
@@ -74,7 +82,8 @@
_returnFile.delete();
}
- public void test_FileGatewayListener() throws Exception
+ @Test
+ public void fileGatewayListener() throws Exception
{
try
{
@@ -94,7 +103,7 @@
catch (Exception e) { }
}
- public static class MockMessageAwareAction
+ private static class MockMessageAwareAction
{
ConfigTree _config;
public MockMessageAwareAction(ConfigTree config) { _config = config; }
@@ -106,7 +115,7 @@
} // ___________________________________________________
- void writeGatewayConfig() throws Exception
+ private void writeGatewayConfig() throws Exception
{
StringBuilder sb = new StringBuilder()
.append("<FileGateway parameterReloadSecs=\"180\">\n")
@@ -126,7 +135,7 @@
_logger.info("GatewayConfiguration\n"+stringFromFile(_gatewayConfig));
}
- void writeEsbListenerConfig() throws Exception
+ private void writeEsbListenerConfig() throws Exception
{
StringBuilder sb = new StringBuilder()
.append("<DummyTester parameterReloadSecs=\"180\">\n")
@@ -151,14 +160,14 @@
_logger.info("EsbListenerConfiguration\n"+stringFromFile(_esbListenerConfig));
}
- static void bytesToFile(File file, byte[] text) throws Exception
+ private static void bytesToFile(File file, byte[] text) throws Exception
{
OutputStream out = new FileOutputStream(file);
out.write(text);
out.close();
}
- static String stringFromFile(File file) throws Exception
+ private static String stringFromFile(File file) throws Exception
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -173,4 +182,8 @@
out.close();
return out.toString();
}
+
+ public static junit.framework.Test suite() {
+ return new JUnit4TestAdapter(FileGatewayListenerUnitTest.class);
+ }
}
Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListenerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListenerUnitTest.java 2006-11-08 14:03:45 UTC (rev 7465)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/gateway/JmsGatewayListenerUnitTest.java 2006-11-08 14:18:24 UTC (rev 7466)
@@ -22,6 +22,8 @@
package org.jboss.soa.esb.listeners.gateway;
+import static org.junit.Assert.assertEquals;
+
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -35,16 +37,20 @@
import javax.jms.QueueSession;
import javax.naming.Context;
+import junit.framework.JUnit4TestAdapter;
+
import org.apache.log4j.Logger;
import org.jboss.soa.esb.addressing.eprs.JMSEpr;
-import org.jboss.soa.esb.common.tests.BaseTest;
import org.jboss.soa.esb.helpers.AppServerContext;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.message.EsbListenerController;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.util.Util;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
-public class JmsGatewayListenerUnitTest extends BaseTest
+public class JmsGatewayListenerUnitTest
{
private static final String TMP_DIR = System.getProperty("java.io.tmpdir","/tmp");
@@ -62,6 +68,7 @@
EsbListenerController _esbListController;
GatewayListenerController _gatewayController;
+ @BeforeClass
public void setUp() throws Exception
{
_logger.info("Writing temp files to "+TMP_DIR);
@@ -75,6 +82,7 @@
sendJmsMessage(THE_TEXT);
}
+ @AfterClass
public void tearDown() throws Exception
{
_gatewayConfig.delete();
@@ -82,7 +90,8 @@
_returnFile.delete();
}
- public void test_JmsGatewayListener() throws Exception
+ @Test
+ public void jmsGatewayListener() throws Exception
{
try
{
@@ -101,7 +110,7 @@
catch (Exception e) { }
}
- public static class MockMessageAwareAction
+ private static class MockMessageAwareAction
{
ConfigTree _config;
public MockMessageAwareAction(ConfigTree config) { _config = config; }
@@ -113,7 +122,7 @@
} // ___________________________________________________
- void writeGatewayConfig() throws Exception
+ private void writeGatewayConfig() throws Exception
{
StringBuilder sb = new StringBuilder()
.append("<JmsGateway parameterReloadSecs=\"180\">\n")
@@ -135,7 +144,7 @@
_logger.info("GatewayConfiguration\n"+stringFromFile(_gatewayConfig));
}
- void writeEsbListenerConfig() throws Exception
+ private void writeEsbListenerConfig() throws Exception
{
StringBuilder sb = new StringBuilder()
.append("<DummyTester parameterReloadSecs=\"180\">\n")
@@ -160,14 +169,14 @@
_logger.info("EsbListenerConfiguration\n"+stringFromFile(_esbListenerConfig));
}
- static void bytesToFile(File file, byte[] text) throws Exception
+ private static void bytesToFile(File file, byte[] text) throws Exception
{
OutputStream out = new FileOutputStream(file);
out.write(text);
out.close();
}
- static String stringFromFile(File file) throws Exception
+ private static String stringFromFile(File file) throws Exception
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -182,7 +191,8 @@
out.close();
return out.toString();
}
- void sendJmsMessage(String text) throws Exception
+
+ private void sendJmsMessage(String text) throws Exception
{
ConfigTree tree = ConfigTree.fromInputStream(new FileInputStream(_gatewayConfig))
.getAllChildren()[0];
@@ -219,5 +229,9 @@
catch (JMSException e) {/* OK do nothing */ }
} //________________________________
+
+ public static junit.framework.Test suite() {
+ return new JUnit4TestAdapter(JmsGatewayListenerUnitTest.class);
+ }
}
Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListenerTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListenerTest.java 2006-11-08 14:03:45 UTC (rev 7465)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/message/CbrJmsQueueListenerTest.java 2006-11-08 14:18:24 UTC (rev 7466)
@@ -46,7 +46,7 @@
import org.jboss.soa.esb.services.registry.RegistryException;
import org.jboss.soa.esb.services.registry.RegistryFactory;
import org.jboss.soa.esb.services.routing.MessageRouter;
-import org.jboss.soa.esb.services.util.FileUtil;
+import org.jboss.soa.esb.testutils.FileUtil;
import org.jboss.soa.esb.testutils.HsqldbUtil;
import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
import org.junit.AfterClass;
More information about the jboss-svn-commits
mailing list