Skip to content

Commit d3359e6

Browse files
Migrated to th2 gradle plugin 0.0.6 (#4)
* Migrated to th2 gradle plugin `0.0.6` * Updated: * bom: `4.6.1` * common: `5.11.0-dev` * cradle: `5.3.0-dev` * jetty: `9.4.54.v20240208` * commons-cli: `1.7.0`
1 parent fcd8a15 commit d3359e6

40 files changed

+159
-140
lines changed

Diff for: .github/workflows/build-dev-release.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ jobs:
1111
createTag: true
1212
docker-username: ${{ github.actor }}
1313
secrets:
14-
docker-password: ${{ secrets.GITHUB_TOKEN }}
14+
docker-password: ${{ secrets.GITHUB_TOKEN }}
15+
nvd-api-key: ${{ secrets.NVD_APIKEY }}

Diff for: .github/workflows/build-release.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ jobs:
1111
createTag: true
1212
docker-username: ${{ github.actor }}
1313
secrets:
14-
docker-password: ${{ secrets.GITHUB_TOKEN }}
14+
docker-password: ${{ secrets.GITHUB_TOKEN }}
15+
nvd-api-key: ${{ secrets.NVD_APIKEY }}

Diff for: .github/workflows/build-sanpshot.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ jobs:
1616
build-target: 'Docker'
1717
docker-username: ${{ github.actor }}
1818
secrets:
19-
docker-password: ${{ secrets.GITHUB_TOKEN }}
19+
docker-password: ${{ secrets.GITHUB_TOKEN }}
20+
nvd-api-key: ${{ secrets.NVD_APIKEY }}

Diff for: .github/workflows/ci-unwelcome-words.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ jobs:
77
test:
88
runs-on: ubuntu-20.04
99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1111
with:
1212
ref: ${{ github.sha }}
1313
- name: Checkout tool
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515
with:
1616
repository: exactpro-th2/ci-github-action
1717
ref: master

Diff for: README.md

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# th2-cradle-admin 1.10.0
2+
3+
The th2-cradle-admin is a set of projects for managing books and pages in th2 storage.
4+
5+
## th2-cradle-admin-tool (th2 component)
6+
7+
The th2-cradle-admin-tool is th2 component which allows to manage books and pages via configuration automatically or via REST API manually
8+
9+
### Configuration
10+
11+
```yaml
12+
apiVersion: th2.exactpro.com/v2
13+
kind: Th2CoreBox
14+
metadata:
15+
name: cradle-admin
16+
spec:
17+
imageName: ghcr.io/th2-net/th2-cradle-admin-tool
18+
imageVersion: 1.9.0-dev
19+
type: th2-conn
20+
customConfig:
21+
ip: 0.0.0.0
22+
port: 8080
23+
page-recheck-interval: 60
24+
auto-book: true
25+
auto-pages:
26+
test_book:
27+
page-duration: "P1D"
28+
page-start-time: "1970-00-00T00:00:00.000Z"
29+
extendedSettings:
30+
service:
31+
enabled: true
32+
ingress:
33+
urlPaths:
34+
- /cradle-admin/
35+
```
36+
37+
### REST API
38+
39+
#### View
40+
41+
* `/get-all-books` - returns all existed books
42+
* `/get-book-info?book-id=test_book&with-pages=false&load-removed-pages` - returns information by arguments:
43+
* `book-id` - name (id) of requested book (required). You can specify multiple `book-id` arguments
44+
* `with-pages` - controls respond information about pages (optional)
45+
* `load-removed-pages` - this flag controls respond information about pages marked as removed (optional)
46+
47+
#### Book management
48+
49+
* `/new-book?book-name=test_book&created-time=1970-00-00T00:00:00.000Z&full-name=test_book&desc=first_book&first-page-name=first_page` - creates new a book by arguments:
50+
* `book-name` - name (id) of new book (required)
51+
* `full-name` - extended book name (optional)
52+
* `desc` - description for book (optional)
53+
* `first-page-name` - name of the first page (optional). You can add page later
54+
55+
#### Page management
56+
57+
* `/new-page?book-id=test_book&page-name=first_page&page-start=1970-00-00T00:00:00.000Z&page-comment=my_first_page` - crates a new page by arguments:
58+
* `book-id` - name (id) where the new page will be created (required).
59+
* `page-name` - name of the new page (optional). If you miss this argument, name is generated automatically
60+
* `page-start` - start time of the new page (required)
61+
* `page-comment` - comment for the new page (optional)
62+
* `/remove-page?book-id=test_book&page-name=first_page` - removes a page by arguments:
63+
* `book-id` - name (id) where the removed page is (required).
64+
* `page-name` - name of the removed page (required).
65+
66+
## Release notes:
67+
68+
### 1.10.0-dev
69+
* Migrated to th2 gradle plugin `0.0.6`
70+
* Updated:
71+
* bom: `4.6.1`
72+
* common: `5.11.0-dev`
73+
* cradle: `5.3.0-dev`
74+
* jetty: `9.4.54.v20240208`
75+
* commons-cli: `1.7.0`

Diff for: build.gradle

+17-64
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
1-
import com.github.jk1.license.filter.LicenseBundleNormalizer
2-
import com.github.jk1.license.render.JsonReportRenderer
3-
41
plugins {
5-
id "org.owasp.dependencycheck" version "8.3.1"
6-
id 'com.github.jk1.dependency-license-report' version '2.5'
7-
id "de.undercouch.download" version "5.4.0"
2+
id "com.exactpro.th2.gradle.base" version "0.0.6"
3+
id "com.exactpro.th2.gradle.component" version "0.0.6" apply false
84
}
95

10-
apply plugin: 'java'
11-
apply plugin: 'application'
12-
13-
146
ext {
15-
commonVersion = '5.8.0-dev'
16-
cradleVersion = '5.2.0-dev'
7+
commonVersion = '5.11.0-dev'
8+
cradleVersion = '5.3.0-dev'
179
}
1810

19-
allprojects {
11+
dependencyCheck {
12+
suppressionFile = "suppressions.xml"
13+
}
2014

15+
subprojects {
2116
apply plugin: 'java'
22-
apply plugin: 'application'
2317

2418
sourceCompatibility = JavaVersion.VERSION_11
2519
targetCompatibility = JavaVersion.VERSION_11
@@ -44,23 +38,19 @@ allprojects {
4438
}
4539

4640
dependencies {
47-
implementation(platform("com.exactpro.th2:bom:4.5.0"))
41+
implementation "org.slf4j:slf4j-api"
4842

49-
implementation("com.exactpro.th2:common:$commonVersion") {
50-
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
51-
}
52-
implementation "com.exactpro.th2:cradle-core:$cradleVersion"
53-
implementation "com.exactpro.th2:cradle-cassandra:$cradleVersion"
54-
implementation 'org.apache.commons:commons-lang3'
43+
testImplementation 'org.mockito:mockito-inline:5.2.0'
44+
testImplementation 'org.mockito:mockito-junit-jupiter:5.10.0'
5545

56-
implementation "org.slf4j:slf4j-api"
46+
testImplementation 'com.exactpro.th2:junit-jupiter-integration:0.0.1'
5747

5848
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
59-
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
6049

61-
testImplementation 'org.mockito:mockito-inline:5.2.0'
62-
testImplementation 'org.mockito:mockito-junit-jupiter:5.10.0'
63-
testImplementation 'com.exactpro.th2:junit-jupiter-integration:0.0.1-master-6956603819-5241ee5-SNAPSHOT'
50+
testRuntimeOnly('org.junit.platform:junit-platform-launcher') {
51+
because 'This artifact will not be added automatically since gradle 9.0. You can read more information here:' +
52+
'https://docs.gradle.org/8.3/userguide/upgrading_version_8.html#test_framework_implementation_dependencies'
53+
}
6454
}
6555

6656
test {
@@ -78,41 +68,4 @@ allprojects {
7868
showStandardStreams = true
7969
}
8070
}
81-
}
82-
83-
dependencyLocking {
84-
lockAllConfigurations()
85-
}
86-
87-
dependencyCheck {
88-
formats = ['SARIF', 'JSON', 'HTML']
89-
failBuildOnCVSS = 5
90-
suppressionFile = "suppressions.xml"
91-
92-
analyzers {
93-
assemblyEnabled = false
94-
nugetconfEnabled = false
95-
nodeEnabled = false
96-
}
97-
}
98-
99-
licenseReport {
100-
def licenseNormalizerBundlePath = "$buildDir/license-normalizer-bundle.json"
101-
102-
if (!file(licenseNormalizerBundlePath).exists()) {
103-
download.run {
104-
src 'https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/license-normalizer-bundle.json'
105-
dest "$buildDir/license-normalizer-bundle.json"
106-
overwrite false
107-
}
108-
}
109-
110-
filters = [
111-
new LicenseBundleNormalizer(licenseNormalizerBundlePath, false)
112-
]
113-
renderers = [
114-
new JsonReportRenderer('licenses.json', false),
115-
]
116-
excludeOwnGroup = false
117-
allowedLicensesFile = new URL("https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/allowed-licenses.json")
118-
}
71+
}

Diff for: cradle-admin-tool-cli/build.gradle

+16-26
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
1+
plugins {
2+
id 'application'
3+
}
4+
15
dependencies {
6+
implementation project(':cradle-admin-tool-core')
27

3-
implementation project(':')
4-
implementation 'commons-cli:commons-cli:1.4'
8+
implementation("com.exactpro.th2:common:$commonVersion") {
9+
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
10+
}
511

6-
testImplementation project(':').sourceSets.test.output
7-
}
12+
implementation "com.exactpro.th2:cradle-core:$cradleVersion"
13+
implementation "com.exactpro.th2:cradle-cassandra:$cradleVersion"
814

9-
jar {
10-
archivesBaseName = 'th2-cradle-admin-cli'
11-
manifest {
12-
attributes(
13-
'Created-By': "${System.getProperty('java.version')} (${System.getProperty('java.vendor')})",
14-
'Specification-Title': 'Cradle TH2 Admin tool (CLI)',
15-
'Specification-Vendor': 'Exactpro Systems LLC',
16-
'Implementation-Title': 'Cradle TH2 Admin tool (CLI)',
17-
'Implementation-Vendor-Id': 'com.exactpro',
18-
'Implementation-Version-Date': getDate(),
19-
'Implementation-Version': project.version,
20-
'Main-Class': 'com.exactpro.th2.cradle.adm.cli.Application',
21-
"Class-Path": configurations.runtimeClasspath.collect { "lib/" + it.getName() }.join(' '))
22-
}
15+
implementation 'commons-cli:commons-cli:1.7.0'
16+
17+
testImplementation project(':cradle-admin-tool-test')
2318
}
2419

25-
mainClassName = 'com.exactpro.th2.cradle.adm.cli.Application'
20+
application {
21+
mainClassName = 'com.exactpro.th2.cradle.adm.cli.Application'
22+
}
2623

2724

2825
tasks.register('release', Zip) {
@@ -34,10 +31,3 @@ tasks.register('release', Zip) {
3431
from jar
3532
}
3633

37-
static def getDate() {
38-
def date = new Date()
39-
def formattedDate = date.format('yyyy-MM-dd_HH:mm:ss.SSS')
40-
return formattedDate
41-
}
42-
43-

Diff for: cradle-admin-tool-core/build.gradle

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dependencies {
2+
implementation "com.exactpro.th2:cradle-core:$cradleVersion"
3+
implementation "com.exactpro.th2:cradle-cassandra:$cradleVersion"
4+
implementation 'org.apache.commons:commons-lang3'
5+
}

Diff for: src/main/java/com/exactpro/th2/cradle/adm/modes/AbstractMode.java renamed to cradle-admin-tool-core/src/main/java/com/exactpro/th2/cradle/adm/modes/AbstractMode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package com.exactpro.th2.cradle.adm.modes;
1818

19-
import com.exactpro.cradle.CradleStorage;
2019
import com.exactpro.th2.cradle.adm.results.SimpleResult;
20+
import com.exactpro.cradle.CradleStorage;
2121

2222

2323
public abstract class AbstractMode<T, K extends SimpleResult> {

Diff for: src/main/java/com/exactpro/th2/cradle/adm/modes/GetAllBooksMode.java renamed to cradle-admin-tool-core/src/main/java/com/exactpro/th2/cradle/adm/modes/GetAllBooksMode.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
package com.exactpro.th2.cradle.adm.modes;
1818

19+
import com.exactpro.th2.cradle.adm.results.BooksListInfo;
20+
import com.exactpro.th2.cradle.adm.results.ResultBookInfo;
1921
import com.exactpro.cradle.BookInfo;
2022
import com.exactpro.cradle.utils.CradleStorageException;
2123
import com.exactpro.th2.cradle.adm.params.GetAllBooksParams;
22-
import com.exactpro.th2.cradle.adm.results.BooksListInfo;
23-
import com.exactpro.th2.cradle.adm.results.ResultBookInfo;
2424
import org.slf4j.Logger;
2525
import org.slf4j.LoggerFactory;
2626

Diff for: src/main/java/com/exactpro/th2/cradle/adm/modes/GetBookInfoMode.java renamed to cradle-admin-tool-core/src/main/java/com/exactpro/th2/cradle/adm/modes/GetBookInfoMode.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
package com.exactpro.th2.cradle.adm.modes;
1818

19+
import com.exactpro.th2.cradle.adm.results.BooksListInfo;
20+
import com.exactpro.th2.cradle.adm.results.ResultBookDetailedInfo;
1921
import com.exactpro.cradle.BookInfo;
2022
import com.exactpro.cradle.PageInfo;
2123
import com.exactpro.cradle.utils.CradleStorageException;
2224
import com.exactpro.th2.cradle.adm.params.GetBookInfoParams;
23-
import com.exactpro.th2.cradle.adm.results.BooksListInfo;
24-
import com.exactpro.th2.cradle.adm.results.ResultBookDetailedInfo;
2525
import org.slf4j.Logger;
2626
import org.slf4j.LoggerFactory;
2727

Diff for: src/main/java/com/exactpro/th2/cradle/adm/modes/ListAllBookSchemasMode.java renamed to cradle-admin-tool-core/src/main/java/com/exactpro/th2/cradle/adm/modes/ListAllBookSchemasMode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package com.exactpro.th2.cradle.adm.modes;
22

3+
import com.exactpro.th2.cradle.adm.results.BookSchemaInfo;
34
import com.exactpro.cradle.BookListEntry;
45
import com.exactpro.th2.cradle.adm.params.NoParams;
5-
import com.exactpro.th2.cradle.adm.results.BookSchemaInfo;
66
import org.slf4j.Logger;
77
import org.slf4j.LoggerFactory;
88

Diff for: src/main/java/com/exactpro/th2/cradle/adm/modes/NewBookCreationMode.java renamed to cradle-admin-tool-core/src/main/java/com/exactpro/th2/cradle/adm/modes/NewBookCreationMode.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@
1616

1717
package com.exactpro.th2.cradle.adm.modes;
1818

19-
import com.exactpro.th2.cradle.adm.params.NewBookCreationParams;
2019
import com.exactpro.th2.cradle.adm.results.SimpleResult;
20+
import com.exactpro.th2.cradle.adm.params.NewBookCreationParams;
2121
import org.slf4j.Logger;
2222
import org.slf4j.LoggerFactory;
2323

2424
import java.time.Instant;
25-
import java.util.UUID;
2625

2726

2827
public class NewBookCreationMode extends AbstractMode<NewBookCreationParams, SimpleResult> {

Diff for: src/main/java/com/exactpro/th2/cradle/adm/modes/NewPageCreationMode.java renamed to cradle-admin-tool-core/src/main/java/com/exactpro/th2/cradle/adm/modes/NewPageCreationMode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package com.exactpro.th2.cradle.adm.modes;
1818

19-
import com.exactpro.th2.cradle.adm.params.NewPageParams;
2019
import com.exactpro.th2.cradle.adm.results.SimpleResult;
20+
import com.exactpro.th2.cradle.adm.params.NewPageParams;
2121
import org.slf4j.Logger;
2222
import org.slf4j.LoggerFactory;
2323

Diff for: src/main/java/com/exactpro/th2/cradle/adm/modes/RemovePageMode.java renamed to cradle-admin-tool-core/src/main/java/com/exactpro/th2/cradle/adm/modes/RemovePageMode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
package com.exactpro.th2.cradle.adm.modes;
1818

19+
import com.exactpro.th2.cradle.adm.results.SimpleResult;
1920
import com.exactpro.cradle.PageId;
2021
import com.exactpro.cradle.PageInfo;
2122
import com.exactpro.cradle.counters.Interval;
2223
import com.exactpro.cradle.utils.CradleStorageException;
2324
import com.exactpro.th2.cradle.adm.params.RemovePageParams;
24-
import com.exactpro.th2.cradle.adm.results.SimpleResult;
2525
import org.slf4j.Logger;
2626
import org.slf4j.LoggerFactory;
2727

Diff for: src/main/java/com/exactpro/th2/cradle/adm/modes/ResultConverter.java renamed to cradle-admin-tool-core/src/main/java/com/exactpro/th2/cradle/adm/modes/ResultConverter.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
package com.exactpro.th2.cradle.adm.modes;
1818

19-
import com.exactpro.cradle.BookInfo;
20-
import com.exactpro.cradle.PageInfo;
2119
import com.exactpro.th2.cradle.adm.results.ResultBookInfo;
2220
import com.exactpro.th2.cradle.adm.results.ResultPageInfo;
21+
import com.exactpro.cradle.BookInfo;
22+
import com.exactpro.cradle.PageInfo;
2323

2424
public class ResultConverter {
2525

0 commit comments

Comments
 (0)