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

Update failing tests #34

Merged
merged 2 commits into from
Mar 31, 2021
Merged

Update failing tests #34

merged 2 commits into from
Mar 31, 2021

Conversation

kevinlind
Copy link
Collaborator

@kevinlind kevinlind commented Mar 31, 2021

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@kevinlind kevinlind requested review from alexandremottet and removed request for alexandremottet March 31, 2021 04:06
Comment on lines 120 to 124
TestHelper.waitForThreads(1000);

// register EdgeIdentity extension
Identity.registerExtension();
TestHelper.waitForThreads(2000);
TestHelper.waitForThreads(1000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use registerBothIdentityExtensions instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we register both extensions at the same time, the direct ECID will become secondary ECID for edgeIdentity extension and when privacy toggle happens it will change only the secondary ECID.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this test needs a few adjustments if we are testing that at first boot it reads the identity direct ecid and on privacy toggle it resets only secondary.

  1. set the persistence for Identity direct
  2. register both
  3. check same ecid
  4. privacy toggle
  5. check different ecids

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this test case just wants to make sure that the ECID is refreshed at EdgeIdentity Extension on toggling privacy change and hence we can still do registerBothIdentityExtensions and see if the secondary ECID is refreshed

    @Test
    public void testECID_AreDifferentAfterPrivacyChange() throws Exception {
        /// Test Edge Identity and IdentityDirect have same ECID on bootup, and after privacy change ECIDs are different
        registerBothIdentityExtensions();

        String edgeECID = getExperienceCloudIdSync();
        String oldDirectECID = getIdentityDirectECIDSync();

        // verify ECID's in edge
        verifyPrimaryECID(edgeECID);
        verifySecondaryECID(oldDirectECID);

        //  Toggle privacy
        togglePrivacyStatus();

        // verify legacy ECID added to IdentityMap and it is changed
        String newDirectECID = getIdentityDirectECIDSync();
        assertNotNull(newDirectECID);
        assertNotEquals(newDirectECID, oldDirectECID);
        verifyPrimaryECID(edgeECID);
        verifySecondaryECID(newDirectECID);
    }

@emdobrin emdobrin changed the title Wait for test threads to finish to allow direct Identity extension to … Update failing tests Mar 31, 2021
@emdobrin emdobrin merged commit 16e9ed2 into adobe:dev Mar 31, 2021
PravinPK added a commit that referenced this pull request Apr 8, 2021
* Setup project (#1)

* Update README and add boilerplate leagal docs

* Add top-level .gitignore

* Add base IdentityEdge extension

* Add Makefile

* Add CircleCI config

* Rename files from IdentityEdge to Identity

* Update README installation instructions

* Use extension name constant.

* [AMSDK-11119] - Rename to IdentityEdge, Move to identity package + added Listeners (#2)

* [AMSDK-11119] - Rename to IdentityEdge, Move to identity package + listeners

* Add functional testing to CI (#3)

* Add circleci job to run functional tests in an emulator

* Fix yaml formatting in circleci config

* rename circleci job to build-and-unit-test

* Call Make targets when running functional tests

* [AMSDK-11019] ECID handling in Identity Edge (#4)

* Add ECID and tests

* Add IdentityMap from Edge extension

* Create IdentityEdgeProperties and tests

* Add utils copied from Edge

* Create storage service

* Add required constants

* Create IdentityEdgeState and tests

* Rename extension version test class

* Add doc comment

* Doc comment for storage service

* Remove configuration handling

* Fix IdentityEdgeState log tag

* update event names

* Make ECID parameter final

* Update class comment for IdentityEdgeProperties

* Make getECID protected

* getIdentityProperties -> getIdentityEdgeProperties

* Remove config listener and remove unused imports

* Make IdentityEdgeState methods protected

* Add test for ECID(final String ecidString)

* Remove config listener

* Fix complier issue

* Remove test to be added in a following PR

* persist data in xdm format

* Use extension name as datastore name

* Update listener doc comment

* Update event type in doc comment

* Save after generating ECID and add assertion in test

* Add null check in IdentityMap.fromData

* Add null check in IdentityEdgeProperties.readECIDFromIdentityMap

* Improve doc comments, logs, and handle empty/null ECID string

* Add tests for storage service

* [AMSDK-11079] Add getEcid API (#5)

* Add ECID and tests

* Add IdentityMap from Edge extension

* Create IdentityEdgeProperties and tests

* Add utils copied from Edge

* Create storage service

* Add required constants

* Create IdentityEdgeState and tests

* Rename extension version test class

* Add doc comment

* Doc comment for storage service

* Remove configuration handling

* Fix IdentityEdgeState log tag

* update event names

* Make ECID parameter final

* Update class comment for IdentityEdgeProperties

* Make getECID protected

* getIdentityProperties -> getIdentityEdgeProperties

* Remove config listener and remove unused imports

* Make IdentityEdgeState methods protected

* Add test for ECID(final String ecidString)

* Remove config listener

* Start on public API

* Fix complier issue

* Remove test to be added in a following PR

* persist data in xdm format

* Use extension name as datastore name

* Update listener doc comment

* Update event type in doc comment

* Save after generating ECID and add assertion in test

* Add null check in IdentityMap.fromData

* Add null check in IdentityEdgeProperties.readECIDFromIdentityMap

* Add tests for IdentityEdgeExtension ECID getter

* Add copyright to IdentityEdgeExtensionTests

* Add tests for public get ECID API

* Improve doc comments, logs, and handle empty/null ECID string

* Add tests for storage service

* remove unused import

* Fix comments and logs

* Fix listener event source

* fix listener source in tests

* Revert un-needed listener change

* Handle case where there are empty IDs

* Add null check for identity map

* Invoke with empty identity map when no ECID found and replace ecidString with toString

* Move ECID read to IdentityMap

* use raw data for API tests

* Ensure when IdentityEdgeProps is empty we dispatch an empty map

* Add test with invalid event data

* add log when failing to get extension api

* [AMSDK-11127] Reset Identities API (#6)

* Add resetIdentties API

* Add required constants

* Add reset listener

* Handle reset event

* Add test for handleRequestEvent

* Add ticket number in TODO

* Update test_ListenersRegistration for new listener

* Improve log and null check

* Don't allow empty when setting shared state and assert ECID length on regeneration

* improve assertion

* [AMSDK-11081] - Update Identities public API (#7)

* [AMSDK-11081] - Rename listener tests

* [AMSDK-11081] - Listeners for remove and update Identity requests + tests

* [AMSDK-11081] - UpdateIdentity Public API

* Add IdentityItem to IdentityMap (#8)

* Add IdentityItem

* Add tests for identity item

* add convince overloaded constructor

* Throw IllegalArgumentException if id null and add test

* Add override for hashCode

* Update access levels and update API signatures in IdentityItem

* Clean up merge

* Fix java doc

* fix java doc

* invert expression

* Deep copy on getIdentityItemsForNamespace

* Invert params

* Add throws to javadoc

* move throws doc to bottom of comment

* use @link for javadoc

* Rename IdentityEdge event type to EdgeIdentity

* Add final

* Add test for equals

* Fix assertion

* Add import

* [AMSDK-11082] Get identities API (#11)

* Add getIdentities API

* Add java doc and fix event name in log

* Rename test

* Use JSON string for test and update auth state json key

* Fix auth key in tests

* fix sentence in java doc

* [Dev] - Introducing the Goodness of Functional test helpers + First functional test (#9)

* [Dev] - Add the functional test helpers + first valid functional test

* [Dev] - First functional test

* [Dev] - Assertion fail on misread of persistence in TestPersistence helper method

* Migrate ECID from direct Identity extension (#13)

* Add method to load ECID from direct Identity datastore.

* Load ECID from direct identity during IdentityState bootup

* Add secondary ecid to IdentityProperties

* Add API to update legacy ECID in IdentityState

* Add listener for Hub Shared State changes from direct Identity to update legacy ECID value.

* Correct copywrite on new files

* Make ListenerHubSharedStateTests class public

* handle class cast exceptions and mark local variables final

* Make ECID class final and add unit tests for equals and hashCode

* Correct documentation in ListenerHubSharedState

* final local variables

* [AMSDK-11210] Remove reset identities API (#12)

* Remove rest identities API

* Update doc comment in listener

* Add reset complete event source

* Update event source for reset response event

* Add unit test to verify secondary Ecid is not set if primary is not set (#15)

* Add unit test to verify secondary ECID is not set if primary is not set

* Make class variables final

* [AMSDK-11081] - Part 2 Implementation of Update/Remove Identity API (#14)

* [AMSDK-11081] - Update/Remove Identity API implementation

* [AMSDK-11081] - Unit test for IdentityMap and RemoveIdentity Public API

* [AMSDK-11081] - More Unit test for update/Remove

* [AMSDK-11081] - Few more edits to unittests

* [AMSDK-11081] - better naming and typo fixes

* [AMSDK-11081] - rearrange parameters, setECID handling, case-insensitive search and more

* [AMSDK-11081] - Caseinsensitive removal of reserved namespace items + cleanup

* [AMSDK-11081] - cleanup and renaming

* [Dev] - AuthenticationState Renaming and Remove ECID variable (#16)

* [AMSDK-11081] - Rename listener tests

* [AMSDK-11081] - Listeners for remove and update Identity requests + tests

* [AMSDK-11081] - UpdateIdentity Public API

* [AMSDK-11081] - Fix spacings in IdentityMap class

* [Dev] - Add the functional test helpers + first valid functional test

* [Dev] - First functional test

* [Dev] - Assertion fail on misread of persistence in TestPersistence helper method

* [AMSDK-11081] - Update/Remove Identity API implementation

* [AMSDK-11081] - Unit test for IdentityMap and RemoveIdentity Public API

* [AMSDK-11081] - More Unit test for update/Remove

* [AMSDK-11081] - Few more edits to unittests

* [AMSDK-11081] - better naming and typo fixes

* [AMSDK-11081] - rearrange parameters, setECID handling, case-insensitive search and more

* [AMSDK-11081] - Caseinsensitive removal of reserved namespace items + cleanup

* [AMSDK-11081] - cleanup and renaming

* [Dev] - Rename enum to AuthenticatedState and fix its toString

* [Dev] - Enum AuthenticatedState

* [Dev] - removed local ecid and secondaryECID local instances variables

* [AMSDK-11081] - final on IdentityMap, enum string comparison change

* [AMSDK-11140] Renaming to edgeidentity (#17)

* [AMSDK-11140] Renaming to edgeidentity

rename package to edge.identity

rename module to edgeidentity

rename to edgeidentity, extension name, class, listeners, constants

Rename internal classes to Identity*

rename to testApp

Renaming in Makefile, readme

* Updates after rebase

* Review impl - circleci update after renaming

* Don't dispatch reset complete on boot/update/remove (#18)

* [AMSDK-11312] - Handle boot event + Bugfixes (#19)

* [AMSDK-11312] - Handle Boot event and share initial shared state

* [AMSDK-11312] - Bug fix on merge Identities

* [AMSDK-11312] - Bootsup during extension registration

* [AMSDK-11312] - update tests for boot up change

* Cleanup asXDMIdentityMap + unit test renaming

* Add sample app (#20)

* Use correct direct Identity data store name

* Override toString in IdentityMap and IdentityItem

* Add Kotlin test app for IdentityEdge

* Add fragment for starting an Assurance session

* Remove unused test files from sample app.

* Add implementations for send event and reset identities buttons.

* Add Application class to initialize SDK and extensions

* Add network security config to AndroidManifest

* Comment out call to resetIdentities as API in Core is not yet released

* Remove Java app

* Rename 'appkt' to 'app' and move files to 'code/app'

* Remove launch environment ID

* Rename test app package from 'appkt' to 'app'

* fix IdentityMap.toString to handle case where map is empty.

* Use correct AuthenticatedState.loggedOut string

* Save custom identifier UI entries and update UI with saved values when page is viewed.

* Remove copyright from non-source files (Manifest, layouts, drawables, etc).

* Make StringBuilder final in IdentityMap.toString()

* Print AuthenticatedState string when calling IdentityItem.toString (#22)

* [AMSDK-11329] - Functional tests on Edge Identity (#21)

* [AMSDK-11329] - Functional test for EdgeIdentity

* [Dev] : 🧼 Clean up - log, sonar Lint + remove unwanted methods (#24)

* [Dev] - Log fixes + cleanup + fix sonarlint issues

* Add contributing guide and templates (#28)

* Update build scripts for publishing directly to Sonatype (#25)

* Update build script for publishing to sonatype and removing publish to bintray and artifactory.

* Update Makefile with publish targets for sonatype

* Remove publish job from CircleCI configuration.

* Create common build-release Makefile target used by publish targets

* Only include Core dependency when generating POM file for publish

* Remove extra bracket from build.gradle

* Set version to 1.0.0

* Create maven-snapshot.yml (#26)

* Create maven-snapshot.yml

* Use Java 1.7

* Create maven-release.yml (#27)

* Create maven-release.yml

* Use Java 1.7

* Fix step name, publish to staging repo

* Update core dependency to 1.8.0 (#30)

* Update core dependency to 1.8.0

* Add todo to remove mvn url for core

* Run astyle to correct formatting (#31)

* Update failing tests (#34)

* Wait for test threads to finsh to allow direct Identity extension to register

* In ECID handling tests, register both extensions after directly setting legacy ECID in persistence.

* Run 'lint' before assembling build (#35)

* Use Java 8 as it is required for Gradle (#33)

* Use Java 8 as it is required to run Gradle (#32)

* Dev -> staging for 1.0.0 release (#43)

* Use GPG_KEY_ID secret in script (#38)

* Use GPG_KEY_ID secret in script (#37)

* Set mock network service for functional tests (#41)

* Read ECID from IdentityDirect on Boot when registered (#40)

* [AMSDK-11399] Handle install scenario, when Identity direct registered

* [AMSDK-11399] Cleanup, IdentityState unit tests

* Rename test app

* [AMSDK-11399] Add docs for new code

* [AMSDK-11399] Cache events locally until the extension is booted up

* [AMSDK-11399] Fix unit tests

* Code format

* [AMSDK-11399] New tests, fix resetIdentities event source

* [AMSDK-11399] Cleanup

* [AMSDK-11399] Fix null check for getApi

* [AMSDK-11399] Review - docs, cleanup

* Update core version 1.8.0 (#42)

* Fetch identity shared state when needed (#44)

Co-authored-by: Kevin Lind <[email protected]>
Co-authored-by: Nick Porter <[email protected]>
Co-authored-by: Emilia Dobrin <[email protected]>
Co-authored-by: Emilia Dobrin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants