fb5cd2e9899cdbe96540ff322ed3f5c4c5d50f1b
[controller.git] / opendaylight / config / yang-jmx-generator-plugin / src / test / java / org / opendaylight / controller / config / yangjmxgenerator / plugin / AbstractGeneratorTest.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.yangjmxgenerator.plugin;
9
10 import java.io.File;
11 import org.junit.Before;
12 import org.opendaylight.controller.config.yangjmxgenerator.AbstractYangTest;
13
14 public abstract class AbstractGeneratorTest extends AbstractYangTest {
15     private static final File GENERATOR_OUTPUT_PATH_ROOT = new File(
16             "target/testgen");
17     protected final File generatorOutputPath;
18
19     public AbstractGeneratorTest() {
20         generatorOutputPath = new File(GENERATOR_OUTPUT_PATH_ROOT, getClass()
21                 .getSimpleName());
22     }
23
24     @Before
25     public void cleanUpDirectory() throws Exception {
26         deleteFolder(generatorOutputPath);
27     }
28
29     public void deleteFolder(File folder) {
30         File[] files = folder.listFiles();
31         if (files != null) {
32             for (File f: files) {
33                 if (f.isDirectory()) {
34                     deleteFolder(f);
35                 } else {
36                     f.delete();
37                 }
38             }
39         }
40         folder.delete();
41     }
42
43 }

©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.