Skip to content

Commit

Permalink
[Th2-5165] Cradle API uses page day cache (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita-Smirnov-Exactpro authored Mar 11, 2024
1 parent ff8091b commit 8f39015
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 15 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Lightweight data provider (2.6.0)
# Lightweight data provider (2.7.0)

# Overview
This component serves as a data provider for [th2-data-services](https://github.com/th2-net/th2-data-services). It will connect to the cassandra database via [cradle api](https://github.com/th2-net/cradleapi) and expose the data stored in there as REST resources.
Expand Down Expand Up @@ -224,6 +224,11 @@ spec:
# Release notes:
## 2.7.0
+ Updated cradle api: `5.2.0-dev`
+ Updated common: `5.8.0-dev`

## 2.6.0

+ Add download task endpoints:
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ plugins {

ext {
dockerImageVersion = release_version
cradleApiVersion = '5.1.4-dev'
cradleApiVersion = '5.2.0-dev'
javalin = '5.4.2'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ group 'com.exactpro.th2'
version release_version

ext {
commonVersion = '5.7.1-dev'
commonVersion = '5.8.0-dev'
}

sourceCompatibility = 11
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

kotlin.code.style=official

release_version=2.6.0
release_version=2.7.0
description='th2 Lightweight data provider component'
vcs_url=https://github.com/th2-net/th2-lw-data-provider
docker_image_name=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ internal class TestCradleMessageExtractor {
StoredGroupedMessageBatch(
TEST_SESSION_GROUP,
incorrectMessages,
PageId(BookId("test-book"), "test-page"),
PageId(BookId("test-book"), Instant.now(), "test-page"),
Instant.now(),
)
)
Expand Down Expand Up @@ -383,7 +383,7 @@ internal class TestCradleMessageExtractor {
StoredGroupedMessageBatch(
TEST_SESSION_GROUP,
incorrectMessages,
PageId(BookId("test-book"), "test-page"),
PageId(BookId("test-book"), Instant.now(), "test-page"),
now,
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ import org.junit.jupiter.api.*
import org.mockito.invocation.InvocationOnMock
import org.mockito.kotlin.*
import strikt.api.Assertion
import strikt.api.ExpectationBuilder
import strikt.api.expectCatching
import strikt.assertions.isNotNull
import java.time.Instant
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.Executors
import java.util.concurrent.Semaphore
Expand Down Expand Up @@ -273,6 +273,7 @@ abstract class AbstractHttpHandlerTest<T : JavalinHandler> {
const val BOOK_NAME =
"test" //TODO: Move to the CradleTestUtil and use in CradleTestUtil.createCradleStoredMessage and all cases where the method used
const val PAGE_NAME = "test-page"
val PAGE_TIMESTAMP = Instant.now()
const val SESSION_GROUP = "test-session-group"
const val SESSION_ALIAS = "test-session-alias"
const val MESSAGE_TYPE = "test-message-type"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ internal class TestGetMessageGroupsServletTransportMode : AbstractHttpHandlerTes
timestamp = messageTimestamp,
)
),
PageId(BookId(BOOK_NAME), PAGE_NAME),
PageId(BookId(BOOK_NAME), PAGE_TIMESTAMP, PAGE_NAME),
Instant.now(),
)

Expand Down Expand Up @@ -176,7 +176,7 @@ internal class TestGetMessageGroupsServletTransportMode : AbstractHttpHandlerTes
timestamp = messageTimestamp,
)
),
PageId(BookId(BOOK_NAME), PAGE_NAME),
PageId(BookId(BOOK_NAME), PAGE_TIMESTAMP, PAGE_NAME),
Instant.now(),
)

Expand Down Expand Up @@ -241,7 +241,7 @@ internal class TestGetMessageGroupsServletTransportMode : AbstractHttpHandlerTes
timestamp = messageTimestamp,
)
),
PageId(BookId(BOOK_NAME), PAGE_NAME),
PageId(BookId(BOOK_NAME), PAGE_TIMESTAMP, PAGE_NAME),
Instant.now(),
)
doReturn(ImmutableListCradleResult(emptyList<StoredMessage>())).whenever(storage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ fun createPageInfo(
updated: Boolean = false,
removed: Boolean = false,
): PageInfo = PageInfo(
PageId(BookId("test"), pageName),
started,
PageId(BookId("test"), started, pageName),
ended,
"test comment for $pageName",
if (updated) started else null,
Expand Down Expand Up @@ -145,7 +144,7 @@ fun createBatches(
StoredGroupedMessageBatch(
group,
messageGenerator.take(messagesPerBatch).toList(),
PageId(BookId("test-book"), "test-page"),
PageId(BookId("test-book"), Instant.now(), "test-page"),
timestamp ?: Instant.now(),
)
)
Expand Down Expand Up @@ -199,7 +198,7 @@ fun createBatches(
incSeconds = increase,
end,
),
PageId(BookId("test-book"), "test-page"),
PageId(BookId("test-book"), Instant.now(), "test-page"),
Instant.now(),
)
)
Expand All @@ -218,7 +217,7 @@ fun GroupBatch(group: String, book: String? = "test", messages: Collection<Store
StoredGroupedMessageBatch(
group,
messages,
PageId(BookId(book), "test-page-${System.currentTimeMillis()}"),
PageId(BookId(book), Instant.now(), "test-page-${System.currentTimeMillis()}"),
Instant.now(),
)

Expand Down

0 comments on commit 8f39015

Please sign in to comment.