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

[Java] rework event module #63

Merged
merged 95 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
3ffecf2
chore: ignore vscode path
arifBurakDemiray Sep 18, 2023
4397867
feat: module events
arifBurakDemiray Sep 18, 2023
abd616c
feat: new constructor for EventImpl
arifBurakDemiray Sep 18, 2023
d42571c
feat: new way of events module call
arifBurakDemiray Sep 18, 2023
6e1b263
feat: module events
arifBurakDemiray Sep 18, 2023
906d346
fix: update version to 23.8.0
arifBurakDemiray Sep 19, 2023
a867c1b
Merge pull request #61 from Countly/staging
arifBurakDemiray Sep 19, 2023
2b2ae27
Merge pull request #62 from Countly/update_version
arifBurakDemiray Sep 19, 2023
44dabe0
Merge branch 'remake_events_module' of https://github.com/Countly/cou…
arifBurakDemiray Sep 19, 2023
92c6041
feat: events module to sdk core
arifBurakDemiray Sep 19, 2023
18782df
feat: end event deatiled
arifBurakDemiray Sep 19, 2023
8bd5a24
feat: init check to events call
arifBurakDemiray Sep 19, 2023
a094d0b
feat: event impl queue to store it in the future
arifBurakDemiray Sep 19, 2023
70b2519
refactor: format and add java 8 way refactorings
arifBurakDemiray Sep 19, 2023
51255a3
refactor: deprecate session events and add new way of event addind
arifBurakDemiray Sep 19, 2023
998e08b
feat: add deprecated changelog
arifBurakDemiray Sep 19, 2023
1046cbd
feat: add deprecated call for event
arifBurakDemiray Sep 19, 2023
5f85c58
feat: map in a beauty way,
arifBurakDemiray Sep 19, 2023
661e8c5
feat: info logs
arifBurakDemiray Sep 19, 2023
07b2551
feat: timed events additionb
arifBurakDemiray Sep 19, 2023
cdf08d0
Merge pull request #64 from Countly/staging
arifBurakDemiray Sep 19, 2023
ffb893c
fix: remove unnecesaary check
arifBurakDemiray Sep 19, 2023
aa16aea
Merge branch 'remake_events_module' of https://github.com/Countly/cou…
arifBurakDemiray Sep 19, 2023
5d94375
feat: remove unnecessary check
arifBurakDemiray Sep 19, 2023
10b113d
fix: add correct param
arifBurakDemiray Sep 19, 2023
558b350
feat: migarete cly to County logs
arifBurakDemiray Sep 19, 2023
95ace1b
revert: Countly to Cly
arifBurakDemiray Sep 19, 2023
d147821
feat: log infos
arifBurakDemiray Sep 19, 2023
db613c5
revert: remove logs to anoother pr
arifBurakDemiray Sep 19, 2023
3e27845
feat: add deprecation
arifBurakDemiray Sep 19, 2023
d03d186
feat: push util func to utils class
arifBurakDemiray Sep 19, 2023
14c3ec8
feat: tests for new util
arifBurakDemiray Sep 19, 2023
ca4e7af
feat: convert string to object
arifBurakDemiray Sep 20, 2023
5bcebf9
feat: util funcs
arifBurakDemiray Sep 20, 2023
cd9b8e9
feat: tests for util and serialization
arifBurakDemiray Sep 20, 2023
a77a9a6
chore: reevert
arifBurakDemiray Sep 20, 2023
66b7f27
Merge pull request #67 from Countly/change_segmentation_type
arifBurakDemiray Sep 20, 2023
f687994
feat: usage of util send obj segm
arifBurakDemiray Sep 20, 2023
ea83105
fix: merge issue
arifBurakDemiray Sep 20, 2023
ecfcf1a
Merge pull request #68 from Countly/migrate_old_logs
arifBurakDemiray Sep 20, 2023
3e93ed6
fix: undo merge conflict changes
arifBurakDemiray Sep 20, 2023
5e406bf
feat: new util string joiner
arifBurakDemiray Sep 20, 2023
bdcdf63
feat: new sdk storage way of events
arifBurakDemiray Sep 20, 2023
d9ad1fc
feat: new way of event add
arifBurakDemiray Sep 20, 2023
a724792
feat: expose target folder to used by other inner classes
arifBurakDemiray Sep 20, 2023
3136e45
feat: default param for sum and dur
arifBurakDemiray Sep 20, 2023
5f01f54
feat: delete unnecesary mapping
arifBurakDemiray Sep 20, 2023
1ee02ae
feat: string joiner and test
arifBurakDemiray Sep 20, 2023
dbb8736
fix: remove unnecessary call
arifBurakDemiray Sep 20, 2023
cc957ef
feat: reorder events to usage in scheduled
arifBurakDemiray Sep 20, 2023
cc25f6e
chore: remove unnecessary log
arifBurakDemiray Sep 20, 2023
62a041f
fix: reorder recordEvent param
arifBurakDemiray Sep 20, 2023
807326e
feat: remove unnecessary funcs and add comment tests
arifBurakDemiray Sep 21, 2023
9cbcf8f
doc: add utils comments
arifBurakDemiray Sep 21, 2023
4645b7b
feat: serialize deserialize test
arifBurakDemiray Sep 21, 2023
e19c909
Merge pull request #71 from Countly/change_segmentation_type
arifBurakDemiray Sep 21, 2023
d2b4074
fix: remove unnecessary util func
arifBurakDemiray Sep 21, 2023
74ca0c8
fix: ctx t config
arifBurakDemiray Sep 21, 2023
9b0c554
Merge branch 'staging' into remake_events_module
ArtursKadikis Sep 21, 2023
fe18de5
fix: revert default params
arifBurakDemiray Sep 21, 2023
3a498d0
Merge branch 'staging' into remake_events_module
arifBurakDemiray Sep 21, 2023
ce02883
fix: semicolon
arifBurakDemiray Sep 21, 2023
65d21bf
fix: use mutable version of instances
arifBurakDemiray Sep 21, 2023
d05dda9
fix: change to lf
arifBurakDemiray Sep 21, 2023
fcd0080
feat: read file content util and test
arifBurakDemiray Sep 21, 2023
da65f86
feat: get current event queue test util
arifBurakDemiray Sep 21, 2023
77df326
feat: test utils to get last item and return event impl1
arifBurakDemiray Sep 21, 2023
cb4aac4
feat: restore event queue when starting event module1
arifBurakDemiray Sep 21, 2023
444c5a0
feat: use restoore
arifBurakDemiray Sep 21, 2023
5a50040
feat: storage init
arifBurakDemiray Sep 21, 2023
8749d07
feat: module event tests for recording event
arifBurakDemiray Sep 21, 2023
ca83ea0
fix: rename read event queue func
arifBurakDemiray Sep 22, 2023
9dc9fe3
feat: reearrange test order and add new tests
arifBurakDemiray Sep 22, 2023
2624930
Merge branch 'staging' into remake_events_module
ArtursKadikis Sep 22, 2023
dcb6ce4
refactor: to in memory cache
arifBurakDemiray Sep 22, 2023
3132b8e
feat: standolaness for every test util
arifBurakDemiray Sep 22, 2023
3b5aa05
feat: conveint usages nd fix
arifBurakDemiray Sep 25, 2023
58fd752
refactor: recordEvent function
arifBurakDemiray Sep 25, 2023
f7502b6
refactor: reformat imports
arifBurakDemiray Sep 25, 2023
ae84c77
refactor: module events test
arifBurakDemiray Sep 26, 2023
da0657e
feat: add halt to sdk
arifBurakDemiray Sep 26, 2023
17887f7
Added a validation function for events in tests
ArtursKadikis Sep 27, 2023
b78edda
Merge branch 'staging' into remake_events_module
arifBurakDemiray Sep 27, 2023
75b687a
fix: test utils
arifBurakDemiray Sep 27, 2023
a96e839
feat: rename event impl queeu to event queue
arifBurakDemiray Sep 27, 2023
71bc4c2
feat: add force sending
arifBurakDemiray Sep 27, 2023
89d955a
refactor: use reduced way
arifBurakDemiray Sep 27, 2023
f5a4fca
fix: os specific test
arifBurakDemiray Sep 28, 2023
fcae388
refactor: remove unused param
arifBurakDemiray Sep 28, 2023
b26fb1c
feat: event queue test
arifBurakDemiray Sep 28, 2023
0857eb3
feat: event queue size over test
arifBurakDemiray Sep 28, 2023
45aee6c
feat: cancel event tests
arifBurakDemiray Sep 28, 2023
605e6c7
Refactoring test and variable names
ArtursKadikis Sep 28, 2023
a8314c1
Refactoring tests
ArtursKadikis Sep 28, 2023
7d80e2f
Merge branch 'staging' into remake_events_module
ArtursKadikis Sep 28, 2023
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
Prev Previous commit
Next Next commit
feat: event queue size over test
  • Loading branch information
