Skip to content

Commit

Permalink
Method createVerifier no longer sets the mirrors
Browse files Browse the repository at this point in the history
The system properties containing the mirror URLs are no longer set in
the createVerifier(String, String) method but in the tests themselves.

In addition, the createVerifier(String, String) method has been slightly
simplified by using the setSystemProperty method.
  • Loading branch information
kevloral committed Jan 7, 2024
1 parent df34368 commit 128740c
Showing 1 changed file with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package org.eclipse.tycho.test.target;

import java.io.File;
import java.util.Properties;

import org.apache.maven.it.Verifier;
import org.eclipse.tycho.test.AbstractTychoIntegrationTest;
Expand Down Expand Up @@ -54,17 +53,29 @@ public void stopServer() throws Exception {
server.stop();
}

/**
* Tries to access a p2 repository over an authenticated mirror.
*
* @throws Exception
*/
@Test
public void testAuthMirror() throws Exception {
Verifier verifier = createVerifier("settings-auth-mirror.xml");
verifier.setSystemProperty("p2.authMirror", p2AuthMirrorUrl);
verifier.addCliOption("-P=repository");
verifier.executeGoal("package");
verifier.verifyErrorFreeLog();
}

/**
* Tries to access a p2 repository over a mirror with no authentication.
*
* @throws Exception
*/
@Test
public void testMirror() throws Exception {
Verifier verifier = createVerifier("settings-mirror.xml");
verifier.setSystemProperty("p2.mirror", p2MirrorUrl);
verifier.addCliOption("-P=repository");
verifier.executeGoal("package");
verifier.verifyErrorFreeLog();
Expand Down Expand Up @@ -96,21 +107,35 @@ public void testTargetDefinition() throws Exception {
verifier.verifyErrorFreeLog();
}

/**
* Tries to resolve a target definition from a p2 repository accessed over a
* mirror with no authentication.
*
* @throws Exception
*/
@Test
public void testTargetDefinitionMirror() throws Exception {
Verifier verifier = createVerifier("settings-mirror.xml");
File platformFile = new File(verifier.getBasedir(), "platform.target");
TargetDefinitionUtil.setRepositoryURLs(platformFile, p2RepoUrl);
verifier.setSystemProperty("p2.mirror", p2MirrorUrl);
verifier.addCliOption("-P=target-definition");
verifier.executeGoal("package");
verifier.verifyErrorFreeLog();
}

/**
* Tries to resolve a target definition from a p2 repository accessed over an
* authenticated mirror.
*
* @throws Exception
*/
@Test
public void testTargetDefinitionAuthMirror() throws Exception {
Verifier verifier = createVerifier("settings-auth-mirror.xml");
File platformFile = new File(verifier.getBasedir(), "platform.target");
TargetDefinitionUtil.setRepositoryURLs(platformFile, p2RepoUrl);
verifier.setSystemProperty("p2.authMirror", p2AuthMirrorUrl);
verifier.addCliOption("-P=target-definition");
verifier.executeGoal("package");
verifier.verifyErrorFreeLog();
Expand All @@ -133,14 +158,11 @@ private Verifier createVerifier(String settingsFile) throws Exception {
private Verifier createVerifier(String settingsFile, String settingsSecurityFile) throws Exception {
Verifier verifier = getVerifier("target.httpAuthentication", false,
new File("projects/target.httpAuthentication/" + settingsFile));
Properties systemProperties = verifier.getSystemProperties();
systemProperties.setProperty("p2.repo", p2RepoUrl);
systemProperties.setProperty("p2.mirror", p2MirrorUrl);
systemProperties.setProperty("p2.authMirror", p2AuthMirrorUrl);
verifier.setSystemProperty("p2.repo", p2RepoUrl);
if (settingsSecurityFile != null) {
// see
// org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher#SYSTEM_PROPERTY_SEC_LOCATION
systemProperties.setProperty("settings.security",
verifier.setSystemProperty("settings.security",
new File("projects/target.httpAuthentication/" + settingsSecurityFile).getAbsolutePath());
}
return verifier;
Expand Down

0 comments on commit 128740c

Please sign in to comment.