Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ayende/ravendb
Browse files Browse the repository at this point in the history
  • Loading branch information
ayende committed May 22, 2012
2 parents 049e425 + 402cbd5 commit 441cf77
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 79 deletions.
Expand Up @@ -34,7 +34,9 @@
<Reference Include="Lucene.Net">
<HintPath>..\..\SharedLibs\Lucene.Net.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL" />
<Reference Include="NLog">
<HintPath>..\..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
Expand All @@ -61,6 +63,9 @@
<Name>Raven.Client.IndexedProperties</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
4 changes: 4 additions & 0 deletions Bundles/Raven.Bundles.IndexedProperties/packages.config
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="2.0.0.2000" />
</packages>
20 changes: 18 additions & 2 deletions Bundles/Raven.Bundles.Tests/Replication/ReplicationBase.cs
Expand Up @@ -29,7 +29,7 @@ public class ReplicationBase : IDisposable
protected readonly List<RavenDbServer> servers = new List<RavenDbServer>();

private const int PortRangeStart = 8079;
protected const int RetriesCount = 300;
protected const int RetriesCount = 500;

public IDocumentStore CreateStore()
{
Expand Down Expand Up @@ -183,7 +183,23 @@ protected void SetupReplication(IDatabaseCommands source, params string[] urls)
Thread.Sleep(100);
}
}
Assert.NotNull(document);
try
{
Assert.NotNull(document);
}
catch (Exception ex)
{
using (var session = store2.OpenSession())
{
Thread.Sleep(TimeSpan.FromSeconds(10));

document = session.Load<TDocument>(expectedId);
if (document == null)
throw;

throw new Exception("WaitForDocument failed, but after waiting 10 seconds more, WaitForDocument succeed. Do we have a race condition here?", ex);
}
}
return document;
}

Expand Down
Expand Up @@ -26,7 +26,7 @@ public void Can_replicate_between_two_instances()
session.SaveChanges();
}

Company company = WaitForDocument<Company>(store2, "companies/1");
var company = WaitForDocument<Company>(store2, "companies/1");
Assert.Equal("Hibernating Rhinos", company.Name);
}

Expand Down
4 changes: 2 additions & 2 deletions Raven.StressTests/Races/BundelsRaceConditions.cs
Expand Up @@ -28,7 +28,7 @@ public void FailoverBetweenTwoMultiTenantDatabases_CanFailoverReplicationBetween
[Fact]
public void SimpleLogin()
{
Run<SimpleLogin>(x => x.WillGetAnErrorWhenTryingToLoginIfUserDoesNotExists());
Run<SimpleLogin>(x => x.WillGetAnErrorWhenTryingToLoginIfUserDoesNotExists(), 40);
}

[Fact]
Expand All @@ -40,7 +40,7 @@ public void AsyncSimpleLogin()
[Fact]
public void CanMergeResultFromAllPostsShards()
{
Run<CanQueryOnlyPosts>(x => x.CanMergeResultFromAllPostsShards(), 10000);
Run<CanQueryOnlyPosts>(x => x.CanMergeResultFromAllPostsShards(), 10);
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions Raven.StressTests/Races/ShardsRaces.cs
Expand Up @@ -8,13 +8,13 @@ public class ShardsRaces : StressTest
[Fact]
public void CanQueryOnlyUsers_WhenStoringUser()
{
Run<CanQueryOnlyUsers>(x => x.WhenStoringUser());
Run<CanQueryOnlyUsers>(x => x.WhenStoringUser(), 100);
}

[Fact]
public void CanQueryOnlyUsers_WhenQueryingForUserById()
{
Run<CanQueryOnlyUsers>(x => x.WhenQueryingForUserById());
Run<CanQueryOnlyUsers>(x => x.WhenQueryingForUserById(), 100);
}
}
}
4 changes: 2 additions & 2 deletions Raven.StressTests/Races/Tobi.cs
Expand Up @@ -9,13 +9,13 @@ public class Tobi : StressTest
[Fact]
public void LazyMultiLoadOperationWouldBeInTheSession_WithNonStaleResponse()
{
Run<MultiGetQueries>(x => x.LazyMultiLoadOperationWouldBeInTheSession_WithNonStaleResponse());
Run<MultiGetQueries>(x => x.LazyMultiLoadOperationWouldBeInTheSession_WithNonStaleResponse(), 100);
}

