[jboss-svn-commits] JBL Code SVN: r12392 - in labs/jbossesb/workspace/dbevenius/product: core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies and 6 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jun 7 16:55:18 EDT 2007
Author: beve
Date: 2007-06-07 16:55:18 -0400 (Thu, 07 Jun 2007)
New Revision: 12392
Added:
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyUnitTest.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerUnitTest.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheUnitTest.java
Removed:
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyTest.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerTest.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTest.java
Modified:
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategy.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListener.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCache.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java
labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener_ReadOnlyStrategyUnitTest.java
labs/jbossesb/workspace/dbevenius/product/docs/ProgrammersGuide.odt
labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/ftpfile-cache-config.xml
labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-readonly-unfiltered.xml
labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/readme.txt
Log:
Added the ability to configure a deletion eviction policy
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java 2007-06-07 19:47:45 UTC (rev 12391)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener.java 2007-06-07 20:55:18 UTC (rev 12392)
@@ -31,6 +31,7 @@
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.listeners.ListenerTagNames;
import org.jboss.soa.esb.listeners.ListenerUtil;
+import org.jboss.soa.esb.listeners.gateway.remotestrategies.ReadOnlyRemoteFileSystemStrategy;
import org.jboss.soa.esb.listeners.gateway.remotestrategies.RemoteFileSystemStrategy;
import org.jboss.soa.esb.services.registry.RegistryException;
import org.jboss.soa.esb.util.ClassUtil;
@@ -52,6 +53,7 @@
*/
public static final String REMOTE_FILE_SYSTEM_STRATEGY_CLASS = "remoteFileSystemStrategy-class";
public static final String REMOTE_FILE_SYSTEM_STRATEGY_CONFIG_FILE = "remoteFileSystemStrategy-configFile";
+ public static final String REMOTE_FILE_SYSTEM_STRATEGY_CACHE_LISTENER = "remoteFileSystemStrategy-deleteOnEviction";
/**
* A strategy from handling call related to write operations
*/
@@ -113,6 +115,14 @@
try
{
remotefileSystemStrategy.init( configFile );
+
+ if ( remotefileSystemStrategy instanceof ReadOnlyRemoteFileSystemStrategy )
+ {
+ String deleteOnEvition = _config.getAttribute( REMOTE_FILE_SYSTEM_STRATEGY_CACHE_LISTENER, "false" );
+ _logger.debug( "deleteOnEviction : " + deleteOnEvition );
+ if ( Boolean.valueOf( deleteOnEvition ))
+ ((ReadOnlyRemoteFileSystemStrategy) remotefileSystemStrategy).setDeleteOnEviction();
+ }
}
catch( Exception e )
{
@@ -122,6 +132,7 @@
}
}
}
+
@Override
protected void seeIfOkToWorkOnDir(File p_oDir) throws GatewayException
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategy.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategy.java 2007-06-07 19:47:45 UTC (rev 12391)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategy.java 2007-06-07 20:55:18 UTC (rev 12392)
@@ -24,6 +24,7 @@
import java.io.File;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import org.apache.log4j.Logger;
import org.jboss.cache.CacheException;
@@ -34,7 +35,7 @@
* Read-only implementation of {@link RemoteFileSystemStrategy}.
*
* An instance of this class can be used when a remote file system does
- * not support write operations, only read.
+ * not support write operations.
*
* @author Daniel Bevenius
*
@@ -44,7 +45,7 @@
private Logger log = Logger .getLogger( ReadOnlyRemoteFileSystemStrategy.class );
private FtpFileCache ftpFileCache;
-
+
public void init( String configFile ) throws Exception
{
ftpFileCache = new FtpFileCache( configFile );
@@ -128,4 +129,14 @@
ftpFileCache.stop();
}
+ public void setDeleteOnEviction()
+ {
+ ftpFileCache.setDeleteOnEviction();
+ }
+
+ public Map getCacheListeners()
+ {
+ return ftpFileCache.getCacheListeners();
+ }
+
}
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListener.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListener.java 2007-06-07 19:47:45 UTC (rev 12391)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListener.java 2007-06-07 20:55:18 UTC (rev 12392)
@@ -78,5 +78,5 @@
public void nodeRemoved(Fqn arg0) {}
public void nodeVisited(Fqn arg0) {}
public void viewChange(View arg0) {}
-
+
}
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCache.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCache.java 2007-06-07 19:47:45 UTC (rev 12391)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCache.java 2007-06-07 20:55:18 UTC (rev 12392)
@@ -6,6 +6,7 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Map;
import org.apache.log4j.Logger;
import org.jboss.cache.CacheException;
@@ -203,6 +204,22 @@
treeCache.removeData( fqn );
}
+ public void setDeleteOnEviction()
+ {
+ treeCache.addTreeCacheListener( new DeleteOnEvictTreeCacheListener( treeCache) );
+ }
+
+ public void addCacheListener( TreeCacheListener listener )
+ {
+ if ( listener != null )
+ treeCache.addTreeCacheListener( listener );
+ }
+
+ public Map getCacheListeners()
+ {
+ return treeCache.getTreeCacheListeners();
+ }
+
private void close( Closeable c )
{
if ( c == null )
@@ -218,13 +235,5 @@
}
}
- public void addCacheListener( TreeCacheListener listener )
- {
- if ( listener == null )
- return;
-
- treeCache.addTreeCacheListener( listener );
- }
-
}
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java 2007-06-07 19:47:45 UTC (rev 12391)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListenerUnitTest.java 2007-06-07 20:55:18 UTC (rev 12392)
@@ -56,7 +56,6 @@
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
/**
@@ -235,37 +234,6 @@
}
/**
- * Test with the following configuration:
- * inputDir="/input"
- */
- @Test ( timeout=3000 )
- @Ignore
- public void doRun_PostDir_Not_Specified() throws ManagedLifecycleException, ConfigurationException, GatewayException, RegistryException, InterruptedException
- {
- setAbsoluteInputDir();
- setAbsolutePostDirToEmptyString();
- boolean getCourierReturnValue = true;
-
- RemoteGatewayListenerMock mock = createAndStartListener ( configTree, getCourierReturnValue );
-
- File processedDir = ftpServer.getLocalInputDir();
- String doneFileName = testFile.getName() + POST_SUFFIX;
-
- waitForFile( processedDir, doneFileName );
- stopdoRun( mock );
-
- File processedFile = new File ( processedDir, doneFileName );
- try
- {
- assertTrue ( processedFile.exists() );
- }
- finally
- {
- FtpTestUtil.deleteFile( processedFile );
- }
- }
-
- /**
* This test will assert that the work file is renamed into the error directory.
* Test with the following configuration:
* postDir="/input"
@@ -518,11 +486,6 @@
configTree.setAttribute( ListenerTagNames.FILE_POST_DIR_TAG, remoteInputDirName );
}
- private void setAbsolutePostDirToEmptyString()
- {
- configTree.setAttribute( ListenerTagNames.FILE_POST_DIR_TAG, "" );
- }
-
protected void setAbsolutePostDirToUploadDir()
{
configTree.setAttribute( ListenerTagNames.FILE_POST_DIR_TAG, remoteUploadDirName );
Modified: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener_ReadOnlyStrategyUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener_ReadOnlyStrategyUnitTest.java 2007-06-07 19:47:45 UTC (rev 12391)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/RemoteGatewayListener_ReadOnlyStrategyUnitTest.java 2007-06-07 20:55:18 UTC (rev 12392)
@@ -28,9 +28,11 @@
import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
import junit.framework.JUnit4TestAdapter;
+import org.apache.log4j.Logger;
import org.jboss.internal.soa.esb.util.embedded.EmbeddableException;
import org.jboss.internal.soa.esb.util.embedded.ftp.FtpTestUtil;
import org.jboss.internal.soa.esb.util.embedded.ftp.NoConfigFileFtpServer;
@@ -42,7 +44,6 @@
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
import org.jboss.soa.esb.services.registry.RegistryException;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
/**
@@ -55,6 +56,8 @@
*/
public class RemoteGatewayListener_ReadOnlyStrategyUnitTest extends RemoteGatewayListenerUnitTest
{
+ @SuppressWarnings("unused")
+ private Logger log = Logger .getLogger( RemoteGatewayListener_ReadOnlyStrategyUnitTest.class );
@BeforeClass
public static void classSetup() throws EmbeddableException, ConfigurationException, GatewayException, RegistryException, MalformedURLException
@@ -121,8 +124,12 @@
RemoteFileSystemStrategy remoteFileSystemStrategy = mock.getRemoteFileSystemStrategy();
assertTrue ( remoteFileSystemStrategy instanceof ReadOnlyRemoteFileSystemStrategy );
+
+ ReadOnlyRemoteFileSystemStrategy roStrategy = (ReadOnlyRemoteFileSystemStrategy) remoteFileSystemStrategy;
+ Map cacheListeners = roStrategy.getCacheListeners();
+ assertTrue ( cacheListeners.size() > 1 );
assertTrue ( "Should always return true", remoteFileSystemStrategy.deleteFile( null ));
- assertTrue ( "Should always return treu", remoteFileSystemStrategy.renameFile( null, null ));
+ assertTrue ( "Should always return true", remoteFileSystemStrategy.renameFile( null, null ));
}
/**
@@ -153,19 +160,19 @@
/**
* Not a valid test for this impl
*/
- @Ignore
+ @Override
public void renameFile_In_Different_Directory() throws GatewayException { }
/**
* Not a valid test for this impl
*/
- @Ignore
+ @Override
public void doRun_PostDir_Different_From_InputDir() throws ManagedLifecycleException, ConfigurationException, GatewayException, RegistryException, InterruptedException { }
/**
* Not a valid test for this impl
*/
- @Ignore
+ @Override
public void doRun_Negative() throws ManagedLifecycleException, ConfigurationException, GatewayException, RegistryException, InterruptedException {}
/**
@@ -178,6 +185,7 @@
ConfigTree configTree = RemoteGatewayListenerUnitTest.createConfigTree();
configTree.setAttribute( RemoteGatewayListener.REMOTE_FILE_SYSTEM_STRATEGY_CLASS, ReadOnlyRemoteFileSystemStrategy.class.getName() );
configTree.setAttribute( RemoteGatewayListener.REMOTE_FILE_SYSTEM_STRATEGY_CONFIG_FILE, FtpFileCacheTestUtil.getCacheConfigFile() );
+ configTree.setAttribute( RemoteGatewayListener.REMOTE_FILE_SYSTEM_STRATEGY_CACHE_LISTENER, String.valueOf( true ) );
return configTree;
}
Deleted: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyTest.java 2007-06-07 19:47:45 UTC (rev 12391)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyTest.java 2007-06-07 20:55:18 UTC (rev 12392)
@@ -1,136 +0,0 @@
-package org.jboss.soa.esb.listeners.gateway.remotestrategies;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-
-import org.apache.log4j.Logger;
-import org.jboss.cache.CacheException;
-import org.jboss.soa.esb.listeners.gateway.GatewayException;
-import org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.FtpFileCacheTestUtil;
-import org.jboss.soa.esb.testutils.HsqldbUtil;
-import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- *
- * @author Daniel Bevenius
- *
- */
-public class ReadOnlyRemoteFileSystemStrategyTest
-{
- private static Logger log = Logger .getLogger( ReadOnlyRemoteFileSystemStrategyTest.class );
-
- private static ReadOnlyRemoteFileSystemStrategy strategy;
-
- private static ReadOnlyRemoteFileSystemStrategy strategy2;
-
- private String testFile1 = "testFile1";
- private String testFile2 = "testFile2";
- private String testFile3 = "testFile3";
-
- private File[] expectedFileList = new File[] { new File( testFile1 ) , new File( testFile2 ) };
- private File[] newFileList = new File[] { new File( testFile3 ) };
- private File[] emptyFileList = new File[] {};
-
- @Test
- public void listFilesNegative()
- {
- try
- {
- strategy.filterFileList( null );
- }
- catch (GatewayException e)
- {
- fail("Should be ok to pass null as the file array!");
- }
- }
-
- @Test
- public void listFiles() throws GatewayException
- {
- File[] filteredFileList = strategy.filterFileList( expectedFileList );
- assertEquals( expectedFileList, filteredFileList );
-
- filteredFileList = strategy.filterFileList( expectedFileList );
- assertEquals( "No files should have been returned. They should have been cached.", emptyFileList, filteredFileList );
-
- filteredFileList = strategy.filterFileList( newFileList );
- assertEquals( newFileList, filteredFileList );
- assertTrue ( filteredFileList instanceof File[] );
- }
-
- @Test
- public void listFiles_With_Two_Strategy_Instances() throws Exception
- {
-
- try
- {
- File[] filteredFileList = strategy2.filterFileList( expectedFileList );
- assertEquals( expectedFileList, filteredFileList );
-
- filteredFileList = strategy.filterFileList( expectedFileList );
- assertEquals( emptyFileList, filteredFileList );
-
- filteredFileList = strategy2.filterFileList( newFileList );
- assertEquals( newFileList, filteredFileList );
-
- filteredFileList = strategy.filterFileList( newFileList );
- assertEquals( emptyFileList, filteredFileList );
-
- }
- catch ( Exception e )
- {
- log.error(e);
- }
- finally
- {
- strategy2.stop();
- }
-
- }
-
- @Before
- public void setup() throws CacheException
- {
- strategy.removeAllData();
- }
-
- @BeforeClass
- public static void classSetup() throws Exception
- {
- registerHsqlDriver();
- HsqldbUtil.startHsqldb(TestEnvironmentUtil.getUserDir() + "build" + File.separator + "hsqltestdb", "ftpcache");
-
- strategy = new ReadOnlyRemoteFileSystemStrategy();
- strategy.init( FtpFileCacheTestUtil.getCacheConfigFile() );
-
- strategy2 = new ReadOnlyRemoteFileSystemStrategy();
- strategy2.init( FtpFileCacheTestUtil.getCacheConfigFile() );
- }
-
- private static void registerHsqlDriver()
- {
- try
- {
- Class.forName( "org.hsqldb.jdbcDriver" );
- }
- catch (Exception e)
- {
- fail( "ERROR: failed to load JDBC driver." + e.getMessage() );
- }
- }
-
- @AfterClass
- public static void classTearDown()
- {
- strategy.stop();
- strategy2.stop();
- }
-
-}
Added: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/ReadOnlyRemoteFileSystemStrategyUnitTest.java 2007-06-07 20:55:18 UTC (rev 12392)
@@ -0,0 +1,136 @@
+package org.jboss.soa.esb.listeners.gateway.remotestrategies;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+
+import org.apache.log4j.Logger;
+import org.jboss.cache.CacheException;
+import org.jboss.soa.esb.listeners.gateway.GatewayException;
+import org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.FtpFileCacheTestUtil;
+import org.jboss.soa.esb.testutils.HsqldbUtil;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ * @author Daniel Bevenius
+ *
+ */
+public class ReadOnlyRemoteFileSystemStrategyUnitTest
+{
+ private static Logger log = Logger .getLogger( ReadOnlyRemoteFileSystemStrategyUnitTest.class );
+
+ private static ReadOnlyRemoteFileSystemStrategy strategy;
+
+ private static ReadOnlyRemoteFileSystemStrategy strategy2;
+
+ private String testFile1 = "testFile1";
+ private String testFile2 = "testFile2";
+ private String testFile3 = "testFile3";
+
+ private File[] expectedFileList = new File[] { new File( testFile1 ) , new File( testFile2 ) };
+ private File[] newFileList = new File[] { new File( testFile3 ) };
+ private File[] emptyFileList = new File[] {};
+
+ @Test
+ public void listFilesNegative()
+ {
+ try
+ {
+ strategy.filterFileList( null );
+ }
+ catch (GatewayException e)
+ {
+ fail("Should be ok to pass null as the file array!");
+ }
+ }
+
+ @Test
+ public void listFiles() throws GatewayException
+ {
+ File[] filteredFileList = strategy.filterFileList( expectedFileList );
+ assertEquals( expectedFileList, filteredFileList );
+
+ filteredFileList = strategy.filterFileList( expectedFileList );
+ assertEquals( "No files should have been returned. They should have been cached.", emptyFileList, filteredFileList );
+
+ filteredFileList = strategy.filterFileList( newFileList );
+ assertEquals( newFileList, filteredFileList );
+ assertTrue ( filteredFileList instanceof File[] );
+ }
+
+ @Test
+ public void listFiles_With_Two_Strategy_Instances() throws Exception
+ {
+
+ try
+ {
+ File[] filteredFileList = strategy2.filterFileList( expectedFileList );
+ assertEquals( expectedFileList, filteredFileList );
+
+ filteredFileList = strategy.filterFileList( expectedFileList );
+ assertEquals( emptyFileList, filteredFileList );
+
+ filteredFileList = strategy2.filterFileList( newFileList );
+ assertEquals( newFileList, filteredFileList );
+
+ filteredFileList = strategy.filterFileList( newFileList );
+ assertEquals( emptyFileList, filteredFileList );
+
+ }
+ catch ( Exception e )
+ {
+ log.error(e);
+ }
+ finally
+ {
+ strategy2.stop();
+ }
+
+ }
+
+ @Before
+ public void setup() throws CacheException
+ {
+ strategy.removeAllData();
+ }
+
+ @BeforeClass
+ public static void classSetup() throws Exception
+ {
+ registerHsqlDriver();
+ HsqldbUtil.startHsqldb(TestEnvironmentUtil.getUserDir() + "build" + File.separator + "hsqltestdb", "ftpcache");
+
+ strategy = new ReadOnlyRemoteFileSystemStrategy();
+ strategy.init( FtpFileCacheTestUtil.getCacheConfigFile() );
+
+ strategy2 = new ReadOnlyRemoteFileSystemStrategy();
+ strategy2.init( FtpFileCacheTestUtil.getCacheConfigFile() );
+ }
+
+ private static void registerHsqlDriver()
+ {
+ try
+ {
+ Class.forName( "org.hsqldb.jdbcDriver" );
+ }
+ catch (Exception e)
+ {
+ fail( "ERROR: failed to load JDBC driver." + e.getMessage() );
+ }
+ }
+
+ @AfterClass
+ public static void classTearDown()
+ {
+ strategy.stop();
+ strategy2.stop();
+ }
+
+}
Deleted: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerTest.java 2007-06-07 19:47:45 UTC (rev 12391)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerTest.java 2007-06-07 20:55:18 UTC (rev 12392)
@@ -1,156 +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.listeners.gateway.remotestrategies.cache;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.TreeCache;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.NodeList;
-
-/**
- *
- * @author Daniel Bevenius
- *
- */
-public class DeleteOnEvictTreeCacheListenerTest
-{
- @SuppressWarnings("unused")
- private Logger log = Logger .getLogger( DeleteOnEvictTreeCacheListenerTest.class );
-
- private static DeleteOnEvictTreeCacheListener listener;
- private static TreeCache treeCache;
-
- private static final String FQN = "test/junit";
- private String key = "testKey";
- private String value = "testValue";
- private Fqn fqnTest = new Fqn ( new String[] { FQN, key, value} );
-
- @Test( expected=IllegalArgumentException.class )
- public void constructor()
- {
- new DeleteOnEvictTreeCacheListener( null );
- }
-
- @Test
- public void nodeEvict() throws CacheException
- {
- treeCache.put( FQN, key, value );
- Node node = treeCache.get( fqnTest );
- assertTrue( "The value should have been added!", treeCache.exists( FQN, key ) );
-
- listener.nodeEvicted( fqnTest );
- node = treeCache.get( fqnTest );
- assertFalse( "The value should have been removed upon eviction!", treeCache.exists( fqnTest ) );
-
- node = treeCache.get( fqnTest );
- assertNull ( "The node should have been removed from the cache store", node );
- }
-
- @Test
- public void testCacheRestart() throws Exception
- {
- treeCache.put( FQN, key, value );
- Object valueBeforeCacheShutdown = treeCache.get( FQN, key );
- treeCache.stop();
- treeCache.start();
- Object valueAfterCacheShutdown = treeCache.get( FQN, key );
- assertEquals( "Objects should be equal even after a treeCache restart", valueBeforeCacheShutdown, valueAfterCacheShutdown );
- }
-
- @BeforeClass
- public static void classSetup() throws Exception
- {
- FtpFileCacheTestUtil.startDB();
- startCache();
- }
-
- private static void startCache() throws Exception
- {
- treeCache = new TreeCache();
- listener = new DeleteOnEvictTreeCacheListener( treeCache );
- treeCache.addTreeCacheListener( listener );
- FtpFileCacheTestUtil.createTreeCache( treeCache, FtpFileCacheTestUtil.getCacheConfigFile() );
- treeCache.start();
- }
-
- private static void stopCache()
- {
- treeCache.stop();
- }
-
- @AfterClass
- public static void classTearDown() throws Exception
- {
- FtpFileCacheTestUtil.stopDB();
- stopCache();
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter( FtpFileCacheTest.class );
- }
-
- @SuppressWarnings("unused")
- private int getMaxAgeSeconds()
- {
- int maxAgeSeconds = 0;
- NodeList elementsByTagName = treeCache.getEvictionPolicyConfig().getElementsByTagName( "region" );
- for ( int i = elementsByTagName.getLength() ; i-->0 ; )
- {
- org.w3c.dom.Node region = elementsByTagName.item( i );
- NamedNodeMap attributes = region.getAttributes();
- org.w3c.dom.Node fqnNameNode = attributes.getNamedItem( "name" );
- if ( fqnNameNode.getNodeValue().equals( "/ftp/cache" ))
- {
- NodeList childNodes = region.getChildNodes();
- for ( int y = 0 ; y < childNodes.getLength() ; y ++ )
- {
- org.w3c.dom.Node node = childNodes.item( y );
- if ( node.getNodeName().equals( "attribute" ))
- {
- NamedNodeMap attributes2 = node.getAttributes();
- org.w3c.dom.Node namedItem = attributes2.getNamedItem( "name" );
- if ( namedItem.getNodeValue().equals("maxAgeSeconds") )
- {
- maxAgeSeconds = Integer.valueOf( node.getTextContent() );
- break;
- }
- }
- }
- }
- }
- return maxAgeSeconds;
- }
-
-}
Added: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/DeleteOnEvictTreeCacheListenerUnitTest.java 2007-06-07 20:55:18 UTC (rev 12392)
@@ -0,0 +1,156 @@
+/*
+ * 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.listeners.gateway.remotestrategies.cache;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.jboss.cache.CacheException;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
+import org.jboss.cache.TreeCache;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.NodeList;
+
+/**
+ *
+ * @author Daniel Bevenius
+ *
+ */
+public class DeleteOnEvictTreeCacheListenerUnitTest
+{
+ @SuppressWarnings("unused")
+ private Logger log = Logger .getLogger( DeleteOnEvictTreeCacheListenerUnitTest.class );
+
+ private static DeleteOnEvictTreeCacheListener listener;
+ private static TreeCache treeCache;
+
+ private static final String FQN = "test/junit";
+ private String key = "testKey";
+ private String value = "testValue";
+ private Fqn fqnTest = new Fqn ( new String[] { FQN, key, value} );
+
+ @Test( expected=IllegalArgumentException.class )
+ public void constructor()
+ {
+ new DeleteOnEvictTreeCacheListener( null );
+ }
+
+ @Test
+ public void nodeEvict() throws CacheException
+ {
+ treeCache.put( FQN, key, value );
+ Node node = treeCache.get( fqnTest );
+ assertTrue( "The value should have been added!", treeCache.exists( FQN, key ) );
+
+ listener.nodeEvicted( fqnTest );
+ node = treeCache.get( fqnTest );
+ assertFalse( "The value should have been removed upon eviction!", treeCache.exists( fqnTest ) );
+
+ node = treeCache.get( fqnTest );
+ assertNull ( "The node should have been removed from the cache store", node );
+ }
+
+ @Test
+ public void testCacheRestart() throws Exception
+ {
+ treeCache.put( FQN, key, value );
+ Object valueBeforeCacheShutdown = treeCache.get( FQN, key );
+ treeCache.stop();
+ treeCache.start();
+ Object valueAfterCacheShutdown = treeCache.get( FQN, key );
+ assertEquals( "Objects should be equal even after a treeCache restart", valueBeforeCacheShutdown, valueAfterCacheShutdown );
+ }
+
+ @BeforeClass
+ public static void classSetup() throws Exception
+ {
+ FtpFileCacheTestUtil.startDB();
+ startCache();
+ }
+
+ private static void startCache() throws Exception
+ {
+ treeCache = new TreeCache();
+ listener = new DeleteOnEvictTreeCacheListener( treeCache );
+ treeCache.addTreeCacheListener( listener );
+ FtpFileCacheTestUtil.createTreeCache( treeCache, FtpFileCacheTestUtil.getCacheConfigFile() );
+ treeCache.start();
+ }
+
+ private static void stopCache()
+ {
+ treeCache.stop();
+ }
+
+ @AfterClass
+ public static void classTearDown() throws Exception
+ {
+ FtpFileCacheTestUtil.stopDB();
+ stopCache();
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter( FtpFileCacheUnitTest.class );
+ }
+
+ @SuppressWarnings("unused")
+ private int getMaxAgeSeconds()
+ {
+ int maxAgeSeconds = 0;
+ NodeList elementsByTagName = treeCache.getEvictionPolicyConfig().getElementsByTagName( "region" );
+ for ( int i = elementsByTagName.getLength() ; i-->0 ; )
+ {
+ org.w3c.dom.Node region = elementsByTagName.item( i );
+ NamedNodeMap attributes = region.getAttributes();
+ org.w3c.dom.Node fqnNameNode = attributes.getNamedItem( "name" );
+ if ( fqnNameNode.getNodeValue().equals( "/ftp/cache" ))
+ {
+ NodeList childNodes = region.getChildNodes();
+ for ( int y = 0 ; y < childNodes.getLength() ; y ++ )
+ {
+ org.w3c.dom.Node node = childNodes.item( y );
+ if ( node.getNodeName().equals( "attribute" ))
+ {
+ NamedNodeMap attributes2 = node.getAttributes();
+ org.w3c.dom.Node namedItem = attributes2.getNamedItem( "name" );
+ if ( namedItem.getNodeValue().equals("maxAgeSeconds") )
+ {
+ maxAgeSeconds = Integer.valueOf( node.getTextContent() );
+ break;
+ }
+ }
+ }
+ }
+ }
+ return maxAgeSeconds;
+ }
+
+}
Deleted: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTest.java 2007-06-07 19:47:45 UTC (rev 12391)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheTest.java 2007-06-07 20:55:18 UTC (rev 12392)
@@ -1,136 +0,0 @@
-package org.jboss.soa.esb.listeners.gateway.remotestrategies.cache;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.io.InputStream;
-
-import junit.framework.JUnit4TestAdapter;
-
-import org.apache.log4j.Logger;
-import org.jboss.cache.CacheException;
-import org.jboss.soa.esb.testutils.HsqldbUtil;
-import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * Test class FtpFileCache
- *
- * @author Daniel Bevenius
- *
- */
-public class FtpFileCacheTest
-{
- private static Logger log = Logger.getLogger(FtpFileCacheTest.class);
-
- private static FtpFileCache ftpfileCache;
-
- @Test
- public void getConfigInputStream_From_Classpath() throws Exception
- {
- String configPath_CP = "/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml";
- InputStream configInputStream = ftpfileCache.getConfigInputStream( configPath_CP );
- assertNotNull( "InputStream was null", configInputStream );
- }
-
- @Test
- public void getPutAndRemove()
- {
- String fileName = "testfile1";
- try
- {
- ftpfileCache.putFileName( fileName );
-
- Object obj = ftpfileCache.getFileName( fileName );
- assertTrue( obj instanceof String );
-
- String actualFileName = (String) obj;
- assertEquals( fileName, actualFileName );
- }
- catch (CacheException e)
- {
- fail ( e.getMessage() );
- }
- finally
- {
- try { ftpfileCache.deleteFile( fileName ); } catch (CacheException e) { log.error( e.getMessage() ); }
- }
- }
-
- @Test
- public void addCacheListenerNegative()
- {
- try
- {
- ftpfileCache.addCacheListener( null );
- }
- catch ( Exception e )
- {
- fail("Should be ok to pass a null listener! Exception was : "+ e.getMessage() );
- }
- }
-
- @Test
- public void fileExists() throws CacheException
- {
- String fileName = "testfile1";
-
- ftpfileCache.putFileName( fileName );
-
- boolean fileExistsInCache = ftpfileCache.containsFile( fileName );
- assertTrue ( fileExistsInCache );
- }
-
- @Test
- public void removeAll() throws CacheException
- {
- String fileName = "testfile3";
- ftpfileCache.putFileName( fileName );
- ftpfileCache.removeAll();
- assertNull ( ftpfileCache.getFileName( fileName ));
-
- }
-
- @BeforeClass
- public static void classSetup() throws Exception
- {
-
- registerHsqlDriver();
- HsqldbUtil.startHsqldb(TestEnvironmentUtil.getUserDir() + "build" + File.separator + "hsqltestdb", "ftpcache");
-
- ftpfileCache = new FtpFileCache ( FtpFileCacheTestUtil.getCacheConfigFile() );
- ftpfileCache.start();
- }
-
- private static void registerHsqlDriver()
- {
- try
- {
- Class.forName( "org.hsqldb.jdbcDriver" );
- }
- catch (Exception e)
- {
- fail( "ERROR: failed to load JDBC driver." + e.getMessage() );
- }
- }
-
- @AfterClass
- public static void classTearDown() throws Exception
- {
- ftpfileCache.stop();
- HsqldbUtil.stopHsqldb( "jdbc:hsqldb:hsql://localhost:9001/ftpcache", "sa", "" );
- }
-
- public static junit.framework.Test suite()
- {
- return new JUnit4TestAdapter( FtpFileCacheTest.class );
- }
-
-}
Added: labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheUnitTest.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheUnitTest.java (rev 0)
+++ labs/jbossesb/workspace/dbevenius/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/FtpFileCacheUnitTest.java 2007-06-07 20:55:18 UTC (rev 12392)
@@ -0,0 +1,120 @@
+package org.jboss.soa.esb.listeners.gateway.remotestrategies.cache;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.InputStream;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.jboss.cache.CacheException;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Test class FtpFileCache
+ *
+ * @author Daniel Bevenius
+ *
+ */
+public class FtpFileCacheUnitTest
+{
+ private static Logger log = Logger.getLogger(FtpFileCacheUnitTest.class);
+
+ private static FtpFileCache ftpfileCache;
+
+ @Test
+ public void getConfigInputStream_From_Classpath() throws Exception
+ {
+ String configPath_CP = "/org/jboss/soa/esb/listeners/gateway/remotestrategies/cache/ftpfile_cache_test.xml";
+ InputStream configInputStream = ftpfileCache.getConfigInputStream( configPath_CP );
+ assertNotNull( "InputStream was null", configInputStream );
+ }
+
+ @Test
+ public void getPutAndRemove()
+ {
+ String fileName = "testfile1";
+ try
+ {
+ ftpfileCache.putFileName( fileName );
+
+ Object obj = ftpfileCache.getFileName( fileName );
+ assertTrue( obj instanceof String );
+
+ String actualFileName = (String) obj;
+ assertEquals( fileName, actualFileName );
+ }
+ catch (CacheException e)
+ {
+ fail ( e.getMessage() );
+ }
+ finally
+ {
+ try { ftpfileCache.deleteFile( fileName ); } catch (CacheException e) { log.error( e.getMessage() ); }
+ }
+ }
+
+ @Test
+ public void addCacheListenerNegative()
+ {
+ try
+ {
+ ftpfileCache.addCacheListener( null );
+ }
+ catch ( Exception e )
+ {
+ fail("Should be ok to pass a null listener! Exception was : "+ e.getMessage() );
+ }
+ }
+
+ @Test
+ public void fileExists() throws CacheException
+ {
+ String fileName = "testfile1";
+
+ ftpfileCache.putFileName( fileName );
+
+ boolean fileExistsInCache = ftpfileCache.containsFile( fileName );
+ assertTrue ( fileExistsInCache );
+ }
+
+ @Test
+ public void removeAll() throws CacheException
+ {
+ String fileName = "testfile3";
+ ftpfileCache.putFileName( fileName );
+ ftpfileCache.removeAll();
+ assertNull ( ftpfileCache.getFileName( fileName ));
+
+ }
+
+ @BeforeClass
+ public static void classSetup() throws Exception
+ {
+ FtpFileCacheTestUtil.startDB();
+
+ ftpfileCache = new FtpFileCache ( FtpFileCacheTestUtil.getCacheConfigFile() );
+ ftpfileCache.start();
+ }
+
+
+ @AfterClass
+ public static void classTearDown() throws Exception
+ {
+ ftpfileCache.stop();
+ FtpFileCacheTestUtil.stopDB();
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter( FtpFileCacheUnitTest.class );
+ }
+
+}
Modified: labs/jbossesb/workspace/dbevenius/product/docs/ProgrammersGuide.odt
===================================================================
(Binary files differ)
Modified: labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/ftpfile-cache-config.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/ftpfile-cache-config.xml 2007-06-07 19:47:45 UTC (rev 12391)
+++ labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/ftpfile-cache-config.xml 2007-06-07 20:55:18 UTC (rev 12392)
@@ -81,7 +81,7 @@
<attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
<attribute name="EvictionPolicyConfig">
<config>
- <attribute name="wakeUpIntervalSeconds">30</attribute>
+ <attribute name="wakeUpIntervalSeconds">5</attribute>
<!-- Cache wide default -->
<region name="/_default_">
<attribute name="maxNodes">5000</attribute>
@@ -89,8 +89,8 @@
</region>
<region name="/ftp/cache">
<attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLiveSeconds">1000</attribute>
- <attribute name="maxAgeSeconds">86400</attribute>
+ <attribute name="timeToLiveSeconds">20</attribute>
+ <attribute name="maxAgeSeconds">20</attribute>
</region>
</config>
</attribute>
Modified: labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-readonly-unfiltered.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-readonly-unfiltered.xml 2007-06-07 19:47:45 UTC (rev 12391)
+++ labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/jboss-esb-readonly-unfiltered.xml 2007-06-07 20:55:18 UTC (rev 12392)
@@ -46,12 +46,10 @@
<ftp-listener name="FtpGateway"
busidref="helloFTPChannel"
maxThreads="1"
- is-gateway="true"
- >
+ is-gateway="true">
<property name="pollLatencySeconds" value="5"/>
- <!-- Example of how one can specify a different configuration file for jboss cache
- <property name="remoteFileSystemStrategy-configFile" value="ftpfile_cache_test_config.xml"/>
- -->
+ <property name="remoteFileSystemStrategy-configFile" value="./ftpfile-cache-config.xml"/>
+ <property name="remoteFileSystemStrategy-deleteOnEviction" value="true"/>
</ftp-listener>
<jms-listener name="helloWorldFileAction"
busidref="quickstartEsbChannel"
Modified: labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/readme.txt
===================================================================
--- labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/readme.txt 2007-06-07 19:47:45 UTC (rev 12391)
+++ labs/jbossesb/workspace/dbevenius/product/samples/quickstarts/helloworld_ftp_action/readme.txt 2007-06-07 20:55:18 UTC (rev 12392)
@@ -25,6 +25,29 @@
3. Switch back to "Window1" to see the output from the ESB. You should see the file contents
displayed in the listener window
+To Run standalone mode readonly configuration:
+==============================================
+ 1. In a command terminal window in this folder ("Window1"), type 'ant run-readonly'.
+ 1. In another command terminal window in this folder ("Window2"), type 'ant run-readonly'.
+ 2. Open another command terminal window in this folder ("Window3"), type 'ant runtest'.
+ 3. You should see the file contents displayed in the one of the listener windows
+ Log onto the ftpserver and see that the file has not been renamed.
+ 4. Examine the jboss-esb-readonly-unfiltered.xml file and specifically this ftp-listener
+ section:
+ <property name="remoteFileSystemStrategy-configFile" value="./ftpfile-cache-config.xml"/>
+ <property name="remoteFileSystemStrategy-deleteOnEviction" value="true"/>
+ Setting the deleteOnEviction to true will cause the file name to be deleted from the
+ cacheloader. You can set the eviction time in ftpfile-cache-config.xml:
+ <region name="/ftp/cache">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">20</attribute>
+ <attribute name="maxAgeSeconds">20</attribute>
+ </region>
+ This will cause the filename to be deleted every 20 seconds. Such as short period is only
+ for testing and a more realistic interval could perhaps be every day or so.
+
+
+
What to consider in this Quickstart:
===================================
1) The FTP configuration has been initialised in ../conf/quickstarts.properties
@@ -36,3 +59,8 @@
following:
[java] 20:41:36,625 ERROR [Thread-5][AbstractFileGateway] Problems renaming
file new_file.dat to new_file.dat.esbWorking
+
+3) Running the read-only version: note that the cacheloader used is hypersonic and
+it is an inmemory database. This means that if you close all the ESBs running('ant run-readonly' windows
+all files will be retrieved once more. This would not be the case with a persistent database.
+
More information about the jboss-svn-commits
mailing list