usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mru...@apache.org
Subject [19/50] [abbrv] usergrid git commit: USERGRID-1306 - Usergrid .NET SDK Integration Tests assume http://api.usergrid.com endpoint for API * Fixes https://issues.apache.org/jira/browse/USERGRID-1306 * Add a new apiUri configuration to the settings files th
Date Mon, 01 Aug 2016 16:53:54 GMT
USERGRID-1306 - Usergrid .NET SDK Integration Tests assume http://api.usergrid.com endpoint
for API
* Fixes https://issues.apache.org/jira/browse/USERGRID-1306
* Add a new apiUri configuration to the settings files that allow for running integration
tests against something aside from http://api.usergrid.com
* If nothing is specified for this config or if it is missing, the default behavior of using
http://api.usergrid.com is enforced


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/5a0756a5
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/5a0756a5
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/5a0756a5

Branch: refs/heads/master
Commit: 5a0756a54e796efa45d07865ea7efbad8a922f8f
Parents: 9e038ef
Author: Andrew Lane <andrew.w.lane@gmail.com>
Authored: Thu Jul 14 09:58:46 2016 -0400
Committer: Andrew Lane <andrew.w.lane@gmail.com>
Committed: Thu Jul 14 09:58:46 2016 -0400

----------------------------------------------------------------------
 .../Usergrid.Sdk.IntegrationTests/BaseTest.cs   | 23 +++++++++++++++++---
 .../EntityPagingTests.cs                        |  2 +-
 .../Usergrid.Sdk.IntegrationTests/GroupTests.cs |  4 ++--
 .../Usergrid.Sdk.IntegrationTests/LoginTests.cs | 12 +++++-----
 .../Usergrid.Sdk.IntegrationTests.dll.config    |  1 +
 5 files changed, 30 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/5a0756a5/sdks/dotnet/Usergrid.Sdk.IntegrationTests/BaseTest.cs
----------------------------------------------------------------------
diff --git a/sdks/dotnet/Usergrid.Sdk.IntegrationTests/BaseTest.cs b/sdks/dotnet/Usergrid.Sdk.IntegrationTests/BaseTest.cs
index 1669569..b83cf7e 100644
--- a/sdks/dotnet/Usergrid.Sdk.IntegrationTests/BaseTest.cs
+++ b/sdks/dotnet/Usergrid.Sdk.IntegrationTests/BaseTest.cs
@@ -32,7 +32,24 @@ namespace Usergrid.Sdk.IntegrationTests
 	            _config = config;
 	    }
 
-	    protected string Organization
+        /// <summary>
+        /// The URI of the Usergrid API, which defaults to api.usergrid.com if none is specified,
just like the Client object does
+        /// </summary>
+        protected string ApiUri
+        {
+            get
+            {
+                var apiUri = GetAppSetting("apiUri");
+                if (String.IsNullOrWhiteSpace(apiUri))
+                {
+                    apiUri = "http://api.usergrid.com";
+                }
+
+                return apiUri;
+            }
+        }
+
+        protected string Organization
 		{
 			get{ return GetAppSetting("organization");}
 		}
