View Javadoc

1   /*
2    * $Id: InboundMessageLossFlowTestCase.java 22491 2011-07-21 10:04:30Z claude.mamo $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.file.reliability;
12  
13  import org.mule.tck.probe.Probe;
14  
15  import java.io.File;
16  
17  import org.junit.Test;
18  
19  
20  public class InboundMessageLossFlowTestCase extends InboundMessageLossTestCase
21  {
22      public InboundMessageLossFlowTestCase(ConfigVariant variant, String configResources)
23      {
24          super(variant, configResources);
25      }
26  
27      @Override
28      protected String getConfigResources()
29      {
30          return "reliability/inbound-message-loss-flow.xml";
31      }
32  
33      @Test
34      @Override
35      public void testTransformerException() throws Exception
36      {
37          tmpDir = createFolder(".mule/transformerException");
38          final File file = createDataFile(tmpDir, "test1.txt");
39          prober.check(new Probe()
40          {
41              @Override
42              public boolean isSatisfied()
43              {
44                  // Exception occurs after the SEDA queue for an asynchronous request, so from the client's
45                  // perspective, the message has been delivered successfully.
46                  // Note that this behavior is different from services because the exception occurs before
47                  // the SEDA queue for services.
48                  return !file.exists();
49              }
50  
51              @Override
52              public String describeFailure()
53              {
54                  return "File should be gone";
55              }
56          });
57      }
58  
59      @Test
60      @Override
61      public void testRouterException() throws Exception
62      {
63          tmpDir = createFolder(".mule/routerException");
64          final File file = createDataFile(tmpDir, "test1.txt");
65          prober.check(new Probe()
66          {
67              @Override
68              public boolean isSatisfied()
69              {
70                  // Exception occurs after the SEDA queue for an asynchronous request, so from the client's
71                  // perspective, the message has been delivered successfully.
72                  // Note that this behavior is different from services because the exception occurs before
73                  // the SEDA queue for services.
74                  return !file.exists();
75              }
76  
77              @Override
78              public String describeFailure()
79              {
80                  return "File should be gone";
81              }
82          });
83      }
84  }