Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/rebase_on_74.31.0_176478613' int…
Browse files Browse the repository at this point in the history
…o gds_master
  • Loading branch information
mogds committed Feb 2, 2021
2 parents 398d52f + a1e25aa commit e25afa7
Show file tree
Hide file tree
Showing 90 changed files with 1,542 additions and 1,252 deletions.
37 changes: 28 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ If this works you are in business:
$ git clone git://github.com/cloudfoundry/uaa.git
$ cd uaa
$ ./gradlew run


The apps all work together with the apps running on the same port
(8080) as [`/uaa`](http://localhost:8080/uaa), [`/app`](http://localhost:8080/app) and [`/api`](http://localhost:8080/api).

Expand Down Expand Up @@ -110,15 +110,15 @@ requesting system information:
}
}

For complex requests it is more convenient to interact with UAA using
For complex requests it is more convenient to interact with UAA using
`uaac`, the [UAA Command Line Client](https://github.com/cloudfoundry/cf-uaac).

## Integration tests

You can run the integration tests with docker

$ run-integration-tests.sh <dbtype>

will create a docker container running uaa + ldap + database whereby integration tests are run against.

### Using Gradle to test with postgresql or mysql
Expand All @@ -128,7 +128,26 @@ The default uaa unit tests (./gradlew test integrationTest) use hsqldb.
To run the unit tests with docker:

$ run-unit-tests.sh <dbtype>


### To run a single test

Start by finding out which gradle project your test belongs to.
You can find all project by running

$ ./gradlew projects

Then you can run

$ ./gradlew :<project name>:test --tests <TestClass>.<MethodName>

or to run all tests in a Class

$ ./gradlew :<project name>:test --tests <TestClass>

You might want to use the full gradle command found at the bottom of
the `scripts/unit-tests.sh` script by prepending the project name to
the `test` command and adding the `--tests` option.

### Building war file

$ ./gradlew :clean :assemble -Pversion=${UAA_VERSION}
Expand All @@ -139,9 +158,9 @@ There are actually several projects here, the main `uaa` server application, a c

1. `uaa` a WAR project for easy deployment

2. `server` a JAR project containing the implementation of UAA's REST API (including [SCIM](http://www.simplecloud.info/)) and UI
2. `server` a JAR project containing the implementation of UAA's REST API (including [SCIM](http://www.simplecloud.info/)) and UI

3. `model` a JAR project used by both the client library and server
3. `model` a JAR project used by both the client library and server

4. `api` (sample) is an OAuth2 resource service which returns a mock list of deployed apps

Expand Down Expand Up @@ -192,6 +211,6 @@ Here are some ways for you to get involved in the community:
want to contribute code this way, please reference an existing issue
if there is one as well covering the specific issue you are
addressing. Always submit pull requests to the "develop" branch.
We strictly adhere to test driven development. We kindly ask that
We strictly adhere to test driven development. We kindly ask that
pull requests are accompanied with test cases that would be failing
if ran separately from the pull request.
if ran separately from the pull request.
152 changes: 69 additions & 83 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,40 @@ import java.nio.file.Files
import java.nio.file.Paths

buildscript {
apply from: "dependencies.gradle"
apply(from: "dependencies.gradle")

repositories {
mavenCentral()
jcenter()
maven {
url "https://repo.spring.io/plugins-release"
url("https://repo.spring.io/plugins-release")
}
}

dependencies {
classpath libraries.gradleCargoPlugin
classpath libraries.prodepsPlugin
classpath libraries.asciidoctorGradlePlugin
classpath libraries.springDependencyMgmtPlugin
classpath libraries.springBootGradlePlugin

classpath 'com.github.jengelman.gradle.plugins:shadow:6.0.0'
classpath(libraries.cargoGradlePlugin)
classpath(libraries.prodepsGradlePlugin)
classpath(libraries.asciidoctorGradlePlugin)
classpath(libraries.springDependencyMangementGradlePlugin)
classpath(libraries.springBootGradlePlugin)
}
}

apply(from: "dependencies.gradle")

def applicationPort = project.hasProperty('port') ? project.getProperty('port').toInteger() : 8080

apply from: "dependencies.gradle"
apply plugin: "com.bmuschko.cargo"
apply(plugin: "com.bmuschko.cargo")

allprojects {
apply plugin: "propdeps"
apply plugin: "propdeps-maven"
apply plugin: "propdeps-idea"
apply plugin: "io.spring.dependency-management"
apply(plugin: "propdeps")
apply(plugin: "propdeps-maven")
apply(plugin: "io.spring.dependency-management")

dependencyManagement {
imports {
mavenBom libraries.springBom
mavenBom libraries.springBootBom
mavenBom(libraries.springBom)
mavenBom(libraries.springBootBom)
}
}

Expand All @@ -47,51 +46,37 @@ allprojects {
repositories {
mavenCentral()
maven {
url "https://build.shibboleth.net/nexus/content/repositories/releases/"
url("https://build.shibboleth.net/nexus/content/repositories/releases/")
}
maven { url "https://repository.mulesoft.org/releases/" }
maven { url("https://repository.mulesoft.org/releases/") }
}
}




subprojects {
apply plugin: "java"
apply plugin: "checkstyle"

tasks.withType(Checkstyle) {
reports {
xml.enabled true
html.enabled true
if (project.hasProperty("checkstyleFail")) {
maxWarnings = 0
}
}
}
apply(plugin: "java")

configurations.all {
exclude group: "org.hamcrest", module: "hamcrest-all"
exclude group: "org.hamcrest", module: "hamcrest-core"
exclude group: "org.hamcrest", module: "hamcrest-library"
exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
exclude group: "org.apache.directory.server", module: "apacheds-core"
exclude group: "org.apache.directory.server", module: "apacheds-protocol-ldap"
exclude group: "org.skyscreamer", module: "jsonassert"
exclude group: "com.vaadin.external.google", module: "android-json"
exclude(group: "org.hamcrest", module: "hamcrest-all")
exclude(group: "org.hamcrest", module: "hamcrest-core")
exclude(group: "org.hamcrest", module: "hamcrest-library")
exclude(group: "org.springframework.boot", module: "spring-boot-starter-logging")
exclude(group: "org.apache.directory.server", module: "apacheds-core")
exclude(group: "org.apache.directory.server", module: "apacheds-protocol-ldap")
exclude(group: "org.skyscreamer", module: "jsonassert")
exclude(group: "com.vaadin.external.google", module: "android-json")
}

dependencies {
testCompile(libraries.springBootStarterTest)
testCompile libraries.hamcrest
testCompile(libraries.junit5JupiterApi)
testCompile(libraries.junit5JupiterParams)
testRuntime(libraries.junit5JupiterEngine)
testRuntime(libraries.junitVintageEngine)
testCompile libraries.unboundIdLdapSdk

compileOnly "org.projectlombok:lombok"
annotationProcessor "org.projectlombok:lombok"
testImplementation(libraries.springBootStarterTest)
testImplementation(libraries.hamcrest)
testImplementation(libraries.junit5JupiterApi)
testImplementation(libraries.junit5JupiterParams)
testRuntimeOnly(libraries.junit5JupiterEngine)
testRuntimeOnly(libraries.junitVintageEngine)
testImplementation(libraries.unboundIdLdapSdk)

compileOnly("org.projectlombok:lombok")
annotationProcessor("org.projectlombok:lombok")
}

[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:none", "-nowarn"]
Expand All @@ -105,8 +90,8 @@ subprojects {
jvmArgs += ["-Xmx1024m", "-XX:+StartAttachListener", "-XX:+HeapDumpOnOutOfMemoryError", "-XX:HeapDumpPath=/var/log/uaa-tests.hprof"]

testLogging {
events "skipped", "failed", "passed"
exceptionFormat "full"
events("skipped", "failed", "passed")
exceptionFormat("full")

// Uncomment the following line to see all standard output from tests (there's a ton of it!)
//showStandardStreams = true
Expand All @@ -118,8 +103,8 @@ subprojects {
useJUnitPlatform()

testLogging {
events "skipped", "failed", "passed"
exceptionFormat "full"
events("skipped", "failed", "passed")
exceptionFormat("full")

// Uncomment the following line to see all standard output from tests (there's a ton of it!)
//showStandardStreams = true
Expand All @@ -136,9 +121,9 @@ subprojects {
project {
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
name("The Apache Software License, Version 2.0")
url("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution("repo")
}
}
}
Expand All @@ -149,13 +134,13 @@ subprojects {
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
url("https://jitpack.io")
}
maven {
url "https://repo.spring.io/release"
url("https://repo.spring.io/release")
}
maven {
url "https://repo.maven.apache.org/maven2"
url("https://repo.maven.apache.org/maven2")
}
}
}
Expand Down Expand Up @@ -183,11 +168,12 @@ cargo {
configHomeDir = file(Paths.get(System.getProperty("java.io.tmpdir") + "/uaa-${applicationPort}"))
startStopTimeout = 540000
rmiPort = applicationPort + 10
List activeProfiles = System.getProperty("spring.profiles.active", "").split(",")
jvmArgs = "-DCLOUDFOUNDRY_CONFIG_PATH=" + file("scripts/cargo").getAbsolutePath() + " -Dlog4j.configurationFile=" + file("scripts/cargo/log4j2.properties").getAbsolutePath()
jvmArgs = String.format("%s -Dstatsd.enabled=true", jvmArgs)

if (activeProfiles.contains("debug")) {
jvmArgs = ""
jvmArgs = String.format("%s -DCLOUDFOUNDRY_CONFIG_PATH=%s", jvmArgs, file("scripts/cargo").getAbsolutePath())
jvmArgs = String.format("%s -Dlog4j.configurationFile=%s", jvmArgs, file("scripts/cargo/log4j2.properties").getAbsolutePath())
jvmArgs = String.format("%s -Dstatsd.enabled=true", jvmArgs)
if (System.getProperty("spring.profiles.active", "").split(',').contains("debug")) {
jvmArgs = String.format("%s -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005", jvmArgs)
}

Expand All @@ -198,19 +184,19 @@ cargo {
}

systemProperties {
property "SECRETS_DIR", System.getProperty("SECRETS_DIR", file("scripts/cargo").getAbsolutePath())
property "spring.profiles.active", System.getProperty("spring.profiles.active", "default")
property "metrics.perRequestMetrics", System.getProperty("metrics.perRequestMetrics", "true")
property "smtp.host", "localhost"
property "smtp.port", 2525
property("SECRETS_DIR", System.getProperty("SECRETS_DIR", file("scripts/cargo").getAbsolutePath()))
property("spring.profiles.active", System.getProperty("spring.profiles.active", "default"))
property("metrics.perRequestMetrics", System.getProperty("metrics.perRequestMetrics", "true"))
property("smtp.host", "localhost")
property("smtp.port", 2525)
}

containerProperties {
property 'cargo.tomcat.ajp.port', applicationPort + 20
property('cargo.tomcat.ajp.port', applicationPort + 20)
}

installer {
installUrl = "https://repo1.maven.org/maven2/org/apache/tomcat/tomcat/" + versions.tomcatVersion + "/tomcat-" + versions.tomcatVersion + ".tar.gz"
installUrl = "https://repo1.maven.org/maven2/org/apache/tomcat/tomcat/" + versions.tomcatCargoVersion + "/tomcat-" + versions.tomcatCargoVersion + ".tar.gz"
downloadDir = file("$buildDir/download")
extractDir = file("$buildDir/extract")
}
Expand All @@ -219,8 +205,8 @@ cargo {

project.gradle.taskGraph.whenReady { TaskExecutionGraph graph ->
project.allprojects.collect({ it.tasks.withType(Test) }).flatten().each {
it.systemProperty "spring.profiles.active", System.getProperty("spring.profiles.active", "default")
it.systemProperty "testId", System.getProperty("testId", "")
it.systemProperty("spring.profiles.active", System.getProperty("spring.profiles.active", "default"))
it.systemProperty("testId", System.getProperty("testId", ""))
}
}

Expand All @@ -229,7 +215,7 @@ task run(dependsOn: cargoRunLocal)

task manifests(dependsOn: assemble, type: Copy) {
from("uaa/src/test/resources/sample-manifests") {
include "**/*.yml"
include("**/*.yml")
filter(ReplaceTokens,
tokens: [
version : version,
Expand All @@ -238,11 +224,11 @@ task manifests(dependsOn: assemble, type: Copy) {
]
)
}
into "build/sample-manifests"
into("build/sample-manifests")
}

task cleanCargoConfDir {
delete file(System.getProperty("java.io.tmpdir") + "/cargo/uaa-${applicationPort}")
delete(file(System.getProperty("java.io.tmpdir") + "/cargo/uaa-${applicationPort}"))
try {
Files.createDirectory(Paths.get(System.getProperty("java.io.tmpdir") + "/uaa-${applicationPort}"))
} catch (ignored) {}
Expand All @@ -253,8 +239,8 @@ task integrationTest(type: Test, dependsOn: subprojects.integrationTest) {
}

// task dependencies
assemble.dependsOn subprojects.assemble
test.dependsOn subprojects.test
test.mustRunAfter integrationTest
cargoStartLocal.dependsOn assemble
cargoRunLocal.dependsOn cleanCargoConfDir, assemble
assemble.dependsOn(subprojects.assemble)
test.dependsOn(subprojects.test)
test.mustRunAfter(integrationTest)
cargoStartLocal.dependsOn(assemble)
cargoRunLocal.dependsOn(cleanCargoConfDir, assemble)
1 change: 0 additions & 1 deletion config/checkstyle/checkstyle.xml

This file was deleted.

Loading

0 comments on commit e25afa7

Please sign in to comment.