BUG-4329: switch to javaparser
[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("target/testgen");
16     protected final File generatorOutputPath;
17
18     public AbstractGeneratorTest() {
19         generatorOutputPath = new File(GENERATOR_OUTPUT_PATH_ROOT, getClass().getSimpleName());
20     }
21
22     @Before
23     public void cleanUpDirectory() throws Exception {
24         deleteFolder(generatorOutputPath);
25     }
26
27     public void deleteFolder(final File folder) {
28         File[] files = folder.listFiles();
29         if (files != null) {
30             for (File f : files) {
31                 if (f.isDirectory()) {
32                     deleteFolder(f);
33                 } else {
34                     f.delete();
35                 }
36             }
37         }
38         folder.delete();
39     }
40 }