BUG-1143: added AbstractTypesTest as base for generated types testing. 79/7979/1
authorMartin Vitez <mvitez@cisco.com>
Fri, 13 Jun 2014 09:11:17 +0000 (11:11 +0200)
committerMartin Vitez <mvitez@cisco.com>
Fri, 13 Jun 2014 09:21:52 +0000 (11:21 +0200)
Signed-off-by: Martin Vitez <mvitez@cisco.com>
code-generator/binding-generator-impl/src/test/java/org/opendaylight/yangtools/sal/binding/generator/impl/AbstractTypesTest.java [new file with mode: 0644]

diff --git a/code-generator/binding-generator-impl/src/test/java/org/opendaylight/yangtools/sal/binding/generator/impl/AbstractTypesTest.java b/code-generator/binding-generator-impl/src/test/java/org/opendaylight/yangtools/sal/binding/generator/impl/AbstractTypesTest.java
new file mode 100644 (file)
index 0000000..58b5133
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.sal.binding.generator.impl;
+
+import com.google.common.base.Preconditions;
+import java.io.File;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+import org.junit.Before;
+
+public abstract class AbstractTypesTest {
+
+    private final URL testSourcesDirUrl;
+    protected Set<File> testModels;
+
+    AbstractTypesTest(final URL testSourcesDirUrl) {
+        this.testSourcesDirUrl = testSourcesDirUrl;
+    }
+
+    @Before
+    public void loadTestResources() throws URISyntaxException {
+        File testSourcesDir = new File(testSourcesDirUrl.toURI());
+        File[] testFiles = Preconditions.checkNotNull(testSourcesDir.listFiles(), testSourcesDir
+                + " does not denote a directory");
+        testModels = new HashSet<>();
+        for (File file : testFiles) {
+            if (file.isFile()) {
+                testModels.add(file);
+            }
+        }
+    }
+
+}