View Javadoc

1   /*
2    * $Id: PGPIntegrationTestCase.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.assertEquals;
14  
15  import java.util.Arrays;
16  import java.util.Collection;
17  
18  import org.junit.Test;
19  import org.junit.runners.Parameterized.Parameters;
20  import org.mule.DefaultMuleMessage;
21  import org.mule.api.MuleMessage;
22  import org.mule.module.client.MuleClient;
23  import org.mule.tck.AbstractServiceAndFlowTestCase;
24  
25  public class PGPIntegrationTestCase extends AbstractServiceAndFlowTestCase
26  {
27  
28      public PGPIntegrationTestCase(ConfigVariant variant, String configResources)
29      {
30          super(variant, configResources);
31      }
32  
33      @Parameters
34      public static Collection<Object[]> parameters()
35      {
36          return Arrays.asList(new Object[][]{
37              {ConfigVariant.SERVICE, "pgp-integration-mule-config-service.xml"},
38              {ConfigVariant.FLOW, "pgp-integration-mule-config-flow.xml"}});
39      }
40  
41      @Test
42      public void testEncryptDecrypt() throws Exception
43      {
44          String payload = "this is a super simple test. Hope it works!!!";
45          MuleClient client = new MuleClient(muleContext);
46  
47          client.send("vm://in", new DefaultMuleMessage(payload, muleContext));
48          MuleMessage message = client.request("vm://out", 5000);
49          assertEquals(payload, message.getPayloadAsString());
50      }
51  
52  }