diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6a2854e..a0e2bfb 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -17,7 +17,7 @@ on: pull_request: # The branches below must be a subset of the branches above branches: [ main ] - + jobs: analyze: @@ -38,11 +38,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -53,7 +53,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -67,4 +67,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/pull-request-test.yml b/.github/workflows/pull-request-test.yml index 3990923..4b7386a 100644 --- a/.github/workflows/pull-request-test.yml +++ b/.github/workflows/pull-request-test.yml @@ -11,7 +11,7 @@ jobs: with: java-version: '8' distribution: 'zulu' - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Test with Gradle run: ./gradlew test:test --stacktrace diff --git a/src/demo/java/com/demo/amplitude/LocalUploadDemo.java b/src/demo/java/com/demo/amplitude/LocalUploadDemo.java index 83dcc46..75c592a 100644 --- a/src/demo/java/com/demo/amplitude/LocalUploadDemo.java +++ b/src/demo/java/com/demo/amplitude/LocalUploadDemo.java @@ -12,6 +12,7 @@ public class LocalUploadDemo { public static void main(String[] args) throws InterruptedException { // Create and initialize Amplitude client + String userId = "java_sdk_demo_user"; Amplitude client = Amplitude.getInstance(); client.init(""); @@ -40,6 +41,35 @@ public void onLogEventServerResponse(Event event, int status, String message) { } }; client.setCallbacks(callback); + + // GROUPS AND GROUP PROPERTIES + JSONObject groups = new JSONObject() + .put("org", "engineering") + .put("department", "sdk"); + JSONObject groupProps = new JSONObject() + .put("technology", "java") + .put("location", "toronto"); + + // Set group (setGroup) + // This assigns a user to a group or groups + Event setGroupEvent = new Event("$identify", userId); + setGroupEvent.groups = groups; + setGroupEvent.userProperties = groups; + client.logEvent(setGroupEvent); + + // Set group properties (groupIdentify) + // This sets properties to a group or groups + Event groupIdentifyEvent = new Event("$groupidentify", userId); + groupIdentifyEvent.groups = groups; + groupIdentifyEvent.groupProperties = groupProps; + client.logEvent(groupIdentifyEvent); + + // Track an event + client.logEvent(new Event("Test Event 1", userId)); + + // Flush events to the server + client.flushEvents(); + for (int i = 0; i < 10000000; i++) { Event ampEvent = new Event("General" + (i % 20), "Test_UserID_B" + (i % 5000)); while (client.shouldWait(ampEvent)) {