Remove DataPostPath
[netconf.git] / restconf / restconf-nb / src / test / java / org / opendaylight / restconf / nb / rfc8040 / databind / AbstractBodyTest.java
1 /*
2  * Copyright (c) 2016 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.restconf.nb.rfc8040.databind;
9
10 import java.io.File;
11 import java.io.FileNotFoundException;
12 import java.util.ArrayList;
13 import java.util.List;
14 import org.opendaylight.restconf.nb.rfc8040.AbstractInstanceIdentifierTest;
15 import org.opendaylight.yangtools.yang.common.YangConstants;
16
17 public abstract class AbstractBodyTest extends AbstractInstanceIdentifierTest {
18     static final List<File> loadFiles(final String resourceDirectory) throws FileNotFoundException {
19         final String path = AbstractBodyTest.class.getResource(resourceDirectory).getPath();
20         final File testDir = new File(path);
21         final String[] fileList = testDir.list();
22         final List<File> testFiles = new ArrayList<>();
23         if (fileList == null) {
24             throw new FileNotFoundException(resourceDirectory);
25         }
26         for (final String fileName : fileList) {
27             if (fileName.endsWith(YangConstants.RFC6020_YANG_FILE_EXTENSION)
28                 && !new File(testDir, fileName).isDirectory()) {
29                 testFiles.add(new File(testDir, fileName));
30             }
31         }
32         return testFiles;
33     }
34 }