Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:ayende/ravendb
- Loading branch information
Showing
180 changed files
with
99,486 additions
and
98,975 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
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
28 changes: 28 additions & 0 deletions
28
Raven.Database/Linq/Ast/TransformGroupByExtensionMethodTransformer.cs
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,28 @@ | ||
using System; | ||
using System.Linq; | ||
using ICSharpCode.NRefactory.CSharp; | ||
using Raven.Database.Linq.PrivateExtensions; | ||
|
||
namespace Raven.Database.Linq.Ast | ||
{ | ||
[CLSCompliant(false)] | ||
public class TransformGroupByExtensionMethodTransformer : DepthFirstAstVisitor<object,object> | ||
{ | ||
public override object VisitInvocationExpression(InvocationExpression invocationExpression, object data) | ||
{ | ||
var memberReferenceExpression = invocationExpression.Target as MemberReferenceExpression; | ||
if (memberReferenceExpression != null && memberReferenceExpression.MemberName == "GroupBy") | ||
{ | ||
var newInvocation = new InvocationExpression( | ||
new MemberReferenceExpression( | ||
new TypeReferenceExpression(new SimpleType(typeof (LinqOnDynamic).FullName)), | ||
memberReferenceExpression.MemberName), | ||
invocationExpression.Arguments.Select(x => x.Clone()) | ||
); | ||
invocationExpression.ReplaceWith(newInvocation); | ||
} | ||
|
||
return base.VisitInvocationExpression(invocationExpression, data); | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,75 +1,75 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Microsoft.Silverlight.Testing; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Raven.Abstractions.Indexing; | ||
using Raven.Client.Document; | ||
using Raven.Client.Extensions; | ||
using Raven.Tests.Document; | ||
|
||
namespace Raven.Tests.Silverlight | ||
{ | ||
public class Statistics : RavenTestBase | ||
{ | ||
[Asynchronous] | ||
public IEnumerable<Task> CanRetrieveStatisticsForTheDefaultDatabase() | ||
{ | ||
using (var documentStore = new DocumentStore {Url = Url + Port}.Initialize()) | ||
{ | ||
var getStats = documentStore.AsyncDatabaseCommands | ||
.GetStatisticsAsync(); | ||
yield return getStats; | ||
|
||
Assert.IsNotNull(getStats.Result); | ||
} | ||
} | ||
|
||
[Asynchronous] | ||
public IEnumerable<Task> CanRetrieveStatisticsForADatabase() | ||
{ | ||
var dbname = GenerateNewDatabaseName(); | ||
using (var documentStore = new DocumentStore {Url = Url + Port}.Initialize()) | ||
{ | ||
yield return documentStore.AsyncDatabaseCommands.EnsureDatabaseExistsAsync(dbname); | ||
|
||
yield return documentStore.AsyncDatabaseCommands.ForDatabase(dbname).PutIndexAsync("test", new IndexDefinition | ||
{ | ||
Map = "from doc in docs select new { doc.Name}" | ||
}, true); | ||
|
||
var getStats = documentStore.AsyncDatabaseCommands.ForDatabase(dbname).GetStatisticsAsync(); | ||
yield return getStats; | ||
|
||
var stats = getStats.Result; | ||
Assert.AreEqual(0, stats.CountOfDocuments); | ||
Assert.IsTrue(stats.CountOfIndexes > 0); | ||
} | ||
} | ||
|
||
[Asynchronous] | ||
public IEnumerable<Task> StatisticsShouldNotBeCached() | ||
{ | ||
var dbname = GenerateNewDatabaseName(); | ||
using (var documentStore = new DocumentStore {Url = Url + Port}.Initialize()) | ||
{ | ||
yield return documentStore.AsyncDatabaseCommands.EnsureDatabaseExistsAsync(dbname); | ||
|
||
var getStats = documentStore.AsyncDatabaseCommands.ForDatabase(dbname).GetStatisticsAsync(); | ||
yield return getStats; | ||
|
||
Assert.AreEqual(0, getStats.Result.CountOfDocuments); | ||
|
||
using (var session = documentStore.OpenAsyncSession(dbname)) | ||
{ | ||
session.Store(new Company {Name = "Change the Stats, Inc."}); | ||
yield return session.SaveChangesAsync(); | ||
} | ||
|
||
var verifyStats = documentStore.AsyncDatabaseCommands.ForDatabase(dbname).GetStatisticsAsync(); | ||
yield return verifyStats; | ||
|
||
Assert.AreEqual(1, verifyStats.Result.CountOfDocuments); | ||
} | ||
} | ||
} | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Microsoft.Silverlight.Testing; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Raven.Abstractions.Indexing; | ||
using Raven.Client.Document; | ||
using Raven.Client.Extensions; | ||
using Raven.Tests.Document; | ||
|
||
namespace Raven.Tests.Silverlight | ||
{ | ||
public class Statistics : RavenTestBase | ||
{ | ||
[Asynchronous] | ||
public IEnumerable<Task> CanRetrieveStatisticsForTheDefaultDatabase() | ||
{ | ||
using (var documentStore = new DocumentStore {Url = Url + Port}.Initialize()) | ||
{ | ||
var getStats = documentStore.AsyncDatabaseCommands | ||
.GetStatisticsAsync(); | ||
yield return getStats; | ||
|
||
Assert.IsNotNull(getStats.Result); | ||
} | ||
} | ||
|
||
[Asynchronous] | ||
public IEnumerable<Task> CanRetrieveStatisticsForADatabase() | ||
{ | ||
var dbname = GenerateNewDatabaseName(); | ||
using (var documentStore = new DocumentStore {Url = Url + Port}.Initialize()) | ||
{ | ||
yield return documentStore.AsyncDatabaseCommands.EnsureDatabaseExistsAsync(dbname); | ||
|
||
yield return documentStore.AsyncDatabaseCommands.ForDatabase(dbname).PutIndexAsync("test", new IndexDefinition | ||
{ | ||
Map = "from doc in docs select new { doc.Name}" | ||
}, true); | ||
|
||
var getStats = documentStore.AsyncDatabaseCommands.ForDatabase(dbname).GetStatisticsAsync(); | ||
yield return getStats; | ||
|
||
var stats = getStats.Result; | ||
Assert.AreEqual(0, stats.CountOfDocuments); | ||
Assert.IsTrue(stats.CountOfIndexes > 0); | ||
} | ||
} | ||
|
||
[Asynchronous] | ||
public IEnumerable<Task> StatisticsShouldNotBeCached() | ||
{ | ||
var dbname = GenerateNewDatabaseName(); | ||
using (var documentStore = new DocumentStore {Url = Url + Port}.Initialize()) | ||
{ | ||
yield return documentStore.AsyncDatabaseCommands.EnsureDatabaseExistsAsync(dbname); | ||
|
||
var getStats = documentStore.AsyncDatabaseCommands.ForDatabase(dbname).GetStatisticsAsync(); | ||
yield return getStats; | ||
|
||
Assert.AreEqual(0, getStats.Result.CountOfDocuments); | ||
|
||
using (var session = documentStore.OpenAsyncSession(dbname)) | ||
{ | ||
session.Store(new Company {Name = "Change the Stats, Inc."}); | ||
yield return session.SaveChangesAsync(); | ||
} | ||
|
||
var verifyStats = documentStore.AsyncDatabaseCommands.ForDatabase(dbname).GetStatisticsAsync(); | ||
yield return verifyStats; | ||
|
||
Assert.AreEqual(1, verifyStats.Result.CountOfDocuments); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.