Skip to content

Commit

Permalink
Remove ECLIPSE_LATEST from tycho-testing-harness
Browse files Browse the repository at this point in the history
Use the one from tycho-api.
Adjust AbstractTychoIntegrationTest to escape '/' in the target platform
url so it can be passed as parameter.
Fixed test for upstream switch javax.annotation ->
jakarta.annotation-api.
Simplified tests to rely more on verifier with preset target platform
instead of setting it in test.
  • Loading branch information
akurtakov committed Dec 12, 2023
1 parent 0842d26 commit e4bc446
Show file tree
Hide file tree
Showing 24 changed files with 37 additions and 56 deletions.
2 changes: 1 addition & 1 deletion tycho-its/projects/p2Repository/category.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<category name="Test Category" />
</iu>
<iu>
<query><expression type="match">id == "javax.annotation"</expression></query>
<query><expression type="match">id == "jakarta.annotation-api"</expression></query>
<category name="Test Category" />
</iu>
<category-def label="Test Category Label" name="Test Category">
Expand Down
2 changes: 1 addition & 1 deletion tycho-its/projects/product.crossReference/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<repository>
<id>test-data-repo</id>
<layout>p2</layout>
<url>${test-data-repo}</url>
<url>${target-platform}</url>
</repository>
</repositories>

Expand Down
4 changes: 2 additions & 2 deletions tycho-its/projects/product.differentVersions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<properties>
<tycho-version>2.5.0-SNAPSHOT</tycho-version>
<platform-url>https://download.eclipse.org/releases/2021-03/</platform-url>
<target-platform>https://download.eclipse.org/releases/2021-03/</target-platform>
</properties>

<modules>
Expand All @@ -25,7 +25,7 @@
<repository>
<id>platform</id>
<layout>p2</layout>
<url>${platform-url}</url>
<url>${target-platform}</url>
</repository>
</repositories>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<repository>
<id>repository</id>
<layout>p2</layout>
<url>${repo}</url>
<url>${target-platform}</url>
</repository>
</repositories>

Expand Down
7 changes: 0 additions & 7 deletions tycho-its/projects/surefire.bundleUnpack/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
<module>tycho340.test</module>
</modules>

<properties>
<target-platform>http://download.eclipse.org/releases/latest</target-platform>
</properties>

<repositories>
<repository>
<id>p2</id>
Expand All @@ -35,9 +31,6 @@
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<explodedBundles>
<bundle>org.apache.ant</bundle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Bundle-Version: 0.0.1.qualifier
Require-Bundle: bundle;bundle-version="0.0.1",
org.junit;bundle-version="4.12.0",
org.eclipse.core.runtime;bundle-version="3.2.0",
javax.annotation
jakarta.annotation-api
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<repository>
<id>eclipse-3.4</id>
<layout>p2</layout>
<url>${e342-repo}</url>
<url>${target-platform}</url>
</repository>
</repositories>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<repository>
<id>eclipse-3.4</id>
<layout>p2</layout>
<url>${e342-repo}</url>
<url>${target-platform}</url>
</repository>
</repositories>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<repository>
<id>repo</id>
<layout>p2</layout>
<url>${repo}</url>
<url>${target-platform}</url>
</repository>
</repositories>

Expand Down
2 changes: 1 addition & 1 deletion tycho-its/projects/surefire.requireBundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<repository>
<id>oxygen</id>
<layout>p2</layout>
<url>${oxygen-repo}</url>
<url>${target-platform}</url>
</repository>
</repositories>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Bundle-Version: 0.0.1.qualifier
Require-Bundle: bundle;bundle-version="0.0.1",
org.junit;bundle-version="4.12.0",
org.eclipse.core.runtime;bundle-version="3.2.0",
javax.annotation
jakarta.annotation-api
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2022 Christoph Läubrich and others.
* Copyright (c) 2021, 2023 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
Expand All @@ -22,8 +22,8 @@

import org.apache.maven.it.VerificationException;
import org.apache.maven.it.Verifier;
import org.eclipse.tycho.TychoConstants;
import org.eclipse.tycho.test.AbstractTychoIntegrationTest;
import org.eclipse.tycho.test.util.EnvironmentUtil;
import org.junit.Test;

