-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate Invoker to Integration test for version-bump-plugin
- Loading branch information
Showing
9 changed files
with
123 additions
and
66 deletions.
There are no files selected for viewing
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
12 changes: 0 additions & 12 deletions
12
tycho-extras/tycho-version-bump-plugin/src/it/update-target/update-target.target
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
tycho-extras/tycho-version-bump-plugin/src/it/update-target/verify.groovy
This file was deleted.
Oops, something went wrong.
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
16 changes: 16 additions & 0 deletions
16
tycho-its/projects/tycho-version-bump-plugin/update-target/update-target.target
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,16 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<?pde version="3.6"?> | ||
<target name="update-target-bug" sequenceNumber="1"> | ||
<locations> | ||
<location includeAllPlatforms="false" includeMode="slicer" | ||
includeSource="true" type="InstallableUnit"> | ||
<unit id="org.eclipse.equinox.executable.feature.group" | ||
version="0.0.0" /> | ||
<unit id="org.eclipse.jdt.feature.group" version="0.0.0" /> | ||
<unit id="org.eclipse.platform.ide" version="0.0.0" /> | ||
<unit id="org.eclipse.pde.feature.group" version="0.0.0" /> | ||
<repository | ||
location="https://download.eclipse.org/eclipse/updates/4.17/" /> | ||
</location> | ||
</locations> | ||
</target> |
73 changes: 73 additions & 0 deletions
73
tycho-its/src/test/java/org/eclipse/tycho/test/VersionBumpPluginTest.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,73 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 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 org.eclipse.tycho.test; | ||
|
||
import static org.junit.Assert.fail; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import org.apache.maven.it.Verifier; | ||
import org.eclipse.tycho.targetplatform.TargetDefinition.InstallableUnitLocation; | ||
import org.eclipse.tycho.targetplatform.TargetDefinition.Location; | ||
import org.eclipse.tycho.targetplatform.TargetDefinition.Unit; | ||
import org.eclipse.tycho.targetplatform.TargetDefinitionFile; | ||
import org.eclipse.tycho.version.TychoVersion; | ||
import org.junit.Test; | ||
import org.w3c.dom.Document; | ||
|
||
public class VersionBumpPluginTest extends AbstractTychoIntegrationTest { | ||
|
||
@Test | ||
public void testUpdateTarget() throws Exception { | ||
Verifier verifier = getVerifier("tycho-version-bump-plugin/update-target", false, true); | ||
String sourceTargetFile = "update-target.target"; | ||
verifier.setSystemProperty("target", sourceTargetFile); | ||
verifier.setSystemProperty("tycho.localArtifacts", "ignore"); | ||
verifier.executeGoal("org.eclipse.tycho.extras:tycho-version-bump-plugin:" + TychoVersion.getTychoVersion() | ||
+ ":update-target"); | ||
verifier.verifyErrorFreeLog(); | ||
File targetFile = new File(verifier.getBasedir(), sourceTargetFile); | ||
try (FileInputStream input = new FileInputStream(targetFile)) { | ||
Document target = TargetDefinitionFile.parseDocument(input); | ||
TargetDefinitionFile parsedTarget = TargetDefinitionFile.parse(target, targetFile.getAbsolutePath()); | ||
List<? extends Location> locations = parsedTarget.getLocations(); | ||
InstallableUnitLocation iu = locations.stream().filter(InstallableUnitLocation.class::isInstance) | ||
.map(InstallableUnitLocation.class::cast).findFirst() | ||
.orElseThrow(() -> new AssertionError("IU Location not found!")); | ||
List<? extends Unit> units = iu.getUnits(); | ||
assertEquals(4, units.size()); | ||
assertIUVersion("org.eclipse.equinox.executable.feature.group", "3.8.900.v20200819-0940", units, | ||
targetFile); | ||
assertIUVersion("org.eclipse.jdt.feature.group", "3.18.500.v20200902-1800", units, targetFile); | ||
assertIUVersion("org.eclipse.platform.ide", "4.17.0.I20200902-1800", units, targetFile); | ||
assertIUVersion("org.eclipse.pde.feature.group", "3.14.500.v20200902-1800", units, targetFile); | ||
} | ||
} | ||
|
||
private void assertIUVersion(String id, String version, List<? extends Unit> units, File targetFile) { | ||
for (Unit unit : units) { | ||
if (unit.getId().equals(id) && unit.getVersion().equals(version)) { | ||
return; | ||
} | ||
} | ||
fail("Unit with id " + id + " and version " + version + " not found: " | ||
+ units.stream().map(String::valueOf).collect(Collectors.joining(System.lineSeparator())) | ||
+ " in target file " + targetFile); | ||
|
||
} | ||
|
||
} |
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