View Javadoc

1   /*
2    * $Id: PGPExpiredIntegrationTestCase.java 22504 2011-07-21 14:55:19Z justin.calleja $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.module.pgp;
12  
13  import static org.junit.Assert.assertNotNull;
14  import static org.junit.Assert.assertNull;
15  
16  import java.util.Arrays;
17  import java.util.Collection;
18  
19  import org.junit.Test;
20  import org.junit.runners.Parameterized.Parameters;
21  import org.mule.DefaultMuleMessage;
22  import org.mule.api.MuleMessage;
23  import org.mule.module.client.MuleClient;
24  import org.mule.tck.AbstractServiceAndFlowTestCase;
25  
26  public class PGPExpiredIntegrationTestCase extends AbstractServiceAndFlowTestCase
27  {
28  
29      public PGPExpiredIntegrationTestCase(ConfigVariant variant, String configResources)
30      {
31          super(variant, configResources);
32          
33      }
34  
35      @Parameters
36      public static Collection<Object[]> parameters()
37      {
38          return Arrays.asList(new Object[][]{
39              {ConfigVariant.SERVICE, "pgp-expired-integration-mule-config-service.xml"},
40              {ConfigVariant.FLOW, "pgp-expired-integration-mule-config-flow.xml"}
41          });
42      }
43  
44      @Test
45      public void testEncryptDecrypt() throws Exception
46      {
47          String payload = "this is a super simple test. Hope it works!!!";
48          MuleClient client = new MuleClient(muleContext);
49          
50          MuleMessage exceptionMessage = client.send("vm://in", new DefaultMuleMessage(payload, muleContext));
51          
52          assertNotNull(exceptionMessage);
53          
54          MuleMessage message = client.request("vm://out", 1000);
55          assertNull(message);
56      }
57  
58  }