-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make enabling analytics and setting region id globally (#36)
* Make region id as a global variable to simplify the usage * Use PXLClient.autoAnalyticsEnabled as a global variable to enable auto-analytics on PXLPhotoRecyclerView.kt and PXLPhotoRecyclerViewInGrid.kt * Use PXLClient.autoAnalyticsEnabled as a global variable to enable auto-analytics on PXLPhotoProductView.kt * Remove a deprecated method * clean up views * Add a test for no auto-analytics * Add @deprecated annotation to notify SDK users that apis because of its duplicated functionality. Update document * Update document * Update document * Fix typo * Feature/add circle ci (#37) * add circleci * Fix lint errors * Add circleci * Update circleci * change version of circleci * update circle to fix erros * update circle to fix errors * update circle to fix errors2 * update circle to fix errors * update circle to fix errors * update circle to fix errors * Add pixleekey.properties in circleci * Remove saving results data * Display project id in circleci console to show the full url of the test result * Split circleci messages * Force to fail a test * Restore tests * Fix hmac test * Fix Unit tests to avoid using android.util.Base64 because All Android related packages are not available in unit tests. * Fix and add unit tests * Fix and add unit tests * Fix circleci * Split test * Split test * Fix unit tests * Remove unnecessary tests * force to fail an unit test * Restore tests Co-authored-by: sungjun <[email protected]> Co-authored-by: sungjun <[email protected]>
- Loading branch information
1 parent
5353c91
commit ae1fbeb
Showing
52 changed files
with
831 additions
and
601 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
version: 2.1 | ||
workflows: | ||
testing: | ||
jobs: | ||
- unit: | ||
filters: | ||
tags: | ||
only: /.*/ | ||
branches: | ||
only: /.*/ | ||
- ui: | ||
filters: | ||
tags: | ||
only: /.*/ | ||
branches: | ||
only: /.*/ | ||
|
||
jobs: | ||
unit: | ||
docker: | ||
- image: circleci/android:api-28-node | ||
auth: | ||
username: mydockerhub-user | ||
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference | ||
steps: | ||
- checkout | ||
- copy-pixlee-credentials | ||
- unit-tests | ||
ui: | ||
docker: | ||
- image: circleci/android:api-28-node | ||
auth: | ||
username: mydockerhub-user | ||
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference | ||
steps: | ||
- checkout | ||
- copy-pixlee-credentials | ||
- ui-tests | ||
commands: | ||
copy-pixlee-credentials: | ||
steps: | ||
- run: | ||
name: Store Pixlee crecentials into pixleekey.properties | ||
command: | | ||
echo "$PIXLEE_PROPERTIES" | base64 --decode > pixleekey.properties | ||
ls -al | ||
unit-tests: | ||
steps: | ||
- restore_cache: | ||
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} | ||
- run: | ||
name: Download Dependencies | ||
command: ./gradlew androidDependencies | ||
- save_cache: | ||
paths: | ||
- ~/.gradle | ||
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} | ||
- run: | ||
name: Run Tests | ||
command: ./gradlew lint test | ||
- store_artifacts: # for display in Artifacts: https://circleci.com/docs/2.0/artifacts/ | ||
path: app/build/reports | ||
destination: reports | ||
- store_test_results: # for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/ | ||
path: app/build/test-results | ||
ui-tests: | ||
steps: | ||
- run: | ||
name: Build debug APK and release APK | ||
command: | | ||
./gradlew :app:assembleDebug | ||
./gradlew :app:assembleDebugAndroidTest | ||
- run: | ||
name: Store Google Service Account | ||
command: echo $GCLOUD_SERVICE_KEY > ${HOME}/gcloud-service-key.json | ||
- run: | ||
name: Authorize gcloud and set config defaults | ||
command: | | ||
sudo gcloud auth activate-service-account --key-file=${HOME}/gcloud-service-key.json | ||
sudo gcloud --quiet config set project pixlee-sdk | ||
- run: | ||
name: Test with Firebase Test Lab | ||
command: > | ||
sudo gcloud firebase test android run \ | ||
--type instrumentation \ | ||
--app app/build/outputs/apk/debug/app-debug.apk \ | ||
--test app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk \ | ||
--device model=Nexus6,version=21,locale=en,orientation=portrait \ | ||
--results-bucket cloud-test-pixlee-sdk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 0 additions & 36 deletions
36
app/src/androidTest/java/com/pixlee/pixleeandroidsdk/HMACTest.java
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
app/src/androidTest/java/com/pixlee/pixleeandroidsdk/HMACTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.pixlee.pixleeandroidsdk | ||
|
||
import android.util.Log | ||
import androidx.test.runner.AndroidJUnit4 | ||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.pixlee.pixleesdk.network.HMAC | ||
import org.json.JSONException | ||
import org.junit.Assert | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import java.security.InvalidKeyException | ||
import java.security.NoSuchAlgorithmException | ||
|
||
/** | ||
* Created by sungjun on 2/1/21. | ||
*/ | ||
class HMACTest { | ||
@Test | ||
@Throws(JSONException::class, InvalidKeyException::class, NoSuchAlgorithmException::class) | ||
fun `test-HMAC-SHA1`() { | ||
val text: String = ObjectMapper().createObjectNode().apply{ | ||
this.put("album_id", 12345) | ||
this.put("title", "Testing Photo Upload") | ||
this.put("approved", true) | ||
this.put("email", "[email protected]") | ||
this.put("username", "Submitter Person") | ||
this.put("photo_uri", "https://example.com/test.jpg") | ||
}.toString().replace("\\/", "/") | ||
val test = HMAC.computeHmac(text, "ABCDEFG") | ||
val targetResult = "epBvDlHbQho/rNDdQVJowWMtGsg=" | ||
Assert.assertEquals(targetResult, test) | ||
} | ||
} |
Oops, something went wrong.