Hi Claus, This patch doesn't fix the unit test errors in windows. After a quick review of the code , I think you need to do some change on the GenericFile to use "File.separator" instead of "/".
Willem davscl...@apache.org wrote: > Author: davsclaus > Date: Thu Jan 29 15:03:12 2009 > New Revision: 738878 > > URL: http://svn.apache.org/viewvc?rev=738878&view=rev > Log: > Trying to fix failed unit test reported by team city. > > Modified: > camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java > > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSortByExpressionTest.java > > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSortByIgnoreCaseExpressionTest.java > > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSortByNestedExpressionTest.java > > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSorterRefTest.java > > camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java > > camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationWithConnectorTest.java > > Modified: > camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java > URL: > http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java?rev=738878&r1=738877&r2=738878&view=diff > ============================================================================== > --- camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java > (original) > +++ camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java > Thu Jan 29 15:03:12 2009 > @@ -30,6 +30,7 @@ > import org.apache.camel.util.ExchangeHelper; > import org.apache.commons.logging.Log; > import org.apache.commons.logging.LogFactory; > +import org.springframework.util.StringUtils; > > /** > * A bunch of useful testing methods > @@ -361,4 +362,28 @@ > File dir = new File(file); > dir.mkdirs(); > } > + > + /** > + * To be used for folder/directory comparision that works across > different platforms such > + * as Window, Mac and Linux. > + */ > + public static void assertDirectoryEquals(String expected, String actual) > throws Exception { > + assertDirectoryEquals(null, expected, actual); > + } > + > + /** > + * To be used for folder/directory comparision that works across > different platforms such > + * as Window, Mac and Linux. > + */ > + public static void assertDirectoryEquals(String message, String > expected, String actual) throws Exception { > + // must use single / as path seperators > + String expectedPath = StringUtils.replace(expected, File.separator, > "/"); > + String acutalPath = StringUtils.replace(actual, File.separator, "/"); > + > + if (message != null) { > + assertEquals(message, expectedPath, acutalPath); > + } else { > + assertEquals(expectedPath, acutalPath); > + } > + } > } > > Modified: > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSortByExpressionTest.java > URL: > http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSortByExpressionTest.java?rev=738878&r1=738877&r2=738878&view=diff > ============================================================================== > --- > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSortByExpressionTest.java > (original) > +++ > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSortByExpressionTest.java > Thu Jan 29 15:03:12 2009 > @@ -63,9 +63,9 @@ > protected RouteBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > public void configure() throws Exception { > - from(fileUrl + "a/?sortBy=file:name.ext").to("mock:result"); > + from(fileUrl + > "a/?sortBy=file:name.ext&initialDelay=1000").to("mock:result"); > > - from(fileUrl + > "b/?sortBy=reverse:file:name.ext").to("mock:reverse"); > + from(fileUrl + > "b/?sortBy=reverse:file:name.ext&initialDelay=1000").to("mock:reverse"); > } > }; > } > > Modified: > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSortByIgnoreCaseExpressionTest.java > URL: > http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSortByIgnoreCaseExpressionTest.java?rev=738878&r1=738877&r2=738878&view=diff > ============================================================================== > --- > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSortByIgnoreCaseExpressionTest.java > (original) > +++ > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSortByIgnoreCaseExpressionTest.java > Thu Jan 29 15:03:12 2009 > @@ -71,11 +71,11 @@ > protected RouteBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > public void configure() throws Exception { > - from(fileUrl + "a/?sortBy=file:name").to("mock:result"); > + from(fileUrl + > "a/?sortBy=file:name&initialDelay=250&delay=1000").to("mock:result"); > > - from(fileUrl + > "b/?sortBy=ignoreCase:file:name").to("mock:nocase"); > + from(fileUrl + > "b/?sortBy=ignoreCase:file:name&initialDelay=500&delay=1000").to("mock:nocase"); > > - from(fileUrl + > "c/?sortBy=reverse:ignoreCase:file:name").to("mock:nocasereverse"); > + from(fileUrl + > "c/?sortBy=reverse:ignoreCase:file:name&initialDelay=750&delay=1000").to("mock:nocasereverse"); > } > }; > } > > Modified: > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSortByNestedExpressionTest.java > URL: > http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSortByNestedExpressionTest.java?rev=738878&r1=738877&r2=738878&view=diff > ============================================================================== > --- > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSortByNestedExpressionTest.java > (original) > +++ > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSortByNestedExpressionTest.java > Thu Jan 29 15:03:12 2009 > @@ -66,9 +66,9 @@ > protected RouteBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > public void configure() throws Exception { > - from(fileUrl + > "a/?sortBy=file:name.ext;file:name").to("mock:result"); > + from(fileUrl + > "a/?sortBy=file:name.ext;file:name&initialDelay=1000&delay=500").to("mock:result"); > > - from(fileUrl + > "b/?sortBy=file:name.ext;reverse:file:name").to("mock:reverse"); > + from(fileUrl + > "b/?sortBy=file:name.ext;reverse:file:name&initialDelay=1000&delay=1000").to("mock:reverse"); > } > }; > } > > Modified: > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSorterRefTest.java > URL: > http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSorterRefTest.java?rev=738878&r1=738877&r2=738878&view=diff > ============================================================================== > --- > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSorterRefTest.java > (original) > +++ > camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileSorterRefTest.java > Thu Jan 29 15:03:12 2009 > @@ -28,7 +28,7 @@ > */ > public class FileSorterRefTest extends ContextTestSupport { > > - private String fileUrl = "newfile://target/filesorter/?sorter=#mySorter"; > + private String fileUrl = > "newfile://target/filesorter/?sorter=#mySorter&initialDelay=1000"; > > @Override > protected JndiRegistry createRegistry() throws Exception { > > Modified: > camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java > URL: > http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java?rev=738878&r1=738877&r2=738878&view=diff > ============================================================================== > --- > camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java > (original) > +++ > camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java > Thu Jan 29 15:03:12 2009 > @@ -51,26 +51,20 @@ > > resolveMandatoryEndpoint("mock:end", MockEndpoint.class); > > - Set s = mbsc.queryNames( > - new ObjectName(domainName + ":type=endpoints,*"), null); > + Set s = mbsc.queryNames(new ObjectName(domainName + > ":type=endpoints,*"), null); > assertEquals("Could not find 2 endpoints: " + s, 2, s.size()); > > - s = mbsc.queryNames( > - new ObjectName(domainName + ":name=context,*"), null); > + s = mbsc.queryNames(new ObjectName(domainName + ":name=context,*"), > null); > assertEquals("Could not find 1 context: " + s, 1, s.size()); > > - s = mbsc.queryNames( > - new ObjectName(domainName + ":type=processors,*"), null); > + s = mbsc.queryNames(new ObjectName(domainName + > ":type=processors,*"), null); > assertEquals("Could not find 1 processor: " + s, 1, s.size()); > > - s = mbsc.queryNames( > - new ObjectName(domainName + ":type=routes,*"), null); > + s = mbsc.queryNames(new ObjectName(domainName + ":type=routes,*"), > null); > assertEquals("Could not find 1 route: " + s, 1, s.size()); > - > } > > public void testCounters() throws Exception { > - > MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:end", > MockEndpoint.class); > resultEndpoint.expectedBodiesReceived("<hello>world!</hello>"); > sendBody("direct:start", "<hello>world!</hello>"); > @@ -79,7 +73,6 @@ > > verifyCounter(mbsc, new ObjectName(domainName + ":type=routes,*")); > verifyCounter(mbsc, new ObjectName(domainName + > ":type=processors,*")); > - > } > > protected void verifyCounter(MBeanServerConnection beanServer, > ObjectName name) throws Exception { > @@ -93,17 +86,17 @@ > assertNotNull("Expected attribute found. MBean registered under a " > + "'<domain>:name=Stats,*' key must be of type > PerformanceCounter.class", > valueofNumExchanges); > - assertTrue(valueofNumExchanges == 1); > + assertEquals(Long.valueOf(1), valueofNumExchanges); > Long valueofNumCompleted = (Long)beanServer.getAttribute(pcob, > "NumCompleted"); > assertNotNull("Expected attribute found. MBean registered under a " > + "'<domain>:name=Stats,*' key must be of type > PerformanceCounter.class", > valueofNumCompleted); > - assertTrue(valueofNumCompleted == 1); > + assertEquals(Long.valueOf(1), valueofNumCompleted); > Long valueofNumFailed = (Long)beanServer.getAttribute(pcob, > "NumFailed"); > assertNotNull("Expected attribute found. MBean registered under a " > + "'<domain>:name=Stats,*' key must be of type > PerformanceCounter.class", > valueofNumFailed); > - assertTrue(valueofNumFailed == 0); > + assertEquals(Long.valueOf(0), valueofNumFailed); > Double valueofMinProcessingTime = > (Double)beanServer.getAttribute(pcob, "MinProcessingTimeMillis"); > assertNotNull("Expected attribute found. MBean registered under a " > + "'<domain>:name=Stats,*' key must be of type > PerformanceCounter.class", > @@ -131,7 +124,6 @@ > > assertNotNull("Expected last completion time to be available", > beanServer.getAttribute(pcob, "LastExchangeCompletionTime")); > - > } > > protected RouteBuilder createRouteBuilder() { > > Modified: > camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationWithConnectorTest.java > URL: > http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationWithConnectorTest.java?rev=738878&r1=738877&r2=738878&view=diff > ============================================================================== > --- > camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationWithConnectorTest.java > (original) > +++ > camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationWithConnectorTest.java > Thu Jan 29 15:03:12 2009 > @@ -26,21 +26,20 @@ > * a client. > * > * @version $Revision$ > - * > */ > public class JmxInstrumentationWithConnectorTest extends > JmxInstrumentationUsingDefaultsTest { > > protected static final String JMXSERVICEURL = > - "service:jmx:rmi:///jndi/rmi://localhost:2000/jmxrmi/camel"; > + "service:jmx:rmi:///jndi/rmi://localhost:2123/jmxrmi/camel"; > protected JMXConnector clientConnector; > > @Override > protected void setUp() throws Exception { > - sleepForConnection = 2000; > - System.setProperty(JmxSystemPropertyKeys.CREATE_CONNECTOR, "True"); > + sleepForConnection = 3000; > + System.setProperty(JmxSystemPropertyKeys.CREATE_CONNECTOR, "true"); > // need to explicit set it to false to use non-platform mbs > - System.setProperty(JmxSystemPropertyKeys.USE_PLATFORM_MBS, "False"); > - System.setProperty(JmxSystemPropertyKeys.REGISTRY_PORT, "2000"); > + System.setProperty(JmxSystemPropertyKeys.USE_PLATFORM_MBS, "false"); > + System.setProperty(JmxSystemPropertyKeys.REGISTRY_PORT, "2123"); > super.setUp(); > } > > @@ -65,8 +64,7 @@ > protected MBeanServerConnection getMBeanConnection() throws Exception { > if (mbsc == null) { > if (clientConnector == null) { > - clientConnector = JMXConnectorFactory.connect( > - new JMXServiceURL(JMXSERVICEURL), null); > + clientConnector = JMXConnectorFactory.connect(new > JMXServiceURL(JMXSERVICEURL), null); > } > mbsc = clientConnector.getMBeanServerConnection(); > } > > >