Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions cnd/cnd.remote/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,6 @@
<compile-dependency/>
<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/>
Expand All @@ -246,19 +242,6 @@
<recursive/>
<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/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
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;
Expand All @@ -47,6 +47,9 @@
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.

/**
*
*/
Expand All @@ -59,32 +62,32 @@ public FullRemoteCodeModelTestCase(String testName, ExecutionEnvironment execEnv
@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();
Expand All @@ -99,28 +102,28 @@ protected void processSample(String sampleName) throws Exception {
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));
}
}
}

@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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,20 @@
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.

/**
*
*/
Expand All @@ -51,7 +54,7 @@ public RemoteCodeModelTestCase(String testName, ExecutionEnvironment execEnv) {
@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);
Expand All @@ -60,24 +63,24 @@ protected void setUp() throws Exception {
@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() {
Expand All @@ -97,7 +100,7 @@ protected void processSample(Toolchain toolchain, String sampleName, String proj
}
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
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;
Expand All @@ -40,6 +40,9 @@
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 {
Expand Down Expand Up @@ -105,21 +108,21 @@ public void test_iz_249533() throws Exception {
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
Expand All @@ -137,13 +140,13 @@ public void testFullRemoteBuildLink() throws Exception {
@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
Expand Down
Loading