@@ -84,12 +101,12 @@ namespace Usergrid.Sdk.IntegrationTests
 
         private string GetAppSetting(string key)
         {
-            return _config == null ? ConfigurationManager.AppSettings[key] : _config.AppSettings.Settings[key].Value;
+            return _config == null ? ConfigurationManager.AppSettings[key] : _config.AppSettings.Settings[key]?.Value;
         }
 
         protected IClient InitializeClientAndLogin(AuthType authType)
         {
-            var client = new Client(Organization, Application);
+            var client = new Client(Organization, Application, ApiUri);
             if (authType == AuthType.Application || authType == AuthType.Organization)
                 client.Login(ClientId, ClientSecret, authType);
             else if (authType == AuthType.User)

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5a0756a5/sdks/dotnet/Usergrid.Sdk.IntegrationTests/EntityPagingTests.cs
----------------------------------------------------------------------
diff --git a/sdks/dotnet/Usergrid.Sdk.IntegrationTests/EntityPagingTests.cs b/sdks/dotnet/Usergrid.Sdk.IntegrationTests/EntityPagingTests.cs
index fbf615f..79234de 100644
--- a/sdks/dotnet/Usergrid.Sdk.IntegrationTests/EntityPagingTests.cs
+++ b/sdks/dotnet/Usergrid.Sdk.IntegrationTests/EntityPagingTests.cs
@@ -31,7 +31,7 @@ namespace Usergrid.Sdk.IntegrationTests
 		[Test]
 		public void ShouldDoPaging()
 		{
-			var client = new Client(Organization, Application);
+			var client = new Client(Organization, Application, ApiUri);
 			client.Login(ClientId, ClientSecret, AuthType.Organization);
 
 			for (var i=0; i<20; i++) 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5a0756a5/sdks/dotnet/Usergrid.Sdk.IntegrationTests/GroupTests.cs
----------------------------------------------------------------------
diff --git a/sdks/dotnet/Usergrid.Sdk.IntegrationTests/GroupTests.cs b/sdks/dotnet/Usergrid.Sdk.IntegrationTests/GroupTests.cs
index 16bfa2c..4213c24 100644
--- a/sdks/dotnet/Usergrid.Sdk.IntegrationTests/GroupTests.cs
+++ b/sdks/dotnet/Usergrid.Sdk.IntegrationTests/GroupTests.cs
@@ -30,7 +30,7 @@ namespace Usergrid.Sdk.IntegrationTests
         [Test]
         public void ShouldManageGroupLifecycle()
         {
-            var client = new Client(Organization, Application);
+            var client = new Client(Organization, Application, ApiUri);
             client.Login(ClientId, ClientSecret, AuthType.Organization);
 
             var group = client.GetGroup<MyUsergridGroup>("group1");
@@ -68,7 +68,7 @@ namespace Usergrid.Sdk.IntegrationTests
         [Test]
         public void ShouldManageUsersInGroup()
         {
-            var client = new Client(Organization, Application);
+            var client = new Client(Organization, Application, ApiUri);
             client.Login(ClientId, ClientSecret, AuthType.Organization);
 
             var user = SetupUsergridUser(client, new MyUsergridUser {UserName = "user1",
Password = "user1", Email = "user1@gmail.com", City = "city1"});

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5a0756a5/sdks/dotnet/Usergrid.Sdk.IntegrationTests/LoginTests.cs
----------------------------------------------------------------------
diff --git a/sdks/dotnet/Usergrid.Sdk.IntegrationTests/LoginTests.cs b/sdks/dotnet/Usergrid.Sdk.IntegrationTests/LoginTests.cs
index aa4e1de..ea2590c 100644
--- a/sdks/dotnet/Usergrid.Sdk.IntegrationTests/LoginTests.cs
+++ b/sdks/dotnet/Usergrid.Sdk.IntegrationTests/LoginTests.cs
@@ -24,14 +24,14 @@ namespace Usergrid.Sdk.IntegrationTests
         [Test]
         public void ShouldLoginSuccessfullyWithClientCredentials()
         {
-            var client = new Client(Organization, Application);
+            var client = new Client(Organization, Application, ApiUri);
             client.Login(ClientId, ClientSecret, AuthType.Organization);
         }
 
 		[Test]
 		public void ShouldThrowWithInvalidOrganizationCredentials()
 		{
-			var client = new Client (Organization, Application);
+			var client = new Client (Organization, Application, ApiUri);
 
 			try
 			{
@@ -48,14 +48,14 @@ namespace Usergrid.Sdk.IntegrationTests
 		[Test]
 		public void ShouldLoginSuccessfullyWithApplicationCredentials()
 		{
-			var client = new Client(Organization, Application);
+			var client = new Client(Organization, Application, ApiUri);
 			client.Login(ApplicationId, ApplicationSecret, AuthType.Application);
 		}
 
 		[Test]
 		public void ShouldThrowWithInvalidApplicationCredentials()
 		{
-			var client = new Client (Organization, Application);
+			var client = new Client (Organization, Application, ApiUri);
 
 			try
 			{
@@ -72,14 +72,14 @@ namespace Usergrid.Sdk.IntegrationTests
 		[Test]
 		public void ShouldLoginSuccessfullyWithUserCredentials()
 		{
-			var client = new Client(Organization, Application);
+			var client = new Client(Organization, Application, ApiUri);
 			client.Login(UserId, UserSecret, AuthType.User);
 		}
 
         [Test]
         public void ShouldThrowWithInvalidUserCredentials()
         {
-            var client = new Client(Organization, Application);
+            var client = new Client(Organization, Application, ApiUri);
 
             try
             {

http://git-wip-us.apache.org/repos/asf/usergrid/blob/5a0756a5/sdks/dotnet/Usergrid.Sdk.IntegrationTests/Usergrid.Sdk.IntegrationTests.dll.config
----------------------------------------------------------------------
diff --git a/sdks/dotnet/Usergrid.Sdk.IntegrationTests/Usergrid.Sdk.IntegrationTests.dll.config
b/sdks/dotnet/Usergrid.Sdk.IntegrationTests/Usergrid.Sdk.IntegrationTests.dll.config
index 9785ff4..e8fd2e5 100644
--- a/sdks/dotnet/Usergrid.Sdk.IntegrationTests/Usergrid.Sdk.IntegrationTests.dll.config
+++ b/sdks/dotnet/Usergrid.Sdk.IntegrationTests/Usergrid.Sdk.IntegrationTests.dll.config
@@ -18,6 +18,7 @@
 
 <configuration>
 	<appSettings>
+                <add key="apiUri" value="BASE_URI_OF_USERGRID_API" />
 		<add key="organization" value="ORGANIZATION_NAME" />
 		<add key="application" value="APPLICATION_NAME" />
 		<add key="clientId" value="CLIENT_ID" />


Mime
View raw message