01: /*
02: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
03: *
04: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
05: *
06: * The contents of this file are subject to the terms of either the GNU
07: * General Public License Version 2 only ("GPL") or the Common
08: * Development and Distribution License("CDDL") (collectively, the
09: * "License"). You may not use this file except in compliance with the
10: * License. You can obtain a copy of the License at
11: * http://www.netbeans.org/cddl-gplv2.html
12: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13: * specific language governing permissions and limitations under the
14: * License. When distributing the software, include this License Header
15: * Notice in each file and include the License file at
16: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17: * particular file as subject to the "Classpath" exception as provided
18: * by Sun in the GPL Version 2 section of the License file that
19: * accompanied this code. If applicable, add the following below the
20: * License Header, with the fields enclosed by brackets [] replaced by
21: * your own identifying information:
22: * "Portions Copyrighted [year] [name of copyright owner]"
23: *
24: * Contributor(s):
25: *
26: * Portions Copyrighted 2007 Sun Microsystems, Inc.
27: */
28:
29: package org.netbeans.modules.cnd.repository.impl;
30:
31: import java.io.File;
32: import java.io.IOException;
33: import java.util.ArrayList;
34: import java.util.List;
35: import org.netbeans.junit.Manager;
36: import org.netbeans.modules.cnd.modelimpl.trace.TraceModelTestBase;
37:
38: /**
39: *
40: * @author sg155630
41: */
42: public class RepositoryValidationBase extends TraceModelTestBase {
43:
44: public RepositoryValidationBase(String testName) {
45: super (testName);
46: }
47:
48: protected static final String nimi = "ModelBuiltFromRepository"; //NOI18N
49: protected static final String modelimplName = "cnd.modelimpl";
50: protected static final String moduleName = "cnd.repository";
51: private static String goldenDirectory;
52:
53: @Override
54: protected File getTestCaseDataDir() {
55: String dataPath = getDataDir().getAbsolutePath().replaceAll(
56: "repository", "modelimpl"); //NOI18N
57: String filePath = "common";
58: return Manager.normalizeFile(new File(dataPath, filePath));
59: }
60:
61: protected static String getGoldenDirectory() {
62: return goldenDirectory;
63: }
64:
65: protected static void setGoldenDirectory(String goldenDirectory) {
66: RepositoryValidationBase.goldenDirectory = goldenDirectory;
67: }
68:
69: protected final List<String> find() throws IOException {
70: List<String> list = new ArrayList<String>();
71: String dataPath = getDataDir().getAbsolutePath().replaceAll(
72: "repository", "modelimpl"); //NOI18N
73: list.add(dataPath + "/common/quote_nosyshdr"); //NOI18N
74: list.add(dataPath + "/org"); //NOI18N
75: // String path = getWorkDir().getAbsolutePath();
76: // assert (path.indexOf(moduleName) > -1);
77: // File root = new File(path.substring(0, path.indexOf(moduleName)));
78: // for (File m : root.listFiles()) {
79: // if (m.isDirectory()) {
80: // String testDataPath = m.getAbsolutePath() + File.separator + "test" + File.separator + "unit" + File.separator + "data" + File.separator + "org";
81: // if (
82: // // TODO: stackoverflow.cc failure
83: // testDataPath.indexOf("modelimpl")>0 ||
84: // // TODO: mixedPreprocDirectives.cc failure
85: // testDataPath.indexOf("folding")>0 ||
86: // // TODO: completion file.cc failure
87: // testDataPath.indexOf("completion")>0)
88: // {
89: // continue;
90: // }
91: // //
92: // if (new File(testDataPath).exists()) {
93: // list.add(testDataPath);
94: // }
95: // }
96: // }
97: return list;
98: }
99: }
|