arifBurakDemiray committed Sep 28, 2023
commit 0857eb3acf143902acb773ae2c117a41526c53f3
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public void restoreFromDisk_corruptedData() throws IOException {
validateEvent(eventQueue.eventQueueMemoryCache.get(0), "test-joinEvents-1", null, 1, null, null);
}

private void writeToEventQueue(String fileContent, boolean delete) throws IOException {
static void writeToEventQueue(String fileContent, boolean delete) throws IOException {
File file = new File(TestUtils.getTestSDirectory(), FILE_NAME_PREFIX + FILE_NAME_SEPARATOR + EVENT_QUEUE_FILE_NAME);
file.createNewFile();
if (delete) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ly.count.sdk.java.internal;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -58,6 +59,43 @@ public void recordEvent() {
validateEventInQueue(TestUtils.getTestSDirectory(), eventKey, segmentation, 1, 45.9, 32.0, 1, 0);
}

/**
* Recording an event and no event to recover
* "recordEvent" function should create an event with given key
* event queue should be empty when reached to event queue size to send
*/
@Test
public void recordEvent_queueSizeOver() {
Config config = TestUtils.getBaseConfig();
config.enableFeatures(Config.Feature.Events).setEventQueueSizeToSend(2);
init(config);

validateQueueSize(0);

Countly.instance().events().recordEvent("recordEvent_queueSizeOver", 1, 45.9, null, 32.0);
validateQueueSize(1);

Countly.instance().events().recordEvent("recordEvent_queueSizeOver", 1, 45.9, null, 32.0);
validateQueueSize(0);
}

/**
* Recording an event with recovered events
* "recordEvent" function should create an event with given key and create a request with memory data
* event queue should be empty when reached to event queue size to send
*/
@Test
public void recordEvent_queueSizeOverMemory() throws IOException {
EventQueueTests.writeToEventQueue("{\"hour\":10,\"count\":1,\"dow\":4,\"key\":\"test-joinEvents-1\",\"timestamp\":1695887006647}:::{\"hour\":10,\"count\":1,\"dow\":4,\"key\":\"test-joinEvents-2\",\"timestamp\":1695887006657}", false);
Config config = TestUtils.getBaseConfig();
config.enableFeatures(Config.Feature.Events).setEventQueueSizeToSend(2);
init(config);

validateQueueSize(2);
Countly.instance().events().recordEvent("recordEvent_queueSizeOver", 1, 45.9, null, 32.0);
validateQueueSize(0);
}

/**
* Recording an event with negative count
* "recordEvent" function should not create an event with given key and negative count
Expand Down Expand Up @@ -368,6 +406,10 @@ private void validateQueueSize(int expectedSize, List<EventImpl> events) {
Assert.assertEquals(expectedSize, moduleEvents.eventQueue.eqSize());
}

private void validateQueueSize(int expectedSize) {
validateQueueSize(expectedSize, TestUtils.getCurrentEventQueue(moduleEvents.ctx.getContext(), moduleEvents.L));
}

private void endEvent(String key, Map<String, Object> segmentation, int count, Double sum) {
boolean result = Countly.instance().events().endEvent(key, segmentation, count, sum);
Assert.assertTrue(result);
Expand Down