View Javadoc

1   /*
2    * $Id: GroovyScriptConfigurationBuilderTestCase.java 22401 2011-07-13 09:10:18Z dirk.olmes $
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.module.scripting.builders;
12  
13  import org.mule.api.MuleException;
14  import org.mule.api.config.ConfigurationBuilder;
15  import org.mule.api.config.MuleProperties;
16  import org.mule.tck.AbstractScriptConfigBuilderTestCase;
17  import org.mule.util.store.QueuePersistenceObjectStore;
18  import org.mule.util.store.SimpleMemoryObjectStore;
19  
20  import java.io.Serializable;
21  import java.util.Properties;
22  
23  import static org.junit.Assert.fail;
24  
25  public class GroovyScriptConfigurationBuilderTestCase extends AbstractScriptConfigBuilderTestCase
26  {
27      @Override
28      public String getConfigResources()
29      {
30          return "mule-config.groovy";
31      }
32  
33      @Override
34      public ConfigurationBuilder getBuilder()
35      {
36          try
37          {
38              return new ScriptConfigurationBuilder("groovy", getConfigResources());
39          }
40          catch (MuleException e)
41          {
42              fail(e.getMessage());
43              return null;
44          }
45      }
46  
47      @Override
48      protected Properties getStartUpProperties()
49      {
50          Properties superProps = super.getStartUpProperties();
51          Properties props = superProps == null ? new Properties() : new Properties(superProps);
52          props.put(MuleProperties.OBJECT_STORE_DEFAULT_IN_MEMORY_NAME, new SimpleMemoryObjectStore<Serializable>());
53          props.put(MuleProperties.OBJECT_STORE_DEFAULT_PERSISTENT_NAME, new QueuePersistenceObjectStore<Serializable>());
54          return props;
55      }
56  }