Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NCBC-1447: Correct behavior of QueryRequest.Pretty(bool) method
Motivation ---------- Implementation of QueryRequest.Pretty(bool) is only sending pretty=true to the query engine, never pretty=false. This makes it impossible to improve performance by disabling pretty print on Couchbase Server < 5.0. Modifications ------------- Always send pretty=x to query engine if QueryRequest.Pretty(bool) is called. If not called, it will continue to use the server-side default. Added unit and integration tests to test the behavior. Results ------- Calling Pretty(false) now works as expected against Couchbase Server 4.5 and 4.6. Change-Id: I42cfa655e50a78df018fbd156f29f2a8de2b53cf Reviewed-on: http://review.couchbase.org/79529 Tested-by: Build Bot <build@couchbase.com> Reviewed-by: Matt Ingenthron <matt@couchbase.com> Reviewed-by: Mike Goldsmith <goldsmith.mike@gmail.com>
- Loading branch information
1 parent
34e2b5b
commit 67cc36b
Showing
4 changed files
with
94 additions
and
3 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Couchbase.N1QL; | ||
using NUnit.Framework; | ||
|
||
namespace Couchbase.UnitTests.N1Ql | ||
{ | ||
[TestFixture] | ||
public class QueryRequestTests | ||
{ | ||
#region GetFormValues | ||
|
||
[Test] | ||
public void GetFormValues_NoPrettyCall_NoPrettyParam() | ||
{ | ||
// Arrange | ||
|
||
var request = new QueryRequest("SELECT * FROM default"); | ||
|
||
// Act | ||
|
||
var fields = request.GetFormValues(); | ||
|
||
// Assert | ||
|
||
Assert.False(fields.Keys.Contains("pretty")); | ||
} | ||
|
||
[Test] | ||
[TestCase(true)] | ||
[TestCase(false)] | ||
public void GetFormValues_PrettyCall_IncludesParam(bool pretty) | ||
{ | ||
// Arrange | ||
|
||
var request = new QueryRequest("SELECT * FROM default") | ||
.Pretty(pretty); | ||
|
||
// Act | ||
|
||
var fields = request.GetFormValues(); | ||
|
||
// Assert | ||
|
||
Assert.True(fields.Keys.Contains("pretty")); | ||
Assert.AreEqual(pretty, fields["pretty"]); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
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