Skip to content

Commit

Permalink
corrected after review
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita-Smirnov-Exactpro committed Sep 25, 2023
1 parent 43e6808 commit e34f998
Show file tree
Hide file tree
Showing 8 changed files with 196 additions and 191 deletions.
20 changes: 4 additions & 16 deletions cradle-admin-tool-http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ Service which allows user to manage books/pages via RestAPI requests.
- **ip** - host where http cradle admin instance will be instanciated. Default value: `0.0.0.0`
- **port** - port on which http server will listen user requests. Default value: `8080`
- **page-recheck-interval** - interval in seconds which `PageManager` service checks if new page is required to create or not based on duration values presented in `auto-pages`. Default value: 60 seconds
- **auto-books** - defines rule for automatic books creation. If empty no books will be created automatically. Default value: `empty_map`.
- **book-creation-time** - book creation time. Default value is current time.
- **book-full-name** - book full name. Default value is book name
- **book-description** - book description. Default value is `auto-book`
- **auto-pages** - defines rule for automatic pages creation for multiple books. If empty no pages will be created automatically. Default value: `empty_map`.
- **auto-book** - if `true` than cradle-admin-tool creates books with first page for each value from `auto-pages` option when target book doesn't exist in cradle.
Creation book time is calculate by the `current time - 1 day` formula to cover events and messages published a bit earlier than cradle-admin-tool started. Please note you can create your own book via REST API later.
- **auto-pages** - defines rule for automatic pages creation for multiple books. If empty no pages will be created automatically. Default value: `false`.
- **page-duration** - defines duration of the page for the book. Value uses the Java Duration format. You can read more about it [here](https://docs.oracle.com/javase/8/docsT/api/java/time/Duration.html#parse-java.lang.CharSequence-).
- **page-start-time** - baseline date and time for every new page created by `PageManager` for this book.

Expand All @@ -33,17 +31,7 @@ spec:
custom-config:
ip: 198.168.0.2
port: 8080
auto-book:
book1:
book-creation-time: 2023-03-27T12:00:00
book-full-name: book1-full-name
book-description: book1-description
book2:
book-creation-time: 2023-03-27T12:00:00
book-full-name: book1-full-name
book3:
book-creation-time: 2023-03-27T12:00:00
book4:
auto-book: true
auto-pages:
book1:
page-duration: PT60S
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ public static void main(String[] args) {
httpServer.run();
resources.add(httpServer);

AutoBookUtils.createBooks(storage, config.getAutoBooks());

resources.add(
new PageManager(
storage,
config.isAutoBook(),
config.getAutoPages(),
config.getPageRecheckInterval(),
settings.calculatePageActionRejectionThreshold() * 2
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.exactpro.th2.cradle.adm.http;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.time.Duration;
import java.time.Instant;

Expand All @@ -34,4 +35,12 @@ public Duration getPageDuration() {
public Instant getPageStartTime() {
return pageStartTime;
}

public void setPageDuration(Duration pageDuration) {
this.pageDuration = pageDuration;
}

public void setPageStartTime(Instant pageStartTime) {
this.pageStartTime = pageStartTime;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public class Configuration {
@JsonProperty("page-recheck-interval")
private int pageRecheckInterval = DEFAULT_PAGE_RECHECK_INTERVAL_SEC;

@JsonProperty("auto-books")
private Map<String, AutoBookConfiguration> autoBooks = Collections.emptyMap();
@JsonProperty("auto-book")
private boolean autoBook = false;

@JsonProperty("auto-pages")
private Map<String, AutoPageConfiguration> autoPages = Collections.emptyMap();
Expand All @@ -51,8 +51,8 @@ public int getPort() {
return port;
}

public Map<String, AutoBookConfiguration> getAutoBooks() {
return autoBooks;
public boolean isAutoBook() {
return autoBook;
}

public Map<String, AutoPageConfiguration> getAutoPages() {
Expand Down
Loading

0 comments on commit e34f998

Please sign in to comment.