diff options
Diffstat (limited to 'dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/CommonDsfTest.java')
-rw-r--r-- | dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/CommonDsfTest.java | 216 |
1 files changed, 108 insertions, 108 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/CommonDsfTest.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/CommonDsfTest.java index 094bcb18f75..5182a0ad472 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/CommonDsfTest.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/CommonDsfTest.java @@ -1,109 +1,109 @@ -/*******************************************************************************
- * Copyright (c) 2017 Renesas Electronics 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
- *
- * Contributors:
- * Bruno Medeiros (Renesas) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.dsf.gdb.service;
-
-import static org.junit.Assert.fail;
-
-import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
-import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
-import org.eclipse.cdt.dsf.concurrent.DefaultDsfExecutor;
-import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
-import org.eclipse.cdt.dsf.debug.model.DsfLaunch;
-import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
-import org.eclipse.cdt.dsf.service.DsfSession;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.ISourceLocator;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-/**
- * Helper base class for running DSF related tests
- */
-public class CommonDsfTest extends CommonTest {
-
- protected static DsfSession fSession = null;
-
- /**
- * Setup the test.
- * The session is typically configured once per class load, but we allow subclasses to override this,
- * and sometimes re-setup during a test (or interactive debugging).
- * Therefore {@link Before} is used, not {@link BeforeClass}.
- */
- @Before
- public void setup() {
- if(fSession != null) {
- return; // Already set-up
- }
-
- doSetupSession();
- }
-
- protected void doSetupSession() {
- fSession = DsfSession.startSession(new DefaultDsfExecutor(GdbPlugin.PLUGIN_ID), GdbPlugin.PLUGIN_ID);
-
- registerLaunch();
- }
-
- @AfterClass
- public static void tearDown() {
- if(fSession != null) {
- DsfSession.endSession(fSession);
- fSession = null;
- }
- }
-
- protected ILaunchConfigurationType getCLaunchConfigType() {
- return getLaunchManager().getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_APP);
- }
-
- protected ILaunchManager getLaunchManager() {
- return DebugPlugin.getDefault().getLaunchManager();
- }
-
- protected void registerLaunch() {
- ILaunchConfigurationWorkingCopy lc;
- try {
- lc = getCLaunchConfigType().newInstance(null, "TestLaunch");
- } catch(CoreException e) {
- fail(e.getMessage());
- return;
- }
- ISourceLocator sourceLocator = null;
- DsfLaunch dsfLaunch = new DsfLaunch(lc, ILaunchManager.DEBUG_MODE, sourceLocator);
- fSession.registerModelAdapter(ILaunch.class, dsfLaunch);
- }
-
- protected RequestMonitor newRequestMonitor() {
- return new RequestMonitor(fSession.getExecutor(), null);
- }
-
- protected <T> DataRequestMonitor<T> newDataRequestMonitor() {
- return new DataRequestMonitor<>(fSession.getExecutor(), null);
- }
-}
-
-/**
- * Misc test utilities.
- */
-class CommonTest {
- /* ----------------- ----------------- */
-
- @SafeVarargs
- public static <T> T[] array(T... elems) {
- return elems;
- }
+/******************************************************************************* + * Copyright (c) 2017 Renesas Electronics 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 + * + * Contributors: + * Bruno Medeiros (Renesas) - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service; + +import static org.junit.Assert.fail; + +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; +import org.eclipse.cdt.dsf.concurrent.DefaultDsfExecutor; +import org.eclipse.cdt.dsf.concurrent.RequestMonitor; +import org.eclipse.cdt.dsf.debug.model.DsfLaunch; +import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.dsf.service.DsfSession; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.core.model.ISourceLocator; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; + +/** + * Helper base class for running DSF related tests + */ +public class CommonDsfTest extends CommonTest { + + protected static DsfSession fSession = null; + + /** + * Setup the test. + * The session is typically configured once per class load, but we allow subclasses to override this, + * and sometimes re-setup during a test (or interactive debugging). + * Therefore {@link Before} is used, not {@link BeforeClass}. + */ + @Before + public void setup() { + if(fSession != null) { + return; // Already set-up + } + + doSetupSession(); + } + + protected void doSetupSession() { + fSession = DsfSession.startSession(new DefaultDsfExecutor(GdbPlugin.PLUGIN_ID), GdbPlugin.PLUGIN_ID); + + registerLaunch(); + } + + @AfterClass + public static void tearDown() { + if(fSession != null) { + DsfSession.endSession(fSession); + fSession = null; + } + } + + protected ILaunchConfigurationType getCLaunchConfigType() { + return getLaunchManager().getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_APP); + } + + protected ILaunchManager getLaunchManager() { + return DebugPlugin.getDefault().getLaunchManager(); + } + + protected void registerLaunch() { + ILaunchConfigurationWorkingCopy lc; + try { + lc = getCLaunchConfigType().newInstance(null, "TestLaunch"); + } catch(CoreException e) { + fail(e.getMessage()); + return; + } + ISourceLocator sourceLocator = null; + DsfLaunch dsfLaunch = new DsfLaunch(lc, ILaunchManager.DEBUG_MODE, sourceLocator); + fSession.registerModelAdapter(ILaunch.class, dsfLaunch); + } + + protected RequestMonitor newRequestMonitor() { + return new RequestMonitor(fSession.getExecutor(), null); + } + + protected <T> DataRequestMonitor<T> newDataRequestMonitor() { + return new DataRequestMonitor<>(fSession.getExecutor(), null); + } +} + +/** + * Misc test utilities. + */ +class CommonTest { + /* ----------------- ----------------- */ + + @SafeVarargs + public static <T> T[] array(T... elems) { + return elems; + } }
\ No newline at end of file |