View Javadoc

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