public class CompilerClasspathEntryTest extends AbstractTychoIntegrationTest {
Expand Down Expand Up @@ -64,7 +64,7 @@ public void testLibEntry() throws Exception {
@Test
public void testDSComponents() throws Exception {
Verifier verifier = getVerifier("tycho-ds", false, true);
verifier.setSystemProperty("repo-url", EnvironmentUtil.ECLIPSE_LATEST);
verifier.setSystemProperty("repo-url", TychoConstants.ECLIPSE_LATEST);
// first test to consume from target platform
verifyDs(verifier);
// now test consume from maven directly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class BasicP2RepositoryIntegrationTest extends AbstractTychoIntegrationTe

@BeforeClass
public static void executeBuild() throws Exception {
verifier = new BasicP2RepositoryIntegrationTest().getVerifier("/p2Repository", true);
verifier = new BasicP2RepositoryIntegrationTest().getVerifier("/p2Repository");
verifier.executeGoal("verify");
verifier.verifyErrorFreeLog();
p2Repo = P2RepositoryTool.forEclipseRepositoryModule(new File(verifier.getBasedir()));
Expand All @@ -47,7 +47,7 @@ public static void executeBuild() throws Exception {
@Test
public void test381377BundleInclusion() {
// check that (separately!) included bundle is there
assertTrue(p2Repo.getBundleArtifact("com.sun.el.javax.el", "3.0.0").isFile());
assertTrue(p2Repo.getBundleArtifact("com.sun.el.javax.el", "3.0.4").isFile());
}

@Test
Expand All @@ -60,10 +60,10 @@ public void testIncludedIUById() throws Exception {

@Test
public void testIncludeIUViaMatchQuery() throws Exception {
assertThat(p2Repo.getAllUnitIds(), hasItem("javax.annotation"));
assertThat(p2Repo.getAllUnitIds(), hasItem("jakarta.annotation-api"));

IU categoryIU = p2Repo.getUniqueIU("Test Category");
assertThat(categoryIU.getRequiredIds(), hasItem("javax.annotation"));
assertThat(categoryIU.getRequiredIds(), hasItem("jakarta.annotation-api"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@

import org.apache.maven.it.Verifier;
import org.eclipse.tycho.test.AbstractTychoIntegrationTest;
import org.eclipse.tycho.test.util.ResourceUtil.P2Repositories;
import org.junit.Test;

public class ProductMixedVersionsTest extends AbstractTychoIntegrationTest {
@Test
public void testMixedPluginVersions() throws Exception {
Verifier verifier = getVerifier("product.differentVersions", false);
verifier.addCliOption("-Dplatform-url=" + P2Repositories.ECLIPSE_LATEST.toString());
Verifier verifier = getVerifier("product.differentVersions");
verifier.executeGoals(Arrays.asList("clean", "verify"));
verifier.verifyErrorFreeLog();
// check that simple configurator is there...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@
import org.apache.maven.it.Verifier;
import org.eclipse.tycho.test.AbstractTychoIntegrationTest;
import org.eclipse.tycho.test.util.P2RepositoryTool;
import org.eclipse.tycho.test.util.ResourceUtil.P2Repositories;
import org.junit.Test;

public class ReferenceBetweenProductsTest extends AbstractTychoIntegrationTest {

@Test
public void testProductCanReferenceProductFromDifferentModule() throws Exception {
Verifier verifier = getVerifier("product.crossReference", false);
verifier.addCliOption("-Dtest-data-repo=" + P2Repositories.ECLIPSE_LATEST.toString());
Verifier verifier = getVerifier("product.crossReference");
verifier.executeGoal("verify");
verifier.verifyErrorFreeLog();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@

import org.apache.maven.it.Verifier;
import org.eclipse.tycho.test.AbstractTychoIntegrationTest;
import org.eclipse.tycho.test.util.ResourceUtil.P2Repositories;
import org.junit.Test;

public class SplitPackagesTest extends AbstractTychoIntegrationTest {

@Test
public void testSplitPackage() throws Exception {
Verifier verifier = getVerifier("/resolver.split/org.eclipse.equinox.security");
verifier.addCliOption("-Drepo=" + P2Repositories.ECLIPSE_LATEST.toString());
verifier.executeGoal("compile");
verifier.verifyErrorFreeLog();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ public class ExplodedTestDependenciesTest extends AbstractTychoIntegrationTest {
public void testLocalMavenRepository() throws Exception {
// project that marks org.apache.ant as "exploded" (unpacked) for the test
// runtime -> supported since TYCHO-340
Verifier v01 = getVerifier("surefire.bundleUnpack", true);
Verifier v01 = getVerifier("surefire.bundleUnpack");
v01.executeGoal("install");
v01.verifyErrorFreeLog();
// TODO this is only an indirect test; it should test that the bundles nested
// jars are accessible as file URLs
File antHome = new File(v01.getBasedir(),
"tycho340.test/target/work/plugins/org.apache.ant_1.10.12.v20211102-1452");
"tycho340.test/target/work/plugins/org.apache.ant_1.10.14.v20230922-1200");
Assert.assertTrue(antHome.isDirectory());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@

import org.apache.maven.it.Verifier;
import org.eclipse.tycho.test.AbstractTychoIntegrationTest;
import org.eclipse.tycho.test.util.ResourceUtil.P2Repositories;
import org.junit.Test;

public class OpenTest4JTest extends AbstractTychoIntegrationTest {

@Test
public void testOpenTest4JUsage() throws Exception {
Verifier verifier = getVerifier("/surefire.opentest4j/bundle.test", false);
verifier.addCliOption("-Dtarget-platform=" + P2Repositories.ECLIPSE_LATEST.toString());
Verifier verifier = getVerifier("/surefire.opentest4j/bundle.test", true);

verifier.setSystemProperty("maven.test.error.ignore", Boolean.toString(true));
verifier.setSystemProperty("maven.test.failure.ignore", Boolean.toString(true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,21 @@

import org.apache.maven.it.Verifier;
import org.eclipse.tycho.test.AbstractTychoIntegrationTest;
import org.eclipse.tycho.test.util.ResourceUtil.P2Repositories;
import org.junit.Test;

public class RequireBundleTest extends AbstractTychoIntegrationTest {

// requested in bug 485926
@Test
public void loadResourceFromRequireBundle() throws Exception {
Verifier verifier = getVerifier("/surefire.requireBundle", false, true);
verifier.addCliOption("-Doxygen-repo=" + P2Repositories.ECLIPSE_LATEST.toString());
Verifier verifier = getVerifier("/surefire.requireBundle", true, true);
verifier.executeGoal("integration-test");
verifier.verifyErrorFreeLog();
}

@Test
public void requireMultipleVersionsOfABundle() throws Exception {
Verifier verifier = getVerifier("/surefire.requireBundle.multipleVersions", false, true);
verifier.addCliOption("-Drepo=" + P2Repositories.ECLIPSE_LATEST.toString());
Verifier verifier = getVerifier("/surefire.requireBundle.multipleVersions", true, true);
verifier.executeGoal("integration-test");
verifier.verifyErrorFreeLog();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import org.apache.maven.it.Verifier;
import org.eclipse.tycho.test.AbstractTychoIntegrationTest;
import org.eclipse.tycho.test.util.ResourceUtil;
import org.junit.Test;

public class TestOptionalDependenciesTest extends AbstractTychoIntegrationTest {
Expand All @@ -23,8 +22,7 @@ public class TestOptionalDependenciesTest extends AbstractTychoIntegrationTest {
// they are conflicting (cf. bug 351842)
@Test
public void testIgnoreMutuallyExclusiveOptionalDependenciesForTestRuntimeComputation() throws Exception {
Verifier verifier = getVerifier("/surefire.optionalDependencies.ignore", false);
verifier.addCliOption("-De342-repo=" + ResourceUtil.P2Repositories.ECLIPSE_LATEST.toString());
Verifier verifier = getVerifier("/surefire.optionalDependencies.ignore", true);
verifier.executeGoal("verify");
verifier.verifyErrorFreeLog();
} // see also OptionalDependenciesTest.testOptionallyRequiredBundleCanBeIgnored()
Expand All @@ -33,8 +31,7 @@ public void testIgnoreMutuallyExclusiveOptionalDependenciesForTestRuntimeComputa
// project (bug 367701)
@Test
public void reactorIndirectOptionalDependencies() throws Exception {
Verifier verifier = getVerifier("/surefire.optionalDependencies.reactor", false);
verifier.addCliOption("-De342-repo=" + ResourceUtil.P2Repositories.ECLIPSE_LATEST.toString());
Verifier verifier = getVerifier("/surefire.optionalDependencies.reactor", true);
verifier.executeGoal("verify");
verifier.verifyErrorFreeLog();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2022 SAP AG and others.
* Copyright (c) 2011, 2023 SAP AG 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
Expand All @@ -15,14 +15,16 @@
import java.io.File;
import java.net.URI;

import org.eclipse.tycho.TychoConstants;

/**
* Helper for accessing test resources.
*/
public class ResourceUtil {

public enum P2Repositories {
ECLIPSE_342("e342"), ECLIPSE_352("e352"), ECLIPSE_OXYGEN("https:////download.eclipse.org/releases/oxygen/"),
ECLIPSE_LATEST(EnvironmentUtil.ECLIPSE_LATEST);
ECLIPSE_LATEST(TychoConstants.ECLIPSE_LATEST);

private final String path;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2022 Sonatype Inc. and others.
* Copyright (c) 2008, 2023 Sonatype Inc. 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
Expand Down Expand Up @@ -119,7 +119,7 @@ protected Verifier getVerifier(String test, boolean setTargetPlatform, File user
tmpDir.mkdirs();
verifier.addCliOption("-Djava.io.tmpdir=" + tmpDir.getAbsolutePath());
if (setTargetPlatform) {
verifier.addCliOption("-Dtarget-platform=" + getTargetPlatform());
verifier.addCliOption("-Dtarget-platform=" + getTargetPlatform().replace("/", "//"));
}
if (ignoreLocalArtifacts) {
verifier.addCliOption("-Dtycho.localArtifacts=ignore");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2020 Sonatype Inc. and others.
* Copyright (c) 2008, 2023 Sonatype Inc. 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
Expand All @@ -24,6 +24,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.eclipse.tycho.TychoConstants;
import org.eclipse.tycho.test.AbstractTychoIntegrationTest;

/**
Expand All @@ -36,8 +37,6 @@ public class EnvironmentUtil {

private static final String MAVEN_HOME_INFO = "Maven home:";

public static final String ECLIPSE_LATEST = "https:////download.eclipse.org/releases/2023-09/";

private static final Properties props;

static {
Expand Down Expand Up @@ -85,7 +84,7 @@ public static boolean isMac() {
}

public static String getTargetPlatform() {
return ECLIPSE_LATEST;
return TychoConstants.ECLIPSE_LATEST;
}

public static String getTestSettings() {
Expand Down

0 comments on commit e4bc446

Please sign in to comment.