Merge remote-tracking branch 'origin/master' into BETA_JAVA14
Change-Id: I88231d2413c5bd00c354e0beadca58ed4a7d5458
diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/ClassFileScannerTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/ClassFileScannerTests.java
index 505fc77..b602cc0 100644
--- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/ClassFileScannerTests.java
+++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/ClassFileScannerTests.java
@@ -13,15 +13,16 @@
*******************************************************************************/
package org.eclipse.pde.api.tools.model.tests;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.pde.api.tools.internal.provisional.builder.IReference;
-import org.eclipse.test.OrderedTestSuite;
-
-import junit.framework.Test;
+import org.junit.AfterClass;
+import org.junit.Test;
/**
* This class tests the class file scanner and the class file visitor
@@ -33,70 +34,21 @@
private static IPath WORKSPACE_ROOT = TestSuiteHelper.getPluginDirectoryPath().append("test_classes_workspace"); //$NON-NLS-1$
private static IPath ROOT_PATH = TestSuiteHelper.getPluginDirectoryPath().append("test-source").append("classes"); //$NON-NLS-1$ //$NON-NLS-2$;
- /**
- * The ordered {@link Test} suite to run
- *
- * @return the {@link Test} suite
- */
- public static Test suite() {
- return new OrderedTestSuite(ClassFileScannerTests.class, new String[] { "testScanEmptyClass", //$NON-NLS-1$
- "testScanEmptyGenericClass", //$NON-NLS-1$
- "testScanInnerClass", //$NON-NLS-1$
- "testScanInnerStaticClass", //$NON-NLS-1$
- "testScanInnerStaticInnerClass", //$NON-NLS-1$
- "testScanOuterClass", //$NON-NLS-1$
- "testScanInnerOuterClass", //$NON-NLS-1$
- "testScanInnerGenericClass", //$NON-NLS-1$
- "testScanInnerStaticInnerGenericClass", //$NON-NLS-1$
- "testScanClassExtendsImplements", //$NON-NLS-1$
- "testScanGenericClassExtendsImplements", //$NON-NLS-1$
- "testScanMethodDecl", //$NON-NLS-1$
- "testScanMethodDeclArrayTypes", //$NON-NLS-1$
- "testScanMethodDeclGenerics", //$NON-NLS-1$
- "testScanFieldDecl", //$NON-NLS-1$
- "testScanLocalVariableArrays", //$NON-NLS-1$
- "testScanConstantPoolAccess", //$NON-NLS-1$
- "testScanConstantPoolAccess1_4", //$NON-NLS-1$
- "testScanMethodCalls", //$NON-NLS-1$
- "testCleanup", //$NON-NLS-1$
- });
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.pde.api.tools.model.tests.ScannerTest#getWorkspaceRoot()
- */
@Override
protected IPath getWorkspaceRoot() {
return WORKSPACE_ROOT;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.pde.api.tools.model.tests.ScannerTest#getPackageName()
- */
@Override
protected String getPackageName() {
return "classes"; //$NON-NLS-1$
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.pde.api.tools.model.tests.ScannerTest#getSourcePath()
- */
@Override
protected IPath getSourcePath() {
return ROOT_PATH;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.pde.api.tools.model.tests.ScannerTest#doCompile()
- */
@Override
protected boolean doCompile() {
boolean result = true;
@@ -112,6 +64,7 @@
* Tests scanning a simple class file that extends nothing, implements
* nothing and has no members
*/
+ @Test
public void testScanEmptyClass() throws CoreException {
List<IReference> refs = getRefSet("Test1"); //$NON-NLS-1$
IReference ref = findMemberReference("classes.Test1", null, "java.lang.Object", null, IReference.REF_EXTENDS, refs); //$NON-NLS-1$ //$NON-NLS-2$
@@ -124,6 +77,7 @@
* Test scanning a simple generic class file that extends nothing,
* implements nothing and has no members
*/
+ @Test
public void testScanEmptyGenericClass() throws CoreException {
List<IReference> refs = getRefSet("Test2"); //$NON-NLS-1$
IReference ref = findMemberReference("classes.Test2", null, "java.lang.Object", null, IReference.REF_EXTENDS, refs); //$NON-NLS-1$ //$NON-NLS-2$
@@ -137,6 +91,7 @@
/**
* Tests scanning an empty inner class
*/
+ @Test
public void testScanInnerClass() throws CoreException {
List<IReference> refs = getRefSet("Test3$Inner"); //$NON-NLS-1$
IReference ref = findMemberReference("classes.Test3$Inner", null, "java.lang.Object", null, IReference.REF_EXTENDS, refs); //$NON-NLS-1$ //$NON-NLS-2$
@@ -149,6 +104,7 @@
/**
* Tests scanning a empty static inner class
*/
+ @Test
public void testScanInnerStaticClass() throws CoreException {
List<IReference> refs = getRefSet("Test3$Inner2"); //$NON-NLS-1$
IReference ref = findReference("classes.Test3$Inner2", "java.lang.Object", IReference.REF_EXTENDS, refs); //$NON-NLS-1$ //$NON-NLS-2$
@@ -161,6 +117,7 @@
/**
* Tests scanning an empty inner class of an empty inner static class
*/
+ @Test
public void testScanInnerStaticInnerClass() throws CoreException {
List<IReference> refs = getRefSet("Test3$Inner2$Inner3"); //$NON-NLS-1$
IReference ref = findReference("classes.Test3$Inner2$Inner3", "java.lang.Object", IReference.REF_EXTENDS, refs); //$NON-NLS-1$ //$NON-NLS-2$
@@ -173,6 +130,7 @@
/**
* Tests scanning an empty outer class
*/
+ @Test
public void testScanOuterClass() throws CoreException {
List<IReference> refs = getRefSet("Test3Outer"); //$NON-NLS-1$
IReference ref = findReference("classes.Test3Outer", "java.lang.Object", IReference.REF_EXTENDS, refs); //$NON-NLS-1$ //$NON-NLS-2$
@@ -185,6 +143,7 @@
/**
* Tests scanning an empty class of the inner class of an outer class
*/
+ @Test
public void testScanInnerOuterClass() throws CoreException {
List<IReference> refs = getRefSet("Test3Outer$Inner"); //$NON-NLS-1$
IReference ref = findReference("classes.Test3Outer$Inner", "java.lang.Object", IReference.REF_EXTENDS, refs); //$NON-NLS-1$ //$NON-NLS-2$
@@ -197,6 +156,7 @@
/**
* Tests scanning an inner static generic type
*/
+ @Test
public void testScanInnerGenericClass() throws CoreException {
List<IReference> refs = getRefSet("Test4$Inner"); //$NON-NLS-1$
IReference ref = findReference("classes.Test4$Inner", "java.lang.Object", IReference.REF_EXTENDS, refs); //$NON-NLS-1$ //$NON-NLS-2$
@@ -212,6 +172,7 @@
/**
* Tests scanning an inner class of a static class of a generic type
*/
+ @Test
public void testScanInnerStaticInnerGenericClass() throws CoreException {
List<IReference> refs = getRefSet("Test4$Inner$Inner2"); //$NON-NLS-1$
IReference ref = findReference("classes.Test4$Inner$Inner2", "java.lang.Object", IReference.REF_EXTENDS, refs); //$NON-NLS-1$ //$NON-NLS-2$
@@ -228,6 +189,7 @@
* Tests scanning a non-generic class that extends something and implements
* interfaces
*/
+ @Test
public void testScanClassExtendsImplements() throws CoreException {
List<IReference> refs = getRefSet("Test5"); //$NON-NLS-1$
IReference ref = findReference("classes.Test5", "java.util.ArrayList", IReference.REF_EXTENDS, refs); //$NON-NLS-1$ //$NON-NLS-2$
@@ -245,6 +207,7 @@
* Tests scanning a generic class that extends something and implements
* interfaces
*/
+ @Test
public void testScanGenericClassExtendsImplements() throws CoreException {
List<IReference> refs = getRefSet("Test6"); //$NON-NLS-1$
IReference ref = findReference("classes.Test6", "classes.Test6Abstract", IReference.REF_CONSTRUCTORMETHOD, refs); //$NON-NLS-1$ //$NON-NLS-2$
@@ -270,6 +233,7 @@
/**
* Tests a variety of method declarations
*/
+ @Test
public void testScanMethodDecl() throws CoreException {
List<IReference> refs = getRefSet("Test7"); //$NON-NLS-1$
IReference ref = findMemberReference("classes.Test7", "m1", "java.lang.String", null, IReference.REF_RETURNTYPE, refs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -302,6 +266,7 @@
/**
* Tests a variety of method declarations with array types in them
*/
+ @Test
public void testScanMethodDeclArrayTypes() throws CoreException {
List<IReference> refs = getRefSet("Test7"); //$NON-NLS-1$
IReference ref = findMemberReference("classes.Test7", "m4", "java.lang.Integer", null, IReference.REF_RETURNTYPE, refs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -333,6 +298,7 @@
/**
* Tests a variety of method declarations with generic types
*/
+ @Test
public void testScanMethodDeclGenerics() throws CoreException {
List<IReference> refs = getRefSet("Test8"); //$NON-NLS-1$
IReference ref = findMemberReference("classes.Test8", "m1", "java.util.ArrayList", null, IReference.REF_RETURNTYPE, refs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -365,6 +331,7 @@
/**
* Tests a variety of field declarations
*/
+ @Test
public void testScanFieldDecl() throws CoreException {
List<IReference> refs = getRefSet("Test9"); //$NON-NLS-1$
IReference ref = findMemberReference("classes.Test9", "strs", "java.lang.String", null, IReference.REF_FIELDDECL, refs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -382,6 +349,7 @@
* Tests a variety of arrays that have been declared as local variables in
* methods
*/
+ @Test
public void testScanLocalVariableArrays() throws CoreException {
List<IReference> refs = getRefSet("Test10"); //$NON-NLS-1$
IReference ref = findMemberReference("classes.Test10", null, "java.lang.String", null, IReference.REF_ARRAYALLOC, refs); //$NON-NLS-1$ //$NON-NLS-2$
@@ -398,6 +366,7 @@
* Tests a variety of LDC ops that load things like Integer.class onto the
* stack
*/
+ @Test
public void testScanConstantPoolAccess() throws CoreException {
List<IReference> refs = getRefSet("Test11"); //$NON-NLS-1$
IReference ref = findMemberReference("classes.Test11", null, "java.lang.Integer", null, IReference.REF_CONSTANTPOOL, refs); //$NON-NLS-1$ //$NON-NLS-2$
@@ -413,6 +382,7 @@
* stack. This method uses a 1.4 code level class, and checks that the LDC
* ref is actually processed via a Class.forName static method call
*/
+ @Test
public void testScanConstantPoolAccess1_4() throws CoreException {
List<IReference> refs = getRefSet("Test12"); //$NON-NLS-1$
IReference ref = findMemberReference("classes.Test12", null, "java.lang.Integer", null, IReference.REF_CONSTANTPOOL, refs); //$NON-NLS-1$ //$NON-NLS-2$
@@ -426,6 +396,7 @@
/**
* Tests a variety of method calls
*/
+ @Test
public void testScanMethodCalls() throws CoreException {
List<IReference> refs = getRefSet("Test13"); //$NON-NLS-1$
IReference ref = findMemberReference("classes.Test13", "m1", "classes.Test13", "m2", IReference.REF_VIRTUALMETHOD, refs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
@@ -443,7 +414,8 @@
*
* @throws Exception
*/
- public void testCleanup() throws Exception {
+ @AfterClass
+ public static void testCleanup() throws Exception {
cleanUp();
// remove workspace root
assertTrue(TestSuiteHelper.delete(new File(WORKSPACE_ROOT.toOSString())));
diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/Java8ClassfileScannerTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/Java8ClassfileScannerTests.java
index 34dcbad..c1d72cc 100644
--- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/Java8ClassfileScannerTests.java
+++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/Java8ClassfileScannerTests.java
@@ -13,14 +13,15 @@
*******************************************************************************/
package org.eclipse.pde.api.tools.model.tests;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
import java.util.List;
import org.eclipse.core.runtime.IPath;
import org.eclipse.pde.api.tools.internal.provisional.builder.IReference;
-import org.eclipse.test.OrderedTestSuite;
-
-import junit.framework.Test;
+import org.junit.AfterClass;
+import org.junit.Test;
/**
* Tests reading JJava 8 classfiles and extracting specific references
@@ -32,55 +33,21 @@
private static IPath WORKSPACE_ROOT = TestSuiteHelper.getPluginDirectoryPath().append("test_classes_workspace_java8"); //$NON-NLS-1$
private static IPath ROOT_PATH = TestSuiteHelper.getPluginDirectoryPath().append("test-source").append("invokedynamic"); //$NON-NLS-1$ //$NON-NLS-2$
- /**
- * Returns the {@link Test} suite to run
- *
- * @return the {@link Test} suite
- */
- public static Test suite() {
- return new OrderedTestSuite(Java8ClassfileScannerTests.class, new String[] { "testStaticMethodRef", //$NON-NLS-1$
- "testInstanceMethodRef", //$NON-NLS-1$
- "testArbitraryObjectMethodRef", //$NON-NLS-1$
- "testConstructorMethodRef", //$NON-NLS-1$
- "testCleanup" //$NON-NLS-1$
- });
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.pde.api.tools.model.tests.ScannerTest#getWorkspaceRoot()
- */
@Override
protected IPath getWorkspaceRoot() {
return WORKSPACE_ROOT;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.pde.api.tools.model.tests.ScannerTest#getSourcePath()
- */
@Override
protected IPath getSourcePath() {
return ROOT_PATH;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.pde.api.tools.model.tests.ScannerTest#getPackageName()
- */
@Override
protected String getPackageName() {
return "invokedynamic"; //$NON-NLS-1$
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.pde.api.tools.model.tests.ScannerTest#doCompile()
- */
@Override
protected boolean doCompile() {
boolean result = true;
@@ -95,6 +62,7 @@
*
* @throws Exception
*/
+ @Test
public void testStaticMethodRef() throws Exception {
List<IReference> refs = getRefSet("test1"); //$NON-NLS-1$
IReference ref = findMemberReference("invokedynamic.test1", "m1", "invokedynamic.test1$MR", "mrCompare", IReference.REF_VIRTUALMETHOD, refs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
@@ -106,6 +74,7 @@
*
* @throws Exception
*/
+ @Test
public void testInstanceMethodRef() throws Exception {
List<IReference> refs = getRefSet("test2"); //$NON-NLS-1$
IReference ref = findMemberReference("invokedynamic.test2", "m1", "invokedynamic.test2$MR", "mrCompare", IReference.REF_VIRTUALMETHOD, refs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
@@ -118,6 +87,7 @@
*
* @throws Exception
*/
+ @Test
public void testArbitraryObjectMethodRef() throws Exception {
List<IReference> refs = getRefSet("test3"); //$NON-NLS-1$
IReference ref = findMemberReference("invokedynamic.test3", "m1", "java.lang.String", "compareToIgnoreCase", IReference.REF_VIRTUALMETHOD, refs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
@@ -129,6 +99,7 @@
*
* @throws Exception
*/
+ @Test
public void testConstructorMethodRef() throws Exception {
List<IReference> refs = getRefSet("test4"); //$NON-NLS-1$
IReference ref = findMemberReference("invokedynamic.test4", "m1", "java.util.HashSet", "<init>", IReference.REF_VIRTUALMETHOD, refs); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
@@ -140,7 +111,8 @@
*
* @throws Exception
*/
- public void testCleanup() throws Exception {
+ @AfterClass
+ public static void testCleanup() throws Exception {
cleanUp();
// remove workspace root
assertTrue(TestSuiteHelper.delete(new File(WORKSPACE_ROOT.toOSString())));
diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/ScannerTest.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/ScannerTest.java
index a7d98c5..5e02e80 100644
--- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/ScannerTest.java
+++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/model/tests/ScannerTest.java
@@ -13,6 +13,9 @@
*******************************************************************************/
package org.eclipse.pde.api.tools.model.tests;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.File;
import java.util.Iterator;
import java.util.List;
@@ -25,15 +28,14 @@
import org.eclipse.pde.api.tools.internal.provisional.model.IApiMember;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiType;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiTypeRoot;
-
-import junit.framework.TestCase;
+import org.junit.Before;
/**
* Root class for testing scanning classfiles
*
* @since 1.0.400
*/
-public abstract class ScannerTest extends TestCase {
+public abstract class ScannerTest {
private static DirectoryApiTypeContainer container = null;
@@ -65,13 +67,8 @@
*/
protected abstract boolean doCompile();
- /*
- * (non-Javadoc)
- *
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
IPath root = getWorkspaceRoot();
File file = root.toFile();
if (!file.exists()) {
@@ -84,17 +81,6 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see junit.framework.TestCase#tearDown()
- */
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
-
- }
-
/**
* Returns the container
*
@@ -211,7 +197,7 @@
*
* @throws Exception
*/
- protected void cleanUp() throws Exception {
+ protected static void cleanUp() throws Exception {
if (container != null) {
container.close();
container = null;
diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/util/tests/ApiBaselineManagerTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/util/tests/ApiBaselineManagerTests.java
index be5dcb6..a431fea 100644
--- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/util/tests/ApiBaselineManagerTests.java
+++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/util/tests/ApiBaselineManagerTests.java
@@ -163,8 +163,8 @@
List<TagElement> tags = (List<TagElement>) docnode.getStructuralProperty(Javadoc.TAGS_PROPERTY);
if (tags != null) {
TagElement tag = null;
- for (int i = 0; i < tags.size(); i++) {
- tag = tags.get(i);
+ for (TagElement tag2 : tags) {
+ tag = tag2;
if (tagname.equals(tag.getTagName())) {
lrewrite.remove(tag, null);
}
@@ -449,7 +449,7 @@
* @throws BadLocationException
*/
private void updateTagInSource(ICompilationUnit unit, String membername, String signature, String tagname, boolean remove) throws CoreException, MalformedTreeException, BadLocationException {
- ASTParser parser = ASTParser.newParser(AST.JLS8);
+ ASTParser parser = ASTParser.newParser(AST.JLS13);
parser.setSource(unit);
CompilationUnit cunit = (CompilationUnit) parser.createAST(new NullProgressMonitor());
assertNotNull("the ast compilation unit cannot be null", cunit); //$NON-NLS-1$
diff --git a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/util/tests/ApiDescriptionProcessorTests.java b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/util/tests/ApiDescriptionProcessorTests.java
index dff4535..2a41562 100644
--- a/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/util/tests/ApiDescriptionProcessorTests.java
+++ b/apitools/org.eclipse.pde.api.tools.tests/src/org/eclipse/pde/api/tools/util/tests/ApiDescriptionProcessorTests.java
@@ -155,11 +155,11 @@
private boolean containsAllTags(List<TagElement> tags) {
boolean allfound = true;
TagElement element = null;
- for (int i = 0; i < expectedtags.length; i++) {
+ for (String expectedtag : expectedtags) {
boolean contained = false;
- for (int j = 0; j < tags.size(); j++) {
- element = tags.get(j);
- if (expectedtags[i].equals(element.getTagName())) {
+ for (TagElement tag : tags) {
+ element = tag;
+ if (expectedtag.equals(element.getTagName())) {
contained = true;
}
}
@@ -282,7 +282,7 @@
IJavaProject project = getTestingJavaProject(TESTING_PROJECT_NAME);
IType type = project.findType("javadoc", typename); //$NON-NLS-1$
assertNotNull("the type for javadoc." + typename + " must exist", type); //$NON-NLS-1$ //$NON-NLS-2$
- ASTParser parser = ASTParser.newParser(AST.JLS8);
+ ASTParser parser = ASTParser.newParser(AST.JLS13);
parser.setSource(type.getCompilationUnit());
CompilationUnit cunit = (CompilationUnit) parser.createAST(new NullProgressMonitor());
ChangeVisitor visitor = new ChangeVisitor(typename, innertypename, membername, signature, expectedtags);
diff --git a/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/completion/APIToolsJavadocCompletionProposalComputer.java b/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/completion/APIToolsJavadocCompletionProposalComputer.java
index 0759f63..df57f10 100644
--- a/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/completion/APIToolsJavadocCompletionProposalComputer.java
+++ b/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/completion/APIToolsJavadocCompletionProposalComputer.java
@@ -116,7 +116,7 @@
}
}
}
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
/**
@@ -135,7 +135,7 @@
int offset = jcontext.getInvocationOffset();
IJavaElement element = cunit.getElementAt(offset);
if (!isVisible(element)) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
ImageDescriptor imagedesc = jcontext.getLabelProvider().createImageDescriptor(org.eclipse.jdt.core.CompletionProposal.create(org.eclipse.jdt.core.CompletionProposal.JAVADOC_BLOCK_TAG, offset));
fImageHandle = (imagedesc == null ? null : imagedesc.createImage());
@@ -185,7 +185,7 @@
fErrorMessage = e.getMessage();
}
}
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
/**
@@ -377,7 +377,7 @@
@Override
public List<IContextInformation> computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
@Override
diff --git a/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/wizards/JavadocConversionRefactoring.java b/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/wizards/JavadocConversionRefactoring.java
index dd788db..e7c8bd5 100644
--- a/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/wizards/JavadocConversionRefactoring.java
+++ b/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/wizards/JavadocConversionRefactoring.java
@@ -414,7 +414,7 @@
@Override
public boolean visit(ImportDeclaration node) {
String name = node.getName().getFullyQualifiedName();
- if (!ALL_API_IMPORTS.values().contains(name)) {
+ if (!ALL_API_IMPORTS.containsValue(name)) {
existingImports.add(name);
}
return super.visit(node);
diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/ApiBaselineManager.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/ApiBaselineManager.java
index 13d430a..a87ad44 100644
--- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/ApiBaselineManager.java
+++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/ApiBaselineManager.java
@@ -543,7 +543,7 @@
if (baselinecache == null) {
return false;
}
- return baselinecache.keySet().contains(name);
+ return baselinecache.containsKey(name);
}
/**
diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/ApiJavadocTag.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/ApiJavadocTag.java
index cbccf22..13f874a 100644
--- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/ApiJavadocTag.java
+++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/ApiJavadocTag.java
@@ -130,7 +130,7 @@
@Override
public boolean isApplicable(int type, int member) {
- return fTagItems != null && fTagItems.keySet().contains(getTagKey(type, member));
+ return fTagItems != null && fTagItems.containsKey(getTagKey(type, member));
}
@Override
diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/AbstractProblemDetector.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/AbstractProblemDetector.java
index 5a18898..5a4b198 100644
--- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/AbstractProblemDetector.java
+++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/AbstractProblemDetector.java
@@ -501,7 +501,7 @@
public List<IApiProblem> createProblems(IProgressMonitor monitor) {
List<IReference> references = getRetainedReferences();
if (references.isEmpty()) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
List<IApiProblem> problems = new LinkedList<>();
Iterator<IReference> iterator = references.iterator();
diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/ProjectComponent.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/ProjectComponent.java
index b74777d..7239c25 100644
--- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/ProjectComponent.java
+++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/ProjectComponent.java
@@ -281,7 +281,7 @@
}
return super.createApiTypeContainers();
}
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
private void retrieveContainers(String name, String prefix, IBuildEntry buildEntry) throws CoreException {
diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/search/ApiSearchEngine.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/search/ApiSearchEngine.java
index b6a7879..7e38e60 100644
--- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/search/ApiSearchEngine.java
+++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/search/ApiSearchEngine.java
@@ -160,7 +160,7 @@
IApiMember member = null;
for (Iterator<IReference> iter = references.iterator(); iter.hasNext();) {
if (localmonitor.isCanceled()) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
ref = iter.next();
member = ref.getResolvedReference();
diff --git a/ds/org.eclipse.pde.ds.tests/All DS Tests.launch b/ds/org.eclipse.pde.ds.tests/All DS Tests.launch
index ff5467e..b35114a 100644
--- a/ds/org.eclipse.pde.ds.tests/All DS Tests.launch
+++ b/ds/org.eclipse.pde.ds.tests/All DS Tests.launch
@@ -1,44 +1,46 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
-<booleanAttribute key="append.args" value="true"/>
-<booleanAttribute key="askclear" value="false"/>
-<booleanAttribute key="automaticAdd" value="true"/>
-<booleanAttribute key="automaticValidate" value="false"/>
-<stringAttribute key="bootstrap" value=""/>
-<booleanAttribute key="clearConfig" value="true"/>
-<booleanAttribute key="clearws" value="true"/>
-<booleanAttribute key="clearwslog" value="false"/>
-<booleanAttribute key="com.mountainminds.eclemma.core.INPLACE_INSTRUMENTATION" value="true"/>
-<listAttribute key="com.mountainminds.eclemma.core.INSTRUMENTATION_PATHS">
-<listEntry value="/org.eclipse.pde.ds.core/bin"/>
-<listEntry value="/org.eclipse.pde.ds.ui/bin"/>
-</listAttribute>
-<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
-<booleanAttribute key="default" value="true"/>
-<booleanAttribute key="includeOptional" value="true"/>
-<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/AllDSModelTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.pde.internal.ds.tests.AllDSModelTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.pde.ds.tests"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="pde.version" value="3.3"/>
-<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
-<booleanAttribute key="run_in_ui_thread" value="true"/>
-<booleanAttribute key="show_selected_only" value="false"/>
-<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
-<booleanAttribute key="tracing" value="false"/>
-<booleanAttribute key="useDefaultConfig" value="true"/>
-<booleanAttribute key="useDefaultConfigArea" value="false"/>
-<booleanAttribute key="useProduct" value="true"/>
+ <booleanAttribute key="append.args" value="true"/>
+ <booleanAttribute key="askclear" value="false"/>
+ <booleanAttribute key="automaticAdd" value="true"/>
+ <booleanAttribute key="automaticValidate" value="false"/>
+ <stringAttribute key="bootstrap" value=""/>
+ <stringAttribute key="checked" value="[NONE]"/>
+ <booleanAttribute key="clearConfig" value="true"/>
+ <booleanAttribute key="clearws" value="true"/>
+ <booleanAttribute key="clearwslog" value="false"/>
+ <booleanAttribute key="com.mountainminds.eclemma.core.INPLACE_INSTRUMENTATION" value="true"/>
+ <listAttribute key="com.mountainminds.eclemma.core.INSTRUMENTATION_PATHS">
+ <listEntry value="/org.eclipse.pde.ds.core/bin"/>
+ <listEntry value="/org.eclipse.pde.ds.ui/bin"/>
+ </listAttribute>
+ <stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+ <booleanAttribute key="default" value="true"/>
+ <booleanAttribute key="includeOptional" value="true"/>
+ <stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+ <listEntry value="/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/AllDSModelTests.java"/>
+ </listAttribute>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+ <listEntry value="1"/>
+ </listAttribute>
+ <stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+ <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+ <stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+ <stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+ <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.pde.internal.ds.tests.AllDSModelTests"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.pde.ds.tests"/>
+ <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+ <stringAttribute key="pde.version" value="3.3"/>
+ <stringAttribute key="product" value="org.eclipse.sdk.ide"/>
+ <booleanAttribute key="run_in_ui_thread" value="true"/>
+ <booleanAttribute key="show_selected_only" value="false"/>
+ <stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
+ <booleanAttribute key="tracing" value="false"/>
+ <booleanAttribute key="useCustomFeatures" value="false"/>
+ <booleanAttribute key="useDefaultConfig" value="true"/>
+ <booleanAttribute key="useDefaultConfigArea" value="false"/>
+ <booleanAttribute key="useProduct" value="true"/>
</launchConfiguration>
diff --git a/ds/org.eclipse.pde.ds.tests/META-INF/MANIFEST.MF b/ds/org.eclipse.pde.ds.tests/META-INF/MANIFEST.MF
index eb5310b..efd6944 100644
--- a/ds/org.eclipse.pde.ds.tests/META-INF/MANIFEST.MF
+++ b/ds/org.eclipse.pde.ds.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.pde.ds.tests
-Bundle-Version: 1.1.500.qualifier
+Bundle-Version: 1.1.600.qualifier
Bundle-Activator: org.eclipse.pde.internal.ds.tests.Activator
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.11.0,4.0.0)",
org.junit;bundle-version="3.8.2",
diff --git a/ds/org.eclipse.pde.ds.tests/pom.xml b/ds/org.eclipse.pde.ds.tests/pom.xml
index 0dbe66a..14cb9c9 100644
--- a/ds/org.eclipse.pde.ds.tests/pom.xml
+++ b/ds/org.eclipse.pde.ds.tests/pom.xml
@@ -20,6 +20,6 @@
</parent>
<groupId>org.eclipse.pde</groupId>
<artifactId>org.eclipse.pde.ds.tests</artifactId>
- <version>1.1.500-SNAPSHOT</version>
+ <version>1.1.600-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
</project>
diff --git a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/AbstractDSModelTestCase.java b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/AbstractDSModelTestCase.java
index e112065..e9700fb 100644
--- a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/AbstractDSModelTestCase.java
+++ b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/AbstractDSModelTestCase.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.pde.internal.ds.tests;
+import static org.junit.Assert.fail;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
@@ -22,10 +24,9 @@
import org.eclipse.text.edits.MalformedTreeException;
import org.eclipse.text.edits.MultiTextEdit;
import org.eclipse.text.edits.TextEdit;
+import org.junit.Before;
-import junit.framework.TestCase;
-
-public abstract class AbstractDSModelTestCase extends TestCase {
+public abstract class AbstractDSModelTestCase {
protected static final String LF = "\n"; //$NON-NLS-1$
protected static final String CR = "\r"; //$NON-NLS-1$
@@ -37,11 +38,8 @@
protected DSModel fModel;
protected IModelTextChangeListener fListener;
- public AbstractDSModelTestCase() {
- }
-
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
fDocument = new Document();
}
diff --git a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/AllDSModelTests.java b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/AllDSModelTests.java
index aaced50..5958392 100644
--- a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/AllDSModelTests.java
+++ b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/AllDSModelTests.java
@@ -14,23 +14,12 @@
*******************************************************************************/
package org.eclipse.pde.internal.ds.tests;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+@RunWith(Suite.class)
+@Suite.SuiteClasses({ DSComponentTestCase.class, DSServiceTestCase.class, DSReferenceTestCase.class,
+ DSProvideTestCase.class, DSPropertyTestCase.class, DSPropertiesTestCase.class, DSImplementationTestCase.class,
+ DSObjectTestCase.class, DSv10tov11TestCase.class })
public class AllDSModelTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite("Test Suite for org.eclipse.pde.ds.core"); //$NON-NLS-1$
- suite.addTestSuite(DSComponentTestCase.class);
- suite.addTestSuite(DSServiceTestCase.class);
- suite.addTestSuite(DSReferenceTestCase.class);
- suite.addTestSuite(DSProvideTestCase.class);
- suite.addTestSuite(DSPropertyTestCase.class);
- suite.addTestSuite(DSPropertiesTestCase.class);
- suite.addTestSuite(DSImplementationTestCase.class);
- suite.addTestSuite(DSObjectTestCase.class);
- suite.addTestSuite(DSv10tov11TestCase.class);
- return suite;
- }
-
}
diff --git a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSComponentTestCase.java b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSComponentTestCase.java
index c319280..823a44c 100644
--- a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSComponentTestCase.java
+++ b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSComponentTestCase.java
@@ -14,6 +14,11 @@
*******************************************************************************/
package org.eclipse.pde.internal.ds.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.internal.core.text.IDocumentElementNode;
import org.eclipse.pde.internal.ds.core.IDSComponent;
import org.eclipse.pde.internal.ds.core.IDSDocumentFactory;
@@ -22,9 +27,10 @@
import org.eclipse.pde.internal.ds.core.IDSProperty;
import org.eclipse.pde.internal.ds.core.IDSReference;
import org.eclipse.pde.internal.ds.core.IDSService;
+import org.junit.Test;
public class DSComponentTestCase extends AbstractDSModelTestCase {
-
+ @Test
public void testAddDefaultComponent() {
StringBuilder buffer = new StringBuilder();
setXMLContents(buffer, LF);
@@ -41,6 +47,7 @@
assertTrue(component.getEnabled());
}
+ @Test
public void testAddComponentwithAllAttributes() {
StringBuilder buffer = new StringBuilder();
setXMLContents(buffer, LF);
@@ -67,6 +74,7 @@
assertEquals(component.getModifiedMethod(), "modified");
}
+ @Test
public void testAddMoveRemoveChildrens() {
StringBuilder buffer = new StringBuilder();
setXMLContents(buffer, LF);
diff --git a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSImplementationTestCase.java b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSImplementationTestCase.java
index 381cb75..a74be70 100644
--- a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSImplementationTestCase.java
+++ b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSImplementationTestCase.java
@@ -14,12 +14,18 @@
*******************************************************************************/
package org.eclipse.pde.internal.ds.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.internal.ds.core.IDSComponent;
import org.eclipse.pde.internal.ds.core.IDSDocumentFactory;
import org.eclipse.pde.internal.ds.core.IDSImplementation;
+import org.junit.Test;
public class DSImplementationTestCase extends AbstractDSModelTestCase {
+ @Test
public void testAddImplementationComponent() {
StringBuilder buffer = new StringBuilder();
buffer.append("<implementation class=\"");
@@ -44,6 +50,7 @@
/**
* Tests a service component default values
*/
+ @Test
public void testDefaultValuesService() {
StringBuilder buffer = new StringBuilder();
buffer.append("<implementation>");
@@ -64,6 +71,7 @@
/**
* Tests to add a implementation by DSDocumentFactory
*/
+ @Test
public void testAddImplementationFactory() {
StringBuilder buffer = new StringBuilder();
setXMLContents(buffer, LF);
diff --git a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSObjectTestCase.java b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSObjectTestCase.java
index 63bb726..4ba1fe3 100644
--- a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSObjectTestCase.java
+++ b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSObjectTestCase.java
@@ -13,6 +13,10 @@
*******************************************************************************/
package org.eclipse.pde.internal.ds.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.util.List;
import org.eclipse.pde.internal.ds.core.IDSComponent;
@@ -23,10 +27,11 @@
import org.eclipse.pde.internal.ds.core.IDSProperty;
import org.eclipse.pde.internal.ds.core.IDSReference;
import org.eclipse.pde.internal.ds.core.IDSService;
+import org.junit.Test;
public class DSObjectTestCase extends AbstractDSModelTestCase {
-
+ @Test
public void testObject(){
StringBuilder buffer = new StringBuilder();
setXMLContents(buffer, LF);
diff --git a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSPropertiesTestCase.java b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSPropertiesTestCase.java
index 482d13d..853f449 100644
--- a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSPropertiesTestCase.java
+++ b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSPropertiesTestCase.java
@@ -13,12 +13,17 @@
*******************************************************************************/
package org.eclipse.pde.internal.ds.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.internal.ds.core.IDSComponent;
import org.eclipse.pde.internal.ds.core.IDSDocumentFactory;
import org.eclipse.pde.internal.ds.core.IDSProperties;
+import org.junit.Test;
public class DSPropertiesTestCase extends AbstractDSModelTestCase {
-
+ @Test
public void testAddPropertiesComponent() {
StringBuilder buffer = new StringBuilder();
buffer.append("<properties entry=\"");
@@ -41,8 +46,9 @@
}
/**
- * Tests a component with multiple properties
+ * Tests a component with multiple properties
*/
+ @Test
public void testMultipleProperties() {
StringBuilder buffer = new StringBuilder();
buffer.append("<properties entry=\"");
@@ -85,6 +91,7 @@
/**
* Tests a properties component default values
*/
+ @Test
public void testDefaultValuesService() {
StringBuilder buffer = new StringBuilder();
buffer.append("<properties>");
@@ -109,6 +116,7 @@
/**
* Tests to add a properties by DSDocumentFactory
*/
+ @Test
public void testAddPropertiesFactory(){
StringBuilder buffer = new StringBuilder();
setXMLContents(buffer , LF);
diff --git a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSPropertyTestCase.java b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSPropertyTestCase.java
index 6800ca3..33a6786 100644
--- a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSPropertyTestCase.java
+++ b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSPropertyTestCase.java
@@ -13,11 +13,16 @@
*******************************************************************************/
package org.eclipse.pde.internal.ds.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.internal.ds.core.IDSComponent;
import org.eclipse.pde.internal.ds.core.IDSProperty;
+import org.junit.Test;
public class DSPropertyTestCase extends AbstractDSModelTestCase {
-
+ @Test
public void testAddProperty() {
StringBuilder buffer = new StringBuilder();
buffer.append("<property ");
diff --git a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSProvideTestCase.java b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSProvideTestCase.java
index 39f3efb..7c63e4c 100644
--- a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSProvideTestCase.java
+++ b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSProvideTestCase.java
@@ -13,13 +13,18 @@
*******************************************************************************/
package org.eclipse.pde.internal.ds.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.internal.ds.core.IDSComponent;
import org.eclipse.pde.internal.ds.core.IDSDocumentFactory;
import org.eclipse.pde.internal.ds.core.IDSProvide;
import org.eclipse.pde.internal.ds.core.IDSService;
+import org.junit.Test;
public class DSProvideTestCase extends AbstractDSModelTestCase {
-
+ @Test
public void testAddCompleteProvidedService() {
StringBuilder buffer = new StringBuilder();
buffer.append("<service servicefactory=\"true\" >");
@@ -56,6 +61,7 @@
/**
* Tests to add a provided service by DSDocumentFactory
*/
+ @Test
public void testAddProvidedServicebyFactory() {
StringBuilder buffer = new StringBuilder();
setXMLContents(buffer , LF);
diff --git a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSReferenceTestCase.java b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSReferenceTestCase.java
index a9b5b9c..ff909d9 100644
--- a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSReferenceTestCase.java
+++ b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSReferenceTestCase.java
@@ -13,11 +13,16 @@
*******************************************************************************/
package org.eclipse.pde.internal.ds.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.internal.ds.core.IDSComponent;
import org.eclipse.pde.internal.ds.core.IDSReference;
+import org.junit.Test;
public class DSReferenceTestCase extends AbstractDSModelTestCase {
-
+ @Test
public void testServiceReference() {
StringBuilder buffer = new StringBuilder();
setXMLContents(buffer, LF);
@@ -61,6 +66,7 @@
}
+ @Test
public void testDefaultServiceReference() {
StringBuilder buffer = new StringBuilder();
setXMLContents(buffer, LF);
diff --git a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSServiceTestCase.java b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSServiceTestCase.java
index 8c585a5..2b463fb 100644
--- a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSServiceTestCase.java
+++ b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSServiceTestCase.java
@@ -13,6 +13,10 @@
*******************************************************************************/
package org.eclipse.pde.internal.ds.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.internal.core.text.IDocumentElementNode;
import org.eclipse.pde.internal.ds.core.IDSComponent;
import org.eclipse.pde.internal.ds.core.IDSConstants;
@@ -20,12 +24,14 @@
import org.eclipse.pde.internal.ds.core.IDSObject;
import org.eclipse.pde.internal.ds.core.IDSProvide;
import org.eclipse.pde.internal.ds.core.IDSService;
+import org.junit.Test;
public class DSServiceTestCase extends AbstractDSModelTestCase {
/**
* Tests a service component with all Attributes and Child values
*/
+ @Test
public void testAddCompleteService() {
StringBuilder buffer = new StringBuilder();
buffer.append("<service servicefactory=\"true\" >");
@@ -72,6 +78,7 @@
/**
* Tests a service component with multiple Childs
*/
+ @Test
public void testMultipleProvideService() {
StringBuilder buffer = new StringBuilder();
buffer.append("<service>");
@@ -128,6 +135,7 @@
/**
* Tests a service component default values
*/
+ @Test
public void testDefaultValuesService() {
StringBuilder buffer = new StringBuilder();
buffer.append("<service>");
@@ -152,6 +160,7 @@
/**
* Test to remove a provided service element from a service element.
*/
+ @Test
public void testRemoveChildService(){
StringBuilder buffer = new StringBuilder();
buffer.append("<service servicefactory=\"true\" >");
@@ -186,6 +195,7 @@
/**
* Tests to add a service by DSDocumentFactory
*/
+ @Test
public void testAddServiceFactory(){
StringBuilder buffer = new StringBuilder();
setXMLContents(buffer , LF);
diff --git a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSv10tov11TestCase.java b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSv10tov11TestCase.java
index 5654c04..bf18e43 100644
--- a/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSv10tov11TestCase.java
+++ b/ds/org.eclipse.pde.ds.tests/src/org/eclipse/pde/internal/ds/tests/DSv10tov11TestCase.java
@@ -14,10 +14,14 @@
*******************************************************************************/
package org.eclipse.pde.internal.ds.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.eclipse.pde.internal.ds.core.IDSComponent;
+import org.junit.Test;
public class DSv10tov11TestCase extends AbstractDSModelTestCase {
-
+ @Test
public void testAddDefaultComponent() {
StringBuilder buffer = new StringBuilder();
setXMLContents(buffer, LF);
diff --git a/ui/org.eclipse.pde.core/book.css b/ui/org.eclipse.pde.core/book.css
index 1ecf145..9b05cfc 100644
--- a/ui/org.eclipse.pde.core/book.css
+++ b/ui/org.eclipse.pde.core/book.css
@@ -109,4 +109,27 @@
border-width: 0px;
border-style: none;
vertical-align: middle;
+}
+
+@media (prefers-color-scheme: dark) {
+ body {
+ color: #f0f0f0;
+ background: #3d3d3d;
+ }
+ body, h1, h2, h3, h4, h5, h6, h6.CaptionFigColumn, caption, p, p.note
+ table, td, th, ul, ol, dl, li, dd, dt, pre {
+ color: #f0f0f0;
+ }
+
+ a:visited{
+ color: #75d7ff;
+ }
+
+ a:link{
+ color: #3ac6ff;
+ }
+
+ a:hover{
+ color: #f0f0f0;
+ }
}
\ No newline at end of file
diff --git a/ui/org.eclipse.pde.core/schema.css b/ui/org.eclipse.pde.core/schema.css
index 7ae11fa..95a1e74 100644
--- a/ui/org.eclipse.pde.core/schema.css
+++ b/ui/org.eclipse.pde.core/schema.css
@@ -72,3 +72,32 @@
margin-left: 32.000000pt;
}
+@media (prefers-color-scheme: dark) {
+ P.SchemaCopyright {
+ color: #3ac6ff;
+ }
+
+ P.SchemaDtd {
+ color: #ff6666;
+ }
+
+ P.SchemaDtdAttlist {
+ color: #ff6666;
+ }
+
+ span.SchemaTag {
+ color: #8080ff;
+ }
+
+ span.SchemaCstring {
+ color: #00ff00;
+ }
+
+ .ConfigMarkupElementDesc {
+ color: black;
+ }
+
+ .ConfigMarkupAttlistDesc {
+ color: black;
+ }
+}
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/BundleManifestSourceLocationManager.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/BundleManifestSourceLocationManager.java
index c58636e..1b6f0f2 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/BundleManifestSourceLocationManager.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/BundleManifestSourceLocationManager.java
@@ -69,7 +69,7 @@
* @return set of source locations, possibly empty
*/
public Collection<SourceLocation> getSourceLocations() {
- Collection<SourceLocation> result = new ArrayList<>(fPluginToSourceBundle.values().size());
+ Collection<SourceLocation> result = new ArrayList<>(fPluginToSourceBundle.size());
for (IPluginModelBase bundle : fPluginToSourceBundle.values()) {
SourceLocation location = new SourceLocation(new Path(bundle.getInstallLocation()));
location.setUserDefined(false);
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/DependencyManager.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/DependencyManager.java
index c4c9178..df74354 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/DependencyManager.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/DependencyManager.java
@@ -309,9 +309,9 @@
VersionConstraint[] unsatisfiedConstraints = input.values().stream()
.filter(ResolverError[].class::isInstance)
.map(ResolverError[].class::cast)
- .flatMap(arr -> Arrays.stream(arr))
+ .flatMap(Arrays::stream)
.filter(err -> err.getUnsatisfiedConstraint() != null)
- .map(err -> err.getUnsatisfiedConstraint())
+ .map(ResolverError::getUnsatisfiedConstraint)
.toArray(VersionConstraint[]::new);
for (VersionConstraint constraint : unsatisfiedConstraints) {
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/FeatureModelManager.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/FeatureModelManager.java
index 4fb6dd7..ea7c54f 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/FeatureModelManager.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/FeatureModelManager.java
@@ -95,7 +95,7 @@
fActiveModels = new FeatureTable();
fInactiveModels = new FeatureTable();
- fProviderListener = e -> handleModelsChanged(e);
+ fProviderListener = this::handleModelsChanged;
fWorkspaceManager.addModelProviderListener(fProviderListener);
IFeatureModel[] models = fWorkspaceManager.getFeatureModels();
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/bundle/Bundle.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/bundle/Bundle.java
index 8811bff..7abcc5e 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/bundle/Bundle.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/bundle/Bundle.java
@@ -108,7 +108,7 @@
* @return a map containing all key/value pairs of manifest headers as strings, values may be empty strings, but not <code>null</code>
*/
protected Map<String, String> getHeaders() {
- Map<String, String> result = new HashMap<>(fDocumentHeaders.values().size());
+ Map<String, String> result = new HashMap<>(fDocumentHeaders.size());
for (IManifestHeader header : fDocumentHeaders.values()) {
if (header.getValue() != null) {
result.put(header.getKey(), header.getValue());
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/project/ProjectModifyOperation.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/project/ProjectModifyOperation.java
index b3f4c8b..3caf7b2 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/project/ProjectModifyOperation.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/project/ProjectModifyOperation.java
@@ -799,7 +799,7 @@
model.getBuild().add(binEntry);
}
boolean modified = fillBinIncludes(project, binEntry, description, before);
- modified = createSourceOutputBuildEntries(model, factory, description, before) | modified;
+ modified = createSourceOutputBuildEntries(model, factory, description, before) || modified;
if (modified) {
model.save();
}
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/ProfileBundleContainer.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/ProfileBundleContainer.java
index b06f7f0..8826104 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/ProfileBundleContainer.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/ProfileBundleContainer.java
@@ -14,6 +14,7 @@
package org.eclipse.pde.internal.core.target;
import static java.util.Arrays.stream;
+import static java.util.Collections.emptyList;
import static java.util.stream.Stream.concat;
import java.io.File;
@@ -24,7 +25,7 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Properties;
@@ -133,9 +134,9 @@
if (infos == null) {
if (configUrl != null) {
try {
- TargetBundle[] osgiBundles = readBundleInfosFromConfigIni(configUrl.toURI());
- if (osgiBundles != null && osgiBundles.length > 0) {
- return osgiBundles;
+ Collection<TargetBundle> osgiBundles = readBundleInfosFromConfigIni(configUrl.toURI());
+ if (!osgiBundles.isEmpty()) {
+ return osgiBundles.toArray(new TargetBundle[0]);
}
} catch (URISyntaxException ex) {
throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, ex.getMessage(), ex));
@@ -173,42 +174,78 @@
}).filter(Objects::nonNull).toArray(TargetBundle[]::new);
}
- private TargetBundle[] readBundleInfosFromConfigIni(URI configArea) {
+ private Collection<TargetBundle> readBundleInfosFromConfigIni(URI configArea) {
File configIni = new File(configArea);
configIni = new File(configIni, CONFIG_INI);
if (!configIni.isFile()) {
- return null;
+ return emptyList();
}
Properties configProps = new Properties();
try (FileInputStream fis = new FileInputStream(configIni)) {
configProps.load(fis);
} catch (IOException e) {
PDECore.log(e);
- return null;
+ return emptyList();
}
+
+ List<File> bundleFiles = parseBundlesFromConfigIni(configProps);
+ ArrayList<TargetBundle> bundles = new ArrayList<>();
+ for (File file : bundleFiles) {
+ if (!file.exists()) {
+ continue;
+ }
+ TargetBundle bundle;
+ try {
+ bundle = new TargetBundle(file);
+ } catch (CoreException e) {
+ bundle = new InvalidTargetBundle(new BundleInfo(file.toURI()), e.getStatus());
+ }
+ bundles.add(bundle);
+ }
+ return bundles;
+ }
+
+ public static List<File> parseBundlesFromConfigIni(Properties configProps) {
String osgiBundles = configProps.getProperty("osgi.bundles"); //$NON-NLS-1$
if (osgiBundles == null || osgiBundles.isEmpty()) {
- return null;
+ return emptyList();
}
+
+ ArrayList<File> bundles = new ArrayList<>();
+ File baseDir = null;
+
String osgiFramework = configProps.getProperty("osgi.framework"); //$NON-NLS-1$
- if (osgiFramework != null && !osgiFramework.isEmpty()) {
- osgiBundles = osgiFramework + ',' + osgiBundles;
+ if (osgiFramework != null) {
+ File frameworkBundle = parseBundleLocation(osgiFramework);
+ bundles.add(frameworkBundle);
+ baseDir = frameworkBundle.getParentFile();
}
- return Arrays.stream(osgiBundles.split(",")) //$NON-NLS-1$
- .map(entry -> entry.split("@")[0]) //$NON-NLS-1$
- .map(location -> location.startsWith("reference:") ? location.substring("reference:".length()) //$NON-NLS-1$ //$NON-NLS-2$
- : location)
- .map(URI::create) //
- .filter(URI::isAbsolute) //
- .map(File::new) //
- .map(file -> {
- try {
- return new TargetBundle(file);
- } catch (CoreException e) {
- return new InvalidTargetBundle(new BundleInfo(file.toURI()), e.getStatus());
- }
- }).filter(Objects::nonNull) //
- .toArray(TargetBundle[]::new);
+
+ for (String spec : osgiBundles.split(",")) { //$NON-NLS-1$
+ File location = parseBundleLocation(spec);
+ if (baseDir == null || location.isAbsolute()) {
+ bundles.add(location);
+ } else {
+ bundles.add(new File(baseDir, location.getPath()));
+ }
+ }
+
+ return bundles;
+ }
+
+ private static File parseBundleLocation(String spec) {
+ String path = spec.split("@", 2)[0]; //$NON-NLS-1$
+ path = trimPrefix(path, "reference:"); //$NON-NLS-1$
+ path = trimPrefix(path, "file:"); //$NON-NLS-1$
+ return new File(path);
+ }
+
+ private static String trimPrefix(String string, String prefix) {
+ if (string.startsWith(prefix)) {
+ return string.substring(prefix.length());
+ }
+
+ return string;
}
@Override
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/TargetDefinition.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/TargetDefinition.java
index e1aeb6a..a2f3ba9 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/TargetDefinition.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/TargetDefinition.java
@@ -1403,7 +1403,7 @@
}
for (Entry<String, List<Element>> entry : oldContainersByRepo.entrySet()) {
- entry.getValue().forEach(element -> TargetDefinitionDocumentTools.removeChildAndWhitespace(element));
+ entry.getValue().forEach(TargetDefinitionDocumentTools::removeChildAndWhitespace);
}
}
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/util/PDEJavaHelper.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/util/PDEJavaHelper.java
index af35156..29ecb74 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/util/PDEJavaHelper.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/util/PDEJavaHelper.java
@@ -67,7 +67,8 @@
try {
IType type = project.findType(fullyQualifiedName.replace('$', '.'));
if (type != null && type.exists()) {
- HashMap<String, IPackageFragment> map = PDEJavaHelper.getPackageFragmentsHash(project, Collections.EMPTY_LIST, false);
+ HashMap<String, IPackageFragment> map = PDEJavaHelper.getPackageFragmentsHash(project,
+ Collections.emptyList(), false);
if (map.containsValue(type.getPackageFragment())) {
return false;
}
diff --git a/ui/org.eclipse.pde.genericeditor.extension/src/org/eclipse/pde/internal/genericeditor/target/extension/reconciler/presentation/TargetPlatformPresentationReconciler.java b/ui/org.eclipse.pde.genericeditor.extension/src/org/eclipse/pde/internal/genericeditor/target/extension/reconciler/presentation/TargetPlatformPresentationReconciler.java
index bbbaf4b..9160fb3 100644
--- a/ui/org.eclipse.pde.genericeditor.extension/src/org/eclipse/pde/internal/genericeditor/target/extension/reconciler/presentation/TargetPlatformPresentationReconciler.java
+++ b/ui/org.eclipse.pde.genericeditor.extension/src/org/eclipse/pde/internal/genericeditor/target/extension/reconciler/presentation/TargetPlatformPresentationReconciler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016, 2018 Red Hat Inc. and others
+ * Copyright (c) 2016, 2020 Red Hat Inc. and others
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -11,6 +11,7 @@
* Contributors:
* Sopot Cela (Red Hat Inc.)
* Lucas Bullen (Red Hat Inc.) - [Bug 531210] Target File Source Editor unreadable with dark theme
+ * Alexander Fedorov <alexander.fedorov@arsysop.ru> - Bug 559432
*******************************************************************************/
package org.eclipse.pde.internal.genericeditor.target.extension.reconciler.presentation;
@@ -34,6 +35,7 @@
import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
@@ -56,7 +58,7 @@
return;
}
setDamageRepairerScanner();
- viewer.invalidateTextPresentation();
+ Display.getDefault().asyncExec(() -> viewer.invalidateTextPresentation());
}
}
diff --git a/ui/org.eclipse.pde.junit.runtime.tests/src/org/eclipse/pde/junit/runtime/tests/JUnitExecutionTest.java b/ui/org.eclipse.pde.junit.runtime.tests/src/org/eclipse/pde/junit/runtime/tests/JUnitExecutionTest.java
index 2e81b1c..32c4260 100644
--- a/ui/org.eclipse.pde.junit.runtime.tests/src/org/eclipse/pde/junit/runtime/tests/JUnitExecutionTest.java
+++ b/ui/org.eclipse.pde.junit.runtime.tests/src/org/eclipse/pde/junit/runtime/tests/JUnitExecutionTest.java
@@ -50,8 +50,6 @@
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
-import junit.framework.AssertionFailedError;
-
@RunWith(Parameterized.class)
public class JUnitExecutionTest {
@@ -131,16 +129,16 @@
if (ITestElement.Result.OK.equals(testResult))
return;
- AssertionFailedError assertionFailedError = new AssertionFailedError("test completed with " + testResult);
+ AssertionError assertionFailedError = new AssertionError("test completed with " + testResult);
addFailureTraces(session, assertionFailedError);
throw assertionFailedError;
}
- private void addFailureTraces(ITestElement element, AssertionFailedError assertionFailedError) {
+ private void addFailureTraces(ITestElement element, AssertionError assertionFailedError) {
FailureTrace trace = element.getFailureTrace();
if (trace != null) {
- assertionFailedError.addSuppressed(new AssertionFailedError("FailureTrace of " + element + ":\n\n" + trace.getTrace()));
+ assertionFailedError.addSuppressed(new AssertionError("FailureTrace of " + element + ":\n\n" + trace.getTrace()));
}
if (element instanceof ITestElementContainer) {
diff --git a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/BundleLauncherHelper.java b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/BundleLauncherHelper.java
index ac2ea5b..f3c6e49 100644
--- a/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/BundleLauncherHelper.java
+++ b/ui/org.eclipse.pde.launching/src/org/eclipse/pde/internal/launching/launcher/BundleLauncherHelper.java
@@ -14,6 +14,8 @@
*******************************************************************************/
package org.eclipse.pde.internal.launching.launcher;
+import static java.util.Collections.emptySet;
+
import java.util.*;
import java.util.Map.Entry;
import org.eclipse.core.runtime.CoreException;
@@ -517,6 +519,10 @@
wc.setAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, value2);
}
+ convertToSet(wc, IPDELauncherConstants.SELECTED_TARGET_PLUGINS, IPDELauncherConstants.SELECTED_TARGET_BUNDLES);
+ convertToSet(wc, IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS, IPDELauncherConstants.SELECTED_WORKSPACE_BUNDLES);
+ convertToSet(wc, IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS, IPDELauncherConstants.DESELECTED_WORKSPACE_BUNDLES);
+
String version = configuration.getAttribute(IPDEConstants.LAUNCHER_PDE_VERSION, (String) null);
boolean newApp = TargetPlatformHelper.usesNewApplicationModel();
boolean upgrade = !"3.3".equals(version) && newApp; //$NON-NLS-1$
@@ -537,36 +543,27 @@
}
if (!"3.3".equals(version) && newApp) //$NON-NLS-1$
list.add("org.eclipse.equinox.app"); //$NON-NLS-1$
- StringBuilder extensions = new StringBuilder(configuration.getAttribute(IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS, "")); //$NON-NLS-1$
- StringBuilder target = new StringBuilder(configuration.getAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, "")); //$NON-NLS-1$
- for (int i = 0; i < list.size(); i++) {
- String plugin = list.get(i).toString();
+ Set<String> extensions = new LinkedHashSet<>(configuration.getAttribute(IPDELauncherConstants.SELECTED_WORKSPACE_BUNDLES, emptySet()));
+ Set<String> target = new LinkedHashSet<>(configuration.getAttribute(IPDELauncherConstants.SELECTED_TARGET_BUNDLES, emptySet()));
+ for (String plugin : list) {
IPluginModelBase model = PluginRegistry.findModel(plugin);
if (model == null)
continue;
if (model.getUnderlyingResource() != null) {
if (automaticAdd)
continue;
- if (extensions.length() > 0)
- extensions.append(","); //$NON-NLS-1$
- extensions.append(plugin);
+ extensions.add(plugin);
} else {
- if (target.length() > 0)
- target.append(","); //$NON-NLS-1$
- target.append(plugin);
+ target.add(plugin);
}
}
- if (extensions.length() > 0)
- wc.setAttribute(IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS, extensions.toString());
- if (target.length() > 0)
- wc.setAttribute(IPDELauncherConstants.SELECTED_TARGET_PLUGINS, target.toString());
+ if (!extensions.isEmpty())
+ wc.setAttribute(IPDELauncherConstants.SELECTED_WORKSPACE_BUNDLES, extensions);
+ if (!target.isEmpty())
+ wc.setAttribute(IPDELauncherConstants.SELECTED_TARGET_BUNDLES, target);
}
}
- convertToSet(wc, IPDELauncherConstants.SELECTED_TARGET_PLUGINS, IPDELauncherConstants.SELECTED_TARGET_BUNDLES);
- convertToSet(wc, IPDELauncherConstants.SELECTED_WORKSPACE_PLUGINS, IPDELauncherConstants.SELECTED_WORKSPACE_BUNDLES);
- convertToSet(wc, IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS, IPDELauncherConstants.DESELECTED_WORKSPACE_BUNDLES);
-
if (wc.isDirty()) {
wc.doSave();
}
diff --git a/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java b/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java
index e9060ea..4164e00 100644
--- a/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java
+++ b/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java
@@ -292,7 +292,7 @@
getViewSite().setSelectionProvider(fTreeViewer);
MenuManager popupMenuManager = new MenuManager();
- IMenuListener listener = mng -> fillContextMenu(mng);
+ IMenuListener listener = this::fillContextMenu;
popupMenuManager.setRemoveAllWhenShown(true);
popupMenuManager.addMenuListener(listener);
Menu menu = popupMenuManager.createContextMenu(tree);
diff --git a/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/RegistryModel.java b/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/RegistryModel.java
index 8855cae..d3ec482 100644
--- a/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/RegistryModel.java
+++ b/ui/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/RegistryModel.java
@@ -265,15 +265,15 @@
}
public Bundle[] getBundles() {
- return bundles.values().toArray(new Bundle[bundles.values().size()]);
+ return bundles.values().toArray(new Bundle[bundles.size()]);
}
public ExtensionPoint[] getExtensionPoints() {
- return extensionPoints.values().toArray(new ExtensionPoint[extensionPoints.values().size()]);
+ return extensionPoints.values().toArray(new ExtensionPoint[extensionPoints.size()]);
}
public ServiceRegistration[] getServices() {
- return services.values().toArray(new ServiceRegistration[services.values().size()]);
+ return services.values().toArray(new ServiceRegistration[services.size()]);
}
public ServiceName[] getServiceNames() {
diff --git a/ui/org.eclipse.pde.ui.templates/templates_3.1/extensibleEditor/java/$javaClassPrefix$Reconciler.java b/ui/org.eclipse.pde.ui.templates/templates_3.1/extensibleEditor/java/$javaClassPrefix$Reconciler.java
index 3e65c33..d474aae 100644
--- a/ui/org.eclipse.pde.ui.templates/templates_3.1/extensibleEditor/java/$javaClassPrefix$Reconciler.java
+++ b/ui/org.eclipse.pde.ui.templates/templates_3.1/extensibleEditor/java/$javaClassPrefix$Reconciler.java
@@ -1,6 +1,5 @@
package $packageName$;
-import $packageName$.$javaClassPrefix$ReconcilerStrategy;
import org.eclipse.jface.text.*;
import org.eclipse.jface.text.reconciler.Reconciler;
import org.eclipse.jface.text.source.projection.ProjectionViewer;
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/feature/FeatureDataTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/feature/FeatureDataTestCase.java
index 62ede07..44da05a 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/feature/FeatureDataTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/feature/FeatureDataTestCase.java
@@ -13,20 +13,25 @@
*******************************************************************************/
package org.eclipse.pde.core.tests.internal.feature;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import java.io.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.internal.core.feature.FeatureData;
import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel;
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
+import org.junit.Test;
import org.w3c.dom.*;
import org.xml.sax.InputSource;
-public class FeatureDataTestCase extends TestCase {
+
+public class FeatureDataTestCase {
private static final String FEATURE_INDENT = " ";
+ @Test
public void testSerialization() throws Exception {
String expected = String.format("<data%n" +
FEATURE_INDENT + "id=\"id.1\"%n" + FEATURE_INDENT + "os=\"win32\"%n" + FEATURE_INDENT
@@ -46,6 +51,7 @@
assertEquals(data.getDownloadSize(), data2.getDownloadSize());
}
+ @Test
public void testSerializationWithLdapFilter() throws CoreException {
String expected = String.format("<data%n" + FEATURE_INDENT + "id=\"id.1\"%n" + FEATURE_INDENT + "os=\"win32\"%n"
+ FEATURE_INDENT + "arch=\"x86_64\"%n" + FEATURE_INDENT
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/util/PDESchemaHelperTest.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/util/PDESchemaHelperTest.java
index 82a53b7..37b41e7 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/util/PDESchemaHelperTest.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/util/PDESchemaHelperTest.java
@@ -13,16 +13,19 @@
*******************************************************************************/
package org.eclipse.pde.core.tests.internal.util;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.util.HashSet;
import java.util.Set;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.Platform;
import org.eclipse.pde.internal.core.iproduct.IConfigurationProperty;
import org.eclipse.pde.internal.core.product.ProductModel;
import org.eclipse.pde.internal.core.product.ProductModelFactory;
import org.eclipse.pde.internal.core.util.PDESchemaHelper;
+import org.junit.Test;
-public class PDESchemaHelperTest extends TestCase {
+public class PDESchemaHelperTest {
private ProductModelFactory fProductModelFactory;
@@ -58,7 +61,7 @@
}
-
+ @Test
public void testContainsMatchingProperty() {
// exact same property test
boolean containsMatchingProperty = PDESchemaHelper.containsMatchingProperty(fConfigurationProperties,
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/PDETestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/PDETestCase.java
index fdd7726..39d7cc0 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/PDETestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/PDETestCase.java
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests;
-import junit.framework.TestCase;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
@@ -23,26 +22,29 @@
import org.eclipse.ui.intro.IIntroManager;
import org.eclipse.ui.intro.IIntroPart;
import org.eclipse.ui.progress.UIJob;
+import org.junit.*;
+import org.junit.rules.TestName;
/**
* Provides a default {@link #tearDown()} implementation to delete all
* projects in the workspace.
*
*/
-public abstract class PDETestCase extends TestCase {
+public abstract class PDETestCase {
private static boolean welcomeClosed;
+ @Rule
+ public TestName name = new TestName();
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- TestUtils.log(IStatus.INFO, getName(), "setUp");
+ @Before
+ public void setUp() throws Exception {
+ TestUtils.log(IStatus.INFO, name.getMethodName(), "setUp");
assertWelcomeScreenClosed();
}
- @Override
- protected void tearDown() {
- TestUtils.log(IStatus.INFO, getName(), "tearDown");
+ @After
+ public void tearDown() {
+ TestUtils.log(IStatus.INFO, name.getMethodName(), "tearDown");
// Close any editors we opened
IWorkbenchWindow[] workbenchPages = PlatformUI.getWorkbench().getWorkbenchWindows();
for (IWorkbenchWindow workbenchPage : workbenchPages) {
@@ -52,7 +54,7 @@
}
}
TestUtils.processUIEvents();
- TestUtils.cleanUp(getName());
+ TestUtils.cleanUp(name.getMethodName());
// Delete any projects that were created
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
IProject[] projects = workspaceRoot.getProjects();
@@ -62,7 +64,7 @@
}
} catch (CoreException e) {
}
- TestUtils.waitForJobs(getName(), 10, 10000);
+ TestUtils.waitForJobs(name.getMethodName(), 10, 10000);
}
/**
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/build/properties/AbstractBuildValidationTest.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/build/properties/AbstractBuildValidationTest.java
index fa8ad7b..1050daa 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/build/properties/AbstractBuildValidationTest.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/build/properties/AbstractBuildValidationTest.java
@@ -13,13 +13,16 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.build.properties;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.io.*;
import java.net.URL;
import java.util.Enumeration;
import java.util.PropertyResourceBundle;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
-import junit.framework.TestCase;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
@@ -34,6 +37,7 @@
import org.eclipse.pde.ui.tests.PDETestsPlugin;
import org.eclipse.pde.ui.tests.target.LocalTargetDefinitionTests;
import org.eclipse.ui.IMarkerResolution;
+import org.junit.Before;
import org.osgi.service.prefs.BackingStoreException;
/**
@@ -44,13 +48,13 @@
* @since 3.6
* @see BuildPropertiesValidationTest
*/
-public abstract class AbstractBuildValidationTest extends TestCase {
+public abstract class AbstractBuildValidationTest {
private static final String MARKER = "marker";
private static final String MULTIPLE_MARKERS = "multipleMarkers";
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
URL location = PDETestsPlugin.getBundleContext().getBundle().getEntry("/tests/build.properties/build.properties.tests.zip");
File projectFile = new File(FileLocator.toFileURL(location).getFile());
assertTrue("Could not find test zip file at " + projectFile, projectFile.isFile());
@@ -60,8 +64,8 @@
File[] projects = projectFile.listFiles((FileFilter) pathname -> {
int index = pathname.getName().lastIndexOf('.');
if (index > 1 && pathname.isDirectory()) { // look out for "CVS"
- // files in the
- // workspace
+ // files in the
+ // workspace
return true;
}
return false;
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/build/properties/BuildPropertiesValidationTest.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/build/properties/BuildPropertiesValidationTest.java
index 1bd05cf..10e422b 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/build/properties/BuildPropertiesValidationTest.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/build/properties/BuildPropertiesValidationTest.java
@@ -15,6 +15,7 @@
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.fail;
import java.io.FileInputStream;
import java.io.IOException;
@@ -23,6 +24,8 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.internal.core.builders.CompilerFlags;
import org.eclipse.pde.internal.core.builders.PDEMarkerFactory;
+import org.junit.Before;
+import org.junit.Test;
import org.osgi.service.prefs.BackingStoreException;
/**
@@ -37,13 +40,15 @@
private static boolean fOneTimeSetupComplete = false;
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
if (fOneTimeSetupComplete)
return;
super.setUp();
fOneTimeSetupComplete = true;
}
+ @Test
public void testSourceFolder() throws CoreException, BackingStoreException, IOException {
for (int i = 1; i <= 5; i++) {
IProject project = findProject("org.eclipse.pde.tests.build.properties." + i);
@@ -60,6 +65,7 @@
}
}
+ @Test
public void testJavacEntries() throws CoreException, BackingStoreException, IOException {
IProject project = findProject("org.eclipse.pde.tests.build.properties.6");
setPreferences(project, CompilerFlags.WARNING);
@@ -76,6 +82,7 @@
}
}
+ @Test
public void testJreCompliance() throws CoreException, BackingStoreException, IOException {
IProject project = findProject("org.eclipse.pde.tests.build.properties.7");
setPreferences(project, CompilerFlags.ERROR);
@@ -92,6 +99,7 @@
}
}
+ @Test
public void testSimpleProject() throws CoreException, BackingStoreException, IOException {
IProject project = findProject("org.eclipse.pde.tests.build.properties.8");
setPreferences(project, CompilerFlags.ERROR);
@@ -107,6 +115,7 @@
}
//Bug 292763
+ @Test
public void testSrcExcludeQuickFix() throws CoreException, BackingStoreException, IOException {
IProject project = findProject("org.eclipse.pde.tests.build.properties.9");
setPreferences(project, CompilerFlags.ERROR);
@@ -122,6 +131,7 @@
}
// Bug 323774
+ @Test
public void testOsgiInf() throws Exception {
IProject project = findProject("org.eclipse.pde.tests.build.properties.10");
setPreferences(project, CompilerFlags.ERROR);
@@ -137,6 +147,7 @@
}
// Bug 540442
+ @Test
public void testTestSource() throws CoreException, BackingStoreException, IOException {
IProject project = findProject("org.eclipse.pde.tests.build.properties.11");
setPreferences(project, CompilerFlags.ERROR);
@@ -152,6 +163,7 @@
}
}
+ @Test
public void testIncrementalMarkers() throws Exception {
IProject project = findProject("org.eclipse.pde.tests.build.properties.1");
setPreferences(project, CompilerFlags.ERROR);
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/classpathcontributor/ClasspathContributorTest.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/classpathcontributor/ClasspathContributorTest.java
index 037fe18..f7be339 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/classpathcontributor/ClasspathContributorTest.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/classpathcontributor/ClasspathContributorTest.java
@@ -13,11 +13,13 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.classpathcontributor;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.*;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
-import junit.framework.TestCase;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.jdt.core.*;
@@ -25,28 +27,30 @@
import org.eclipse.pde.internal.core.PDECore;
import org.eclipse.pde.ui.tests.PDETestsPlugin;
import org.eclipse.pde.ui.tests.classpathresolver.ClasspathResolverTest;
+import org.junit.*;
/**
* Tests {@link IClasspathContributor} API to add additional classpath
* entries during project classpath computation. Requires {@link TestClasspathContributor}
* to be installed as an extension.
*/
-public class ClasspathContributorTest extends TestCase {
+public class ClasspathContributorTest {
private static final IProgressMonitor monitor = new NullProgressMonitor();
private IWorkspace workspace = ResourcesPlugin.getWorkspace();
private IProject project;
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
project = importProject(workspace);
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
project.delete(true, true, monitor);
}
+ @Test
public void testAdditionalClasspathEntries() throws Exception {
List<IClasspathEntry> expected = new ArrayList<>(TestClasspathContributor.entries);
expected.addAll(TestClasspathContributor.entries2);
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/classpathresolver/ClasspathResolverTest.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/classpathresolver/ClasspathResolverTest.java
index d6b76cb..9c704db 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/classpathresolver/ClasspathResolverTest.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/classpathresolver/ClasspathResolverTest.java
@@ -14,10 +14,11 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.classpathresolver;
+import static org.junit.Assert.assertEquals;
+
import java.io.*;
import java.net.URL;
import java.util.Properties;
-import junit.framework.TestCase;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
@@ -29,13 +30,14 @@
import org.eclipse.pde.internal.launching.sourcelookup.PDESourceLookupDirector;
import org.eclipse.pde.internal.launching.sourcelookup.PDESourceLookupQuery;
import org.eclipse.pde.ui.tests.PDETestsPlugin;
+import org.junit.*;
/**
* Tests {@link IBundleClasspathResolver} API to extend how the classpath and source lookup path
* is created.
*
*/
-public class ClasspathResolverTest extends TestCase {
+public class ClasspathResolverTest {
private static final IProgressMonitor monitor = new NullProgressMonitor();
@@ -48,13 +50,13 @@
*/
public static final String bundleName = "classpathresolver";
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
project = importProject(workspace);
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
project.delete(true, true, monitor);
}
@@ -71,9 +73,12 @@
}
/**
- * Checks that a created dev properties file will recognise the modified classpath
+ * Checks that a created dev properties file will recognise the modified
+ * classpath
+ *
* @throws Exception
*/
+ @Test
public void testDevProperties() throws Exception {
File devProperties = File.createTempFile("dev", ".properties");
ClasspathHelper.getDevEntriesProperties(devProperties.getCanonicalPath(), false);
@@ -88,8 +93,10 @@
/**
* Checks that the source lookup path of a project is updated from the API
+ *
* @throws Exception
*/
+ @Test
public void testSourceLookupPath() throws Exception {
PDESourceLookupDirector d = new PDESourceLookupDirector();
_PDESourceLookupQuery q = new _PDESourceLookupQuery(d, project);
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExecutionEnvironmentTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExecutionEnvironmentTests.java
index 827c821..86c8b46 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExecutionEnvironmentTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExecutionEnvironmentTests.java
@@ -13,6 +13,10 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.ee;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.util.Hashtable;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
@@ -26,6 +30,7 @@
import org.eclipse.pde.internal.ui.wizards.tools.UpdateClasspathJob;
import org.eclipse.pde.ui.tests.PDETestCase;
import org.eclipse.pde.ui.tests.util.ProjectUtils;
+import org.junit.Test;
/**
* Tests projects with a custom execution environment
@@ -98,8 +103,10 @@
/**
* Validates the target level of a generated class file.
*
- * @param classfile location of class file in local file system
- * @param major expected major class file version
+ * @param classfile
+ * location of class file in local file system
+ * @param major
+ * expected major class file version
*/
protected void validateTargetLevel(String classfile, int major) {
IClassFileReader reader = ToolFactory.createDefaultClassFileReader(classfile, IClassFileReader.ALL);
@@ -107,18 +114,21 @@
}
/**
- * Creates a plug-in project with a custom execution environment. Validates that
- * compiler compliance settings and build path are correct and that class files
- * are generated with correct target level.
+ * Creates a plug-in project with a custom execution environment. Validates
+ * that compiler compliance settings and build path are correct and that
+ * class files are generated with correct target level.
*
- * TODO The VM this is run on must be included in the compatible JREs for the custom
- * environment. See {@link EnvironmentAnalyzerDelegate#analyze(org.eclipse.jdt.launching.IVMInstall, IProgressMonitor)}
+ * TODO The VM this is run on must be included in the compatible JREs for
+ * the custom environment. See
+ * {@link EnvironmentAnalyzerDelegate#analyze(org.eclipse.jdt.launching.IVMInstall, IProgressMonitor)}
*
* @throws Exception
*/
+ @Test
public void testCustomEnvironment() throws Exception {
try {
- IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment(EnvironmentAnalyzerDelegate.EE_NO_SOUND);
+ IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager()
+ .getEnvironment(EnvironmentAnalyzerDelegate.EE_NO_SOUND);
IJavaProject project = ProjectUtils.createPluginProject("no.sound", env);
assertTrue("Project was not created", project.exists());
@@ -142,12 +152,13 @@
}
/**
- * Creates a plug-in project with a J2SE-1.4 execution environment. Validates that
- * compiler compliance settings and build path are correct and that class files
- * are generated with correct target level.
+ * Creates a plug-in project with a J2SE-1.4 execution environment.
+ * Validates that compiler compliance settings and build path are correct
+ * and that class files are generated with correct target level.
*
* @throws Exception
*/
+ @Test
public void testJava4Environment() throws Exception {
try {
IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("J2SE-1.4");
@@ -173,22 +184,27 @@
}
/**
- * Creates a plug-in project without an execution environment. Validates that
- * compiler compliance settings and build path reflect default workspace settings.
+ * Creates a plug-in project without an execution environment. Validates
+ * that compiler compliance settings and build path reflect default
+ * workspace settings.
*
* @throws Exception
*/
+ @Test
public void testNoEnvironment() throws Exception {
try {
IJavaProject project = ProjectUtils.createPluginProject("no.env", null);
assertTrue("Project was not created", project.exists());
Hashtable<String, String> options = JavaCore.getOptions();
- validateOption(project, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, options.get(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM));
+ validateOption(project, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM,
+ options.get(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM));
validateOption(project, JavaCore.COMPILER_SOURCE, options.get(JavaCore.COMPILER_SOURCE));
validateOption(project, JavaCore.COMPILER_COMPLIANCE, options.get(JavaCore.COMPILER_COMPLIANCE));
- validateOption(project, JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, options.get(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER));
- validateOption(project, JavaCore.COMPILER_PB_ENUM_IDENTIFIER, options.get(JavaCore.COMPILER_PB_ENUM_IDENTIFIER));
+ validateOption(project, JavaCore.COMPILER_PB_ASSERT_IDENTIFIER,
+ options.get(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER));
+ validateOption(project, JavaCore.COMPILER_PB_ENUM_IDENTIFIER,
+ options.get(JavaCore.COMPILER_PB_ENUM_IDENTIFIER));
validateSystemLibrary(project, JavaRuntime.newDefaultJREContainerPath());
} finally {
@@ -197,13 +213,15 @@
}
/**
- * Creates a plug-in project with a J2SE-1.4 execution environment. Validates that
- * compiler compliance settings and build path are correct. Modifies the compliance
- * options and then updates the class path again. Ensures that the enum and assert
- * identifier options get overwritten with minimum 'warning' severity.
+ * Creates a plug-in project with a J2SE-1.4 execution environment.
+ * Validates that compiler compliance settings and build path are correct.
+ * Modifies the compliance options and then updates the class path again.
+ * Ensures that the enum and assert identifier options get overwritten with
+ * minimum 'warning' severity.
*
* @throws Exception
*/
+ @Test
public void testMinimumComplianceOverwrite() throws Exception {
try {
IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("J2SE-1.4");
@@ -226,7 +244,7 @@
// updating class path should increase severity to warning
IPluginModelBase model = PluginRegistry.findModel(project.getProject());
- UpdateClasspathJob job = new UpdateClasspathJob(new IPluginModelBase[]{model});
+ UpdateClasspathJob job = new UpdateClasspathJob(new IPluginModelBase[] { model });
job.schedule();
job.join();
@@ -243,13 +261,15 @@
}
/**
- * Creates a plug-in project with a J2SE-1.4 execution environment. Validates that
- * compiler compliance settings and build path are correct. Modifies the compliance
- * options and then updates the class path again. Ensures that the enum and assert
- * identifier options do not overwrite existing 'error' severity.
+ * Creates a plug-in project with a J2SE-1.4 execution environment.
+ * Validates that compiler compliance settings and build path are correct.
+ * Modifies the compliance options and then updates the class path again.
+ * Ensures that the enum and assert identifier options do not overwrite
+ * existing 'error' severity.
*
* @throws Exception
*/
+ @Test
public void testMinimumComplianceNoOverwrite() throws Exception {
try {
IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("J2SE-1.4");
@@ -272,7 +292,7 @@
// updating class path should increase severity to warning
IPluginModelBase model = PluginRegistry.findModel(project.getProject());
- UpdateClasspathJob job = new UpdateClasspathJob(new IPluginModelBase[]{model});
+ UpdateClasspathJob job = new UpdateClasspathJob(new IPluginModelBase[] { model });
job.schedule();
job.join();
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExportBundleTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExportBundleTests.java
index 03e8088..3133005 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExportBundleTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/ee/ExportBundleTests.java
@@ -13,6 +13,11 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.ee;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@@ -32,6 +37,8 @@
import org.eclipse.pde.ui.tests.PDETestsPlugin;
import org.eclipse.pde.ui.tests.runtime.TestUtils;
import org.eclipse.pde.ui.tests.util.ProjectUtils;
+import org.junit.Before;
+import org.junit.Test;
/**
* Tests exporting bundles.
@@ -41,7 +48,8 @@
private static final IPath EXPORT_PATH = PDETestsPlugin.getDefault().getStateLocation().append(".export");
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
Path path = Files.createDirectories(EXPORT_PATH.toFile().toPath());
if (Files.exists(path)) {
@@ -106,6 +114,7 @@
*
* @throws Exception
*/
+ @Test
public void testExportCustomEnvironment() throws Exception {
try {
IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment(EnvironmentAnalyzerDelegate.EE_NO_SOUND);
@@ -134,31 +143,32 @@
assertTrue("Export job had errors", result.isOK());
TestUtils.processUIEvents(100);
- TestUtils.waitForJobs(getName(), 100, 10000);
+ TestUtils.waitForJobs(name.getMethodName(), 100, 10000);
// verify exported bundle exists
IPath path = EXPORT_PATH.append("plugins/no.sound.export_1.0.0.jar");
// The jar file may not have been copied to the file system yet, see Bug 424597
if (!path.toFile().exists()) {
- TestUtils.waitForJobs(getName(), 100, 30000);
+ TestUtils.waitForJobs(name.getMethodName(), 100, 30000);
}
assertTrue("Missing exported bundle", path.toFile().exists());
validateTargetLevel(path.toOSString(), "no/sound/export/Activator.class", 47);
} finally {
- TestUtils.waitForJobs(getName(), 10, 5000);
+ TestUtils.waitForJobs(name.getMethodName(), 10, 5000);
deleteProject("no.sound.export");
deleteFolder(EXPORT_PATH.toFile());
}
}
/**
- * Exports a plug-in project with a J2SE-1.4 execution environment and validates class file
- * target level.
+ * Exports a plug-in project with a J2SE-1.4 execution environment and
+ * validates class file target level.
*
* @throws Exception
*/
+ @Test
public void testExport14Environment() throws Exception {
try {
IExecutionEnvironment env = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("J2SE-1.4");
@@ -197,13 +207,13 @@
long l7 = System.currentTimeMillis();
TestUtils.processUIEvents(100);
- TestUtils.waitForJobs(getName(), 100, 10000);
+ TestUtils.waitForJobs(name.getMethodName(), 100, 10000);
boolean didPathExistBeforeSleep = path.toFile().exists();
/* give a 30 second delay when the path doesn't exist
( JUST IN CASE - unlikely to work but worth trying)*/
if (!path.toFile().exists()) {
- TestUtils.waitForJobs(getName(), 3000, 30000);
+ TestUtils.waitForJobs(name.getMethodName(), 3000, 30000);
}
boolean didPathExistAfterSleep = path.toFile().exists();
@@ -249,7 +259,7 @@
assertTrue("Missing exported bundle", path.toFile().exists());
validateTargetLevel(path.toOSString(), "j2se14/export/Activator.class", 46);
} finally {
- TestUtils.waitForJobs(getName(), 10, 5000);
+ TestUtils.waitForJobs(name.getMethodName(), 10, 5000);
deleteProject("j2se14.export");
deleteFolder(EXPORT_PATH.toFile());
}
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/BaseImportTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/BaseImportTestCase.java
index ba3bf5e..92cbe62 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/BaseImportTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/BaseImportTestCase.java
@@ -13,6 +13,10 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.imports;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
@@ -21,6 +25,7 @@
import org.eclipse.pde.internal.core.PDECore;
import org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation;
import org.eclipse.pde.ui.tests.PDETestCase;
+import org.junit.Test;
import org.osgi.framework.Version;
public abstract class BaseImportTestCase extends PDETestCase {
@@ -28,31 +33,38 @@
protected abstract int getType();
protected abstract void verifyProject(String projectName, boolean isJava);
+ @Test
public void testImportJAR() {
doSingleImport("org.eclipse.jsch.core", true);
}
+ @Test
public void testImportFlat() {
doSingleImport("org.eclipse.jdt.debug", true);
}
+ @Test
public void testImportNotJavaFlat() {
doSingleImport("org.junit.source", false);
}
+ @Test
public void testImportNotJavaJARd() {
doSingleImport("org.eclipse.jdt.doc.user", false);
doSingleImport("org.eclipse.pde.ui.source", false);
}
+ @Test
public void testImportJUnit4() {
doSingleImport("org.junit", 4, true);
}
+ @Test
public void testImportICU(){
doSingleImport("com.ibm.icu", true);
}
+ @Test
public void testImportLinksMultiple() {
IPluginModelBase[] modelsToImport = getModels(new String[] {"org.eclipse.core.filebuffers", "org.eclipse.jdt.doc.user", "org.eclipse.pde.build"});
runOperation(modelsToImport, getType());
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportAsBinaryTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportAsBinaryTestCase.java
index c7584cd..32047b0 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportAsBinaryTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportAsBinaryTestCase.java
@@ -13,6 +13,10 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.imports;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
@@ -20,6 +24,7 @@
import org.eclipse.pde.internal.core.PDECore;
import org.eclipse.pde.internal.core.natures.PDE;
import org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation;
+import org.junit.Test;
public class ImportAsBinaryTestCase extends BaseImportTestCase {
@@ -30,12 +35,14 @@
return TYPE;
}
+ @Test
public void testImportAnt() {
// Note: Ant is exempt from importing as source
doSingleImport("org.apache.ant", true);
}
@Override
+ @Test
public void testImportJUnit4() {
// Note: JUnit 4 does not have source but it is a java project
doSingleImport("org.junit", 4, true);
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportAsSourceTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportAsSourceTestCase.java
index 0a59fb6..442af87 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportAsSourceTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportAsSourceTestCase.java
@@ -13,6 +13,10 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.imports;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.*;
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportFeatureProjectsTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportFeatureProjectsTestCase.java
index 272b24a..589bb60 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportFeatureProjectsTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportFeatureProjectsTestCase.java
@@ -13,6 +13,10 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.imports;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import org.eclipse.core.runtime.*;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.pde.internal.core.PDECore;
@@ -22,13 +26,16 @@
import org.eclipse.pde.internal.ui.wizards.imports.FeatureImportOperation;
import org.eclipse.pde.internal.ui.wizards.imports.FeatureImportWizard.ReplaceQuery;
import org.eclipse.pde.ui.tests.wizards.NewProjectTestCase;
+import org.junit.After;
+import org.junit.Test;
public class ImportFeatureProjectsTestCase extends NewProjectTestCase {
private String fProjectName;
@Override
- protected void tearDown() {
+ @After
+ public void tearDown() {
fProjectName = null;
super.tearDown();
}
@@ -94,6 +101,7 @@
}
}
+ @Test
public void testImportFeature() {
IFeatureModel[] model = PDECore.getDefault().getFeatureModelManager().getModels();
if (model.length == 0)
@@ -105,6 +113,7 @@
verifyFeature(binary);
}
+ @Test
public void testImportBinaryFeature() {
IFeatureModel[] model = PDECore.getDefault().getFeatureModelManager().getModels();
if (model.length == 0)
@@ -116,6 +125,7 @@
verifyFeature(binary);
}
+ @Test
public void testImportMulitpleFeatures() {
IFeatureModel[] models = PDECore.getDefault().getFeatureModelManager().getModels();
if (models.length == 0)
@@ -129,6 +139,7 @@
assertTrue("Verifing number models imported...", imported.length == models.length);
}
+ @Test
public void testFeaturePlugins() {
IFeatureModel[] model = PDECore.getDefault().getFeatureModelManager().getModels();
if (model.length == 0)
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportWithLinksTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportWithLinksTestCase.java
index cf17edc..fad0336 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportWithLinksTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/imports/ImportWithLinksTestCase.java
@@ -13,6 +13,10 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.imports;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/launcher/FeatureBasedLaunchTest.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/launcher/FeatureBasedLaunchTest.java
index a7e7d36..96994eb 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/launcher/FeatureBasedLaunchTest.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/launcher/FeatureBasedLaunchTest.java
@@ -19,7 +19,6 @@
import static org.hamcrest.core.IsEqual.equalTo;
import java.util.Map;
-import junit.framework.AssertionFailedError;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.pde.core.plugin.IPluginModelBase;
@@ -56,7 +55,7 @@
false);
String actualLevels = bundleMap.entrySet().stream()
.filter(e -> pluginId.equals(e.getKey().getPluginBase().getId())).map(e -> e.getValue()).findFirst()
- .orElseThrow(() -> new AssertionFailedError("no entry found for " + pluginId));
+ .orElseThrow(() -> new AssertionError("no entry found for " + pluginId));
assertThat("start levels of " + pluginId, actualLevels, is(equalTo(expectedStartLevels)));
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/launcher/LaunchConfigurationHelperTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/launcher/LaunchConfigurationHelperTestCase.java
index f8e4ff4..cc7b6c3 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/launcher/LaunchConfigurationHelperTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/launcher/LaunchConfigurationHelperTestCase.java
@@ -13,15 +13,17 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.launcher;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
import org.eclipse.pde.internal.launching.launcher.LaunchConfigurationHelper;
+import org.junit.Test;
/**
* Tests LaunchConfigurationHelper convenience methods
* @since 3.5
*/
-public class LaunchConfigurationHelperTestCase extends TestCase {
-
+public class LaunchConfigurationHelperTestCase {
+ @Test
public void testgetStartData() {
assertEquals(LaunchConfigurationHelper.getStartData("", false), "");
assertEquals(LaunchConfigurationHelper.getStartData("", true), "@start");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleActivatorTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleActivatorTestCase.java
index b6f4239..bf70f55 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleActivatorTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleActivatorTestCase.java
@@ -13,9 +13,14 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
import org.eclipse.pde.internal.core.text.bundle.BundleActivatorHeader;
import org.eclipse.text.edits.TextEdit;
+import org.junit.Test;
import org.osgi.framework.Constants;
public class BundleActivatorTestCase extends BundleModelTestCase {
@@ -24,6 +29,7 @@
super(Constants.BUNDLE_ACTIVATOR);
}
+ @Test
public void testGetActivator() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -39,6 +45,7 @@
assertEquals(((BundleActivatorHeader) header).getClassName(), "com.package.Activator");
}
+ @Test
public void testSetActivator() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -64,6 +71,7 @@
assertEquals(fHeaderName + ": com.package.Activator\n", fDocument.get(pos, length));
}
+ @Test
public void testChangeExistingActivator() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleClasspathTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleClasspathTestCase.java
index 722c195..ef56b69 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleClasspathTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleClasspathTestCase.java
@@ -13,9 +13,12 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
+import static org.junit.Assert.assertEquals;
+
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
import org.eclipse.pde.internal.core.text.bundle.BundleClasspathHeader;
import org.eclipse.text.edits.TextEdit;
+import org.junit.Test;
import org.osgi.framework.Constants;
public class BundleClasspathTestCase extends MultiLineHeaderTestCase {
@@ -24,6 +27,7 @@
super(Constants.BUNDLE_CLASSPATH);
}
+ @Test
public void testAddLibrary() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -50,6 +54,7 @@
assertEquals(" com.example.xyz\n", fDocument.get(pos, length));
}
+ @Test
public void testRemoveLibrary() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -77,6 +82,7 @@
assertEquals(fHeaderName + ": com.example.xyz\n", fDocument.get(pos, length));
}
+ @Test
public void testRemoveOnlyLibrary() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleLocalizationTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleLocalizationTestCase.java
index 2f64119..ac84b1e 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleLocalizationTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleLocalizationTestCase.java
@@ -13,9 +13,14 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
import org.eclipse.pde.internal.core.text.bundle.BundleLocalizationHeader;
import org.eclipse.text.edits.TextEdit;
+import org.junit.Test;
import org.osgi.framework.Constants;
public class BundleLocalizationTestCase extends BundleModelTestCase {
@@ -24,6 +29,7 @@
super(Constants.BUNDLE_LOCALIZATION);
}
+ @Test
public void testGetLocalizationDefault() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -35,6 +41,7 @@
assertEquals(fModel.getBundle().getLocalization(), Constants.BUNDLE_LOCALIZATION_DEFAULT_BASENAME);
}
+ @Test
public void testGetLocalization() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -50,6 +57,7 @@
assertEquals(((BundleLocalizationHeader) header).getLocalization(), "plugin");
}
+ @Test
public void testSetLocalization() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -75,6 +83,7 @@
assertEquals(fHeaderName + ": plugin\n", fDocument.get(pos, length));
}
+ @Test
public void testChangeExistingLocalization() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleModelTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleModelTestCase.java
index 270bb31..7d9b2fa 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleModelTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleModelTestCase.java
@@ -13,14 +13,20 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.Document;
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
import org.eclipse.pde.internal.core.text.bundle.BundleModel;
import org.eclipse.pde.internal.core.text.bundle.BundleTextChangeListener;
+import org.junit.Before;
+import org.junit.Test;
-public abstract class BundleModelTestCase extends TestCase {
+public abstract class BundleModelTestCase {
protected Document fDocument;
protected BundleModel fModel;
@@ -31,8 +37,8 @@
fHeaderName = headerName;
}
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
fDocument = new Document();
}
@@ -55,6 +61,7 @@
}
}
+ @Test
public void testAbsentHeader() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -66,6 +73,7 @@
assertNull(fModel.getBundle().getManifestHeader(fHeaderName));
}
+ @Test
public void testPresentHeader() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -79,6 +87,7 @@
assertNotNull(fModel.getBundle().getManifestHeader(fHeaderName));
}
+ @Test
public void testHeaderOffset1() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -93,6 +102,7 @@
assertEquals(fDocument.getLineOffset(3), header.getOffset());
}
+ @Test
public void testHeaderOffset2() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -107,6 +117,7 @@
assertEquals(fDocument.getLineOffset(2), header.getOffset());
}
+ @Test
public void testHeaderLength() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -121,6 +132,7 @@
assertEquals(fDocument.getLineLength(3), header.getLength());
}
+ @Test
public void testHeaderLengthWithWindowsDelimiter() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\r\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleNameTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleNameTestCase.java
index 5f85dca..eeaa89c 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleNameTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleNameTestCase.java
@@ -13,9 +13,14 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
import org.eclipse.pde.internal.core.text.bundle.BundleNameHeader;
import org.eclipse.text.edits.TextEdit;
+import org.junit.Test;
import org.osgi.framework.Constants;
public class BundleNameTestCase extends BundleModelTestCase {
@@ -24,6 +29,7 @@
super(Constants.BUNDLE_NAME);
}
+ @Test
public void testGetName() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -39,6 +45,7 @@
assertEquals(((BundleNameHeader) header).getBundleName(), "Bundle Name");
}
+ @Test
public void testSetName() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -64,6 +71,7 @@
assertEquals(fHeaderName + ": Bundle Name\n", fDocument.get(pos, length));
}
+ @Test
public void testChangeExistingName() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleSymbolicNameTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleSymbolicNameTestCase.java
index 12ef749..6cbe42b 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleSymbolicNameTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleSymbolicNameTestCase.java
@@ -13,9 +13,15 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
import org.eclipse.pde.internal.core.text.bundle.BundleSymbolicNameHeader;
import org.eclipse.text.edits.TextEdit;
+import org.junit.Test;
import org.osgi.framework.Constants;
public class BundleSymbolicNameTestCase extends BundleModelTestCase {
@@ -25,6 +31,7 @@
}
@Override
+ @Test
public void testAbsentHeader() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -36,6 +43,7 @@
}
@Override
+ @Test
public void testPresentHeader() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -48,6 +56,7 @@
}
@Override
+ @Test
public void testHeaderOffset1() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -61,6 +70,7 @@
}
@Override
+ @Test
public void testHeaderOffset2() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -75,6 +85,7 @@
}
@Override
+ @Test
public void testHeaderLength() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -88,6 +99,7 @@
}
@Override
+ @Test
public void testHeaderLengthWithWindowsDelimiter() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\r\n");
@@ -100,6 +112,7 @@
assertEquals(fDocument.getLineLength(2), header.getLength());
}
+ @Test
public void testAddBundleSymbolicName() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -120,6 +133,7 @@
assertEquals(buffer.toString() + header.write(), fDocument.get());
}
+ @Test
public void testRemoveBundleSymbolicName() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -140,6 +154,7 @@
assertEquals(4, fDocument.getNumberOfLines());
}
+ @Test
public void testChangeBundleSymbolicName() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -164,6 +179,7 @@
assertEquals("Bundle-SymbolicName: com.example.core\n", fDocument.get(pos, length));
}
+ @Test
public void testReadSingletonDirective() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -178,6 +194,7 @@
assertTrue(((BundleSymbolicNameHeader) header).isSingleton());
}
+ @Test
public void testAddSingletonDirective() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -202,6 +219,7 @@
assertEquals("Bundle-SymbolicName: com.example.xyz;singleton:=true\n", fDocument.get(pos, length));
}
+ @Test
public void testRemoveSingletonDirective() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleVendorTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleVendorTestCase.java
index 7f14285..fc0c4af 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleVendorTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleVendorTestCase.java
@@ -13,9 +13,13 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
import org.eclipse.pde.internal.core.text.bundle.BundleVendorHeader;
import org.eclipse.text.edits.TextEdit;
+import org.junit.Test;
import org.osgi.framework.Constants;
public class BundleVendorTestCase extends BundleModelTestCase {
@@ -24,6 +28,7 @@
super(Constants.BUNDLE_VENDOR);
}
+ @Test
public void testAddBundleVendor() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -44,6 +49,7 @@
assertEquals(buffer.toString() + header.write(), fDocument.get());
}
+ @Test
public void testRemoveBundleVendor() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -65,6 +71,7 @@
assertEquals(0, fDocument.getLineLength(3));
}
+ @Test
public void testChangeBundleVendor() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleVersionTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleVersionTestCase.java
index a83fbcd..525961e 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleVersionTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/BundleVersionTestCase.java
@@ -13,9 +13,13 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
import org.eclipse.pde.internal.core.text.bundle.BundleVersionHeader;
import org.eclipse.text.edits.TextEdit;
+import org.junit.Test;
import org.osgi.framework.Constants;
public class BundleVersionTestCase extends BundleModelTestCase {
@@ -24,6 +28,7 @@
super(Constants.BUNDLE_VERSION);
}
+ @Test
public void testAddVersion() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -44,6 +49,7 @@
assertEquals(buffer.toString() + header.write(), fDocument.get());
}
+ @Test
public void testRemoveVersion() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -64,6 +70,7 @@
assertEquals(4, fDocument.getNumberOfLines());
}
+ @Test
public void testChangeVersion() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/ExecutionEnvironmentTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/ExecutionEnvironmentTestCase.java
index 78c34ee..9c8d53e 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/ExecutionEnvironmentTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/ExecutionEnvironmentTestCase.java
@@ -13,6 +13,9 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager;
@@ -20,6 +23,7 @@
import org.eclipse.pde.internal.core.text.bundle.ExecutionEnvironment;
import org.eclipse.pde.internal.core.text.bundle.RequiredExecutionEnvironmentHeader;
import org.eclipse.text.edits.TextEdit;
+import org.junit.Test;
import org.osgi.framework.Constants;
@SuppressWarnings("deprecation")
@@ -30,6 +34,7 @@
super(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT);
}
+ @Test
public void testAddExecutionEnvironmentHeader() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -50,6 +55,7 @@
assertEquals(buffer.toString() + header.write(), fDocument.get());
}
+ @Test
public void testRemoveExistingExecutionEnvironment() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -71,6 +77,7 @@
assertEquals(4, fDocument.getNumberOfLines());
}
+ @Test
public void testAddExecutionEnvironment() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -98,6 +105,7 @@
assertEquals(expected.toString(), fDocument.get(pos, length));
}
+ @Test
public void testAddMulitplieExecutionEnvironmnets() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -131,6 +139,7 @@
assertEquals(expected.toString(), fDocument.get(pos, length));
}
+ @Test
public void testRemoveExecutionEnvironment() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -159,6 +168,7 @@
assertEquals(expected.toString(), fDocument.get(pos, length));
}
+ @Test
public void testRemoveMultipleExecutionEnvironments() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -186,6 +196,7 @@
assertEquals("Bundle-RequiredExecutionEnvironment: OSGi/Minimum-1.1\n", fDocument.get(pos, length));
}
+ @Test
public void testPreserveSpacing() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/ExportPackageTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/ExportPackageTestCase.java
index 0131979..c208dcb 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/ExportPackageTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/ExportPackageTestCase.java
@@ -13,9 +13,14 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
import org.eclipse.pde.internal.core.text.bundle.*;
import org.eclipse.text.edits.TextEdit;
+import org.junit.Test;
import org.osgi.framework.Constants;
public class ExportPackageTestCase extends PackageHeaderTestCase {
@@ -35,6 +40,7 @@
return ((ExportPackageHeader) header).getPackage(packageName);
}
+ @Test
public void testReadInternalPackage() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -53,6 +59,7 @@
assertTrue(object.isInternal());
}
+ @Test
public void testReadOneFriend() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -73,6 +80,7 @@
assertTrue(friends[0].getName().equals("com.example.xyz"));
}
+ @Test
public void testReadMultipleFriend() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -95,6 +103,7 @@
assertTrue(friends[2].getName().equals("com.example.zzz"));
}
+ @Test
public void testSetPackageInternal() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -122,6 +131,7 @@
assertEquals(fHeaderName + ": org.osgi.framework;x-internal:=true\n", fDocument.get(pos, length));
}
+ @Test
public void testAddPackageFriend() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -148,6 +158,7 @@
assertEquals(fHeaderName + ": org.osgi.framework;x-friends:=\"org.eclipse.pde.ui\"\n", fDocument.get(pos, length));
}
+ @Test
public void testAddPackageFriends() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/FragmentHostTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/FragmentHostTestCase.java
index fb700b1..63ccc90 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/FragmentHostTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/FragmentHostTestCase.java
@@ -13,9 +13,13 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
import org.eclipse.pde.internal.core.text.bundle.FragmentHostHeader;
import org.eclipse.text.edits.TextEdit;
+import org.junit.Test;
import org.osgi.framework.Constants;
public class FragmentHostTestCase extends BundleModelTestCase {
@@ -24,6 +28,7 @@
super(Constants.FRAGMENT_HOST);
}
+ @Test
public void testAddFragmentHost() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -44,6 +49,7 @@
assertEquals(buffer.toString() + header.write(), fDocument.get());
}
+ @Test
public void testRemoveFragmentHost() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -65,6 +71,7 @@
assertEquals(0, fDocument.getLineLength(3));
}
+ @Test
public void testChangeFragmentHost() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/ImportPackageTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/ImportPackageTestCase.java
index 1ad2a2b..7d1a77f 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/ImportPackageTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/ImportPackageTestCase.java
@@ -13,9 +13,14 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
import org.eclipse.pde.internal.core.text.bundle.*;
import org.eclipse.text.edits.TextEdit;
+import org.junit.Test;
import org.osgi.framework.Constants;
public class ImportPackageTestCase extends PackageHeaderTestCase {
@@ -24,6 +29,7 @@
super(Constants.IMPORT_PACKAGE);
}
+ @Test
public void testReadOptionalPackage() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -41,6 +47,7 @@
assertTrue(object.isOptional());
}
+ @Test
public void testMakePackageOptional() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -68,6 +75,7 @@
assertEquals(fHeaderName + ": org.osgi.framework;resolution:=optional\n", fDocument.get(pos, length));
}
+ @Test
public void testRemoveOptionalDirective() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/LazyStartTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/LazyStartTestCase.java
index 5c11f58..57ce018 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/LazyStartTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/LazyStartTestCase.java
@@ -13,10 +13,16 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.internal.core.ICoreConstants;
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
import org.eclipse.pde.internal.core.text.bundle.LazyStartHeader;
import org.eclipse.text.edits.TextEdit;
+import org.junit.Test;
public class LazyStartTestCase extends BundleModelTestCase {
@@ -24,6 +30,7 @@
super(ICoreConstants.ECLIPSE_AUTOSTART);
}
+ @Test
public void testGetAutoStart() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -39,6 +46,7 @@
assertTrue(((LazyStartHeader) header).isLazyStart());
}
+ @Test
public void testGetAutoStart2() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -54,6 +62,7 @@
assertTrue(!((LazyStartHeader) header).isLazyStart());
}
+ @Test
public void testSetLazyStart() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -79,6 +88,7 @@
assertEquals(fHeaderName + ": plugin\n", fDocument.get(pos, length));
}
+ @Test
public void testChangeExistingLazyStart() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/MultiLineHeaderTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/MultiLineHeaderTestCase.java
index 102c251..4b9d79b 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/MultiLineHeaderTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/MultiLineHeaderTestCase.java
@@ -13,7 +13,10 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
+import static org.junit.Assert.assertEquals;
+
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
+import org.junit.Test;
public abstract class MultiLineHeaderTestCase extends BundleModelTestCase {
@@ -21,6 +24,7 @@
super(headerName);
}
+ @Test
public void testHeaderLengthMultiLines1() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -36,6 +40,7 @@
assertEquals(fDocument.getLineLength(3) + fDocument.getLineLength(4), header.getLength());
}
+ @Test
public void testHeaderLengthMultiLines2() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/PackageHeaderTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/PackageHeaderTestCase.java
index de42448..cf7a15b 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/PackageHeaderTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/PackageHeaderTestCase.java
@@ -13,10 +13,14 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
import org.eclipse.pde.internal.core.text.bundle.BasePackageHeader;
import org.eclipse.pde.internal.core.text.bundle.PackageObject;
import org.eclipse.text.edits.TextEdit;
+import org.junit.Test;
public abstract class PackageHeaderTestCase extends MultiLineHeaderTestCase {
@@ -24,6 +28,7 @@
super(headerName);
}
+ @Test
public void testAddExportPackageHeader() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -44,6 +49,7 @@
assertEquals(buffer.toString() + header.write(), fDocument.get());
}
+ @Test
public void testRemoveExistingExportPackageHeader() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -65,6 +71,7 @@
assertEquals(4, fDocument.getNumberOfLines());
}
+ @Test
public void testAddPackage() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -92,6 +99,7 @@
assertEquals(expected.toString(), fDocument.get(pos, length));
}
+ @Test
public void testAddImportPackageHeader() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -112,6 +120,7 @@
assertEquals(buffer.toString() + header.write(), fDocument.get());
}
+ @Test
public void testAddMultiplePackages() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -142,6 +151,7 @@
assertEquals(expected.toString(), fDocument.get(pos, length));
}
+ @Test
public void testRemovePackage() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -170,6 +180,7 @@
assertEquals(expected.toString(), fDocument.get(pos, length));
}
+ @Test
public void testRemoveMultiplePackages() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -197,6 +208,7 @@
assertEquals(fHeaderName + ": com.example.abc.refactoring\n", fDocument.get(pos, length));
}
+ @Test
public void testReadPackageWithVersion() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -215,6 +227,7 @@
assertEquals("1.3.0", object.getVersion());
}
+ @Test
public void testAddVersionToPackage() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -243,6 +256,7 @@
assertEquals(fHeaderName + ": org.osgi.framework;version=\"1.3.0\"\n", fDocument.get(pos, length));
}
+ @Test
public void testRemoveVersionFromPackage() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -271,6 +285,7 @@
assertEquals(fHeaderName + ": org.osgi.framework\n", fDocument.get(pos, length));
}
+ @Test
public void testAddPackageWithWindowsDelimiter() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\r\n");
@@ -298,6 +313,7 @@
assertEquals(expected.toString(), fDocument.get(pos, length));
}
+ @Test
public void testRemovePackageWithWindowsDelimiter() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\r\n");
@@ -326,6 +342,7 @@
assertEquals(expected.toString(), fDocument.get(pos, length));
}
+ @Test
public void testPreserveSpacing() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/RequireBundleTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/RequireBundleTestCase.java
index d9537a2..5b7aa46 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/RequireBundleTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/bundle/RequireBundleTestCase.java
@@ -13,10 +13,15 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.bundle;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
import org.eclipse.pde.internal.core.text.bundle.RequireBundleHeader;
import org.eclipse.pde.internal.core.text.bundle.RequireBundleObject;
import org.eclipse.text.edits.TextEdit;
+import org.junit.Test;
import org.osgi.framework.Constants;
public class RequireBundleTestCase extends MultiLineHeaderTestCase {
@@ -25,6 +30,7 @@
super(Constants.REQUIRE_BUNDLE);
}
+ @Test
public void testAddRequireBundleHeader() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -45,6 +51,7 @@
assertEquals(buffer.toString() + header.write(), fDocument.get());
}
+ @Test
public void testRemoveExistingRequireBundleHeader() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -65,6 +72,7 @@
assertEquals(4, fDocument.getNumberOfLines());
}
+ @Test
public void testAddBundle() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -91,6 +99,7 @@
assertEquals(expected.toString(), fDocument.get(pos, length));
}
+ @Test
public void testAddMultipleBundles() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -120,6 +129,7 @@
assertEquals(expected.toString(), fDocument.get(pos, length));
}
+ @Test
public void testRemoveBundle() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -147,6 +157,7 @@
assertEquals(expected.toString(), fDocument.get(pos, length));
}
+ @Test
public void testRemoveMultipleBundles() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -173,6 +184,7 @@
assertEquals("Require-Bundle: com.example.ui\n", fDocument.get(pos, length));
}
+ @Test
public void testReadOptionalBundle() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -190,6 +202,7 @@
assertTrue(bundle.isOptional());
}
+ @Test
public void testSetGetVersion() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -210,6 +223,7 @@
assertEquals("(1.9.9,3.0.9]", bundle.getVersion());
}
+ @Test
public void testReadBundleWithVersion() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -227,6 +241,7 @@
assertEquals("3.2.0", bundle.getVersion());
}
+ @Test
public void testMakeBundleOptional() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -254,6 +269,7 @@
assertEquals("Require-Bundle: org.eclipse.osgi;resolution:=optional\n", fDocument.get(pos, length));
}
+ @Test
public void testRemoveOptionalDirective() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -281,6 +297,7 @@
assertEquals("Require-Bundle: org.eclipse.osgi\n", fDocument.get(pos, length));
}
+ @Test
public void testAddVersionToBundle() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -308,6 +325,7 @@
assertEquals("Require-Bundle: org.eclipse.osgi;bundle-version=\"3.2.0\"\n", fDocument.get(pos, length));
}
+ @Test
public void testRemoveVersionFromBundle() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -335,6 +353,7 @@
assertEquals("Require-Bundle: org.eclipse.osgi\n", fDocument.get(pos, length));
}
+ @Test
public void testAddBundleWithWindowsDelimiter() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\r\n");
@@ -361,6 +380,7 @@
assertEquals(expected.toString(), fDocument.get(pos, length));
}
+ @Test
public void testRemoveBundleWithWindowsDelimiter() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\r\n");
@@ -388,6 +408,7 @@
assertEquals(expected.toString(), fDocument.get(pos, length));
}
+ @Test
public void testPreserveSpacing() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -417,6 +438,7 @@
}
+ @Test
public void testReadBundleReExport() {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -434,6 +456,7 @@
assertTrue(bundle.isReexported());
}
+ @Test
public void testMakeBundleReExport() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
@@ -461,6 +484,7 @@
assertEquals("Require-Bundle: org.eclipse.osgi;visibility:=reexport\n", fDocument.get(pos, length));
}
+ @Test
public void testRemoveReExport() throws Exception {
StringBuilder buffer = new StringBuilder();
buffer.append("Manifest-Version: 1.0\n");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/BasicXMLTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/BasicXMLTestCase.java
index 8827221..a4d94bd 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/BasicXMLTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/BasicXMLTestCase.java
@@ -13,11 +13,15 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.xml;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.eclipse.pde.core.plugin.*;
import org.eclipse.pde.internal.core.text.IDocumentElementNode;
+import org.junit.Test;
public class BasicXMLTestCase extends XMLModelTestCase {
-
+ @Test
public void testReadSimpleExtension() {
StringBuilder sb = new StringBuilder();
sb.append("<extension point=\"org.eclipse.pde.ui.samples\"><sample /></extension>");
@@ -31,6 +35,7 @@
assertEquals(extensions[0].getChildren()[0].getName(), "sample");
}
+ @Test
public void testReadSimpleExtensionOneLine() {
StringBuilder sb = new StringBuilder();
sb.append("<extension point=\"org.eclipse.pde.ui.samples\"><sample /></extension>");
@@ -41,6 +46,7 @@
assertEquals(extensions.length, 1);
}
+ @Test
public void testReadMultilineSimpleExtension() {
StringBuilder sb = new StringBuilder();
sb.append("<extension ");
@@ -60,6 +66,7 @@
assertEquals(extensions[0].getChildren()[0].getName(), "sample");
}
+ @Test
public void testAddSimpleExtension() throws Exception {
setXMLContents(null, LF);
load(true);
@@ -84,6 +91,7 @@
assertEquals(extensions[0].getChildren()[0].getName(), "sample");
}
+ @Test
public void testRemoveSimpleExtension() throws Exception {
StringBuilder sb = new StringBuilder();
sb.append("<extension id=\"org.eclipse.pde.ui.samples\"><sample /></extension>");
@@ -102,6 +110,7 @@
}
// bug 220178
+ @Test
public void testRemoveChildNode() throws Exception {
StringBuilder sb = new StringBuilder();
sb.append("<extension id=\"org.eclipse.pde.ui.samples\"><sample /></extension>");
@@ -121,6 +130,7 @@
}
//bug 285134
+ @Test
public void testSingleQuoteAttribute() {
StringBuilder sb = new StringBuilder();
sb.append("<extension point='org.eclipse.pde.ui.samples'><sample /></extension>");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ExtensionAttributeTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ExtensionAttributeTestCase.java
index eb190d5..a7eae54 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ExtensionAttributeTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ExtensionAttributeTestCase.java
@@ -13,30 +13,39 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.xml;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.core.plugin.*;
+import org.junit.Test;
public class ExtensionAttributeTestCase extends ExtensionTestCase {
-
+ @Test
public void testAddNewExtensionAttribute1LF() throws Exception {
testAddNewExtensionAttribute1(LF);
}
+ @Test
public void testAddNewExtensionAttribute2LF() throws Exception {
testAddNewExtensionAttribute2(LF);
}
+ @Test
public void testAddNewExtensionAttribute3LF() throws Exception {
testAddNewExtensionAttribute3(LF);
}
+ @Test
public void testAddNewExtensionAttribute1CRLF() throws Exception {
testAddNewExtensionAttribute1(CRLF);
}
+ @Test
public void testAddNewExtensionAttribute2CRLF() throws Exception {
testAddNewExtensionAttribute2(CRLF);
}
+ @Test
public void testAddNewExtensionAttribute3CRLF() throws Exception {
testAddNewExtensionAttribute3(CRLF);
}
@@ -64,26 +73,32 @@
testAddNewExtensionAttribute(buffer, newLine);
}
+ @Test
public void testAddExtensionAttribute1LF() throws Exception {
testAddExtensionAttribute1(LF);
}
+ @Test
public void testAddExtensionAttribute2LF() throws Exception {
testAddExtensionAttribute2(LF);
}
+ @Test
public void testAddExtensionAttribute3LF() throws Exception {
testAddExtensionAttribute3(LF);
}
+ @Test
public void testAddExtensionAttribute1CRLF() throws Exception {
testAddExtensionAttribute1(CRLF);
}
+ @Test
public void testAddExtensionAttribute2CRLF() throws Exception {
testAddExtensionAttribute2(CRLF);
}
+ @Test
public void testAddExtensionAttribute3CRLF() throws Exception {
testAddExtensionAttribute3(CRLF);
}
@@ -112,26 +127,32 @@
testAddExtensionAttribute(buffer, newLine);
}
+ @Test
public void testAddNewMultipleAttributes1LF() throws Exception {
testAddNewMultipleAttributes1(LF);
}
+ @Test
public void testAddNewMultipleAttributes2LF() throws Exception {
testAddNewMultipleAttributes2(LF);
}
+ @Test
public void testAddNewMultipleAttributes3LF() throws Exception {
testAddNewMultipleAttributes3(LF);
}
+ @Test
public void testAddNewMultipleAttributes1CRLF() throws Exception {
testAddNewMultipleAttributes1(CRLF);
}
+ @Test
public void testAddNewMultipleAttributes2CRLF() throws Exception {
testAddNewMultipleAttributes2(CRLF);
}
+ @Test
public void testAddNewMultipleAttributes3CRLF() throws Exception {
testAddNewMultipleAttributes3(CRLF);
}
@@ -159,26 +180,32 @@
testAddNewMultipleExtensionAttributes(buffer, newLine);
}
+ @Test
public void testRemoveExtensionAttribute1LF() throws Exception {
testRemoveExtensionAttribute1(LF);
}
+ @Test
public void testRemoveExtensionAttribute2LF() throws Exception {
testRemoveExtensionAttribute2(LF);
}
+ @Test
public void testRemoveExtensionAttribute3LF() throws Exception {
testRemoveExtensionAttribute3(LF);
}
+ @Test
public void testRemoveExtensionAttribute1CRLF() throws Exception {
testRemoveExtensionAttribute1(CRLF);
}
+ @Test
public void testRemoveExtensionAttribute2CRLF() throws Exception {
testRemoveExtensionAttribute2(CRLF);
}
+ @Test
public void testRemoveExtensionAttribute3CRLF() throws Exception {
testRemoveExtensionAttribute3(CRLF);
}
@@ -207,26 +234,32 @@
testRemoveExtensionAttribute(buffer, newLine);
}
+ @Test
public void testRemoveMultipleExtensionAttributes1LF() throws Exception {
testRemoveMultipleExtensionAttributes1(LF);
}
+ @Test
public void testRemoveMultipleExtensionAttributes2LF() throws Exception {
testRemoveMultipleExtensionAttributes2(LF);
}
+ @Test
public void testRemoveMultipleExtensionAttributes3LF() throws Exception {
testRemoveMultipleExtensionAttributes3(LF);
}
+ @Test
public void testRemoveMultipleExtensionAttributes1CRLF() throws Exception {
testRemoveMultipleExtensionAttributes1(CRLF);
}
+ @Test
public void testRemoveMultipleExtensionAttributes2CRLF() throws Exception {
testRemoveMultipleExtensionAttributes2(CRLF);
}
+ @Test
public void testRemoveMultipleExtensionAttributes3CRLF() throws Exception {
testRemoveMultipleExtensionAttributes3(CRLF);
}
@@ -255,26 +288,32 @@
testRemoveMultipleExtensionAttributes(buffer, newLine);
}
+ @Test
public void testChangeExtensionAttribute1LF() throws Exception {
testChangeExtensionAttribute1(LF);
}
+ @Test
public void testChangeExtensionAttribute2LF() throws Exception {
testChangeExtensionAttribute2(LF);
}
+ @Test
public void testChangeExtensionAttribute3LF() throws Exception {
testChangeExtensionAttribute3(LF);
}
+ @Test
public void testChangeExtensionAttribute1CRLF() throws Exception {
testChangeExtensionAttribute1(CRLF);
}
+ @Test
public void testChangeExtensionAttribute2CRLF() throws Exception {
testChangeExtensionAttribute2(CRLF);
}
+ @Test
public void testChangeExtensionAttribute3CRLF() throws Exception {
testChangeExtensionAttribute3(CRLF);
}
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ExtensionElementTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ExtensionElementTestCase.java
index 005f040..f788531 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ExtensionElementTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ExtensionElementTestCase.java
@@ -13,31 +13,39 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.xml;
+import static org.junit.Assert.assertEquals;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.core.plugin.*;
+import org.junit.Test;
public class ExtensionElementTestCase extends ExtensionTestCase {
-
+ @Test
public void testAddNewExtensionElement1LF() throws Exception {
testAddNewExtensionElement1(LF);
}
+ @Test
public void testAddNewExtensionElement2LF() throws Exception {
testAddNewExtensionElement2(LF);
}
+ @Test
public void testAddNewExtensionElement3LF() throws Exception {
testAddNewExtensionElement3(LF);
}
+ @Test
public void testAddNewExtensionElement1CRLF() throws Exception {
testAddNewExtensionElement1(CRLF);
}
+ @Test
public void testAddNewExtensionElement2CRLF() throws Exception {
testAddNewExtensionElement2(CRLF);
}
+ @Test
public void testAddNewExtensionElement3CRLF() throws Exception {
testAddNewExtensionElement3(CRLF);
}
@@ -61,31 +69,37 @@
testAddNewExtensionElement(buffer, newLine);
}
+ @Test
public void testAddExtensionElement1LF() throws Exception {
StringBuilder buffer = getSingleElementBuffer1(LF);
testAddExtensionElement(buffer, LF);
}
+ @Test
public void testAddExtensionElement2LF() throws Exception {
StringBuilder buffer = getSingleElementBuffer2(LF);
testAddExtensionElement(buffer, LF);
}
+ @Test
public void testAddExtensionElement3LF() throws Exception {
StringBuilder buffer = getSingleElementBuffer3(LF);
testAddExtensionElement(buffer, LF);
}
+ @Test
public void testAddExtensionElement1CRLF() throws Exception {
StringBuilder buffer = getSingleElementBuffer1(CRLF);
testAddExtensionElement(buffer, CRLF);
}
+ @Test
public void testAddExtensionElement2CRLF() throws Exception {
StringBuilder buffer = getSingleElementBuffer2(CRLF);
testAddExtensionElement(buffer, CRLF);
}
+ @Test
public void testAddExtensionElement3CRLF() throws Exception {
StringBuilder buffer = getSingleElementBuffer3(CRLF);
testAddExtensionElement(buffer, CRLF);
@@ -111,26 +125,32 @@
return buffer.append("\t</extension>");
}
+ @Test
public void testAddNewMultipleExtensionElements1LF() throws Exception {
testAddNewMultipleExtensionElements1(LF);
}
+ @Test
public void testAddNewMultipleExtensionElements2LF() throws Exception {
testAddNewMultipleExtensionElements2(LF);
}
+ @Test
public void testAddNewMultipleExtensionElements3LF() throws Exception {
testAddNewMultipleExtensionElements3(LF);
}
+ @Test
public void testAddNewMultipleExtensionElements1CRLF() throws Exception {
testAddNewMultipleExtensionElements1(CRLF);
}
+ @Test
public void testAddNewMultipleExtensionElements2CRLF() throws Exception {
testAddNewMultipleExtensionElements2(CRLF);
}
+ @Test
public void testAddNewMultipleExtensionElements3CRLF() throws Exception {
testAddNewMultipleExtensionElements3(CRLF);
}
@@ -154,86 +174,104 @@
testAddNewMultipleExtensionElements(buffer, newLine);
}
+ @Test
public void testAddMultipleExtensionElements1LF() throws Exception {
StringBuilder buffer = getSingleElementBuffer1(LF);
testAddMultipleExtensionElements(buffer, LF);
}
+ @Test
public void testAddMultipleExtensionElements2LF() throws Exception {
StringBuilder buffer = getSingleElementBuffer2(LF);
testAddMultipleExtensionElements(buffer, LF);
}
+ @Test
public void testAddMultipleExtensionElements3LF() throws Exception {
StringBuilder buffer = getSingleElementBuffer3(LF);
testAddMultipleExtensionElements(buffer, LF);
}
+ @Test
public void testAddMultipleExtensionElements1CRLF() throws Exception {
StringBuilder buffer = getSingleElementBuffer1(CRLF);
testAddMultipleExtensionElements(buffer, CRLF);
}
+ @Test
public void testAddMultipleExtensionElements2CRLF() throws Exception {
StringBuilder buffer = getSingleElementBuffer2(CRLF);
testAddMultipleExtensionElements(buffer, CRLF);
}
+ @Test
public void testAddMultipleExtensionElements3CRLF() throws Exception {
StringBuilder buffer = getSingleElementBuffer3(CRLF);
testAddMultipleExtensionElements(buffer, CRLF);
}
+ @Test
public void testRemoveExtensionElement1LF() throws Exception {
StringBuilder buffer = getSingleElementBuffer1(LF);
testRemoveExtensionElement(buffer, LF);
}
+ @Test
public void testRemoveExtensionElement2LF() throws Exception {
StringBuilder buffer = getSingleElementBuffer2(LF);
testRemoveExtensionElement(buffer, LF);
}
+ @Test
public void testRemoveExtensionElement3LF() throws Exception {
StringBuilder buffer = getSingleElementBuffer3(LF);
testRemoveExtensionElement(buffer, LF);
}
+ @Test
public void testRemoveExtensionElement1CRLF() throws Exception {
StringBuilder buffer = getSingleElementBuffer1(CRLF);
testRemoveExtensionElement(buffer, CRLF);
}
+ @Test
public void testRemoveExtensionElement2CRLF() throws Exception {
StringBuilder buffer = getSingleElementBuffer2(CRLF);
testRemoveExtensionElement(buffer, CRLF);
}
+ @Test
public void testRemoveExtensionElement3CRLF() throws Exception {
StringBuilder buffer = getSingleElementBuffer3(CRLF);
testRemoveExtensionElement(buffer, CRLF);
}
+ @Test
public void testRemoveMultipleExtensionElements1LF() throws Exception {
testRemoveMultipleExtensionElements1(LF);
}
+ @Test
public void testRemoveMultipleExtensionElements2LF() throws Exception {
testRemoveMultipleExtensionElements2(LF);
}
+ @Test
public void testRemoveMultipleExtensionElements3LF() throws Exception {
testRemoveMultipleExtensionElements3(LF);
}
+ @Test
public void testRemoveMultipleExtensionElements1CRLF() throws Exception {
testRemoveMultipleExtensionElements1(CRLF);
}
+ @Test
public void testRemoveMultipleExtensionElements2CRLF() throws Exception {
testRemoveMultipleExtensionElements2(CRLF);
}
+ @Test
public void testRemoveMultipleExtensionElements3CRLF() throws Exception {
testRemoveMultipleExtensionElements3(CRLF);
}
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ExtensionTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ExtensionTestCase.java
index 180b43a..d6cde67 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ExtensionTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ExtensionTestCase.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.xml;
+import static org.junit.Assert.assertEquals;
+
import org.eclipse.pde.core.plugin.IPluginExtension;
public class ExtensionTestCase extends XMLModelTestCase {
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ManifestEditorSpellCheckTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ManifestEditorSpellCheckTestCase.java
index ac67aa8..880793e 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ManifestEditorSpellCheckTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/ManifestEditorSpellCheckTestCase.java
@@ -13,6 +13,9 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.xml;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
import java.io.*;
import java.util.Iterator;
import org.eclipse.core.resources.*;
@@ -26,6 +29,8 @@
import org.eclipse.ui.*;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.texteditor.spelling.SpellingAnnotation;
+import org.junit.Before;
+import org.junit.Test;
/**
* Test cases for ensuring the source page in Manifest Editor for plug-in.xml
@@ -40,7 +45,8 @@
private static final String EDITOR_ID = "org.eclipse.pde.ui.manifestEditor";
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
fProject = root.getProject("model.tests.editor");
@@ -59,6 +65,7 @@
/**
* Checks that no spelling annotations are created.
*/
+ @Test
public void testNoSpellingAnnotation(){
try {
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/StructureXMLModelTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/StructureXMLModelTestCase.java
index 973b2b3..f5e547f 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/StructureXMLModelTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/StructureXMLModelTestCase.java
@@ -13,8 +13,12 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.xml;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.core.plugin.*;
import org.eclipse.pde.internal.core.text.IDocumentElementNode;
+import org.junit.Test;
public class StructureXMLModelTestCase extends XMLModelTestCase {
@@ -28,50 +32,62 @@
// ~ line 37
static String ELEMENT_SHIFT = " "; //$NON-NLS-1$
+ @Test
public void testStructureAddExtensionLF() throws Exception {
addExtension(LF);
}
+ @Test
public void testStructureAddExtensionCRLF() throws Exception {
addExtension(CRLF);
}
+ @Test
public void testStructureAddElementLF() throws Exception {
addElement(LF);
}
+ @Test
public void testStructureAddElementCRLF() throws Exception {
addElement(CRLF);
}
+ @Test
public void testStructureAddAttributeLF() throws Exception {
addAttributesToElement(LF);
}
+ @Test
public void testStructureAddAttributeCRLF() throws Exception {
addAttributesToElement(CRLF);
}
+ @Test
public void testStructureBreakOpenElementLF() throws Exception {
breakOpenElement(LF);
}
+ @Test
public void testStructureBreakOpenElementCRLF() throws Exception {
breakOpenElement(CRLF);
}
+ @Test
public void testStructurePreserveCommentInRootLF() throws Exception {
preserveCommentAddExtension(LF);
}
+ @Test
public void testStructurePreserveCommentInRootCRLF() throws Exception {
preserveCommentAddExtension(CRLF);
}
+ @Test
public void testStructurePreserveCommentInExtensionLF() throws Exception {
preserveContainedCommentAddElement(LF);
}
+ @Test
public void testStructurePreserveCommentInExtensionCRLF() throws Exception {
preserveContainedCommentAddElement(CRLF);
}
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/SwapXMLModelTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/SwapXMLModelTestCase.java
index 255b4f7..1f5d81e 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/SwapXMLModelTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/SwapXMLModelTestCase.java
@@ -13,11 +13,16 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.xml;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.core.plugin.*;
+import org.junit.Test;
public class SwapXMLModelTestCase extends XMLModelTestCase {
// all one one line
+ @Test
public void testSwapTwoChildren() throws Exception {
StringBuilder sb = new StringBuilder();
sb.append("<extension id=\"org.eclipse.pde.ui.samples\">");
@@ -28,6 +33,7 @@
}
// all on diff line
+ @Test
public void testSwapTwoChildren2() throws Exception {
StringBuilder sb = new StringBuilder();
sb.append("<extension id=\"org.eclipse.pde.ui.samples\">");
@@ -42,6 +48,7 @@
}
// all on diff line with tabs
+ @Test
public void testSwapTwoChildren3() throws Exception {
StringBuilder sb = new StringBuilder();
sb.append("<extension id=\"org.eclipse.pde.ui.samples\">");
@@ -56,6 +63,7 @@
}
// some on diff lines with no spacing
+ @Test
public void testSwapTwoChildren4() throws Exception {
StringBuilder sb = new StringBuilder();
sb.append("<extension id=\"org.eclipse.pde.ui.samples\">");
@@ -68,6 +76,7 @@
}
// some on diff lines with spacing
+ @Test
public void testSwapTwoChildren5() throws Exception {
StringBuilder sb = new StringBuilder();
sb.append("<extension id=\"org.eclipse.pde.ui.samples\">");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/XMLModelTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/XMLModelTestCase.java
index f0e9693..fafb4ef 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/XMLModelTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/model/xml/XMLModelTestCase.java
@@ -13,7 +13,8 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.model.xml;
-import junit.framework.TestCase;
+import static org.junit.Assert.fail;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
@@ -21,8 +22,9 @@
import org.eclipse.pde.internal.core.text.plugin.PluginModel;
import org.eclipse.pde.internal.core.text.plugin.XMLTextChangeListener;
import org.eclipse.text.edits.*;
+import org.junit.Before;
-public abstract class XMLModelTestCase extends TestCase {
+public abstract class XMLModelTestCase {
protected static final String LF = "\n";
protected static final String CR = "\r";
@@ -32,8 +34,8 @@
protected PluginModel fModel;
protected IModelTextChangeListener fListener;
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
fDocument = new Document();
}
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/nls/StringHelperTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/nls/StringHelperTestCase.java
index d3f2a7f..893bc7f 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/nls/StringHelperTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/nls/StringHelperTestCase.java
@@ -14,16 +14,19 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.nls;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
import org.eclipse.pde.internal.ui.nls.StringHelper;
+import org.junit.Test;
/**
* Tests StringHelper.java convenience methods
* @since 3.4
*/
-public class StringHelperTestCase extends TestCase {
+public class StringHelperTestCase {
private static final String newLine = "\r\n";
+ @Test
public void testSimpleLines() {
String s1, s2;
@@ -38,6 +41,7 @@
assertEquals("abc\\r\\n\\" + newLine + "def", s2);
}
+ @Test
public void testSpaces() {
String s1, s2;
@@ -70,7 +74,7 @@
// s2 = StringHelper.preparePropertiesString(s1, newLine.toCharArray());
// assertEquals("ab\\u010D \\r\\n \\" + newLine + "d \\u00E9\\u03B5\\uFEDA f ", s2);
// }
-
+ @Test
public void testSideEffects() {
String s1, s2;
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/preferences/PDEPreferencesTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/preferences/PDEPreferencesTestCase.java
index 760119b..de359d0 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/preferences/PDEPreferencesTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/preferences/PDEPreferencesTestCase.java
@@ -13,7 +13,8 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.preferences;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -23,13 +24,14 @@
import org.eclipse.pde.internal.core.natures.PDE;
import org.eclipse.pde.internal.launching.ILaunchingPreferenceConstants;
import org.eclipse.pde.internal.ui.*;
+import org.junit.Test;
/**
* Tests to ensure that the PDE Preferences manager, added in 3.5, is working
* correctly and is compatible with the existing preference story.
*/
-public class PDEPreferencesTestCase extends TestCase {
+public class PDEPreferencesTestCase {
private static final String PLUGIN_ID = "org.eclipse.pde.core";
@@ -49,6 +51,7 @@
preferences.setDefault("intKey", -1);
}
+ @Test
public void testInstanceScopePDEPreferences(){
PDEPreferencesManager preferences = new PDEPreferencesManager(PLUGIN_ID);
assertEquals(preferences.getString("stringKey"), "stringValue");
@@ -56,6 +59,7 @@
assertEquals(preferences.getInt("intKey"), 0);
}
+ @Test
public void testDefaultPDEPreferences(){
PDEPreferencesManager preferences = new PDEPreferencesManager(PLUGIN_ID);
assertEquals(preferences.getDefaultString("stringKey"), "defaultValue");
@@ -63,6 +67,7 @@
assertEquals(preferences.getDefaultInt("intKey"), -1);
}
+ @Test
public void testPreferenceChangeListener1(){
IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(PLUGIN_ID);
final String key = "stringKey";
@@ -81,6 +86,7 @@
preferences.put(key, originalValue);
}
+ @Test
public void testPreferenceChangeListner2(){
IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(PLUGIN_ID);
final String key = "stringKey";
@@ -101,6 +107,7 @@
preferences.put(key, originalValue);
}
+ @Test
public void testCompilerPreferences(){
// Testing the compiler preferences set by PDECore in org.eclipse.pde
PDEPreferencesManager preferences = new PDEPreferencesManager(PDE.PLUGIN_ID);
@@ -109,6 +116,7 @@
assertEquals(preferences.getDefaultInt(CompilerFlags.P_MISSING_VERSION_EXP_PKG), CompilerFlags.IGNORE);
}
+ @Test
public void testCompatibilityWithPreferenceStore(){
IPreferenceStore store = PDEPlugin.getDefault().getPreferenceStore();
PDEPreferencesManager preferencesManager = new PDEPreferencesManager(IPDEUIConstants.PLUGIN_ID);
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/project/BundleImporterTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/project/BundleImporterTests.java
index be4b41a..8be539d 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/project/BundleImporterTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/project/BundleImporterTests.java
@@ -13,28 +13,33 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.project;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.util.Map;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.core.plugin.*;
import org.eclipse.pde.internal.core.project.BundleProjectService;
import org.eclipse.team.core.ScmUrlImportDescription;
import org.eclipse.team.core.Team;
import org.eclipse.team.core.importing.provisional.IBundleImporter;
+import org.junit.Test;
/**
* Tests for bundle importer extensions.
*
* @since 3.6
*/
-public class BundleImporterTests extends TestCase {
+public class BundleImporterTests {
private static final String CVS_IMPORTER = "org.eclipse.team.core.cvs.importer";
/**
* Tests that a import description can be created for a known plug-in
+ *
* @throws CoreException
*/
+ @Test
public void testGetImportDescriptions() throws CoreException {
String bundleId = "org.eclipse.jdt.core";
String expectedURL = "scm:cvs:pserver:dev.eclipse.org:/cvsroot/eclipse:org.eclipse.jdt.core";
@@ -59,6 +64,7 @@
/**
* Tests that the team API returns all known bundle importers
*/
+ @Test
public void testBundleImporters() {
IBundleImporter[] importers = Team.getBundleImporters();
assertEquals(1, importers.length);
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/project/BundleRootTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/project/BundleRootTests.java
index 5b58f6e..8455a14 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/project/BundleRootTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/project/BundleRootTests.java
@@ -13,7 +13,11 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.project;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.jdt.core.JavaCore;
@@ -23,13 +27,19 @@
import org.eclipse.pde.internal.core.PDECore;
import org.eclipse.pde.internal.core.natures.PDE;
import org.eclipse.pde.internal.core.project.PDEProject;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
import org.osgi.framework.Version;
/**
* Tests flexible bundle root location within PDE projects.
* @since 3.6
*/
-public class BundleRootTests extends TestCase {
+public class BundleRootTests {
+
+ @Rule
+ public TestName testName = new TestName();
protected IBundleProjectService getBundleProjectService() {
return PDECore.getDefault().acquireService(IBundleProjectService.class);
@@ -43,7 +53,7 @@
* @exception CoreException on failure
*/
protected IProject createProject() throws CoreException {
- String name = getName().toLowerCase().substring(4);
+ String name = testName.getMethodName().toLowerCase().substring(4);
name = "test." + name;
IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
assertFalse("Project should not exist", proj.exists());
@@ -60,7 +70,7 @@
* @exception CoreException on failure
*/
protected IBundleProjectDescription newProject() throws CoreException {
- String name = getName().toLowerCase().substring(4);
+ String name = testName.getMethodName().toLowerCase().substring(4);
name = "test." + name;
IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
assertFalse("Project should not exist", proj.exists());
@@ -72,6 +82,7 @@
/**
* Tests setting/getting the bundle root property for a project.
*/
+ @Test
public void testSetGetLocation() throws CoreException {
IProject project = createProject();
assertEquals("Bundle root unspecified - should be project itself", project, PDEProject.getBundleRoot(project));
@@ -88,8 +99,10 @@
}
/**
- * Tests setting/getting the bundle root property for a project using IBundleProjectService and IBundleProjectDescription
+ * Tests setting/getting the bundle root property for a project using
+ * IBundleProjectService and IBundleProjectDescription
*/
+ @Test
public void testServiceSetGetLocation() throws CoreException {
IProject project = createProject();
IBundleProjectService service = getBundleProjectService();
@@ -109,16 +122,20 @@
/**
* Test getting a root location from a non-existent project
*/
+ @Test
public void testGetOnNonExistantProject() {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getName());
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(testName.getMethodName());
assertFalse("Project should not exist", project.exists());
assertEquals("Root location should be project root", project, PDEProject.getBundleRoot(project));
}
/**
- * Tests that IPluginModel.getInstallLocation() returns the bundle root location in a project.
+ * Tests that IPluginModel.getInstallLocation() returns the bundle root
+ * location in a project.
+ *
* @throws CoreException
*/
+ @Test
public void testPluginModelInstallLocation() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
@@ -136,10 +153,12 @@
}
/**
- * Minimal bundle project with a non-default root - set a symbolic name, and go.
+ * Minimal bundle project with a non-default root - set a symbolic name, and
+ * go.
*
* @throws CoreException
*/
+ @Test
public void testBundleRoot() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
@@ -186,11 +205,12 @@
}
/**
- * Creates a bundle project at a root location, and then removes PDE/Java natures. Then attempts create
- * a bundle project out of the existing data.
+ * Creates a bundle project at a root location, and then removes PDE/Java
+ * natures. Then attempts create a bundle project out of the existing data.
*
* @throws CoreException
*/
+ @Test
public void testAssignRootToExistingProject() throws CoreException {
testBundleRoot(); // create a simple bundle
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/project/ProjectCreationTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/project/ProjectCreationTests.java
index 7c5b82f..a8ed499 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/project/ProjectCreationTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/project/ProjectCreationTests.java
@@ -14,11 +14,16 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.project;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.*;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.charset.*;
-import junit.framework.TestCase;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
@@ -38,6 +43,9 @@
import org.eclipse.pde.internal.core.project.PDEProject;
import org.eclipse.pde.internal.core.text.bundle.BundleModelFactory;
import org.eclipse.pde.ui.tests.PDETestsPlugin;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
@@ -46,7 +54,7 @@
*
* @since 3.6
*/
-public class ProjectCreationTests extends TestCase {
+public class ProjectCreationTests {
protected static final IBundleClasspathEntry DEFAULT_BUNDLE_CLASSPATH_ENTRY;
@@ -54,6 +62,9 @@
DEFAULT_BUNDLE_CLASSPATH_ENTRY = getBundleProjectService().newBundleClasspathEntry(null, null, new Path("."));
}
+ @Rule
+ public TestName testName = new TestName();
+
public static IBundleProjectService getBundleProjectService() {
return PDECore.getDefault().acquireService(IBundleProjectService.class);
}
@@ -79,12 +90,14 @@
/**
* Provides a project for the test case.
*
- * @param test test case
+ * @param test
+ * test case
* @return project which does not yet exist
- * @exception CoreException on failure
+ * @exception CoreException
+ * on failure
*/
protected IBundleProjectDescription newProject() throws CoreException {
- String name = getName().toLowerCase().substring(4);
+ String name = testName.getMethodName().toLowerCase().substring(4);
name = "test." + name;
IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
assertFalse("Project should not exist", proj.exists());
@@ -98,6 +111,7 @@
*
* @throws CoreException
*/
+ @Test
public void testBundle() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
@@ -146,6 +160,7 @@
*
* @throws CoreException
*/
+ @Test
public void testEmptyHeader() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
@@ -194,10 +209,12 @@
}
/**
- * Tests that an empty package import header can be tolerated (see bug 312291)
+ * Tests that an empty package import header can be tolerated (see bug
+ * 312291)
*
* @throws CoreException
*/
+ @Test
public void testEmptyPackageImportHeader() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
@@ -226,6 +243,7 @@
*
* @throws CoreException
*/
+ @Test
public void testFragment() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
@@ -274,16 +292,19 @@
*
* @throws CoreException
*/
+ @Test
public void testFragmentSrc() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
description.setBundleVersion(new Version("1.2.2"));
IBundleProjectService service = getBundleProjectService();
- IHostDescription host = service.newHost("some.host", new VersionRange(new Version("1.0.0"), true, new Version("2.0.0"), false));
+ IHostDescription host = service.newHost("some.host",
+ new VersionRange(new Version("1.0.0"), true, new Version("2.0.0"), false));
description.setHost(host);
description.setActivationPolicy(Constants.ACTIVATION_LAZY);
- IBundleClasspathEntry e1 = service.newBundleClasspathEntry(new Path("frag"), new Path("bin"), new Path("frag.jar"));
- description.setBundleClasspath(new IBundleClasspathEntry[]{e1});
+ IBundleClasspathEntry e1 = service.newBundleClasspathEntry(new Path("frag"), new Path("bin"),
+ new Path("frag.jar"));
+ description.setBundleClasspath(new IBundleClasspathEntry[] { e1 });
description.apply(null);
IBundleProjectDescription d2 = service.getDescription(project);
@@ -326,13 +347,14 @@
*
* @throws CoreException
*/
+ @Test
public void testTwoSourceFoldersOneJar() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
IBundleProjectService service = getBundleProjectService();
IBundleClasspathEntry e1 = service.newBundleClasspathEntry(new Path("src1"), null, new Path("the.jar"));
IBundleClasspathEntry e2 = service.newBundleClasspathEntry(new Path("src2"), null, new Path("the.jar"));
- description.setBundleClasspath(new IBundleClasspathEntry[]{e1, e2});
+ description.setBundleClasspath(new IBundleClasspathEntry[] { e1, e2 });
description.setBundleVersion(new Version("1.2.3"));
description.apply(null);
@@ -385,13 +407,15 @@
*
* @throws CoreException
*/
+ @Test
public void testTwoSourceFoldersTwoJars() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
IBundleProjectService service = getBundleProjectService();
IBundleClasspathEntry e1 = service.newBundleClasspathEntry(new Path("src1"), null, new Path("."));
- IBundleClasspathEntry e2 = service.newBundleClasspathEntry(new Path("src2"), new Path("bin2"), new Path("two.jar"));
- description.setBundleClasspath(new IBundleClasspathEntry[]{e1, e2});
+ IBundleClasspathEntry e2 = service.newBundleClasspathEntry(new Path("src2"), new Path("bin2"),
+ new Path("two.jar"));
+ description.setBundleClasspath(new IBundleClasspathEntry[] { e1, e2 });
description.setBundleVersion(new Version("1.2.3"));
description.apply(null);
@@ -430,11 +454,13 @@
assertNull("Wrong export wizard", d2.getExportWizardId());
assertNull("Wrong launch shortctus", d2.getLaunchShortcuts());
}
+
/**
* Set a symbolic name and singleton property, and go.
*
* @throws CoreException
*/
+ @Test
public void testSingleton() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
@@ -476,10 +502,12 @@
}
/**
- * A simple project with a single source folder, default output folder, and bundle classpath (.).
+ * A simple project with a single source folder, default output folder, and
+ * bundle classpath (.).
*
* @throws CoreException
*/
+ @Test
public void testBundleSrc() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
@@ -487,12 +515,14 @@
IPath src = new Path("src");
IBundleProjectService service = getBundleProjectService();
IBundleClasspathEntry spec = service.newBundleClasspathEntry(src, null, new Path("."));
- description.setBundleClasspath(new IBundleClasspathEntry[] {spec});
+ description.setBundleClasspath(new IBundleClasspathEntry[] { spec });
IPackageExportDescription ex0 = service.newPackageExport("a.b.c", new Version("2.0.0"), true, null);
IPackageExportDescription ex1 = service.newPackageExport("a.b.c.interal", null, false, null);
- IPackageExportDescription ex2 = service.newPackageExport("a.b.c.interal.x", null, false, new String[]{"x.y.z"});
- IPackageExportDescription ex3 = service.newPackageExport("a.b.c.interal.y", new Version("1.2.3"), false, new String[]{"d.e.f", "g.h.i"});
- description.setPackageExports(new IPackageExportDescription[]{ex0, ex1, ex2, ex3});
+ IPackageExportDescription ex2 = service.newPackageExport("a.b.c.interal.x", null, false,
+ new String[] { "x.y.z" });
+ IPackageExportDescription ex3 = service.newPackageExport("a.b.c.interal.y", new Version("1.2.3"), false,
+ new String[] { "d.e.f", "g.h.i" });
+ description.setPackageExports(new IPackageExportDescription[] { ex0, ex1, ex2, ex3 });
description.setActivationPolicy(Constants.ACTIVATION_LAZY);
description.apply(null);
@@ -541,6 +571,7 @@
*
* @throws CoreException
*/
+ @Test
public void testBundleToFrag() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
@@ -548,7 +579,7 @@
IPath src = new Path("src");
IBundleProjectService service = getBundleProjectService();
IBundleClasspathEntry spec = service.newBundleClasspathEntry(src, null, new Path("."));
- description.setBundleClasspath(new IBundleClasspathEntry[] {spec});
+ description.setBundleClasspath(new IBundleClasspathEntry[] { spec });
description.setActivationPolicy(Constants.ACTIVATION_LAZY);
description.apply(null);
@@ -594,11 +625,12 @@
}
/**
- * A project with a source folder, plugin.xml, activator, execution environment,
- * required bundles, and package import.
+ * A project with a source folder, plugin.xml, activator, execution
+ * environment, required bundles, and package import.
*
* @throws CoreException
*/
+ @Test
public void testPlugin() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
@@ -606,21 +638,19 @@
IPath src = new Path("src");
IBundleProjectService service = getBundleProjectService();
IBundleClasspathEntry spec = service.newBundleClasspathEntry(src, null, new Path("."));
- description.setBundleClasspath(new IBundleClasspathEntry[] {spec});
- description.setBinIncludes(new IPath[]{new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR)});
+ description.setBundleClasspath(new IBundleClasspathEntry[] { spec });
+ description.setBinIncludes(new IPath[] { new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) });
description.setActivator("org.eclipse.foo.Activator");
description.setActivationPolicy(Constants.ACTIVATION_LAZY);
description.setEquinox(true);
description.setExtensionRegistry(true);
- description.setExecutionEnvironments(new String[]{"J2SE-1.4"});
- IRequiredBundleDescription rb1 = service.newRequiredBundle(
- "org.eclipse.core.resources",
- new VersionRange(new Version(3,5,0), true, new Version(4,0,0), false),
- true, false);
+ description.setExecutionEnvironments(new String[] { "J2SE-1.4" });
+ IRequiredBundleDescription rb1 = service.newRequiredBundle("org.eclipse.core.resources",
+ new VersionRange(new Version(3, 5, 0), true, new Version(4, 0, 0), false), true, false);
IRequiredBundleDescription rb2 = service.newRequiredBundle("org.eclipse.core.variables", null, false, false);
- description.setRequiredBundles(new IRequiredBundleDescription[]{rb1, rb2});
+ description.setRequiredBundles(new IRequiredBundleDescription[] { rb1, rb2 });
IPackageImportDescription pi1 = service.newPackageImport("com.ibm.icu.text", null, false);
- description.setPackageImports(new IPackageImportDescription[]{pi1});
+ description.setPackageImports(new IPackageImportDescription[] { pi1 });
description.setHeader("SomeHeader", "something");
// test version override with explicit header setting
description.setBundleVersion(new Version("2.0.0"));
@@ -676,32 +706,39 @@
}
/**
- * Modify a simple project - change class path, add activator and plugin.xml.
+ * Modify a simple project - change class path, add activator and
+ * plugin.xml.
*
* @throws CoreException
*/
+ @Test
public void testModifyBundle() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
IBundleProjectService service = getBundleProjectService();
IPath src = new Path("srcA");
IBundleClasspathEntry spec = service.newBundleClasspathEntry(src, null, new Path("a.jar"));
- description.setBundleClasspath(new IBundleClasspathEntry[] {spec});
+ description.setBundleClasspath(new IBundleClasspathEntry[] { spec });
IPackageExportDescription ex0 = service.newPackageExport("a.b.c", new Version("2.0.0"), true, null);
IPackageExportDescription ex1 = service.newPackageExport("a.b.c.interal", null, false, null);
- IPackageExportDescription ex2 = service.newPackageExport("a.b.c.interal.x", null, false, new String[]{"x.y.z"});
- IPackageExportDescription ex3 = service.newPackageExport("a.b.c.interal.y", new Version("1.2.3"), false, new String[]{"d.e.f", "g.h.i"});
- description.setPackageExports(new IPackageExportDescription[]{ex0, ex1, ex2, ex3});
+ IPackageExportDescription ex2 = service.newPackageExport("a.b.c.interal.x", null, false,
+ new String[] { "x.y.z" });
+ IPackageExportDescription ex3 = service.newPackageExport("a.b.c.interal.y", new Version("1.2.3"), false,
+ new String[] { "d.e.f", "g.h.i" });
+ description.setPackageExports(new IPackageExportDescription[] { ex0, ex1, ex2, ex3 });
description.apply(null);
// modify the project
IBundleProjectDescription modify = service.getDescription(project);
IPath srcB = new Path("srcB");
IBundleClasspathEntry specB = service.newBundleClasspathEntry(srcB, null, new Path("b.jar"));
- modify.setBundleClasspath(new IBundleClasspathEntry[] {specB});
- IPackageExportDescription ex4 = service.newPackageExport("x.y.z.interal", null, false, new String[]{"zz.top"});
- modify.setPackageExports(new IPackageExportDescription[]{ex0, ex2, ex4, ex3}); // remove, add, re-order
- modify.setBinIncludes(new IPath[]{new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR)});
+ modify.setBundleClasspath(new IBundleClasspathEntry[] { specB });
+ IPackageExportDescription ex4 = service.newPackageExport("x.y.z.interal", null, false,
+ new String[] { "zz.top" });
+ modify.setPackageExports(new IPackageExportDescription[] { ex0, ex2, ex4, ex3 }); // remove,
+ // add,
+ // re-order
+ modify.setBinIncludes(new IPath[] { new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) });
modify.setActivator("org.eclipse.foo.Activator");
modify.setActivationPolicy(Constants.ACTIVATION_LAZY);
modify.apply(null);
@@ -736,7 +773,9 @@
assertEquals("Wrong number of exports", 4, exports.length);
assertEquals("Wrong export", ex0, exports[0]);
assertEquals("Wrong export", ex2, exports[1]);
- assertEquals("Wrong export", ex3, exports[2]); // the manifest ends up sorted, so order changes
+ assertEquals("Wrong export", ex3, exports[2]); // the manifest ends up
+ // sorted, so order
+ // changes
assertEquals("Wrong export", ex4, exports[3]);
assertEquals("Wrong project", project, d2.getProject());
assertNull("Wrong required bundles", d2.getRequiredBundles());
@@ -750,33 +789,40 @@
}
/**
- * Modify a simple project to add/remove/clear some entries.
- * See bug 380444 where previous settings weren't being cleared
+ * Modify a simple project to add/remove/clear some entries. See bug 380444
+ * where previous settings weren't being cleared
*
* @throws CoreException
*/
+ @Test
public void testModifyRequiredBundles() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
IBundleProjectService service = getBundleProjectService();
IRequiredBundleDescription requireDesc = service.newRequiredBundle("requiredBundleOne", null, false, false);
- IRequiredBundleDescription requireDesc2 = service.newRequiredBundle("requiredBundleTwo", new VersionRange("[1.0.0,2.0.0)"), false, false);
+ IRequiredBundleDescription requireDesc2 = service.newRequiredBundle("requiredBundleTwo",
+ new VersionRange("[1.0.0,2.0.0)"), false, false);
IRequiredBundleDescription requireDesc3 = service.newRequiredBundle("requiredBundleThree", null, true, false);
IRequiredBundleDescription requireDesc4 = service.newRequiredBundle("requiredBundleFour", null, false, true);
- description.setRequiredBundles(new IRequiredBundleDescription[]{requireDesc, requireDesc2, requireDesc3, requireDesc4});
+ description.setRequiredBundles(
+ new IRequiredBundleDescription[] { requireDesc, requireDesc2, requireDesc3, requireDesc4 });
IPackageExportDescription ex0 = service.newPackageExport("a.b.c", new Version("2.0.0"), true, null);
IPackageExportDescription ex1 = service.newPackageExport("a.b.c.interal", null, false, null);
- IPackageExportDescription ex2 = service.newPackageExport("a.b.c.interal.x", null, false, new String[]{"x.y.z"});
- IPackageExportDescription ex3 = service.newPackageExport("a.b.c.interal.y", new Version("1.2.3"), false, new String[]{"d.e.f", "g.h.i"});
- description.setPackageExports(new IPackageExportDescription[]{ex0, ex1, ex2, ex3});
+ IPackageExportDescription ex2 = service.newPackageExport("a.b.c.interal.x", null, false,
+ new String[] { "x.y.z" });
+ IPackageExportDescription ex3 = service.newPackageExport("a.b.c.interal.y", new Version("1.2.3"), false,
+ new String[] { "d.e.f", "g.h.i" });
+ description.setPackageExports(new IPackageExportDescription[] { ex0, ex1, ex2, ex3 });
IPackageImportDescription importDesc = service.newPackageImport("importPkgOne", null, false);
- IPackageImportDescription importDesc2 = service.newPackageImport("importPkgTwo", new VersionRange("[1.0.0,2.0.0)"), false);
+ IPackageImportDescription importDesc2 = service.newPackageImport("importPkgTwo",
+ new VersionRange("[1.0.0,2.0.0)"), false);
IPackageImportDescription importDesc3 = service.newPackageImport("importPkgThree", null, true);
IPackageImportDescription importDesc4 = service.newPackageImport("importPkgFour", null, false);
- description.setPackageImports(new IPackageImportDescription[]{importDesc, importDesc2, importDesc3, importDesc4});
+ description.setPackageImports(
+ new IPackageImportDescription[] { importDesc, importDesc2, importDesc3, importDesc4 });
description.apply(null);
@@ -789,15 +835,19 @@
// add entries
IRequiredBundleDescription requireDesc5 = service.newRequiredBundle("requiredBundleFive", null, false, false);
IRequiredBundleDescription requireDesc6 = service.newRequiredBundle("requiredBundleSix", null, false, false);
- description.setRequiredBundles(new IRequiredBundleDescription[]{requireDesc, requireDesc2, requireDesc3, requireDesc4, requireDesc5, requireDesc6});
+ description.setRequiredBundles(new IRequiredBundleDescription[] { requireDesc, requireDesc2, requireDesc3,
+ requireDesc4, requireDesc5, requireDesc6 });
- IPackageExportDescription ex4 = service.newPackageExport("a.b.c.interal.x2", null, false, new String[]{"x.y.z"});
- IPackageExportDescription ex5 = service.newPackageExport("a.b.c.interal.y2", new Version("1.2.3"), false, new String[]{"d.e.f", "g.h.i"});
- description.setPackageExports(new IPackageExportDescription[]{ex0, ex1, ex2, ex3, ex4, ex5});
+ IPackageExportDescription ex4 = service.newPackageExport("a.b.c.interal.x2", null, false,
+ new String[] { "x.y.z" });
+ IPackageExportDescription ex5 = service.newPackageExport("a.b.c.interal.y2", new Version("1.2.3"), false,
+ new String[] { "d.e.f", "g.h.i" });
+ description.setPackageExports(new IPackageExportDescription[] { ex0, ex1, ex2, ex3, ex4, ex5 });
IPackageImportDescription importDesc5 = service.newPackageImport("importPkgFive", null, true);
IPackageImportDescription importDesc6 = service.newPackageImport("importPkgSix", null, false);
- description.setPackageImports(new IPackageImportDescription[]{importDesc, importDesc2, importDesc3, importDesc4, importDesc5, importDesc6});
+ description.setPackageImports(new IPackageImportDescription[] { importDesc, importDesc2, importDesc3,
+ importDesc4, importDesc5, importDesc6 });
description.apply(null);
@@ -808,9 +858,9 @@
assertEquals("Wrong number of package imports after additions", 6, d3.getPackageImports().length);
// remove most entries
- description.setRequiredBundles(new IRequiredBundleDescription[]{requireDesc2, requireDesc5});
- description.setPackageExports(new IPackageExportDescription[]{ex1, ex4});
- description.setPackageImports(new IPackageImportDescription[]{importDesc2, importDesc5});
+ description.setRequiredBundles(new IRequiredBundleDescription[] { requireDesc2, requireDesc5 });
+ description.setPackageExports(new IPackageExportDescription[] { ex1, ex4 });
+ description.setPackageImports(new IPackageImportDescription[] { importDesc2, importDesc5 });
description.apply(null);
// verify attributes
@@ -837,6 +887,7 @@
*
* @throws CoreException
*/
+ @Test
public void testFragToBundle() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
@@ -846,7 +897,7 @@
description.setHost(host);
description.apply(null);
- //modify to a bundle and remove a header
+ // modify to a bundle and remove a header
IBundleProjectDescription modify = service.getDescription(project);
assertEquals("Wrong header value", "one", modify.getHeader("HeaderOne"));
modify.setHeader("HeaderOne", null);
@@ -895,18 +946,19 @@
*
* @throws CoreException
*/
+ @Test
public void testJarsAsBundle() throws CoreException, IOException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
IBundleProjectService service = getBundleProjectService();
IBundleClasspathEntry one = service.newBundleClasspathEntry(null, null, new Path("one.jar"));
IBundleClasspathEntry two = service.newBundleClasspathEntry(null, null, new Path("lib/two.jar"));
- description.setBundleClasspath(new IBundleClasspathEntry[]{one, two});
+ description.setBundleClasspath(new IBundleClasspathEntry[] { one, two });
IPackageExportDescription exp1 = service.newPackageExport("org.eclipse.one", new Version("1.0.0"), true, null);
IPackageExportDescription exp2 = service.newPackageExport("org.eclipse.two", new Version("1.0.0"), true, null);
- description.setPackageExports(new IPackageExportDescription[]{exp1, exp2});
+ description.setPackageExports(new IPackageExportDescription[] { exp1, exp2 });
description.setBundleVersion(new Version("1.0.0"));
- description.setExecutionEnvironments(new String[]{"J2SE-1.5"});
+ description.setExecutionEnvironments(new String[] { "J2SE-1.5" });
description.apply(null);
// create bogus jar files
createBogusJar(project.getFile("one.jar"));
@@ -965,7 +1017,7 @@
IContainer parent = file.getParent();
while (parent instanceof IFolder) {
if (!parent.exists()) {
- ((IFolder)parent).create(false, true, null);
+ ((IFolder) parent).create(false, true, null);
}
parent = parent.getParent();
}
@@ -981,18 +1033,19 @@
*
* @throws CoreException
*/
+ @Test
public void testClassFolders() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
IBundleProjectService service = getBundleProjectService();
IBundleClasspathEntry one = service.newBundleClasspathEntry(null, new Path("bin1"), new Path("one.jar"));
IBundleClasspathEntry two = service.newBundleClasspathEntry(null, new Path("bin2"), new Path("two.jar"));
- description.setBundleClasspath(new IBundleClasspathEntry[]{one, two});
+ description.setBundleClasspath(new IBundleClasspathEntry[] { one, two });
IPackageExportDescription exp1 = service.newPackageExport("org.eclipse.one", new Version("1.0.0"), true, null);
IPackageExportDescription exp2 = service.newPackageExport("org.eclipse.two", new Version("1.0.0"), true, null);
- description.setPackageExports(new IPackageExportDescription[]{exp1, exp2});
+ description.setPackageExports(new IPackageExportDescription[] { exp1, exp2 });
description.setBundleVersion(new Version("1.0.0"));
- description.setExecutionEnvironments(new String[]{"J2SE-1.5"});
+ description.setExecutionEnvironments(new String[] { "J2SE-1.5" });
description.apply(null);
// create folders
project.getFolder("bin1").create(false, true, null);
@@ -1046,10 +1099,11 @@
*
* @throws CoreException
*/
+ @Test
public void testExportWizardLaunchShortcuts() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
- description.setLaunchShortcuts(new String[]{"org.eclipse.jdt.debug.ui.javaAppletShortcut"});
+ description.setLaunchShortcuts(new String[] { "org.eclipse.jdt.debug.ui.javaAppletShortcut" });
description.setExportWizardId("org.eclipse.debug.internal.ui.importexport.breakpoints.WizardExportBreakpoints");
description.apply(null);
@@ -1084,7 +1138,9 @@
assertFalse("Wrong extension registry support", d2.isExtensionRegistry());
assertFalse("Wrong Equinox headers", d2.isEquinox());
assertFalse("Wrong singleton", d2.isSingleton());
- assertEquals("Wrong export wizard", "org.eclipse.debug.internal.ui.importexport.breakpoints.WizardExportBreakpoints", d2.getExportWizardId());
+ assertEquals("Wrong export wizard",
+ "org.eclipse.debug.internal.ui.importexport.breakpoints.WizardExportBreakpoints",
+ d2.getExportWizardId());
String[] ids = d2.getLaunchShortcuts();
assertNotNull("Wrong launch shortctus", ids);
assertEquals("Wrong number of shortcuts", 1, ids.length);
@@ -1096,6 +1152,7 @@
*
* @throws CoreException
*/
+ @Test
public void testLazyAutostart() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
@@ -1103,22 +1160,20 @@
IPath src = new Path("src");
IBundleProjectService service = getBundleProjectService();
IBundleClasspathEntry spec = service.newBundleClasspathEntry(src, null, new Path("."));
- description.setBundleClasspath(new IBundleClasspathEntry[] {spec});
- description.setBinIncludes(new IPath[]{new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR)});
+ description.setBundleClasspath(new IBundleClasspathEntry[] { spec });
+ description.setBinIncludes(new IPath[] { new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) });
description.setActivator("org.eclipse.foo.Activator");
description.setActivationPolicy(Constants.ACTIVATION_LAZY);
description.setTargetVersion(IBundleProjectDescription.VERSION_3_1);
description.setEquinox(true);
description.setExtensionRegistry(true);
- description.setExecutionEnvironments(new String[]{"J2SE-1.4"});
- IRequiredBundleDescription rb1 = service.newRequiredBundle(
- "org.eclipse.core.resources",
- new VersionRange(new Version(3,5,0), true, new Version(4,0,0), false),
- true, false);
+ description.setExecutionEnvironments(new String[] { "J2SE-1.4" });
+ IRequiredBundleDescription rb1 = service.newRequiredBundle("org.eclipse.core.resources",
+ new VersionRange(new Version(3, 5, 0), true, new Version(4, 0, 0), false), true, false);
IRequiredBundleDescription rb2 = service.newRequiredBundle("org.eclipse.core.variables", null, false, false);
- description.setRequiredBundles(new IRequiredBundleDescription[]{rb1, rb2});
+ description.setRequiredBundles(new IRequiredBundleDescription[] { rb1, rb2 });
IPackageImportDescription pi1 = service.newPackageImport("com.ibm.icu.text", null, false);
- description.setPackageImports(new IPackageImportDescription[]{pi1});
+ description.setPackageImports(new IPackageImportDescription[] { pi1 });
description.apply(null);
IBundleProjectDescription d2 = service.getDescription(project);
@@ -1178,8 +1233,10 @@
/**
* Returns a structured header from a bundle model
*
- * @param bundle the bundle
- * @param header header name/key
+ * @param bundle
+ * the bundle
+ * @param header
+ * header name/key
* @return header or <code>null</code>
*/
private IManifestHeader createHeader(IBundle bundle, String header) {
@@ -1196,6 +1253,7 @@
*
* @throws CoreException
*/
+ @Test
public void testEagerAutostart() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
@@ -1203,8 +1261,8 @@
IPath src = new Path("src");
IBundleProjectService service = getBundleProjectService();
IBundleClasspathEntry spec = service.newBundleClasspathEntry(src, null, new Path("."));
- description.setBundleClasspath(new IBundleClasspathEntry[] {spec});
- description.setBinIncludes(new IPath[]{new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR)});
+ description.setBundleClasspath(new IBundleClasspathEntry[] { spec });
+ description.setBinIncludes(new IPath[] { new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) });
description.setActivator("org.eclipse.foo.Activator");
description.setTargetVersion(IBundleProjectDescription.VERSION_3_1);
description.setEquinox(true);
@@ -1262,6 +1320,7 @@
*
* @throws CoreException
*/
+ @Test
public void testLazyEclipseLazyStart() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
@@ -1269,8 +1328,8 @@
IPath src = new Path("src");
IBundleProjectService service = getBundleProjectService();
IBundleClasspathEntry spec = service.newBundleClasspathEntry(src, null, new Path("."));
- description.setBundleClasspath(new IBundleClasspathEntry[] {spec});
- description.setBinIncludes(new IPath[]{new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR)});
+ description.setBundleClasspath(new IBundleClasspathEntry[] { spec });
+ description.setBinIncludes(new IPath[] { new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) });
description.setActivator("org.eclipse.foo.Activator");
description.setActivationPolicy(Constants.ACTIVATION_LAZY);
description.setTargetVersion(IBundleProjectDescription.VERSION_3_2);
@@ -1329,6 +1388,7 @@
*
* @throws CoreException
*/
+ @Test
public void testEagerEclipseLazyStart() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
@@ -1336,8 +1396,8 @@
IPath src = new Path("src");
IBundleProjectService service = getBundleProjectService();
IBundleClasspathEntry spec = service.newBundleClasspathEntry(src, null, new Path("."));
- description.setBundleClasspath(new IBundleClasspathEntry[] {spec});
- description.setBinIncludes(new IPath[]{new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR)});
+ description.setBundleClasspath(new IBundleClasspathEntry[] { spec });
+ description.setBinIncludes(new IPath[] { new Path(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) });
description.setActivator("org.eclipse.foo.Activator");
description.setTargetVersion(IBundleProjectDescription.VERSION_3_2);
description.setEquinox(true);
@@ -1391,12 +1451,16 @@
}
/**
- * Returns the given input stream's contents as a character array.
- * If a length is specified (i.e. if length != -1), this represents the number of bytes in the stream.
- * Note the specified stream is not closed in this method
- * @param stream the stream to get convert to the char array
+ * Returns the given input stream's contents as a character array. If a
+ * length is specified (i.e. if length != -1), this represents the number of
+ * bytes in the stream. Note the specified stream is not closed in this
+ * method
+ *
+ * @param stream
+ * the stream to get convert to the char array
* @return the given input stream's contents as a character array.
- * @throws IOException if a problem occurred reading the stream.
+ * @throws IOException
+ * if a problem occurred reading the stream.
*/
public static char[] getInputStreamAsCharArray(InputStream stream) throws IOException {
Charset charset = StandardCharsets.UTF_8;
@@ -1411,8 +1475,11 @@
/**
* Returns the given input stream as a byte array
- * @param stream the stream to get as a byte array
- * @param length the length to read from the stream or -1 for unknown
+ *
+ * @param stream
+ * the stream to get as a byte array
+ * @param length
+ * the length to read from the stream or -1 for unknown
* @return the given input stream as a byte array
* @throws IOException
*/
@@ -1427,9 +1494,7 @@
int amountRequested = Math.max(stream.available(), 8192);
// resize contents if needed
if (contentsLength + amountRequested > contents.length) {
- System.arraycopy(contents,
- 0,
- contents = new byte[contentsLength + amountRequested],
+ System.arraycopy(contents, 0, contents = new byte[contentsLength + amountRequested],
0,
contentsLength);
}
@@ -1450,7 +1515,8 @@
int readSize = 0;
while ((readSize != -1) && (len != length)) {
// See PR 1FMS89U
- // We record first the read size. In this case length is the actual
+ // We record first the read size. In this case length is the
+ // actual
// read size.
len += readSize;
readSize = stream.read(contents, len, length - len);
@@ -1460,21 +1526,25 @@
}
/**
- * Tests that package import/export headers don't get flattened when doing an unrelated edit.
+ * Tests that package import/export headers don't get flattened when doing
+ * an unrelated edit.
*
* @throws CoreException
* @throws IOException
*/
+ @Test
public void testHeaderFormatting() throws CoreException, IOException {
IBundleProjectDescription description = newProject();
IPackageImportDescription imp1 = getBundleProjectService().newPackageImport("org.eclipse.osgi", null, false);
- IPackageImportDescription imp2 = getBundleProjectService().newPackageImport("org.eclipse.core.runtime", null, false);
- IPackageImportDescription imp3 = getBundleProjectService().newPackageImport("org.eclipse.core.resources", null, false);
- description.setPackageImports(new IPackageImportDescription[]{imp1, imp2, imp3});
+ IPackageImportDescription imp2 = getBundleProjectService().newPackageImport("org.eclipse.core.runtime", null,
+ false);
+ IPackageImportDescription imp3 = getBundleProjectService().newPackageImport("org.eclipse.core.resources", null,
+ false);
+ description.setPackageImports(new IPackageImportDescription[] { imp1, imp2, imp3 });
IPackageExportDescription ex1 = getBundleProjectService().newPackageExport("a.b.c", null, true, null);
IPackageExportDescription ex2 = getBundleProjectService().newPackageExport("a.b.c.d", null, true, null);
IPackageExportDescription ex3 = getBundleProjectService().newPackageExport("a.b.c.e", null, true, null);
- description.setPackageExports(new IPackageExportDescription[]{ex1, ex2, ex3});
+ description.setPackageExports(new IPackageExportDescription[] { ex1, ex2, ex3 });
IProject project = description.getProject();
description.apply(null);
@@ -1503,19 +1573,20 @@
*
* @throws CoreException
*/
+ @Test
public void testNonBundleToBundle() throws CoreException {
IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject("test.non.bundle.to.bundle");
assertFalse("Project should not exist", proj.exists());
proj.create(null);
proj.open(null);
IProjectDescription pd = proj.getDescription();
- pd.setNatureIds(new String[]{JavaCore.NATURE_ID});
+ pd.setNatureIds(new String[] { JavaCore.NATURE_ID });
proj.setDescription(pd, null);
IBundleProjectDescription description = getBundleProjectService().getDescription(proj);
assertTrue("Missing Java Nature", description.hasNature(JavaCore.NATURE_ID));
description.setSymbolicName("test.non.bundle.to.bundle");
- description.setNatureIds(new String[]{IBundleProjectDescription.PLUGIN_NATURE, JavaCore.NATURE_ID});
+ description.setNatureIds(new String[] { IBundleProjectDescription.PLUGIN_NATURE, JavaCore.NATURE_ID });
description.apply(null);
// validate
@@ -1533,21 +1604,22 @@
}
/**
- * Convert an existing Java project into a bundle project. Ensure it's build path
- * doesn't get toasted in the process.
+ * Convert an existing Java project into a bundle project. Ensure it's build
+ * path doesn't get toasted in the process.
*
* @throws CoreException
*/
+ @Test
public void testJavaToBundle() throws CoreException {
// create a Java project
- String name = getName().toLowerCase().substring(4);
+ String name = testName.getMethodName().toLowerCase().substring(4);
name = "test." + name;
IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
assertFalse("Project should not exist", proj.exists());
proj.create(null);
proj.open(null);
IProjectDescription pd = proj.getDescription();
- pd.setNatureIds(new String[]{JavaCore.NATURE_ID});
+ pd.setNatureIds(new String[] { JavaCore.NATURE_ID });
proj.setDescription(pd, null);
IFolder src = proj.getFolder("someSrc");
src.create(false, true, null);
@@ -1556,17 +1628,19 @@
IJavaProject javaProject = JavaCore.create(proj);
javaProject.setOutputLocation(output.getFullPath(), null);
IClasspathEntry entry1 = JavaCore.newSourceEntry(src.getFullPath());
- IClasspathEntry entry2 = JavaCore.newContainerEntry(JavaRuntime.newJREContainerPath(JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("J2SE-1.4")));
+ IClasspathEntry entry2 = JavaCore.newContainerEntry(JavaRuntime
+ .newJREContainerPath(JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("J2SE-1.4")));
IClasspathEntry entry3 = JavaCore.newContainerEntry(ClasspathContainerInitializer.PATH);
- javaProject.setRawClasspath(new IClasspathEntry[]{entry1, entry2, entry3}, null);
+ javaProject.setRawClasspath(new IClasspathEntry[] { entry1, entry2, entry3 }, null);
// convert to a bundle
IBundleProjectDescription description = getBundleProjectService().getDescription(proj);
assertTrue("Missing Java Nature", description.hasNature(JavaCore.NATURE_ID));
description.setSymbolicName(proj.getName());
- description.setNatureIds(new String[]{IBundleProjectDescription.PLUGIN_NATURE, JavaCore.NATURE_ID});
- IBundleClasspathEntry entry = getBundleProjectService().newBundleClasspathEntry(src.getProjectRelativePath(), null, null);
- description.setBundleClasspath(new IBundleClasspathEntry[]{entry});
+ description.setNatureIds(new String[] { IBundleProjectDescription.PLUGIN_NATURE, JavaCore.NATURE_ID });
+ IBundleClasspathEntry entry = getBundleProjectService().newBundleClasspathEntry(src.getProjectRelativePath(),
+ null, null);
+ description.setBundleClasspath(new IBundleClasspathEntry[] { entry });
description.apply(null);
// validate
@@ -1587,7 +1661,9 @@
IBundleClasspathEntry[] classpath = d2.getBundleClasspath();
assertEquals("Wrong number of Bundle-Classpath entries", 1, classpath.length);
- assertEquals("Wrong Bundle-Classpath entry", getBundleProjectService().newBundleClasspathEntry(src.getProjectRelativePath(), null, new Path(".")), classpath[0]);
+ assertEquals("Wrong Bundle-Classpath entry",
+ getBundleProjectService().newBundleClasspathEntry(src.getProjectRelativePath(), null, new Path(".")),
+ classpath[0]);
// raw class path should still be intact
IClasspathEntry[] rawClasspath = javaProject.getRawClasspath();
@@ -1599,21 +1675,24 @@
}
/**
- * Tests creating a project that has a nested class file folders instead of a jar
+ * Tests creating a project that has a nested class file folders instead of
+ * a jar
*
* @throws CoreException
*/
+ @Test
public void testClassFoldersNoJars() throws CoreException {
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
IBundleProjectService service = getBundleProjectService();
- IBundleClasspathEntry one = service.newBundleClasspathEntry(new Path("src"), new Path("WebContent/WEB-INF/classes"), new Path("WebContent/WEB-INF/classes"));
- description.setBundleClasspath(new IBundleClasspathEntry[]{one});
+ IBundleClasspathEntry one = service.newBundleClasspathEntry(new Path("src"),
+ new Path("WebContent/WEB-INF/classes"), new Path("WebContent/WEB-INF/classes"));
+ description.setBundleClasspath(new IBundleClasspathEntry[] { one });
IPackageExportDescription exp1 = service.newPackageExport("org.eclipse.one", new Version("1.0.0"), true, null);
IPackageExportDescription exp2 = service.newPackageExport("org.eclipse.two", new Version("1.0.0"), true, null);
- description.setPackageExports(new IPackageExportDescription[]{exp1, exp2});
+ description.setPackageExports(new IPackageExportDescription[] { exp1, exp2 });
description.setBundleVersion(new Version("1.0.0"));
- description.setExecutionEnvironments(new String[]{"J2SE-1.5"});
+ description.setExecutionEnvironments(new String[] { "J2SE-1.5" });
description.apply(null);
IBundleProjectDescription d2 = service.getDescription(project);
@@ -1663,23 +1742,23 @@
assertEquals("Should be no errors", 0, markers.length);
}
-
/**
* Tests that adding package exports incrementally works
*
* @throws CoreException
*/
+ @Test
public void testExportUpdateSequence() throws CoreException {
IBundleProjectService service = getBundleProjectService();
IBundleProjectDescription description = newProject();
IProject project = description.getProject();
IPackageExportDescription e1 = service.newPackageExport("a.b.c", null, true, null);
- description.setPackageExports(new IPackageExportDescription[]{e1});
+ description.setPackageExports(new IPackageExportDescription[] { e1 });
description.apply(null);
IBundleProjectDescription d2 = service.getDescription(project);
IPackageExportDescription e2 = service.newPackageExport("a.b.c.internal", null, false, null);
- d2.setPackageExports(new IPackageExportDescription[]{e1, e2});
+ d2.setPackageExports(new IPackageExportDescription[] { e1, e2 });
d2.apply(null);
IBundleProjectDescription d3 = service.getDescription(project);
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/runtime/AbstractRegistryModelTest.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/runtime/AbstractRegistryModelTest.java
index 5ff6537..4831fa2 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/runtime/AbstractRegistryModelTest.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/runtime/AbstractRegistryModelTest.java
@@ -13,17 +13,20 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.runtime;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.net.URISyntaxException;
import java.util.EventListener;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.*;
import org.eclipse.pde.internal.runtime.registry.model.*;
import org.eclipse.pde.internal.runtime.registry.model.Bundle;
import org.eclipse.pde.internal.runtime.registry.model.ServiceRegistration;
import org.eclipse.pde.ui.tests.PDETestsPlugin;
+import org.junit.*;
import org.osgi.framework.*;
-public abstract class AbstractRegistryModelTest extends TestCase implements ModelChangeListener {
+public abstract class AbstractRegistryModelTest implements ModelChangeListener {
public static class MockFramework {
private EventListener listener;
@@ -95,8 +98,8 @@
testExtPointBundle = Platform.getBundle(TEST_EXT_POINT_BUNDLE);
}
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
model = createModel();
model.connect(new NullProgressMonitor(), false);
@@ -104,8 +107,8 @@
model.addModelChangeListener(this);
}
- @Override
- protected void tearDown() {
+ @After
+ public void tearDown() {
model.removeModelChangeListener(this);
model.disconnect();
}
@@ -113,6 +116,7 @@
/**
* Verifies that model provides correct list of installed bundles
*/
+ @Test
public void testInstalledBundles() {
org.osgi.framework.Bundle[] origBundles = PDETestsPlugin.getBundleContext().getBundles();
model.initialize(new NullProgressMonitor());
@@ -121,6 +125,7 @@
assertEquals(origBundles.length, bundles.length);
}
+ @Test
public void testBundleInstalled() {
mockFramework.createBundleEvent(BundleEvent.INSTALLED, testBundle);
@@ -130,6 +135,7 @@
assertEquals(ModelChangeDelta.ADDED, deltas[0].getFlag());
}
+ @Test
public void testBundleStartedEvent() {
mockFramework.createBundleEvent(BundleEvent.STARTED, testBundle);
@@ -139,6 +145,7 @@
assertEquals(ModelChangeDelta.STARTED, deltas[0].getFlag());
}
+ @Test
public void testBundleStoppedEvent() {
mockFramework.createBundleEvent(BundleEvent.STOPPED, testBundle);
@@ -148,6 +155,7 @@
assertEquals(ModelChangeDelta.STOPPED, deltas[0].getFlag());
}
+ @Test
public void testBundleUpdatedEvent() {
mockFramework.createBundleEvent(BundleEvent.UPDATED, testBundle);
@@ -157,6 +165,7 @@
assertEquals(ModelChangeDelta.UPDATED, deltas[0].getFlag());
}
+ @Test
public void testBundleUninstalledEvent() {
mockFramework.createBundleEvent(BundleEvent.UNINSTALLED, testBundle);
@@ -166,6 +175,7 @@
assertEquals(ModelChangeDelta.REMOVED, deltas[0].getFlag());
}
+ @Test
public void testBundleResolvedEvent() {
mockFramework.createBundleEvent(BundleEvent.RESOLVED, testBundle);
@@ -175,6 +185,7 @@
assertEquals(ModelChangeDelta.RESOLVED, deltas[0].getFlag());
}
+ @Test
public void testBundleUnresolvedEvent() {
mockFramework.createBundleEvent(BundleEvent.UNRESOLVED, testBundle);
@@ -184,6 +195,7 @@
assertEquals(ModelChangeDelta.UNRESOLVED, deltas[0].getFlag());
}
+ @Test
public void testBundleStartingEvent() {
mockFramework.createBundleEvent(BundleEvent.STARTING, testBundle);
@@ -193,6 +205,7 @@
assertEquals(ModelChangeDelta.STARTING, deltas[0].getFlag());
}
+ @Test
public void testBundleStoppingEvent() {
mockFramework.createBundleEvent(BundleEvent.STOPPING, testBundle);
@@ -202,6 +215,7 @@
assertEquals(ModelChangeDelta.STOPPING, deltas[0].getFlag());
}
+ @Test
public void testServiceRegisteredEvent() {
mockFramework.createServiceEvent(ServiceEvent.REGISTERED, testServiceReference);
@@ -217,6 +231,7 @@
assertEquals(ModelChangeDelta.ADDED, delta.getFlag());
}
+ @Test
public void testServiceUnregisteringEvent() {
mockFramework.createServiceEvent(ServiceEvent.UNREGISTERING, testServiceReference);
@@ -232,6 +247,7 @@
assertEquals(ModelChangeDelta.REMOVED, delta.getFlag());
}
+ @Test
public void testServiceModifiedEvent() {
mockFramework.createServiceEvent(ServiceEvent.MODIFIED, testServiceReference);
@@ -241,6 +257,7 @@
assertEquals(ModelChangeDelta.UPDATED, deltas[0].getFlag());
}
+ @Test
public void testExtensionAddedEvent() {
mockFramework.createRegistryAddedEvent(new IExtensionPoint[] {testExtPoint});
@@ -256,6 +273,7 @@
assertEquals(ModelChangeDelta.ADDED, deltas[0].getFlag());
}
+ @Test
public void testExtensionRemovedEvent() {
mockFramework.createRegistryAddedEvent(new IExtensionPoint[] {testExtPoint});
@@ -272,6 +290,7 @@
assertEquals(ModelChangeDelta.REMOVED, deltas[0].getFlag());
}
+ @Test
public void testExtensionPointAddedEvent() {
mockFramework.createRegistryAddedEvent(new IExtensionPoint[] {testExtPoint});
@@ -285,6 +304,7 @@
assertEquals(ModelChangeDelta.ADDED, deltas[0].getFlag());
}
+ @Test
public void testExtensionPointRemovedEvent() {
mockFramework.createRegistryRemovedEvent(new IExtensionPoint[] {testExtPoint});
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/runtime/TestUtils.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/runtime/TestUtils.java
index 8d1453f..04538c0 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/runtime/TestUtils.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/runtime/TestUtils.java
@@ -19,8 +19,6 @@
import java.lang.management.ThreadInfo;
import java.util.*;
import java.util.function.Function;
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.pde.ui.tests.PDETestsPlugin;
@@ -40,7 +38,8 @@
}
public static String findPath(String path) {
- return FileLocator.find(PDETestsPlugin.getBundleContext().getBundle(), new Path(path), Collections.EMPTY_MAP).toString();
+ return FileLocator.find(PDETestsPlugin.getBundleContext().getBundle(), new Path(path), Collections.emptyMap())
+ .toString();
}
/**
@@ -113,8 +112,8 @@
/**
* Waits while given condition is {@code true} for a given amount of
* milliseconds. If the actual wait time exceeds given timeout and condition
- * will be still {@code true}, throws {@link AssertionFailedError} with
- * given message.
+ * will be still {@code true}, throws {@link AssertionError} with given
+ * message.
* <p>
* Will process UI events while waiting in UI thread, if called from
* background thread, just waits.
@@ -147,7 +146,7 @@
}
Boolean stillTrue = condition.apply(context);
if (stillTrue) {
- TestCase.fail(errorMessage.apply(context));
+ Assert.fail(errorMessage.apply(context));
}
}
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/AbstractTargetTest.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/AbstractTargetTest.java
index 28ed198..3b7348f 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/AbstractTargetTest.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/AbstractTargetTest.java
@@ -14,12 +14,17 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.target;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.*;
import java.net.URL;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
-import junit.framework.TestCase;
import org.eclipse.core.filebuffers.*;
import org.eclipse.core.runtime.*;
import org.eclipse.e4.core.contexts.EclipseContextFactory;
@@ -37,7 +42,7 @@
/**
* Common utility methods for target definition tests
*/
-public abstract class AbstractTargetTest extends TestCase {
+public abstract class AbstractTargetTest {
/**
@@ -49,8 +54,6 @@
ServiceReference<ITargetPlatformService> reference = PDETestsPlugin.getBundleContext()
.getServiceReference(ITargetPlatformService.class);
assertNotNull("Missing target platform service", reference);
- if (reference == null)
- return null;
return PDETestsPlugin.getBundleContext().getService(reference);
}
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/IUBundleContainerTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/IUBundleContainerTests.java
index 2a8621c..f19db6a 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/IUBundleContainerTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/IUBundleContainerTests.java
@@ -13,6 +13,11 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.target;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.*;
import java.net.URI;
import java.net.URL;
@@ -33,6 +38,7 @@
import org.eclipse.pde.internal.core.PDECore;
import org.eclipse.pde.internal.core.target.*;
import org.eclipse.pde.ui.tests.PDETestsPlugin;
+import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
@@ -87,6 +93,7 @@
return null;
}
+ @Test
public void testResolveUsingProfile() throws Exception {
String[] features1 = new String[]{"feature.b.feature.group"};
String[] features2 = new String[]{"feature.a.feature.group"};
@@ -131,6 +138,7 @@
*
* @throws Exception
*/
+ @Test
public void testResolveRequiredFeatures() throws Exception {
String[] bundles = new String[]{"bundle.a1", "bundle.a2", "bundle.a3", "bundle.b1", "bundle.b2", "bundle.b3"};
doResolutionTest(new String[]{"feature.b.feature.group"}, bundles);
@@ -141,6 +149,7 @@
*
* @throws Exception
*/
+ @Test
public void testResolveSingleFeature() throws Exception {
String[] bundles = new String[]{"bundle.a1", "bundle.a2", "bundle.a3"};
doResolutionTest(new String[]{"feature.a.feature.group"}, bundles);
@@ -151,6 +160,7 @@
*
* @throws Exception
*/
+ @Test
public void testResolveRequiredBundles() throws Exception {
String[] bundles = new String[]{"bundle.a1", "bundle.a2", "bundle.a3", "bundle.b1"};
doResolutionTest(new String[]{"bundle.b1"}, bundles);
@@ -161,6 +171,7 @@
*
* @throws Exception
*/
+ @Test
public void testResolveSingleBundle() throws Exception {
String[] bundles = new String[]{"bundle.a1"};
doResolutionTest(new String[]{"bundle.a1"}, bundles);
@@ -171,6 +182,7 @@
*
* @throws Exception
*/
+ @Test
public void testContentEqualNonNull() throws Exception {
IUBundleContainer c1 = createContainer(new String[]{"bundle.a1", "bundle.a2"});
IUBundleContainer c2 = createContainer(new String[]{"bundle.a1", "bundle.a2"});
@@ -182,6 +194,7 @@
*
* @throws Exception
*/
+ @Test
public void testContentNotEqualNonNull() throws Exception {
IUBundleContainer c1 = createContainer(new String[]{"bundle.a1", "bundle.a2"});
IUBundleContainer c2 = createContainer(new String[]{"bundle.b1", "bundle.b2"});
@@ -193,6 +206,7 @@
*
* @throws Exception
*/
+ @Test
public void testContentEqualNull() throws Exception {
ITargetPlatformService service = getTargetService();
IUBundleContainer c3 = (IUBundleContainer) service.newIULocation(new String[]{"bundle.a1", "bundle.a2"}, new String[]{"1.0.0", "1.0.0"}, null, 0);
@@ -205,6 +219,7 @@
*
* @throws Exception
*/
+ @Test
public void testContentNotEqualNull() throws Exception {
ITargetPlatformService service = getTargetService();
IUBundleContainer c3 = (IUBundleContainer) service.newIULocation(new String[]{"bundle.a1", "bundle.a2"}, new String[]{"1.0.0", "1.0.0"}, null, 1);
@@ -282,6 +297,7 @@
*
* @throws Exception
*/
+ @Test
public void testExternalModelManagerPreferences() throws Exception {
try {
// Set the active target to feature b (has 6 bundles)
@@ -358,17 +374,19 @@
*
* @throws Exception
*/
+ @Test
public void testPersistIUDefinition() throws Exception {
String[] bundles = new String[]{"bundle.a1", "bundle.a2", "bundle.a3"};
doPersistanceTest(new String[]{"feature.a.feature.group"}, bundles);
}
/**
- * Tests that a target definition with IU containers can be serialized to xml, then deserialized without
- * any loss of data.
+ * Tests that a target definition with IU containers can be serialized to
+ * xml, then deserialized without any loss of data.
*
* @throws Exception
*/
+ @Test
public void testPersistMultipleIUDefinition() throws Exception {
String[] bundles = new String[]{"bundle.a1", "bundle.a2", "bundle.a3", "bundle.b1", "bundle.b2", "bundle.b3"};
doPersistanceTest(new String[]{"bundle.a3", "bundle.b3"}, bundles);
@@ -379,6 +397,7 @@
*
* @throws Exception
*/
+ @Test
public void testAddIUs() throws Exception {
IUBundleContainer c1 = createContainer(new String[]{"feature.a.feature.group"});
ITargetDefinition target = getTargetService().newTarget();
@@ -413,6 +432,7 @@
*
* @throws Exception
*/
+ @Test
public void testRemoveIUs() throws Exception {
IUBundleContainer c1 = createContainer(new String[]{"feature.b.feature.group"});
ITargetDefinition target = getTargetService().newTarget();
@@ -447,6 +467,7 @@
*
* @throws Exception
*/
+ @Test
public void testOverlappingIUContainers() throws Exception {
IUBundleContainer c1 = createContainer(new String[]{"feature.a.feature.group"});
IUBundleContainer c2 = createContainer(new String[]{"feature.b.feature.group"});
@@ -477,6 +498,7 @@
assertEquals(1, profiles.size());
}
+ @Test
public void testSerialization1() throws Exception {
URI uri = getURI("/tests/sites/site.a.b");
String[] unitIds = new String[]{"feature.a.feature.group"};
@@ -489,7 +511,7 @@
deserializationTest(location);
}
-
+ @Test
public void testSerialization2() throws Exception {
IUBundleContainer location = createContainer(new String[]{"bundle.a1", "bundle.a2"});
String xml = location.serialize();
@@ -499,6 +521,7 @@
deserializationTest(location);
}
+ @Test
public void testSerialization3() throws Exception {
URI uri = getURI("/tests/sites/site.a.b");
String[] unitIds = new String[]{"feature.b.feature.group"};
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/LocalTargetDefinitionTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/LocalTargetDefinitionTests.java
index 21a9020..d9be574 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/LocalTargetDefinitionTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/LocalTargetDefinitionTests.java
@@ -13,6 +13,12 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.target;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.*;
import java.net.*;
import java.util.*;
@@ -25,18 +31,23 @@
import org.eclipse.pde.internal.core.target.TargetDefinitionPersistenceHelper;
import org.eclipse.pde.internal.launching.launcher.LaunchArgumentsHelper;
import org.eclipse.pde.ui.tests.PDETestsPlugin;
+import org.junit.Test;
import org.osgi.framework.ServiceReference;
/**
- * Tests for target definitions. The tested targets will be created in the metadata.
+ * Tests for target definitions. The tested targets will be created in the
+ * metadata.
+ *
* @see WorkspaceTargetDefinitionTests
*
* @since 3.5
*/
public class LocalTargetDefinitionTests extends AbstractTargetTest {
- public static final NameVersionDescriptor MULTI_VERSION_LOW_DESCRIPTION = new NameVersionDescriptor("a.typical.bundle", "1.0.0.200907071058");
- public static final NameVersionDescriptor MULTI_VERSION_HIGH_DESCRIPTION = new NameVersionDescriptor("a.typical.bundle", "1.1.0.200907071100");
+ public static final NameVersionDescriptor MULTI_VERSION_LOW_DESCRIPTION = new NameVersionDescriptor(
+ "a.typical.bundle", "1.0.0.200907071058");
+ public static final NameVersionDescriptor MULTI_VERSION_HIGH_DESCRIPTION = new NameVersionDescriptor(
+ "a.typical.bundle", "1.1.0.200907071100");
/**
* Returns the target platform service or <code>null</code> if none
@@ -48,8 +59,6 @@
ServiceReference<ITargetPlatformService> reference = PDETestsPlugin.getBundleContext()
.getServiceReference(ITargetPlatformService.class);
assertNotNull("Missing target platform service", reference);
- if (reference == null)
- return null;
return PDETestsPlugin.getBundleContext().getService(reference);
}
@@ -57,7 +66,8 @@
* Retrieves all bundles (source and code) in the given target definition
* returning them as a set of URIs.
*
- * @param target target definition
+ * @param target
+ * target definition
* @return all bundle URIs
*/
protected Set<URI> getAllBundleURIs(ITargetDefinition target) throws Exception {
@@ -73,11 +83,12 @@
}
/**
- * Tests that resetting the target platform should work OK (i.e. is equivalent to the
- * models in the default target platform).
+ * Tests that resetting the target platform should work OK (i.e. is
+ * equivalent to the models in the default target platform).
*
* @throws CoreException
*/
+ @Test
public void testResetTargetPlatform() throws Exception {
ITargetDefinition definition = getDefaultTargetPlatorm();
Set<URI> uris = getAllBundleURIs(definition);
@@ -112,18 +123,20 @@
*
* @throws Exception
*/
+ @Test
public void testDefaultTargetPlatform() throws Exception {
// the new way
ITargetDefinition definition = getNewTarget();
ITargetLocation container = getTargetService().newProfileLocation(TargetPlatform.getDefaultLocation(), null);
- definition.setTargetLocations(new ITargetLocation[]{container});
+ definition.setTargetLocations(new ITargetLocation[] { container });
Set<URI> uris = getAllBundleURIs(definition);
// the old way
IPath location = new Path(TargetPlatform.getDefaultLocation());
URL[] pluginPaths = P2Utils.readBundlesTxt(location.toOSString(),
location.append("configuration").toFile().toURI().toURL());
- // pluginPaths will be null (and NPE) when self-hosting and the target platform is not a real installation
+ // pluginPaths will be null (and NPE) when self-hosting and the target
+ // platform is not a real installation
assertBundlePathsEqual(pluginPaths, uris);
}
@@ -133,14 +146,14 @@
*
* @throws Exception
*/
+ @Test
public void testRestrictedDefaultTargetPlatform() throws Exception {
ITargetDefinition definition = getNewTarget();
ITargetLocation container = getTargetService().newProfileLocation(TargetPlatform.getDefaultLocation(), null);
- NameVersionDescriptor[] restrictions = new NameVersionDescriptor[]{
+ NameVersionDescriptor[] restrictions = new NameVersionDescriptor[] {
new NameVersionDescriptor("org.eclipse.jdt.launching", null),
- new NameVersionDescriptor("org.eclipse.jdt.debug", null)
- };
- definition.setTargetLocations(new ITargetLocation[]{container});
+ new NameVersionDescriptor("org.eclipse.jdt.debug", null) };
+ definition.setTargetLocations(new ITargetLocation[] { container });
definition.setIncluded(restrictions);
List<BundleInfo> infos = getAllBundleInfos(definition);
@@ -159,10 +172,11 @@
*
* @throws Exception
*/
+ @Test
public void testVersionRestrictedDefaultTargetPlatform() throws Exception {
ITargetDefinition definition = getNewTarget();
ITargetLocation container = getTargetService().newProfileLocation(TargetPlatform.getDefaultLocation(), null);
- definition.setTargetLocations(new ITargetLocation[]{container});
+ definition.setTargetLocations(new ITargetLocation[] { container });
List<BundleInfo> infos = getAllBundleInfos(definition);
// find right versions
String v1 = null;
@@ -181,10 +195,9 @@
assertNotNull(v2);
assertFalse(v2.equals(BundleInfo.EMPTY_VERSION));
- NameVersionDescriptor[] restrictions = new NameVersionDescriptor[]{
+ NameVersionDescriptor[] restrictions = new NameVersionDescriptor[] {
new NameVersionDescriptor("org.eclipse.jdt.launching", v1),
- new NameVersionDescriptor("org.eclipse.jdt.debug", v2)
- };
+ new NameVersionDescriptor("org.eclipse.jdt.debug", v2) };
definition.setIncluded(restrictions);
infos = getAllBundleInfos(definition);
@@ -207,21 +220,22 @@
*
* @throws Exception
*/
+ @Test
public void testMissingVersionRestrictedDefaultTargetPlatform() throws Exception {
ITargetDefinition definition = getNewTarget();
ITargetLocation container = getTargetService().newProfileLocation(TargetPlatform.getDefaultLocation(), null);
- NameVersionDescriptor[] restrictions = new NameVersionDescriptor[]{
+ NameVersionDescriptor[] restrictions = new NameVersionDescriptor[] {
new NameVersionDescriptor("org.eclipse.jdt.launching", "xyz"),
- new NameVersionDescriptor("org.eclipse.jdt.debug", "abc")
- };
- definition.setTargetLocations(new ITargetLocation[]{container});
+ new NameVersionDescriptor("org.eclipse.jdt.debug", "abc") };
+ definition.setTargetLocations(new ITargetLocation[] { container });
definition.setIncluded(restrictions);
definition.resolve(null);
TargetBundle[] bundles = definition.getBundles();
assertEquals("Wrong number of bundles", 2, bundles.length);
for (TargetBundle rb : bundles) {
- assertEquals("Should be a missing bundle version", TargetBundle.STATUS_VERSION_DOES_NOT_EXIST, rb.getStatus().getCode());
+ assertEquals("Should be a missing bundle version", TargetBundle.STATUS_VERSION_DOES_NOT_EXIST,
+ rb.getStatus().getCode());
assertEquals("Should be an error", IStatus.ERROR, rb.getStatus().getSeverity());
}
}
@@ -234,18 +248,20 @@
*
* @throws Exception
*/
+ @Test
public void testEclipseHomeTargetPlatform() throws Exception {
// the new way
ITargetDefinition definition = getNewTarget();
ITargetLocation container = getTargetService().newProfileLocation("${eclipse_home}", null);
- definition.setTargetLocations(new ITargetLocation[]{container});
+ definition.setTargetLocations(new ITargetLocation[] { container });
Set<URI> uris = getAllBundleURIs(definition);
// the old way
IPath location = new Path(TargetPlatform.getDefaultLocation());
URL[] pluginPaths = P2Utils.readBundlesTxt(location.toOSString(),
location.append("configuration").toFile().toURI().toURL());
- // pluginPaths will be null (and NPE) when self-hosting and the target platform is not a real installation
+ // pluginPaths will be null (and NPE) when self-hosting and the target
+ // platform is not a real installation
assertBundlePathsEqual(pluginPaths, uris);
}
@@ -257,36 +273,40 @@
*
* @throws Exception
*/
+ @Test
public void testEclipseHomeTargetPlatformAndConfigurationArea() throws Exception {
// the new way
ITargetDefinition definition = getNewTarget();
- ITargetLocation container = getTargetService().newProfileLocation("${eclipse_home}", "${eclipse_home}/configuration");
- definition.setTargetLocations(new ITargetLocation[]{container});
+ ITargetLocation container = getTargetService().newProfileLocation("${eclipse_home}",
+ "${eclipse_home}/configuration");
+ definition.setTargetLocations(new ITargetLocation[] { container });
Set<URI> uris = getAllBundleURIs(definition);
// the old way
IPath location = new Path(TargetPlatform.getDefaultLocation());
URL[] pluginPaths = P2Utils.readBundlesTxt(location.toOSString(),
location.append("configuration").toFile().toURI().toURL());
- // pluginPaths will be null (and NPE) when self-hosting and the target platform is not a real installation
+ // pluginPaths will be null (and NPE) when self-hosting and the target
+ // platform is not a real installation
assertBundlePathsEqual(pluginPaths, uris);
}
/**
* Tests that a target definition equivalent to the default target platform
* contains the same bundles as the default target platform using the
- * platform's configuration location (which will do target weaving). This
- * is really only tested when run as a JUnit plug-in test suite from
- * within Eclipse.
+ * platform's configuration location (which will do target weaving). This is
+ * really only tested when run as a JUnit plug-in test suite from within
+ * Eclipse.
*
* @throws Exception
*/
+ @Test
public void testWovenTargetPlatform() throws Exception {
// the new way
ITargetDefinition definition = getNewTarget();
ITargetLocation container = getTargetService().newProfileLocation(TargetPlatform.getDefaultLocation(),
new File(Platform.getConfigurationLocation().getURL().getFile()).getAbsolutePath());
- definition.setTargetLocations(new ITargetLocation[]{container});
+ definition.setTargetLocations(new ITargetLocation[] { container });
Set<URI> uris = getAllBundleURIs(definition);
// the old way
@@ -295,15 +315,18 @@
}
/**
- * Tests that a bundle directory container is equivalent to scanning locations.
+ * Tests that a bundle directory container is equivalent to scanning
+ * locations.
*
* @throws Exception
*/
+ @Test
public void testDirectoryBundleContainer() throws Exception {
// the new way
ITargetDefinition definition = getNewTarget();
- ITargetLocation container = getTargetService().newDirectoryLocation(TargetPlatform.getDefaultLocation() + "/plugins");
- definition.setTargetLocations(new ITargetLocation[]{container});
+ ITargetLocation container = getTargetService()
+ .newDirectoryLocation(TargetPlatform.getDefaultLocation() + "/plugins");
+ definition.setTargetLocations(new ITargetLocation[] { container });
Set<URI> uris = getAllBundleURIs(definition);
// the old way
@@ -312,16 +335,17 @@
}
/**
- * Tests that a bundle directory container is equivalent to scanning locations
- * when it uses a variable to specify its location.
+ * Tests that a bundle directory container is equivalent to scanning
+ * locations when it uses a variable to specify its location.
*
* @throws Exception
*/
+ @Test
public void testVariableDirectoryBundleContainer() throws Exception {
// the new way
ITargetDefinition definition = getNewTarget();
ITargetLocation container = getTargetService().newDirectoryLocation("${eclipse_home}/plugins");
- definition.setTargetLocations(new ITargetLocation[]{container});
+ definition.setTargetLocations(new ITargetLocation[] { container });
Set<URI> uris = getAllBundleURIs(definition);
// the old way
@@ -331,8 +355,11 @@
/**
* Returns the given input stream as a byte array
- * @param stream the stream to get as a byte array
- * @param length the length to read from the stream or -1 for unknown
+ *
+ * @param stream
+ * the stream to get as a byte array
+ * @param length
+ * the length to read from the stream or -1 for unknown
* @return the given input stream as a byte array
* @throws IOException
*/
@@ -347,9 +374,7 @@
int amountRequested = Math.max(stream.available(), 8192);
// resize contents if needed
if (contentsLength + amountRequested > contents.length) {
- System.arraycopy(contents,
- 0,
- contents = new byte[contentsLength + amountRequested],
+ System.arraycopy(contents, 0, contents = new byte[contentsLength + amountRequested],
0,
contentsLength);
}
@@ -370,7 +395,8 @@
int readSize = 0;
while ((readSize != -1) && (len != length)) {
// See PR 1FMS89U
- // We record first the read size. In this case length is the actual
+ // We record first the read size. In this case length is the
+ // actual
// read size.
len += readSize;
readSize = stream.read(contents, len, length - len);
@@ -380,8 +406,8 @@
}
/**
- * Returns the location of the JDT feature in the running host as
- * a path in the local file system.
+ * Returns the location of the JDT feature in the running host as a path in
+ * the local file system.
*
* @return path to JDT feature
*/
@@ -404,15 +430,18 @@
/**
* Tests a JDT feature bundle container contains the appropriate bundles
+ *
* @throws Exception
*/
+ @Test
public void testFeatureBundleContainer() throws Exception {
// extract the feature
IPath location = extractModifiedFeatures();
// the new way
ITargetDefinition definition = getNewTarget();
- ITargetLocation container = getTargetService().newFeatureLocation(location.toOSString(), "org.eclipse.jdt", null);
+ ITargetLocation container = getTargetService().newFeatureLocation(location.toOSString(), "org.eclipse.jdt",
+ null);
container.resolve(definition, null);
TargetBundle[] bundles = container.getBundles();
@@ -445,17 +474,20 @@
}
/**
- * Tests a JDT feature bundle container contains the appropriate bundles for a specific OS.
+ * Tests a JDT feature bundle container contains the appropriate bundles for
+ * a specific OS.
*
* @throws Exception
*/
+ @Test
public void testMacOSFeatureBundleContainer() throws Exception {
// extract the feature
IPath location = extractModifiedFeatures();
ITargetDefinition definition = getNewTarget();
definition.setOS(Platform.OS_MACOSX);
- ITargetLocation container = getTargetService().newFeatureLocation(location.toOSString(), "org.eclipse.jdt", null);
+ ITargetLocation container = getTargetService().newFeatureLocation(location.toOSString(), "org.eclipse.jdt",
+ null);
container.resolve(definition, null);
TargetBundle[] bundles = container.getBundles();
@@ -479,7 +511,8 @@
assertTrue("Mac bundle should be present", status.isOK());
} else {
assertFalse("Mac bundle should be missing", status.isOK());
- assertEquals("Mac bundle should be mssing", TargetBundle.STATUS_PLUGIN_DOES_NOT_EXIST, status.getCode());
+ assertEquals("Mac bundle should be mssing", TargetBundle.STATUS_PLUGIN_DOES_NOT_EXIST,
+ status.getCode());
}
}
}
@@ -490,29 +523,30 @@
}
assertTrue("Wrong bundles in JDT feature", expected.isEmpty());
-
// should be no source bundles
for (TargetBundle bundle : bundles) {
assertFalse("Should be no source bundles", bundle.isSourceBundle());
}
}
+
/**
- * Tests that a target definition based on the JDT feature
- * restricted to a subset of bundles contains the right set.
+ * Tests that a target definition based on the JDT feature restricted to a
+ * subset of bundles contains the right set.
*
* @throws Exception
*/
+ @Test
public void testRestrictedFeatureBundleContainer() throws Exception {
// extract the feature
IPath location = extractModifiedFeatures();
ITargetDefinition definition = getNewTarget();
- ITargetLocation container = getTargetService().newFeatureLocation(location.toOSString(), "org.eclipse.jdt", null);
- NameVersionDescriptor[] restrictions = new NameVersionDescriptor[]{
+ ITargetLocation container = getTargetService().newFeatureLocation(location.toOSString(), "org.eclipse.jdt",
+ null);
+ NameVersionDescriptor[] restrictions = new NameVersionDescriptor[] {
new NameVersionDescriptor("org.eclipse.jdt", null),
- new NameVersionDescriptor("org.junit", "3.8.2.v20090203-1005")
- };
- definition.setTargetLocations(new ITargetLocation[]{container});
+ new NameVersionDescriptor("org.junit", "3.8.2.v20090203-1005") };
+ definition.setTargetLocations(new ITargetLocation[] { container });
definition.setIncluded(restrictions);
List<BundleInfo> infos = getAllBundleInfos(definition);
@@ -526,15 +560,19 @@
}
/**
- * Tests a JDT source feature bundle container contains the appropriate bundles
+ * Tests a JDT source feature bundle container contains the appropriate
+ * bundles
+ *
* @throws Exception
*/
+ @Test
public void testSourceFeatureBundleContainer() throws Exception {
// extract the feature
IPath location = extractModifiedFeatures();
ITargetDefinition definition = getNewTarget();
- ITargetLocation container = getTargetService().newFeatureLocation(location.toOSString(), "org.eclipse.jdt.source", null);
+ ITargetLocation container = getTargetService().newFeatureLocation(location.toOSString(),
+ "org.eclipse.jdt.source", null);
container.resolve(definition, null);
TargetBundle[] bundles = container.getBundles();
@@ -560,22 +598,23 @@
assertTrue("Wrong bundles in JDT feature", expected.isEmpty());
}
-
/**
* Tests setting the target platform to the stored JDT feature test data
*
* @throws Exception
*/
+ @Test
public void testSetTargetPlatformToJdtFeature() throws Exception {
try {
// extract the feature
IPath location = extractModifiedFeatures();
- //org.eclipse.jdt_3.6.0.v20100105-0800-7z8VFR9FMTb52_pOyKHhoek1
+ // org.eclipse.jdt_3.6.0.v20100105-0800-7z8VFR9FMTb52_pOyKHhoek1
ITargetDefinition target = getNewTarget();
- ITargetLocation container = getTargetService().newFeatureLocation(location.toOSString(), "org.eclipse.jdt", "3.6.0.v20100105-0800-7z8VFR9FMTb52_pOyKHhoek1");
+ ITargetLocation container = getTargetService().newFeatureLocation(location.toOSString(), "org.eclipse.jdt",
+ "3.6.0.v20100105-0800-7z8VFR9FMTb52_pOyKHhoek1");
- target.setTargetLocations(new ITargetLocation[]{container});
+ target.setTargetLocations(new ITargetLocation[] { container });
setTargetPlatform(target);
@@ -611,8 +650,10 @@
/**
* Tests setting the target platform to empty.
+ *
* @throws CoreException
*/
+ @Test
public void testSetEmptyTargetPlatform() throws CoreException {
try {
setTargetPlatform(null);
@@ -628,7 +669,7 @@
}
protected void assertTargetDefinitionsEqual(ITargetDefinition targetA, ITargetDefinition targetB) {
- assertTrue("Target content not equal",((TargetDefinition)targetA).isContentEqual(targetB));
+ assertTrue("Target content not equal", ((TargetDefinition) targetA).isContentEqual(targetB));
}
protected void assertBundlePathsEqual(URL[] legacyPluginPaths, Set<URI> bundleUris) throws URISyntaxException {
@@ -639,15 +680,16 @@
}
/**
- * Reads a target definition file from the tests/targets/target-files location
- * with the given name. Note that ".target" will be appended.
+ * Reads a target definition file from the tests/targets/target-files
+ * location with the given name. Note that ".target" will be appended.
*
* @param name
* @return target definition
* @throws Exception
*/
protected ITargetDefinition readOldTarget(String name) throws Exception {
- URL url = PDETestsPlugin.getBundleContext().getBundle().getEntry("/tests/targets/target-files/" + name + ".target");
+ URL url = PDETestsPlugin.getBundleContext().getBundle()
+ .getEntry("/tests/targets/target-files/" + name + ".target");
File file = new File(FileLocator.toFileURL(url).getFile());
ITargetDefinition target = getNewTarget();
try (FileInputStream stream = new FileInputStream(file)) {
@@ -661,9 +703,11 @@
*
* @throws Exception
*/
+ @Test
public void testArgumentsPluginsDirectory() throws Exception {
// test bundle containers for known arguments
- ITargetLocation directoryContainer = getTargetService().newDirectoryLocation(TargetPlatform.getDefaultLocation() + "/plugins");
+ ITargetLocation directoryContainer = getTargetService()
+ .newDirectoryLocation(TargetPlatform.getDefaultLocation() + "/plugins");
assertNull("Plugins directory containers should not have arguments", directoryContainer.getVMArguments());
}
@@ -672,6 +716,7 @@
*
* @throws Exception
*/
+ @Test
public void testArgumentsInstallDirectory() throws Exception {
ITargetLocation installDirectory = getTargetService().newDirectoryLocation(TargetPlatform.getDefaultLocation());
String[] installArgs = installDirectory.getVMArguments();
@@ -684,8 +729,10 @@
*
* @throws Exception
*/
+ @Test
public void testArgumentsFeatureContainer() throws Exception {
- ITargetLocation featureContainer = getTargetService().newFeatureLocation(TargetPlatform.getDefaultLocation(), "DOES NOT EXIST", "DOES NOT EXIST");
+ ITargetLocation featureContainer = getTargetService().newFeatureLocation(TargetPlatform.getDefaultLocation(),
+ "DOES NOT EXIST", "DOES NOT EXIST");
assertNull("Feature containers should not have arguments", featureContainer.getVMArguments());
}
@@ -694,18 +741,22 @@
*
* @throws Exception
*/
+ @Test
public void testArgumentsProfileContainer() throws Exception {
- ITargetLocation profileContainer = getTargetService().newProfileLocation(TargetPlatform.getDefaultLocation(), null);
+ ITargetLocation profileContainer = getTargetService().newProfileLocation(TargetPlatform.getDefaultLocation(),
+ null);
String[] arguments = profileContainer.getVMArguments();
assertNotNull("Profile containers should have arguments", arguments);
assertTrue("Profile containers should have arguments", arguments.length > 0);
}
/**
- * Tests the ability to add arguments to a target platform and have them show up on new configs
+ * Tests the ability to add arguments to a target platform and have them
+ * show up on new configs
*
* @throws Exception
*/
+ @Test
public void testArguments() throws Exception {
ITargetDefinition definition = getNewTarget();
@@ -725,7 +776,8 @@
// Check that new launch configs will be prepopulated from target
assertEquals(vmArgs, LaunchArgumentsHelper.getInitialVMArguments());
- assertEquals("-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog ".concat(programArgs), LaunchArgumentsHelper.getInitialProgramArguments());
+ assertEquals("-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog "
+ .concat(programArgs), LaunchArgumentsHelper.getInitialProgramArguments());
} finally {
getTargetService().deleteTarget(definition.getHandle());
@@ -735,21 +787,25 @@
}
/**
- * Tests that a single (lower) version of a bundle can be included in the target platform.
+ * Tests that a single (lower) version of a bundle can be included in the
+ * target platform.
*
* @throws Exception
*/
+ @Test
public void testLowerVersionOfBundle() throws Exception {
- doIncludeVersions(new NameVersionDescriptor[]{MULTI_VERSION_LOW_DESCRIPTION});
+ doIncludeVersions(new NameVersionDescriptor[] { MULTI_VERSION_LOW_DESCRIPTION });
}
/**
- * Tests that a single (higher) version of a bundle can be included in the target platform.
+ * Tests that a single (higher) version of a bundle can be included in the
+ * target platform.
*
* @throws Exception
*/
+ @Test
public void testHigherVersionOfBundle() throws Exception {
- doIncludeVersions(new NameVersionDescriptor[]{MULTI_VERSION_HIGH_DESCRIPTION});
+ doIncludeVersions(new NameVersionDescriptor[] { MULTI_VERSION_HIGH_DESCRIPTION });
}
/**
@@ -757,6 +813,7 @@
*
* @throws Exception
*/
+ @Test
public void testNoVersionsOfBundle() throws Exception {
doIncludeVersions(new NameVersionDescriptor[0]);
}
@@ -766,6 +823,7 @@
*
* @throws Exception
*/
+ @Test
public void testAllVersionsOfBundle() throws Exception {
doIncludeVersions(null);
}
@@ -775,8 +833,10 @@
*
* @throws Exception
*/
+ @Test
public void testAllVersionsOfBundleExplicit() throws Exception {
- doIncludeVersions(new NameVersionDescriptor[]{MULTI_VERSION_LOW_DESCRIPTION, MULTI_VERSION_HIGH_DESCRIPTION});
+ doIncludeVersions(
+ new NameVersionDescriptor[] { MULTI_VERSION_LOW_DESCRIPTION, MULTI_VERSION_HIGH_DESCRIPTION });
}
protected void doIncludeVersions(NameVersionDescriptor[] descriptions) throws Exception {
@@ -785,7 +845,7 @@
IPath extras = extractMultiVersionPlugins();
ITargetDefinition target = getNewTarget();
ITargetLocation container = getTargetService().newDirectoryLocation(extras.toOSString());
- target.setTargetLocations(new ITargetLocation[]{container});
+ target.setTargetLocations(new ITargetLocation[] { container });
target.setIncluded(descriptions);
try {
getTargetService().saveTargetDefinition(target);
@@ -794,7 +854,8 @@
Set<NameVersionDescriptor> enabled = new HashSet<>();
for (IPluginModelBase pm : models) {
if (pm.getBundleDescription().getSymbolicName().equals(bsn)) {
- NameVersionDescriptor desc = new NameVersionDescriptor(pm.getPluginBase().getId(), pm.getPluginBase().getVersion());
+ NameVersionDescriptor desc = new NameVersionDescriptor(pm.getPluginBase().getId(),
+ pm.getPluginBase().getVersion());
if (pm.isEnabled()) {
enabled.add(desc);
}
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/MinimalTargetDefinitionFeatureResolutionTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/MinimalTargetDefinitionFeatureResolutionTests.java
index 65743a1..a338f5d 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/MinimalTargetDefinitionFeatureResolutionTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/MinimalTargetDefinitionFeatureResolutionTests.java
@@ -13,12 +13,19 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.target;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.pde.core.plugin.TargetPlatform;
import org.eclipse.pde.core.target.*;
import org.eclipse.pde.internal.core.PDECore;
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
+import org.junit.Test;
/**
* Tests whether targets and bundle containers manage features correctly. Runs
@@ -31,6 +38,7 @@
* Tests that a directory bundle container provides the correct features to
* a target
*/
+ @Test
public void testDirectoryBundleContainer() throws Exception {
ITargetDefinition definition = getNewTarget();
ITargetLocation directoryContainer = getTargetService()
@@ -62,6 +70,7 @@
* Tests that a profile (installation) bundle container provides the correct
* features to a target
*/
+ @Test
public void testProfileBundleContainer() throws Exception {
ITargetDefinition definition = getNewTarget();
ITargetLocation profileContainer = getTargetService().newProfileLocation(TargetPlatform.getDefaultLocation(),
@@ -89,6 +98,7 @@
expectedIDs.isEmpty());
}
+ @Test
public void testExplicitIncludes() throws Exception {
// Use the modified JDT features as we know their versions
ITargetDefinition definition = getNewTarget();
@@ -143,6 +153,7 @@
}
+ @Test
public void testSingleInclude() throws Exception {
// Use the modified JDT features as we know their versions
ITargetDefinition definition = getNewTarget();
@@ -189,6 +200,7 @@
assertTrue("Wrong bundles in JDT feature", expected.isEmpty());
}
+ @Test
public void testMixedIncludes() throws Exception {
// Use the modified JDT features as we know their versions
ITargetDefinition definition = getNewTarget();
@@ -236,6 +248,7 @@
assertTrue("Wrong bundles in JDT feature", expected.isEmpty());
}
+ @Test
public void testMissingFeatures() throws Exception {
// Use the modified JDT features as we know their versions
ITargetDefinition definition = getNewTarget();
@@ -269,6 +282,7 @@
assertTrue(definition.getBundles().length > 4);
}
+ @Test
public void testMissingFeatureVersion() throws Exception {
// Use the modified JDT features as we know their versions
ITargetDefinition definition = getNewTarget();
@@ -315,6 +329,7 @@
assertTrue("Wrong bundles in JDT feature", expected.isEmpty());
}
+ @Test
public void testMissingMixed() throws Exception {
// Use the modified JDT features as we know their versions
ITargetDefinition definition = getNewTarget();
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/MinimalTargetDefinitionPersistenceTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/MinimalTargetDefinitionPersistenceTests.java
index 66d6294..24a7801 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/MinimalTargetDefinitionPersistenceTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/MinimalTargetDefinitionPersistenceTests.java
@@ -13,11 +13,16 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.target;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.*;
import java.net.*;
import java.util.HashSet;
import java.util.Set;
-import junit.framework.TestCase;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.*;
@@ -27,6 +32,7 @@
import org.eclipse.pde.core.target.*;
import org.eclipse.pde.internal.core.target.*;
import org.eclipse.pde.ui.tests.PDETestsPlugin;
+import org.junit.Test;
import org.osgi.framework.ServiceReference;
/**
@@ -36,7 +42,7 @@
* TargetDefinitionPersistenceTests
*
*/
-public class MinimalTargetDefinitionPersistenceTests extends TestCase {
+public class MinimalTargetDefinitionPersistenceTests {
protected void assertTargetDefinitionsEqual(ITargetDefinition targetA, ITargetDefinition targetB) {
assertTrue("Target content not equal", ((TargetDefinition) targetA).isContentEqual(targetB));
@@ -51,8 +57,6 @@
ServiceReference<ITargetPlatformService> reference = PDETestsPlugin.getBundleContext()
.getServiceReference(ITargetPlatformService.class);
assertNotNull("Missing target platform service", reference);
- if (reference == null)
- return null;
return PDETestsPlugin.getBundleContext().getService(reference);
}
@@ -96,6 +100,7 @@
*
* @throws CoreException
*/
+ @Test
public void testWorkspaceTargetHandleMemento() throws CoreException {
ITargetPlatformService service = getTargetService();
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("does/not/exist"));
@@ -116,6 +121,7 @@
* @throws CoreException
* @throws InterruptedException
*/
+ @Test
public void testLocalTargetHandleMemento() throws CoreException, InterruptedException {
ITargetPlatformService service = getTargetService();
ITargetHandle handle = service.newTarget().getHandle();
@@ -134,6 +140,7 @@
* @throws CoreException
* @throws InterruptedException
*/
+ @Test
public void testExternalFileTargetHandleMemento() throws CoreException, InterruptedException {
ITargetPlatformService service = getTargetService();
URI uri = null;
@@ -173,6 +180,7 @@
*
* @throws Exception
*/
+ @Test
public void testPersistEmptyDefinition() throws Exception {
ITargetDefinition definitionA = getTargetService().newTarget();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@@ -208,6 +216,7 @@
*
* @throws Exception
*/
+ @Test
public void testReadOldBasicTargetFile() throws Exception {
ITargetDefinition target = readOldTarget("basic");
@@ -234,6 +243,7 @@
*
* @throws Exception
*/
+ @Test
public void testReadOldBasicDirectoryTargetFile() throws Exception {
ITargetDefinition target = readOldTarget("directory");
@@ -260,6 +270,7 @@
*
* @throws Exception
*/
+ @Test
public void testReadOldSpecificTargetFile() throws Exception {
ITargetDefinition target = readOldTarget("specific");
@@ -272,7 +283,8 @@
assertEquals("-Dfoo=\"bar\"", target.getVMArguments());
assertEquals(
JavaRuntime
- .newJREContainerPath(JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("J2SE-1.4")),
+ .newJREContainerPath(JavaRuntime.getExecutionEnvironmentsManager().getEnvironment(
+ "J2SE-1.4")),
target.getJREContainer());
NameVersionDescriptor[] infos = target.getImplicitDependencies();
@@ -298,6 +310,7 @@
*
* @throws Exception
*/
+ @Test
public void testReadOldAdditionLocationsTargetFile() throws Exception {
ITargetDefinition target = readOldTarget("additionalLocations");
@@ -335,6 +348,7 @@
*
* @throws Exception
*/
+ @Test
public void testReadOldFeaturesTargetFile() throws Exception {
ITargetDefinition target = readOldTarget("featureLocations");
@@ -365,6 +379,7 @@
*
* @throws Exception
*/
+ @Test
public void testReadOldRestrictionsTargetFile() throws Exception {
ITargetDefinition target = readOldTarget("restrictions");
@@ -413,6 +428,7 @@
*
* @throws Exception
*/
+ @Test
public void testReadOldTargetFileWithUnknownTags() throws Exception {
ITargetDefinition target = readOldTarget("extratags");
@@ -460,6 +476,7 @@
*
* @throws Exception
*/
+ @Test
public void testReadOldOptionalTargetFile() throws Exception {
ITargetDefinition target = readOldTarget("optional");
@@ -506,6 +523,7 @@
* useAllPlugins=true setting, treat the file as though it did include all
* plug-ins from the directory.
*/
+ @Test
public void testEmptyContentSection() throws Exception {
ITargetDefinition target = readOldTarget("emptycontent");
@@ -528,6 +546,7 @@
*
* @throws Exception
*/
+ @Test
public void testMigrationOfUseAllWithRestrictions() throws Exception {
ITargetDefinition target = readOldTarget("eclipse-serverside");
ITargetLocation[] containers = target.getTargetLocations();
@@ -570,6 +589,7 @@
*
* @throws Exception
*/
+ @Test
public void testSequenceNumberChange() throws Exception {
ITargetDefinition target = readOldTarget("featureLocations");
@@ -603,6 +623,7 @@
targetDef.getSequenceNumber());
}
+ @Test
public void testIncludeSource() throws Exception {
ITargetDefinition target = readOldTarget("SoftwareSiteTarget");
ITargetLocation[] containers = target.getTargetLocations();
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/MinimalTargetDefinitionResolutionTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/MinimalTargetDefinitionResolutionTests.java
index 173f41a..ed5feed 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/MinimalTargetDefinitionResolutionTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/MinimalTargetDefinitionResolutionTests.java
@@ -13,6 +13,12 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.target;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -23,6 +29,7 @@
import org.eclipse.pde.internal.core.PDECore;
import org.eclipse.pde.internal.core.target.IUBundleContainer;
import org.eclipse.pde.internal.core.target.TargetPlatformService;
+import org.junit.Test;
/**
* Runs on minimal bundles and don't require full eclipse SDK.This class is
@@ -30,7 +37,7 @@
*
*/
public class MinimalTargetDefinitionResolutionTests extends AbstractTargetTest {
-
+ @Test
public void testInvalidBundleContainers() throws Exception {
ITargetDefinition definition = getNewTarget();
@@ -64,10 +71,12 @@
* @see TargetBundle.STATUS_INVALID_MANIFEST
* @throws Exception
*/
+ @Test
public void testInvalidManifest() throws Exception {
// TODO Should we have tests for this?
}
+ @Test
public void testResolutionCaching() throws Exception {
ITargetDefinition definition = getNewTarget();
assertTrue(definition.isResolved());
@@ -160,13 +169,13 @@
}
-
/**
* Tests that if users *don't* have the old preference to append .ini VM
* arguments, target definitions are migrated properly *without* the
* arguments appended.
*/
@SuppressWarnings("deprecation")
+ @Test
public void testVMArgumentsMigrationNoAppend() throws Exception {
Preferences store = PDECore.getDefault().getPluginPreferences();
boolean original = store.getBoolean(ICoreConstants.VM_LAUNCHER_INI);
@@ -189,6 +198,7 @@
*
* @throws Exception
*/
+ @Test
public void testTargetInSynch() throws Exception {
IPath location = extractAbcdePlugins();
IPath dirPath = location.append("plugins");
@@ -215,6 +225,7 @@
*
* @throws Exception
*/
+ @Test
public void testTargetInSynchWithDuplicates() throws Exception {
IPath location = extractAbcdePlugins();
IPath dirPath = location.append("plugins");
@@ -242,6 +253,7 @@
*
* @throws Exception
*/
+ @Test
public void testTargetMissingBundle() throws Exception {
IPath location = extractAbcdePlugins();
IPath dirPath = location.append("plugins");
@@ -277,6 +289,7 @@
*
* @throws Exception
*/
+ @Test
public void testTargetPlatformMissingBundle() throws Exception {
IPath location = extractAbcdePlugins();
IPath dirPath = location.append("plugins");
@@ -320,6 +333,7 @@
*
* @throws Exception
*/
+ @Test
public void testSiteContainerIncludeSettings() throws Exception {
ITargetDefinition target = getNewTarget();
IUBundleContainer containerA = (IUBundleContainer) getTargetService().newIULocation(new IInstallableUnit[0],
@@ -373,6 +387,7 @@
assertTrue(containerB.getIncludeSource());
}
+ @Test
public void testNameVersionDescriptor() {
NameVersionDescriptor d1 = new NameVersionDescriptor("a.b.c", "1.0.0");
NameVersionDescriptor d2 = new NameVersionDescriptor("a.b.c", "1.0.0");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/ProfileContainerTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/ProfileContainerTests.java
index d03e05e..fb1c79a 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/ProfileContainerTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/ProfileContainerTests.java
@@ -10,7 +10,11 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.target;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
+import java.util.*;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.simpleconfigurator.manipulator.SimpleConfiguratorManipulator;
import org.eclipse.pde.core.target.ITargetDefinition;
@@ -22,10 +26,61 @@
@Test
public void testBundleResolutionWithConfigIni() {
- File bundlesInfo = new File(new ProfileBundleContainer("${eclipse.home}", null).getConfigurationLocation(), SimpleConfiguratorManipulator.BUNDLES_INFO_PATH);
+ File bundlesInfo = new File(new ProfileBundleContainer("${eclipse.home}", null).getConfigurationLocation(),
+ SimpleConfiguratorManipulator.BUNDLES_INFO_PATH);
Assume.assumeFalse("Skip test when using regular p2 configurator", bundlesInfo.isFile());
ITargetDefinition defaultDefinition = getTargetService().newDefaultTarget();
defaultDefinition.resolve(new NullProgressMonitor());
assertTrue(defaultDefinition.getBundles().length > 10);
}
+
+ @Test
+ public void testParseBundleInfoFromConfigIni() {
+
+ Properties configIni = new Properties();
+ configIni.put("osgi.bundles", absoluteFile("plugins/some.bundle").toURI() + ","//
+ + "reference:" + absoluteFile("plugins/some.bundle_startlevel").toURI() + "@1:start");
+
+ Collection<File> parsedBundles = ProfileBundleContainer.parseBundlesFromConfigIni(configIni);
+ assertEquals(Arrays.asList( //
+ absoluteFile("plugins/some.bundle"), //
+ absoluteFile("plugins/some.bundle_startlevel")), //
+ parsedBundles);
+ }
+
+ @Test
+ public void testParseBundleInfoFromConfigIni_relative() {
+ Properties configIni = new Properties();
+ configIni.put("osgi.bundles", "reference:file:plugins/some.bundle," //
+ + "reference:file:plugins/some.bundle_startlevel@1:start," //
+ + "reference:" + absoluteFile("absolute.bundle").toURI());
+
+ Collection<File> parsedBundles = ProfileBundleContainer.parseBundlesFromConfigIni(configIni);
+ assertEquals(Arrays.asList( //
+ new File("plugins/some.bundle"), //
+ new File("plugins/some.bundle_startlevel"), //
+ absoluteFile("absolute.bundle")), //
+ parsedBundles);
+ }
+
+ @Test
+ public void testParseBundleInfoFromConfigIni_relativeToFramework() {
+ Properties configIni = new Properties();
+ configIni.put("osgi.bundles", "reference:file:some.bundle," //
+ + "reference:file:some.bundle_startlevel@1:start," //
+ + "reference:" + absoluteFile("absolute.bundle").toURI());
+ configIni.put("osgi.framework", "file:plugins/o.e.osgi.jar");
+
+ Collection<File> parsedBundles = ProfileBundleContainer.parseBundlesFromConfigIni(configIni);
+ assertEquals(Arrays.asList( //
+ new File("plugins/o.e.osgi.jar"), //
+ new File("plugins/some.bundle"), //
+ new File("plugins/some.bundle_startlevel"), //
+ absoluteFile("absolute.bundle")), //
+ parsedBundles);
+ }
+
+ private static File absoluteFile(String path) {
+ return new File(path).getAbsoluteFile();
+ }
}
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetDefinitionFeatureResolutionTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetDefinitionFeatureResolutionTests.java
index 48cb1c3..fcacd1d 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetDefinitionFeatureResolutionTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetDefinitionFeatureResolutionTests.java
@@ -13,10 +13,16 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.target;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.pde.core.plugin.TargetPlatform;
import org.eclipse.pde.core.target.*;
import org.eclipse.pde.internal.core.PDECore;
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
+import org.junit.Test;
/**
* Tests whether targets and bundle containers manage features correctly.
@@ -28,6 +34,7 @@
/**
* Tests that a feature bundle container provides the correct features to a target
*/
+ @Test
public void testFeatureBundleContainer() throws Exception{
ITargetDefinition definition = getNewTarget();
ITargetLocation featureContainer = getTargetService().newFeatureLocation(TargetPlatform.getDefaultLocation(), "org.eclipse.pde", null);
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetDefinitionPersistenceTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetDefinitionPersistenceTests.java
index 3074609..314516c 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetDefinitionPersistenceTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetDefinitionPersistenceTests.java
@@ -13,6 +13,9 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.target;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
@@ -25,6 +28,7 @@
import org.eclipse.pde.core.target.*;
import org.eclipse.pde.internal.core.target.IUBundleContainer;
import org.eclipse.pde.internal.core.target.TargetDefinitionPersistenceHelper;
+import org.junit.Test;
/**
* Tests the persistence of target definitions. Tests memento creation, reading of old target files, and writing of the model.
@@ -40,7 +44,7 @@
* @throws Exception
*/
- // @IgnoreWhen
+ @Test
public void testPersistComplexMetadataDefinition() throws Exception {
// org.junit.Assume.assumeTrue(false);
ITargetDefinition definitionA = getTargetService().newTarget();
@@ -61,6 +65,7 @@
*
* @throws Exception
*/
+ @Test
public void testPersistComplexWorkspaceDefinition() throws Exception {
// org.junit.Assume.assumeTrue(false);
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("TargetDefinitionPersistenceTests");
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetDefinitionResolutionTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetDefinitionResolutionTests.java
index fbec62b..e1e38db 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetDefinitionResolutionTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetDefinitionResolutionTests.java
@@ -13,6 +13,11 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.target;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -21,9 +26,10 @@
import org.eclipse.pde.core.target.*;
import org.eclipse.pde.internal.core.*;
import org.eclipse.pde.internal.core.target.TargetPlatformService;
+import org.junit.Test;
public class TargetDefinitionResolutionTests extends MinimalTargetDefinitionResolutionTests {
-
+ @Test
public void testMissingBundles() throws Exception {
ITargetDefinition definition = getNewTarget();
@@ -61,6 +67,7 @@
* are able to determine the bundle their source is for.
* @throws Exception
*/
+ @Test
public void testSourceBundleRecognition() throws Exception {
ITargetDefinition definition = getNewTarget();
@@ -107,6 +114,7 @@
* target definitions are migrated properly with the arguments appended.
*/
@SuppressWarnings("deprecation")
+ @Test
public void testVMArgumentsMigrationAppend() throws Exception {
IEclipsePreferences store = InstanceScope.INSTANCE.getNode(PDECore.PLUGIN_ID);
boolean original = store.getBoolean(ICoreConstants.VM_LAUNCHER_INI, false);
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetEnvironmentTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetEnvironmentTestCase.java
index 2ab3041..06a31b1 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetEnvironmentTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetEnvironmentTestCase.java
@@ -13,59 +13,72 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.target;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.util.Dictionary;
import java.util.Properties;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
import org.eclipse.pde.core.plugin.TargetPlatform;
import org.eclipse.pde.internal.core.TargetPlatformHelper;
+import org.junit.Test;
import org.osgi.framework.Constants;
-public class TargetEnvironmentTestCase extends TestCase {
-
+public class TargetEnvironmentTestCase {
+ @Test
public void testOS() {
assertEquals(Platform.getOS(), TargetPlatform.getOS());
}
+ @Test
public void testWS() {
assertEquals(Platform.getWS(), TargetPlatform.getWS());
}
+ @Test
public void testArch() {
assertEquals(Platform.getOSArch(), TargetPlatform.getOSArch());
}
+ @Test
public void testNL() {
assertEquals(Platform.getNL(), TargetPlatform.getNL());
}
+ @Test
public void testEnvironmentDictionarySize() {
Dictionary<String, String> dictionary = TargetPlatformHelper.getTargetEnvironment();
assertEquals(6, dictionary.size());
}
+ @Test
public void testDictionaryOS() {
Dictionary<String, String> dictionary = TargetPlatformHelper.getTargetEnvironment();
assertEquals(Platform.getOS(), dictionary.get("osgi.os"));
}
+ @Test
public void testDictionaryWS() {
Dictionary<String, String> dictionary = TargetPlatformHelper.getTargetEnvironment();
assertEquals(Platform.getWS(), dictionary.get("osgi.ws"));
}
+ @Test
public void testDictionaryArch() {
Dictionary<String, String> dictionary = TargetPlatformHelper.getTargetEnvironment();
assertEquals(Platform.getOSArch(), dictionary.get("osgi.arch"));
}
+ @Test
public void testDictionaryNL() {
Dictionary<String, String> dictionary = TargetPlatformHelper.getTargetEnvironment();
assertEquals(Platform.getNL(), dictionary.get("osgi.nl"));
}
+ @Test
public void testResolveOptional() {
Dictionary<String, String> dictionary = TargetPlatformHelper.getTargetEnvironment();
assertTrue("true".equals(dictionary.get("osgi.resolveOptional")));
@@ -75,6 +88,7 @@
* Tests that the OSGi state for the PDE models has the correct properties set, based on known execution environments
*/
@SuppressWarnings("deprecation")
+ @Test
public void testStateEEProperties() {
Dictionary<?, ?>[] platformProps = TargetPlatformHelper.getState().getPlatformProperties();
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetPlatformHelperTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetPlatformHelperTests.java
index 3c72280..75b7b6f 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetPlatformHelperTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/TargetPlatformHelperTests.java
@@ -13,16 +13,18 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.target;
+import static org.junit.Assert.assertEquals;
+
import java.io.File;
-import junit.framework.TestCase;
import org.eclipse.pde.internal.core.TargetPlatformHelper;
+import org.junit.Test;
/**
* Tests TargetPlatformHelper.java convenience methods
* @since 3.4
*/
-public class TargetPlatformHelperTests extends TestCase {
-
+public class TargetPlatformHelperTests {
+ @Test
public void testStripPathInformation(){
String[] bundleStrings = new String[]{
"org.eclipse.osgi0",
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/WorkspaceTargetDefinitionTests.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/WorkspaceTargetDefinitionTests.java
index 393db09..81c82c8 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/WorkspaceTargetDefinitionTests.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/target/WorkspaceTargetDefinitionTests.java
@@ -13,9 +13,15 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.target;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.core.target.ITargetDefinition;
+import org.junit.After;
+import org.junit.Before;
/**
* Tests for target definitions. The tested targets will be backed by a workspace file.
@@ -27,8 +33,8 @@
private static final String PROJECT_NAME = "WorkspaceTargetDefinitionTests";
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
if (!project.exists()){
project.create(null);
@@ -38,8 +44,8 @@
assertTrue("Could not open test project", project.isOpen());
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
if (project.exists()){
project.delete(true, null);
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/util/TestBundleCreator.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/util/TestBundleCreator.java
index 544faef..f1bad86 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/util/TestBundleCreator.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/util/TestBundleCreator.java
@@ -13,10 +13,11 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.util;
+import static org.junit.Assert.assertFalse;
+
import java.io.File;
import java.util.ArrayList;
import java.util.List;
-import junit.framework.TestCase;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.core.plugin.IPluginModelBase;
@@ -27,7 +28,7 @@
import org.eclipse.pde.internal.core.exports.PluginExportOperation;
import org.osgi.framework.Version;
-public class TestBundleCreator extends TestCase {
+public class TestBundleCreator {
private static final String TEST_BUNDLE_NAME = "TestBundle_";
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/util/xml/ParserWrapperTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/util/xml/ParserWrapperTestCase.java
index e257682..ec98f6e 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/util/xml/ParserWrapperTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/util/xml/ParserWrapperTestCase.java
@@ -14,21 +14,24 @@
package org.eclipse.pde.ui.tests.util.xml;
+import static org.junit.Assert.assertFalse;
+
import java.io.File;
import java.io.IOException;
import java.net.URL;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.pde.internal.core.XMLDefaultHandler;
import org.eclipse.pde.internal.core.util.SAXParserWrapper;
import org.eclipse.pde.ui.tests.PDETestsPlugin;
import org.eclipse.pde.ui.tests.util.DOMParserWrapper;
+import org.junit.Before;
+import org.junit.Test;
import org.osgi.framework.Bundle;
import org.xml.sax.SAXException;
-public class ParserWrapperTestCase extends TestCase {
+public class ParserWrapperTestCase {
protected static final int FTHREADCOUNT = 5;
protected static final int FSAX = 0;
@@ -36,9 +39,8 @@
protected static File fXMLFile;
protected static final String FFILENAME = "/plugin.xml"; //$NON-NLS-1$
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
PDETestsPlugin plugin = PDETestsPlugin.getDefault();
if (plugin == null)
throw new Exception("ERROR: Macro plug-in uninitialized"); //$NON-NLS-1$
@@ -54,6 +56,7 @@
fXMLFile = new File(path);
}
+ @Test
public void testSAXParserWrapperConcurrency() throws Exception {
ParserThread[] threads = new ParserThread[FTHREADCOUNT];
@@ -70,6 +73,7 @@
}
+ @Test
public void testDOMParserWrapperConcurrency() throws Exception {
ParserThread[] threads = new ParserThread[FTHREADCOUNT];
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/views/log/LogEntryTest.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/views/log/LogEntryTest.java
index 9506026d..78fbad0 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/views/log/LogEntryTest.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/views/log/LogEntryTest.java
@@ -14,15 +14,17 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.views.log;
-import org.eclipse.ui.internal.views.log.LogEntry;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import java.text.ParseException;
import java.util.Calendar;
import java.util.GregorianCalendar;
-import junit.framework.TestCase;
+import org.eclipse.ui.internal.views.log.LogEntry;
+import org.junit.Test;
-public class LogEntryTest extends TestCase {
-
+public class LogEntryTest {
+ @Test
public void testProcessEntry() throws ParseException {
LogEntry entry = new LogEntry();
entry.processEntry("!ENTRY org.eclipse.pde.ui 1 100 2009-01-03 11:15:30.123");
@@ -36,6 +38,7 @@
assertEquals(expectedDate.getTime(), entry.getDate());
}
+ @Test
public void testProcessFrameworkEntry() throws ParseException {
LogEntry entry = new LogEntry();
entry.processEntry("!ENTRY org.eclipse.osgi 2009-01-07 11:15:30.123");
@@ -49,6 +52,7 @@
assertEquals(expectedDate.getTime(), entry.getDate());
}
+ @Test
public void testProcessSubEntry() throws ParseException {
LogEntry entry = new LogEntry();
int depth = entry.processSubEntry("!SUBENTRY 1 org.eclipse.osgi 1 101 2009-01-08 11:15:30.123");
@@ -64,6 +68,7 @@
assertEquals(1, depth);
}
+ @Test
public void testProcessFrameworkSubEntry() throws ParseException {
LogEntry entry = new LogEntry();
int depth = entry.processSubEntry("!SUBENTRY 1 org.eclipse.osgi 2009-01-01 11:15:30.123");
@@ -79,6 +84,7 @@
assertEquals(1, depth);
}
+ @Test
public void testInvalidEntry() {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=271733
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/ConvertProjectToPluginTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/ConvertProjectToPluginTestCase.java
index 4b892d1..abc4f6c 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/ConvertProjectToPluginTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/ConvertProjectToPluginTestCase.java
@@ -14,6 +14,11 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.wizards;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
@@ -25,6 +30,7 @@
import org.eclipse.pde.ui.tests.PDETestCase;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.IProgressService;
+import org.junit.Test;
/**
* Test case to test the conversion of projects to plug-in projects
@@ -42,6 +48,7 @@
* @throws Exception
* If there's a problem.
*/
+ @Test
public void testSingleProject() throws Exception {
IProject project = createProject(PROJECT_NAME_1);
@@ -65,6 +72,7 @@
* @throws Exception
* If there's a problem.
*/
+ @Test
public void testMultipleProjects() throws Exception {
IProject project1 = createProject(PROJECT_NAME_1);
@@ -95,6 +103,7 @@
* @throws Exception
* If there's a problem.
*/
+ @Test
public void testApiToolsSetup() throws Exception {
IProject project1 = createProject(PROJECT_NAME_1);
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/NewFeatureProjectTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/NewFeatureProjectTestCase.java
index 6d2010d..d8ae92e 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/NewFeatureProjectTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/NewFeatureProjectTestCase.java
@@ -13,6 +13,10 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.wizards;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
@@ -27,6 +31,7 @@
import org.eclipse.pde.internal.ui.wizards.feature.*;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.IProgressService;
+import org.junit.Test;
public class NewFeatureProjectTestCase extends NewProjectTestCase {
@@ -72,12 +77,14 @@
assertTrue("Verifying feature nature...", hasNature(PDE.FEATURE_NATURE));
}
+ @Test
public void testCreationFeatureProject() throws Exception {
createFeature(DEFAULT_FEATURE_DATA, false, null);
verifyProjectExistence();
verifyFeatureNature();
}
+ @Test
public void testCreationFeaturePatch() throws Exception {
IFeatureModel[] models = PDECore.getDefault().getFeatureModelManager().getModels();
if (models.length == 0)
@@ -103,13 +110,14 @@
assertTrue(feature.getProviderName().equals(provider));
assertTrue(feature.getInstallHandler().getLibrary().equals(library));
} */
-
+ @Test
public void testSimpleFeature() throws Exception {
createFeature(DEFAULT_FEATURE_DATA, false, null);
verifyProjectExistence();
assertFalse("Testing simple project for no java nature...", hasNature(JavaCore.NATURE_ID));
}
+ @Test
public void testJavaFeature() throws Exception {
FeatureData fd = createDefaultFeatureData();
String library = "testLibrary";
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/NewProjectTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/NewProjectTestCase.java
index fb72238..ae0b937 100755
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/NewProjectTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/NewProjectTestCase.java
@@ -13,12 +13,11 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.wizards;
-import org.eclipse.pde.ui.tests.PDETestCase;
+import static org.junit.Assert.assertTrue;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.pde.ui.tests.PDETestCase;
public abstract class NewProjectTestCase extends PDETestCase {
diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/NewSiteProjectTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/NewSiteProjectTestCase.java
index c81cf63..20032d5 100644
--- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/NewSiteProjectTestCase.java
+++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/wizards/NewSiteProjectTestCase.java
@@ -13,10 +13,13 @@
*******************************************************************************/
package org.eclipse.pde.ui.tests.wizards;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.ByteArrayInputStream;
import java.lang.reflect.InvocationTargetException;
import java.nio.charset.StandardCharsets;
-import junit.framework.TestCase;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.pde.internal.core.natures.PDE;
@@ -25,14 +28,16 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.IProgressService;
+import org.junit.*;
+import org.junit.rules.TestName;
-public class NewSiteProjectTestCase extends TestCase {
+public class NewSiteProjectTestCase {
private static final String EXISTING_PROJECT_NAME = "ExistingSiteProject"; //$NON-NLS-1$
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- if ("testExistingSiteProject".equalsIgnoreCase(getName())) { //$NON-NLS-1$
+ @Rule
+ public TestName name = new TestName();
+ @Before
+ public void setUp() throws Exception {
+ if ("testExistingSiteProject".equalsIgnoreCase(name.getMethodName())) { //$NON-NLS-1$
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(EXISTING_PROJECT_NAME);
project.create(new NullProgressMonitor());
project.open(new NullProgressMonitor());
@@ -50,8 +55,8 @@
}
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
IProject[] projects = workspaceRoot.getProjects();
try {
@@ -61,7 +66,6 @@
} catch (CoreException e) {
// do nothing if deletion fails. No need to fail the test.
}
- super.tearDown();
}
private void createSite(IProject project, IPath path, String webLocation) throws InvocationTargetException, InterruptedException {
@@ -91,6 +95,7 @@
model.dispose();
}
+ @Test
public void testExistingSiteProject() {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(EXISTING_PROJECT_NAME);
IPath path = Platform.getLocation();
@@ -109,6 +114,7 @@
}
+ @Test
public void testSiteProject() {
String projectName = "SiteProject"; //$NON-NLS-1$
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
@@ -124,6 +130,7 @@
.exists(new Path("index.html"))); //$NON-NLS-1$
}
+ @Test
public void testSiteProjectWithWeb() {
String projectName = "SiteProjectWithWeb"; //$NON-NLS-1$
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/commands/CommandList.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/commands/CommandList.java
index 981b84f..ae89a51 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/commands/CommandList.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/commands/CommandList.java
@@ -81,7 +81,7 @@
@Override
public void dispose() {
- fImgMap.values().forEach(obj -> obj.dispose());
+ fImgMap.values().forEach(org.eclipse.swt.graphics.Resource::dispose);
if (fDefaultImage != null)
fDefaultImage.dispose();
super.dispose();
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEFormEditor.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEFormEditor.java
index 3771872..6e52eca 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEFormEditor.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEFormEditor.java
@@ -231,7 +231,7 @@
protected void createPages() {
clipboard = new Clipboard(getContainer().getDisplay());
MenuManager manager = new MenuManager();
- IMenuListener listener = manager1 -> contextMenuAboutToShow(manager1);
+ IMenuListener listener = this::contextMenuAboutToShow;
manager.setRemoveAllWhenShown(true);
manager.addMenuListener(listener);
fContextMenu = manager.createContextMenu(getContainer());
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDESourcePage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDESourcePage.java
index af2fa1a..b645f53 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDESourcePage.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDESourcePage.java
@@ -186,7 +186,7 @@
protected ISortableContentOutlinePage createOutlinePage() {
SourceOutlinePage sourceOutlinePage = new SourceOutlinePage(fEditor, (IEditingModel) getInputContext().getModel(), createOutlineLabelProvider(), createOutlineContentProvider(), createDefaultOutlineComparator(), createOutlineComparator());
fOutlinePage = sourceOutlinePage;
- fOutlineSelectionChangedListener = event -> updateSelection(event);
+ fOutlineSelectionChangedListener = this::updateSelection;
fOutlinePage.addSelectionChangedListener(fOutlineSelectionChangedListener);
getSelectionProvider().addSelectionChangedListener(sourceOutlinePage);
fEditorSelectionChangedListener = new PDESourcePageChangedListener();
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/StructuredViewerSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/StructuredViewerSection.java
index 081ca2a..0fd997c 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/StructuredViewerSection.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/StructuredViewerSection.java
@@ -57,7 +57,7 @@
protected void createViewerPartControl(Composite parent, int style, int span, FormToolkit toolkit) {
fViewerPart.createControl(parent, style, span, toolkit);
MenuManager popupMenuManager = new MenuManager();
- IMenuListener listener = mng -> fillContextMenu(mng);
+ IMenuListener listener = this::fillContextMenu;
popupMenuManager.addMenuListener(listener);
popupMenuManager.setRemoveAllWhenShown(true);
Control control = fViewerPart.getControl();
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildContentsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildContentsSection.java
index 28ff209..02b4758 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildContentsSection.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildContentsSection.java
@@ -107,7 +107,7 @@
@Override
protected void createViewerPartControl(Composite parent, int style, int span, FormToolkit toolkit) {
MenuManager popupMenuManager = new MenuManager();
- IMenuListener listener = mng -> fillContextMenu(mng);
+ IMenuListener listener = this::fillContextMenu;
popupMenuManager.addMenuListener(listener);
popupMenuManager.setRemoveAllWhenShown(true);
Control control = fTreeViewer.getControl();
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildSourceViewerConfiguration.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildSourceViewerConfiguration.java
index a71ae41..fc2930f 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildSourceViewerConfiguration.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildSourceViewerConfiguration.java
@@ -159,7 +159,7 @@
fAssignmentToken = new Token(createTextAttribute(PreferenceConstants.PROPERTIES_FILE_COLORING_ASSIGNMENT));
rules[1] = new WordRule(new AssignmentDetector(), fAssignmentToken);
- rules[2] = new WhitespaceRule(c -> Character.isWhitespace(c));
+ rules[2] = new WhitespaceRule(Character::isWhitespace);
setRules(rules);
setDefaultReturnToken(new Token(createTextAttribute(PreferenceConstants.PROPERTIES_FILE_COLORING_VALUE)));
}
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/RuntimeInfoSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/RuntimeInfoSection.java
index 2dab984..c309a21 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/RuntimeInfoSection.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/RuntimeInfoSection.java
@@ -324,7 +324,7 @@
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(manager -> fillLibraryContextMenu(manager));
+ menuMgr.addMenuListener(this::fillLibraryContextMenu);
fLibraryViewer.getControl().setMenu(menuMgr.createContextMenu(fLibraryViewer.getControl()));
}
@@ -345,7 +345,7 @@
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(manager -> fillFolderViewerContextMenu(manager));
+ menuMgr.addMenuListener(this::fillFolderViewerContextMenu);
fFolderViewer.getControl().setMenu(menuMgr.createContextMenu(fFolderViewer.getControl()));
}
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/ManifestContentAssistProcessor.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/ManifestContentAssistProcessor.java
index fc47a46..6786702 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/ManifestContentAssistProcessor.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/ManifestContentAssistProcessor.java
@@ -73,7 +73,7 @@
fExecEnvs = new String[envs.length];
for (int i = 0; i < envs.length; i++)
fExecEnvs[i] = envs[i].getId();
- Arrays.sort(fExecEnvs, (o1, o2) -> o1.compareToIgnoreCase(o2));
+ Arrays.sort(fExecEnvs, String::compareToIgnoreCase);
}
/**
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/RequiresSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/RequiresSection.java
index 8d2d8f5..867fa66 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/RequiresSection.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/RequiresSection.java
@@ -346,7 +346,7 @@
@Override
public boolean doGlobalAction(String actionId) {
if (actionId.equals(ActionFactory.DELETE.getId())) {
- BusyIndicator.showWhile(fPluginViewer.getTable().getDisplay(), () -> handleDelete());
+ BusyIndicator.showWhile(fPluginViewer.getTable().getDisplay(), this::handleDelete);
return true;
}
if (actionId.equals(ActionFactory.CUT.getId())) {
@@ -360,7 +360,7 @@
return true;
}
if (actionId.equals(ActionFactory.SELECT_ALL.getId())) {
- BusyIndicator.showWhile(fPluginViewer.getTable().getDisplay(), () -> handleSelectAll());
+ BusyIndicator.showWhile(fPluginViewer.getTable().getDisplay(), this::handleSelectAll);
return true;
}
return false;
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/rows/ClassAttributeRow.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/rows/ClassAttributeRow.java
index 65d8511..f48cef6 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/rows/ClassAttributeRow.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/rows/ClassAttributeRow.java
@@ -63,7 +63,7 @@
@Override
protected void browse() {
- BusyIndicator.showWhile(text.getDisplay(), () -> doOpenSelectionDialog());
+ BusyIndicator.showWhile(text.getDisplay(), this::doOpenSelectionDialog);
}
private JavaAttributeValue createJavaAttributeValue(String name) {
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/ArchiveSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/ArchiveSection.java
index 8337537..a7d0604 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/ArchiveSection.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/ArchiveSection.java
@@ -217,7 +217,7 @@
@Override
public boolean doGlobalAction(String actionId) {
if (actionId.equals(ActionFactory.DELETE.getId())) {
- BusyIndicator.showWhile(fTable.getDisplay(), () -> handleDelete());
+ BusyIndicator.showWhile(fTable.getDisplay(), this::handleDelete);
return true;
}
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/SiteEditor.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/SiteEditor.java
index ff1c79e..6712ab3 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/SiteEditor.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/SiteEditor.java
@@ -236,7 +236,7 @@
private void ensureContentSaved() {
if (isDirty()) {
try {
- IRunnableWithProgress op = monitor -> doSave(monitor);
+ IRunnableWithProgress op = this::doSave;
PlatformUI.getWorkbench().getProgressService().runInUI(PDEPlugin.getActiveWorkbenchWindow(), op, PDEPlugin.getWorkspace().getRoot());
} catch (InvocationTargetException e) {
PDEPlugin.logException(e);
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/EnvironmentSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/EnvironmentSection.java
index aa567f0..c30195c 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/EnvironmentSection.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/EnvironmentSection.java
@@ -276,7 +276,7 @@
if (LOCALES_INITIALIZED)
return;
// kick off thread in background to find the NL values
- new Thread(() -> initializeAllLocales()).start();
+ new Thread(this::initializeAllLocales).start();
}
}
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/TargetEditor.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/TargetEditor.java
index 99ec63e..15d7996 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/TargetEditor.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/TargetEditor.java
@@ -85,7 +85,7 @@
private ImageHyperlink fLoadHyperlink;
- private EventHandler fEventHandler = e -> handleBrokerEvent(e);
+ private EventHandler fEventHandler = this::handleBrokerEvent;
@Override
protected FormToolkit createToolkit(Display display) {
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/validation/TextValidator.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/validation/TextValidator.java
index 28ad603..d77692c 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/validation/TextValidator.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/validation/TextValidator.java
@@ -74,7 +74,7 @@
}
protected void createListeners() {
- fModifyListener = e -> handleModifyTextEvent(e);
+ fModifyListener = this::handleModifyTextEvent;
}
protected void handleModifyTextEvent(ModifyEvent e) {
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java
index f709041..58ff403 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java
@@ -786,8 +786,8 @@
Set<String> additionalIds = DependencyManager.getDependencies(toCheck.toArray(),
fIncludeOptionalButton.getSelection(), null);
- additionalIds.stream().map(id -> PluginRegistry.findEntry(id))
- .filter(Objects::nonNull).map(entry -> entry.getModel())
+ additionalIds.stream().map(org.eclipse.pde.core.plugin.PluginRegistry::findEntry)
+ .filter(Objects::nonNull).map(org.eclipse.pde.core.plugin.ModelEntry::getModel)
.forEach(model -> toCheck.add(model));
checked = toCheck.toArray();
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/FeatureBlock.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/FeatureBlock.java
index e931c90..598dfe9 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/FeatureBlock.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/FeatureBlock.java
@@ -1209,7 +1209,7 @@
private void updateCounter() {
if (fCounter != null) {
int checked = fTree.getCheckedLeafCount();
- int total = fFeatureModels.values().size() + fAdditionalPlugins.size();
+ int total = fFeatureModels.size() + fAdditionalPlugins.size();
fCounter.setText(NLS.bind(PDEUIMessages.AbstractPluginBlock_counter, Integer.valueOf(checked), Integer.valueOf(total)));
}
}
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/TracingPropertySource.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/TracingPropertySource.java
index 571239e..7b00f53 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/TracingPropertySource.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/TracingPropertySource.java
@@ -216,7 +216,7 @@
String key = (String) keys.nextElement();
keyArray[i++] = key;
}
- Arrays.sort(keyArray, (o1, o2) -> compareKeys(o1, o2));
+ Arrays.sort(keyArray, this::compareKeys);
return keyArray;
}
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/nls/ExternalizeStringsWizardPage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/nls/ExternalizeStringsWizardPage.java
index 04ff374..4e624da 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/nls/ExternalizeStringsWizardPage.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/nls/ExternalizeStringsWizardPage.java
@@ -239,7 +239,7 @@
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 250;
fInputViewer.getTree().setLayoutData(gd);
- fInputViewer.addSelectionChangedListener(event -> handleSelectionChanged(event));
+ fInputViewer.addSelectionChangedListener(this::handleSelectionChanged);
fInputViewer.addCheckStateListener(event -> setPageComplete(hasCheckedElements()));
fInputViewer.setComparator(ListUtil.PLUGIN_COMPARATOR);
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/ExtensionsPatternFilter.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/ExtensionsPatternFilter.java
index 8d6c9a9..f17fbe7 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/ExtensionsPatternFilter.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/ExtensionsPatternFilter.java
@@ -267,7 +267,7 @@
}
}
}
- return isAnyChildMatch | isAnyLeafMatch;
+ return isAnyChildMatch || isAnyLeafMatch;
}
/**
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/SharedLabelProvider.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/SharedLabelProvider.java
index 24165d2..ffafea3 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/SharedLabelProvider.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/SharedLabelProvider.java
@@ -184,7 +184,7 @@
}
public Image getImageFromPlugin(String bundleID, String path) {
- return ResourceLocator.imageDescriptorFromBundle(bundleID, path).map(d-> get(d)).orElse(getBlankImage());
+ return ResourceLocator.imageDescriptorFromBundle(bundleID, path).map(this::get).orElse(getBlankImage());
}
public Image getImageFromPlugin(IPluginModelBase model, String relativePath) {
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/dependencies/DependenciesViewPage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/dependencies/DependenciesViewPage.java
index e4e4483..b5fa95f 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/dependencies/DependenciesViewPage.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/dependencies/DependenciesViewPage.java
@@ -283,7 +283,7 @@
private void hookContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(manager -> DependenciesViewPage.this.fillContextMenu(manager));
+ menuMgr.addMenuListener(DependenciesViewPage.this::fillContextMenu);
Menu menu = menuMgr.createContextMenu(fViewer.getControl());
fViewer.getControl().setMenu(menu);
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/plugins/PluginsView.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/plugins/PluginsView.java
index 0230407..5b62aad 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/plugins/PluginsView.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/plugins/PluginsView.java
@@ -580,7 +580,7 @@
private void hookContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(manager -> PluginsView.this.fillContextMenu(manager));
+ menuMgr.addMenuListener(PluginsView.this::fillContextMenu);
Menu menu = menuMgr.createContextMenu(fTreeViewer.getControl());
fTreeViewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, fTreeViewer);
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/target/StateViewPage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/target/StateViewPage.java
index 7486e04..e51d20d 100755
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/target/StateViewPage.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/target/StateViewPage.java
@@ -394,7 +394,7 @@
private void hookContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(manager -> fillContextMenu(manager));
+ menuMgr.addMenuListener(this::fillContextMenu);
Menu menu = menuMgr.createContextMenu(fTreeViewer.getControl());
fTreeViewer.getControl().setMenu(menu);
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/ListUtil.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/ListUtil.java
index bc96d1c..2abb5da 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/ListUtil.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/ListUtil.java
@@ -27,7 +27,7 @@
public class ListUtil {
- private static final Comparator<String> stringComparator = (arg0, arg1) -> arg0.compareToIgnoreCase(arg1);
+ private static final Comparator<String> stringComparator = String::compareToIgnoreCase;
static class NameComparator extends ViewerComparator {
public NameComparator() {
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/TestTab.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/TestTab.java
index a9b9cd1..f64bbb9 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/TestTab.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/TestTab.java
@@ -10,6 +10,7 @@
*
* Contributors:
* Ketan Padegaonkar - initial API and implementation
+ * Stefan Winkler - Bug 560156
*******************************************************************************/
package org.eclipse.pde.ui.launcher;
@@ -21,6 +22,7 @@
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationTab;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.pde.internal.ui.PDEUIMessages;
import org.eclipse.pde.launching.IPDELauncherConstants;
@@ -60,6 +62,8 @@
Composite composite = (Composite) getControl();
createSpacer(composite);
createRunInUIThreadGroup(composite);
+
+ Dialog.applyDialogFont(composite);
}
private void createRunInUIThreadGroup(Composite comp) {