4c896e7e830cc67db4914495dba4d9bb8152dace
[controller.git] / opendaylight / config / config-manager / src / test / java / org / opendaylight / controller / config / manager / impl / AbstractLockedPlatformMBeanServerTest.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.config.manager.impl;
9
10 import java.lang.management.ManagementFactory;
11 import java.util.concurrent.locks.ReentrantLock;
12 import javax.management.MBeanServer;
13 import org.junit.After;
14 import org.junit.Before;
15
16 /**
17  * Each test that works with platform MBeanServer should extend this class.
18  */
19 public abstract class AbstractLockedPlatformMBeanServerTest {
20     private static final ReentrantLock lock = new ReentrantLock();
21     protected static MBeanServer platformMBeanServer = ManagementFactory
22             .getPlatformMBeanServer();
23
24     @Before
25     public void acquireLock() {
26         lock.lock();
27     }
28
29     @After
30     public void unlock() {
31         lock.unlock();
32     }
33
34     public static class SimpleBean implements SimpleBeanMBean {
35
36     }
37
38     public static interface SimpleBeanMBean {
39
40     }
41
42 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.