servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r564607 [12/12] - in /incubator/servicemix/trunk/core/servicemix-core/src: main/java/org/apache/servicemix/ main/java/org/apache/servicemix/jbi/ main/java/org/apache/servicemix/jbi/framework/ main/java/org/apache/servicemix/jbi/framework/su...
Date Fri, 10 Aug 2007 14:38:14 GMT
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/nmr/flow/jms/StatelessJmsFlowTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/nmr/flow/jms/StatelessJmsFlowTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/nmr/flow/jms/StatelessJmsFlowTest.java
(original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/nmr/flow/jms/StatelessJmsFlowTest.java
Fri Aug 10 07:37:46 2007
@@ -19,6 +19,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 import javax.jbi.messaging.ExchangeStatus;
 import javax.jbi.messaging.InOut;
@@ -37,31 +38,29 @@
 import org.apache.servicemix.jbi.container.JBIContainer;
 import org.apache.servicemix.jbi.jaxp.StringSource;
 
-import java.util.concurrent.CopyOnWriteArrayList;
-
 public class StatelessJmsFlowTest extends TestCase {
 
     protected JBIContainer jbi1;
     protected JBIContainer jbi2;
     protected BrokerService broker;
-    
+
     protected void setUp() throws Exception {
         broker = new BrokerService();
         broker.setPersistent(false);
         broker.setUseJmx(false);
         broker.addConnector("tcp://localhost:61616");
         broker.start();
-        
+
         jbi1 = createContainer("jbi1");
         jbi2 = createContainer("jbi2");
     }
-    
+
     protected void tearDown() throws Exception {
         jbi1.shutDown();
         jbi2.shutDown();
         broker.stop();
     }
-    
+
     protected JBIContainer createContainer(String name) throws Exception {
         JBIContainer container = new JBIContainer();
         container.setName(name);
@@ -72,27 +71,27 @@
         container.start();
         return container;
     }
-    
+
     protected StatelessEcho activateProvider(JBIContainer container, boolean stateless) throws
Exception {
         StatelessEcho echo = new StatelessEcho(stateless);
         container.activateComponent(echo, "echo");
         return echo;
     }
-    
+
     protected StatelessSender activateConsumer(JBIContainer container) throws Exception {
         StatelessSender sender = new StatelessSender();
         container.activateComponent(sender, "sender");
         return sender;
     }
-    
+
     public void testStatelessConsumer() throws Exception {
         StatelessEcho echo1 = activateProvider(jbi1, false);
         StatelessEcho echo2 = activateProvider(jbi2, false);
         StatelessSender sender1 = activateConsumer(jbi1);
         StatelessSender sender2 = activateConsumer(jbi2);
-        
+
         sender1.sendMessages(100, true);
-        
+
         int n1 = 0;
         int n2 = 0;
         for (int i = 0; i < 10; i++) {
@@ -107,15 +106,15 @@
         assertTrue(n2 != 0);
         assertTrue(n1 + n2 == 100);
     }
-    
+
     public void testStatefullConsumer() throws Exception {
         StatelessEcho echo1 = activateProvider(jbi1, false);
         StatelessEcho echo2 = activateProvider(jbi2, false);
         StatelessSender sender1 = activateConsumer(jbi1);
         StatelessSender sender2 = activateConsumer(jbi2);
-        
+
         sender1.sendMessages(100, false);
-        
+
         int n1 = 0;
         int n2 = 0;
         for (int i = 0; i < 10; i++) {
@@ -130,13 +129,13 @@
         assertTrue(n2 == 0);
         assertTrue(n1 + n2 == 100);
     }
-    
+
     public void testStatelessProvider() throws Exception {
         StatelessEcho echo1 = activateProvider(jbi1, true);
         StatelessEcho echo2 = activateProvider(jbi2, true);
         StatelessSender sender1 = activateConsumer(jbi1);
         StatelessSender sender2 = activateConsumer(jbi2);
-        
+
         sender1.sendMessages(100, false);
 
         for (int i = 0; i < 10; i++) {
@@ -146,7 +145,7 @@
             }
         }
         assertTrue(echo1.doneIds.size() + echo2.doneIds.size() == 100);
-        
+
         // Check that the echo1 component received
         // DONE status for exchanges it did not handle
         // the first time.
@@ -157,13 +156,13 @@
         doneIds1.removeAll(echo1.inIds);
         assertTrue(doneIds1.size() > 0);
     }
-    
+
     public void testStatefullProvider() throws Exception {
         StatelessEcho echo1 = activateProvider(jbi1, false);
         StatelessEcho echo2 = activateProvider(jbi2, false);
         StatelessSender sender1 = activateConsumer(jbi1);
         StatelessSender sender2 = activateConsumer(jbi2);
-        
+
         sender1.sendMessages(100, false);
 
         for (int i = 0; i < 10; i++) {
@@ -173,7 +172,7 @@
             }
         }
         assertTrue(echo1.doneIds.size() + echo2.doneIds.size() == 100);
-        
+
         // Check that the echo1 component received
         // DONE status for exchanges it did not handle
         // the first time.
@@ -184,14 +183,18 @@
         doneIds1.removeAll(echo1.inIds);
         assertTrue(doneIds1.size() == 0);
     }
-    
+
     public static class StatelessSender extends ComponentSupport implements MessageExchangeListener
{
+
         public static final QName SERVICE = new QName("sender");
         public static final String ENDPOINT = "ep";
-        public List outIds = new CopyOnWriteArrayList();
+
+        List outIds = new CopyOnWriteArrayList();
+
         public StatelessSender() {
             super(SERVICE, ENDPOINT);
         }
+
         public void sendMessages(int nb, boolean stateless) throws Exception {
             for (int i = 0; i < nb; i++) {
                 MessageExchangeFactory mef = getDeliveryChannel().createExchangeFactory();
@@ -203,24 +206,28 @@
                 me.setInMessage(me.createMessage());
                 me.getInMessage().setContent(new StringSource("<hello/>"));
                 getDeliveryChannel().send(me);
-                
+
             }
         }
+
         public void onMessageExchange(MessageExchange exchange) throws MessagingException
{
             outIds.add(exchange.getExchangeId());
             done(exchange);
         }
     }
-    
+
     public static class StatelessEcho extends ComponentSupport implements MessageExchangeListener
{
-        private boolean stateless;
-        public List inIds = new CopyOnWriteArrayList();
-        public List doneIds = new CopyOnWriteArrayList();
+
+        boolean stateless;
+        List inIds = new CopyOnWriteArrayList();
+        List doneIds = new CopyOnWriteArrayList();
+
         public StatelessEcho(boolean stateless) {
             setService(new QName("echo"));
             setEndpoint("ep");
             this.stateless = stateless;
         }
+
         public void onMessageExchange(MessageExchange exchange) throws MessagingException
{
             if (exchange.getStatus() == ExchangeStatus.DONE) {
                 doneIds.add(exchange.getExchangeId());

Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/FileKeystoreManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/FileKeystoreManagerTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/FileKeystoreManagerTest.java
(original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/FileKeystoreManagerTest.java
Fri Aug 10 07:37:46 2007
@@ -35,7 +35,7 @@
         keystore.setKeystorePassword("keyStorePassword");
         keystore.setKeyPasswords("myalias=myAliasPassword");
         keystore.setName("ks");
-        mgr.setKeystores(new KeystoreInstance[] { keystore });
+        mgr.setKeystores(new KeystoreInstance[] {keystore });
         keystoreManager = mgr;
     }
     

Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/GroupPrincipalTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/GroupPrincipalTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/GroupPrincipalTest.java
(original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/GroupPrincipalTest.java
Fri Aug 10 07:37:46 2007
@@ -18,22 +18,21 @@
 
 import junit.framework.TestCase;
 
-
 /**
- *
+ * 
  */
 public class GroupPrincipalTest extends TestCase {
 
     public void testArguments() {
         GroupPrincipal principal = new GroupPrincipal("FOO");
 
-       assertEquals("FOO", principal.getName());
+        assertEquals("FOO", principal.getName());
 
         try {
             new GroupPrincipal(null);
             fail("Should have thrown IllegalArgumentException");
         } catch (IllegalArgumentException ingore) {
-
+            // Expected
         }
     }
 

Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/PropertiesLoginModuleTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/PropertiesLoginModuleTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/PropertiesLoginModuleTest.java
(original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/PropertiesLoginModuleTest.java
Fri Aug 10 07:37:46 2007
@@ -99,8 +99,8 @@
             context.login();
             fail("Should have thrown a FailedLoginException");
         } catch (FailedLoginException doNothing) {
+            // Expected
         }
-
     }
 
     public void testBadPWLogin() throws Exception {
@@ -121,7 +121,7 @@
             context.login();
             fail("Should have thrown a FailedLoginException");
         } catch (FailedLoginException doNothing) {
+            // Expected
         }
-
     }
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/SecuredBrokerTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/SecuredBrokerTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/SecuredBrokerTest.java
(original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/SecuredBrokerTest.java
Fri Aug 10 07:37:46 2007
@@ -33,6 +33,8 @@
 
 import junit.framework.TestCase;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.client.DefaultServiceMixClient;
 import org.apache.servicemix.client.ServiceMixClient;
 import org.apache.servicemix.jbi.container.JBIContainer;
@@ -41,11 +43,10 @@
 import org.apache.servicemix.jbi.security.acl.impl.AuthorizationEntry;
 import org.apache.servicemix.jbi.security.acl.impl.DefaultAuthorizationMap;
 import org.apache.servicemix.tck.ReceiverComponent;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 public class SecuredBrokerTest extends TestCase {
-    private static final Log log = LogFactory.getLog(SecuredBrokerTest.class);
+
+    private static final Log LOG = LogFactory.getLog(SecuredBrokerTest.class);
 
     static {
         String path = System.getProperty("java.security.auth.login.config");
@@ -56,7 +57,7 @@
                 System.setProperty("java.security.auth.login.config", path);
             }
         }
-        log.info("Path to login config: " + path);
+        LOG.info("Path to login config: " + path);
     }
 
     protected JBIContainer jbi;

Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/SpringSecuredBrokerTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/SpringSecuredBrokerTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/SpringSecuredBrokerTest.java
(original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/SpringSecuredBrokerTest.java
Fri Aug 10 07:37:46 2007
@@ -30,19 +30,19 @@
 import javax.security.auth.login.LoginContext;
 import javax.xml.namespace.QName;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.client.DefaultServiceMixClient;
 import org.apache.servicemix.client.ServiceMixClient;
 import org.apache.servicemix.jbi.jaxp.StringSource;
 import org.apache.servicemix.tck.Receiver;
 import org.apache.servicemix.tck.SpringTestSupport;
 import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 
 public class SpringSecuredBrokerTest extends SpringTestSupport {
 
-    private static final Log log = LogFactory.getLog(SpringSecuredBrokerTest.class);
+    private static final Log LOG = LogFactory.getLog(SpringSecuredBrokerTest.class);
 
     static {
         String path = System.getProperty("java.security.auth.login.config");
@@ -53,7 +53,7 @@
                 System.setProperty("java.security.auth.login.config", path);
             }
         }
-        log.info("Path to login config: " + path);
+        LOG.info("Path to login config: " + path);
     }
 
     protected Receiver receiver1;
@@ -121,6 +121,7 @@
             send("third", "another", service);
             fail("receiver2 is not available to testers");
         } catch (SecurityException e) {
+            // Expected
         }
     }
     
@@ -132,11 +133,13 @@
             send("second", "password", service);
             fail("receiver2 is not available to accounting");
         } catch (SecurityException e) {
+            // Expected
         }
         try {
             send("third", "another", service);
             fail("receiver2 is not available to testers");
         } catch (SecurityException e) {
+            // Expected
         }
     }
     

Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/UserPrincipalTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/UserPrincipalTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/UserPrincipalTest.java
(original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/security/UserPrincipalTest.java
Fri Aug 10 07:37:46 2007
@@ -18,22 +18,21 @@
 
 import junit.framework.TestCase;
 
-
 /**
- *
+ * 
  */
 public class UserPrincipalTest extends TestCase {
 
     public void testArguments() {
         UserPrincipal principal = new UserPrincipal("FOO");
 
-       assertEquals("FOO", principal.getName());
+        assertEquals("FOO", principal.getName());
 
         try {
             new UserPrincipal(null);
             fail("Should have thrown IllegalArgumentException");
         } catch (IllegalArgumentException ingore) {
-
+            // Expected
         }
     }
 

Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/servicedesc/EndpointReferenceBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/servicedesc/EndpointReferenceBuilderTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/servicedesc/EndpointReferenceBuilderTest.java
(original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/servicedesc/EndpointReferenceBuilderTest.java
Fri Aug 10 07:37:46 2007
@@ -18,33 +18,35 @@
 
 import javax.xml.namespace.QName;
 
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+
 import junit.framework.TestCase;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
 import org.apache.servicemix.jbi.util.DOMUtil;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Element;
 
 public class EndpointReferenceBuilderTest extends TestCase {
 
-	private static final Log log = LogFactory.getLog(EndpointReferenceBuilderTest.class);
-	
+    private static final Log LOG = LogFactory.getLog(EndpointReferenceBuilderTest.class);
+
     /*
-     * Test method for 'org.apache.servicemix.jbi.servicedesc.EndpointReferenceBuilder.getReference(ServiceEndpoint)'
+     * Test method for
+     * 'org.apache.servicemix.jbi.servicedesc.EndpointReferenceBuilder.getReference(ServiceEndpoint)'
      */
     public void testGetReference() throws Exception {
         InternalEndpoint endpoint = new InternalEndpoint(null, "myEndpoint", new QName("http://foo.bar.com",
"myService"));
         DocumentFragment df = EndpointReferenceBuilder.getReference(endpoint);
         assertNotNull(df);
-        log.info(new SourceTransformer().toString(df));
+        LOG.info(new SourceTransformer().toString(df));
         Element e = (Element) df.getFirstChild();
         assertEquals("http://java.sun.com/jbi/end-point-reference", e.getNamespaceURI());
         assertEquals("end-point-reference", e.getLocalName());
         assertEquals("myEndpoint", e.getAttributeNodeNS("http://java.sun.com/jbi/end-point-reference",
"end-point-name").getValue());
-        assertEquals(new QName("http://foo.bar.com", "myService"),
-                     DOMUtil.createQName(e, e.getAttributeNS("http://java.sun.com/jbi/end-point-reference",
"service-name")));
+        assertEquals(new QName("http://foo.bar.com", "myService"), DOMUtil.createQName(e,
e.getAttributeNS(
+                        "http://java.sun.com/jbi/end-point-reference", "service-name")));
     }
 
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/servicedesc/InternalEndpointTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/servicedesc/InternalEndpointTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/servicedesc/InternalEndpointTest.java
(original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/servicedesc/InternalEndpointTest.java
Fri Aug 10 07:37:46 2007
@@ -16,17 +16,16 @@
  */
 package org.apache.servicemix.jbi.servicedesc;
 
-import org.apache.servicemix.jbi.framework.ComponentNameSpace;
-import org.apache.servicemix.jbi.servicedesc.InternalEndpoint;
-
-import javax.xml.namespace.QName;
-
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
+import javax.xml.namespace.QName;
+
 import junit.framework.TestCase;
+
+import org.apache.servicemix.jbi.framework.ComponentNameSpace;
 
 public class InternalEndpointTest extends TestCase {
 

Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/util/FileUtilTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/util/FileUtilTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/util/FileUtilTest.java
(original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/util/FileUtilTest.java
Fri Aug 10 07:37:46 2007
@@ -22,96 +22,65 @@
 
 public class FileUtilTest extends TestCase {
 
-	private static File WORKDIR = new File("target/servicemix-test");
-	
-	protected void setUp() throws Exception {
-		FileUtil.deleteFile(WORKDIR);
-		WORKDIR.mkdirs();
-	}
-	
-	public void testDeleteFile() throws Exception {
-		File f = new File(WORKDIR, "test.txt");
-		assertFalse(f.exists());
-		assertTrue(f.createNewFile());
-		assertTrue(f.exists());
-		assertFalse(f.isDirectory());
-		assertTrue(f.isFile());
-		assertTrue(FileUtil.deleteFile(f));
-		assertFalse(f.exists());
-	}
-	
-	/*
-	 * This test only works on windows, as
-	 * writing to a file does not prevent its 
-	 * deletion on unix systems.
-	 *
-	public void testDeleteLockedFile() throws Exception {
-		File f = new File(WORKDIR, "test.txt");
-		assertFalse(f.exists());
-		OutputStream os = new FileOutputStream(f);
-		try {
-			Writer w = new OutputStreamWriter(os);
-			w.write("hello");
-			w.flush();
-			assertTrue(f.exists());
-			assertFalse(FileUtil.deleteFile(f));
-			assertTrue(f.exists());
-		} finally {
-			os.close();
-		}
-		assertTrue(f.exists());
-		assertTrue(FileUtil.deleteFile(f));
-		assertFalse(f.exists());
-	}
-	*/
-	
-	public void testDeleteDir() throws Exception {
-		File f = new File(WORKDIR, "testdir");
-		assertFalse(f.exists());
-		assertTrue(f.mkdir());
-		assertTrue(f.exists());
-		assertTrue(f.isDirectory());
-		assertFalse(f.isFile());
-		assertTrue(FileUtil.deleteFile(f));
-		assertFalse(f.exists());
-	}
-	
-	/*
-	 * This test only works on windows, as
-	 * writing to a file does not prevent its 
-	 * deletion on unix systems.
-	 *
-	public void testDeleteDirWithLockedFile() throws Exception {
-		File f = new File(WORKDIR, "testdir");
-		assertFalse(f.exists());
-		assertTrue(f.mkdir());
-		assertTrue(f.exists());
-		assertTrue(f.isDirectory());
-		assertFalse(f.isFile());
-		File f2 = new File(f, "test.txt");
-		assertFalse(f2.exists());
-		File f3 = new File(f, "test2.txt");
-		assertFalse(f3.exists());
-		assertTrue(f3.createNewFile());
-		assertTrue(f3.exists());
-		OutputStream os = new FileOutputStream(f2);
-		try {
-			Writer w = new OutputStreamWriter(os);
-			w.write("hello");
-			w.flush();
-			assertTrue(f2.exists());
-			assertFalse(FileUtil.deleteFile(f));
-			assertTrue(f.exists());
-			assertTrue(f2.exists());
-		} finally {
-			os.close();
-		}
-		assertFalse(f3.exists());
-		assertTrue(f2.exists());
-		assertTrue(f.exists());
-		assertTrue(FileUtil.deleteFile(f));
-		assertFalse(f.exists());
-	}
-	*/
-	
+    private static final File WORKDIR = new File("target/servicemix-test");
+
+    protected void setUp() throws Exception {
+        FileUtil.deleteFile(WORKDIR);
+        WORKDIR.mkdirs();
+    }
+
+    public void testDeleteFile() throws Exception {
+        File f = new File(WORKDIR, "test.txt");
+        assertFalse(f.exists());
+        assertTrue(f.createNewFile());
+        assertTrue(f.exists());
+        assertFalse(f.isDirectory());
+        assertTrue(f.isFile());
+        assertTrue(FileUtil.deleteFile(f));
+        assertFalse(f.exists());
+    }
+
+    /*
+     * This test only works on windows, as writing to a file does not prevent
+     * its deletion on unix systems.
+     * 
+     * public void testDeleteLockedFile() throws Exception { File f = new
+     * File(WORKDIR, "test.txt"); assertFalse(f.exists()); OutputStream os = new
+     * FileOutputStream(f); try { Writer w = new OutputStreamWriter(os);
+     * w.write("hello"); w.flush(); assertTrue(f.exists());
+     * assertFalse(FileUtil.deleteFile(f)); assertTrue(f.exists()); } finally {
+     * os.close(); } assertTrue(f.exists()); assertTrue(FileUtil.deleteFile(f));
+     * assertFalse(f.exists()); }
+     */
+
+    public void testDeleteDir() throws Exception {
+        File f = new File(WORKDIR, "testdir");
+        assertFalse(f.exists());
+        assertTrue(f.mkdir());
+        assertTrue(f.exists());
+        assertTrue(f.isDirectory());
+        assertFalse(f.isFile());
+        assertTrue(FileUtil.deleteFile(f));
+        assertFalse(f.exists());
+    }
+
+    /*
+     * This test only works on windows, as writing to a file does not prevent
+     * its deletion on unix systems.
+     * 
+     * public void testDeleteDirWithLockedFile() throws Exception { File f = new
+     * File(WORKDIR, "testdir"); assertFalse(f.exists()); assertTrue(f.mkdir());
+     * assertTrue(f.exists()); assertTrue(f.isDirectory());
+     * assertFalse(f.isFile()); File f2 = new File(f, "test.txt");
+     * assertFalse(f2.exists()); File f3 = new File(f, "test2.txt");
+     * assertFalse(f3.exists()); assertTrue(f3.createNewFile());
+     * assertTrue(f3.exists()); OutputStream os = new FileOutputStream(f2); try {
+     * Writer w = new OutputStreamWriter(os); w.write("hello"); w.flush();
+     * assertTrue(f2.exists()); assertFalse(FileUtil.deleteFile(f));
+     * assertTrue(f.exists()); assertTrue(f2.exists()); } finally { os.close(); }
+     * assertFalse(f3.exists()); assertTrue(f2.exists());
+     * assertTrue(f.exists()); assertTrue(FileUtil.deleteFile(f));
+     * assertFalse(f.exists()); }
+     */
+
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/util/MessageCopierTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/util/MessageCopierTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/util/MessageCopierTest.java
(original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/jbi/util/MessageCopierTest.java
Fri Aug 10 07:37:46 2007
@@ -26,8 +26,6 @@
 import org.apache.commons.io.IOUtils;
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
 import org.apache.servicemix.jbi.jaxp.StringSource;
-import org.apache.servicemix.jbi.util.ByteArrayDataSource;
-import org.apache.servicemix.jbi.util.MessageUtil;
 
 public class MessageCopierTest extends TestCase {
 

Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/ExamplePojoTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/ExamplePojoTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/ExamplePojoTest.java
(original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/ExamplePojoTest.java
Fri Aug 10 07:37:46 2007
@@ -16,22 +16,22 @@
  */
 package org.apache.servicemix.tck;
 
+import junit.framework.TestCase;
+
 import org.apache.servicemix.jbi.container.ActivationSpec;
 import org.apache.servicemix.jbi.container.JBIContainer;
 import org.apache.servicemix.jbi.resolver.ServiceNameEndpointResolver;
-import org.apache.servicemix.tck.ReceiverComponent;
-import org.apache.servicemix.tck.SenderComponent;
-
-import junit.framework.TestCase;
 
 /**
  * @version $Revision$
  */
 public class ExamplePojoTest extends TestCase {
+
+    private static final int NUM_MESSAGES = 10;
+
     protected JBIContainer container = new JBIContainer();
-    private SenderComponent sender;
-    private ReceiverComponent receiver;
-    protected int NUM_MESSAGES = 10;
+    protected SenderComponent sender;
+    protected ReceiverComponent receiver;
 
     public void testInOnly() throws Exception {
         sender.sendMessages(NUM_MESSAGES);
@@ -49,7 +49,7 @@
         container.activateComponent(new ActivationSpec("sender", sender));
         container.activateComponent(new ActivationSpec("receiver", receiver));
     }
-    
+
     protected void tearDown() throws Exception {
         container.shutDown();
     }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/SpringAsyncPojoTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/SpringAsyncPojoTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/SpringAsyncPojoTest.java
(original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/SpringAsyncPojoTest.java
Fri Aug 10 07:37:46 2007
@@ -17,8 +17,8 @@
 package org.apache.servicemix.tck;
 
 import org.apache.servicemix.examples.AbstractSpringTestSupport;
-import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
 
 /**
  * @version $Revision$

Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/SpringComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/SpringComponentTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/SpringComponentTest.java
(original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/SpringComponentTest.java
Fri Aug 10 07:37:46 2007
@@ -17,15 +17,15 @@
 package org.apache.servicemix.tck;
 
 import org.apache.servicemix.examples.AbstractSpringTestSupport;
-import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
 
 /**
  * @version $Revision$
  */
 public class SpringComponentTest extends AbstractSpringTestSupport {
 
-   protected AbstractXmlApplicationContext createBeanFactory() {
+    protected AbstractXmlApplicationContext createBeanFactory() {
         return new ClassPathXmlApplicationContext("org/apache/servicemix/examples/spring-simple.xml");
     }
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/SpringPojoTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/SpringPojoTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/SpringPojoTest.java
(original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/tck/SpringPojoTest.java
Fri Aug 10 07:37:46 2007
@@ -17,8 +17,8 @@
 package org.apache.servicemix.tck;
 
 import org.apache.servicemix.examples.AbstractSpringTestSupport;
-import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
 
 /**
  * @version $Revision$



Mime
View raw message