diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f258689cb..721a67076 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/update-license-year.yml b/.github/workflows/update-license-year.yml index 13aaac8a2..7e0a945f9 100644 --- a/.github/workflows/update-license-year.yml +++ b/.github/workflows/update-license-year.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -24,7 +24,7 @@ jobs: run: "echo PREVIOUS=$(($CURRENT-1)) >> $GITHUB_ENV" - name: Update LICENSE - uses: jacobtomlinson/gha-find-replace@v2 + uses: jacobtomlinson/gha-find-replace@v3 with: find: ${{ env.PREVIOUS }} replace: ${{ env.CURRENT }} @@ -38,7 +38,7 @@ jobs: git commit -m "Updated License Year" -a - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.GITHUB_TOKEN }} title: Update License Year diff --git a/CHANGES.txt b/CHANGES.txt index 36b9b2662..f1137abdb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,6 @@ +4.11.0 (Jan 9, 2024) +- Added impressionsListener method in the IntegrationConfig builder to set Sync or Async Listener execution. + 4.10.2 (Dec 1, 2023) - Added getTreatmentsByFlagSets without attributes. - Fixed some issues for flag sets: Not logging a warning when using flag sets that don't contain cached feature flags. diff --git a/LICENSE b/LICENSE index 65f5999da..c022e9200 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright © 2023 Split Software, Inc. +Copyright © 2024 Split Software, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/client/src/main/java/io/split/integrations/IntegrationsConfig.java b/client/src/main/java/io/split/integrations/IntegrationsConfig.java index b13f6f114..1a0fa4846 100644 --- a/client/src/main/java/io/split/integrations/IntegrationsConfig.java +++ b/client/src/main/java/io/split/integrations/IntegrationsConfig.java @@ -51,10 +51,14 @@ public Builder() { } public Builder impressionsListener(ImpressionListener listener, int queueSize) { + return impressionsListener(listener, queueSize, Execution.ASYNC); + } + + public Builder impressionsListener(ImpressionListener listener, int queueSize, Execution executionType) { if (queueSize <= 0) { throw new IllegalArgumentException("An ImpressionListener was provided, but its capacity was non-positive: " + queueSize); } - _listeners.add(new ImpressionListenerWithMeta(listener, Execution.ASYNC, queueSize)); + _listeners.add(new ImpressionListenerWithMeta(listener, executionType, queueSize)); return this; } diff --git a/client/src/test/java/io/split/client/SplitClientConfigTest.java b/client/src/test/java/io/split/client/SplitClientConfigTest.java index 2285e22a2..8e87ce938 100644 --- a/client/src/test/java/io/split/client/SplitClientConfigTest.java +++ b/client/src/test/java/io/split/client/SplitClientConfigTest.java @@ -7,6 +7,7 @@ import io.split.integrations.IntegrationsConfig; import org.junit.Assert; import org.junit.Test; +import org.mockito.Mockito; import java.util.List; import java.util.stream.Collectors; @@ -214,4 +215,24 @@ public void threadFactoryNotNull() { SplitClientConfig config = SplitClientConfig.builder().threadFactory(new ThreadFactoryBuilder().build()).build(); Assert.assertNotNull(config.getThreadFactory()); } + + @Test + public void IntegrationConfigSyncNotNull() { + SplitClientConfig config = SplitClientConfig.builder().integrations(IntegrationsConfig.builder() + .impressionsListener(Mockito.mock(ImpressionListener.class), 500, IntegrationsConfig.Execution.SYNC) + .build()).build(); + Assert.assertNotNull(config.integrationsConfig()); + Assert.assertEquals(1, config.integrationsConfig().getImpressionsListeners(IntegrationsConfig.Execution.SYNC).size()); + Assert.assertEquals(0, config.integrationsConfig().getImpressionsListeners(IntegrationsConfig.Execution.ASYNC).size()); + } + + @Test + public void IntegrationConfigAsyncNotNull() { + SplitClientConfig config = SplitClientConfig.builder().integrations(IntegrationsConfig.builder() + .impressionsListener(Mockito.mock(ImpressionListener.class), 500, IntegrationsConfig.Execution.ASYNC) + .build()).build(); + Assert.assertNotNull(config.integrationsConfig()); + Assert.assertEquals(0, config.integrationsConfig().getImpressionsListeners(IntegrationsConfig.Execution.SYNC).size()); + Assert.assertEquals(1, config.integrationsConfig().getImpressionsListeners(IntegrationsConfig.Execution.ASYNC).size()); + } } \ No newline at end of file