View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.module.logging;
8   
9   import static org.junit.Assert.assertTrue;
10  
11  import org.junit.AfterClass;
12  import org.junit.BeforeClass;
13  import org.junit.Test;
14  
15  public class StandaloneLogHandlerThreadTestCase extends AbstractLogHandlerThreadTestCase
16  {
17  
18      private static String originalSystemProperty;
19  
20      public StandaloneLogHandlerThreadTestCase(LoggerFactoryFactory loggerFactory, String logHandlerThreadName)
21      {
22          super(loggerFactory, logHandlerThreadName);
23      }
24  
25      @BeforeClass
26      public static void setUpSystemProperty()
27      {
28          originalSystemProperty = System.setProperty(MuleUtils.MULE_HOME, "test");
29      }
30  
31      @AfterClass
32      public static void restoreSystemProperty()
33      {
34          if (originalSystemProperty != null)
35          {
36              System.setProperty(MuleUtils.MULE_HOME, originalSystemProperty);
37          }
38          else
39          {
40              System.clearProperty(MuleUtils.MULE_HOME);
41          }
42  
43      }
44  
45      @Test
46      public void startsLogHandlerThreadOnStandaloneMode() throws Exception
47      {
48          loggerFactory.create();
49  
50          assertTrue("Did not create expected LoggerReferenceHandler instance", createdLoggerReferenceHandler);
51      }
52  }