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.management.agents;
8   
9   import org.mule.management.AbstractMuleJmxTestCase;
10  import org.mule.module.management.agent.Log4jAgent;
11  
12  import javax.management.ObjectName;
13  
14  import org.apache.log4j.jmx.HierarchyDynamicMBean;
15  import org.junit.Test;
16  
17  public class Log4jAgentTestCase extends AbstractMuleJmxTestCase
18  {
19      @Test
20      public void testRedeploy() throws Exception
21      {
22          mBeanServer.registerMBean(new HierarchyDynamicMBean(),
23                                    ObjectName.getInstance(Log4jAgent.JMX_OBJECT_NAME));
24  
25          Log4jAgent agent = new Log4jAgent();
26          agent.initialise();
27      }
28      
29      protected void doTearDown() throws Exception
30      {
31          // This MBean was registered manually so needs to be unregistered manually in tearDown()
32          unregisterMBeansByMask(Log4jAgent.JMX_OBJECT_NAME);
33          super.doTearDown();
34      }
35  }