Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Khouzam2012-01-24 21:53:30 -0500
committerMarc Khouzam2012-01-24 21:53:30 -0500
commite8a9e67b8cd5023a26ce824c6d27b4e4d28c2910 (patch)
treecda0b15d6406c55c2d9b6caeb14a09ee861f88bc
parentf8496f2693f92922d44923ee18f997caa82809b8 (diff)
downloadorg.eclipse.cdt-e8a9e67b8cd5023a26ce824c6d27b4e4d28c2910.tar.gz
org.eclipse.cdt-e8a9e67b8cd5023a26ce824c6d27b4e4d28c2910.tar.xz
org.eclipse.cdt-e8a9e67b8cd5023a26ce824c6d27b4e4d28c2910.zip
Bug 369583: [junit] Sessionless tests fail with NPE
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIBreakInsertCommand.java17
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMICommandConstructCommand.java20
2 files changed, 28 insertions, 9 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIBreakInsertCommand.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIBreakInsertCommand.java
index f4c416fa94..d12153056a 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIBreakInsertCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIBreakInsertCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Ericsson and others.
+ * Copyright (c) 2008, 2012 Ericsson 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
@@ -7,14 +7,18 @@
*
* Contributors:
* Ericsson - Initial Implementation
+ * Marc Khouzam (Ericsson) - Fix NPE (bug 369583)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.commands;
import static org.junit.Assert.assertEquals;
+import org.eclipse.cdt.dsf.concurrent.DefaultDsfExecutor;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
-import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert;
+import org.eclipse.cdt.dsf.gdb.service.command.GDBControlDMContext;
+import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
import org.junit.Test;
/**
@@ -46,15 +50,20 @@ public class TestMIBreakInsertCommand {
}
private class TestContext implements IBreakpointsTargetDMContext {
+ private DsfSession session = null;
+ public TestContext() {
+ session = DsfSession.startSession(new DefaultDsfExecutor(TestsPlugin.PLUGIN_ID), TestsPlugin.PLUGIN_ID);
+ }
+
@Override
public IDMContext[] getParents() {
- return null;
+ return new IDMContext[] {new GDBControlDMContext(getSessionId(), "1")};
}
@Override
public String getSessionId() {
- return null;
+ return session.getId();
}
@Override
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMICommandConstructCommand.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMICommandConstructCommand.java
index e3559fee57..1d085f4410 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMICommandConstructCommand.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMICommandConstructCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Ericsson and others.
+ * Copyright (c) 2008, 2012 Ericsson 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
@@ -7,14 +7,20 @@
*
* Contributors:
* Ericsson - Initial Implementation
+ * Marc Khouzam (Ericsson) - Fix NPE (bug 369583)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.commands;
import static org.junit.Assert.assertEquals;
+import org.eclipse.cdt.dsf.concurrent.DefaultDsfExecutor;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
+import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
+import org.eclipse.cdt.dsf.gdb.service.command.GDBControlDMContext;
import org.eclipse.cdt.dsf.mi.service.command.commands.MICommand;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
+import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
import org.junit.Test;
/**
@@ -46,16 +52,21 @@ public class TestMICommandConstructCommand {
result);
}
- private class TestContext implements IDMContext {
+ private class TestContext implements IBreakpointsTargetDMContext {
+ private DsfSession session = null;
+ public TestContext() {
+ session = DsfSession.startSession(new DefaultDsfExecutor(TestsPlugin.PLUGIN_ID), TestsPlugin.PLUGIN_ID);
+ }
+
@Override
public IDMContext[] getParents() {
- return null;
+ return new IDMContext[] {new GDBControlDMContext(getSessionId(), "1")};
}
@Override
public String getSessionId() {
- return null;
+ return session.getId();
}
@Override
@@ -63,7 +74,6 @@ public class TestMICommandConstructCommand {
public Object getAdapter(Class adapter) {
return null;
}
-
}
}

Back to the top