-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#4] Reuse password configured in uploadArchives task
- Loading branch information
Showing
7 changed files
with
91 additions
and
0 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
13 changes: 13 additions & 0 deletions
13
src/test/groovy/io/codearte/gradle/nexus/functional/PasswordFunctionalSpec.groovy
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,13 @@ | ||
package io.codearte.gradle.nexus.functional | ||
|
||
class PasswordFunctionalSpec extends BaseNexusStagingFunctionalSpec { | ||
|
||
def "should read password from repository configured in uploadArchives"() { | ||
given: | ||
copyResources("sampleProjects//uploadArchives", "") | ||
when: | ||
def result = runTasksSuccessfully('tasks') | ||
then: | ||
result.standardOutput.contains("Using username 'testUsername' and password from repository 'Test repo'") | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/test/resources/sampleProjects/uploadArchives/build.gradle
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,33 @@ | ||
apply plugin: 'groovy' | ||
apply plugin: 'maven' | ||
|
||
apply plugin: 'io.codearte.nexus-staging' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
compile 'org.codehaus.groovy:groovy-all:2.3.7' | ||
|
||
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0' | ||
testCompile 'junit:junit:4.11' | ||
} | ||
|
||
artifacts { | ||
archives jar | ||
} | ||
|
||
uploadArchives { | ||
repositories { | ||
mavenDeployer { | ||
repository(id: 'test-repo-staging', url: "http://localhost:8089/nexus/content/repositories/internal/") { | ||
authentication(userName: sonatypeUsername, password: sonatypePassword) | ||
} | ||
snapshotRepository(id: 'test-repo-snapshots', url: 'http://localhost:8089/nexus/content/repositories/internal-snapshots/') { | ||
authentication(userName: 'testUser', password: 'noPassword') | ||
} | ||
name = 'Test repo' | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/test/resources/sampleProjects/uploadArchives/gradle.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 @@ | ||
group=com.example.upload1 | ||
version=0.0.1-SNAPSHOT | ||
sonatypeUsername=testUsername | ||
sonatypePassword=testPassword |
1 change: 1 addition & 0 deletions
1
src/test/resources/sampleProjects/uploadArchives/settings.gradle
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 @@ | ||
rootProject.name = 'uploadArchives' |
5 changes: 5 additions & 0 deletions
5
src/test/resources/sampleProjects/uploadArchives/src/main/groovy/Library.groovy
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,5 @@ | ||
class Library { | ||
boolean someLibraryMethod() { | ||
true | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/resources/sampleProjects/uploadArchives/src/test/groovy/LibraryTest.groovy
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,12 @@ | ||
import spock.lang.Specification | ||
|
||
class LibraryTest extends Specification{ | ||
def "someLibraryMethod returns true"() { | ||
setup: | ||
Library lib = new Library() | ||
when: | ||
def result = lib.someLibraryMethod() | ||
then: | ||
result == true | ||
} | ||
} |