Пример #1
0
        public void Cleanup()
        {
            CognitoIdentity.CleanupIdentityPools();

            CleanupCreatedRoles();

            if (facebookUser != null)
            {
                FacebookUtilities.DeleteFacebookUser(facebookUser);
            }

            using (var sns = new AmazonSimpleNotificationServiceClient())
            {
                foreach (var topicArn in topicArns)
                {
                    sns.DeleteTopic(topicArn);
                }
                topicArns.Clear();

                if (platformApplicationArn != null)
                {
                    sns.DeletePlatformApplication(new DeletePlatformApplicationRequest
                    {
                        PlatformApplicationArn = platformApplicationArn
                    });
                }
            }
        }
Пример #2
0
        public void Cleanup()
        {
            if (poolid != null)
            {
                DeleteIdentityPool(poolid);
            }
            CleanupCreatedRoles();

#if INCLUDE_FACEBOOK_TESTS
            if (facebookUser != null)
            {
                FacebookUtilities.DeleteFacebookUser(facebookUser);
            }
#endif
        }
Пример #3
0
        public void Cleanup()
        {
            if (poolid != null)
            {
                DeleteIdentityPool(poolid);
            }

            CleanupCreatedRoles();

#if INCLUDE_FACEBOOK_TESTS
            if (facebookUser != null)
            {
                FacebookUtilities.DeleteFacebookUser(facebookUser);
            }
#endif
            //drop all the tables from the db
#if !BCL35
            var filePath = InternalSDKUtils.DetermineAppLocalStoragePath(DB_FILE_NAME);
            if (File.Exists(filePath))
            {
                using (SQLiteConnection connection = new SQLiteConnection(string.Format("Data Source={0};Version=3;", filePath)))
                {
                    connection.Open();

                    SQLiteCommand cmd = connection.CreateCommand();

                    cmd.CommandText = "DROP TABLE IF EXISTS records";
                    cmd.ExecuteNonQuery();

                    cmd             = connection.CreateCommand();
                    cmd.CommandText = "DROP TABLE IF EXISTS datasets";
                    cmd.ExecuteNonQuery();

                    cmd             = connection.CreateCommand();
                    cmd.CommandText = "DROP TABLE IF EXISTS kvstore";
                    cmd.ExecuteNonQuery();
                }
            }
#endif
            BaseClean();
        }
Пример #4
0
        private void TestCredentials(bool usePoolRoles)
        {
            int credentialsChanges = 0;
            CognitoAWSCredentials credentials;

            using (var authenticatedClient = CreateAuthenticatedClient(poolId, usePoolRoles, out credentials))
            {
                // Log and count identity changes
                credentials.IdentityChangedEvent += (sender, args) =>
                {
                    credentialsChanges++;
                    Console.WriteLine("Identity changed: [{0}] => [{1}]", args.OldIdentityId, args.NewIdentityId);
                };

                string datasetName = "sample-dataset";

                // Test calls using unauthenticated role
                TestDataCalls(datasetName, authenticatedClient);

                // Configure IdentityPool to support Facebook logins
                CognitoIdentity.UpdateIdentityPool(poolId, poolName,
                                                   new Dictionary <string, string> {
                    { FacebookProvider, FacebookAppId }
                });

                // Create a Facebook user and supply this information to the credentials
                facebookUser = FacebookUtilities.CreateFacebookUser(FacebookAppId, FacebookAppSecret);
                var facebookAccessToken = facebookUser.AccessToken;

                // Logins was updated, clear the current credentials
                credentials.AddLogin(FacebookProvider, facebookAccessToken);

                // Test calls using authenticated role
                TestDataCalls(datasetName, authenticatedClient);
            }

            Assert.AreEqual(2, credentialsChanges);
        }