[jboss-svn-commits] JBL Code SVN: r7644 - in labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb: listeners/old util

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Nov 16 10:19:26 EST 2006


Author: kurt.stam at jboss.com
Date: 2006-11-16 10:19:24 -0500 (Thu, 16 Nov 2006)
New Revision: 7644

Modified:
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/old/DirectoryPollerTest.java
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/old/JmsQueueListenerTest.java
   labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/ListenerUtils.java
Log:
Fixing paths and token replacement. Uncommented code.

Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/old/DirectoryPollerTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/old/DirectoryPollerTest.java	2006-11-16 15:16:24 UTC (rev 7643)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/old/DirectoryPollerTest.java	2006-11-16 15:19:24 UTC (rev 7644)
@@ -26,7 +26,6 @@
 import junit.framework.TestCase;
 
 import org.jboss.soa.esb.helpers.KeyValuePair;
-import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
 import org.jboss.soa.esb.util.ClassUtils;
 import org.jboss.soa.esb.util.FileUtils;
 import org.jboss.soa.esb.util.JMSClientUtil;
@@ -49,8 +48,7 @@
 		copiedTo = FileUtils.createTestDir("copiedTo");
 		
 		// Start the listener...
-		listenersMgr = ListenerUtils.startListeners(TestEnvironmentUtil.getUserDir("qa") + 
-        		"junit/src" +ClassUtils.toResourcePath(getClass().getPackage()) + "/DirectoryPollerConfig1.xml");
+		listenersMgr = ListenerUtils.startListeners(ClassUtils.toResourcePath(getClass().getPackage()) + "/DirectoryPollerConfig1.xml");
 	}
 
 	public void test() throws InterruptedException {

Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/old/JmsQueueListenerTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/old/JmsQueueListenerTest.java	2006-11-16 15:16:24 UTC (rev 7643)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/listeners/old/JmsQueueListenerTest.java	2006-11-16 15:19:24 UTC (rev 7644)
@@ -45,8 +45,7 @@
         // Create the directories required by the test...
         notifyDir = FileUtils.createTestDir("notifyDir");
         // Start the listener...
-        listenersMgr = ListenerUtils.startListeners(TestEnvironmentUtil.getUserDir("qa") + 
-        		"junit/src" +ClassUtils.toResourcePath(getClass().getPackage()) + "/JmsQueueListenerConfig.xml");
+        listenersMgr = ListenerUtils.startListeners(ClassUtils.toResourcePath(getClass().getPackage()) + "/JmsQueueListenerConfig.xml");
     }
 
     public void test() throws InterruptedException {

Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/ListenerUtils.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/ListenerUtils.java	2006-11-16 15:16:24 UTC (rev 7643)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/util/ListenerUtils.java	2006-11-16 15:19:24 UTC (rev 7644)
@@ -33,6 +33,7 @@
 import org.jboss.soa.esb.listeners.old.GpListener;
 import org.jboss.soa.esb.parameters.ParamRepositoryException;
 import org.jboss.soa.esb.parameters.ParamRepositoryFactory;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
 
 /**
  * Listener utility methods.
@@ -79,7 +80,7 @@
 	 * @return The {@link GpListener} instance.
 	 */
 	public static GpListener createGpListener(String paramName) throws Exception {		
-		//fixUpConfig(paramName);
+		paramName = fixUpConfig(paramName);
 		GpListener.setDefaultCommandQueue(new JmsCommandQueue());
 		return new GpListener(paramName);
 	}
@@ -91,13 +92,21 @@
 	 * @return The file handle for the new "fixed up" config.
 	 */
 	@SuppressWarnings("unused") //I take it this will be used in the near future?
-	private static File fixUpConfig(String paramName) throws ParamRepositoryException, IOException {
+	private static String fixUpConfig(String paramName) throws ParamRepositoryException, IOException {
 		ParamFileRepository repos = (ParamFileRepository)ParamRepositoryFactory.getInstance();
+		File fixedupFile = null;
+		File paramFile = repos.toParamFile(paramName);
+		if ("qa/".equals(TestEnvironmentUtil.getUserDir("qa"))) {
+			paramName = System.getProperty("user.dir") + "/qa/junit/src" + paramName;
+			fixedupFile = new File(paramName + CONFIG_TMP_EXT);
+		} else {
+			fixedupFile = new File(paramFile.getAbsolutePath() + CONFIG_TMP_EXT);
+		}
 		String configXml = repos.get(paramName);
-		File paramFile = repos.toParamFile(paramName);
-		File fixedupFile = new File(paramFile.getAbsolutePath() + CONFIG_TMP_EXT);
+		System.out.println("Path=" + paramFile.getAbsolutePath());
+		System.out.println("Path=" + paramFile.getAbsolutePath());
 		FileOutputStream fixedUpFileStream = new FileOutputStream(fixedupFile);
-		
+		paramName+=CONFIG_TMP_EXT;
 		try {
 			// Replace all the "@qa.build@" tokens with the qa "build" dirs file URI, and write to file...
 			configXml = configXml.replaceAll("@qa.build@", FileUtils.getEnvBuildDir().toURI().toString());
@@ -114,7 +123,7 @@
 			fixedUpFileStream.close();
 		}		
 		
-		return fixedupFile;
+		return paramName;
 	}
 	
 




More information about the jboss-svn-commits mailing list