[323510]: [releng] Migrate XSLT CI build to Maven 3/Tycho
https://bugs.eclipse.org/bugs/show_bug.cgi?id=323510
Added launching tests
diff --git a/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/AbstractLaunchingTest.java b/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/AbstractLaunchingTest.java
index 86d6ab3..ee33691 100644
--- a/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/AbstractLaunchingTest.java
+++ b/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/AbstractLaunchingTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Standards for Technology in Automotive Retail and others.
+ * Copyright (c) 2009,2010 Standards for Technology in Automotive Retail 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,11 +7,13 @@
*
* Contributors:
* David Carver (STAR) - bug 262046 - initial API and implementation
+ * David Carver (Intalio)- upgraded to junit 4 during maven3/tycho migration
*******************************************************************************/
package org.eclipse.wst.xsl.launching.tests;
import java.io.*;
+import static org.junit.Assert.*;
import java.net.URL;
import java.util.List;
@@ -24,11 +26,13 @@
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager;
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension;
import org.eclipse.wst.xsl.launching.XSLLaunchConfigurationConstants;
+import org.junit.After;
+import org.junit.Before;
import org.w3c.dom.Document;
import junit.framework.TestCase;
-public abstract class AbstractLaunchingTest extends TestCase {
+public abstract class AbstractLaunchingTest {
private static final String XSL_TEST_PROJECT = "XSLTestProject";
protected static final String XSL_LAUNCH_SHORTCUT_ID = "org.eclipse.wst.xsl.debug.ui.launchshortcut";
protected static final String LAUNCHCONFIGS = "launchConfigs";
@@ -40,13 +44,8 @@
super();
}
- public AbstractLaunchingTest(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
createProject();
createEmptyLaunchConfigsFolder();
deleteExistingLaunchConfigs();
@@ -74,9 +73,8 @@
}
}
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
+ @After
+ public void tearDown() throws Exception {
testProject.delete(true, new NullProgressMonitor());
}
diff --git a/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/LaunchingSuite.java b/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/LaunchingSuite.java
index 1fde7dc..de83344 100644
--- a/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/LaunchingSuite.java
+++ b/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/LaunchingSuite.java
@@ -16,7 +16,7 @@
import org.eclipse.wst.xsl.launching.tests.testcase.LaunchShortcutTests;
import org.eclipse.wst.xsl.launching.tests.testcase.ResultRunnableTest;
-import org.eclipse.wst.xsl.launching.tests.testcase.TestInputFileBlock;
+import org.eclipse.wst.xsl.launching.tests.testcase.InputFileBlockTest;
import org.eclipse.wst.xsl.launching.tests.testcase.XSLLaunchingTests;
@@ -34,7 +34,7 @@
public LaunchingSuite() {
super("XSL Launching Test Suite");
addTest(new TestSuite(XSLLaunchingTests.class));
- addTest(new TestSuite(TestInputFileBlock.class));
+ addTest(new TestSuite(InputFileBlockTest.class));
addTest(new TestSuite(LaunchShortcutTests.class));
addTest(new TestSuite(ResultRunnableTest.class));
}
diff --git a/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/TestInputFileBlock.java b/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/InputFileBlockTest.java
similarity index 93%
rename from tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/TestInputFileBlock.java
rename to tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/InputFileBlockTest.java
index 4e470c6..0d918e0 100644
--- a/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/TestInputFileBlock.java
+++ b/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/InputFileBlockTest.java
@@ -10,11 +10,14 @@
*******************************************************************************/
package org.eclipse.wst.xsl.launching.tests.testcase;
-import junit.framework.TestCase;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
-public class TestInputFileBlock extends TestCase {
+public class InputFileBlockTest {
+ @Test
public void testXMLFileExtensions() throws Exception {
MockInputFileBlock fileBlock = new MockInputFileBlock(null);
String[] fileExtensions = fileBlock.getAvailableFileExtensions();
diff --git a/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/LaunchShortcutTests.java b/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/LaunchShortcutTests.java
index 93af6ae..c2827a8 100755
--- a/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/LaunchShortcutTests.java
+++ b/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/LaunchShortcutTests.java
@@ -11,6 +11,7 @@
package org.eclipse.wst.xsl.launching.tests.testcase;
import java.util.ArrayList;
+
import java.util.List;
import org.eclipse.core.runtime.IPath;
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension;
@@ -18,33 +19,31 @@
import org.eclipse.wst.xsl.launching.XSLLaunchConfigurationConstants;
import org.eclipse.wst.xsl.launching.tests.AbstractLaunchingTest;
import org.eclipse.wst.xsl.launching.tests.MockXSLLaunchShortCut;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.*;
/**
* Tests the capabilities of launch shortcuts from the <code>LaunchShortcuts</code> extension point
*
- * @since 1.0
+ * @since 1.2
*/
public class LaunchShortcutTests extends AbstractLaunchingTest {
- /**
- * Constructor
- * @param name
- */
- public LaunchShortcutTests(String name) {
- super(name);
- }
-
+ @Before
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
// TODO Auto-generated method stub
super.setUp();
IPath path = folder.getFullPath();
copyConfigurationToWorkspace(path, "SimpleTransform.launch");
}
+ @After
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
env.dispose();
super.tearDown();
}
@@ -52,11 +51,13 @@
/**
* Tests that the short cut is defined via the extension point.
*/
+ @Test
public void testShortcutExtensionPointConfigured() {
LaunchShortcutExtension ext = getLaunchShortcutExtension(XSL_LAUNCH_SHORTCUT_ID);
assertNotNull("XSLT stylesheet shortcut not found", ext); //$NON-NLS-1$
}
+ @Test
public void testXSLLaunchConfigTypeDefined() {
MockXSLLaunchShortCut shortCut = new MockXSLLaunchShortCut();
@@ -67,6 +68,7 @@
/**
* Tests that the local java app shortcut does not support some fake type id 'foo'
*/
+ @Test
public void testAssociatedConfigurationTypeNotSupported() {
LaunchShortcutExtension ext = getLaunchShortcutExtension(XSL_LAUNCH_SHORTCUT_ID);
assertNotNull("XSLT shortcut not found", ext); //$NON-NLS-1$
diff --git a/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/ResultRunnableTest.java b/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/ResultRunnableTest.java
index 25b240b..2d195f5 100644
--- a/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/ResultRunnableTest.java
+++ b/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/ResultRunnableTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- *Copyright (c) 2009 Standards for Technology in Automotive Retail and others.
+ *Copyright (c) 2009, 2010 Standards for Technology in Automotive Retail 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,41 +7,23 @@
*
*Contributors:
* David Carver (STAR) - initial API and implementation
+ * David Carver (Intalio) - migrate to junit 4 with maven migration
*******************************************************************************/
package org.eclipse.wst.xsl.launching.tests.testcase;
-import java.io.IOException;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceAlreadyExists;
-import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceInUse;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
-import org.eclipse.wst.xml.core.internal.encoding.XMLDocumentLoader;
import org.eclipse.wst.xsl.ui.internal.StructuredTextViewerConfigurationXSL;
-import org.eclipse.wst.xsl.jaxp.debug.ui.internal.views.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
/**
* This class is an abstract class for Content Completion Tests. It provides all
@@ -51,8 +33,9 @@
*
* @author David Carver
*
+ * @since 1.2
*/
-public class ResultRunnableTest extends TestCase {
+public class ResultRunnableTest {
protected StructuredTextViewer sourceViewer = null;
protected Shell shell = null;
@@ -79,8 +62,7 @@
sourceViewer = new StructuredTextViewer(parent, null, null, false,
SWT.NONE);
} else {
- Assert
- .fail("Unable to run the test as a display must be available.");
+ fail("Unable to run the test as a display must be available.");
}
configureSourceViewer();
@@ -94,18 +76,18 @@
/**
* Setup the necessary projects, files, and source viewer for the tests.
*/
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
initializeSourceViewer();
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
parent.dispose();
- super.tearDown();
}
+ @Test
public void testNoProcessingInstruction() throws Exception {
String results = "This is some sample text.";
MockResultRunnable runnable = new MockResultRunnable(sourceViewer, results, null);
diff --git a/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/XSLLaunchingTests.java b/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/XSLLaunchingTests.java
index 4939073..d6ae27c 100644
--- a/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/XSLLaunchingTests.java
+++ b/tests/org.eclipse.wst.xsl.launching.tests/test-launching-src/org/eclipse/wst/xsl/launching/tests/testcase/XSLLaunchingTests.java
@@ -13,6 +13,7 @@
package org.eclipse.wst.xsl.launching.tests.testcase;
import java.io.*;
+import static org.junit.Assert.*;
import javax.xml.parsers.*;
import org.eclipse.core.resources.*;
@@ -21,14 +22,18 @@
import org.xml.sax.*;
import org.eclipse.wst.xsl.launching.tests.AbstractLaunchingTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
public class XSLLaunchingTests extends AbstractLaunchingTest {
private static final String TRANSFORM_COMMENTS = "TransformComments";
private static final String SIMPLE_TRANSFORM = "SimpleTransform";
+ @Before
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
IPath path = folder.getFullPath();
@@ -41,12 +46,14 @@
}
}
+ @After
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
env.dispose();
super.tearDown();
}
+ @Test
public synchronized void testSimpleTransformation() throws Exception {
IPath folder = testProject.getFullPath();
env.addFileFromResource(folder, "1-input.xml", "1-input.xml");
@@ -69,6 +76,7 @@
* @throws SAXException
* @throws IOException
*/
+ @Test
public synchronized void testTransformComments() throws Exception {
IPath folder = testProject.getFullPath();
env.addFileFromResource(folder, "testCommentInput.xml",