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

Migrated to th2 gradle plugin 0.0.6 #4

Merged
merged 6 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/build-dev-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ jobs:
createTag: true
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
3 changes: 2 additions & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ jobs:
createTag: true
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
3 changes: 2 additions & 1 deletion .github/workflows/build-sanpshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ jobs:
build-target: 'Docker'
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
4 changes: 2 additions & 2 deletions .github/workflows/ci-unwelcome-words.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Checkout tool
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: exactpro-th2/ci-github-action
ref: master
Expand Down
75 changes: 75 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# th2-cradle-admin 1.10.0

The th2-cradle-admin is a set of projects for managing books and pages in th2 storage.

## th2-cradle-admin-tool (th2 component)

The th2-cradle-admin-tool is th2 component which allows to manage books and pages via configuration automatically or via REST API manually

### Configuration

```yaml
apiVersion: th2.exactpro.com/v2
kind: Th2CoreBox
metadata:
name: cradle-admin
spec:
imageName: ghcr.io/th2-net/th2-cradle-admin-tool
imageVersion: 1.9.0-dev
type: th2-conn
customConfig:
ip: 0.0.0.0
port: 8080
page-recheck-interval: 60
auto-book: true
auto-pages:
test_book:
page-duration: "P1D"
page-start-time: "1970-00-00T00:00:00.000Z"
extendedSettings:
service:
enabled: true
ingress:
urlPaths:
- /cradle-admin/
```

### REST API

#### View

* `/get-all-books` - returns all existed books
* `/get-book-info?book-id=test_book&with-pages=false&load-removed-pages` - returns information by arguments:
* `book-id` - name (id) of requested book (required). You can specify multiple `book-id` arguments
* `with-pages` - controls respond information about pages (optional)
* `load-removed-pages` - this flag controls respond information about pages marked as removed (optional)

#### Book management

* `/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:
* `book-name` - name (id) of new book (required)
* `full-name` - extended book name (optional)
* `desc` - description for book (optional)
* `first-page-name` - name of the first page (optional). You can add page later

#### Page management

* `/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:
* `book-id` - name (id) where the new page will be created (required).
* `page-name` - name of the new page (optional). If you miss this argument, name is generated automatically
* `page-start` - start time of the new page (required)
* `page-comment` - comment for the new page (optional)
* `/remove-page?book-id=test_book&page-name=first_page` - removes a page by arguments:
* `book-id` - name (id) where the removed page is (required).
* `page-name` - name of the removed page (required).

## Release notes:

