Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expand properties in server id attribute #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -80,7 +80,7 @@ private Map<String,Credentials> extractCredentialsFromSettings(File settingsFile
final Map<String,Credentials> result = new HashMap<>();

for ( Element serverElement : serverElements ) {
final String id = DomHelper.extractValue( serverElement.element( "id" ) );
final String id = extractValue( serverElement.element( "id" ) );
if ( id == null ) {
continue;
}
Expand Down
Expand Up @@ -123,6 +123,7 @@ public void testPluginEncryptedFunction() {

@Test
public void testPluginEnvironmentFunction() {
environmentVariables.set( "SERVER_ID", "id" );
environmentVariables.set( "SERVER_USERNAME", "clu" );
environmentVariables.set( "SERVER_PASSWORD", "xyz" );

Expand All @@ -137,7 +138,7 @@ public void testPluginEnvironmentFunction() {
project.getPluginManager().apply( "maven" );
project.getPluginManager().apply( "maven-publish" );

final String serverId = "environment-server";
final String serverId = "environment-server-id";

applyRepositories( project, serverId, HTTP_REPO );

Expand All @@ -149,6 +150,7 @@ public void testPluginEnvironmentFunction() {

@Test
public void testPluginSystemPropertyFunction() {
System.setProperty( "user.id", "testid" );
System.setProperty( "user.name", "admin" );
System.setProperty( "user.top.secret.password", "top-secret-password" );

Expand All @@ -163,7 +165,7 @@ public void testPluginSystemPropertyFunction() {
project.getPluginManager().apply( "maven" );
project.getPluginManager().apply( "maven-publish" );

final String serverId = "system-properties-server";
final String serverId = "system-properties-server-testid";

applyRepositories( project, serverId, HTTP_REPO );

Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/env/environment-settings.xml
Expand Up @@ -2,7 +2,7 @@

<servers>
<server>
<id>environment-server</id>
<id>environment-server-${env.SERVER_ID}</id>
<username>${env.SERVER_USERNAME}</username>
<password>${env.SERVER_PASSWORD}</password>
</server>
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/env/system-properties-settings.xml
Expand Up @@ -2,7 +2,7 @@

<servers>
<server>
<id>system-properties-server</id>
<id>system-properties-server-${user.id}</id>
<username>${user.name}</username>
<password>${user.top.secret.password}</password>
</server>
Expand Down