diff options
author | dacarver | 2010-09-22 13:21:56 +0000 |
---|---|---|
committer | dacarver | 2010-09-22 13:21:56 +0000 |
commit | 8df7c3586e6f644fef7f081d480268bcdbf426e8 (patch) | |
tree | abd6d7d875a591f77db39319eff9a51c03a4633e | |
parent | b4c548a9ee5076d7662ef71a558d4b3451d26e04 (diff) | |
download | webtools.sourceediting.xsl.tests-8df7c3586e6f644fef7f081d480268bcdbf426e8.tar.gz webtools.sourceediting.xsl.tests-8df7c3586e6f644fef7f081d480268bcdbf426e8.tar.xz webtools.sourceediting.xsl.tests-8df7c3586e6f644fef7f081d480268bcdbf426e8.zip |
325473: [releng] Two initialization errors with CI build tests
https://bugs.eclipse.org/bugs/show_bug.cgi?id=325473
10 files changed, 81 insertions, 60 deletions
diff --git a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/core/internal/utils/tests/TestXMLContentType.java b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/core/internal/utils/tests/TestXMLContentType.java index 40dc337..d63405a 100644 --- a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/core/internal/utils/tests/TestXMLContentType.java +++ b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/core/internal/utils/tests/TestXMLContentType.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 @@ -11,15 +11,15 @@ package org.eclipse.wst.xsl.core.internal.utils.tests; import org.eclipse.wst.xsl.core.internal.util.XMLContentType; +import org.junit.Test; -import junit.framework.TestCase; +import static org.junit.Assert.*; -public class TestXMLContentType extends TestCase { - public TestXMLContentType() { - super(); - } - +public class TestXMLContentType { + + + @Test public void testGetFileExtensions() { XMLContentType xmlContentType = new XMLContentType(); String[] exts = xmlContentType.getFileExtensions(); diff --git a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/core/tests/XSLCoreTestSuite.java b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/core/tests/XSLCoreTestSuite.java index e7b58db..79637b6 100644 --- a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/core/tests/XSLCoreTestSuite.java +++ b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/core/tests/XSLCoreTestSuite.java @@ -17,23 +17,14 @@ import org.eclipse.wst.xsl.internal.core.tests.TestStructuredTextPartitionerForX import org.eclipse.wst.xsl.internal.core.tests.TestXSLCore; import org.eclipse.wst.xsl.internal.model.tests.TestStylesheet; import org.eclipse.wst.xsl.internal.model.tests.TestStylesheetModel; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; -import junit.framework.Test; -import junit.framework.TestSuite; -public class XSLCoreTestSuite extends TestSuite { - public static Test suite() { - return new XSLCoreTestSuite(); - } - - public XSLCoreTestSuite() { - super("XSL Core Test Suite"); - addTestSuite(TestIncludedTemplates.class); - addTestSuite(TestXSLCore.class); - addTestSuite(TestStylesheet.class); - addTestSuite(TestStylesheetModel.class); - addTestSuite(TestXMLContentType.class); - addTestSuite(TestStructuredTextPartitionerForXSL.class); - } +@RunWith(Suite.class) +@Suite.SuiteClasses({TestIncludedTemplates.class, TestXSLCore.class, TestStylesheet.class, TestStylesheetModel.class, TestXMLContentType.class, + TestStructuredTextPartitionerForXSL.class}) +public class XSLCoreTestSuite { + } diff --git a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/AbstractValidationTest.java b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/AbstractValidationTest.java index 0f189e6..4f81b4e 100644 --- a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/AbstractValidationTest.java +++ b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/AbstractValidationTest.java @@ -12,6 +12,8 @@ package org.eclipse.wst.xsl.internal.core.tests; import java.io.IOException; +import static org.junit.Assert.*; + import java.io.InputStream; import java.net.URL; import java.util.Enumeration; @@ -23,8 +25,6 @@ import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import junit.framework.TestCase; - import org.apache.xpath.jaxp.XPathFactoryImpl; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -51,6 +51,7 @@ import org.eclipse.wst.xsl.core.internal.validation.XSLValidationReport; import org.eclipse.wst.xsl.core.internal.validation.XSLValidator; import org.eclipse.wst.xsl.core.model.StylesheetModel; import org.eclipse.wst.xsl.core.tests.XSLCoreTestsPlugin; +import org.junit.Before; import org.osgi.framework.Bundle; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -65,14 +66,13 @@ import org.w3c.dom.NodeList; * * @author Doug Satchwell */ -public abstract class AbstractValidationTest extends TestCase { +public abstract class AbstractValidationTest { protected static IProject fTestProject; private static boolean fTestProjectInitialized; private static final String TEST_PROJECT_NAME = "testproject"; - @Override - protected void setUp() throws Exception { - super.setUp(); + @Before + public void setUp() throws Exception { if (!fTestProjectInitialized) { getAndCreateProject(); diff --git a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/TestIncludedTemplates.java b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/TestIncludedTemplates.java index ccd6542..8a08ced 100644 --- a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/TestIncludedTemplates.java +++ b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/TestIncludedTemplates.java @@ -10,10 +10,12 @@ *******************************************************************************/ package org.eclipse.wst.xsl.internal.core.tests; -public class TestIncludedTemplates extends AbstractValidationTest -{ - public void test1() throws Exception - { +import org.junit.Test; + +public class TestIncludedTemplates extends AbstractValidationTest { + + @Test + public void test1() throws Exception { validate(getFile("style1.xsl")); } } diff --git a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/TestStructuredTextPartitionerForXSL.java b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/TestStructuredTextPartitionerForXSL.java index 9d92b20..688129e 100644 --- a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/TestStructuredTextPartitionerForXSL.java +++ b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/TestStructuredTextPartitionerForXSL.java @@ -11,12 +11,13 @@ package org.eclipse.wst.xsl.internal.core.tests; import org.eclipse.jface.text.IDocumentPartitioner; +import static org.junit.Assert.*; import org.eclipse.wst.xsl.core.internal.text.rules.StructuredTextPartitionerForXSL; +import org.junit.Test; -import junit.framework.TestCase; - -public class TestStructuredTextPartitionerForXSL extends TestCase { +public class TestStructuredTextPartitionerForXSL { + @Test public void testXSLNewInstance() { StructuredTextPartitionerForXSL textPartioner = new StructuredTextPartitionerForXSL(); IDocumentPartitioner documentPartitioner = textPartioner.newInstance(); diff --git a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/TestXSLCore.java b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/TestXSLCore.java index 4857029..d7400b3 100644 --- a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/TestXSLCore.java +++ b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/core/tests/TestXSLCore.java @@ -1,18 +1,14 @@ package org.eclipse.wst.xsl.internal.core.tests; -import junit.framework.TestCase; + import org.eclipse.wst.xsl.core.XSLCore; +import org.junit.Test; -public class TestXSLCore extends TestCase { +import static org.junit.Assert.*; - public TestXSLCore() { - super(); - } +public class TestXSLCore { - public TestXSLCore(String name) { - super(name); - } - + @Test public void testisXSLNamespaceNullFalse() { assertFalse(XSLCore.isXSLNamespace(null)); } diff --git a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/model/tests/AbstractModelTest.java b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/model/tests/AbstractModelTest.java index 71f3e67..21a8a22 100644 --- a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/model/tests/AbstractModelTest.java +++ b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/model/tests/AbstractModelTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Chase Technology Ltd - http://www.chasetechnology.co.uk + * Copyright (c) 2008, 2010 Chase Technology Ltd - http://www.chasetechnology.co.uk * 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,14 @@ * * Contributors: * Doug Satchwell (Chase Technology Ltd) - initial API and implementation + * David Carver (Intalio) - convert to Junit 4 - bug 313510 *******************************************************************************/ package org.eclipse.wst.xsl.internal.model.tests; import java.io.IOException; +import static org.junit.Assert.*; + import java.io.InputStream; import java.net.URL; import java.util.Enumeration; @@ -23,7 +26,6 @@ import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import junit.framework.TestCase; import org.apache.xpath.jaxp.XPathFactoryImpl; import org.eclipse.core.resources.IFile; @@ -52,6 +54,8 @@ import org.eclipse.wst.xsl.core.internal.validation.XSLValidationReport; import org.eclipse.wst.xsl.core.internal.validation.XSLValidator; import org.eclipse.wst.xsl.core.model.StylesheetModel; import org.eclipse.wst.xsl.core.tests.XSLCoreTestsPlugin; +import org.junit.After; +import org.junit.Before; import org.osgi.framework.Bundle; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -64,15 +68,14 @@ import org.w3c.dom.NodeList; * * @author Doug Satchwell */ -public abstract class AbstractModelTest extends TestCase +public abstract class AbstractModelTest { protected static IProject fTestProject; private static boolean fTestProjectInitialized; private static final String TEST_PROJECT_NAME = "testproject"; - @Override - protected void setUp() throws Exception { - super.setUp(); + @Before + public void setUp() throws Exception { if (!fTestProjectInitialized) { getAndCreateProject(); @@ -108,9 +111,8 @@ public abstract class AbstractModelTest extends TestCase } - @Override - protected void tearDown() throws Exception { - super.tearDown(); + @After + public void tearDown() throws Exception { StylesheetBuilder builder = StylesheetBuilder.getInstance(); builder.release(); } diff --git a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/model/tests/TestStylesheet.java b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/model/tests/TestStylesheet.java index c6a37c8..188e91f 100644 --- a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/model/tests/TestStylesheet.java +++ b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/model/tests/TestStylesheet.java @@ -1,6 +1,8 @@ package org.eclipse.wst.xsl.internal.model.tests; import java.util.List; +import static org.junit.Assert.*; + import java.util.Map; import org.eclipse.wst.xsl.core.internal.model.StylesheetBuilder; @@ -11,6 +13,9 @@ import org.eclipse.wst.xsl.core.model.Stylesheet; import org.eclipse.wst.xsl.core.model.Template; import org.eclipse.wst.xsl.core.model.Variable; import org.eclipse.wst.xsl.core.model.XSLAttribute; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; public class TestStylesheet extends AbstractModelTest { StylesheetBuilder builder = null; @@ -19,23 +24,27 @@ public class TestStylesheet extends AbstractModelTest { // TODO Auto-generated constructor stub } + @Before @Override - protected void setUp() throws Exception { + public void setUp() throws Exception { super.setUp(); builder = StylesheetBuilder.getInstance(); } + @After @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { super.tearDown(); builder.release(); } + @Test public void testLoadModel() { Stylesheet model = builder.getStylesheet(getFile("style1.xsl"), false); assertNotNull("Model failed to load, returned NULL", model); } + @Test public void testgetLocalTemplatesTemplates() { Stylesheet model = builder.getStylesheet(getFile("style1.xsl"), false); assertNotNull("Model failed to load, returned NULL", model); @@ -45,6 +54,7 @@ public class TestStylesheet extends AbstractModelTest { .size()); } + @Test public void testGetIncludes() { Stylesheet stylesheet = builder.getStylesheet(getFile("style1.xsl"), false); @@ -55,6 +65,7 @@ public class TestStylesheet extends AbstractModelTest { .size()); } + @Test public void testGetImports() { Stylesheet stylesheet = builder.getStylesheet(getFile("style1.xsl"), false); @@ -66,6 +77,7 @@ public class TestStylesheet extends AbstractModelTest { } + @Test public void testGetGlobalVariables() { Stylesheet stylesheet = builder.getStylesheet( getFile("globalVariablesTest.xsl"), false); @@ -76,6 +88,7 @@ public class TestStylesheet extends AbstractModelTest { globalVariablesList.size()); } + @Test public void testGetLineNumber() { Stylesheet stylesheet = builder.getStylesheet( getFile("globalVariablesTest.xsl"), false); @@ -84,6 +97,7 @@ public class TestStylesheet extends AbstractModelTest { assertEquals("Incorrect line number.", 12, stylesheet.getLineNumber()); } + @Test public void testGetColumnNumber() { Stylesheet stylesheet = builder.getStylesheet( getFile("globalVariablesTest.xsl"), false); @@ -93,6 +107,7 @@ public class TestStylesheet extends AbstractModelTest { .getColumnNumber()); } + @Test public void testGetVersion() { Stylesheet stylesheet = builder.getStylesheet( getFile("globalVariablesTest.xsl"), false); @@ -103,6 +118,7 @@ public class TestStylesheet extends AbstractModelTest { .getVersion()); } + @Test public void testXSLT2GetVersion() { Stylesheet stylesheet = builder.getStylesheet( getFile("XSLT20Test.xsl"), false); @@ -112,6 +128,7 @@ public class TestStylesheet extends AbstractModelTest { .getVersion()); } + @Test public void testGetAttributes() { Stylesheet stylesheet = builder.getStylesheet( getFile("globalVariablesTest.xsl"), false); @@ -126,6 +143,7 @@ public class TestStylesheet extends AbstractModelTest { } + @Test public void testGetFunction() { Stylesheet stylesheet = builder.getStylesheet( getFile("XSLT20FunctionTest.xsl"), false); @@ -136,6 +154,7 @@ public class TestStylesheet extends AbstractModelTest { functionList.size()); } + @Test public void testGetFunctionFunc1() { Stylesheet stylesheet = builder.getStylesheet( getFile("XSLT20FunctionTest.xsl"), false); diff --git a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/model/tests/TestStylesheetModel.java b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/model/tests/TestStylesheetModel.java index bfa9d39..3f01601 100644 --- a/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/model/tests/TestStylesheetModel.java +++ b/tests/org.eclipse.wst.xsl.core.tests/src/org/eclipse/wst/xsl/internal/model/tests/TestStylesheetModel.java @@ -8,6 +8,10 @@ import org.eclipse.wst.xsl.core.internal.model.StylesheetBuilder; import org.eclipse.wst.xsl.core.model.StylesheetModel; import org.eclipse.wst.xsl.core.model.Template; import org.eclipse.wst.xsl.core.model.XSLAttribute; +import org.junit.After; +import org.junit.Test; + +import static org.junit.Assert.*; public class TestStylesheetModel extends AbstractModelTest { private StylesheetModel model = null; @@ -15,14 +19,16 @@ public class TestStylesheetModel extends AbstractModelTest { } + @After @Override - protected void tearDown() throws Exception { + public void tearDown() throws Exception { super.tearDown(); StylesheetBuilder builder = StylesheetBuilder.getInstance(); builder.release(); model = null; } - + + @Test public void testStyleSheetModel() { model = XSLCore.getInstance().getStylesheet(getFile("globalVariablesTest.xsl")); @@ -38,6 +44,7 @@ public class TestStylesheetModel extends AbstractModelTest { } + @Test public void testFindAvailableTemplateModes() { ArrayList<String> modes = new ArrayList(); model = XSLCore.getInstance().getStylesheet(getFile("modeTest.xsl")); @@ -54,12 +61,14 @@ public class TestStylesheetModel extends AbstractModelTest { } assertEquals("Wrong number of mode templates returned.", 3, modes.size()); } - + + @Test public void testCircularReference() { model = XSLCore.getInstance().getStylesheet(getFile("circularref.xsl")); assertTrue("Undettected circular reference", model.hasCircularReference()); } + @Test public void testNoCircularReference() { model = XSLCore.getInstance().getStylesheet(getFile("modeTest.xsl")); assertFalse("Undettected circular reference", model.hasCircularReference()); diff --git a/tests/org.eclipse.wst.xsl.tests/src/org/eclipse/wst/xsl/tests/AllTestsSuite.java b/tests/org.eclipse.wst.xsl.tests/src/org/eclipse/wst/xsl/tests/AllTestsSuite.java index 13ead90..60e679f 100644 --- a/tests/org.eclipse.wst.xsl.tests/src/org/eclipse/wst/xsl/tests/AllTestsSuite.java +++ b/tests/org.eclipse.wst.xsl.tests/src/org/eclipse/wst/xsl/tests/AllTestsSuite.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2010 IBM Corporation 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,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * David Carver (Intalio) - bug 323510 - convert to junit 4 *******************************************************************************/ package org.eclipse.wst.xsl.tests; |