Permalink
Browse files

remove references to junit and old code

  • Loading branch information...
1 parent 33d8d7d commit 5c08d1946be95d2553e3e5d38e9df02d624ba1ef @JPMoresmau committed Nov 15, 2012
@@ -15,8 +15,6 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.jface.text;bundle-version="3.2.0",
org.eclipse.ui.ide,
org.eclipse.core.filesystem,
- org.eclipse.jdt.core;resolution:=optional,
- org.eclipse.jdt.junit;bundle-version="3.5.0";resolution:=optional,
org.eclipse.ui.workbench.texteditor,
org.eclipse.ui.editors,
net.sf.eclipsefp.haskell.buildwrapper
@@ -5,21 +5,14 @@
import java.util.Random;
import javax.xml.parsers.DocumentBuilderFactory;
import net.sf.eclipsefp.haskell.debug.core.internal.HaskellDebugCore;
-import net.sf.eclipsefp.haskell.debug.core.internal.util.CoreTexts;
import net.sf.eclipsefp.haskell.debug.core.test.ITestListener;
import net.sf.eclipsefp.haskell.debug.core.test.TestListenerManager;
import net.sf.eclipsefp.haskell.debug.core.test.TestResult;
import net.sf.eclipsefp.haskell.debug.core.test.TestStatus;
import net.sf.eclipsefp.haskell.debug.core.test.TestSuite;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.jdt.internal.junit.model.JUnitModel;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -127,39 +120,39 @@ protected void postProcessFinished(final ILaunchConfiguration configuration) {
}
} catch (Throwable t){
HaskellDebugCore.log( t.getLocalizedMessage(), t );
+ } finally {
+ // Always delete the file at the end
+ file.delete();
}
- // final TestSuiteAndSession session = TestSuiteAndSession.parseFile( file );
-
- if (canShowJUnit()) {
- Display.getDefault().syncExec( new Runnable() {
-
- @Override
- public void run() {
- try {
- IWorkbenchPage page = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage();
- page.showView( JUNIT_VIEW );
- // JUnitCorePlugin.getModel().addTestRunSession( session );
- JUnitModel.importTestRunSession( file );
- } catch( CoreException e ) {
- // Do nothing
- }
- }
- } );
- } else {
- Display.getCurrent().syncExec( new Runnable() {
-
- @Override
- public void run() {
- MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- CoreTexts.jdt_notFound_title, CoreTexts.jdt_notFound_message );
- }
- } );
- }
+// if (canShowJUnit()) {
+// Display.getDefault().syncExec( new Runnable() {
+//
+// @Override
+// public void run() {
+// try {
+// IWorkbenchPage page = PlatformUI.getWorkbench()
+// .getActiveWorkbenchWindow().getActivePage();
+// page.showView( JUNIT_VIEW );
+// // JUnitCorePlugin.getModel().addTestRunSession( session );
+// JUnitModel.importTestRunSession( file );
+// } catch( CoreException e ) {
+// // Do nothing
+// }
+// }
+// } );
+// } else {
+// Display.getCurrent().syncExec( new Runnable() {
+//
+// @Override
+// public void run() {
+// MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+// CoreTexts.jdt_notFound_title, CoreTexts.jdt_notFound_message );
+// }
+// } );
+// }
+
- // Always delete the file at the end
- new File( getFilename() ).delete();
}
/* (non-Javadoc)
@@ -1,17 +0,0 @@
-package net.sf.eclipsefp.haskell.debug.core.internal.xml;
-
-/**
- * Constants for parsing test-framework XML output.
- * @author Alejandro Serrano
- *
- */
-public interface IXMLTags {
- static final String ELEMENT_TESTSUITE = "testsuite"; //$NON-NLS-1$
- static final String ELEMENT_TESTCASE = "testcase"; //$NON-NLS-1$
- static final String ELEMENT_FAILURE = "failure"; //$NON-NLS-1$
-
- static final String ATTRIB_NAME = "name"; //$NON-NLS-1$
- static final String DEFAULT_NAME = ""; //$NON-NLS-1$
- static final String ATTRIB_TIME = "time"; //$NON-NLS-1$
- static final String DEFAULT_TIME = "0"; //$NON-NLS-1$
-}
@@ -1,88 +0,0 @@
-package net.sf.eclipsefp.haskell.debug.core.internal.xml;
-
-import org.eclipse.jdt.junit.model.ITestCaseElement;
-import org.eclipse.jdt.junit.model.ITestElementContainer;
-import org.eclipse.jdt.junit.model.ITestRunSession;
-import org.jdom.Element;
-
-/**
- * Represents a JUnit testcase, used in the presentation of
- * test-framework test resuts.
- * The code was taken from Eclipse JDT.
- * @author Alejandro Serrano
- *
- */
-public class TestCase implements ITestCaseElement {
-
- private final ITestElementContainer parent;
- private final ITestRunSession session;
- private String name;
- private double time;
- private FailureTrace trace;
-
- public TestCase( final Element elt,
- final ITestElementContainer parent, final ITestRunSession session ) {
- this.parent = parent;
- this.session = session;
- initialize(elt);
- }
-
- private void initialize( final Element elt ) {
- this.name = elt.getAttributeValue( IXMLTags.ATTRIB_NAME, IXMLTags.DEFAULT_NAME );
- try {
- String timeVal = elt.getAttributeValue( IXMLTags.ATTRIB_TIME,
- IXMLTags.DEFAULT_TIME );
- time = Double.parseDouble( timeVal );
- } catch( NumberFormatException e ) {
- time = 0;
- }
-
- Element failure = elt.getChild( IXMLTags.ELEMENT_FAILURE );
- if (failure == null) {
- trace = null; // The result was OK
- } else {
- trace = new FailureTrace( failure.getText(), null, null );
- }
- }
-
- @Override
- public String getTestMethodName() {
- return name;
- }
-
- @Override
- public Result getTestResult( final boolean includeChildren ) {
- return trace != null ? Result.FAILURE : Result.OK;
- }
-
- @Override
- public double getElapsedTimeInSeconds() {
- return time;
- }
-
- @Override
- public FailureTrace getFailureTrace() {
- return trace;
- }
-
- @Override
- public ITestElementContainer getParentContainer() {
- return parent;
- }
-
- @Override
- public ITestRunSession getTestRunSession() {
- return session;
- }
-
- @Override
- public ProgressState getProgressState() {
- return ProgressState.COMPLETED;
- }
-
- @Override
- public String getTestClassName() {
- return null;
- }
-
-}
@@ -1,142 +0,0 @@
-package net.sf.eclipsefp.haskell.debug.core.internal.xml;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.junit.model.ITestElement;
-import org.eclipse.jdt.junit.model.ITestElementContainer;
-import org.eclipse.jdt.junit.model.ITestRunSession;
-import org.eclipse.jdt.junit.model.ITestSuiteElement;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.input.SAXBuilder;
-
-/**
- * Represents a group or entire session in a JUnit file,
- * used here to represent test-framework tests.
- * This file is derived from the work in Eclipse JDT.
- * @author Alejandro Serrano
- *
- */
-public class TestSuiteAndSession implements ITestRunSession, ITestSuiteElement {
-
- private final ITestElementContainer parent;
- private final ITestRunSession session;
- private String name;
- private ArrayList<ITestElement> children;
- private double time;
-
- public static TestSuiteAndSession parseFile( final File file ) {
- try {
- SAXBuilder parser = new SAXBuilder();
- Document doc = parser.build( file );
- Element root = doc.getRootElement();
-
- return new TestSuiteAndSession( root );
- } catch( Exception e ) {
- return new TestSuiteAndSession();
- }
- }
-
- public TestSuiteAndSession() {
- this.parent = null;
- this.session = this;
- }
-
- public TestSuiteAndSession( final Element elt ) {
- this.parent = null;
- this.session = this;
- initialize( elt );
- }
-
- public TestSuiteAndSession( final Element elt,
- final ITestElementContainer parent, final ITestRunSession session ) {
- this.parent = parent;
- this.session = session;
- initialize( elt );
- }
-
- private void initialize( final Element elt ) {
- this.children = new ArrayList<ITestElement>();
- this.name = elt.getAttributeValue( IXMLTags.ATTRIB_NAME,
- IXMLTags.DEFAULT_NAME );
- try {
- String timeVal = elt.getAttributeValue( IXMLTags.ATTRIB_TIME,
- IXMLTags.DEFAULT_TIME );
- time = Double.parseDouble( timeVal );
- } catch( NumberFormatException e ) {
- time = 0;
- }
-
- for( Element e: ( List<Element> )elt.getChildren() ) {
- if( e.getName().equals( IXMLTags.ELEMENT_TESTSUITE ) ) {
- children.add( new TestSuiteAndSession( e, this, session ) );
- } else if( e.getName().equals( IXMLTags.ELEMENT_TESTCASE ) ) {
- children.add( new TestCase( e, this, session ) );
- }
- }
- }
-
- @Override
- public ITestElement[] getChildren() {
- return children.toArray( new ITestElement[ children.size() ] );
- }
-
- @Override
- public String getTestRunName() {
- return name;
- }
-
- @Override
- public String getSuiteTypeName() {
- return name;
- }
-
- @Override
- public double getElapsedTimeInSeconds() {
- return time;
- }
-
- @Override
- public Result getTestResult( final boolean includeChildren ) {
- if( !includeChildren ) {
- return Result.OK;
- }
-
- Result result = Result.OK;
- for( ITestElement child: children ) {
- if( child.getTestResult( true ).equals( Result.OK ) ) {
- result = Result.FAILURE;
- break;
- }
- }
- return result;
- }
-
- @Override
- public ITestElementContainer getParentContainer() {
- return parent;
- }
-
- @Override
- public ITestRunSession getTestRunSession() {
- return session;
- }
-
- @Override
- public FailureTrace getFailureTrace() {
- return null;
- }
-
- @Override
- public ProgressState getProgressState() {
- return ProgressState.COMPLETED;
- }
-
- @Override
- public IJavaProject getLaunchedProject() {
- return null;
- }
-
-}

0 comments on commit 5c08d19

Please sign in to comment.