diff --git a/tycho-baseline-plugin/.settings/org.eclipse.jdt.core.prefs b/tycho-baseline-plugin/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..cf2cd4590a --- /dev/null +++ b/tycho-baseline-plugin/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/.project b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/.project new file mode 100644 index 0000000000..235a102ae2 --- /dev/null +++ b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/.project @@ -0,0 +1,54 @@ + + + junit5-with-linked-resources + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.m2e.core.maven2Nature + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + + + + .classpath + 1 + PROJECT_LOC/linkedresources/.classpath + + + + src_test + 2 + VARIABLE_SELFREF_VIA_PARENT/linkedresources/src_test/ + + + + + VARIABLE_SELFREF_VIA_PARENT + $%7BPARENT-1-PROJECT_LOC%7D/junit5-with-linked-files + + + diff --git a/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/META-INF/MANIFEST.MF b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..ebc27b2bd7 --- /dev/null +++ b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: junit5-with-linked-resources +Bundle-SymbolicName: junit5.with.linked.resources +Bundle-Version: 1.0.0 +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Export-Package: bundle.test diff --git a/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/build.properties b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/build.properties new file mode 100644 index 0000000000..34d2e4d2da --- /dev/null +++ b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/linkedresources/.classpath b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/linkedresources/.classpath new file mode 100644 index 0000000000..ee7865ef8c --- /dev/null +++ b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/linkedresources/.classpath @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/linkedresources/src_test/bundle/test/AdderTest.java b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/linkedresources/src_test/bundle/test/AdderTest.java new file mode 100644 index 0000000000..e73e626c2e --- /dev/null +++ b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/linkedresources/src_test/bundle/test/AdderTest.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2021 Christoph Läubrich and others. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Christoph Läubrich. - initial API and implementation + *******************************************************************************/ +package bundle.test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; + +public class AdderTest { + + @Test + public void incrementTest() { + Counter counter = new Counter(); + counter.increment(1); + counter.increment(3); + assertEquals(4, counter.get()); + } + + @Test + public void decrementTest() { + assertThrows(IllegalArgumentException.class, () -> { + Counter counter = new Counter(); + counter.increment(-1); + }); + } +} diff --git a/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/linkedresources/src_test/bundle/test/SubtractorTest.java b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/linkedresources/src_test/bundle/test/SubtractorTest.java new file mode 100644 index 0000000000..138881173d --- /dev/null +++ b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/linkedresources/src_test/bundle/test/SubtractorTest.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2021 Christoph Läubrich and others. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Christoph Läubrich - initial API and implementation + *******************************************************************************/ +package bundle.test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; + +public class SubtractorTest { + + @Test + public void incrementTest() { + CountDown counter = new CountDown(10); + counter.decrement(1); + counter.decrement(3); + assertEquals(6, counter.get()); + } + + @Test + public void decrementTest() { + assertThrows(IllegalArgumentException.class, ()->{ + CountDown counter = new CountDown(10); + counter.decrement(-1); + }); + } + + @Test + public void decrementTest2() { + assertThrows(IllegalStateException.class, ()->{ + CountDown counter = new CountDown(1); + counter.decrement(5); + }); + } +} diff --git a/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/pom.xml b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/pom.xml new file mode 100644 index 0000000000..cbb51c0eb6 --- /dev/null +++ b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + org.eclipse.tycho.tycho-its.surefire + junit5.with.linked.resources + eclipse-plugin + 1.0.0 + + + + org.eclipse.tycho + tycho-maven-plugin + ${tycho-version} + true + + + org.apache.maven.plugins + maven-surefire-plugin + 3.1.2 + + + org.junit.jupiter + junit-jupiter-engine + 5.9.1 + + + + + surefire-test + test + + test + + + + + + + diff --git a/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/src/bundle/test/CountDown.java b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/src/bundle/test/CountDown.java new file mode 100644 index 0000000000..ca27d5b7c4 --- /dev/null +++ b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/src/bundle/test/CountDown.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2021 Christoph Läubrich and others. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Christoph Läubrich. - initial API and implementation + *******************************************************************************/ +package bundle.test; + +public class CountDown { + + RefMe refFromOtherSourceFolder; + + int count; + + public CountDown(int initalValue) { + count = initalValue; + } + + public void decrement(int x) { + if (x < 0) { + throw new IllegalArgumentException(); + } + if (count-x < 0) { + throw new IllegalStateException(); + } + count -= x; + } + + public int get() { + return count; + } +} diff --git a/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/src/bundle/test/Counter.java b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/src/bundle/test/Counter.java new file mode 100644 index 0000000000..133e1b749b --- /dev/null +++ b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/src/bundle/test/Counter.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2021 Christoph Läubrich and others. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Christoph Läubrich. - initial API and implementation + *******************************************************************************/ +package bundle.test; + +public class Counter { + + int count; + + public void increment(int x) { + if (x < 0) { + throw new IllegalArgumentException(); + } + count += x; + } + + public int get() { + return count; + } +} diff --git a/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/src/bundle/test/RefMe.java b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/src/bundle/test/RefMe.java new file mode 100644 index 0000000000..2b479d82e1 --- /dev/null +++ b/tycho-its/projects/compiler.junitcontainer/junit5-with-linked-resources/src/bundle/test/RefMe.java @@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2021 Christoph Läubrich and others. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Christoph Läubrich. - initial API and implementation + *******************************************************************************/ + +package bundle.test; + +public class RefMe extends Counter{ + +} diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/compiler/CompilerClasspathEntryTest.java b/tycho-its/src/test/java/org/eclipse/tycho/test/compiler/CompilerClasspathEntryTest.java index 82abb0ce8b..aeafe19c79 100644 --- a/tycho-its/src/test/java/org/eclipse/tycho/test/compiler/CompilerClasspathEntryTest.java +++ b/tycho-its/src/test/java/org/eclipse/tycho/test/compiler/CompilerClasspathEntryTest.java @@ -37,6 +37,16 @@ public void testJUnit5ContainerWithoutTarget() throws Exception { verifier.verifyTextInLog("Tests run: 5, Failures: 0, Errors: 0, Skipped: 0"); } + @Test + public void testJUnit5ContainerWithLinkedResources() throws Exception { + Verifier verifier = getVerifier("compiler.junitcontainer/junit5-with-linked-resources", false, true); + verifier.executeGoal("test"); + verifier.verifyErrorFreeLog(); + verifier.verifyTextInLog("-- in bundle.test.AdderTest"); + verifier.verifyTextInLog("-- in bundle.test.SubtractorTest"); + verifier.verifyTextInLog("Tests run: 5, Failures: 0, Errors: 0, Skipped: 0"); + } + @Test public void testJUnit4Container() throws Exception { Verifier verifier = getVerifier("compiler.junitcontainer/junit4-in-bundle", true); diff --git a/tycho-p2/.settings/org.eclipse.jdt.core.prefs b/tycho-p2/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..cf2cd4590a --- /dev/null +++ b/tycho-p2/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/tycho-surefire/org.eclipse.tycho.bnd.executionlistener/.settings/org.eclipse.jdt.core.prefs b/tycho-surefire/org.eclipse.tycho.bnd.executionlistener/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..2f5cc74c3a --- /dev/null +++ b/tycho-surefire/org.eclipse.tycho.bnd.executionlistener/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.8