[Fact]
public void GetDocumentAfterAnEtagWhileAddingDocsFromMultipleThreadsEnumeratesAllDocs()
{
Run<GeneralStorage>(x => x.GetDocumentAfterAnEtagWhileAddingDocsFromMultipleThreadsEnumeratesAllDocs());
Run<GeneralStorage>(x => x.GetDocumentAfterAnEtagWhileAddingDocsFromMultipleThreadsEnumeratesAllDocs(), 20);
}
}
}
2 changes: 1 addition & 1 deletion Raven.StressTests/StressTest.cs
Expand Up @@ -32,7 +32,7 @@ protected void Run<T>(Action<T> action, int iterations = 1000) where T : new()
{
for (; i < iterations; i++)
{
Console.Write("\r" + i);
Console.Write(i + " ");
RunTest(action, i);
}
}
Expand Down
136 changes: 68 additions & 68 deletions Raven.Studio/Controls/Editors/QueryEditor.cs
@@ -1,31 +1,31 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using ActiproSoftware.Text;
using ActiproSoftware.Windows.Controls.SyntaxEditor.IntelliPrompt;
using Raven.Studio.Features.Query;

namespace Raven.Studio.Controls.Editors
{
public class QueryEditor : EditorBase
{
private static readonly ISyntaxLanguage DefaultLanguage;

static QueryEditor()
{
DefaultLanguage = SyntaxEditorHelper.LoadLanguageDefinitionFromResourceStream("RavenQuery.langdef");
}

public QueryEditor()
{
Document.Language = DefaultLanguage;
AreLineModificationMarksVisible = false;

foreach (var key in InputBindings.Where(x => x.Key == Key.Enter && x.Modifiers == ModifierKeys.Control).ToList())
{
InputBindings.Remove(key);
}
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using ActiproSoftware.Text;
using ActiproSoftware.Windows.Controls.SyntaxEditor.IntelliPrompt;
using Raven.Studio.Features.Query;

namespace Raven.Studio.Controls.Editors
{
public class QueryEditor : EditorBase
{
private static readonly ISyntaxLanguage DefaultLanguage;

static QueryEditor()
{
DefaultLanguage = SyntaxEditorHelper.LoadLanguageDefinitionFromResourceStream("RavenQuery.langdef");
}

public QueryEditor()
{
Document.Language = DefaultLanguage;
AreLineModificationMarksVisible = false;

foreach (var key in InputBindings.Where(x => x.Key == Key.Enter && x.Modifiers == ModifierKeys.Control).ToList())
{
InputBindings.Remove(key);
}
}

public ICompletionProvider CompletionProvider
Expand All @@ -34,46 +34,46 @@ public ICompletionProvider CompletionProvider
set { SetValue(CompletionProviderProperty, value); }
}

public static readonly DependencyProperty CompletionProviderProperty =
DependencyProperty.Register("CompletionProvider", typeof(ICompletionProvider), typeof(QueryEditor), new PropertyMetadata(null, PropertyChangedCallback));

private static void PropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
{
public static readonly DependencyProperty CompletionProviderProperty =
DependencyProperty.Register("CompletionProvider", typeof(ICompletionProvider), typeof(QueryEditor), new PropertyMetadata(null, PropertyChangedCallback));

private static void PropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
{
var editor = (QueryEditor)dependencyObject;
editor.Document.Language.RegisterService((ICompletionProvider) args.NewValue);
}

public static IEnumerable<FieldAndTerm> GetCurrentFieldsAndTerms(string text)
{
var editor = new QueryEditor {Text = text};
var textSnapshotReader = editor.ActiveView.GetReader();
string currentField = null;
while (!textSnapshotReader.IsAtSnapshotEnd)
{
var token = textSnapshotReader.ReadToken();
if (token == null)
break;

var txt = textSnapshotReader.ReadTextReverse(token.Length);
textSnapshotReader.ReadToken();
if(string.IsNullOrWhiteSpace(txt))
continue;

string currentVal = null;
if (txt.EndsWith(":"))
{
currentField = txt.Substring(0, txt.Length - 1);
}
else
{
currentVal = txt;
}
if (currentField == null || currentVal == null)
continue;

yield return new FieldAndTerm(currentField, currentVal);
currentField = null;
}
}
}
}

public static IEnumerable<FieldAndTerm> GetCurrentFieldsAndTerms(string text)
{
var editor = new QueryEditor {Text = text};
var textSnapshotReader = editor.ActiveView.GetReader();
string currentField = null;
while (!textSnapshotReader.IsAtSnapshotEnd)
{
var token = textSnapshotReader.ReadToken();
if (token == null)
break;

var txt = textSnapshotReader.ReadTextReverse(token.Length);
textSnapshotReader.ReadToken();
if(string.IsNullOrWhiteSpace(txt))
continue;

string currentVal = null;
if (txt.EndsWith(":"))
{
currentField = txt.Substring(0, txt.Length - 1);
}
else
{
currentVal = txt;
}
if (currentField == null || currentVal == null)
continue;

yield return new FieldAndTerm(currentField, currentVal);
currentField = null;
}
}
}
}
1 change: 1 addition & 0 deletions packages/repositories.config
Expand Up @@ -3,6 +3,7 @@
<repository path="..\Bundles\Raven.Bundles.Authentication\packages.config" />
<repository path="..\Bundles\Raven.Bundles.Authorization\packages.config" />
<repository path="..\Bundles\Raven.Bundles.Expiration\packages.config" />
<repository path="..\Bundles\Raven.Bundles.IndexedProperties\packages.config" />
<repository path="..\Bundles\Raven.Bundles.Replication\packages.config" />
<repository path="..\Bundles\Raven.Bundles.Tests\packages.config" />
<repository path="..\Bundles\Raven.Client.Authorization\packages.config" />
Expand Down
26 changes: 26 additions & 0 deletions zzz_RavenDB_Release.sln
Expand Up @@ -120,6 +120,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Raven.Client.MoreLikeThis",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Raven.Database", "Raven.Database\Raven.Database.csproj", "{212823CD-25E1-41AC-92D1-D6DF4D53FC85}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Raven.Bundles.IndexedProperties", "Bundles\Raven.Bundles.IndexedProperties\Raven.Bundles.IndexedProperties.csproj", "{012F5E7B-DDC3-4B8C-BA39-1394536D58BE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Raven.Client.IndexedProperties", "Bundles\Raven.Client.IndexedProperties\Raven.Client.IndexedProperties.csproj", "{F41C7F7E-A287-449A-A545-E7152937EF77}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -700,6 +704,26 @@ Global
{212823CD-25E1-41AC-92D1-D6DF4D53FC85}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{212823CD-25E1-41AC-92D1-D6DF4D53FC85}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{212823CD-25E1-41AC-92D1-D6DF4D53FC85}.Release|x86.ActiveCfg = Release|Any CPU
{012F5E7B-DDC3-4B8C-BA39-1394536D58BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{012F5E7B-DDC3-4B8C-BA39-1394536D58BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{012F5E7B-DDC3-4B8C-BA39-1394536D58BE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{012F5E7B-DDC3-4B8C-BA39-1394536D58BE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{012F5E7B-DDC3-4B8C-BA39-1394536D58BE}.Debug|x86.ActiveCfg = Debug|Any CPU
{012F5E7B-DDC3-4B8C-BA39-1394536D58BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{012F5E7B-DDC3-4B8C-BA39-1394536D58BE}.Release|Any CPU.Build.0 = Release|Any CPU
{012F5E7B-DDC3-4B8C-BA39-1394536D58BE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{012F5E7B-DDC3-4B8C-BA39-1394536D58BE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{012F5E7B-DDC3-4B8C-BA39-1394536D58BE}.Release|x86.ActiveCfg = Release|Any CPU
{F41C7F7E-A287-449A-A545-E7152937EF77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F41C7F7E-A287-449A-A545-E7152937EF77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F41C7F7E-A287-449A-A545-E7152937EF77}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{F41C7F7E-A287-449A-A545-E7152937EF77}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{F41C7F7E-A287-449A-A545-E7152937EF77}.Debug|x86.ActiveCfg = Debug|Any CPU
{F41C7F7E-A287-449A-A545-E7152937EF77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F41C7F7E-A287-449A-A545-E7152937EF77}.Release|Any CPU.Build.0 = Release|Any CPU
{F41C7F7E-A287-449A-A545-E7152937EF77}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{F41C7F7E-A287-449A-A545-E7152937EF77}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{F41C7F7E-A287-449A-A545-E7152937EF77}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -728,6 +752,8 @@ Global
{35CFAB1C-7934-4481-AC0D-7102F7DEE7F8} = {F2B14D1C-4B20-4DA0-9CE6-C169773B0493}
{2EA316E8-629A-45C2-80B8-48F9CDB5BF57} = {F2B14D1C-4B20-4DA0-9CE6-C169773B0493}
{039CB1C3-C4F3-4D87-A2C0-7531E386E6A3} = {F2B14D1C-4B20-4DA0-9CE6-C169773B0493}
{012F5E7B-DDC3-4B8C-BA39-1394536D58BE} = {F2B14D1C-4B20-4DA0-9CE6-C169773B0493}
{F41C7F7E-A287-449A-A545-E7152937EF77} = {F2B14D1C-4B20-4DA0-9CE6-C169773B0493}
{B09A78D9-B609-459F-9AE1-319799330C6B} = {135E8994-55C0-4353-B31A-24778CB727B5}
{C9D466E0-346D-4C68-8F2F-1391C498E07F} = {135E8994-55C0-4353-B31A-24778CB727B5}
{76989E08-049F-4938-9E17-9A0EB69F70ED} = {135E8994-55C0-4353-B31A-24778CB727B5}
Expand Down

0 comments on commit 441cf77

Please sign in to comment.