-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Bug: 1275 Support Junit 5.9 - added provider classes and configuration for new Junit 5.9 Signed-off-by: lnavrat <lumi@centrum.cz> Change-Id: I3eff5b3f442a11a60f81b3b2e3386ec6343a7835 * Bug: 1275 Support Junit 5.9 - removed not needed modules Signed-off-by: lnavrat <lumi@centrum.cz> Change-Id: I19953e1a7550bdfd8e5bf01ec2311da04c926219 * Bug: 1275 Support Junit 5.9 - added integration test for provider (TODO set correct repo that contains junit 5.9.0) Signed-off-by: lnavrat <lumi@centrum.cz> Change-Id: I77d1f0f3aca079a9fbe02deeb09e3415af5ad952 * Bug: 1275 Support Junit 5.9 - added correct url for I repository - fixed typo in test Signed-off-by: lnavrat <lumi@centrum.cz> Change-Id: Ia18f72abe899259d9168f6555dc420585bea51a9 Signed-off-by: lnavrat <lumi@centrum.cz>
- Loading branch information
Showing
9 changed files
with
226 additions
and
2 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
tycho-its/projects/surefire.junit59/bundle.test/META-INF/MANIFEST.MF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: JUnit59 Test Plug-in | ||
Bundle-SymbolicName: bundle.test.junit59 | ||
Bundle-Version: 1.0.0 | ||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | ||
Import-Package: org.junit.jupiter.api;version="5.9.0" |
4 changes: 4 additions & 0 deletions
4
tycho-its/projects/surefire.junit59/bundle.test/build.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source.. = src/ | ||
output.. = bin/ | ||
bin.includes = META-INF/,\ | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.eclipse.tycho.tycho-its.surefire-junit5</groupId> | ||
<artifactId>bundle.test.junit59</artifactId> | ||
<packaging>eclipse-test-plugin</packaging> | ||
<version>1.0.0</version> | ||
|
||
<repositories> | ||
<repository> | ||
<id>eclipse202003</id> | ||
<layout>p2</layout> | ||
<url>${repo-2020-03}</url> | ||
</repository> | ||
</repositories> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.eclipse.tycho</groupId> | ||
<artifactId>tycho-maven-plugin</artifactId> | ||
<version>${tycho-version}</version> | ||
<extensions>true</extensions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.eclipse.tycho</groupId> | ||
<artifactId>tycho-surefire-plugin</artifactId> | ||
<version>${tycho-version}</version> | ||
<configuration> | ||
<excludedGroups>slow</excludedGroups> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
37 changes: 37 additions & 0 deletions
37
tycho-its/projects/surefire.junit59/bundle.test/src/bundle/test/JUnit59Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2018 Bachmann electronic GmbH 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: | ||
* Bachmann electronic GmbH - initial API and implementation | ||
*******************************************************************************/ | ||
package bundle.test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestInfo; | ||
|
||
class JUnit59Test { | ||
|
||
@Test | ||
@DisplayName("My 1st JUnit 5.9 test!") | ||
void myFirstJUnit59Test(TestInfo testInfo) { | ||
assertEquals(2, 1+1, "1 + 1 should equal 2"); | ||
assertEquals("My 1st JUnit 5.9 test!", testInfo.getDisplayName(), () -> "TestInfo is injected correctly"); | ||
} | ||
|
||
@Test | ||
@Tag("slow") | ||
void slowJUnit5Test() { | ||
assertEquals(2, 1+1, "1 + 1 should equal 2"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...refire-plugin/src/main/java/org/eclipse/tycho/surefire/provider/impl/JUnit59Provider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2018 SAP SE 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: | ||
* SAP SE - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.tycho.surefire.provider.impl; | ||
|
||
import static java.util.Collections.singletonList; | ||
import static org.eclipse.tycho.surefire.provider.impl.ProviderHelper.newDependency; | ||
|
||
import java.util.List; | ||
import java.util.Properties; | ||
import java.util.Set; | ||
|
||
import org.apache.maven.model.Dependency; | ||
import org.codehaus.plexus.component.annotations.Component; | ||
import org.eclipse.tycho.classpath.ClasspathEntry; | ||
import org.eclipse.tycho.surefire.provider.spi.TestFrameworkProvider; | ||
import org.osgi.framework.Version; | ||
import org.osgi.framework.VersionRange; | ||
|
||
@Component(role = TestFrameworkProvider.class, hint = "junit59") | ||
public class JUnit59Provider extends AbstractJUnitProvider { | ||
|
||
private static final Version VERSION = Version.parseVersion("5.9.0"); | ||
|
||
@Override | ||
protected Set<String> getJUnitBundleNames() { | ||
return Set.of("org.junit.jupiter.api" /* legacy Orbit bundle */, "junit-jupiter-api"); | ||
} | ||
|
||
@Override | ||
public String getSurefireProviderClassName() { | ||
return "org.apache.maven.surefire.junitplatform.JUnitPlatformProvider"; | ||
} | ||
|
||
@Override | ||
public Version getVersion() { | ||
return VERSION; | ||
} | ||
|
||
@Override | ||
public List<Dependency> getRequiredBundles() { | ||
return singletonList(newDependency("org.eclipse.tycho", "org.eclipse.tycho.surefire.junit58")); | ||
} | ||
|
||
@Override | ||
protected VersionRange getJUnitVersionRange() { | ||
return new VersionRange("[5.9,6.0)"); | ||
} | ||
|
||
@Override | ||
public boolean isEnabled(List<ClasspathEntry> testBundleClassPath, Properties surefireProperties) { | ||
return super.isEnabled(testBundleClassPath, surefireProperties) | ||
&& !new JUnit47Provider().containsJunitInClasspath(testBundleClassPath); | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
...in/src/main/java/org/eclipse/tycho/surefire/provider/impl/JUnit59WithVintageProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2018 SAP SE 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: | ||
* SAP SE - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.tycho.surefire.provider.impl; | ||
|
||
import static java.util.Collections.singletonList; | ||
import static org.eclipse.tycho.surefire.provider.impl.ProviderHelper.newDependency; | ||
|
||
import java.util.List; | ||
import java.util.Properties; | ||
import java.util.Set; | ||
|
||
import org.apache.maven.model.Dependency; | ||
import org.codehaus.plexus.component.annotations.Component; | ||
import org.eclipse.tycho.classpath.ClasspathEntry; | ||
import org.eclipse.tycho.surefire.provider.spi.TestFrameworkProvider; | ||
import org.osgi.framework.Version; | ||
import org.osgi.framework.VersionRange; | ||
|
||
@Component(role = TestFrameworkProvider.class, hint = "junit59withvintage") | ||
public class JUnit59WithVintageProvider extends AbstractJUnitProvider { | ||
|
||
private static final Version VERSION = Version.parseVersion("5.9.0"); | ||
|
||
@Override | ||
protected Set<String> getJUnitBundleNames() { | ||
return Set.of("org.junit.jupiter.api" /* legacy Orbit bundle */, "junit-jupiter-api"); | ||
} | ||
|
||
@Override | ||
public String getSurefireProviderClassName() { | ||
return "org.apache.maven.surefire.junitplatform.JUnitPlatformProvider"; | ||
} | ||
|
||
@Override | ||
public Version getVersion() { | ||
return VERSION; | ||
} | ||
|
||
@Override | ||
public List<Dependency> getRequiredBundles() { | ||
return singletonList(newDependency("org.eclipse.tycho", "org.eclipse.tycho.surefire.junit58withvintage")); | ||
} | ||
|
||
@Override | ||
protected VersionRange getJUnitVersionRange() { | ||
return new VersionRange("[5.9,6.0)"); | ||
} | ||
|
||
@Override | ||
public boolean isEnabled(List<ClasspathEntry> testBundleClassPath, Properties surefireProperties) { | ||
return super.isEnabled(testBundleClassPath, surefireProperties) | ||
&& new JUnit47Provider().containsJunitInClasspath(testBundleClassPath); | ||
} | ||
} |