This is an automated email from the ASF dual-hosted git repository.

vieiro pushed a commit to branch cnd
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/cnd by this push:
     new 9feca6f  [cnd] small-1.5 More cnd tests (#3419)
9feca6f is described below

commit 9feca6f8a5fd873751e6ff0ffe3db4e3c1a02840
Author: Antonio Vieiro <vie...@apache.org>
AuthorDate: Thu Jan 6 20:14:02 2022 +0100

    [cnd] small-1.5 More cnd tests (#3419)
    
    * [cnd] small-1.5 More cnd tests
---
 cnd/cnd.remote/nbproject/project.xml               | 17 ----
 .../cnd/remote/fs/FullRemoteCodeModelTestCase.java | 91 +++++++++++-----------
 .../cnd/remote/fs/RemoteCodeModelTestCase.java     | 47 +++++------
 .../cnd/remote/full/FullRemoteBuildTestCase.java   | 25 +++---
 .../cnd/remote/test/RemoteBuildTestBase.java       | 87 +++++++++++----------
 .../toolchain/api/ValidateRegistryTestCase.java    |  4 +
 .../modules/cnd/test/CndCoreTestUtils.java         | 28 ++++++-
 7 files changed, 161 insertions(+), 138 deletions(-)

diff --git a/cnd/cnd.remote/nbproject/project.xml 
b/cnd/cnd.remote/nbproject/project.xml
index 021e1aa..3dc77f9 100644
--- a/cnd/cnd.remote/nbproject/project.xml
+++ b/cnd/cnd.remote/nbproject/project.xml
@@ -225,10 +225,6 @@
                         <test/>
                     </test-dependency>
                     <test-dependency>
-                        
<code-name-base>org.netbeans.modules.cnd.api.model</code-name-base>
-                        <compile-dependency/>
-                    </test-dependency>
-                    <test-dependency>
                         
<code-name-base>org.netbeans.modules.cnd.api.project</code-name-base>
                         <compile-dependency/>
                     </test-dependency>
@@ -247,19 +243,6 @@
                         <compile-dependency/>
                     </test-dependency>
                     <test-dependency>
-                        
<code-name-base>org.netbeans.modules.cnd.modelimpl</code-name-base>
-                        <recursive/>
-                        <compile-dependency/>
-                    </test-dependency>
-                    <test-dependency>
-                        
<code-name-base>org.netbeans.modules.cnd.repository</code-name-base>
-                        <compile-dependency/>
-                    </test-dependency>
-                    <test-dependency>
-                        
<code-name-base>org.netbeans.modules.cnd.repository.api</code-name-base>
-                        <compile-dependency/>
-                    </test-dependency>
-                    <test-dependency>
                         
<code-name-base>org.netbeans.modules.cnd.script</code-name-base>
                         <compile-dependency/>
                     </test-dependency>
diff --git 
a/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/fs/FullRemoteCodeModelTestCase.java
 
b/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/fs/FullRemoteCodeModelTestCase.java
index 53b66f5..6708bbb 100644
--- 
a/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/fs/FullRemoteCodeModelTestCase.java
+++ 
b/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/fs/FullRemoteCodeModelTestCase.java
@@ -28,17 +28,17 @@ import static junit.framework.TestCase.assertTrue;
 import org.netbeans.api.project.Project;
 import org.netbeans.api.project.ProjectManager;
 import org.netbeans.api.project.ui.OpenProjects;
-import org.netbeans.modules.cnd.api.model.CsmFile;
-import org.netbeans.modules.cnd.api.model.CsmModelAccessor;
-import org.netbeans.modules.cnd.api.model.CsmOffsetableDeclaration;
-import org.netbeans.modules.cnd.api.model.CsmProject;
-import org.netbeans.modules.cnd.indexing.impl.TextIndexStorageManager;
+//import org.netbeans.modules.cnd.api.model.CsmFile;
+//import org.netbeans.modules.cnd.api.model.CsmModelAccessor;
+//import org.netbeans.modules.cnd.api.model.CsmOffsetableDeclaration;
+//import org.netbeans.modules.cnd.api.model.CsmProject;
+//import org.netbeans.modules.cnd.indexing.impl.TextIndexStorageManager;
 import org.netbeans.modules.cnd.makeproject.api.MakeProject;
-import org.netbeans.modules.cnd.modelimpl.csm.core.ModelImpl;
-import org.netbeans.modules.cnd.modelimpl.platform.ModelSupport;
+//import org.netbeans.modules.cnd.modelimpl.csm.core.ModelImpl;
+//import org.netbeans.modules.cnd.modelimpl.platform.ModelSupport;
 import org.netbeans.modules.cnd.remote.test.RemoteBuildTestBase;
 import org.netbeans.modules.cnd.remote.test.RemoteDevelopmentTest;
-import org.netbeans.modules.cnd.repository.support.RepositoryTestUtils;
+//import org.netbeans.modules.cnd.repository.support.RepositoryTestUtils;
 import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
 import org.netbeans.modules.nativeexecution.api.util.CommonTasksSupport;
 import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
@@ -47,6 +47,9 @@ import org.netbeans.modules.remote.spi.FileSystemProvider;
 import org.openide.filesystems.FileObject;
 import org.openide.filesystems.FileUtil;
 
+// NOTE: Some tests commented out since Apache NetBeans does not use the
+// donated cnd.api.model, cnd.indexing, cnd.modelimpl and cnd.repository 
modules.
+
 /**
  *
  */
@@ -59,32 +62,32 @@ public class FullRemoteCodeModelTestCase extends 
RemoteBuildTestBase {
     @Override
     protected void setUp() throws Exception {
         super.setUp();
-        startupModel();
+//        startupModel();
         System.setProperty("cnd.mode.unittest", "true");
         System.setProperty("org.netbeans.modules.cnd.apt.level", "OFF"); // 
NOI18N
         
Logger.getLogger("org.netbeans.modules.editor.settings.storage.Utils").setLevel(Level.SEVERE);
     }
 
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        shutdownModel();
-    }
-
-    private void shutdownModel() {
-        ModelImpl model = (ModelImpl) CsmModelAccessor.getModel();
-        model.shutdown();
-        ModelSupport.instance().shutdown();
-        TextIndexStorageManager.shutdown();
-        RepositoryTestUtils.deleteDefaultCacheLocation();
-    }
-
-    private void startupModel() {
-        RepositoryTestUtils.deleteDefaultCacheLocation();
-        ModelImpl model = (ModelImpl) CsmModelAccessor.getModel();
-        model.startup();
-        ModelSupport.instance().startup();
-    }
+//    @Override
+//    protected void tearDown() throws Exception {
+//        super.tearDown();
+//        shutdownModel();
+//    }
+//
+//    private void shutdownModel() {
+//        ModelImpl model = (ModelImpl) CsmModelAccessor.getModel();
+//        model.shutdown();
+//        ModelSupport.instance().shutdown();
+//        TextIndexStorageManager.shutdown();
+//        RepositoryTestUtils.deleteDefaultCacheLocation();
+//    }
+//
+//    private void startupModel() {
+//        RepositoryTestUtils.deleteDefaultCacheLocation();
+//        ModelImpl model = (ModelImpl) CsmModelAccessor.getModel();
+//        model.startup();
+//        ModelSupport.instance().startup();
+//    }
 
     protected void processSample(String sampleName) throws Exception {
         final ExecutionEnvironment execEnv = getTestExecutionEnvironment();
@@ -99,7 +102,7 @@ public class FullRemoteCodeModelTestCase extends 
RemoteBuildTestBase {
             assertTrue("Should be remote: " + 
makeProject.getProjectDirectory(), 
FileSystemProvider.getExecutionEnvironment(makeProject.getProjectDirectory()).isRemote());
             assertTrue("Host should be connected at this point", 
ConnectionManager.getInstance().isConnectedTo(execEnv));
             OpenProjects.getDefault().open(new Project[]{makeProject}, false);
-            checkCodeModel(makeProject);
+//            checkCodeModel(makeProject);
         } finally {
             if (remoteTempDir != null) {
                 CommonTasksSupport.rmDir(execEnv, remoteTempDir, true, new 
OutputStreamWriter(System.err));
@@ -107,20 +110,20 @@ public class FullRemoteCodeModelTestCase extends 
RemoteBuildTestBase {
         }        
     }
     
-    @Override
-    protected void checkCodeModel(MakeProject makeProject) throws Exception {
-        CsmProject csmProject = getCsmProject(makeProject);
-        assertNotNull("Null CsmProject", csmProject);
-        csmProject.waitParse();
-        Collection<CsmFile> allFiles = csmProject.getAllFiles();
-        assertEquals("Expected amount of csm files ", 1, allFiles.size());
-        CsmFile mainFile = allFiles.iterator().next();
-        Collection<CsmOffsetableDeclaration> decls = 
mainFile.getDeclarations();
-        assertEquals("Excpected amount of declarations", 1, decls.size());
-        CsmOffsetableDeclaration decl = decls.iterator().next();
-        assertEquals("Declaration name", "main", decl.getName().toString());
-        assertTrue("File object should be remote", 
FileSystemProvider.getExecutionEnvironment(mainFile.getFileObject()).isRemote());
-    }
+//    @Override
+//    protected void checkCodeModel(MakeProject makeProject) throws Exception {
+//        CsmProject csmProject = getCsmProject(makeProject);
+//        assertNotNull("Null CsmProject", csmProject);
+//        csmProject.waitParse();
+//        Collection<CsmFile> allFiles = csmProject.getAllFiles();
+//        assertEquals("Expected amount of csm files ", 1, allFiles.size());
+//        CsmFile mainFile = allFiles.iterator().next();
+//        Collection<CsmOffsetableDeclaration> decls = 
mainFile.getDeclarations();
+//        assertEquals("Excpected amount of declarations", 1, decls.size());
+//        CsmOffsetableDeclaration decl = decls.iterator().next();
+//        assertEquals("Declaration name", "main", decl.getName().toString());
+//        assertTrue("File object should be remote", 
FileSystemProvider.getExecutionEnvironment(mainFile.getFileObject()).isRemote());
+//    }
 
     @ForAllEnvironments
     public void testArguments() throws Exception {
diff --git 
a/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/fs/RemoteCodeModelTestCase.java
 
b/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/fs/RemoteCodeModelTestCase.java
index 8e9cf1c..5824120 100644
--- 
a/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/fs/RemoteCodeModelTestCase.java
+++ 
b/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/fs/RemoteCodeModelTestCase.java
@@ -26,17 +26,20 @@ import junit.framework.Test;
 import org.netbeans.api.project.Project;
 import org.netbeans.api.project.ui.OpenProjects;
 import org.netbeans.junit.RandomlyFails;
-import org.netbeans.modules.cnd.api.model.CsmModelAccessor;
-import org.netbeans.modules.cnd.indexing.impl.TextIndexStorageManager;
+//import org.netbeans.modules.cnd.api.model.CsmModelAccessor;
+//import org.netbeans.modules.cnd.indexing.impl.TextIndexStorageManager;
 import org.netbeans.modules.cnd.makeproject.api.MakeProject;
-import org.netbeans.modules.cnd.modelimpl.csm.core.ModelImpl;
-import org.netbeans.modules.cnd.modelimpl.platform.ModelSupport;
+//import org.netbeans.modules.cnd.modelimpl.csm.core.ModelImpl;
+//import org.netbeans.modules.cnd.modelimpl.platform.ModelSupport;
 import org.netbeans.modules.cnd.remote.test.RemoteDevelopmentTest;
-import org.netbeans.modules.cnd.repository.support.RepositoryTestUtils;
+//import org.netbeans.modules.cnd.repository.support.RepositoryTestUtils;
 import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
 import org.netbeans.modules.nativeexecution.api.util.ConnectionManager;
 import org.netbeans.modules.nativeexecution.test.ForAllEnvironments;
 
+// NOTE: Some tests commented out since Apache NetBeans does not use the
+// donated "cnd.api.model, cnd.indexing, cnd.modelimpl and cnd.repository 
modules.
+
 /**
  *
  */
@@ -51,7 +54,7 @@ public class RemoteCodeModelTestCase extends 
RemoteBuildTestBase {
     @Override
     protected void setUp() throws Exception {
         super.setUp();
-        startupModel();
+//        startupModel();
         System.setProperty("cnd.mode.unittest", "true");
         System.setProperty("org.netbeans.modules.cnd.apt.level","OFF"); // 
NOI18N
         
Logger.getLogger("org.netbeans.modules.editor.settings.storage.Utils").setLevel(Level.SEVERE);
@@ -60,24 +63,24 @@ public class RemoteCodeModelTestCase extends 
RemoteBuildTestBase {
     @Override
     protected void tearDown() throws Exception {
         super.tearDown(); 
-        shutdownModel();
+//        shutdownModel();
     }
     
     
-    private void shutdownModel() {
-        ModelImpl model = (ModelImpl) CsmModelAccessor.getModel();
-        model.shutdown();
-        ModelSupport.instance().shutdown();
-        TextIndexStorageManager.shutdown();
-        RepositoryTestUtils.deleteDefaultCacheLocation();
-    }    
-
-    private void startupModel() {
-        RepositoryTestUtils.deleteDefaultCacheLocation();
-        ModelImpl model = (ModelImpl) CsmModelAccessor.getModel();
-        model.startup();
-        ModelSupport.instance().startup();        
-    }
+//    private void shutdownModel() {
+//        ModelImpl model = (ModelImpl) CsmModelAccessor.getModel();
+//        model.shutdown();
+//        ModelSupport.instance().shutdown();
+//        TextIndexStorageManager.shutdown();
+//        RepositoryTestUtils.deleteDefaultCacheLocation();
+//    }    
+//
+//    private void startupModel() {
+//        RepositoryTestUtils.deleteDefaultCacheLocation();
+//        ModelImpl model = (ModelImpl) CsmModelAccessor.getModel();
+//        model.startup();
+//        ModelSupport.instance().startup();        
+//    }
 
     @Override
     protected void clearRemoteSyncRoot() {
@@ -97,7 +100,7 @@ public class RemoteCodeModelTestCase extends 
RemoteBuildTestBase {
         }
         OpenProjects.getDefault().open(new Project[]{ makeProject }, false);
         changeProjectHost(makeProject, execEnv);
-        checkCodeModel(makeProject);
+//        checkCodeModel(makeProject);
         if (testReconnect) {
             ConnectionManager.getInstance().connectTo(execEnv);
             assertTrue("Can not reconnect to host", 
ConnectionManager.getInstance().isConnectedTo(execEnv));
diff --git 
a/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/full/FullRemoteBuildTestCase.java
 
b/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/full/FullRemoteBuildTestCase.java
index f0582b5..ee8298a 100644
--- 
a/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/full/FullRemoteBuildTestCase.java
+++ 
b/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/full/FullRemoteBuildTestCase.java
@@ -28,7 +28,7 @@ import junit.framework.AssertionFailedError;
 import org.netbeans.modules.cnd.remote.test.RemoteBuildTestBase;
 import junit.framework.Test;
 import org.netbeans.api.project.ProjectManager;
-import org.netbeans.modules.cnd.api.model.CsmProject;
+//import org.netbeans.modules.cnd.api.model.CsmProject;
 import org.netbeans.modules.cnd.makeproject.api.MakeProject;
 import org.netbeans.modules.cnd.remote.test.RemoteDevelopmentTest;
 import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
@@ -40,6 +40,9 @@ import org.netbeans.modules.remote.spi.FileSystemProvider;
 import org.netbeans.spi.project.ActionProvider;
 import org.openide.filesystems.FileObject;
 
+// NOTE: Some tests commented out since Apache NetBeans does not use the
+// donated "cnd.api.model, cnd.indexing, cnd.modelimpl and cnd.repository 
modules.
+
 /**
  */
 public class FullRemoteBuildTestCase extends RemoteBuildTestBase {
@@ -105,21 +108,21 @@ public class FullRemoteBuildTestCase extends 
RemoteBuildTestBase {
         FileObject headerFO = parentFO.getFileObject(origHeaderName);
         assertNotNull(headerFO);
         headerFO.delete();
-        CsmProject csmProject = getCsmProject(makeProject);
+//        CsmProject csmProject = getCsmProject(makeProject);
         AtomicReference<AssertionFailedError> exRef = new AtomicReference<>();
-        try {
-            checkCodeModel(makeProject);
-        } catch (AssertionFailedError ex) {
-            exRef.set(ex);
-        }
+//        try {
+//            checkCodeModel(makeProject);
+//        } catch (AssertionFailedError ex) {
+//            exRef.set(ex);
+//        }
         AssertionFailedError ex = exRef.get();
         assertNotNull(ex);
         String messageStart = "Unresolved include";
         assertTrue("Unexpected exception " + ex.getMessage() + ", expected " + 
messageStart  , ex.getMessage().startsWith(messageStart));
         headerFO = parentFO.createData(origHeaderName);
         sleep(1);
-        csmProject.waitParse();
-        checkCodeModel(makeProject);
+//        csmProject.waitParse();
+//        checkCodeModel(makeProject);
     }
 
     @ForAllEnvironments
@@ -137,13 +140,13 @@ public class FullRemoteBuildTestCase extends 
RemoteBuildTestBase {
     @ForAllEnvironments
     public void testFullRemoteCodeModelSimple() throws Exception {
         MakeProject makeProject = 
importProject("simple_make_project_to_import", false);
-        checkCodeModel(makeProject);
+//        checkCodeModel(makeProject);
     }
     
     @ForAllEnvironments
     public void testFullRemoteCodeModelLink() throws Exception {
         MakeProject makeProject = 
importProject("simple_make_project_to_import", true);
-        checkCodeModel(makeProject);
+//        checkCodeModel(makeProject);
     }
     
     // hg filters out "nbproject/private", for that reason we have to rewname 
it and restore correct name while copying
diff --git 
a/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/test/RemoteBuildTestBase.java
 
b/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/test/RemoteBuildTestBase.java
index ff081de..cd587d5 100644
--- 
a/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/test/RemoteBuildTestBase.java
+++ 
b/cnd/cnd.remote/test/unit/src/org/netbeans/modules/cnd/remote/test/RemoteBuildTestBase.java
@@ -32,11 +32,11 @@ import java.util.concurrent.atomic.AtomicReference;
 import javax.swing.SwingUtilities;
 import org.netbeans.api.annotations.common.SuppressWarnings;
 import org.netbeans.api.project.ProjectManager;
-import org.netbeans.modules.cnd.api.model.CsmFile;
-import org.netbeans.modules.cnd.api.model.CsmInclude;
-import org.netbeans.modules.cnd.api.model.CsmModel;
-import org.netbeans.modules.cnd.api.model.CsmModelAccessor;
-import org.netbeans.modules.cnd.api.model.CsmProject;
+//import org.netbeans.modules.cnd.api.model.CsmFile;
+//import org.netbeans.modules.cnd.api.model.CsmInclude;
+//import org.netbeans.modules.cnd.api.model.CsmModel;
+//import org.netbeans.modules.cnd.api.model.CsmModelAccessor;
+//import org.netbeans.modules.cnd.api.model.CsmProject;
 import org.netbeans.modules.cnd.api.project.NativeProject;
 import org.netbeans.modules.cnd.api.remote.RemoteFileUtil;
 import org.netbeans.modules.cnd.api.remote.ServerList;
@@ -56,7 +56,7 @@ import 
org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfiguration
 import 
org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfigurationDescriptor;
 import org.netbeans.modules.cnd.makeproject.api.ui.wizard.WizardConstants;
 import 
org.netbeans.modules.cnd.makeproject.ui.wizards.MakeSampleProjectIterator;
-import org.netbeans.modules.cnd.modelimpl.csm.core.ModelImpl;
+//import org.netbeans.modules.cnd.modelimpl.csm.core.ModelImpl;
 import org.netbeans.modules.cnd.remote.server.RemoteServerRecord;
 import org.netbeans.modules.cnd.spi.remote.RemoteSyncFactory;
 import org.netbeans.modules.cnd.utils.FSPath;
@@ -75,6 +75,9 @@ import org.openide.loaders.DataObjectNotFoundException;
 import org.openide.loaders.TemplateWizard;
 import org.openide.nodes.Node;
 
+// NOTE: Some tests commented out since Apache NetBeans does not use the
+// donated cnd.api.model, cnd.indexing, cnd.modelimpl and cnd.repository 
modules.
+
 /**
  * A common base class for tests that build remote project
  */
@@ -365,42 +368,42 @@ public class RemoteBuildTestBase extends RemoteTestBase {
         }
     }
 
-    protected CsmProject getCsmProject(MakeProject makeProject) throws 
Exception {
-        NativeProject np = makeProject.getLookup().lookup(NativeProject.class);
-        assertNotNull("Null NativeProject", np);
-        CsmModel model = CsmModelAccessor.getModel();
-        ((ModelImpl) model).enableProject(np);
-        CsmProject csmProject = model.getProject(makeProject);
-        return csmProject;
-    }
-    
-    protected void checkCodeModel(MakeProject makeProject) throws Exception {
-        CsmProject csmProject = getCsmProject(makeProject);
-        assertNotNull("Null CsmProject", csmProject);
-        csmProject.waitParse();
-        checkIncludes(csmProject, true);
-    }
-        
-    protected void checkIncludes(CsmFile csmFile, boolean recursive, 
Set<CsmFile> antiLoop) throws Exception {
-        if (!antiLoop.contains(csmFile)) {
-            antiLoop.add(csmFile);
-            trace("Checking %s\n", csmFile.getAbsolutePath());
-            for (CsmInclude incl : csmFile.getIncludes()) {
-                CsmFile includedFile = incl.getIncludeFile();
-                trace("\t%s -> %s\n", incl.getIncludeName(), includedFile);
-                assertNotNull("Unresolved include: " + incl.getIncludeName() + 
" in " + csmFile.getAbsolutePath(), includedFile);
-                if (recursive) {
-                    checkIncludes(includedFile, true, antiLoop);
-                }
-            }
-        }
-    }
-
-    protected void checkIncludes(CsmProject csmProject, boolean recursive) 
throws Exception {
-        for (CsmFile csmFile : csmProject.getAllFiles()) {
-            checkIncludes(csmFile, recursive, new HashSet<CsmFile>());
-        }
-    }
+//    protected CsmProject getCsmProject(MakeProject makeProject) throws 
Exception {
+//        NativeProject np = 
makeProject.getLookup().lookup(NativeProject.class);
+//        assertNotNull("Null NativeProject", np);
+//        CsmModel model = CsmModelAccessor.getModel();
+//        ((ModelImpl) model).enableProject(np);
+//        CsmProject csmProject = model.getProject(makeProject);
+//        return csmProject;
+//    }
+//    
+//    protected void checkCodeModel(MakeProject makeProject) throws Exception {
+//        CsmProject csmProject = getCsmProject(makeProject);
+//        assertNotNull("Null CsmProject", csmProject);
+//        csmProject.waitParse();
+//        checkIncludes(csmProject, true);
+//    }
+//        
+//    protected void checkIncludes(CsmFile csmFile, boolean recursive, 
Set<CsmFile> antiLoop) throws Exception {
+//        if (!antiLoop.contains(csmFile)) {
+//            antiLoop.add(csmFile);
+//            trace("Checking %s\n", csmFile.getAbsolutePath());
+//            for (CsmInclude incl : csmFile.getIncludes()) {
+//                CsmFile includedFile = incl.getIncludeFile();
+//                trace("\t%s -> %s\n", incl.getIncludeName(), includedFile);
+//                assertNotNull("Unresolved include: " + incl.getIncludeName() 
+ " in " + csmFile.getAbsolutePath(), includedFile);
+//                if (recursive) {
+//                    checkIncludes(includedFile, true, antiLoop);
+//                }
+//            }
+//        }
+//    }
+//
+//    protected void checkIncludes(CsmProject csmProject, boolean recursive) 
throws Exception {
+//        for (CsmFile csmFile : csmProject.getAllFiles()) {
+//            checkIncludes(csmFile, recursive, new HashSet<CsmFile>());
+//        }
+//    }
     
     protected void trace(String pattern, Object... args) {
         if (trace) {
diff --git 
a/cnd/cnd.toolchain/test/unit/src/org/netbeans/modules/cnd/toolchain/api/ValidateRegistryTestCase.java
 
b/cnd/cnd.toolchain/test/unit/src/org/netbeans/modules/cnd/toolchain/api/ValidateRegistryTestCase.java
index 1566ec0..9854369 100644
--- 
a/cnd/cnd.toolchain/test/unit/src/org/netbeans/modules/cnd/toolchain/api/ValidateRegistryTestCase.java
+++ 
b/cnd/cnd.toolchain/test/unit/src/org/netbeans/modules/cnd/toolchain/api/ValidateRegistryTestCase.java
@@ -87,6 +87,10 @@ public class ValidateRegistryTestCase extends NbTestCase {
             public void error(SAXParseException exception) throws SAXException 
{
                 if ("Document is invalid: no grammar 
found.".equals(exception.getMessage())) {
                     return;
+                } else if ("El documento no es válido: no se ha encontrado la 
gramática.".equals(exception.getMessage())) {
+                    return;
+                } else if ("El elemento raíz del documento 
\"toolchaindefinition\", debe coincidir con la raíz DOCTYPE 
\"null\".".equals(exception.getMessage()) ) {
+                    return;
                 } else if ("Document root element \"toolchaindefinition\", 
must match DOCTYPE root \"null\".".equals(exception.getMessage())) {
                     return;
                 }
diff --git 
a/cnd/cnd/test/unit/src/org/netbeans/modules/cnd/test/CndCoreTestUtils.java 
b/cnd/cnd/test/unit/src/org/netbeans/modules/cnd/test/CndCoreTestUtils.java
index 18b0ef7..2495fed 100644
--- a/cnd/cnd/test/unit/src/org/netbeans/modules/cnd/test/CndCoreTestUtils.java
+++ b/cnd/cnd/test/unit/src/org/netbeans/modules/cnd/test/CndCoreTestUtils.java
@@ -33,7 +33,6 @@ import javax.swing.text.StyledDocument;
 import org.netbeans.editor.BaseDocument;
 import org.netbeans.editor.Utilities;
 import org.netbeans.junit.Manager;
-import org.netbeans.modules.cnd.modelutil.CsmUtilities;
 import org.openide.cookies.EditorCookie;
 import org.openide.filesystems.FileUtil;
 import org.openide.loaders.DataObject;
@@ -73,6 +72,31 @@ public class CndCoreTestUtils {
         } 
         return editor[0];
     }
+
+    /**
+     * This method taken from from contrib/cnd.modelutil:
+     * opens document even if it is very big by silently confirming open
+     * @param cookie
+     * @return
+     */
+    private static StyledDocument openDocument(EditorCookie cookie) {
+        if (cookie == null) {
+            return null;
+        }
+        StyledDocument document = null;
+        try {
+            try {
+                document = cookie.openDocument();
+            } catch (Exception e) {
+                document = cookie.openDocument();
+            }
+        } catch(Exception e) {
+            // no need to report
+        }
+        cookie.prepareDocument().waitFinished();
+        return document;
+    }
+
     
     public static BaseDocument getBaseDocument(final DataObject dob) throws 
Exception {
         EditorCookie  cookie = dob.getCookie(EditorCookie.class);
@@ -81,7 +105,7 @@ public class CndCoreTestUtils {
             throw new IllegalStateException("Given file (\"" + dob.getName() + 
"\") does not have EditorCookie."); // NOI18N
         }
         
-        StyledDocument doc = CsmUtilities.openDocument(cookie);
+        StyledDocument doc = openDocument(cookie);
         return doc instanceof BaseDocument ? (BaseDocument)doc : null;
     }
     

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to