Skip to content

Commit d6ba44f

Browse files
authoredMar 19, 2018
Switch to gradle (#12)
Switch to gradle
1 parent 535cd9a commit d6ba44f

File tree

38 files changed

+527
-893
lines changed

38 files changed

+527
-893
lines changed
 

‎.gitignore

+10-14
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,14 @@ atlassian-ide-plugin.xml
1616
**/webapp/css/styles.css
1717
platform/solr/**/overlays
1818

19-
# JMeter Related files to ignore
20-
jmeter.log
21-
*.jmx.log
22-
*.jtl
19+
.gradle
20+
**/build/
2321

24-
# Maven Ignores (https://raw.githubusercontent.com/github/gitignore/master/Maven.gitignore)
25-
target/
26-
pom.xml.tag
27-
pom.xml.releaseBackup
28-
pom.xml.versionsBackup
29-
pom.xml.next
30-
release.properties
31-
dependency-reduced-pom.xml
32-
buildNumber.properties
33-
.mvn/timing.properties
22+
# Ignore Gradle GUI config
23+
gradle-app.setting
24+
25+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
26+
!gradle-wrapper.jar
27+
28+
# Cache of project
29+
.gradletasknamecache

‎README.md

+63-55
Original file line numberDiff line numberDiff line change
@@ -9,76 +9,83 @@ SAML: https://wiki.oasis-open.org/security/FrontPage
99
ECP: http://docs.oasis-open.org/security/saml/Post2.0/saml-ecp/v2.0/saml-ecp-v2.0.html
1010

1111
## Setup
12-
To build the project, execute `mvn clean install -nsu` at the project root.
13-
The `distribution` module will contain a full package of the deployment after the build.
14-
Tests can be run with the script:
15-
16-
`<PATH_TO_PROJECT>/distribution/command-line/target/command-line-<VERSION>-bin/bin/samltest.sh`.
17-
18-
>NOTE
19-
>
20-
>In order for the test kit to execute properly, you must configure both
21-
the test kit's and your IdP's/SP's metadata, as well as implement plugins
12+
To build the project, execute `gradle build` at the project root.
13+
The `distribution/command-line` module will contain a full package of the deployment after the build.
14+
15+
Tests can be run with the `samlconf` script under `<PATH_TO_PROJECT>/distribution/command-line/build/distributions/samlconf-<VERSION>/bin/`.
16+
17+
The `samlconf` script takes multiple parameters:
18+
19+
```
20+
NAME
21+
samlconf - Runs the SAML Conformance Tests against an IdP or an SP
22+
23+
SYNOPSIS
24+
samlconf [-i path] [--idpMetadata path]
25+
[-p path] [--plugins path]
26+
27+
DESCRIPTION
28+
Runs the SAML Conformance Tests which tests the compliance of an IdP and/or an SP
29+
with the SAML Specifications. If a compliance issue is identified, a
30+
SAMLConformanceException will be thrown with an explanation of the error and a direct
31+
quote from the specification. All of the parameters are optional and if they are
32+
not provided, the default values will use DDF's parameters. All parameters must
33+
be given one time.
34+
35+
OPTIONS
36+
-i | --idpMetadata path
37+
The path to the IdP metadata. If it is not given, the default IdP metadata
38+
is /conf/idp-metadata.xml.
39+
40+
-p | --plugins path
41+
The path to the custom, server-specific plugin implementations. If it is not given,
42+
the default plugin directory is /plugins.
43+
```
44+
45+
46+
> NOTE
47+
>
48+
> In order for the test kit to execute properly, you must configure both the test kit's and your IdP's/SP's metadata, as well as implement plugins
2249
for the user-handled portions of SAML profiles. See "Metadata" and "Plugins" for instructions.
2350

2451
### Metadata
2552
* If testing an IdP:
26-
* **TODO** *This requires the user to rebuild and is not an optimal
27-
configuration solution. A solution that works with a pre-built artifact
28-
should be found.* Configure the test kit with your IdP's metadata by updating
29-
`<PATH_TO_PROJECT>/distribution/command-line/src/main/resources/idp-metadata.xml`
30-
prior to building.
31-
* Configure your IdP with the test kit's metadata from
32-
`<PATH_TO_PROJECT>/distribution/command-line/src/main/resources/test-sp-metadata.xml`.
53+
* Provide your IdP's metadata file path to the `samlconf` script using `-i` or `--idpMetadata`.
54+
* Configure your IdP with the test kit's SP metadata from
55+
`<PATH_TO_PROJECT>/distribution/command-line/src/main/resources/test-sp-metadata.xml`
56+
or `samlconf-1.0-SNAPSHOT/conf/test-sp-metadata.xml` from the distribution.
3357

34-
* **TODO** If testing an SP:
35-
* Place your SP's metadata into `sp-metadata.xml` under `<PATH_TO_PROJECT>/distribution/command-line/src/main/resources`.
36-
* Copy `test-idp-metadata.xml` under `<PATH_TO_PROJECT>/distribution/command-line/src/main/resources` into your SP.
58+
* **TODO - not implemented yet** If testing an SP:
59+
* Provide your SP's metadata file path to the `samlconf` script using `-s` or `--spMetadata`.
60+
* Configure your SP with the test kit's IdP metadata from
61+
`<PATH_TO_PROJECT>/distribution/command-line/src/main/resources/test-idp-metadata.xml`
62+
or `samlconf-1.0-SNAPSHOT/conf/test-idp-metadata.xml` from the distribution.
3763

3864
### Plugins
3965
**TODO** *describe how to implement plugins*
4066

41-
**TODO** *This requires the user to rebuild and is not an optimal configuration
42-
solution. A solution that works with a pre-built artifact should be found.*
43-
Place your plugins in `<PATH_TO_PROJECT>/distribution/command-line/target/command-line-<VERSION>-bin/plugins`.
67+
* Provide your plugins directory to the `samlconf` script using `-p` or `--plugins`.
4468

4569
### Docker
46-
To build a docker image, add `-P docker` to the build command. To run it, run:
47-
48-
`docker run --rm -it -v <IDP_METADATA_PATH>:/samlconf/conf/idp-metadata.xml --add-host "<HOST_NAME>:<IP>" codice/samlconf`
49-
50-
Where
51-
* `<IDP_METADATA_PATH>` is the path to the file containing the idp's metadata
52-
(anywhere on your local machine ex: `/tmp/idp.xml`)
53-
* `<HOST_NAME>` is the hostname the IdP is running on (for DDF, DDF's hostname)
54-
* `<IP>` is the machine's IP address
70+
To build a docker image, execute `gradle build docker`.
5571

56-
>NOTE
72+
> NOTE
5773
>
58-
>To run the tests using the `docker-compose.yml` file, run `docker-compose up`
59-
in the `/docker` module.
60-
61-
>NOTE
62-
>
63-
>If building throws a `Connect to localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused`
64-
error, go into docker settings &rarr; general &rarr; enable `Expose daemon to tcp://localhost:2375 without TLS`.
65-
66-
### Running Tests in IDE
67-
68-
Edit the run configuration of your tests to include the vm variables:
69-
70-
* `-Dsaml.plugin.deployDir=<PATH_TO_PROJECT>/distribution/command-line/target/command-line-<VERSION>-bin/plugins`
71-
* `-Didp.metadata=<PATH_TO_PROJECT>/distribution/command-line/src/main/resources/idp-metadata.xml`
72-
* todo `-Didp.metadata=<PATH_TO_PROJECT>/distribution/command-line/src/main/resources/sp-metadata.xml`
74+
> Docker is used exclusively for our Jenkins builds.
7375
7476
## Steps to Test DDF's IDP
75-
* Boot up DDF
76-
* Copy the contents of `test-sp-metadata.xml` under `...saml-conformance/distribution/command-line/src/main/resources` to `AdminConsole -> Security -> Configuration -> IdPServer -> SP Metadata`.
77-
* If not on localhost, copy DDF's IDP metadata from `https://<hostname>:<port>/services/saml/sso/metadata` to `idp-metadata.xml` under `...saml-conformance/distribution/command-line/src/main/resources`.
78-
* Run the tests through your IDE by setting the vm variables (see "Running Tests in IDE") or by invoking the `...saml-conformance/distribution/command-line/target/command-line-\[VERSION\]-bin/bin/samltest.sh` script.
77+
* Start DDF
78+
* Copy the contents of `test-sp-metadata.xml` to `AdminConsole -> Security -> Configuration -> IdPServer -> SP Metadata`.
79+
* If not on localhost, copy DDF's IDP metadata from `https://<hostname>:<port>/services/idp/login/metadata`
80+
to a file and pass that file to the `samlconf` script using `-i` or `--idpMetadata`.
81+
* Run `samlconf`.
7982

8083
## Steps to Test DDF's SP
81-
todo
84+
**TODO** * Start DDF
85+
* Copy the contents of `test-idp-metadata.xml` to `AdminConsole -> Security -> Configuration -> IdPClient -> IdP Metadata`.
86+
* If not on localhost, copy DDF's SP metadata from `https://<hostname>:<port>/services/saml/sso/metadata`
87+
to a file and pass that file to the `samlconf` script using `-s` or `--spMetadata`.
88+
* Run `samlconf`.
8289

8390
## Project Structure
8491
This section will briefly talk about the project structure.
@@ -87,7 +94,7 @@ This section will briefly talk about the project structure.
8794
This module contains all the test related modules: `idp`, `sp`, and `common`.
8895

8996
#### idp
90-
This module will contain all tests being written against a SAML IdP. The src directory of the module is organized by the SAML spec as follows:
97+
This module will contain all tests being written against a SAML IdP. The `src` directory of the module is organized by the SAML specification as follows:
9198
* Package: Based on Profile (i.e. WebSSO, Single Logout)
9299
* Class: Based on Binding (i.e. POST, REDIRECT, ARTIFACT)
93100
* Class: Based on Metadata
@@ -122,7 +129,8 @@ This module is the projects full package deployment consisting of: `command-line
122129
todo: check and elaborate on this&rarr; This module contains all the runtime elements including scripts, jars, and configurations.
123130

124131
#### docker
125-
todo: check this&rarr; This module contains the logic for building a docker image.
132+
This module contains the logic for building a docker image.
133+
To build this module you must run the docker task by executing `gradle build docker`.
126134

127135
#### suites
128136
This module contains the test suites.

‎build.gradle

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
buildscript {
2+
ext.kotlin_version='1.2.30'
3+
ext.gradle_docker_version='3.2.4'
4+
5+
repositories {
6+
jcenter()
7+
mavenCentral()
8+
}
9+
10+
dependencies {
11+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12+
classpath "com.bmuschko:gradle-docker-plugin:$gradle_docker_version"
13+
}
14+
}
15+
16+
plugins {
17+
id 'org.jetbrains.kotlin.jvm' version '1.2.30'
18+
}
19+
20+
description = 'SAML Conformance Test Kit'
21+
22+
project.ext {
23+
project_version='1.0-SNAPSHOT'
24+
kotlin_test_version='2.0.7'
25+
rest_assured_version='2.9.0'
26+
org_slf4j_version='1.7.1'
27+
junit_version='4.12'
28+
guava_version='24.0-jre'
29+
}
30+
31+
allprojects {
32+
group = 'org.codice.samlconf'
33+
version = "$project_version"
34+
}
35+
36+
subprojects {
37+
apply plugin: 'java'
38+
apply plugin: 'maven'
39+
apply plugin: 'kotlin-kapt'
40+
apply plugin: 'kotlin'
41+
apply plugin: 'com.bmuschko.docker-remote-api'
42+
43+
sourceCompatibility = 1.8
44+
targetCompatibility = 1.8
45+
46+
repositories {
47+
mavenLocal()
48+
mavenCentral()
49+
}
50+
51+
dependencies {
52+
compile "org.jetbrains.kotlin:kotlin-reflect"
53+
compile "junit:junit:$junit_version"
54+
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
55+
compile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
56+
compile "com.jayway.restassured:rest-assured:$rest_assured_version"
57+
compile "org.slf4j:slf4j-api:$org_slf4j_version"
58+
compile "com.google.guava:guava:$guava_version"
59+
}
60+
}
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apply plugin: 'application'
2+
3+
description = 'Script and CLI to run the tests.'
4+
5+
group = 'org.codice.samlconf.distribution'
6+
7+
applicationName = 'samlconf'
8+
9+
mainClassName = 'org.codice.ckt.CommandKt'
10+
11+
dependencies {
12+
compile project(':plugins:ddf-plugins')
13+
compile project(':library')
14+
compile project(':plugins:plugins-api')
15+
compile project(':test:common')
16+
compile project(':test:idp')
17+
compile project(':test:sp')
18+
compile project(':distribution:suites')
19+
20+
compile 'us.jimschubert:kopper-typed:0.0.3'
21+
}
22+
23+
applicationDistribution.from('src/main/resources/') {
24+
into 'conf'
25+
}
26+
27+
applicationDistribution.from(project(':plugins:ddf-plugins').file('build/libs')) {
28+
into 'plugins'
29+
}

‎distribution/command-line/pom.xml

-80
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.