### 1.10.0-dev
* 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`
79 changes: 15 additions & 64 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
import com.github.jk1.license.filter.LicenseBundleNormalizer
import com.github.jk1.license.render.JsonReportRenderer

plugins {
id "org.owasp.dependencycheck" version "8.3.1"
id 'com.github.jk1.dependency-license-report' version '2.5'
id "de.undercouch.download" version "5.4.0"
id "com.exactpro.th2.gradle.base" version "0.0.6"
id "com.exactpro.th2.gradle.component" version "0.0.6" apply false
}

apply plugin: 'java'
apply plugin: 'application'


ext {
commonVersion = '5.8.0-dev'
cradleVersion = '5.2.0-dev'
commonVersion = '5.11.0-dev'
cradleVersion = '5.3.0-dev'
}

allprojects {
dependencyCheck {
suppressionFile = "suppressions.xml"
}

subprojects {
apply plugin: 'java'
apply plugin: 'application'

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
Expand All @@ -44,23 +38,17 @@ allprojects {
}

dependencies {
implementation(platform("com.exactpro.th2:bom:4.5.0"))
implementation "org.slf4j:slf4j-api"

implementation("com.exactpro.th2:common:$commonVersion") {
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
implementation "com.exactpro.th2:cradle-core:$cradleVersion"
implementation "com.exactpro.th2:cradle-cassandra:$cradleVersion"
implementation 'org.apache.commons:commons-lang3'
testImplementation 'org.mockito:mockito-inline:5.2.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.10.0'

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

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

testImplementation 'org.mockito:mockito-inline:5.2.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.10.0'
testImplementation 'com.exactpro.th2:junit-jupiter-integration:0.0.1-master-6956603819-5241ee5-SNAPSHOT'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
}

test {
Expand All @@ -78,41 +66,4 @@ allprojects {
showStandardStreams = true
}
}
}

dependencyLocking {
lockAllConfigurations()
}

dependencyCheck {
formats = ['SARIF', 'JSON', 'HTML']
failBuildOnCVSS = 5
suppressionFile = "suppressions.xml"

analyzers {
assemblyEnabled = false
nugetconfEnabled = false
nodeEnabled = false
}
}

licenseReport {
def licenseNormalizerBundlePath = "$buildDir/license-normalizer-bundle.json"

if (!file(licenseNormalizerBundlePath).exists()) {
download.run {
src 'https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/license-normalizer-bundle.json'
dest "$buildDir/license-normalizer-bundle.json"
overwrite false
}
}

filters = [
new LicenseBundleNormalizer(licenseNormalizerBundlePath, false)
]
renderers = [
new JsonReportRenderer('licenses.json', false),
]
excludeOwnGroup = false
allowedLicensesFile = new URL("https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/allowed-licenses.json")
}
}
42 changes: 16 additions & 26 deletions cradle-admin-tool-cli/build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
plugins {
id 'application'
}

dependencies {
implementation project(':cradle-admin-tool-core')

implementation project(':')
implementation 'commons-cli:commons-cli:1.4'
implementation("com.exactpro.th2:common:$commonVersion") {
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}

testImplementation project(':').sourceSets.test.output
}
implementation "com.exactpro.th2:cradle-core:$cradleVersion"
implementation "com.exactpro.th2:cradle-cassandra:$cradleVersion"

jar {
archivesBaseName = 'th2-cradle-admin-cli'
manifest {
attributes(
'Created-By': "${System.getProperty('java.version')} (${System.getProperty('java.vendor')})",
'Specification-Title': 'Cradle TH2 Admin tool (CLI)',
'Specification-Vendor': 'Exactpro Systems LLC',
'Implementation-Title': 'Cradle TH2 Admin tool (CLI)',
'Implementation-Vendor-Id': 'com.exactpro',
'Implementation-Version-Date': getDate(),
'Implementation-Version': project.version,
'Main-Class': 'com.exactpro.th2.cradle.adm.cli.Application',
"Class-Path": configurations.runtimeClasspath.collect { "lib/" + it.getName() }.join(' '))
}
implementation 'commons-cli:commons-cli:1.7.0'

testImplementation project(':cradle-admin-tool-test')
}

mainClassName = 'com.exactpro.th2.cradle.adm.cli.Application'
application {
mainClassName = 'com.exactpro.th2.cradle.adm.cli.Application'
}


tasks.register('release', Zip) {
Expand All @@ -34,10 +31,3 @@ tasks.register('release', Zip) {
from jar
}

static def getDate() {
def date = new Date()
def formattedDate = date.format('yyyy-MM-dd_HH:mm:ss.SSS')
return formattedDate
}


5 changes: 5 additions & 0 deletions cradle-admin-tool-core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dependencies {
implementation "com.exactpro.th2:cradle-core:$cradleVersion"
implementation "com.exactpro.th2:cradle-cassandra:$cradleVersion"
implementation 'org.apache.commons:commons-lang3'
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

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

import com.exactpro.cradle.CradleStorage;
import com.exactpro.th2.cradle.adm.results.SimpleResult;
import com.exactpro.cradle.CradleStorage;


public abstract class AbstractMode<T, K extends SimpleResult> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

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

import com.exactpro.th2.cradle.adm.results.BooksListInfo;
import com.exactpro.th2.cradle.adm.results.ResultBookInfo;
import com.exactpro.cradle.BookInfo;
import com.exactpro.cradle.utils.CradleStorageException;
import com.exactpro.th2.cradle.adm.params.GetAllBooksParams;
import com.exactpro.th2.cradle.adm.results.BooksListInfo;
import com.exactpro.th2.cradle.adm.results.ResultBookInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

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

import com.exactpro.th2.cradle.adm.results.BooksListInfo;
import com.exactpro.th2.cradle.adm.results.ResultBookDetailedInfo;
import com.exactpro.cradle.BookInfo;
import com.exactpro.cradle.PageInfo;
import com.exactpro.cradle.utils.CradleStorageException;
import com.exactpro.th2.cradle.adm.params.GetBookInfoParams;
import com.exactpro.th2.cradle.adm.results.BooksListInfo;
import com.exactpro.th2.cradle.adm.results.ResultBookDetailedInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.exactpro.th2.cradle.adm.modes;

import com.exactpro.th2.cradle.adm.results.BookSchemaInfo;
import com.exactpro.cradle.BookListEntry;
import com.exactpro.th2.cradle.adm.params.NoParams;
import com.exactpro.th2.cradle.adm.results.BookSchemaInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@

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

import com.exactpro.th2.cradle.adm.params.NewBookCreationParams;
import com.exactpro.th2.cradle.adm.results.SimpleResult;
import com.exactpro.th2.cradle.adm.params.NewBookCreationParams;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.time.Instant;
import java.util.UUID;


public class NewBookCreationMode extends AbstractMode<NewBookCreationParams, SimpleResult> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

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

import com.exactpro.th2.cradle.adm.params.NewPageParams;
import com.exactpro.th2.cradle.adm.results.SimpleResult;
import com.exactpro.th2.cradle.adm.params.NewPageParams;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

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

import com.exactpro.th2.cradle.adm.results.SimpleResult;
import com.exactpro.cradle.PageId;
import com.exactpro.cradle.PageInfo;
import com.exactpro.cradle.counters.Interval;
import com.exactpro.cradle.utils.CradleStorageException;
import com.exactpro.th2.cradle.adm.params.RemovePageParams;
import com.exactpro.th2.cradle.adm.results.SimpleResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

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

import com.exactpro.cradle.BookInfo;
import com.exactpro.cradle.PageInfo;
import com.exactpro.th2.cradle.adm.results.ResultBookInfo;
import com.exactpro.th2.cradle.adm.results.ResultPageInfo;
import com.exactpro.cradle.BookInfo;
import com.exactpro.cradle.PageInfo;

public class ResultConverter {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.exactpro.th2.cradle.adm.modes;

import com.exactpro.th2.cradle.adm.results.SimpleResult;
import com.exactpro.cradle.PageInfo;
import com.exactpro.th2.cradle.adm.params.UpdatePageParams;
import com.exactpro.th2.cradle.adm.results.SimpleResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Loading
Loading