From fddac135ebbabf02499c854e4bc65e2501514047 Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Thu, 15 Dec 2016 07:40:26 -0600 Subject: [PATCH] ripped out the ravendb support --- packaging/nuget/fubumvc.ravendb.nuspec | 26 - rakefile.rb | 3 - .../Fixtures/LockedOutLogicFixture.cs | 87 - .../Fixtures/LoginAuditingFixture.cs | 29 - .../Fixtures/LoginScreenFixture.cs | 157 -- .../Fixtures/ModelFixture.cs | 68 - .../Fixtures/OtherScreenFixture.cs | 32 - .../FubuMVC.IntegrationTesting.csproj | 20 - ...access the home page after logging out.xml | 9 - ...Sliding_expiration_success_and_failure.xml | 27 - .../Authentication/Logins/Lockout_Logic.xml | 14 - .../Logins/Log in successfully.xml | 15 - .../Logins/Log in unsuccessfully.xml | 23 - ...ogging out redirects to the login page.xml | 8 - ...essfully_to_a_different_page_than_home.xml | 16 - ...s on the initial attempt at logging in.xml | 7 - .../Authentication/Logins/Remember me.xml | 15 - ...rozen_after_the_lockout_period_is_over.xml | 21 - ...udit_user_login_successes_and_failures.xml | 35 - src/FubuMVC.IntegrationTesting/TestSystem.cs | 4 - .../EntityRepositoryTester.cs | 53 - src/FubuMVC.RavenDb.Tests/FakeEntity.cs | 15 - src/FubuMVC.RavenDb.Tests/FixieConvention.cs | 10 - .../FubuMVC.RavenDb.Tests.csproj | 1521 ----------------- .../FubuPersistence.Tests.dll.config | 6 - .../InMemory/InMemoryPersistentResetTester.cs | 37 - .../InMemory/InMemoryPersistorTester.cs | 89 - .../Membership/LoginAuditPersistorTester.cs | 72 - .../Membership/MembershipRepositoryTester.cs | 116 -- .../Membership/PasswordHash_is_predictable.cs | 30 - .../PersistedLoginAuditorIntegratedTester.cs | 245 --- .../PersistedMembershipIntegratedTester.cs | 48 - ...registering_the_persisted_login_auditor.cs | 26 - .../ByTenantEntityStorageTester.cs | 255 --- .../ByTenantStoragePolicyTester.cs | 58 - .../Properties/AssemblyInfo.cs | 36 - .../RavenDb/DocumentStoreBuilderTester.cs | 31 - .../EmbeddedDatabaseRunnerTester.cs | 89 - .../MultipleDatabaseConstructionTester.cs | 149 -- .../Replacing_database_settings_tester.cs | 31 - .../TransactionBehaviorIntegratedTester.cs | 113 -- ...lds_a_dispose_raven_session_log_message.cs | 48 - ...onal_behavior_raven_session_log_message.cs | 59 - ...om_interface_for_an_additional_database.cs | 74 - .../LambdaDocumentStoreConfigurationTester.cs | 56 - .../RavenDb/RavenDbSettingsTester.cs | 195 --- .../RavenDb/RavenPersistenceResetTester.cs | 121 -- .../RavenDb/RavenPersistorTester.cs | 153 -- .../RavenDb/RavenTransactionTester.cs | 133 -- .../RavenDb/RavenUnitOfWorkTester.cs | 151 -- ...the_out_of_the_box_bottle_can_use_raven.cs | 84 - .../Reset/CompleteResetTester.cs | 90 - .../RavenDbSchedulePersistenceTester.cs | 112 -- .../RavenDbSubscriptionPersistenceTester.cs | 174 -- .../Storage/GlobalEntityStorageTester.cs | 71 - .../Storage/SoftDeletedEntityStorageTester.cs | 90 - .../Storage/SoftDeletedStoragePolicyTester.cs | 41 - ...ntity_storage_with_no_matching_policies.cs | 23 - .../EntityRepositoryIntegrationTester.cs | 124 -- ...yPersistenceRegistry_integration_tester.cs | 86 - ...ding_the_bottle_with_string_conversions.cs | 76 - src/FubuMVC.RavenDb.Tests/paket.references | 21 - .../when_updating_an_entity.cs | 43 - src/FubuMVC.RavenDb/ContainerExtensions.cs | 14 - .../DatabaseReplacementExtensions.cs | 51 - src/FubuMVC.RavenDb/Entity.cs | 29 - src/FubuMVC.RavenDb/EntityRepository.cs | 77 - src/FubuMVC.RavenDb/FubuMVC.RavenDb.csproj | 1460 ---------------- src/FubuMVC.RavenDb/IEntity.cs | 18 - src/FubuMVC.RavenDb/IEntityRepository.cs | 22 - .../IEntityRepositoryBuilder.cs | 55 - src/FubuMVC.RavenDb/IPersistor.cs | 17 - src/FubuMVC.RavenDb/ITransaction.cs | 43 - src/FubuMVC.RavenDb/IUnitOfWork.cs | 12 - .../InMemory/DelegatingTransaction.cs | 24 - .../InMemory/InMemoryPersistenceRegistry.cs | 47 - .../InMemory/InMemoryPersistenceReset.cs | 25 - .../InMemory/InMemoryPersistor.cs | 63 - .../InMemory/InMemoryTransaction.cs | 29 - .../InMemory/InMemoryUnitOfWork.cs | 40 - src/FubuMVC.RavenDb/Membership/Audit.cs | 29 - .../Membership/LoginAuditPersistor.cs | 56 - .../Membership/LoginFailureHistory.cs | 11 - .../Membership/MembershipRepository.cs | 28 - .../Membership/PersistedLoginAuditor.cs | 76 - .../Membership/PersistedMembership.cs | 29 - src/FubuMVC.RavenDb/Membership/User.cs | 10 - .../MultiTenancy/ByTenantEntityStorage.cs | 95 - .../MultiTenancy/ByTenantStoragePolicy.cs | 27 - .../MultiTenancy/ITenantContext.cs | 9 - .../MultiTenancy/ITenantedEntity.cs | 14 - .../MultiTenancy/NulloTenantContext.cs | 12 - .../MultiTenancy/SimpleTenantContext.cs | 15 - .../Properties/AssemblyInfo.cs | 10 - .../RavenDb/CustomizeRavenJsonSerializer.cs | 25 - .../RavenDb/DisposeRavenSessionMessage.cs | 29 - .../RavenDb/EmbeddedDatabaseRunner.cs | 89 - .../RavenDb/IDocumentStoreBuilder.cs | 35 - .../IDocumentStoreConfigurationAction.cs | 81 - .../RavenDb/ISessionBoundary.cs | 16 - .../RavenDb/Multiple/DocumentSession.cs | 139 -- .../RavenDb/Multiple/DocumentStore.cs | 133 -- .../RavenDb/Multiple/DocumentStoreBuilder.cs | 11 - .../RavenDb/Multiple/DocumentStoreInstance.cs | 16 - .../RavenDb/Multiple/IDocumentSession.cs | 9 - .../RavenDb/RavenDbRegistry.cs | 39 - .../RavenDb/RavenDbSettings.cs | 92 - .../RavenDb/RavenPersistenceReset.cs | 89 - src/FubuMVC.RavenDb/RavenDb/RavenPersistor.cs | 66 - .../RavenDb/RavenTransaction.cs | 29 - .../RavenDb/RavenUnitOfWork.cs | 66 - .../RavenDb/SessionBoundary.cs | 101 -- .../RavenDbFubuRegistryExtension.cs | 30 - src/FubuMVC.RavenDb/Reset/CompleteReset.cs | 62 - src/FubuMVC.RavenDb/Reset/ICompleteReset.cs | 8 - src/FubuMVC.RavenDb/Reset/IInitialState.cs | 15 - .../Reset/IPersistenceReset.cs | 8 - src/FubuMVC.RavenDb/Reset/IServiceReset.cs | 8 - src/FubuMVC.RavenDb/Reset/ResetMessage.cs | 9 - .../ServiceBus/RavenDbSchedulePersistence.cs | 90 - .../RavenDbSubscriptionPersistence.cs | 109 -- src/FubuMVC.RavenDb/Storage/EntityStorage.cs | 46 - src/FubuMVC.RavenDb/Storage/IEntityStorage.cs | 17 - .../Storage/IEntityStoragePolicy.cs | 8 - .../Storage/IStorageFactory.cs | 7 - .../Storage/SoftDeletedEntityStorage.cs | 56 - .../Storage/SoftDeletedStoragePolicy.cs | 27 - src/FubuMVC.RavenDb/Storage/StorageFactory.cs | 27 - src/FubuMVC.RavenDb/TransactionalBehavior.cs | 33 - ...ctionalBehaviorRavenSessionUsageMessage.cs | 37 - src/FubuMVC.RavenDb/paket.references | 14 - src/FubuMVC.sln | 45 +- src/ScheduledJobHarness/MonitoredNode.cs | 3 - src/ScheduledJobHarness/MonitoredNodeGroup.cs | 20 +- .../ScheduledJobHarness.csproj | 4 - 135 files changed, 9 insertions(+), 9857 deletions(-) delete mode 100644 packaging/nuget/fubumvc.ravendb.nuspec delete mode 100644 src/FubuMVC.IntegrationTesting/Fixtures/LockedOutLogicFixture.cs delete mode 100644 src/FubuMVC.IntegrationTesting/Fixtures/LoginAuditingFixture.cs delete mode 100644 src/FubuMVC.IntegrationTesting/Fixtures/LoginScreenFixture.cs delete mode 100644 src/FubuMVC.IntegrationTesting/Fixtures/ModelFixture.cs delete mode 100644 src/FubuMVC.IntegrationTesting/Fixtures/OtherScreenFixture.cs delete mode 100644 src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Cannot access the home page after logging out.xml delete mode 100644 src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Expiration/Sliding_expiration_success_and_failure.xml delete mode 100644 src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Lockout_Logic.xml delete mode 100644 src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Log in successfully.xml delete mode 100644 src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Log in unsuccessfully.xml delete mode 100644 src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Logging out redirects to the login page.xml delete mode 100644 src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Login_successfully_to_a_different_page_than_home.xml delete mode 100644 src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/No messages on the initial attempt at logging in.xml delete mode 100644 src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Remember me.xml delete mode 100644 src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/The_user_is_no_longer_frozen_after_the_lockout_period_is_over.xml delete mode 100644 src/FubuMVC.IntegrationTesting/Specs/Authentication/PersistedMembership/Audit_user_login_successes_and_failures.xml delete mode 100644 src/FubuMVC.RavenDb.Tests/EntityRepositoryTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/FakeEntity.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/FixieConvention.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/FubuMVC.RavenDb.Tests.csproj delete mode 100644 src/FubuMVC.RavenDb.Tests/FubuPersistence.Tests.dll.config delete mode 100644 src/FubuMVC.RavenDb.Tests/InMemory/InMemoryPersistentResetTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/InMemory/InMemoryPersistorTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/Membership/LoginAuditPersistorTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/Membership/MembershipRepositoryTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/Membership/PasswordHash_is_predictable.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/Membership/PersistedLoginAuditorIntegratedTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/Membership/PersistedMembershipIntegratedTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/Membership/is_registering_the_persisted_login_auditor.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/MultiTenancy/ByTenantEntityStorageTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/MultiTenancy/ByTenantStoragePolicyTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/Properties/AssemblyInfo.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/RavenDb/DocumentStoreBuilderTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/RavenDb/Integration/EmbeddedDatabaseRunnerTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/RavenDb/Integration/MultipleDatabaseConstructionTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/RavenDb/Integration/Replacing_database_settings_tester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/RavenDb/Integration/TransactionBehaviorIntegratedTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/RavenDb/Integration/builds_a_dispose_raven_session_log_message.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/RavenDb/Integration/builds_a_transactional_behavior_raven_session_log_message.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/RavenDb/Integration/plugging_in_a_custom_interface_for_an_additional_database.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/RavenDb/LambdaDocumentStoreConfigurationTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/RavenDb/RavenDbSettingsTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/RavenDb/RavenPersistenceResetTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/RavenDb/RavenPersistorTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/RavenDb/RavenTransactionTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/RavenDb/RavenUnitOfWorkTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/RavenDb/the_out_of_the_box_bottle_can_use_raven.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/Reset/CompleteResetTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/ServiceBus/RavenDbSchedulePersistenceTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/ServiceBus/RavenDbSubscriptionPersistenceTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/Storage/GlobalEntityStorageTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/Storage/SoftDeletedEntityStorageTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/Storage/SoftDeletedStoragePolicyTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/Storage/when_finding_the_entity_storage_with_no_matching_policies.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/StructureMap/EntityRepositoryIntegrationTester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/StructureMap/InMemoryPersistenceRegistry_integration_tester.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/loading_the_bottle_with_string_conversions.cs delete mode 100644 src/FubuMVC.RavenDb.Tests/paket.references delete mode 100644 src/FubuMVC.RavenDb.Tests/when_updating_an_entity.cs delete mode 100644 src/FubuMVC.RavenDb/ContainerExtensions.cs delete mode 100644 src/FubuMVC.RavenDb/DatabaseReplacementExtensions.cs delete mode 100644 src/FubuMVC.RavenDb/Entity.cs delete mode 100644 src/FubuMVC.RavenDb/EntityRepository.cs delete mode 100644 src/FubuMVC.RavenDb/FubuMVC.RavenDb.csproj delete mode 100644 src/FubuMVC.RavenDb/IEntity.cs delete mode 100644 src/FubuMVC.RavenDb/IEntityRepository.cs delete mode 100644 src/FubuMVC.RavenDb/IEntityRepositoryBuilder.cs delete mode 100644 src/FubuMVC.RavenDb/IPersistor.cs delete mode 100644 src/FubuMVC.RavenDb/ITransaction.cs delete mode 100644 src/FubuMVC.RavenDb/IUnitOfWork.cs delete mode 100644 src/FubuMVC.RavenDb/InMemory/DelegatingTransaction.cs delete mode 100644 src/FubuMVC.RavenDb/InMemory/InMemoryPersistenceRegistry.cs delete mode 100644 src/FubuMVC.RavenDb/InMemory/InMemoryPersistenceReset.cs delete mode 100644 src/FubuMVC.RavenDb/InMemory/InMemoryPersistor.cs delete mode 100644 src/FubuMVC.RavenDb/InMemory/InMemoryTransaction.cs delete mode 100644 src/FubuMVC.RavenDb/InMemory/InMemoryUnitOfWork.cs delete mode 100644 src/FubuMVC.RavenDb/Membership/Audit.cs delete mode 100644 src/FubuMVC.RavenDb/Membership/LoginAuditPersistor.cs delete mode 100644 src/FubuMVC.RavenDb/Membership/LoginFailureHistory.cs delete mode 100644 src/FubuMVC.RavenDb/Membership/MembershipRepository.cs delete mode 100644 src/FubuMVC.RavenDb/Membership/PersistedLoginAuditor.cs delete mode 100644 src/FubuMVC.RavenDb/Membership/PersistedMembership.cs delete mode 100644 src/FubuMVC.RavenDb/Membership/User.cs delete mode 100644 src/FubuMVC.RavenDb/MultiTenancy/ByTenantEntityStorage.cs delete mode 100644 src/FubuMVC.RavenDb/MultiTenancy/ByTenantStoragePolicy.cs delete mode 100644 src/FubuMVC.RavenDb/MultiTenancy/ITenantContext.cs delete mode 100644 src/FubuMVC.RavenDb/MultiTenancy/ITenantedEntity.cs delete mode 100644 src/FubuMVC.RavenDb/MultiTenancy/NulloTenantContext.cs delete mode 100644 src/FubuMVC.RavenDb/MultiTenancy/SimpleTenantContext.cs delete mode 100644 src/FubuMVC.RavenDb/Properties/AssemblyInfo.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/CustomizeRavenJsonSerializer.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/DisposeRavenSessionMessage.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/EmbeddedDatabaseRunner.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/IDocumentStoreBuilder.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/IDocumentStoreConfigurationAction.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/ISessionBoundary.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentSession.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentStore.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentStoreBuilder.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentStoreInstance.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/Multiple/IDocumentSession.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/RavenDbRegistry.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/RavenDbSettings.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/RavenPersistenceReset.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/RavenPersistor.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/RavenTransaction.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/RavenUnitOfWork.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDb/SessionBoundary.cs delete mode 100644 src/FubuMVC.RavenDb/RavenDbFubuRegistryExtension.cs delete mode 100644 src/FubuMVC.RavenDb/Reset/CompleteReset.cs delete mode 100644 src/FubuMVC.RavenDb/Reset/ICompleteReset.cs delete mode 100644 src/FubuMVC.RavenDb/Reset/IInitialState.cs delete mode 100644 src/FubuMVC.RavenDb/Reset/IPersistenceReset.cs delete mode 100644 src/FubuMVC.RavenDb/Reset/IServiceReset.cs delete mode 100644 src/FubuMVC.RavenDb/Reset/ResetMessage.cs delete mode 100644 src/FubuMVC.RavenDb/ServiceBus/RavenDbSchedulePersistence.cs delete mode 100644 src/FubuMVC.RavenDb/ServiceBus/RavenDbSubscriptionPersistence.cs delete mode 100644 src/FubuMVC.RavenDb/Storage/EntityStorage.cs delete mode 100644 src/FubuMVC.RavenDb/Storage/IEntityStorage.cs delete mode 100644 src/FubuMVC.RavenDb/Storage/IEntityStoragePolicy.cs delete mode 100644 src/FubuMVC.RavenDb/Storage/IStorageFactory.cs delete mode 100644 src/FubuMVC.RavenDb/Storage/SoftDeletedEntityStorage.cs delete mode 100644 src/FubuMVC.RavenDb/Storage/SoftDeletedStoragePolicy.cs delete mode 100644 src/FubuMVC.RavenDb/Storage/StorageFactory.cs delete mode 100644 src/FubuMVC.RavenDb/TransactionalBehavior.cs delete mode 100644 src/FubuMVC.RavenDb/TransactionalBehaviorRavenSessionUsageMessage.cs delete mode 100644 src/FubuMVC.RavenDb/paket.references diff --git a/packaging/nuget/fubumvc.ravendb.nuspec b/packaging/nuget/fubumvc.ravendb.nuspec deleted file mode 100644 index bababb96df..0000000000 --- a/packaging/nuget/fubumvc.ravendb.nuspec +++ /dev/null @@ -1,26 +0,0 @@ - - - - FubuMVC.RavenDb - 0.0 - Jeremy Miller, et al. - Jeremy Miller, Joshua Arnold - https://github.com/DarthFubuMVC/fubumvc/raw/master/license.txt - http://github.com/DarthFubuMVC/fubumvc - https://github.com/DarthFubuMVC/fubu-collateral/raw/master/Icons/FubuMvc_256.png - false - Drop in persistence with RavenDb for FubuMVC / StructureMap applications - fubu persistence fubumvc ravendb - - - - - - - - - - - - - \ No newline at end of file diff --git a/rakefile.rb b/rakefile.rb index 12a92b7579..ddae1f0cc9 100644 --- a/rakefile.rb +++ b/rakefile.rb @@ -79,7 +79,6 @@ desc 'Run the integration tests' task :integration_test => [:compile] do sh "packages/Fixie/lib/net45/Fixie.Console.exe src/FubuMVC.IntegrationTesting/bin/#{COMPILE_TARGET}/FubuMVC.IntegrationTesting.dll --NUnitXml results/IntegrationTestResult.xml" - sh "packages/Fixie/lib/net45/Fixie.Console.exe src/FubuMVC.RavenDb.Tests/bin/#{COMPILE_TARGET}/FubuMVC.RavenDb.Tests.dll --NUnitXml results/RavenDbTestResult.xml" sh "packages/Fixie/lib/net45/Fixie.Console.exe src/FubuMVC.LightningQueues.Testing/bin/#{COMPILE_TARGET}/FubuMVC.LightningQueues.Testing.dll --NUnitXml results/LQTestResult.xml" end @@ -88,7 +87,6 @@ sh "nuget.exe pack packaging/nuget/fubumvc.aspnet.nuspec -VERSION #{build_number}-alpha -OutputDirectory artifacts" sh "nuget.exe pack packaging/nuget/fubumvc.core.nuspec -VERSION #{build_number}-alpha -OutputDirectory artifacts" sh "nuget.exe pack packaging/nuget/fubumvc.lightningqueues.nuspec -VERSION #{build_number}-alpha -OutputDirectory artifacts" - sh "nuget.exe pack packaging/nuget/fubumvc.ravendb.nuspec -VERSION #{build_number}-alpha -OutputDirectory artifacts" sh "nuget.exe pack packaging/nuget/fubumvc.razor.nuspec -VERSION #{build_number}-alpha -OutputDirectory artifacts" sh "nuget.exe pack packaging/nuget/fubumvc.spark.nuspec -VERSION #{build_number}-alpha -OutputDirectory artifacts" sh "nuget.exe pack packaging/nuget/fubumvc.marten.nuspec -VERSION #{build_number}-alpha -OutputDirectory artifacts" @@ -104,7 +102,6 @@ sh "nuget.exe push artifacts/FubuMVC.Core.#{build_number}-alpha.nupkg #{NUGET_KEY} " sh "nuget.exe push artifacts/FubuMVC.AspNet.#{build_number}-alpha.nupkg #{NUGET_KEY} " sh "nuget.exe push artifacts/FubuMVC.LightningQueues.#{build_number}-alpha.nupkg #{NUGET_KEY} " - sh "nuget.exe push artifacts/FubuMVC.RavenDb.#{build_number}-alpha.nupkg #{NUGET_KEY} " sh "nuget.exe push artifacts/FubuMVC.Razor.#{build_number}-alpha.nupkg #{NUGET_KEY} " sh "nuget.exe push artifacts/FubuMVC.Spark.#{build_number}-alpha.nupkg #{NUGET_KEY} " sh "nuget.exe push artifacts/FubuMVC.Marten.#{build_number}-alpha.nupkg #{NUGET_KEY} " diff --git a/src/FubuMVC.IntegrationTesting/Fixtures/LockedOutLogicFixture.cs b/src/FubuMVC.IntegrationTesting/Fixtures/LockedOutLogicFixture.cs deleted file mode 100644 index 6aefa2e666..0000000000 --- a/src/FubuMVC.IntegrationTesting/Fixtures/LockedOutLogicFixture.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using FubuCore.Dates; -using FubuMVC.Core.Security.Authentication; -using StoryTeller; -using StoryTeller.Grammars.Decisions; - -namespace FubuMVC.IntegrationTesting.Fixtures -{ - public class LockedOutLogicFixture : Fixture - { - public LockedOutLogicFixture() - { - Title = "User Locked Out Logic"; - - this["Logic"] = new LoginLockoutGrammar(); - } - } - - public class LoginLockoutGrammar : DecisionTableGrammar - { - private readonly AuthenticationSettings _settings = new AuthenticationSettings(); - private readonly LoginRequest _request = new LoginRequest(); - private readonly ISystemTime _systemTime = SystemTime.Default(); - private readonly LockedOutRule _lockedOutRule; - - private DateTime toTime(string time) - { - time = time.Replace("NOW", ""); - return _systemTime.UtcNow().AddMinutes(int.Parse(time)); - } - - public LoginLockoutGrammar() : base("Locked out rules") - { - _lockedOutRule = new LockedOutRule(_settings, _systemTime); - } - - public int NumberOfTries - { - set { _request.NumberOfTries = value; } - } - - public int MaximumNumberOfFailedAttempts - { - set { _settings.MaximumNumberOfFailedAttempts = value; } - } - - public int CoolingOffPeriod - { - set { _settings.CooloffPeriodInMinutes = value; } - } - - public string CurrentLockedOutTime - { - set - { - if (value == "NONE") return; - - var time = toTime(value); - _request.LockedOutUntil = time; - _request.Status = LoginStatus.LockedOut; - } - } - - public bool IsLockedOut - { - get { return _lockedOutRule.IsLockedOut(_request) == LoginStatus.LockedOut; } - } - - public string LockedOutUntil - { - get - { - _lockedOutRule.ProcessFailure(_request); - - if (_request.LockedOutUntil == null) - { - return "NONE"; - } - - var totalMinutes = _request.LockedOutUntil.Value.Subtract(_systemTime.UtcNow()).TotalMinutes; - var number = (int) Math.Round(totalMinutes); - - return number < 0 ? "NOW" + number : "NOW+" + number; - } - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/Fixtures/LoginAuditingFixture.cs b/src/FubuMVC.IntegrationTesting/Fixtures/LoginAuditingFixture.cs deleted file mode 100644 index 565fecaec8..0000000000 --- a/src/FubuMVC.IntegrationTesting/Fixtures/LoginAuditingFixture.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using FubuMVC.RavenDb; -using FubuMVC.RavenDb.Membership; -using StoryTeller; - -namespace FubuMVC.IntegrationTesting.Fixtures -{ - public class LoginAuditingFixture : Fixture - { - public LoginAuditingFixture() - { - Title = "Login Auditing"; - } - - public IGrammar TheAuditsAre() - { - return VerifySetOf(allAudits).Titled("All of the audit messages should be") - .Ordered() - .MatchOn(x => x.Username, x => x.Type); - } - - private IEnumerable allAudits() - { - return Context.Service().All() - .OrderBy(x => x.Timestamp); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/Fixtures/LoginScreenFixture.cs b/src/FubuMVC.IntegrationTesting/Fixtures/LoginScreenFixture.cs deleted file mode 100644 index 9c909f908a..0000000000 --- a/src/FubuMVC.IntegrationTesting/Fixtures/LoginScreenFixture.cs +++ /dev/null @@ -1,157 +0,0 @@ -using System; -using System.Linq; -using System.Linq.Expressions; -using FubuCore; -using FubuCore.Dates; -using FubuCore.Reflection; -using FubuMVC.Core.Security.Authentication; -using FubuMVC.Core.Security.Authentication.Endpoints; -using OpenQA.Selenium; -using Serenity; -using Serenity.Fixtures; -using StoryTeller; - -namespace FubuMVC.IntegrationTesting.Fixtures -{ - public class LoginScreenFixture : ScreenFixture - { - public static By LoginSubmitButton = By.Id("login-submit"); - public static By LoginMessageText = By.Id("login-message"); - - public LoginScreenFixture() - { - Title = "Login Screen"; - } - - [FormatAs("Recycle the browser")] - public void RecycleTheBrowser() - { - Browser.Recycle(); - } - - [FormatAs("Go to the login screen")] - public void OpenLoginScreen() - { - Navigation.NavigateTo(new LoginRequest()); - } - - [FormatAs("Logout")] - public void Logout() - { - Navigation.NavigateTo(new LogoutRequest()); - } - - [FormatAs("Login as {user}/{password}")] - public void Login(string user, string password) - { - // TODO -- need to fix this in Serenity - Wait.Until(() => Driver.FindElements(By.Name("UserName")).Any()); - - SetData(By.Name("UserName"), user); - SetData(By.Name("Password"), password); - - Driver.FindElement(LoginSubmitButton).Click(); - } - - // TODO (checked) -- this needs to be in ScreenFixture, Serenity - protected IWebElement findElement(Expression> property) - { - return Driver.FindElement(By.Name(property.ToAccessor().Name)); - } - - [FormatAs("Check the 'Remember me' checkbox")] - public void CheckRememberMe() - { - IWebElement checkbox = findElement(x => x.RememberMe); - if (!checkbox.Selected) - { - checkbox.Click(); - } - } - - [FormatAs("The displayed user name should be {UserName}")] - public string CheckUserName() - { - return Driver.FindElement(By.Name("UserName")).Text; - } - - [FormatAs("No message is shown")] - public bool NoMessageIsShown() - { - return TheMessageShouldBe().IsEmpty(); - } - - [FormatAs("The message displayed should be {message}")] - public string TheMessageShouldBe() - { - Wait.Until(() => Driver.FindElements(LoginMessageText).Any()); - - return Driver.FindElement(LoginMessageText).Text; - } - - [FormatAs("The user account locked out message should be displayed")] - public bool TheLockedOutMessageShouldBeDisplayed() - { - string theMessage = TheMessageShouldBe().Trim(); - StoryTellerAssert.Fail(theMessage != LoginKeys.LockedOut.ToString(), () => "Was '{0}'".ToFormat(theMessage)); - - return true; - } - - [FormatAs("Should be on the login screen")] - public bool IsOnTheLoginScreen() - { - string url = Urls.UrlFor(new LoginRequest(), "GET"); - - - var actual = Driver.Url; - - StoryTellerAssert.Fail(!actual.Matches(url), "The actual url was " + actual); - - return true; - } - - [FormatAs("Should have moved off the login screen")] - public bool IsNotOnTheLoginScreen() - { - string url = Urls.UrlFor(new LoginRequest(), "GET"); - return !Driver.Url.Matches(url); - } - - [FormatAs("The url should now be {url}")] - public bool TheUrlIs(string url) - { - StoryTellerAssert.Fail(Driver.Url.Matches(url), "The actual url is " + url); - - return true; - } - - [FormatAs("Try to open the home page")] - public void TryToGoHome() - { - Navigation.NavigateToHome(); - } - - [FormatAs("Should be on the home page")] - public bool ShouldBeOnTheHomePage() - { - return Driver.Url.StartsWith(RootUrl); - } - - [FormatAs("After {number} of minutes, reopen the login page")] - public void ReopenTheLoginScreen(int number) - { - var clock = (Clock)Context.Service(); - - clock.RestartAtLocal(clock.UtcNow()); - - OpenLoginScreen(); - } - - [FormatAs("After {number} minutes")] - public void AfterMinutes(int number) - { - AdvanceTheClock(number.Minutes()); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/Fixtures/ModelFixture.cs b/src/FubuMVC.IntegrationTesting/Fixtures/ModelFixture.cs deleted file mode 100644 index ab738129d8..0000000000 --- a/src/FubuMVC.IntegrationTesting/Fixtures/ModelFixture.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Linq.Expressions; -using FubuCore.Reflection; -using FubuMVC.Core.Security.Authentication; -using FubuMVC.RavenDb; -using FubuMVC.RavenDb.Membership; -using StoryTeller; -using StoryTeller.Grammars.ObjectBuilding; -using StoryTeller.Grammars.Tables; - -namespace FubuMVC.IntegrationTesting.Fixtures -{ - public class ModelFixture : Fixture - { - private IUnitOfWork _unitOfWork; - private IEntityRepository _repository; - - public ModelFixture() - { - Title = "The system state"; - } - - public override void SetUp() - { - _unitOfWork = Context.Service(); - _repository = _unitOfWork.Start(); - } - - - public override void TearDown() - { - _unitOfWork.Commit(); - } - - private IGrammar setter(Expression> property) - { - var accessor = property.ToAccessor(); - var grammar = new SetPropertyGrammar(accessor.InnerProperty); - grammar.CellModifications.DefaultValue(accessor.GetValue(new AuthenticationSettings()).ToString()); - - return grammar; - } - - public IGrammar SetAuthenticationSettings() - { - return Paragraph("The Authentication Settings are", x => - { - x += () => Context.State.CurrentObject = Context.Service(); - x += setter(o => o.ExpireInMinutes); - x += setter(o => o.SlidingExpiration); - x += setter(o => o.MaximumNumberOfFailedAttempts); - x += setter(o => o.CooloffPeriodInMinutes); - }); - } - - [ExposeAsTable("The users are")] - public void UsersAre(string UserName, string Password) - { - var user = new User - { - UserName = UserName, - Password = Context.Service().CreateHash(Password) - }; - - _repository.Update(user); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/Fixtures/OtherScreenFixture.cs b/src/FubuMVC.IntegrationTesting/Fixtures/OtherScreenFixture.cs deleted file mode 100644 index 62c412be0a..0000000000 --- a/src/FubuMVC.IntegrationTesting/Fixtures/OtherScreenFixture.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Linq; -using Serenity; -using StoryTeller; - -namespace FubuMVC.IntegrationTesting.Fixtures -{ - public class OtherScreenFixture : LoginScreenFixture - { - public OtherScreenFixture() - { - Title = "Login Screen with a Different Page"; - } - - protected override void beforeRunning() - { - Logout(); - } - - [FormatAs("Go to a different page for {name}")] - public void GoToDifferentPage(string name) - { - Navigation.NavigateTo(new DifferentInput{Name = name}); - } - - [FormatAs("Should be on the different page for {name}")] - public string ShouldBeOnTheDifferentPage() - { - var currentUrl = Browser.Driver.Url; - return currentUrl.Split('/').Last(); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/FubuMVC.IntegrationTesting.csproj b/src/FubuMVC.IntegrationTesting/FubuMVC.IntegrationTesting.csproj index 7ce17fdb0f..b73f8f63c2 100644 --- a/src/FubuMVC.IntegrationTesting/FubuMVC.IntegrationTesting.csproj +++ b/src/FubuMVC.IntegrationTesting/FubuMVC.IntegrationTesting.csproj @@ -92,11 +92,6 @@ - - - - - @@ -235,10 +230,6 @@ {f151167c-4736-4c67-9697-7876574c05d0} FubuMVC.LightningQueues - - {02441e35-668b-4713-9279-bd51948b95eb} - FubuMVC.RavenDb - {a88246a6-2a7a-4964-902e-a5a7fdaaa9d4} FubuMVC.Razor @@ -282,17 +273,6 @@ PreserveNewest - - - - - - - - - - - diff --git a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Cannot access the home page after logging out.xml b/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Cannot access the home page after logging out.xml deleted file mode 100644 index d40534b35f..0000000000 --- a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Cannot access the home page after logging out.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Expiration/Sliding_expiration_success_and_failure.xml b/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Expiration/Sliding_expiration_success_and_failure.xml deleted file mode 100644 index 812ea2d02b..0000000000 --- a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Expiration/Sliding_expiration_success_and_failure.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - -
-
- -
- - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Lockout_Logic.xml b/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Lockout_Logic.xml deleted file mode 100644 index 4b15a34079..0000000000 --- a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Lockout_Logic.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - -
-
-
-
\ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Log in successfully.xml b/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Log in successfully.xml deleted file mode 100644 index a1f53f4de7..0000000000 --- a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Log in successfully.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - -
-
-
- - - - - -
\ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Log in unsuccessfully.xml b/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Log in unsuccessfully.xml deleted file mode 100644 index 37029190d8..0000000000 --- a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Log in unsuccessfully.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - -
-
- -
- - - - - - - - - - - - -
\ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Logging out redirects to the login page.xml b/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Logging out redirects to the login page.xml deleted file mode 100644 index 1f3a8c8b98..0000000000 --- a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Logging out redirects to the login page.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Login_successfully_to_a_different_page_than_home.xml b/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Login_successfully_to_a_different_page_than_home.xml deleted file mode 100644 index d1ec6240f0..0000000000 --- a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Login_successfully_to_a_different_page_than_home.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - -
-
-
- - - - - - - -
\ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/No messages on the initial attempt at logging in.xml b/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/No messages on the initial attempt at logging in.xml deleted file mode 100644 index 9903c4aab0..0000000000 --- a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/No messages on the initial attempt at logging in.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Remember me.xml b/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Remember me.xml deleted file mode 100644 index 7fc48f5262..0000000000 --- a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/Remember me.xml +++ /dev/null @@ -1,15 +0,0 @@ - - This test is unreliable because of the cookie state. Despite my efforts at cleaning up the existing cookie state, this test is only trustworthy after recycling the environment. - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/The_user_is_no_longer_frozen_after_the_lockout_period_is_over.xml b/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/The_user_is_no_longer_frozen_after_the_lockout_period_is_over.xml deleted file mode 100644 index 8b95ea3676..0000000000 --- a/src/FubuMVC.IntegrationTesting/Specs/Authentication/Logins/The_user_is_no_longer_frozen_after_the_lockout_period_is_over.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - -
-
-
- - - - - - If the user is no longer locked out, we should no longer see the locked out message when we first open the screen - - - - - -
\ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/Specs/Authentication/PersistedMembership/Audit_user_login_successes_and_failures.xml b/src/FubuMVC.IntegrationTesting/Specs/Authentication/PersistedMembership/Audit_user_login_successes_and_failures.xml deleted file mode 100644 index 7d3275bbfa..0000000000 --- a/src/FubuMVC.IntegrationTesting/Specs/Authentication/PersistedMembership/Audit_user_login_successes_and_failures.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/src/FubuMVC.IntegrationTesting/TestSystem.cs b/src/FubuMVC.IntegrationTesting/TestSystem.cs index a149be5f74..470a955912 100644 --- a/src/FubuMVC.IntegrationTesting/TestSystem.cs +++ b/src/FubuMVC.IntegrationTesting/TestSystem.cs @@ -8,8 +8,6 @@ using FubuMVC.Core.Security.Authentication.Endpoints; using FubuMVC.Core.ServiceBus.Configuration; using FubuMVC.Core.ServiceBus.Polling; -using FubuMVC.RavenDb.Membership; -using FubuMVC.RavenDb.Reset; using NUnit.Framework; using Serenity; using ServiceNode; @@ -27,7 +25,6 @@ public WebsiteRegistry() ServiceBus.HealthMonitoring.ScheduledExecution(ScheduledExecution.Disabled); - Import>(); Features.Authentication.Configure(_ => { @@ -111,7 +108,6 @@ protected override void beforeEach(IContainer scope) scope.GetInstance().NavigateTo(); } - Runtime.Get().ResetState(); } } } \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/EntityRepositoryTester.cs b/src/FubuMVC.RavenDb.Tests/EntityRepositoryTester.cs deleted file mode 100644 index 64623a6412..0000000000 --- a/src/FubuMVC.RavenDb.Tests/EntityRepositoryTester.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Linq; -using NUnit.Framework; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests -{ - [TestFixture] - public class EntityRepositoryTester - { - - [Test] - public void assign_a_guid_if_one_does_not_exist() - { - var repository = EntityRepository.InMemory(); - var @case = new FakeEntity(); - - @case.Id.ShouldBe(Guid.Empty); - - repository.Update(@case); - - @case.Id.ShouldBeOfType().ShouldNotBe(Guid.Empty); - } - - [Test] - public void update_an_existing_case_should_replace_it() - { - var repository = EntityRepository.InMemory(); - var case1 = new FakeEntity(); - var case2 = new FakeEntity(); - - repository.Update(case1); - repository.All().Single().ShouldBeTheSameAs(case1); - repository.Find(case1.Id).ShouldBeTheSameAs(case1); - - case2.Id = case1.Id; - repository.Update(case2); - - repository.All().Single().ShouldBeTheSameAs(case2); - repository.Find(case1.Id).ShouldBeTheSameAs(case2); - } - - [Test] - public void fetch_is_covariant_contravariant_you_know_what_I_mean() - { - var repository = EntityRepository.InMemory(); - var case1 = new FakeEntity(); - repository.Update(case1); - - repository.Find(case1.Id).ShouldBeTheSameAs(case1); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/FakeEntity.cs b/src/FubuMVC.RavenDb.Tests/FakeEntity.cs deleted file mode 100644 index 4f8b27b11a..0000000000 --- a/src/FubuMVC.RavenDb.Tests/FakeEntity.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace FubuMVC.RavenDb.Tests -{ - public class FakeEntity : Entity { } - - public class User : Entity - { - public string FirstName { get; set; } - - public string LastName { get; set; } - } - - public class OtherEntity : Entity { } - - public class ThirdEntity : Entity { } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/FixieConvention.cs b/src/FubuMVC.RavenDb.Tests/FixieConvention.cs deleted file mode 100644 index 4d9b512d7a..0000000000 --- a/src/FubuMVC.RavenDb.Tests/FixieConvention.cs +++ /dev/null @@ -1,10 +0,0 @@ -using FubuMVC.Tests; - -namespace FubuMVC.RavenDb.Tests -{ - // Pulls in the same convention we use in FubuMVC.Tests - public class FixieConvention : CustomConvention - { - - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/FubuMVC.RavenDb.Tests.csproj b/src/FubuMVC.RavenDb.Tests/FubuMVC.RavenDb.Tests.csproj deleted file mode 100644 index 3626da6d57..0000000000 --- a/src/FubuMVC.RavenDb.Tests/FubuMVC.RavenDb.Tests.csproj +++ /dev/null @@ -1,1521 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB} - Library - Properties - FubuMVC.RavenDb.Tests - FubuMVC.RavenDb.Tests - v4.6 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {e18fd922-0e7a-49cd-b89f-473826077b9d} - FubuMVC.Core - - - {e18fd922-0e7a-49cd-b89f-473826077b9d} - FubuMVC.Core - - - {02441E35-668B-4713-9279-BD51948B95EB} - FubuMVC.RavenDb - - - {feb91f9f-ece2-480c-b39c-a44bbf1f7b01} - FubuMVC.Tests - - - - - PreserveNewest - Designer - - - - - - - - - - - - - ..\..\packages\Fixie\lib\net45\Fixie.dll - True - True - - - - - - - ..\..\packages\FubuCore\lib\FubuCore.dll - True - True - - - - - - - ..\..\packages\HtmlTags\lib\4.0\HtmlTags.dll - True - True - - - - - - - - - ..\..\packages\Microsoft.CompilerServices.AsyncTargetingPack\lib\net40\Microsoft.CompilerServices.AsyncTargetingPack.Net4.dll - True - True - - - - - - - ..\..\packages\Microsoft.CompilerServices.AsyncTargetingPack\lib\net45\Microsoft.CompilerServices.AsyncTargetingPack.Net45.dll - True - True - - - - - - - ..\..\packages\Microsoft.CompilerServices.AsyncTargetingPack\lib\sl50\Microsoft.CompilerServices.AsyncTargetingPack.Silverlight5.dll - True - True - - - - - - - - - ..\..\packages\Microsoft.Data.Edm\lib\net40\Microsoft.Data.Edm.dll - True - True - - - - - - - ..\..\packages\Microsoft.Data.Edm\lib\portable-net40+sl5+wp8+win8\Microsoft.Data.Edm.Portable.dll - True - True - - - - - - - ..\..\packages\Microsoft.Data.Edm\lib\sl4\Microsoft.Data.Edm.SL.dll - True - True - - - - - - - - - ..\..\packages\Microsoft.Data.OData\lib\net40\Microsoft.Data.OData.dll - True - True - - - - - - - ..\..\packages\Microsoft.Data.OData\lib\portable-net40+sl5+wp8+win8\Microsoft.Data.OData.Portable.dll - True - True - - - - - - - ..\..\packages\Microsoft.Data.OData\lib\sl4\Microsoft.Data.OData.SL.dll - True - True - - - - - - - - - ..\..\packages\Microsoft.Data.Services.Client\lib\net40\Microsoft.Data.Services.Client.dll - True - True - - - - - - - ..\..\packages\Microsoft.Data.Services.Client\lib\portable-net45+sl5+wp8+win8\Microsoft.Data.Services.Client.Portable.dll - True - True - - - - - - - ..\..\packages\Microsoft.Data.Services.Client\lib\sl4\Microsoft.Data.Services.Client.SL.dll - True - True - - - True - - - - - - - - - ..\..\packages\Microsoft.Owin\lib\net45\Microsoft.Owin.dll - True - True - - - - - - - - - ..\..\packages\Microsoft.Owin.Host.HttpListener\lib\net45\Microsoft.Owin.Host.HttpListener.dll - True - True - - - - - - - - - ..\..\packages\Microsoft.Owin.Hosting\lib\net45\Microsoft.Owin.Hosting.dll - True - True - - - - - - - - - ..\..\packages\Microsoft.Win32.Primitives\ref\netstandard1.3\Microsoft.Win32.Primitives.dll - True - True - - - - - - - - - ..\..\packages\Microsoft.WindowsAzure.ConfigurationManager\lib\net40\Microsoft.WindowsAzure.Configuration.dll - True - True - - - - - - - - - ..\..\packages\Newtonsoft.Json\lib\net20\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\packages\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\packages\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\packages\Newtonsoft.Json\lib\netstandard1.0\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\packages\Newtonsoft.Json\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\packages\Newtonsoft.Json\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll - True - True - - - - - - - - - ..\..\packages\Owin\lib\net40\Owin.dll - True - True - - - - - - - - - ..\..\packages\RavenDB.Client\lib\net40\Raven.Abstractions.dll - True - True - - - ..\..\packages\RavenDB.Client\lib\net40\Raven.Client.Lightweight.dll - True - True - - - - - - - ..\..\packages\RavenDB.Client\lib\net45\Raven.Abstractions.dll - True - True - - - ..\..\packages\RavenDB.Client\lib\net45\Raven.Client.Lightweight.dll - True - True - - - - - - - ..\..\packages\RavenDB.Client\lib\sl50\Raven.Client.Silverlight.dll - True - True - - - - - - - - - ..\..\packages\RavenDB.Database\lib\net40\Raven.Abstractions.dll - True - True - - - ..\..\packages\RavenDB.Database\lib\net40\Raven.Database.dll - True - True - - - - - - - ..\..\packages\RavenDB.Database\lib\net45\Raven.Abstractions.dll - True - True - - - ..\..\packages\RavenDB.Database\lib\net45\Raven.Database.dll - True - True - - - - - - - - - ..\..\packages\RavenDB.Embedded\lib\net40\Raven.Client.Embedded.dll - True - True - - - - - - - ..\..\packages\RavenDB.Embedded\lib\net45\Raven.Client.Embedded.dll - True - True - - - - - - - - - ..\..\packages\RhinoMocks\lib\net\Rhino.Mocks.dll - True - True - - - - - - - - - ..\..\packages\Shouldly\lib\net35\Shouldly.dll - True - True - - - - - - - ..\..\packages\Shouldly\lib\net40\Shouldly.dll - True - True - - - - - - - - - ..\..\packages\StructureMap\lib\net45\StructureMap.dll - True - True - - - - - - - ..\..\packages\StructureMap\lib\netstandard1.3\StructureMap.dll - True - True - - - - - - - ..\..\packages\StructureMap\lib\netstandard1.5\StructureMap.dll - True - True - - - - - - - - - ..\..\packages\System.AppContext\ref\netstandard1.3\System.AppContext.dll - True - True - - - - - - - - - ..\..\packages\System.Buffers\lib\netstandard1.1\System.Buffers.dll - True - True - - - - - - - - - ..\..\packages\System.Collections\ref\netstandard1.0\System.Collections.dll - True - True - - - - - - - ..\..\packages\System.Collections\ref\netstandard1.3\System.Collections.dll - True - True - - - - - - - - - ..\..\packages\System.Collections.Concurrent\ref\netstandard1.1\System.Collections.Concurrent.dll - True - True - - - - - - - ..\..\packages\System.Collections.Concurrent\ref\netstandard1.3\System.Collections.Concurrent.dll - True - True - - - - - - - - - ..\..\packages\System.Console\ref\netstandard1.3\System.Console.dll - True - True - - - - - - - - - ..\..\packages\System.Diagnostics.Debug\ref\netstandard1.0\System.Diagnostics.Debug.dll - True - True - - - - - - - ..\..\packages\System.Diagnostics.Debug\ref\netstandard1.3\System.Diagnostics.Debug.dll - True - True - - - - - - - - - ..\..\packages\System.Diagnostics.DiagnosticSource\lib\netstandard1.3\System.Diagnostics.DiagnosticSource.dll - True - True - - - - - - - - - ..\..\packages\System.Diagnostics.Tools\ref\netstandard1.0\System.Diagnostics.Tools.dll - True - True - - - - - - - - - ..\..\packages\System.Diagnostics.Tracing\ref\netstandard1.3\System.Diagnostics.Tracing.dll - True - True - - - - - - - ..\..\packages\System.Diagnostics.Tracing\ref\netstandard1.5\System.Diagnostics.Tracing.dll - True - True - - - - - - - - - ..\..\packages\System.Dynamic.Runtime\ref\netstandard1.0\System.Dynamic.Runtime.dll - True - True - - - - - - - ..\..\packages\System.Dynamic.Runtime\ref\netstandard1.3\System.Dynamic.Runtime.dll - True - True - - - - - - - - - ..\..\packages\System.Globalization\ref\netstandard1.0\System.Globalization.dll - True - True - - - - - - - ..\..\packages\System.Globalization\ref\netstandard1.3\System.Globalization.dll - True - True - - - - - - - - - ..\..\packages\System.Globalization.Calendars\ref\netstandard1.3\System.Globalization.Calendars.dll - True - True - - - - - - - - - ..\..\packages\System.Globalization.Extensions\ref\netstandard1.3\System.Globalization.Extensions.dll - True - True - - - - - - - - - ..\..\packages\System.IO\ref\netstandard1.0\System.IO.dll - True - True - - - - - - - ..\..\packages\System.IO\ref\netstandard1.3\System.IO.dll - True - True - - - - - - - ..\..\packages\System.IO\ref\netstandard1.5\System.IO.dll - True - True - - - - - - - - - ..\..\packages\System.IO.Compression\ref\netstandard1.3\System.IO.Compression.dll - True - True - - - - - - - - - ..\..\packages\System.IO.Compression.ZipFile\ref\netstandard1.3\System.IO.Compression.ZipFile.dll - True - True - - - - - - - - - ..\..\packages\System.IO.FileSystem\ref\netstandard1.3\System.IO.FileSystem.dll - True - True - - - - - - - - - ..\..\packages\System.IO.FileSystem.Primitives\ref\netstandard1.3\System.IO.FileSystem.Primitives.dll - True - True - - - - - - - - - ..\..\packages\System.Linq\ref\netstandard1.0\System.Linq.dll - True - True - - - - - - - ..\..\packages\System.Linq\ref\netstandard1.6\System.Linq.dll - True - True - - - - - - - - - ..\..\packages\System.Linq.Expressions\ref\netstandard1.0\System.Linq.Expressions.dll - True - True - - - - - - - ..\..\packages\System.Linq.Expressions\ref\netstandard1.3\System.Linq.Expressions.dll - True - True - - - - - - - ..\..\packages\System.Linq.Expressions\ref\netstandard1.6\System.Linq.Expressions.dll - True - True - - - - - - - - - ..\..\packages\System.Net.Http\ref\netstandard1.3\System.Net.Http.dll - True - True - - - - - - - - - ..\..\packages\System.Net.Primitives\ref\netstandard1.3\System.Net.Primitives.dll - True - True - - - - - - - - - ..\..\packages\System.Net.Sockets\ref\net46\System.Net.Sockets.dll - True - True - - - True - - - - - - - ..\..\packages\System.Net.Sockets\ref\netstandard1.3\System.Net.Sockets.dll - True - True - - - - - - - - - ..\..\packages\System.ObjectModel\ref\netstandard1.0\System.ObjectModel.dll - True - True - - - - - - - ..\..\packages\System.ObjectModel\ref\netstandard1.3\System.ObjectModel.dll - True - True - - - - - - - - - ..\..\packages\System.Reflection\ref\netstandard1.0\System.Reflection.dll - True - True - - - - - - - ..\..\packages\System.Reflection\ref\netstandard1.3\System.Reflection.dll - True - True - - - - - - - ..\..\packages\System.Reflection\ref\netstandard1.5\System.Reflection.dll - True - True - - - - - - - - - ..\..\packages\System.Reflection.Emit\ref\netstandard1.1\System.Reflection.Emit.dll - True - True - - - - - - - - - ..\..\packages\System.Reflection.Emit.ILGeneration\ref\netstandard1.0\System.Reflection.Emit.ILGeneration.dll - True - True - - - - - - - - - ..\..\packages\System.Reflection.Emit.Lightweight\ref\netstandard1.0\System.Reflection.Emit.Lightweight.dll - True - True - - - - - - - - - ..\..\packages\System.Reflection.Extensions\ref\netstandard1.0\System.Reflection.Extensions.dll - True - True - - - - - - - - - ..\..\packages\System.Reflection.Primitives\ref\netstandard1.0\System.Reflection.Primitives.dll - True - True - - - - - - - - - ..\..\packages\System.Reflection.TypeExtensions\ref\netstandard1.3\System.Reflection.TypeExtensions.dll - True - True - - - - - - - ..\..\packages\System.Reflection.TypeExtensions\ref\netstandard1.5\System.Reflection.TypeExtensions.dll - True - True - - - - - - - - - ..\..\packages\System.Resources.ResourceManager\ref\netstandard1.0\System.Resources.ResourceManager.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime\ref\netstandard1.0\System.Runtime.dll - True - True - - - - - - - ..\..\packages\System.Runtime\ref\netstandard1.2\System.Runtime.dll - True - True - - - - - - - ..\..\packages\System.Runtime\ref\netstandard1.3\System.Runtime.dll - True - True - - - - - - - ..\..\packages\System.Runtime\ref\netstandard1.5\System.Runtime.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime.Extensions\ref\netstandard1.0\System.Runtime.Extensions.dll - True - True - - - - - - - ..\..\packages\System.Runtime.Extensions\ref\netstandard1.3\System.Runtime.Extensions.dll - True - True - - - - - - - ..\..\packages\System.Runtime.Extensions\ref\netstandard1.5\System.Runtime.Extensions.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime.Handles\ref\netstandard1.3\System.Runtime.Handles.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime.InteropServices\ref\netstandard1.3\System.Runtime.InteropServices.dll - True - True - - - - - - - ..\..\packages\System.Runtime.InteropServices\ref\netstandard1.5\System.Runtime.InteropServices.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime.InteropServices.RuntimeInformation\ref\netstandard1.1\System.Runtime.InteropServices.RuntimeInformation.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime.Loader\ref\netstandard1.5\System.Runtime.Loader.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime.Numerics\ref\netstandard1.1\System.Runtime.Numerics.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime.Serialization.Primitives\ref\netstandard1.0\System.Runtime.Serialization.Primitives.dll - True - True - - - - - - - ..\..\packages\System.Runtime.Serialization.Primitives\ref\netstandard1.3\System.Runtime.Serialization.Primitives.dll - True - True - - - - - - - - - ..\..\packages\System.Security.Cryptography.Algorithms\ref\netstandard1.3\System.Security.Cryptography.Algorithms.dll - True - True - - - - - - - ..\..\packages\System.Security.Cryptography.Algorithms\ref\netstandard1.4\System.Security.Cryptography.Algorithms.dll - True - True - - - - - - - ..\..\packages\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll - True - True - - - - - - - - - ..\..\packages\System.Security.Cryptography.Cng\ref\netstandard1.6\System.Security.Cryptography.Cng.dll - True - True - - - - - - - - - ..\..\packages\System.Security.Cryptography.Csp\ref\netstandard1.3\System.Security.Cryptography.Csp.dll - True - True - - - - - - - - - ..\..\packages\System.Security.Cryptography.Encoding\ref\netstandard1.3\System.Security.Cryptography.Encoding.dll - True - True - - - - - - - - - ..\..\packages\System.Security.Cryptography.OpenSsl\ref\netstandard1.6\System.Security.Cryptography.OpenSsl.dll - True - True - - - - - - - - - ..\..\packages\System.Security.Cryptography.Primitives\ref\netstandard1.3\System.Security.Cryptography.Primitives.dll - True - True - - - - - - - - - ..\..\packages\System.Security.Cryptography.X509Certificates\ref\netstandard1.3\System.Security.Cryptography.X509Certificates.dll - True - True - - - - - - - ..\..\packages\System.Security.Cryptography.X509Certificates\ref\netstandard1.4\System.Security.Cryptography.X509Certificates.dll - True - True - - - - - - - - - ..\..\packages\System.Spatial\lib\net40\System.Spatial.dll - True - True - - - - - - - ..\..\packages\System.Spatial\lib\portable-net40+sl5+wp8+win8\System.Spatial.Portable.dll - True - True - - - - - - - ..\..\packages\System.Spatial\lib\sl4\System.Spatial.SL.dll - True - True - - - - - - - - - ..\..\packages\System.Text.Encoding\ref\netstandard1.0\System.Text.Encoding.dll - True - True - - - - - - - ..\..\packages\System.Text.Encoding\ref\netstandard1.3\System.Text.Encoding.dll - True - True - - - - - - - - - ..\..\packages\System.Text.Encoding.Extensions\ref\netstandard1.0\System.Text.Encoding.Extensions.dll - True - True - - - - - - - ..\..\packages\System.Text.Encoding.Extensions\ref\netstandard1.3\System.Text.Encoding.Extensions.dll - True - True - - - - - - - - - ..\..\packages\System.Text.RegularExpressions\ref\netstandard1.0\System.Text.RegularExpressions.dll - True - True - - - - - - - ..\..\packages\System.Text.RegularExpressions\ref\netstandard1.3\System.Text.RegularExpressions.dll - True - True - - - - - - - ..\..\packages\System.Text.RegularExpressions\ref\netstandard1.6\System.Text.RegularExpressions.dll - True - True - - - - - - - - - ..\..\packages\System.Threading\ref\netstandard1.0\System.Threading.dll - True - True - - - - - - - ..\..\packages\System.Threading\ref\netstandard1.3\System.Threading.dll - True - True - - - - - - - - - ..\..\packages\System.Threading.Tasks\ref\netstandard1.0\System.Threading.Tasks.dll - True - True - - - - - - - ..\..\packages\System.Threading.Tasks\ref\netstandard1.3\System.Threading.Tasks.dll - True - True - - - - - - - - - ..\..\packages\System.Threading.Tasks.Extensions\lib\netstandard1.0\System.Threading.Tasks.Extensions.dll - True - True - - - - - - - - - ..\..\packages\System.Threading.Timer\ref\netstandard1.2\System.Threading.Timer.dll - True - True - - - - - - - - - ..\..\packages\System.Xml.ReaderWriter\ref\netstandard1.0\System.Xml.ReaderWriter.dll - True - True - - - - - - - ..\..\packages\System.Xml.ReaderWriter\ref\netstandard1.3\System.Xml.ReaderWriter.dll - True - True - - - - - - - - - ..\..\packages\System.Xml.XDocument\ref\netstandard1.0\System.Xml.XDocument.dll - True - True - - - - - - - ..\..\packages\System.Xml.XDocument\ref\netstandard1.3\System.Xml.XDocument.dll - True - True - - - - - - - - - ..\..\packages\WindowsAzure.Storage\lib\net40\Microsoft.WindowsAzure.Storage.dll - True - True - - - True - - - - - \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/FubuPersistence.Tests.dll.config b/src/FubuMVC.RavenDb.Tests/FubuPersistence.Tests.dll.config deleted file mode 100644 index 5607a894c2..0000000000 --- a/src/FubuMVC.RavenDb.Tests/FubuPersistence.Tests.dll.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/InMemory/InMemoryPersistentResetTester.cs b/src/FubuMVC.RavenDb.Tests/InMemory/InMemoryPersistentResetTester.cs deleted file mode 100644 index 5fcbcb838c..0000000000 --- a/src/FubuMVC.RavenDb.Tests/InMemory/InMemoryPersistentResetTester.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Linq; -using FubuMVC.RavenDb.InMemory; -using NUnit.Framework; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.InMemory -{ - [TestFixture] - public class InMemoryPersistentResetTester - { - [Test] - public void clear_all_state() - { - var persister = new InMemoryPersistor(); - persister.Persist(new City()); - persister.Persist(new City()); - persister.Persist(new City()); - persister.Persist(new City()); - persister.Persist(new City()); - persister.Persist(new City()); - - var reset = new InMemoryPersistenceReset(persister); - - persister.LoadAll().Any().ShouldBeTrue(); - - reset.ClearPersistedState(); - - persister.LoadAll().Any().ShouldBeFalse(); - - } - } - - public class City : Entity - { - - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/InMemory/InMemoryPersistorTester.cs b/src/FubuMVC.RavenDb.Tests/InMemory/InMemoryPersistorTester.cs deleted file mode 100644 index fd95169c5f..0000000000 --- a/src/FubuMVC.RavenDb.Tests/InMemory/InMemoryPersistorTester.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System.Linq; -using FubuMVC.RavenDb.InMemory; -using NUnit.Framework; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.InMemory -{ - [TestFixture] - public class InMemoryPersistorTester - { - [Test] - public void load_all() - { - var persistor = new InMemoryPersistor(); - - persistor.Persist(new User()); - persistor.Persist(new User()); - persistor.Persist(new User()); - persistor.Persist(new OtherEntity()); - persistor.Persist(new OtherEntity()); - persistor.Persist(new ThirdEntity()); - - persistor.LoadAll().Count().ShouldBe(3); - persistor.LoadAll().Count().ShouldBe(2); - persistor.LoadAll().Count().ShouldBe(1); - } - - [Test] - public void persist() - { - var entity = new OtherEntity(); - var persistor = new InMemoryPersistor(); - - persistor.Persist(entity); - - persistor.LoadAll().Single().ShouldBeTheSameAs(entity); - } - - [Test] - public void delete_all() - { - var persistor = new InMemoryPersistor(); - - persistor.Persist(new User()); - persistor.Persist(new User()); - persistor.Persist(new User()); - persistor.Persist(new OtherEntity()); - persistor.Persist(new OtherEntity()); - persistor.Persist(new ThirdEntity()); - - persistor.DeleteAll(); - - persistor.LoadAll().Count().ShouldBe(3); - persistor.LoadAll().Count().ShouldBe(2); - persistor.LoadAll().Count().ShouldBe(0); - } - - [Test] - public void remove() - { - var persistor = new InMemoryPersistor(); - - persistor.Persist(new User()); - var user1 = new User(); - persistor.Persist(user1); - persistor.Persist(new User()); - - persistor.Remove(user1); - - persistor.LoadAll().Count().ShouldBe(2); - persistor.LoadAll().ShouldNotContain(user1); - } - - [Test] - public void find_by() - { - var persistor = new InMemoryPersistor(); - - persistor.Persist(new User()); - persistor.Persist(new User - { - FirstName = "Jeremy" - }); - persistor.Persist(new User()); - - persistor.FindBy(x => x.FirstName == "Jeremy").FirstName.ShouldBe("Jeremy"); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/Membership/LoginAuditPersistorTester.cs b/src/FubuMVC.RavenDb.Tests/Membership/LoginAuditPersistorTester.cs deleted file mode 100644 index 7d38490eaf..0000000000 --- a/src/FubuMVC.RavenDb.Tests/Membership/LoginAuditPersistorTester.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using FubuMVC.Core.Security.Authentication; -using FubuMVC.RavenDb.Membership; -using FubuMVC.Tests.TestSupport; -using NUnit.Framework; -using Raven.Client; -using Rhino.Mocks; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.Membership -{ - [TestFixture] - public class LoginAuditPersistorTester : InteractionContext - { - private IDocumentSession theSession; - private LoginRequest theRequest; - private IEntityRepository theRepository; - - protected override void beforeEach() - { - theSession = MockFor(); - theRepository = MockFor(); - theRequest = new LoginRequest(); - } - - [Test] - public void does_not_apply_history_if_username_is_empty() - { - ClassUnderTest.ApplyHistory(theRequest); - theSession.AssertWasNotCalled(x => x.Load((string) null)); - theRequest.NumberOfTries.ShouldBe(0); - theRequest.LockedOutUntil.ShouldBeNull(); - } - - [Test] - public void applies_history_if_username_is_not_empty() - { - const string userName = "foo"; - theSession.Stub(x => x.Load(userName)) - .Return(new LoginFailureHistory {Attempts = 1, LockedOutTime = DateTime.Now}); - theRequest.UserName = userName; - ClassUnderTest.ApplyHistory(theRequest); - theSession.AssertWasCalled(x => x.Load("foo")); - theRequest.NumberOfTries.ShouldBe(1); - theRequest.LockedOutUntil.HasValue.ShouldBeTrue(); - } - - [Test] - public void does_not_log_failure_if_username_is_empty() - { - var audit = new Audit(); - ClassUnderTest.LogFailure(theRequest, audit); - theRepository.AssertWasNotCalled(x => x.Update(audit)); - theSession.AssertWasNotCalled(x => x.Load((string) null)); - theSession.AssertWasNotCalled(x => x.Store(Arg.Is.Anything)); - } - - [Test] - public void logs_failure_if_username_is_not_empty() - { - const string userName = "foo"; - var audit = new Audit(); - theSession.Stub(x => x.Load(userName)) - .Return(new LoginFailureHistory {Attempts = 1, LockedOutTime = DateTime.Now}); - theRequest.UserName = userName; - ClassUnderTest.LogFailure(theRequest, audit); - theRepository.AssertWasCalled(x => x.Update(audit)); - theSession.AssertWasCalled(x => x.Load("foo")); - theSession.AssertWasCalled(x => x.Store(Arg.Is.Anything)); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/Membership/MembershipRepositoryTester.cs b/src/FubuMVC.RavenDb.Tests/Membership/MembershipRepositoryTester.cs deleted file mode 100644 index e60cd6a192..0000000000 --- a/src/FubuMVC.RavenDb.Tests/Membership/MembershipRepositoryTester.cs +++ /dev/null @@ -1,116 +0,0 @@ -using FubuMVC.Core.Security.Authentication; -using FubuMVC.RavenDb.Membership; -using NUnit.Framework; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.Membership -{ - [TestFixture] - public class MembershipRepositoryTester - { - private EntityRepository theRepository; - private PasswordHash theHash; - private MembershipRepository theMembership; - - [SetUp] - public void SetUp() - { - theRepository = EntityRepository.InMemory(); - theHash = new PasswordHash(); - - theMembership = new MembershipRepository(theRepository, theHash); - } - - [Test] - public void matches_credentials_postive() - { - var user1 = new FubuMVC.RavenDb.Membership.User - { - UserName = "jeremy", - Password = theHash.CreateHash("something") - }; - - var user2 = new FubuMVC.RavenDb.Membership.User - { - UserName = "josh", - Password = theHash.CreateHash("else") - }; - - theRepository.Update(user1); - theRepository.Update(user2); - - - theMembership.MatchesCredentials(new LoginRequest - { - UserName = "jeremy", - Password = "wrong" - }).ShouldBeFalse(); - - theMembership.MatchesCredentials(new LoginRequest - { - UserName = "jeremy", - Password = "else" - }).ShouldBeFalse(); - - theMembership.MatchesCredentials(new LoginRequest - { - UserName = "josh", - Password = "something" - }).ShouldBeFalse(); - } - - [Test] - public void matches_credentials_negative() - { - var user1 = new FubuMVC.RavenDb.Membership.User - { - UserName = "jeremy", - Password = theHash.CreateHash("something") - }; - - var user2 = new FubuMVC.RavenDb.Membership.User - { - UserName = "josh", - Password = theHash.CreateHash("else") - }; - - theRepository.Update(user1); - theRepository.Update(user2); - - - theMembership.MatchesCredentials(new LoginRequest - { - UserName = "jeremy", - Password = "something" - }).ShouldBeTrue(); - - theMembership.MatchesCredentials(new LoginRequest - { - UserName = "josh", - Password = "else" - }).ShouldBeTrue(); - } - - [Test] - public void find_by_name() - { - var user1 = new FubuMVC.RavenDb.Membership.User - { - UserName = "jeremy", - Password = theHash.CreateHash("something") - }; - - var user2 = new FubuMVC.RavenDb.Membership.User - { - UserName = "josh", - Password = theHash.CreateHash("else") - }; - - theRepository.Update(user1); - theRepository.Update(user2); - - theMembership.FindByName("jeremy").ShouldBeTheSameAs(user1); - theMembership.FindByName("josh").ShouldBeTheSameAs(user2); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/Membership/PasswordHash_is_predictable.cs b/src/FubuMVC.RavenDb.Tests/Membership/PasswordHash_is_predictable.cs deleted file mode 100644 index 4c9e9872d6..0000000000 --- a/src/FubuMVC.RavenDb.Tests/Membership/PasswordHash_is_predictable.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Diagnostics; -using FubuMVC.Core.Security.Authentication; -using NUnit.Framework; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.Membership -{ - [TestFixture] - public class PasswordHash_is_predictable - { - [Test] - public void see_it_in_action() - { - var hash = new PasswordHash(); - var password = "something"; - - for (var i = 0; i < 50; i++) - { - Debug.WriteLine(hash.CreateHash(password)); - } - - hash.CreateHash(password).ShouldBe(hash.CreateHash(password)); - hash.CreateHash(password).ShouldBe(hash.CreateHash(password)); - hash.CreateHash(password).ShouldBe(hash.CreateHash(password)); - hash.CreateHash(password).ShouldBe(hash.CreateHash(password)); - - hash.CreateHash(password).ShouldNotBe(password); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/Membership/PersistedLoginAuditorIntegratedTester.cs b/src/FubuMVC.RavenDb.Tests/Membership/PersistedLoginAuditorIntegratedTester.cs deleted file mode 100644 index 22c6027b8b..0000000000 --- a/src/FubuMVC.RavenDb.Tests/Membership/PersistedLoginAuditorIntegratedTester.cs +++ /dev/null @@ -1,245 +0,0 @@ -using System; -using System.Linq; -using FubuCore.Dates; -using FubuMVC.Core.Security.Authentication; -using FubuMVC.Core.Security.Authentication.Auditing; -using FubuMVC.RavenDb.Membership; -using FubuMVC.RavenDb.RavenDb; -using NUnit.Framework; -using Raven.Client; -using Shouldly; -using StructureMap; - -namespace FubuMVC.RavenDb.Tests.Membership -{ - [TestFixture] - public class PersistedLoginAuditorIntegratedTester - { - private SettableClock theTime; - private Container theContainer; - - [SetUp] - public void SetUp() - { - theTime = new SettableClock(); - theTime.LocalNow(LocalTime.AtMachineTime("1200")); // doesn't matter what, only needs to be constant - - theContainer = new Container(x => - { - x.IncludeRegistry(); - x.For() - .Use(new RavenDbSettings - { - RunInMemory = true, - DataDirectory = null, - Url = null, - ConnectionString = null - }); - - x.For().Use(theTime); - }); - } - - [TearDown] - public void TearDown() - { - theContainer.Dispose(); - } - - [Test] - public void write_audit_message() - { - var auditor = theContainer.GetInstance(); - auditor.Audit(new Something {UserName = "the something"}); - - var theAudit = - theContainer.GetInstance().All().Where(x => x.Type == "Something").Single(); - theAudit.Message.ShouldBeOfType().UserName.ShouldBe("the something"); - theAudit.Timestamp.ShouldBe(theTime.UtcNow()); - theAudit.Username.ShouldBe("the something"); - } - - [Test] - public void write_login_success() - { - var request = new LoginRequest - { - Status = LoginStatus.Succeeded, - UserName = "somebody" - }; - - var auditor = theContainer.GetInstance(); - auditor.Audit(request); - - var theAudit = theContainer.GetInstance().All() - .Where(x => x.Type == "LoginSuccess").Single(); - - theAudit.Message.ShouldBeOfType(); - theAudit.Timestamp.ShouldBe(theTime.UtcNow()); - theAudit.Username.ShouldBe("somebody"); - } - - [Test] - public void write_login_failure() - { - var request = new LoginRequest - { - Status = LoginStatus.Failed, - UserName = "FailedGuy" - }; - - var auditor = theContainer.GetInstance(); - auditor.Audit(request); - - var theAudit = theContainer.GetInstance().All() - .Where(x => x.Type == "LoginFailure").Single(); - - theAudit.Message.ShouldBeOfType(); - theAudit.Timestamp.ShouldBe(theTime.UtcNow()); - theAudit.Username.ShouldBe(request.UserName); - } - - - [Test] - public void when_logging_success_wipe_clean_the_login_failure_history() - { - var history = new LoginFailureHistory - { - Id = "doofus", - Attempts = 3 - }; - - theContainer.GetInstance().Execute(repo => { repo.Store(history); }); - - - var request = new LoginRequest - { - Status = LoginStatus.Succeeded, - UserName = history.Id - }; - - var auditor = theContainer.GetInstance(); - auditor.Audit(request); - } - - [Test] - public void when_logging_failure_for_a_user_that_has_no_prior_failure_history() - { - var request = new LoginRequest - { - Status = LoginStatus.Failed, - UserName = "NeverFailedBefore", - NumberOfTries = 1, - LockedOutUntil = null - }; - - var auditor = theContainer.GetInstance(); - auditor.Audit(request); - - - var history = theContainer.GetInstance().Load(request.UserName); - - - history.ShouldNotBeNull(); - history.Attempts.ShouldBe(1); - history.LockedOutTime.ShouldBeNull(); - } - - [Test] - public void when_logging_failure_for_a_user_that_is_locked_out() - { - var request = new LoginRequest - { - Status = LoginStatus.Failed, - UserName = "NeverFailedBefore", - NumberOfTries = 1, - LockedOutUntil = DateTime.Today.ToUniversalTime() - }; - - var auditor = theContainer.GetInstance(); - auditor.Audit(request); - - - var history = theContainer.GetInstance() - .Load(request.UserName); - - - history.LockedOutTime.ShouldBe(request.LockedOutUntil); - } - - [Test] - public void update_an_existing_history() - { - var history = new LoginFailureHistory - { - Id = "AlreadyFailed", - Attempts = 2 - }; - - theContainer.GetInstance().Execute(repo => { repo.Store(history); }); - - - var request = new LoginRequest - { - Status = LoginStatus.Failed, - UserName = history.Id, - NumberOfTries = 3, - LockedOutUntil = DateTime.Today.ToUniversalTime() - }; - - var auditor = theContainer.GetInstance(); - auditor.Audit(request); - - - var history2 = theContainer.GetInstance() - .Load(request.UserName); - - history2.Attempts.ShouldBe(request.NumberOfTries); - history2.LockedOutTime.ShouldBe(request.LockedOutUntil); - } - - [Test] - public void apply_history_when_there_is_no_history() - { - var request = new LoginRequest - { - NumberOfTries = 5, - UserName = "NoHistoryGuy" - }; - - - var auditor = theContainer.GetInstance(); - auditor.ApplyHistory(request); - - request.NumberOfTries.ShouldBe(5); // Nothing gets replaced - } - - [Test] - public void apply_history_when_there_is_prior_history() - { - var history = new LoginFailureHistory - { - Id = "AlreadyLockedOut", - Attempts = 3, - LockedOutTime = DateTime.Today.AddMinutes(30) - }; - - theContainer.GetInstance().Execute(repo => repo.Store(history)); - - var auditor = theContainer.GetInstance(); - var request = new LoginRequest - { - UserName = history.Id - }; - - auditor.ApplyHistory(request); - - request.NumberOfTries.ShouldBe(history.Attempts); - request.LockedOutUntil.ShouldBe(history.LockedOutTime.Value); - } - } - - public class Something : AuditMessage - { - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/Membership/PersistedMembershipIntegratedTester.cs b/src/FubuMVC.RavenDb.Tests/Membership/PersistedMembershipIntegratedTester.cs deleted file mode 100644 index 7e9fc384aa..0000000000 --- a/src/FubuMVC.RavenDb.Tests/Membership/PersistedMembershipIntegratedTester.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Linq; -using FubuMVC.Core; -using FubuMVC.Core.Security.Authentication; -using FubuMVC.Core.Security.Authentication.Membership; -using FubuMVC.RavenDb.InMemory; -using FubuMVC.RavenDb.Membership; -using NUnit.Framework; -using Shouldly; -using StructureMap; - -namespace FubuMVC.RavenDb.Tests.Membership -{ - [TestFixture] - public class PersistedMembershipIntegratedTester - { - [Test] - public void build_application_with_persisted_membership() - { - using (var runtime = FubuRuntime - .For(_ => - { - _.Features.Authentication.Enable(true); - _.Services.IncludeRegistry(); - }) - ) - { - var container = runtime.Get(); - - container.GetInstance() - .ShouldBeOfType>(); - - container.GetInstance().ShouldBeOfType(); - - container.GetAllInstances() - .OfType() - .Any(x => x.Membership is MembershipRepository).ShouldBeTrue(); - } - } - } - - public class FubuRepoWithPersistedMembership : FubuRegistry - { - public FubuRepoWithPersistedMembership() - { - Import>(); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/Membership/is_registering_the_persisted_login_auditor.cs b/src/FubuMVC.RavenDb.Tests/Membership/is_registering_the_persisted_login_auditor.cs deleted file mode 100644 index 598c09f737..0000000000 --- a/src/FubuMVC.RavenDb.Tests/Membership/is_registering_the_persisted_login_auditor.cs +++ /dev/null @@ -1,26 +0,0 @@ -using FubuMVC.Core; -using FubuMVC.Core.Security.Authentication.Auditing; -using FubuMVC.RavenDb.InMemory; -using FubuMVC.RavenDb.Membership; -using NUnit.Framework; -using Shouldly; -using StructureMap; - -namespace FubuMVC.RavenDb.Tests.Membership -{ - [TestFixture] - public class is_registering_the_persisted_login_auditor - { - [Test] - public void PersistedLoginAuditor_is_registered() - { - var container = new Container(new InMemoryPersistenceRegistry()); - using ( - var application = - FubuRuntime.For(_ => _.StructureMap(container))) - { - application.Get().ShouldBeOfType(); - } - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/MultiTenancy/ByTenantEntityStorageTester.cs b/src/FubuMVC.RavenDb.Tests/MultiTenancy/ByTenantEntityStorageTester.cs deleted file mode 100644 index e4b61f9299..0000000000 --- a/src/FubuMVC.RavenDb.Tests/MultiTenancy/ByTenantEntityStorageTester.cs +++ /dev/null @@ -1,255 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using FubuMVC.RavenDb.InMemory; -using FubuMVC.RavenDb.MultiTenancy; -using FubuMVC.RavenDb.Storage; -using NUnit.Framework; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.MultiTenancy -{ - [TestFixture] - public class ByTenantEntityStorageTester - { - private EntityStorage inner; - private SimpleTenantContext theContext; - private ByTenantEntityStorage theStorage; - - [SetUp] - public void SetUp() - { - inner = new EntityStorage(new InMemoryPersistor()); - theContext = new SimpleTenantContext - { - CurrentTenant = Guid.NewGuid() - }; - - theStorage = new ByTenantEntityStorage(inner, theContext); - } - - [Test] - public void find_throws_exception_if_there_is_no_tenant() - { - theContext.CurrentTenant = Guid.Empty; - - Exception.ShouldBeThrownBy(() => { - theStorage.Find(Guid.NewGuid()); - }); - } - - [Test] - public void find_when_the_tenant_id_matches() - { - var entity = new TrackedEntity - { - TenantId = theContext.CurrentTenant, - Id = Guid.NewGuid() - }; - - inner.Update(entity); - - theStorage.Find(entity.Id).ShouldBeTheSameAs(entity); - } - - [Test] - public void find_when_the_entity_does_not_match_the_tenant() - { - var entity = new TrackedEntity - { - TenantId = Guid.NewGuid(), - Id = Guid.NewGuid() - }; - - inner.Update(entity); - - theStorage.Find(entity.Id).ShouldBeNull(); - } - - [Test] - public void update_will_throw_an_exception_if_there_is_no_tenant() - { - theContext.CurrentTenant = Guid.Empty; - - Exception.ShouldBeThrownBy(() => - { - theStorage.Update(new TrackedEntity()); - }); - } - - [Test] - public void update_should_set_the_tenant_id_before_updating_to_the_inner() - { - var entity = new TrackedEntity - { - Id = Guid.NewGuid() - }; - - theStorage.Update(entity); - - entity.TenantId.ShouldBe(theContext.CurrentTenant); - - inner.Find(entity.Id).ShouldBeTheSameAs(entity); - } - - [Test] - public void update_will_throw_an_exception_if_you_try_to_update_an_entity_that_is_not_owned_by_the_current_tenant() - { - var original = new TrackedEntity - { - Id = Guid.NewGuid(), - TenantId = Guid.NewGuid() - }; - - inner.Update(original); - - var newEntity = new TrackedEntity - { - Id = original.Id - }; - - Exception.ShouldBeThrownBy(() => { - theStorage.Update(newEntity); - }); - } - - [Test] - public void remove_throws_exception_if_no_tenant_is_detected() - { - theContext.CurrentTenant = Guid.Empty; - - Exception.ShouldBeThrownBy(() => - { - theStorage.Remove(new TrackedEntity()); - }); - } - - [Test] - public void remove_throws_exception_if_the_entity_is_owned_by_a_different_tenant() - { - var original = new TrackedEntity - { - Id = Guid.NewGuid(), - TenantId = Guid.NewGuid() - }; - - inner.Update(original); - - var newEntity = new TrackedEntity - { - Id = original.Id - }; - - Exception.ShouldBeThrownBy(() => - { - theStorage.Remove(newEntity); - }); - } - - [Test] - public void remove_happy_path() - { - var original = new TrackedEntity - { - Id = Guid.NewGuid(), - TenantId = theContext.CurrentTenant - }; - - inner.Update(original); - - var newEntity = new TrackedEntity - { - Id = original.Id - }; - - theStorage.Remove(newEntity); - - inner.All().Any().ShouldBeFalse(); - } - - [Test] - public void all_will_throw_exceptions_if_no_tenant_is_detected() - { - theContext.CurrentTenant = Guid.Empty; - - Exception.ShouldBeThrownBy(() => { - theStorage.All().Each(x => Debug.WriteLine(x)); - }); - } - - [Test] - public void all_only_returns_values_where_the_tenant_id_matches() - { - var e1 = new TrackedEntity {TenantId = theContext.CurrentTenant}; - var e2 = new TrackedEntity {TenantId = theContext.CurrentTenant}; - var e3 = new TrackedEntity {TenantId = Guid.NewGuid()}; - var e4 = new TrackedEntity {TenantId = theContext.CurrentTenant}; - var e5 = new TrackedEntity {TenantId = theContext.CurrentTenant}; - var e6 = new TrackedEntity { TenantId = Guid.NewGuid() }; - var e7 = new TrackedEntity {TenantId = theContext.CurrentTenant}; - - inner.Update(e1); - inner.Update(e2); - inner.Update(e3); - inner.Update(e4); - inner.Update(e5); - inner.Update(e6); - inner.Update(e7); - - theStorage.All().ShouldHaveTheSameElementsAs(e1, e2, e4, e5, e7); - } - - [Test] - public void find_single_throws_exception_if_no_tenant() - { - theContext.CurrentTenant = Guid.Empty; - - Exception.ShouldBeThrownBy(() => { - theStorage.FindSingle(x => x.Id == Guid.NewGuid()); - }); - } - - [Test] - public void find_single_happy_path() - { - var original = new TrackedEntity - { - Id = Guid.NewGuid(), - TenantId = theContext.CurrentTenant, - Name = "Jeremy" - }; - - inner.Update(original); - - inner.Update(new TrackedEntity - { - Name = original.Name, - TenantId = Guid.NewGuid() - }); - - theStorage.FindSingle(x => x.Name == "Jeremy").ShouldBeTheSameAs(original); - } - - [Test] - public void find_single_does_not_find_anything_from_the_same_tenant() - { - var original = new TrackedEntity - { - Id = Guid.NewGuid(), - TenantId = Guid.NewGuid(), - Name = "Jeremy" - }; - - inner.Update(original); - - theStorage.FindSingle(x => x.Name == "Jeremy") - .ShouldBeNull(); - } - } - - public class TrackedEntity : TenantedEntity - { - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/MultiTenancy/ByTenantStoragePolicyTester.cs b/src/FubuMVC.RavenDb.Tests/MultiTenancy/ByTenantStoragePolicyTester.cs deleted file mode 100644 index 24de6d0b7e..0000000000 --- a/src/FubuMVC.RavenDb.Tests/MultiTenancy/ByTenantStoragePolicyTester.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using FubuMVC.RavenDb.InMemory; -using FubuMVC.RavenDb.MultiTenancy; -using FubuMVC.RavenDb.Storage; -using NUnit.Framework; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.MultiTenancy -{ - [TestFixture] - public class ByTenantStoragePolicyTester - { - private SimpleTenantContext theContext; - private ByTenantStoragePolicy thePolicy; - - [SetUp] - public void SetUp() - { - theContext = new SimpleTenantContext - { - CurrentTenant = Guid.NewGuid() - }; - - thePolicy = new ByTenantStoragePolicy(theContext); - } - - [Test] - public void matches_negative() - { - thePolicy.Matches().ShouldBeFalse(); - } - - [Test] - public void matches_positive() - { - thePolicy.Matches().ShouldBeTrue(); - } - - [Test] - public void wrap() - { - var inner = new EntityStorage(new InMemoryPersistor()); - - thePolicy.Wrap(inner).ShouldBeOfType>() - .Context.ShouldBeTheSameAs(theContext); - } - } - - public class MyTenantedEntity : TenantedEntity - { - - } - - public class GlobalEntity : Entity - { - - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/Properties/AssemblyInfo.cs b/src/FubuMVC.RavenDb.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index 74d194cefe..0000000000 --- a/src/FubuMVC.RavenDb.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FubuMVC.RavenDb.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("FubuMVC.RavenDb.Tests")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2012")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("2bedcfe9-1b08-44af-98aa-eef4073fc399")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/FubuMVC.RavenDb.Tests/RavenDb/DocumentStoreBuilderTester.cs b/src/FubuMVC.RavenDb.Tests/RavenDb/DocumentStoreBuilderTester.cs deleted file mode 100644 index 852978d679..0000000000 --- a/src/FubuMVC.RavenDb.Tests/RavenDb/DocumentStoreBuilderTester.cs +++ /dev/null @@ -1,31 +0,0 @@ -using FubuMVC.RavenDb.RavenDb; -using NUnit.Framework; -using Raven.Client.Embedded; -using Raven.Imports.Newtonsoft.Json; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.RavenDb -{ - [TestFixture] - public class DocumentStoreBuilderTester - { - [Test] - public void simple_construction() - { - var settings = new RavenDbSettings - { - RunInMemory = true - }; - - var actions = new IDocumentStoreConfigurationAction[] - {new CustomizeRavenJsonSerializer(new JsonConverter[0]),}; - - var builder = new DocumentStoreBuilder(settings, actions); - var store = builder.Build().ShouldBeOfType(); - store.RunInMemory.ShouldBeTrue(); - store.Conventions.CustomizeJsonSerializer.ShouldNotBeNull(); - - store.Dispose(); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/EmbeddedDatabaseRunnerTester.cs b/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/EmbeddedDatabaseRunnerTester.cs deleted file mode 100644 index d007dce9d7..0000000000 --- a/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/EmbeddedDatabaseRunnerTester.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System.Linq; -using System.Runtime.CompilerServices; -using FubuMVC.RavenDb.RavenDb; -using NUnit.Framework; -using Shouldly; -using StructureMap; - -namespace FubuMVC.RavenDb.Tests.RavenDb.Integration -{ - [TestFixture, Explicit] - public class EmbeddedDatabaseRunnerTester - { - private EmbeddedDatabaseRunner theRunner; - private Container container; - - [SetUp] - public void FixtureSetUp() - { - theRunner = new EmbeddedDatabaseRunner(); - theRunner.Start(); - - container = new Container(x => { - x.IncludeRegistry(); - - x.For().Use(new RavenDbSettings {Url = "http://localhost:8080"}); - }); - } - - [TearDown] - public void FixtureTeardown() - { - theRunner.Dispose(); - container.Dispose(); - } - - [Test] - public void can_connect_remotely() - { - var transaction = container.GetInstance(); - - transaction.WithRepository(repo => { - repo.Update(new Entity1{Name = "Jeremy"}); - repo.Update(new Entity1{Name = "Josh"}); - repo.Update(new Entity1{Name = "Roy"}); - }); - - transaction.WithRepository(repo => { - repo.All().Select(x => x.Name).ToList().OrderBy(x => x) - .ShouldHaveTheSameElementsAs("Jeremy", "Josh", "Roy"); - }); - } - - [Test, Explicit("I think this design doesn't work anyway, too many requests")] - public void clear_persisted_state() - { - var transaction = container.GetInstance(); - - transaction.WithRepository(repo => - { - repo.Update(new Entity1 { Name = "Jeremy" }); - repo.Update(new Entity1 { Name = "Josh" }); - repo.Update(new Entity1 { Name = "Roy" }); - - repo.Update(new Entity2 { Name = "Jeremy" }); - repo.Update(new Entity2 { Name = "Josh" }); - repo.Update(new Entity2 { Name = "Roy" }); - - repo.Update(new Entity3 { Name = "Jeremy" }); - repo.Update(new Entity3 { Name = "Josh" }); - repo.Update(new Entity3 { Name = "Roy" }); - }); - - theRunner.ClearPersistedState(); - - transaction.WithRepository(repo => { - repo.All().Any().ShouldBeFalse(); - repo.All().Any().ShouldBeFalse(); - repo.All().Any().ShouldBeFalse(); - }); - } - - public class Entity1 : Entity - { - public string Name { get; set; } - } - public class Entity2 : Entity1{} - public class Entity3 : Entity1{} - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/MultipleDatabaseConstructionTester.cs b/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/MultipleDatabaseConstructionTester.cs deleted file mode 100644 index db6d46e066..0000000000 --- a/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/MultipleDatabaseConstructionTester.cs +++ /dev/null @@ -1,149 +0,0 @@ -using System; -using FubuMVC.RavenDb.RavenDb; -using FubuMVC.RavenDb.RavenDb.Multiple; -using NUnit.Framework; -using Raven.Client; -using Raven.Client.Document; -using Shouldly; -using StructureMap; - -namespace FubuMVC.RavenDb.Tests.RavenDb.Integration -{ - [TestFixture] - public class MultipleDatabaseConstructionTester - { - private Container theContainer; - - [SetUp] - public void SetUp() - { - theContainer = new Container(x => { - x.ConnectToRavenDb(store => { - store.Conventions.DefaultQueryingConsistency = ConsistencyOptions.None; - }); - x.ConnectToRavenDb(store => { - store.Conventions.DefaultQueryingConsistency = ConsistencyOptions.AlwaysWaitForNonStaleResultsAsOfLastWrite; - }); - - x.IncludeRegistry(); - x.For().Use(() => RavenDbSettings.InMemory()); - x.For().Use(new SecondDbSettings {RunInMemory = true}); - x.For().Use(new ThirdDbSettings {RunInMemory = true}); - }); - } - - [TearDown] - public void TearDown() - { - theContainer.Dispose(); - } - - [Test] - public void can_create_database_store_per_type() - { - theContainer.GetInstance>() - .ShouldNotBeNull(); - - theContainer.GetInstance>() - .ShouldNotBeNull(); - } - - [Test] - public void respects_the_configuration_per_store_setting_type() - { - theContainer.GetInstance>() - .Conventions.DefaultQueryingConsistency - .ShouldBe(ConsistencyOptions.None); - - theContainer.GetInstance>() - .Conventions.DefaultQueryingConsistency - .ShouldBe(ConsistencyOptions.AlwaysWaitForNonStaleResultsAsOfLastWrite); - } - - [Test] - public void document_store_is_singleton() - { - theContainer.GetInstance>() - .ShouldBeTheSameAs(theContainer.GetInstance>()); - - theContainer.GetInstance>() - .ShouldBeTheSameAs(theContainer.GetInstance>()); - } - - [Test] - public void can_build_document_session_per_type() - { - theContainer.GetInstance>() - .ShouldBeOfType>(); - - theContainer.GetInstance>() - .ShouldBeOfType>(); - } - - [Test] - public void default_raven_store_is_identified_as_Default() - { - theContainer.GetInstance() - .Identifier.ShouldBe("Default"); - } - - [Test] - public void other_raven_stores_are_identified_as_the_type() - { - theContainer.GetInstance>() - .Identifier.ShouldBe("SecondDbSettings"); - - theContainer.GetInstance>() - .Identifier.ShouldBe("ThirdDbSettings"); - } - - - [Test] - public void session_boundary_respects_transaction_boundaries() - { - var foo1 = new Foo {Id = Guid.NewGuid(), Name = "Jeremy"}; - var foo2 = new Foo {Id = foo1.Id, Name = "Josh"}; - - var transaction = theContainer.GetInstance(); - transaction.Execute>(x => x.Store(foo1)); - transaction.Execute>(x => x.Store(foo2)); - - transaction.Execute>(session => { - session.Load(foo1.Id).Name.ShouldBe("Jeremy"); - }); - - transaction.Execute>(session => - { - session.Load(foo1.Id).Name.ShouldBe("Josh"); - }); - - transaction.Execute>(session => - { - session.Load(foo1.Id).Name.ShouldBe("Jeremy"); - }); - - transaction.Execute>(session => - { - session.Load(foo1.Id).Name.ShouldBe("Josh"); - }); - } - } - - public class SecondDbSettings : RavenDbSettings - { - - } - - public class ThirdDbSettings : RavenDbSettings - { - - } - - - - public class Foo - { - public Guid Id { get; set; } - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/Replacing_database_settings_tester.cs b/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/Replacing_database_settings_tester.cs deleted file mode 100644 index 84370e6118..0000000000 --- a/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/Replacing_database_settings_tester.cs +++ /dev/null @@ -1,31 +0,0 @@ -using FubuMVC.Core; -using FubuMVC.Core.Runtime; -using NUnit.Framework; -using Raven.Client; -using Raven.Client.Embedded; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.RavenDb.Integration -{ - [TestFixture] - public class Replacing_database_settings_tester - { - [Test] - public void can_replace_with_new_database() - { - using (var runtime = FubuRuntime.Basic()) - { - var original = runtime.Get(); - - runtime.Get().UseInMemoryDatastore(); - - var current = runtime.Get(); - current - .ShouldBeOfType() - .RunInMemory.ShouldBeTrue(); - - current.ShouldNotBeTheSameAs(original); - } - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/TransactionBehaviorIntegratedTester.cs b/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/TransactionBehaviorIntegratedTester.cs deleted file mode 100644 index 35e4d54826..0000000000 --- a/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/TransactionBehaviorIntegratedTester.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Net; -using FubuMVC.Core; -using FubuMVC.Core.Ajax; -using FubuMVC.Core.Http.Hosting; -using FubuMVC.RavenDb.InMemory; -using FubuMVC.RavenDb.MultiTenancy; -using FubuMVC.RavenDb.RavenDb; -using NUnit.Framework; -using Raven.Client; -using Shouldly; -using StructureMap; - -namespace FubuMVC.RavenDb.Tests.RavenDb.Integration -{ - [TestFixture] - public class TransactionBehaviorIntegratedTester - { - [Test] - public void posts_are_committed() - { - var container = new Container(new RavenDbRegistry()); - container.Configure(x => x.For().Use()); - - container.Inject(new RavenDbSettings{RunInMemory = true}); - - using (var application = FubuRuntime.For(_ => - { - _.StructureMap(container); - _.HostWith(); - })) - { - application.Scenario(_ => - { - _.Post.Json(new NamedEntity {Name = "Jeremy"}); - }); - - application.Scenario(_ => - { - _.Post.Json(new NamedEntity { Name = "Josh" }); - }); - - application.Scenario(_ => - { - _.Post.Json(new NamedEntity { Name = "Vyrak" }); - }); - - - - - application.Get().Execute(session => { - session.Query() - .Customize(x => x.WaitForNonStaleResults()) - .Each(x => Debug.WriteLine(x.Name)); - }); - - - application.Scenario(_ => - { - _.Get.Action(x => x.get_names()); - _.Response.Body.ReadAsJson() - .Names.ShouldHaveTheSameElementsAs("Jeremy", "Josh", "Vyrak"); - }); - } - } - } - - public class NamedEntityRegistry : FubuRegistry - { - public NamedEntityRegistry() - { - Services.ReplaceService(new RavenDbSettings { RunInMemory = true}); - Policies.Local.Add(); - } - } - - public class FakeEntityEndpoint - { - private readonly IEntityRepository _repository; - - public FakeEntityEndpoint(IEntityRepository repository) - { - _repository = repository; - } - - public NamesResponse get_names() - { - return new NamesResponse - { - Names = _repository.All().OrderBy(x => x.Name).Select(x => x.Name).ToArray() - }; - } - - public AjaxContinuation post_name(NamedEntity entity) - { - _repository.Update(entity); - - return AjaxContinuation.Successful(); - } - } - - public class NamesResponse - { - public string[] Names { get; set; } - } - - public class NamedEntity : Entity - { - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/builds_a_dispose_raven_session_log_message.cs b/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/builds_a_dispose_raven_session_log_message.cs deleted file mode 100644 index c277046471..0000000000 --- a/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/builds_a_dispose_raven_session_log_message.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Security.Principal; -using System.Threading; -using FubuMVC.Core.Http.Owin; -using FubuMVC.RavenDb.RavenDb; -using NUnit.Framework; -using Raven.Client; -using Rhino.Mocks; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.RavenDb.Integration -{ - public class builds_a_dispose_raven_session_log_message - { - private DisposeRavenSessionMessage theMessage; - - [SetUp] - public void SetUp() - { - var advanced = MockRepository.GenerateMock(); - advanced.Stub(x => x.NumberOfRequests).Return(10); - var session = MockRepository.GenerateMock(); - session.Stub(x => x.Advanced).Return(advanced); - - session.Advanced.NumberOfRequests.ShouldBe(10); - - var request = new OwinHttpRequest(); - request.FullUrl("http://something/somethingelse"); - request.HttpMethod("GET"); - - var currentPrincipal = new GenericPrincipal(new GenericIdentity("bob"), new string[0]); - Thread.CurrentPrincipal = currentPrincipal; - - theMessage = DisposeRavenSessionMessage.For(session); - } - - [Test] - public void the_username_is_correct() - { - theMessage.UserName.ShouldBe("bob"); - } - - [Test] - public void the_request_number_is_correct() - { - theMessage.Requests.ShouldBe(10); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/builds_a_transactional_behavior_raven_session_log_message.cs b/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/builds_a_transactional_behavior_raven_session_log_message.cs deleted file mode 100644 index f774351898..0000000000 --- a/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/builds_a_transactional_behavior_raven_session_log_message.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.Security.Principal; -using System.Threading; -using FubuMVC.Core.Http.Owin; -using NUnit.Framework; -using Raven.Client; -using Rhino.Mocks; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.RavenDb.Integration -{ - public class builds_a_transactional_behavior_raven_session_log_message - { - private TransactionalBehaviorRavenSessionUsageMessage theMessage; - - [SetUp] - public void SetUp() - { - var advanced = MockRepository.GenerateMock(); - advanced.Stub(x => x.NumberOfRequests).Return(10); - var session = MockRepository.GenerateMock(); - session.Stub(x => x.Advanced).Return(advanced); - - session.Advanced.NumberOfRequests.ShouldBe(10); - - var request = new OwinHttpRequest(); - request.FullUrl("http://something/somethingelse"); - request.HttpMethod("GET"); - - var currentPrincipal = new GenericPrincipal(new GenericIdentity("bob"), new string[0]); - Thread.CurrentPrincipal = currentPrincipal; - - theMessage = TransactionalBehaviorRavenSessionUsageMessage.For(session, request); - } - - [Test] - public void the_url_is_correct() - { - theMessage.Url.ShouldBe("http://something/somethingelse"); - } - - [Test] - public void the_username_is_correct() - { - theMessage.UserName.ShouldBe("bob"); - } - - [Test] - public void the_request_number_is_correct() - { - theMessage.Requests.ShouldBe(10); - } - - [Test] - public void the_http_method_is_correct() - { - theMessage.HttpMethod.ShouldBe("GET"); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/plugging_in_a_custom_interface_for_an_additional_database.cs b/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/plugging_in_a_custom_interface_for_an_additional_database.cs deleted file mode 100644 index a3ef5a19a3..0000000000 --- a/src/FubuMVC.RavenDb.Tests/RavenDb/Integration/plugging_in_a_custom_interface_for_an_additional_database.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using FubuMVC.RavenDb.RavenDb; -using FubuMVC.RavenDb.RavenDb.Multiple; -using NUnit.Framework; -using Raven.Client.Document; -using Shouldly; -using StructureMap; - -namespace FubuMVC.RavenDb.Tests.RavenDb.Integration -{ - [TestFixture] - public class plugging_in_a_custom_interface_for_an_additional_database - { - private Container theContainer; - - [SetUp] - public void SetUp() - { - theContainer = new Container(x => - { - x.ConnectToRavenDb(store => - { - store.Conventions.DefaultQueryingConsistency = ConsistencyOptions.None; - }).Using(); - - - x.IncludeRegistry(); - x.For().Use(() => RavenDbSettings.InMemory()); - x.For().Use(new FourthDbSettings { RunInMemory = true }); - }); - } - - [TearDown] - public void TearDown() - { - theContainer.Dispose(); - } - - [Test] - public void session_boundary_respects_transaction_boundaries() - { - var foo1 = new Foo { Id = Guid.NewGuid(), Name = "Jeremy" }; - - var transaction = theContainer.GetInstance(); - transaction.Execute(x => x.Store(foo1)); - - transaction.Execute(session => - { - session.Load(foo1.Id).Name.ShouldBe("Jeremy"); - }); - - transaction.Execute(session => - { - session.Load(foo1.Id).Name.ShouldBe("Jeremy"); - }); - - - } - } - - public class FourthDbSettings : RavenDbSettings - { - - } - - public interface IFourthDatabase : IDocumentSession { } - - public class FourthDatabase : DocumentSession, IFourthDatabase - { - public FourthDatabase(ISessionBoundary boundary) : base(boundary) - { - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/RavenDb/LambdaDocumentStoreConfigurationTester.cs b/src/FubuMVC.RavenDb.Tests/RavenDb/LambdaDocumentStoreConfigurationTester.cs deleted file mode 100644 index 60f2059fe2..0000000000 --- a/src/FubuMVC.RavenDb.Tests/RavenDb/LambdaDocumentStoreConfigurationTester.cs +++ /dev/null @@ -1,56 +0,0 @@ -using FubuMVC.RavenDb.RavenDb; -using NUnit.Framework; -using Raven.Client; -using Raven.Client.Document; -using Shouldly; -using StructureMap; -using StructureMap.Configuration.DSL; - -namespace FubuMVC.RavenDb.Tests.RavenDb -{ - [TestFixture] - public class LambdaDocumentStoreConfigurationTester - { - [Test] - public void registers_and_uses_a_lambda_configuration_action() - { - var registry = new Registry(); - registry.RavenDbConfiguration(store => { - store.Conventions.DefaultQueryingConsistency = ConsistencyOptions.AlwaysWaitForNonStaleResultsAsOfLastWrite; - }); - - var container = new Container(x => { - x.IncludeRegistry(); - x.IncludeRegistry(registry); - x.For().Use(() => RavenDbSettings.InMemory()); - }); - - container.GetInstance().Conventions - .DefaultQueryingConsistency.ShouldBe(ConsistencyOptions.AlwaysWaitForNonStaleResultsAsOfLastWrite); - - container.Dispose(); - } - - [Test] - public void registers_and_uses_a_lambda_configuration_action_2() - { - var registry = new Registry(); - registry.RavenDbConfiguration(store => - { - store.Conventions.DefaultQueryingConsistency = ConsistencyOptions.None; - }); - - var container = new Container(x => - { - x.IncludeRegistry(); - x.IncludeRegistry(registry); - x.For().Use(() => RavenDbSettings.InMemory()); - }); - - container.GetInstance().Conventions - .DefaultQueryingConsistency.ShouldBe(ConsistencyOptions.None); - - container.Dispose(); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/RavenDb/RavenDbSettingsTester.cs b/src/FubuMVC.RavenDb.Tests/RavenDb/RavenDbSettingsTester.cs deleted file mode 100644 index 9cd7d30e2f..0000000000 --- a/src/FubuMVC.RavenDb.Tests/RavenDb/RavenDbSettingsTester.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System; -using System.Threading; -using FubuMVC.RavenDb.RavenDb; -using NUnit.Framework; -using Raven.Client; -using Raven.Client.Document; -using Raven.Client.Embedded; -using Raven.Database.Extensions; -using Shouldly; -using Process = System.Diagnostics.Process; - -namespace FubuMVC.RavenDb.Tests.RavenDb -{ - [TestFixture] - public class RavenDbSettingsTester - { - [Test] - public void builds_in_memory() - { - var settings = new RavenDbSettings {RunInMemory = true}; - using (var store = settings.Create()) - { - store.ShouldBeOfType().RunInMemory.ShouldBeTrue(); - } - } - - [Test] - public void uses_the_port_number_if_it_is_non_zero() - { - var settings = new RavenDbSettings { RunInMemory = true, Port = 8081}; - - using (var store = settings.Create()) - { - store.ShouldBeOfType() - .Configuration.Port.ShouldBe(8081); - } - } - - [Test] - public void uses_default_port_number_if_none() - { - var settings = new RavenDbSettings { RunInMemory = true }; - - using (var store = settings.Create()) - { - // 8080 is RavenDb's default port number - store.ShouldBeOfType() - .Configuration.Port.ShouldBe(8080); - } - } - - - [Test] - public void build_empty_does_not_throw_but_connects_to_the_parallel_data_folder() - { - using( var store = new RavenDbSettings().Create()) - { - store.ShouldBeOfType() - .DataDirectory.ShouldEndWith("data"); - } - - } - - [Test] - public void in_memory_is_wait_for_it_in_memory() - { - var settings = RavenDbSettings.InMemory(); - - var store = settings.Create(); - store.ShouldBeOfType().RunInMemory.ShouldBeTrue(); - - store.Dispose(); - } - - [Test] - public void build_in_memory() - { - var store = createStore(x => x.RunInMemory = true); - store.RunInMemory.ShouldBeTrue(); - store.UseEmbeddedHttpServer.ShouldBeFalse(); - - store.Dispose(); - } - - [Test] - public void build_using_embedded_http_server_in_memory() - { - var store = createStore(x => - { - x.RunInMemory = true; - x.UseEmbeddedHttpServer = true; - }); - store.RunInMemory.ShouldBeTrue(); - store.UseEmbeddedHttpServer.ShouldBeTrue(); - - store.Dispose(); - } - - [Test] - public void build_using_embedded_http_server_with_data_directory() - { - var store = createStore(x => - { - x.DataDirectory = "data".ToFullPath(); - x.UseEmbeddedHttpServer = true; - }); - store.DataDirectory.ShouldBe("data".ToFullPath()); - store.UseEmbeddedHttpServer.ShouldBeTrue(); - - store.Dispose(); - } - - [Test] - public void build_with_data_directory() - { - var store = createStore(x => x.DataDirectory = "data".ToFullPath()); - store.DataDirectory.ShouldBe("data".ToFullPath()); - store.UseEmbeddedHttpServer.ShouldBeFalse(); - store.Dispose(); - } - - [Test] - public void build_with_url() - { - var store = createStore(x => x.Url = "http://somewhere:8080"); - store.Url.ShouldBe("http://somewhere:8080"); - - store.Dispose(); - } - - [Test] - public void is_empty() - { - new RavenDbSettings().IsEmpty().ShouldBeTrue(); - - new RavenDbSettings - { - RunInMemory = true - }.IsEmpty().ShouldBeFalse(); - - new RavenDbSettings - { - DataDirectory = "data" - }.IsEmpty().ShouldBeFalse(); - - new RavenDbSettings - { - Url = "http://server.com" - }.IsEmpty().ShouldBeFalse(); - } - - private T createStore(Action setup) where T : IDocumentStore - { - var settings = new RavenDbSettings(); - if (setup != null) setup(settings); - using (var documentStore = settings.Create()) - { - return documentStore.ShouldBeOfType(); - } - } - - [Test, Explicit] - public void load_a_store_with_explicit_port_see_the_hosted_url() - { - var settings = new RavenDbSettings {RunInMemory = true, Port = 8082, UseEmbeddedHttpServer = true}; - using (var store = settings.Create()) - { - store.Initialize(); - - using (var session = store.OpenSession()) - { - session.Store(new House - { - Whose = "Mine", - Id = Guid.NewGuid() - }); - - session.SaveChanges(); - } - - - Process.Start("http://localhost:8082"); - - Thread.Sleep(30000); - - - } - } - } - - public class House : Entity - { - public string Whose { get; set; } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/RavenDb/RavenPersistenceResetTester.cs b/src/FubuMVC.RavenDb.Tests/RavenDb/RavenPersistenceResetTester.cs deleted file mode 100644 index 987a84b390..0000000000 --- a/src/FubuMVC.RavenDb.Tests/RavenDb/RavenPersistenceResetTester.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System.Linq; -using System.Threading; -using FubuCore; -using FubuMVC.RavenDb.RavenDb; -using FubuMVC.RavenDb.RavenDb.Multiple; -using FubuMVC.RavenDb.Reset; -using FubuMVC.RavenDb.Tests.RavenDb.Integration; -using NUnit.Framework; -using Shouldly; -using StructureMap; -using Process = System.Diagnostics.Process; - -namespace FubuMVC.RavenDb.Tests.RavenDb -{ - [TestFixture] - public class RavenPersistenceResetTester - { - private Container container; - private RavenUnitOfWork theUnitOfWork; - private IPersistenceReset theReset; - - [SetUp] - public void SetUp() - { - container = new Container(new RavenDbRegistry()); - container.Inject(new RavenDbSettings { RunInMemory = true }); - - theReset = container.GetInstance(); - theUnitOfWork = new RavenUnitOfWork(container); - } - - [TearDown] - public void TearDown() - { - container.Dispose(); - } - - [Test, Explicit("Manual only testing")] - public void can_access_the_new_store_by_url() - { - theReset.ClearPersistedState(); - Process.Start("http://localhost:8080"); - Thread.Sleep(60000); - } - - [Test] - public void can_find_other_setting_types() - { - container.Inject(new SecondDbSettings()); - container.Inject(new ThirdDbSettings()); - container.Inject(new FourthDbSettings()); - - theReset.As() - .FindOtherSettingTypes() - .OrderBy(x => x.Name) - .ShouldHaveTheSameElementsAs(typeof(FourthDbSettings), typeof(SecondDbSettings), typeof(ThirdDbSettings)); - - - } - - [Test] - public void reset_wipes_the_slate_clean() - { - var repo = theUnitOfWork.Start(); - - repo.Update(new User()); - repo.Update(new User()); - repo.Update(new User()); - repo.Update(new OtherEntity()); - repo.Update(new OtherEntity()); - repo.Update(new ThirdEntity()); - - theUnitOfWork.Commit(); - - theReset.ClearPersistedState(); - - repo = theUnitOfWork.Start(); - - repo.All().Count().ShouldBe(0); - repo.All().Count().ShouldBe(0); - repo.All().Count().ShouldBe(0); - } - } - - [TestFixture, Explicit("some cleanup problems here.")] - public class when_clearing_persisted_state_with_multiple_settings - { - [Test] - public void ejects_the_store_for_each_and_uses_in_memory_for_each_additional_type_of_setting() - { - var theContainer = new Container(x => - { - x.IncludeRegistry(); - x.ConnectToRavenDb(); - x.ConnectToRavenDb(); - - x.For().Use(new SecondDbSettings {RunInMemory = true}); - x.For().Use(new ThirdDbSettings {RunInMemory = true}); - }); - - var store2a = theContainer.GetInstance>(); - var store3a = theContainer.GetInstance>(); - - theContainer.GetInstance().ClearPersistedState(); - - theContainer.GetInstance>() - .ShouldNotBeTheSameAs(store2a); - - - theContainer.GetInstance>() - .ShouldNotBeTheSameAs(store3a); - - var newSettings = theContainer.GetInstance(); - newSettings - .RunInMemory.ShouldBeTrue(); - - newSettings.Url.ShouldBeNull(); - newSettings.ConnectionString.ShouldBeNull(); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/RavenDb/RavenPersistorTester.cs b/src/FubuMVC.RavenDb.Tests/RavenDb/RavenPersistorTester.cs deleted file mode 100644 index 2ae7d943f9..0000000000 --- a/src/FubuMVC.RavenDb.Tests/RavenDb/RavenPersistorTester.cs +++ /dev/null @@ -1,153 +0,0 @@ -using System; -using System.Linq; -using FubuMVC.RavenDb.RavenDb; -using NUnit.Framework; -using Raven.Client; -using Raven.Client.Document; -using Shouldly; -using StructureMap; - -namespace FubuMVC.RavenDb.Tests.RavenDb -{ - [TestFixture] - public class RavenPersistorTester - { - private Container container; - private RavenPersistor persistor; - private IDocumentStore documents; - private ISessionBoundary boundary; - private IContainer nested; - - [SetUp] - public void SetUp() - { - container = new Container(new RavenDbRegistry()); - container.Inject(new RavenDbSettings - { - RunInMemory = true - }); - - nested = container.GetNestedContainer(); - - documents = nested.GetInstance(); - documents.Conventions.DefaultQueryingConsistency = ConsistencyOptions.AlwaysWaitForNonStaleResultsAsOfLastWrite; - - persistor = nested.GetInstance(); - boundary = nested.GetInstance(); - } - - [TearDown] - public void TearDown() - { - nested.Dispose(); - container.Dispose(); - } - - [Test] - public void load_all() - { - persistor.Persist(new User()); - persistor.Persist(new User()); - persistor.Persist(new User()); - persistor.Persist(new OtherEntity()); - persistor.Persist(new OtherEntity()); - persistor.Persist(new ThirdEntity()); - - boundary.SaveChanges(); - - persistor.LoadAll().Count().ShouldBe(3); - persistor.LoadAll().Count().ShouldBe(2); - persistor.LoadAll().Count().ShouldBe(1); - } - - [Test] - public void persist() - { - var entity = new OtherEntity(); - - persistor.Persist(entity); - - boundary.SaveChanges(); - - persistor.LoadAll().Single().ShouldBeTheSameAs(entity); - } - - [Test] - public void delete_all() - { - persistor.Persist(new User()); - persistor.Persist(new User()); - persistor.Persist(new User()); - persistor.Persist(new OtherEntity()); - persistor.Persist(new OtherEntity()); - persistor.Persist(new ThirdEntity()); - - boundary.SaveChanges(); - - persistor.DeleteAll(); - - boundary.SaveChanges(); - - persistor.LoadAll().Count().ShouldBe(3); - persistor.LoadAll().Count().ShouldBe(2); - persistor.LoadAll().Count().ShouldBe(0); - } - - [Test] - public void remove() - { - persistor.Persist(new User{Id = Guid.NewGuid()}); - var user1 = new User - { - Id = Guid.NewGuid(), - FirstName = "Jeremy" - }; - persistor.Persist(user1); - persistor.Persist(new User { Id = Guid.NewGuid() }); - - boundary.SaveChanges(); - - container.GetInstance().Execute(x => { - var u = x.Find(user1.Id); - - x.Remove(u); - }); - - container.GetInstance() - .Execute(p => { - var users = p.LoadAll().ToList(); - users.Count().ShouldBe(2); - users.ShouldNotContain(user1); - }); - } - - [Test] - public void find_by() - { - persistor.Persist(new User()); - persistor.Persist(new User - { - FirstName = "Jeremy" - }); - persistor.Persist(new User()); - - boundary.SaveChanges(); - - persistor.FindSingle(x => x.FirstName == "Jeremy").FirstName.ShouldBe("Jeremy"); - } - - [Test] - public void find_by_gets_the_latest_changes() - { - var user1 = new User - { - FirstName = "Jeremy" - }; - persistor.Persist(user1); - - user1.LastName = "Miller"; - - boundary.SaveChanges(); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/RavenDb/RavenTransactionTester.cs b/src/FubuMVC.RavenDb.Tests/RavenDb/RavenTransactionTester.cs deleted file mode 100644 index e0d5394dc7..0000000000 --- a/src/FubuMVC.RavenDb.Tests/RavenDb/RavenTransactionTester.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Linq; -using FubuMVC.RavenDb.RavenDb; -using FubuMVC.RavenDb.Tests.MultiTenancy; -using NUnit.Framework; -using Raven.Client; -using Shouldly; -using StructureMap; - -namespace FubuMVC.RavenDb.Tests.RavenDb -{ - [TestFixture] - public class RavenTransactionTester - { - private Container container; - private ITransaction transaction; - - [TestFixtureSetUp] - public void FixtureSetUp() - { - container = new Container(new RavenDbRegistry()); - container.Inject(new RavenDbSettings - { - RunInMemory = true - }); - } - - [SetUp] - public void SetUp() - { - transaction = container.GetInstance(); - } - - [TestFixtureTearDown] - public void TearDown() - { - container.Dispose(); - } - - [Test] - public void load_all() - { - transaction.WithRepository(repo => { - repo.Update(new User()); - repo.Update(new User()); - repo.Update(new User()); - repo.Update(new OtherEntity()); - repo.Update(new OtherEntity()); - repo.Update(new ThirdEntity()); - }); - - bool wasCalled = false; - - transaction.Execute(session => session.Query().Customize(x => x.WaitForNonStaleResults()).Any().ShouldBeTrue()); - transaction.Execute(session => session.Query().Customize(x => x.WaitForNonStaleResults()).Any().ShouldBeTrue()); - transaction.Execute(session => session.Query().Customize(x => x.WaitForNonStaleResults()).Any().ShouldBeTrue()); - - transaction.WithRepository(repo => { - repo.All().Count().ShouldBe(3); - repo.All().Count().ShouldBe(2); - repo.All().Count().ShouldBe(1); - - wasCalled = true; - }); - - wasCalled.ShouldBeTrue(); - - } - - [Test] - public void persist() - { - var entity = new OtherEntity(); - - transaction.WithRepository(repo => repo.Update(entity)); - - transaction.Execute(session => session.Query().Customize(x => x.WaitForNonStaleResults()).Any().ShouldBeTrue()); - - bool wasCalled = false; - transaction.WithRepository(repo => { - repo.All().ShouldContain(entity); - wasCalled = true; - }); - - wasCalled.ShouldBeTrue(); - } - - [Test] - public void multi_tenancy_test_to_excercise_the_service_arguments() - { - var tenantA = Guid.NewGuid(); - var tenantB = Guid.NewGuid(); - - - var trackedA1 = new TrackedEntity(); - var trackedA2 = new TrackedEntity(); - var trackedB1 = new TrackedEntity(); - var trackedB2 = new TrackedEntity(); - var trackedB3 = new TrackedEntity(); - - - transaction.WithRepository(tenantA, repo => { - repo.Update(trackedA1); - repo.Update(trackedA2); - }); - - transaction.WithRepository(tenantB, repo => { - repo.Update(trackedB1); - repo.Update(trackedB2); - repo.Update(trackedB3); - }); - - - transaction.Execute(session => session.Query().Customize(x => x.WaitForNonStaleResults()).Any().ShouldBeTrue()); - - - transaction.WithRepository(tenantA, repo => { - repo.All().ShouldHaveTheSameElementsAs(trackedA1, trackedA2); - }); - - bool wasCalled = false; - transaction.WithRepository(tenantB, repo => - { - wasCalled = true; - repo.All().ShouldHaveTheSameElementsAs(trackedB1, trackedB2, trackedB3); - }); - - wasCalled.ShouldBeTrue(); - } - - - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/RavenDb/RavenUnitOfWorkTester.cs b/src/FubuMVC.RavenDb.Tests/RavenDb/RavenUnitOfWorkTester.cs deleted file mode 100644 index 80b65f89df..0000000000 --- a/src/FubuMVC.RavenDb.Tests/RavenDb/RavenUnitOfWorkTester.cs +++ /dev/null @@ -1,151 +0,0 @@ -using System; -using System.Linq; -using FubuMVC.RavenDb.RavenDb; -using FubuMVC.RavenDb.Tests.MultiTenancy; -using NUnit.Framework; -using Shouldly; -using StructureMap; - -namespace FubuMVC.RavenDb.Tests.RavenDb -{ - [TestFixture] - public class RavenUnitOfWorkTester - { - private Container container; - private RavenUnitOfWork theUnitOfWork; - - [SetUp] - public void SetUp() - { - container = new Container(new RavenDbRegistry()); - container.Inject(new RavenDbSettings{RunInMemory = true}); - - theUnitOfWork = new RavenUnitOfWork(container); - } - - [TearDown] - public void TearDown() - { - container.Dispose(); - } - - [Test] - public void starting_the_unit_of_work_twice_throws_an_exception() - { - theUnitOfWork.Start(); - - Exception.ShouldBeThrownBy(() => { - theUnitOfWork.Start(); - }); - } - - - [Test] - public void starting_the_unit_of_work_twice_throws_an_exception_2() - { - theUnitOfWork.Start(); - - Exception.ShouldBeThrownBy(() => - { - theUnitOfWork.Start(Guid.NewGuid()); - }); - } - - [Test] - public void starting_the_unit_of_work_twice_throws_an_exception_3() - { - theUnitOfWork.Start(Guid.NewGuid()); - - Exception.ShouldBeThrownBy(() => - { - theUnitOfWork.Start(Guid.NewGuid()); - }); - } - - [Test] - public void starting_the_unit_of_work_twice_throws_an_exception_4() - { - theUnitOfWork.Start(Guid.NewGuid()); - - Exception.ShouldBeThrownBy(() => - { - theUnitOfWork.Start(); - }); - } - - [Test] - public void commit_and_load_all() - { - var repo = theUnitOfWork.Start(); - - repo.Update(new User()); - repo.Update(new User()); - repo.Update(new User()); - repo.Update(new OtherEntity()); - repo.Update(new OtherEntity()); - repo.Update(new ThirdEntity()); - - theUnitOfWork.Commit(); - - repo = theUnitOfWork.Start(); - - repo.All().Count().ShouldBe(3); - repo.All().Count().ShouldBe(2); - repo.All().Count().ShouldBe(1); - } - - [Test] - public void reject_saves_nothing() - { - var repo = theUnitOfWork.Start(); - - repo.Update(new User()); - repo.Update(new User()); - repo.Update(new User()); - repo.Update(new OtherEntity()); - repo.Update(new OtherEntity()); - repo.Update(new ThirdEntity()); - - theUnitOfWork.Reject(); - - repo = theUnitOfWork.Start(); - - repo.All().Count().ShouldBe(0); - repo.All().Count().ShouldBe(0); - repo.All().Count().ShouldBe(0); - } - - [Test] - public void multi_tenancy_test_to_excercise_the_service_arguments() - { - var tenantA = Guid.NewGuid(); - var tenantB = Guid.NewGuid(); - - - var trackedA1 = new TrackedEntity(); - var trackedA2 = new TrackedEntity(); - var trackedB1 = new TrackedEntity(); - var trackedB2 = new TrackedEntity(); - var trackedB3 = new TrackedEntity(); - - var repo = theUnitOfWork.Start(tenantA); - repo.Update(trackedA1); - repo.Update(trackedA2); - theUnitOfWork.Commit(); - - repo = theUnitOfWork.Start(tenantB); - repo.Update(trackedB1); - repo.Update(trackedB2); - repo.Update(trackedB3); - theUnitOfWork.Commit(); - - theUnitOfWork.Start(tenantA) - .All().ShouldHaveTheSameElementsAs(trackedA1, trackedA2); - theUnitOfWork.Reject(); - - theUnitOfWork.Start(tenantB) - .All().ShouldHaveTheSameElementsAs(trackedB1, trackedB2, trackedB3); - theUnitOfWork.Reject(); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/RavenDb/the_out_of_the_box_bottle_can_use_raven.cs b/src/FubuMVC.RavenDb.Tests/RavenDb/the_out_of_the_box_bottle_can_use_raven.cs deleted file mode 100644 index 381ef6e395..0000000000 --- a/src/FubuMVC.RavenDb.Tests/RavenDb/the_out_of_the_box_bottle_can_use_raven.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using FubuMVC.Core; -using FubuMVC.RavenDb.RavenDb; -using NUnit.Framework; -using Raven.Client; -using Raven.Client.Document; -using Raven.Database.Server; -using Shouldly; -using StructureMap; - -namespace FubuMVC.RavenDb.Tests.RavenDb -{ - [TestFixture] - public class the_out_of_the_box_bottle_can_use_raven - { - [Test] - public void raven_is_available_out_of_the_box() - { - NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8080); - - using (var application = FubuRuntime.Basic()) - { - application.Behaviors.PackageAssemblies.Each(x => Debug.WriteLine(x.GetName().FullName)); - - - application.Get().ShouldNotBeNull(); - } - } - - [Test] - public void can_run_silverlight_from_embedded() - { - NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8080); - - var container = new Container(); - var settings = RavenDbSettings.InMemory(); - //settings.Url = "http://localhost:8080"; - settings.UseEmbeddedHttpServer = true; - container.Inject(settings); - - var store = settings.Create(); - store.Initialize(); - - Debug.WriteLine(store.Url); - - //Process.Start("http://localhost:8080"); - - var store2 = new DocumentStore - { - Url = "http://localhost:8080", - DefaultDatabase = "Portal" - }; - - store2.Initialize(); - - var entity1 = new FakeEntity {Id = Guid.NewGuid()}; - - using (var session = store2.OpenSession()) - { - session.Store(entity1); - session.SaveChanges(); - } - - using (var session2 = store2.OpenSession()) - { - session2.Query() - .Customize(x => x.WaitForNonStaleResultsAsOfNow()) - .Any().ShouldBeTrue(); - } - } - } - - public class FakeEntity : Entity - { - } - - public class SampleEntity : Entity - { - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/Reset/CompleteResetTester.cs b/src/FubuMVC.RavenDb.Tests/Reset/CompleteResetTester.cs deleted file mode 100644 index db915558b3..0000000000 --- a/src/FubuMVC.RavenDb.Tests/Reset/CompleteResetTester.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System.Collections.Generic; -using FubuCore.Logging; -using FubuMVC.RavenDb.Reset; -using NUnit.Framework; -using Rhino.Mocks; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.Reset -{ - [TestFixture] - public class CompleteResetTester - { - private CompleteReset theCompleteReset; - - [SetUp] - public void SetUp() - { - Tracer.Messages.Clear(); - - theCompleteReset = new CompleteReset(MockRepository.GenerateMock(), new FakeInitialState(), - new FakePersistenceReset(), - new IServiceReset[] - { - new FakeServiceReset("A"), new FakeServiceReset("B"), - new FakeServiceReset("C") - }); - } - - [Test] - public void clearing_state_order() - { - theCompleteReset.ResetState(); - Tracer.Messages.ShouldHaveTheSameElementsAs("Service:Stop:A", "Service:Stop:B", "Service:Stop:C", "PersistenceReset:ClearPersistedState", "IInitialState:Load", "Service:Start:A", "Service:Start:B", "Service:Start:C"); - } - - [Test] - public void committing_the_changes() - { - theCompleteReset.CommitChanges(); - - Tracer.Messages.ShouldHaveTheSameElementsAs("PersistenceReset:CommitAllChanges"); - } - } - - public class FakePersistenceReset : IPersistenceReset - { - public void ClearPersistedState() - { - Tracer.Messages.Add("PersistenceReset:ClearPersistedState"); - } - - public void CommitAllChanges() - { - Tracer.Messages.Add("PersistenceReset:CommitAllChanges"); - } - } - - public class FakeInitialState : IInitialState - { - public void Load() - { - Tracer.Messages.Add("IInitialState:Load"); - } - } - - public class FakeServiceReset : IServiceReset - { - private readonly string _name; - - public FakeServiceReset(string name) - { - _name = name; - } - - public void Stop() - { - Tracer.Messages.Add("Service:Stop:" + _name); - } - - public void Start() - { - Tracer.Messages.Add("Service:Start:" + _name); - } - } - - public static class Tracer - { - public static IList Messages = new List(); - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/ServiceBus/RavenDbSchedulePersistenceTester.cs b/src/FubuMVC.RavenDb.Tests/ServiceBus/RavenDbSchedulePersistenceTester.cs deleted file mode 100644 index e56f3e0331..0000000000 --- a/src/FubuMVC.RavenDb.Tests/ServiceBus/RavenDbSchedulePersistenceTester.cs +++ /dev/null @@ -1,112 +0,0 @@ -using FubuMVC.Core; -using FubuMVC.Core.ServiceBus.Configuration; -using FubuMVC.Core.ServiceBus.ScheduledJobs.Persistence; -using FubuMVC.RavenDb.ServiceBus; -using NUnit.Framework; -using Shouldly; -using StructureMap; - -namespace FubuMVC.RavenDb.Tests.ServiceBus -{ - [TestFixture] - public class RavenDbSchedulePersistenceTester - { - private FubuRuntime runtime; - private RavenDbSchedulePersistence thePersistence; - - private JobStatusDTO foo1; - private JobStatusDTO foo2; - private JobStatusDTO foo3; - private JobStatusDTO bar1; - private JobStatusDTO bar2; - - [SetUp] - public void SetUp() - { - runtime = FubuRuntime.BasicBus(); - runtime.Get().UseInMemoryDatastore(); - - thePersistence = runtime.Get(); - - foo1 = new JobStatusDTO {JobKey = "1", NodeName = "foo"}; - foo2 = new JobStatusDTO {JobKey = "2", NodeName = "foo"}; - foo3 = new JobStatusDTO {JobKey = "3", NodeName = "foo"}; - bar1 = new JobStatusDTO {JobKey = "1", NodeName = "bar"}; - bar2 = new JobStatusDTO {JobKey = "2", NodeName = "bar"}; - - thePersistence.Persist(new[] {foo1, foo2, foo3, bar1, bar2}); - } - - [TearDown] - public void TearDown() - { - runtime.Dispose(); - } - - - [Test] - public void store_history() - { - var record1 = new JobExecutionRecord(); - var record2 = new JobExecutionRecord(); - var record3 = new JobExecutionRecord(); - var record4 = new JobExecutionRecord(); - - thePersistence.RecordHistory("foo", "1", record1); - thePersistence.RecordHistory("foo", "1", record2); - thePersistence.RecordHistory("foo", "2", record3); - thePersistence.RecordHistory("foo", "2", record4); - - thePersistence.FindHistory("foo", "1").ShouldHaveTheSameElementsAs(record1, record2); - thePersistence.FindHistory("foo", "2").ShouldHaveTheSameElementsAs(record3, record4); - } - - [Test] - public void find_all_for_node() - { - thePersistence.FindAll("foo") - .ShouldHaveTheSameElementsAs(foo1, foo2, foo3); - - thePersistence.FindAll("bar") - .ShouldHaveTheSameElementsAs(bar1, bar2); - } - - [Test] - public void find_all_active_for_node() - { - foo1.Status = foo2.Status = bar1.Status = JobExecutionStatus.Scheduled; - foo3.Status = bar2.Status = JobExecutionStatus.Inactive; - - thePersistence.Persist(new[] {foo1, foo2, foo3, bar1, bar2}); - - thePersistence.FindAllActive("foo") - .ShouldHaveTheSameElementsAs(foo1, foo2); - - thePersistence.FindAllActive("bar") - .ShouldHaveTheSameElementsAs(bar1); - } - - [Test] - public void persist_job_status() - { - foo1.Status = foo2.Status = foo3.Status = bar1.Status = bar2.Status = JobExecutionStatus.Inactive; - thePersistence.Persist(new[] {foo1, foo2, foo3, bar1, bar2}); - - var change = new JobStatusDTO {JobKey = "1", NodeName = "foo", Status = JobExecutionStatus.Scheduled}; - - thePersistence.Persist(change); - - thePersistence.FindAllActive("foo") - .ShouldHaveTheSameElementsAs(change); - - thePersistence.Find("foo", "1").Status.ShouldBe(change.Status); - } - - [Test] - public void find_a_single_status() - { - thePersistence.Find("foo", "1") - .Id.ShouldBe("foo/1"); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/ServiceBus/RavenDbSubscriptionPersistenceTester.cs b/src/FubuMVC.RavenDb.Tests/ServiceBus/RavenDbSubscriptionPersistenceTester.cs deleted file mode 100644 index b99ca9151a..0000000000 --- a/src/FubuMVC.RavenDb.Tests/ServiceBus/RavenDbSubscriptionPersistenceTester.cs +++ /dev/null @@ -1,174 +0,0 @@ -using System; -using System.Linq; -using FubuMVC.Core; -using FubuMVC.Core.ServiceBus; -using FubuMVC.Core.ServiceBus.Configuration; -using FubuMVC.Core.ServiceBus.Subscriptions; -using FubuMVC.RavenDb.ServiceBus; -using FubuMVC.Tests.ServiceBus; -using NUnit.Framework; -using Shouldly; -using StructureMap; - -namespace FubuMVC.RavenDb.Tests.ServiceBus -{ - [TestFixture] - public class RavenDbSubscriptionPersistenceTester - { - private FubuRuntime runtime; - private RavenDbSubscriptionPersistence persistence; - - [SetUp] - public void SetUp() - { - runtime = FubuRuntime.BasicBus(); - runtime.Get().UseInMemoryDatastore(); - - persistence = runtime.Get(); - } - - [TearDown] - public void TearDown() - { - runtime.Dispose(); - } - - [Test] - public void persist_and_load_all_new_subscriptions() - { - var subscriptions = new Subscription[] - { - ObjectMother.ExistingSubscription("Node1"), - ObjectMother.ExistingSubscription("Node1"), - ObjectMother.ExistingSubscription("Node1"), - ObjectMother.ExistingSubscription("Node1"), - ObjectMother.ExistingSubscription("Node1") - }; - - var subscriptions2 = new Subscription[] - { - ObjectMother.ExistingSubscription("Node2"), - ObjectMother.ExistingSubscription("Node2") - }; - - persistence.Persist(subscriptions); - persistence.Persist(subscriptions2); - - var loaded = persistence.LoadSubscriptions("Node1", SubscriptionRole.Subscribes); - loaded.ShouldHaveTheSameElementsAs(subscriptions); - - persistence.LoadSubscriptions("Node2", SubscriptionRole.Subscribes) - .ShouldHaveTheSameElementsAs(subscriptions2); - } - - [Test] - public void persist_and_load_transport_nodes() - { - var node1 = new TransportNode - { - Id = Guid.NewGuid().ToString(), - MachineName = "Box1", - NodeName = "Node1", - Addresses = new Uri[] {"memory://1".ToUri(), "memory://2".ToUri()} - }; - - persistence.Persist(node1); - - var node2 = new TransportNode - { - Id = Guid.NewGuid().ToString(), - MachineName = "Box2", - NodeName = "Node2", - Addresses = new Uri[] {"memory://3".ToUri(), "memory://4".ToUri()} - }; - - persistence.Persist(node2); - - persistence.NodesForGroup("Node1").Single() - .ShouldBe(node1); - - persistence.NodesForGroup("Node2").Single() - .ShouldBe(node2); - } - - [Test] - public void load_a_specific_node() - { - var node1 = new TransportNode - { - Id = Guid.NewGuid().ToString(), - MachineName = "Box1", - NodeName = "Node1", - Addresses = new Uri[] {"memory://1".ToUri(), "memory://2".ToUri()} - }; - - - var node2 = new TransportNode - { - Id = Guid.NewGuid().ToString(), - MachineName = "Box2", - NodeName = "Node2", - Addresses = new Uri[] {"memory://3".ToUri(), "memory://4".ToUri()} - }; - - persistence.Persist(node1, node2); - - persistence.LoadNode(node2.Id) - .MachineName.ShouldBe(node2.MachineName); - - persistence.LoadNode(node1.Id) - .MachineName.ShouldBe(node1.MachineName); - } - - [Test] - public void alter_a_node() - { - var node1 = new TransportNode - { - Id = Guid.NewGuid().ToString(), - MachineName = "Box1", - NodeName = "Node1", - Addresses = new Uri[] {"memory://1".ToUri(), "memory://2".ToUri()} - }; - - - var node2 = new TransportNode - { - Id = Guid.NewGuid().ToString(), - MachineName = "Box2", - NodeName = "Node2", - Addresses = new Uri[] {"memory://3".ToUri(), "memory://4".ToUri()} - }; - - var subject = "foo://1".ToUri(); - - persistence.Persist(node1, node2); - - - persistence.Alter(node1.Id, x => x.AddOwnership(subject)); - - persistence.LoadNode(node1.Id).OwnedTasks - .ShouldContain(subject); - } - - [Test] - public void delete_susbscriptions() - { - var subscriptions = new Subscription[] - { - ObjectMother.ExistingSubscription("Node1"), - ObjectMother.ExistingSubscription("Node2"), - ObjectMother.ExistingSubscription("Node2") - }; - - persistence.Persist(subscriptions); - - persistence.DeleteSubscriptions(subscriptions.Take(2)); - - persistence.LoadSubscriptions("Node1", SubscriptionRole.Subscribes) - .ShouldHaveCount(0); - persistence.LoadSubscriptions("Node2", SubscriptionRole.Subscribes) - .ShouldHaveTheSameElementsAs(subscriptions.Skip(2)); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/Storage/GlobalEntityStorageTester.cs b/src/FubuMVC.RavenDb.Tests/Storage/GlobalEntityStorageTester.cs deleted file mode 100644 index 2ef27b9a17..0000000000 --- a/src/FubuMVC.RavenDb.Tests/Storage/GlobalEntityStorageTester.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Linq; -using FubuMVC.RavenDb.Storage; -using FubuMVC.Tests.TestSupport; -using NUnit.Framework; -using Rhino.Mocks; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.Storage -{ - [TestFixture] - public class GlobalEntityStorageTester : InteractionContext> - { - [Test] - public void find_delegates() - { - var user = new User(){ - Id = Guid.NewGuid() - }; - - MockFor().Stub(x => x.Find(user.Id)) - .Return(user); - - ClassUnderTest.Find(user.Id).ShouldBeTheSameAs(user); - } - - [Test] - public void update_just_delegates() - { - var user = new User() - { - Id = Guid.NewGuid() - }; - - ClassUnderTest.Update(user); - - MockFor().AssertWasCalled(x => x.Persist(user)); - } - - [Test] - public void remove_just_delegates() - { - var user = new User() - { - Id = Guid.NewGuid() - }; - - ClassUnderTest.Remove(user); - - MockFor().AssertWasCalled(x => x.Remove(user)); - } - - [Test] - public void all_just_delegates() - { - IQueryable queryable = new User[0].AsQueryable(); - - MockFor().Stub(x => x.LoadAll()).Return(queryable); - - ClassUnderTest.All().ShouldBeTheSameAs(queryable); - } - - [Test] - public void delete_all_delegates() - { - ClassUnderTest.DeleteAll(); - - MockFor().AssertWasCalled(x => x.DeleteAll()); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/Storage/SoftDeletedEntityStorageTester.cs b/src/FubuMVC.RavenDb.Tests/Storage/SoftDeletedEntityStorageTester.cs deleted file mode 100644 index 6b7ec53244..0000000000 --- a/src/FubuMVC.RavenDb.Tests/Storage/SoftDeletedEntityStorageTester.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using FubuCore.Dates; -using FubuMVC.RavenDb.InMemory; -using FubuMVC.RavenDb.Storage; -using FubuMVC.Tests.TestSupport; -using NUnit.Framework; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.Storage -{ - [TestFixture] - public class SoftDeletedEntityStorageTester : InteractionContext> - { - private InMemoryPersistor thePersistor; - - protected override void beforeEach() - { - LocalSystemTime = DateTime.Today.AddHours(8); - - - thePersistor = new InMemoryPersistor(); - Services.Inject>(new EntityStorage(thePersistor)); - } - - - [Test] - public void can_still_find_a_soft_deleted_object() - { - var @case = new SoftDeletedEntity(); - @case.Deleted.ShouldBeNull(); - - ClassUnderTest.Remove(@case); - - - ClassUnderTest.Find(@case.Id).Id.ShouldBe(@case.Id); - } - - [Test] - public void can_still_find_where_can_find_a_soft_deleted_object() - { - var @case = new SoftDeletedEntity(); - @case.Deleted.ShouldBeNull(); - - ClassUnderTest.Remove(@case); - - ClassUnderTest.FindSingle(c => c.Id == @case.Id).Id.ShouldBe(@case.Id); - } - - [Test] - public void soft_deleted_entities_are_not_available_from_All() - { - var c1 = new SoftDeletedEntity(); - var c2 = new SoftDeletedEntity {Deleted = new Milestone(DateTime.Now)}; - var c3 = new SoftDeletedEntity(); - var c4 = new SoftDeletedEntity {Deleted = new Milestone(DateTime.Now)}; - - thePersistor.Persist(c1); - thePersistor.Persist(c2); - thePersistor.Persist(c3); - thePersistor.Persist(c4); - - thePersistor.Persist(c2); - thePersistor.Persist(c4); - - ClassUnderTest.All().ShouldHaveTheSameElementsAs(c1, c3); - } - - [Test] - public void when_deleting_an_entity_mark_the_entity_as_deleted() - { - var @case = new SoftDeletedEntity(); - @case.Deleted.ShouldBeNull(); - - ClassUnderTest.Remove(@case); - - @case.Deleted.ShouldBe(new Milestone(LocalSystemTime)); - } - } - - - public class SoftDeletedEntity : ISoftDeletedEntity - { - #region ISoftDeletedEntity Members - - public Guid Id { get; set; } - public Milestone Deleted { get; set; } - - #endregion - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/Storage/SoftDeletedStoragePolicyTester.cs b/src/FubuMVC.RavenDb.Tests/Storage/SoftDeletedStoragePolicyTester.cs deleted file mode 100644 index 6a72e32859..0000000000 --- a/src/FubuMVC.RavenDb.Tests/Storage/SoftDeletedStoragePolicyTester.cs +++ /dev/null @@ -1,41 +0,0 @@ -using FubuCore.Dates; -using FubuMVC.RavenDb.Storage; -using NUnit.Framework; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.Storage -{ - [TestFixture] - public class SoftDeletedStoragePolicyTester - { - private SoftDeletedStoragePolicy thePolicy; - - [SetUp] - public void SetUp() - { - thePolicy = new SoftDeletedStoragePolicy(SystemTime.Default()); - } - - [Test] - public void does_not_match_a_regular_entity() - { - thePolicy.Matches().ShouldBeFalse(); - } - - [Test] - public void matches_a_soft_deleted_entity() - { - thePolicy.Matches().ShouldBeTrue(); - } - - [Test] - public void create_the_wrapper() - { - var inner = new EntityStorage(null); - thePolicy.Wrap(inner).ShouldBeOfType>() - .Inner.ShouldBeTheSameAs(inner); - } - } - - public class RegularEntity : Entity{} -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/Storage/when_finding_the_entity_storage_with_no_matching_policies.cs b/src/FubuMVC.RavenDb.Tests/Storage/when_finding_the_entity_storage_with_no_matching_policies.cs deleted file mode 100644 index a723a9178a..0000000000 --- a/src/FubuMVC.RavenDb.Tests/Storage/when_finding_the_entity_storage_with_no_matching_policies.cs +++ /dev/null @@ -1,23 +0,0 @@ -using FubuMVC.RavenDb.Storage; -using FubuMVC.Tests.TestSupport; -using NUnit.Framework; -using Rhino.Mocks; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests.Storage -{ - [TestFixture] - public class when_finding_the_entity_storage_with_no_matching_policies : InteractionContext - { - protected override void beforeEach() - { - MockFor().Stub(x => x.Matches()).Return(false); - } - - [Test] - public void uses_the_global_entity_storage_by_default() - { - ClassUnderTest.StorageFor().ShouldBeOfType>(); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/StructureMap/EntityRepositoryIntegrationTester.cs b/src/FubuMVC.RavenDb.Tests/StructureMap/EntityRepositoryIntegrationTester.cs deleted file mode 100644 index 7134941d14..0000000000 --- a/src/FubuMVC.RavenDb.Tests/StructureMap/EntityRepositoryIntegrationTester.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System; -using FubuCore.Dates; -using FubuMVC.RavenDb.InMemory; -using FubuMVC.RavenDb.MultiTenancy; -using NUnit.Framework; -using Shouldly; -using StructureMap; - -namespace FubuMVC.RavenDb.Tests.StructureMap -{ - [TestFixture] - public class EntityRepositoryIntegrationTester - { - private IEntityRepository theRepository; - private SimpleTenantContext theContext; - private IPersistor thePersistor; - - [SetUp] - public void SetUp() - { - var container = new Container(new InMemoryPersistenceRegistry()); - theContext = new SimpleTenantContext {CurrentTenant = Guid.NewGuid()}; - container.Inject(theContext); - - thePersistor = container.GetInstance(); - - theRepository = container.GetInstance(); - } - - [Test] - public void search_for_multi_tenanted_entities() - { - var e1 = new SiteEntity {Name = "Jeremy", TenantId = theContext.CurrentTenant}; - var e2 = new SiteEntity {Name = "Josh", TenantId = theContext.CurrentTenant}; - var e3 = new SiteEntity {Name = "Jeremy", TenantId = Guid.NewGuid()}; - var e4 = new SiteEntity {Name = "Josh", TenantId = Guid.NewGuid()}; - - thePersistor.Persist(e1); - thePersistor.Persist(e2); - thePersistor.Persist(e3); - thePersistor.Persist(e4); - - theRepository.All().ShouldHaveTheSameElementsAs(e1, e2); - - theRepository.FindWhere(x => x.Name == "Jeremy").ShouldBeTheSameAs(e1); - - theContext.CurrentTenant = e3.TenantId; - - theRepository.FindWhere(x => x.Name == "Jeremy").ShouldBeTheSameAs(e3); - } - - [Test] - public void search_for_soft_deleted_entities() - { - var e1 = new SoftDeletedEntity {Name = "Jeremy"}; - var e2 = new SoftDeletedEntity {Name = "Josh"}; - var e3 = new SoftDeletedEntity {Name = "Lindsey"}; - var e4 = new SoftDeletedEntity {Name = "Max"}; - - thePersistor.Persist(e1); - thePersistor.Persist(e2); - thePersistor.Persist(e3); - thePersistor.Persist(e4); - - theRepository.Remove(e3); - - - e3.Deleted.ShouldNotBeNull(); - - theRepository.Find(e3.Id).ShouldBeTheSameAs(e3); - - theRepository.All().ShouldHaveTheSameElementsAs(e1, e2, e4); - - - } - - [Test] - public void search_for_the_combination_of_soft_deleted_and_multi_tenancy() - { - var e1 = new SoftDeletedTenanted {Name = "Jeremy", TenantId = theContext.CurrentTenant, Id = Guid.NewGuid()}; - var e2 = new SoftDeletedTenanted {Name = "Jeremy", TenantId = Guid.NewGuid(), Id = Guid.NewGuid()}; - var e3 = new SoftDeletedTenanted {Name = "Josh", TenantId = theContext.CurrentTenant}; - var e4 = new SoftDeletedTenanted {Name = "Lindsey", TenantId = theContext.CurrentTenant}; - var e5 = new SoftDeletedTenanted {Name = "Max", TenantId = theContext.CurrentTenant}; - - thePersistor.Persist(e1); - thePersistor.Persist(e2); - thePersistor.Persist(e3); - thePersistor.Persist(e4); - thePersistor.Persist(e5); - - theRepository.Remove(e1); - - theRepository.Find(e1.Id).ShouldBeTheSameAs(e1); - theRepository.Find(e2.Id).ShouldBeNull(); // not the same tenant - - theRepository.FindWhere(x => x.Name == "Jeremy").ShouldBeTheSameAs(e1); - - theRepository.All().ShouldHaveTheSameElementsAs(e3, e4, e5); - } - } - - public class SiteEntity : TenantedEntity - { - public string Name { get; set; } - } - - public class SoftDeletedEntity : Entity, ISoftDeletedEntity - { - public Milestone Deleted { get; set; } - public string Name { get; set; } - } - - public class SoftDeletedTenanted : TenantedEntity, ISoftDeletedEntity - { - public string Name { get; set; } - public Milestone Deleted { get; set; } - } - - public class SimpleEntity : Entity - { - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/StructureMap/InMemoryPersistenceRegistry_integration_tester.cs b/src/FubuMVC.RavenDb.Tests/StructureMap/InMemoryPersistenceRegistry_integration_tester.cs deleted file mode 100644 index 56929e2acd..0000000000 --- a/src/FubuMVC.RavenDb.Tests/StructureMap/InMemoryPersistenceRegistry_integration_tester.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using FubuMVC.RavenDb.InMemory; -using FubuMVC.RavenDb.Reset; -using FubuMVC.RavenDb.Storage; -using NUnit.Framework; -using Shouldly; -using StructureMap; -using StructureMap.Configuration.DSL; - -namespace FubuMVC.RavenDb.Tests.StructureMap -{ - [TestFixture] - public class InMemoryPersistenceRegistry_integration_tester - { - private IContainer theContainer; - - [SetUp] - public void SetUp() - { - theContainer = new Container(x => x.AddRegistry()); - } - - private IEntityRepository theRepository - { - get { return theContainer.GetInstance(); } - } - - - [Test] - public void can_persist_and_retrieve_an_entities() - { - var entity = new FakeEntity {Id = Guid.NewGuid()}; - - theRepository.Update(entity); - - theRepository.Find(entity.Id).ShouldBeTheSameAs(entity); - } - - [Test] - public void persistor_is_a_singleton() - { - var p1 = theContainer.GetInstance().ShouldBeOfType(); - - p1.ShouldBeTheSameAs(theContainer.GetInstance()); - } - - [Test] - public void transaction_is_registered() - { - theContainer.GetInstance().ShouldBeOfType(); - } - - [Test] - public void entity_registry_is_registered_and_can_be_built() - { - theContainer.GetInstance().ShouldBeOfType(); - } - - [Test] - public void persistence_reset_is_registered() - { - theContainer.GetInstance().ShouldBeOfType(); - } - - [Test] - public void storage_registry_is_registered() - { - theContainer.GetInstance().ShouldBeOfType(); - } - - [Test] - public void can_build_out_complete_reset() - { - theContainer.GetInstance().ShouldNotBeNull(); - } - - - public class TestRegistry : Registry - { - public TestRegistry() - { - IncludeRegistry(); - } - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/loading_the_bottle_with_string_conversions.cs b/src/FubuMVC.RavenDb.Tests/loading_the_bottle_with_string_conversions.cs deleted file mode 100644 index e90a1da908..0000000000 --- a/src/FubuMVC.RavenDb.Tests/loading_the_bottle_with_string_conversions.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Linq; -using System.Text.RegularExpressions; -using FubuCore; -using FubuCore.Dates; -using FubuCore.Formatting; -using FubuMVC.Core; -using FubuMVC.RavenDb.RavenDb; -using NUnit.Framework; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests -{ - [TestFixture] - public class loading_the_bottle_with_string_conversions - { - [Test] - public void does_not_lose_registrations_with_custom_string_display_conversions() - { - // This was a crazy weird bug we found at work where the Container was re-created - // when a custom DisplayConversionRegistry was added - - /* - using (var r = FubuRuntime.Basic()) - { - var assembly = typeof(RavenDbRegistry).Assembly; - r.CurrentContainer.Model.PluginTypes.Any(x => x.PluginType.Assembly == assembly) - .ShouldBeTrue(); - } - */ - - using (var runtime = FubuRuntime.Basic(_ => _.Policies.StringConversions())) - { - var assembly = typeof (RavenDbRegistry).Assembly; - runtime.CurrentContainer.Model.PluginTypes.Any(x => x.PluginType.Assembly == assembly) - .ShouldBeTrue(); - } - - } - } - - public class OurDisplayConventions : DisplayConversionRegistry - { - public OurDisplayConventions() - { - /* - IfIsType().ConvertBy((req, val) => - { - return req.WithFormat("{0:c}"); - }); - - IfIsType().ConvertBy((req, val) => - { - return "{0:MM/dd/yyyy}".ToFormat(val.Day); - }); - */ - - /* - IfIsType().ConvertBy((req, val) => - { - if (val.RawValue == null) - return String.Empty; - - var formattedPhone = Regex.Replace(val.RawValue, @"(\d{3})(\d{3})(\d{4})", "$1-$2-$3"); - - return "{0} {1}".ToFormat(formattedPhone, val.Type); - }); - - IfIsType().ConvertBy((req, val) => - { - return val != null ? val.Obfuscated() : string.Empty; - }); - */ - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/paket.references b/src/FubuMVC.RavenDb.Tests/paket.references deleted file mode 100644 index 41fa05829c..0000000000 --- a/src/FubuMVC.RavenDb.Tests/paket.references +++ /dev/null @@ -1,21 +0,0 @@ -Fixie -FubuCore -HtmlTags -Microsoft.CompilerServices.AsyncTargetingPack -Microsoft.Data.Edm -Microsoft.Data.OData -Microsoft.Data.Services.Client -Microsoft.Owin -Microsoft.Owin.Host.HttpListener -Microsoft.Owin.Hosting -Microsoft.WindowsAzure.ConfigurationManager -Newtonsoft.Json -Owin -RavenDB.Client -RavenDB.Database -RavenDB.Embedded -RhinoMocks -Shouldly -structuremap -System.Spatial -WindowsAzure.Storage \ No newline at end of file diff --git a/src/FubuMVC.RavenDb.Tests/when_updating_an_entity.cs b/src/FubuMVC.RavenDb.Tests/when_updating_an_entity.cs deleted file mode 100644 index d6dcdbd39c..0000000000 --- a/src/FubuMVC.RavenDb.Tests/when_updating_an_entity.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Configuration; -using FubuMVC.RavenDb.Storage; -using FubuMVC.Tests.TestSupport; -using NUnit.Framework; -using Rhino.Mocks; -using Shouldly; - -namespace FubuMVC.RavenDb.Tests -{ - [TestFixture] - public class when_updating_an_entity : InteractionContext - { - private FakeEntity theEntity; - private IEntityStorage theStorage; - - protected override void beforeEach() - { - theEntity = new FakeEntity(); - - theStorage = MockFor>(); - MockFor().Stub(x => x.StorageFor()).Return( - theStorage); - - LocalSystemTime = DateTime.Now; - } - - [Test] - public void should_update() - { - ClassUnderTest.Update(theEntity); - theStorage.AssertWasCalled(x => x.Update(theEntity)); - } - - public static void Try() - { - ConfigurationManager.AppSettings.Set("Raven/Port", "8081"); - - ConfigurationManager.AppSettings.Get("Raven/Port").ShouldBe("8081"); - } - - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/ContainerExtensions.cs b/src/FubuMVC.RavenDb/ContainerExtensions.cs deleted file mode 100644 index 4f478527d3..0000000000 --- a/src/FubuMVC.RavenDb/ContainerExtensions.cs +++ /dev/null @@ -1,14 +0,0 @@ -using FubuCore.Binding; -using StructureMap; - -namespace FubuMVC.RavenDb -{ - public static class ContainerExtensions - { - public static void Apply(this IContainer container, ServiceArguments arguments) - { - arguments.EachService(container.Inject); - } - - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/DatabaseReplacementExtensions.cs b/src/FubuMVC.RavenDb/DatabaseReplacementExtensions.cs deleted file mode 100644 index bff11ec336..0000000000 --- a/src/FubuMVC.RavenDb/DatabaseReplacementExtensions.cs +++ /dev/null @@ -1,51 +0,0 @@ -using FubuMVC.Core.Runtime; -using FubuMVC.RavenDb.RavenDb; -using Raven.Client; -using StructureMap; - -namespace FubuMVC.RavenDb -{ - public static class DatabaseReplacementExtensions - { - /// - /// Change the default RavenDb datastore to the configured settings - /// - /// - /// - public static void ReplaceDatastore(this IContainer container, RavenDbSettings settings) - { - container.Model.For().Default.EjectObject(); - container.Model.For().EjectAndRemoveAll(); - - container.Inject(settings); - } - - /// - /// Change the default RavenDb datastore to the configured settings - /// - /// - /// - public static void ReplaceDatastore(this IServiceFactory factory, RavenDbSettings settings) - { - factory.Get().ReplaceDatastore(settings); - } - - /// - /// Replace the current datastore with a new in memory datastore - /// - /// - public static void UseInMemoryDatastore(this IContainer container) - { - container.ReplaceDatastore(RavenDbSettings.InMemory()); - } - - /// - /// Replace the current datastore with a new in memory datastore - /// - /// - public static void UseInMemoryDatastore(this IServiceFactory factory) - { - factory.Get().UseInMemoryDatastore(); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Entity.cs b/src/FubuMVC.RavenDb/Entity.cs deleted file mode 100644 index b696901b61..0000000000 --- a/src/FubuMVC.RavenDb/Entity.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; - -namespace FubuMVC.RavenDb -{ - public abstract class Entity : IEntity - { - public Guid Id { get; set; } - - public bool Equals(Entity other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return other.Id.Equals(Id) && other.GetType() == GetType(); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != GetType()) return false; - return Equals((Entity)obj); - } - - public override int GetHashCode() - { - return Id.GetHashCode(); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/EntityRepository.cs b/src/FubuMVC.RavenDb/EntityRepository.cs deleted file mode 100644 index bf7d2e8bf9..0000000000 --- a/src/FubuMVC.RavenDb/EntityRepository.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Linq; -using System.Linq.Expressions; -using FubuCore.Util; -using FubuMVC.RavenDb.Storage; - -namespace FubuMVC.RavenDb -{ - public class EntityRepository : IEntityRepository - { - private readonly IStorageFactory _storageFactory; - private readonly Cache _storageProviders = new Cache(); - - public EntityRepository(IStorageFactory storageFactory) - { - _storageFactory = storageFactory; - } - - public IQueryable All() where T : class, IEntity - { - return storage().All(); - } - - - public T FindWhere(Expression> filter) where T : class, IEntity - { - var raw = storage().FindSingle(filter); - return raw == null ? null : Find(raw.Id); - } - - public T Find(Guid id) where T : class, IEntity - { - return storage().Find(id); - } - - // virtual for testing - public void Update(T model) where T : class, IEntity - { - if (model.Id == default(Guid) || model.Id == Guid.Empty) - { - model.Id = Guid.NewGuid(); - } - - storage().Update(model); - } - - public void Remove(T model) where T : class, IEntity - { - storage().Remove(model); - } - - public void DeleteAll() where T : class, IEntity - { - storage().DeleteAll(); - } - - private IEntityStorage storage() where T : class, IEntity - { - _storageProviders.Fill(typeof(T), t => _storageFactory.StorageFor()); - - return (IEntityStorage)_storageProviders[typeof(T)]; - } - - public static EntityRepository InMemory() - { - return InMemory(x => { }); - } - - public static EntityRepository InMemory(Action configure) - { - var expression = new EntityRepositoryExpression(); - configure(expression); - - return expression.Build(); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/FubuMVC.RavenDb.csproj b/src/FubuMVC.RavenDb/FubuMVC.RavenDb.csproj deleted file mode 100644 index 2020fad001..0000000000 --- a/src/FubuMVC.RavenDb/FubuMVC.RavenDb.csproj +++ /dev/null @@ -1,1460 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {02441E35-668B-4713-9279-BD51948B95EB} - Library - Properties - FubuMVC.RavenDb - FubuMVC.RavenDb - v4.6 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - - - - - - - - - - - - CommonAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {e18fd922-0e7a-49cd-b89f-473826077b9d} - FubuMVC.Core - - - {e18fd922-0e7a-49cd-b89f-473826077b9d} - FubuMVC.Core - - - - - - - - - - - ..\..\packages\FubuCore\lib\FubuCore.dll - True - True - - - - - - - ..\..\packages\HtmlTags\lib\4.0\HtmlTags.dll - True - True - - - - - - - - - ..\..\packages\Microsoft.CompilerServices.AsyncTargetingPack\lib\net40\Microsoft.CompilerServices.AsyncTargetingPack.Net4.dll - True - True - - - - - - - ..\..\packages\Microsoft.CompilerServices.AsyncTargetingPack\lib\net45\Microsoft.CompilerServices.AsyncTargetingPack.Net45.dll - True - True - - - - - - - ..\..\packages\Microsoft.CompilerServices.AsyncTargetingPack\lib\sl50\Microsoft.CompilerServices.AsyncTargetingPack.Silverlight5.dll - True - True - - - - - - - - - ..\..\packages\Microsoft.Data.Edm\lib\net40\Microsoft.Data.Edm.dll - True - True - - - - - - - ..\..\packages\Microsoft.Data.Edm\lib\portable-net40+sl5+wp8+win8\Microsoft.Data.Edm.Portable.dll - True - True - - - - - - - ..\..\packages\Microsoft.Data.Edm\lib\sl4\Microsoft.Data.Edm.SL.dll - True - True - - - - - - - - - ..\..\packages\Microsoft.Data.OData\lib\net40\Microsoft.Data.OData.dll - True - True - - - - - - - ..\..\packages\Microsoft.Data.OData\lib\portable-net40+sl5+wp8+win8\Microsoft.Data.OData.Portable.dll - True - True - - - - - - - ..\..\packages\Microsoft.Data.OData\lib\sl4\Microsoft.Data.OData.SL.dll - True - True - - - - - - - - - ..\..\packages\Microsoft.Data.Services.Client\lib\net40\Microsoft.Data.Services.Client.dll - True - True - - - - - - - ..\..\packages\Microsoft.Data.Services.Client\lib\portable-net45+sl5+wp8+win8\Microsoft.Data.Services.Client.Portable.dll - True - True - - - - - - - ..\..\packages\Microsoft.Data.Services.Client\lib\sl4\Microsoft.Data.Services.Client.SL.dll - True - True - - - True - - - - - - - - - ..\..\packages\Microsoft.Win32.Primitives\ref\netstandard1.3\Microsoft.Win32.Primitives.dll - True - True - - - - - - - - - ..\..\packages\Microsoft.WindowsAzure.ConfigurationManager\lib\net40\Microsoft.WindowsAzure.Configuration.dll - True - True - - - - - - - - - ..\..\packages\Newtonsoft.Json\lib\net20\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\packages\Newtonsoft.Json\lib\net35\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\packages\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\packages\Newtonsoft.Json\lib\netstandard1.0\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\packages\Newtonsoft.Json\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll - True - True - - - - - - - ..\..\packages\Newtonsoft.Json\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll - True - True - - - - - - - - - ..\..\packages\Owin\lib\net40\Owin.dll - True - True - - - - - - - - - ..\..\packages\RavenDB.Client\lib\net40\Raven.Abstractions.dll - True - True - - - ..\..\packages\RavenDB.Client\lib\net40\Raven.Client.Lightweight.dll - True - True - - - - - - - ..\..\packages\RavenDB.Client\lib\net45\Raven.Abstractions.dll - True - True - - - ..\..\packages\RavenDB.Client\lib\net45\Raven.Client.Lightweight.dll - True - True - - - - - - - ..\..\packages\RavenDB.Client\lib\sl50\Raven.Client.Silverlight.dll - True - True - - - - - - - - - ..\..\packages\RavenDB.Database\lib\net40\Raven.Abstractions.dll - True - True - - - ..\..\packages\RavenDB.Database\lib\net40\Raven.Database.dll - True - True - - - - - - - ..\..\packages\RavenDB.Database\lib\net45\Raven.Abstractions.dll - True - True - - - ..\..\packages\RavenDB.Database\lib\net45\Raven.Database.dll - True - True - - - - - - - - - ..\..\packages\RavenDB.Embedded\lib\net40\Raven.Client.Embedded.dll - True - True - - - - - - - ..\..\packages\RavenDB.Embedded\lib\net45\Raven.Client.Embedded.dll - True - True - - - - - - - - - ..\..\packages\StructureMap\lib\net45\StructureMap.dll - True - True - - - - - - - ..\..\packages\StructureMap\lib\netstandard1.3\StructureMap.dll - True - True - - - - - - - ..\..\packages\StructureMap\lib\netstandard1.5\StructureMap.dll - True - True - - - - - - - - - ..\..\packages\System.AppContext\ref\netstandard1.3\System.AppContext.dll - True - True - - - - - - - - - ..\..\packages\System.Buffers\lib\netstandard1.1\System.Buffers.dll - True - True - - - - - - - - - ..\..\packages\System.Collections\ref\netstandard1.0\System.Collections.dll - True - True - - - - - - - ..\..\packages\System.Collections\ref\netstandard1.3\System.Collections.dll - True - True - - - - - - - - - ..\..\packages\System.Collections.Concurrent\ref\netstandard1.1\System.Collections.Concurrent.dll - True - True - - - - - - - ..\..\packages\System.Collections.Concurrent\ref\netstandard1.3\System.Collections.Concurrent.dll - True - True - - - - - - - - - ..\..\packages\System.Console\ref\netstandard1.3\System.Console.dll - True - True - - - - - - - - - ..\..\packages\System.Diagnostics.Debug\ref\netstandard1.0\System.Diagnostics.Debug.dll - True - True - - - - - - - ..\..\packages\System.Diagnostics.Debug\ref\netstandard1.3\System.Diagnostics.Debug.dll - True - True - - - - - - - - - ..\..\packages\System.Diagnostics.DiagnosticSource\lib\netstandard1.3\System.Diagnostics.DiagnosticSource.dll - True - True - - - - - - - - - ..\..\packages\System.Diagnostics.Tools\ref\netstandard1.0\System.Diagnostics.Tools.dll - True - True - - - - - - - - - ..\..\packages\System.Diagnostics.Tracing\ref\netstandard1.3\System.Diagnostics.Tracing.dll - True - True - - - - - - - ..\..\packages\System.Diagnostics.Tracing\ref\netstandard1.5\System.Diagnostics.Tracing.dll - True - True - - - - - - - - - ..\..\packages\System.Dynamic.Runtime\ref\netstandard1.0\System.Dynamic.Runtime.dll - True - True - - - - - - - ..\..\packages\System.Dynamic.Runtime\ref\netstandard1.3\System.Dynamic.Runtime.dll - True - True - - - - - - - - - ..\..\packages\System.Globalization\ref\netstandard1.0\System.Globalization.dll - True - True - - - - - - - ..\..\packages\System.Globalization\ref\netstandard1.3\System.Globalization.dll - True - True - - - - - - - - - ..\..\packages\System.Globalization.Calendars\ref\netstandard1.3\System.Globalization.Calendars.dll - True - True - - - - - - - - - ..\..\packages\System.Globalization.Extensions\ref\netstandard1.3\System.Globalization.Extensions.dll - True - True - - - - - - - - - ..\..\packages\System.IO\ref\netstandard1.0\System.IO.dll - True - True - - - - - - - ..\..\packages\System.IO\ref\netstandard1.3\System.IO.dll - True - True - - - - - - - ..\..\packages\System.IO\ref\netstandard1.5\System.IO.dll - True - True - - - - - - - - - ..\..\packages\System.IO.Compression\ref\netstandard1.3\System.IO.Compression.dll - True - True - - - - - - - - - ..\..\packages\System.IO.Compression.ZipFile\ref\netstandard1.3\System.IO.Compression.ZipFile.dll - True - True - - - - - - - - - ..\..\packages\System.IO.FileSystem\ref\netstandard1.3\System.IO.FileSystem.dll - True - True - - - - - - - - - ..\..\packages\System.IO.FileSystem.Primitives\ref\netstandard1.3\System.IO.FileSystem.Primitives.dll - True - True - - - - - - - - - ..\..\packages\System.Linq\ref\netstandard1.0\System.Linq.dll - True - True - - - - - - - ..\..\packages\System.Linq\ref\netstandard1.6\System.Linq.dll - True - True - - - - - - - - - ..\..\packages\System.Linq.Expressions\ref\netstandard1.0\System.Linq.Expressions.dll - True - True - - - - - - - ..\..\packages\System.Linq.Expressions\ref\netstandard1.3\System.Linq.Expressions.dll - True - True - - - - - - - ..\..\packages\System.Linq.Expressions\ref\netstandard1.6\System.Linq.Expressions.dll - True - True - - - - - - - - - ..\..\packages\System.Net.Http\ref\netstandard1.3\System.Net.Http.dll - True - True - - - - - - - - - ..\..\packages\System.Net.Primitives\ref\netstandard1.3\System.Net.Primitives.dll - True - True - - - - - - - - - ..\..\packages\System.Net.Sockets\ref\net46\System.Net.Sockets.dll - True - True - - - True - - - - - - - ..\..\packages\System.Net.Sockets\ref\netstandard1.3\System.Net.Sockets.dll - True - True - - - - - - - - - ..\..\packages\System.ObjectModel\ref\netstandard1.0\System.ObjectModel.dll - True - True - - - - - - - ..\..\packages\System.ObjectModel\ref\netstandard1.3\System.ObjectModel.dll - True - True - - - - - - - - - ..\..\packages\System.Reflection\ref\netstandard1.0\System.Reflection.dll - True - True - - - - - - - ..\..\packages\System.Reflection\ref\netstandard1.3\System.Reflection.dll - True - True - - - - - - - ..\..\packages\System.Reflection\ref\netstandard1.5\System.Reflection.dll - True - True - - - - - - - - - ..\..\packages\System.Reflection.Emit\ref\netstandard1.1\System.Reflection.Emit.dll - True - True - - - - - - - - - ..\..\packages\System.Reflection.Emit.ILGeneration\ref\netstandard1.0\System.Reflection.Emit.ILGeneration.dll - True - True - - - - - - - - - ..\..\packages\System.Reflection.Emit.Lightweight\ref\netstandard1.0\System.Reflection.Emit.Lightweight.dll - True - True - - - - - - - - - ..\..\packages\System.Reflection.Extensions\ref\netstandard1.0\System.Reflection.Extensions.dll - True - True - - - - - - - - - ..\..\packages\System.Reflection.Primitives\ref\netstandard1.0\System.Reflection.Primitives.dll - True - True - - - - - - - - - ..\..\packages\System.Reflection.TypeExtensions\ref\netstandard1.3\System.Reflection.TypeExtensions.dll - True - True - - - - - - - ..\..\packages\System.Reflection.TypeExtensions\ref\netstandard1.5\System.Reflection.TypeExtensions.dll - True - True - - - - - - - - - ..\..\packages\System.Resources.ResourceManager\ref\netstandard1.0\System.Resources.ResourceManager.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime\ref\netstandard1.0\System.Runtime.dll - True - True - - - - - - - ..\..\packages\System.Runtime\ref\netstandard1.2\System.Runtime.dll - True - True - - - - - - - ..\..\packages\System.Runtime\ref\netstandard1.3\System.Runtime.dll - True - True - - - - - - - ..\..\packages\System.Runtime\ref\netstandard1.5\System.Runtime.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime.Extensions\ref\netstandard1.0\System.Runtime.Extensions.dll - True - True - - - - - - - ..\..\packages\System.Runtime.Extensions\ref\netstandard1.3\System.Runtime.Extensions.dll - True - True - - - - - - - ..\..\packages\System.Runtime.Extensions\ref\netstandard1.5\System.Runtime.Extensions.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime.Handles\ref\netstandard1.3\System.Runtime.Handles.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime.InteropServices\ref\netstandard1.3\System.Runtime.InteropServices.dll - True - True - - - - - - - ..\..\packages\System.Runtime.InteropServices\ref\netstandard1.5\System.Runtime.InteropServices.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime.InteropServices.RuntimeInformation\ref\netstandard1.1\System.Runtime.InteropServices.RuntimeInformation.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime.Loader\ref\netstandard1.5\System.Runtime.Loader.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime.Numerics\ref\netstandard1.1\System.Runtime.Numerics.dll - True - True - - - - - - - - - ..\..\packages\System.Runtime.Serialization.Primitives\ref\netstandard1.0\System.Runtime.Serialization.Primitives.dll - True - True - - - - - - - ..\..\packages\System.Runtime.Serialization.Primitives\ref\netstandard1.3\System.Runtime.Serialization.Primitives.dll - True - True - - - - - - - - - ..\..\packages\System.Security.Cryptography.Algorithms\ref\netstandard1.3\System.Security.Cryptography.Algorithms.dll - True - True - - - - - - - ..\..\packages\System.Security.Cryptography.Algorithms\ref\netstandard1.4\System.Security.Cryptography.Algorithms.dll - True - True - - - - - - - ..\..\packages\System.Security.Cryptography.Algorithms\ref\netstandard1.6\System.Security.Cryptography.Algorithms.dll - True - True - - - - - - - - - ..\..\packages\System.Security.Cryptography.Cng\ref\netstandard1.6\System.Security.Cryptography.Cng.dll - True - True - - - - - - - - - ..\..\packages\System.Security.Cryptography.Csp\ref\netstandard1.3\System.Security.Cryptography.Csp.dll - True - True - - - - - - - - - ..\..\packages\System.Security.Cryptography.Encoding\ref\netstandard1.3\System.Security.Cryptography.Encoding.dll - True - True - - - - - - - - - ..\..\packages\System.Security.Cryptography.OpenSsl\ref\netstandard1.6\System.Security.Cryptography.OpenSsl.dll - True - True - - - - - - - - - ..\..\packages\System.Security.Cryptography.Primitives\ref\netstandard1.3\System.Security.Cryptography.Primitives.dll - True - True - - - - - - - - - ..\..\packages\System.Security.Cryptography.X509Certificates\ref\netstandard1.3\System.Security.Cryptography.X509Certificates.dll - True - True - - - - - - - ..\..\packages\System.Security.Cryptography.X509Certificates\ref\netstandard1.4\System.Security.Cryptography.X509Certificates.dll - True - True - - - - - - - - - ..\..\packages\System.Spatial\lib\net40\System.Spatial.dll - True - True - - - - - - - ..\..\packages\System.Spatial\lib\portable-net40+sl5+wp8+win8\System.Spatial.Portable.dll - True - True - - - - - - - ..\..\packages\System.Spatial\lib\sl4\System.Spatial.SL.dll - True - True - - - - - - - - - ..\..\packages\System.Text.Encoding\ref\netstandard1.0\System.Text.Encoding.dll - True - True - - - - - - - ..\..\packages\System.Text.Encoding\ref\netstandard1.3\System.Text.Encoding.dll - True - True - - - - - - - - - ..\..\packages\System.Text.Encoding.Extensions\ref\netstandard1.0\System.Text.Encoding.Extensions.dll - True - True - - - - - - - ..\..\packages\System.Text.Encoding.Extensions\ref\netstandard1.3\System.Text.Encoding.Extensions.dll - True - True - - - - - - - - - ..\..\packages\System.Text.RegularExpressions\ref\netstandard1.0\System.Text.RegularExpressions.dll - True - True - - - - - - - ..\..\packages\System.Text.RegularExpressions\ref\netstandard1.3\System.Text.RegularExpressions.dll - True - True - - - - - - - ..\..\packages\System.Text.RegularExpressions\ref\netstandard1.6\System.Text.RegularExpressions.dll - True - True - - - - - - - - - ..\..\packages\System.Threading\ref\netstandard1.0\System.Threading.dll - True - True - - - - - - - ..\..\packages\System.Threading\ref\netstandard1.3\System.Threading.dll - True - True - - - - - - - - - ..\..\packages\System.Threading.Tasks\ref\netstandard1.0\System.Threading.Tasks.dll - True - True - - - - - - - ..\..\packages\System.Threading.Tasks\ref\netstandard1.3\System.Threading.Tasks.dll - True - True - - - - - - - - - ..\..\packages\System.Threading.Tasks.Extensions\lib\netstandard1.0\System.Threading.Tasks.Extensions.dll - True - True - - - - - - - - - ..\..\packages\System.Threading.Timer\ref\netstandard1.2\System.Threading.Timer.dll - True - True - - - - - - - - - ..\..\packages\System.Xml.ReaderWriter\ref\netstandard1.0\System.Xml.ReaderWriter.dll - True - True - - - - - - - ..\..\packages\System.Xml.ReaderWriter\ref\netstandard1.3\System.Xml.ReaderWriter.dll - True - True - - - - - - - - - ..\..\packages\System.Xml.XDocument\ref\netstandard1.0\System.Xml.XDocument.dll - True - True - - - - - - - ..\..\packages\System.Xml.XDocument\ref\netstandard1.3\System.Xml.XDocument.dll - True - True - - - - - - - - - ..\..\packages\WindowsAzure.Storage\lib\net40\Microsoft.WindowsAzure.Storage.dll - True - True - - - True - - - - - \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/IEntity.cs b/src/FubuMVC.RavenDb/IEntity.cs deleted file mode 100644 index bb3fc6a002..0000000000 --- a/src/FubuMVC.RavenDb/IEntity.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using FubuCore.Dates; - -namespace FubuMVC.RavenDb -{ - // All this means is that it has an Id, nothing else - public interface IEntity - { - Guid Id { get; set; } - } - - public interface ISoftDeletedEntity : IEntity - { - Milestone Deleted { get; set; } - } - - -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/IEntityRepository.cs b/src/FubuMVC.RavenDb/IEntityRepository.cs deleted file mode 100644 index 0dd6269026..0000000000 --- a/src/FubuMVC.RavenDb/IEntityRepository.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Linq; -using System.Linq.Expressions; - -namespace FubuMVC.RavenDb -{ - public interface IEntityRepository - { - IQueryable All() where T : class, IEntity; - T Find(Guid id) where T : class, IEntity; - void Update(T model) where T : class, IEntity; - void Remove(T model) where T : class, IEntity; - - T FindWhere(Expression> filter) where T : class, IEntity; - - /// - /// This should only be used in testing!!!! - /// - /// - void DeleteAll() where T : class, IEntity; - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/IEntityRepositoryBuilder.cs b/src/FubuMVC.RavenDb/IEntityRepositoryBuilder.cs deleted file mode 100644 index e3dba61812..0000000000 --- a/src/FubuMVC.RavenDb/IEntityRepositoryBuilder.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; -using FubuCore.Dates; -using FubuMVC.RavenDb.InMemory; -using FubuMVC.RavenDb.Storage; - -namespace FubuMVC.RavenDb -{ - public class EntityRepositoryExpression - { - private readonly IList _policies = new List(); - private Func _builder; - private ISystemTime _clock; - - public EntityRepositoryExpression() - { - UseSystemTime(SystemTime.Default()); - BuildWith(basicRepository); - } - - private static EntityRepository basicRepository(EntityRepositoryExpression expression) - { - var storage = new StorageFactory(new InMemoryPersistor(), expression.Policies); - return new EntityRepository(storage); - } - - public void UseSystemTime(ISystemTime clock) - { - _clock = clock; - } - - public void BuildWith(Func builder) - { - _builder = builder; - } - - public void AddStoragePolicy() where T : IEntityStoragePolicy, new() - { - AddStoragePolicy(new T()); - } - - public void AddStoragePolicy(IEntityStoragePolicy policy) - { - _policies.Add(policy); - } - - public EntityRepository Build() - { - return _builder(this); - } - - public IEnumerable Policies { get { return _policies; } } - public ISystemTime Clock { get { return _clock; } } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/IPersistor.cs b/src/FubuMVC.RavenDb/IPersistor.cs deleted file mode 100644 index 521eb1adb6..0000000000 --- a/src/FubuMVC.RavenDb/IPersistor.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Linq; -using System.Linq.Expressions; - -namespace FubuMVC.RavenDb -{ - public interface IPersistor - { - IQueryable LoadAll() where T : IEntity; - void Persist(T subject) where T : class, IEntity; - void DeleteAll() where T : IEntity; - void Remove(T target) where T : IEntity; - - T Find(Guid id) where T : class, IEntity; - T FindSingle(Expression> filter) where T : class, IEntity; - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/ITransaction.cs b/src/FubuMVC.RavenDb/ITransaction.cs deleted file mode 100644 index dfe34344b0..0000000000 --- a/src/FubuMVC.RavenDb/ITransaction.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using FubuCore.Binding; -using FubuMVC.RavenDb.MultiTenancy; - -namespace FubuMVC.RavenDb -{ - public interface ITransaction - { - void Execute(ServiceArguments arguments, Action action) where T : class; - - void Execute(Action action) where T : class; - - void Execute(Guid tenantId, Action action) where T : class; - } - - public abstract class TransactionBase : ITransaction - { - public abstract void Execute(ServiceArguments arguments, Action action) where T : class; - - public void Execute(Action action) where T : class - { - Execute(new ServiceArguments(), action); - } - - public void Execute(Guid tenantId, Action action) where T : class - { - Execute(SimpleTenantContext.ArgumentsForTenant(tenantId), action); - } - } - - public static class TransactionExtensions - { - public static void WithRepository(this ITransaction transaction, Action action) - { - transaction.Execute(action); - } - - public static void WithRepository(this ITransaction transaction, Guid tenantId, Action action) - { - transaction.Execute(tenantId, action); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/IUnitOfWork.cs b/src/FubuMVC.RavenDb/IUnitOfWork.cs deleted file mode 100644 index 34f8e76223..0000000000 --- a/src/FubuMVC.RavenDb/IUnitOfWork.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace FubuMVC.RavenDb -{ - public interface IUnitOfWork - { - IEntityRepository Start(); - IEntityRepository Start(Guid tenantId); - void Commit(); - void Reject(); - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/InMemory/DelegatingTransaction.cs b/src/FubuMVC.RavenDb/InMemory/DelegatingTransaction.cs deleted file mode 100644 index ccd4285d2a..0000000000 --- a/src/FubuMVC.RavenDb/InMemory/DelegatingTransaction.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using FubuCore.Binding; -using StructureMap; - -namespace FubuMVC.RavenDb.InMemory -{ - public class DelegatingTransaction : TransactionBase - { - private readonly IContainer _container; - - public DelegatingTransaction(IContainer container) - { - _container = container; - } - - public override void Execute(ServiceArguments arguments, Action action) - { - _container.Apply(arguments); - action(_container.GetInstance()); - } - - - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/InMemory/InMemoryPersistenceRegistry.cs b/src/FubuMVC.RavenDb/InMemory/InMemoryPersistenceRegistry.cs deleted file mode 100644 index 4a11b1b200..0000000000 --- a/src/FubuMVC.RavenDb/InMemory/InMemoryPersistenceRegistry.cs +++ /dev/null @@ -1,47 +0,0 @@ -using FubuCore.Dates; -using FubuCore.Logging; -using FubuMVC.RavenDb.MultiTenancy; -using FubuMVC.RavenDb.Reset; -using FubuMVC.RavenDb.Storage; -using StructureMap; - -namespace FubuMVC.RavenDb.InMemory -{ - public class PersistenceRegistry : Registry - { - public PersistenceRegistry() - { - // This acts as "SetServiceIfNone" - For().UseIfNone(() => SystemTime.Default()); - For().Add(); - For().UseIfNone(); - - // It's important that these are in this order - For().Add(); - For().Add(); - - For().Use(); - For().Use(); - - - // Needs to be resolved from the parent - ForSingletonOf().Use(); - For().UseIfNone(); - } - } - - public class InMemoryPersistenceRegistry : Registry - { - public InMemoryPersistenceRegistry() - { - IncludeRegistry(); - - For().Use(); - ForSingletonOf().Use(); - - For().Use(); - - For().Use(); - } - } -} diff --git a/src/FubuMVC.RavenDb/InMemory/InMemoryPersistenceReset.cs b/src/FubuMVC.RavenDb/InMemory/InMemoryPersistenceReset.cs deleted file mode 100644 index 126a00eebe..0000000000 --- a/src/FubuMVC.RavenDb/InMemory/InMemoryPersistenceReset.cs +++ /dev/null @@ -1,25 +0,0 @@ -using FubuCore; -using FubuMVC.RavenDb.Reset; - -namespace FubuMVC.RavenDb.InMemory -{ - public class InMemoryPersistenceReset : IPersistenceReset - { - private readonly InMemoryPersistor _persistor; - - public InMemoryPersistenceReset(IPersistor persistor) - { - _persistor = persistor.As(); - } - - public void ClearPersistedState() - { - _persistor.WipeAndReplace(new IEntity[0]); - } - - public void CommitAllChanges() - { - // no-op - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/InMemory/InMemoryPersistor.cs b/src/FubuMVC.RavenDb/InMemory/InMemoryPersistor.cs deleted file mode 100644 index f3bdeec18b..0000000000 --- a/src/FubuMVC.RavenDb/InMemory/InMemoryPersistor.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using FubuCore; - -namespace FubuMVC.RavenDb.InMemory -{ - public class InMemoryPersistor : IPersistor - { - private readonly IList _objects = new List(); - - - public IQueryable LoadAll() where T : IEntity - { - return _objects.OfType().AsQueryable(); - } - - public void Persist(T subject) where T : class, IEntity - { - if (subject.Id == Guid.Empty) - { - subject.Id = Guid.NewGuid(); - } - - var old = _objects.OfType().FirstOrDefault(x => x.Id == subject.Id); - old.IfNotNull(x => _objects.Remove(x)); - - _objects.Add(subject); - } - - public void DeleteAll() where T : IEntity - { - _objects.RemoveAll(x => x is T); - } - - public void Remove(T target) where T : IEntity - { - _objects.RemoveAll(x => x is T && x.Id == target.Id); - } - - public T FindBy(Expression> filter) where T : class, IEntity - { - return _objects.OfType().FirstOrDefault(filter.Compile()); - } - - public T Find(Guid id) where T : class, IEntity - { - return FindBy(x => x.Id == id); - } - - public T FindSingle(Expression> filter) where T : class, IEntity - { - return LoadAll().FirstOrDefault(filter); - } - - public void WipeAndReplace(IEnumerable entities) - { - _objects.Clear(); - _objects.AddRange(entities); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/InMemory/InMemoryTransaction.cs b/src/FubuMVC.RavenDb/InMemory/InMemoryTransaction.cs deleted file mode 100644 index 126da83327..0000000000 --- a/src/FubuMVC.RavenDb/InMemory/InMemoryTransaction.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using FubuCore.Binding; -using StructureMap; -using StructureMap.Pipeline; - -namespace FubuMVC.RavenDb.InMemory -{ - public class InMemoryTransaction : TransactionBase - { - private readonly IContainer _container; - - public InMemoryTransaction(IContainer container) - { - _container = container; - } - - public override void Execute(ServiceArguments arguments, Action action) - { - using (var nested = _container.GetNestedContainer()) - { - var explicits = new ExplicitArguments(); - arguments.EachService((type, o) => explicits.Set(type, o)); - - action(nested.GetInstance(explicits)); - } - } - - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/InMemory/InMemoryUnitOfWork.cs b/src/FubuMVC.RavenDb/InMemory/InMemoryUnitOfWork.cs deleted file mode 100644 index 1a82a0ba88..0000000000 --- a/src/FubuMVC.RavenDb/InMemory/InMemoryUnitOfWork.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using FubuMVC.RavenDb.MultiTenancy; -using StructureMap; - -namespace FubuMVC.RavenDb.InMemory -{ - public class InMemoryUnitOfWork : IUnitOfWork - { - private readonly IContainer _container; - - public InMemoryUnitOfWork(IContainer container) - { - _container = container; - } - - public IEntityRepository Start() - { - return _container.GetInstance(); - } - - public IEntityRepository Start(Guid tenantId) - { - return _container - .With(new SimpleTenantContext {CurrentTenant = tenantId}) - .GetInstance(); - } - - public void Commit() - { - // no-op; - } - - public void Reject() - { - // no-op; - } - } - - -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Membership/Audit.cs b/src/FubuMVC.RavenDb/Membership/Audit.cs deleted file mode 100644 index f0a8b959a3..0000000000 --- a/src/FubuMVC.RavenDb/Membership/Audit.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using FubuMVC.Core.Security.Authentication.Auditing; - -namespace FubuMVC.RavenDb.Membership -{ - public class Audit : Entity - { - public AuditMessage Message { get; set; } - public DateTime Timestamp { get; set; } - - public string Type - { - get { return Message.GetType().Name; } - set - { - // no-op; - } - } - - public string Username - { - get { return Message.UserName; } - set - { - // do nothing - } - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Membership/LoginAuditPersistor.cs b/src/FubuMVC.RavenDb/Membership/LoginAuditPersistor.cs deleted file mode 100644 index 34597b1244..0000000000 --- a/src/FubuMVC.RavenDb/Membership/LoginAuditPersistor.cs +++ /dev/null @@ -1,56 +0,0 @@ -using FubuCore; -using FubuMVC.Core.Security.Authentication; -using Raven.Client; - -namespace FubuMVC.RavenDb.Membership -{ - public class LoginAuditPersistor - { - private readonly IEntityRepository _repository; - private readonly IDocumentSession _session; - - public LoginAuditPersistor(IEntityRepository repository, IDocumentSession session) - { - _repository = repository; - _session = session; - } - - public void LogFailure(LoginRequest request, Audit audit) - { - if (request.UserName.IsEmpty()) return; - - _repository.Update(audit); - - var history = _session.Load(request.UserName) ?? new LoginFailureHistory - { - Id = request.UserName - }; - - history.Attempts = request.NumberOfTries; - history.LockedOutTime = request.LockedOutUntil; - - _session.Store(history); - } - - public void LogSuccess(LoginRequest request, Audit audit) - { - _repository.Update(audit); - - var history = _session.Load(request.UserName); - if (history != null) - { - _session.Delete(history); - } - } - - public void ApplyHistory(LoginRequest request) - { - if (request.UserName.IsEmpty()) return; - var history = _session.Load(request.UserName); - if (history == null) return; - - request.NumberOfTries = history.Attempts; - request.LockedOutUntil = history.LockedOutTime; - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Membership/LoginFailureHistory.cs b/src/FubuMVC.RavenDb/Membership/LoginFailureHistory.cs deleted file mode 100644 index 217b3c19f5..0000000000 --- a/src/FubuMVC.RavenDb/Membership/LoginFailureHistory.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace FubuMVC.RavenDb.Membership -{ - public class LoginFailureHistory - { - public string Id { get; set; } - public int Attempts { get; set; } - public DateTime? LockedOutTime { get; set; } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Membership/MembershipRepository.cs b/src/FubuMVC.RavenDb/Membership/MembershipRepository.cs deleted file mode 100644 index ae6040de51..0000000000 --- a/src/FubuMVC.RavenDb/Membership/MembershipRepository.cs +++ /dev/null @@ -1,28 +0,0 @@ -using FubuMVC.Core.Security.Authentication; -using FubuMVC.Core.Security.Authentication.Membership; - -namespace FubuMVC.RavenDb.Membership -{ - public class MembershipRepository : IMembershipRepository where T : User - { - private readonly IEntityRepository _repository; - private readonly IPasswordHash _hash; - - public MembershipRepository(IEntityRepository repository, IPasswordHash hash) - { - _repository = repository; - _hash = hash; - } - - public bool MatchesCredentials(LoginRequest request) - { - var hashed = _hash.CreateHash(request.Password); - return _repository.FindWhere(x => x.UserName == request.UserName && x.Password == hashed) != null; - } - - public IUserInfo FindByName(string username) - { - return _repository.FindWhere(x => x.UserName == username); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Membership/PersistedLoginAuditor.cs b/src/FubuMVC.RavenDb/Membership/PersistedLoginAuditor.cs deleted file mode 100644 index a97ba45728..0000000000 --- a/src/FubuMVC.RavenDb/Membership/PersistedLoginAuditor.cs +++ /dev/null @@ -1,76 +0,0 @@ -using FubuCore.Dates; -using FubuMVC.Core.Security.Authentication; -using FubuMVC.Core.Security.Authentication.Auditing; - -namespace FubuMVC.RavenDb.Membership -{ - public class PersistedLoginAuditor : ILoginAuditor - { - private readonly ISystemTime _systemTime; - private readonly ITransaction _transaction; - - public PersistedLoginAuditor(ISystemTime systemTime, ITransaction transaction) - { - _systemTime = systemTime; - _transaction = transaction; - } - - public void Audit(LoginRequest request) - { - if (request.Status == LoginStatus.Succeeded) - { - logSuccess(request); - } - else - { - logFailure(request); - } - } - - private void logFailure(LoginRequest request) - { - var audit = new Audit - { - Message = new LoginFailure {UserName = request.UserName}, - Timestamp = _systemTime.UtcNow() - }; - - _transaction.Execute(x => x.LogFailure(request, audit)); - } - - - private void logSuccess(LoginRequest request) - { - var audit = new Audit - { - Message = new LoginSuccess {UserName = request.UserName}, - Timestamp = _systemTime.UtcNow() - }; - - _transaction.Execute(x => x.LogSuccess(request, audit)); - } - - - public void ApplyHistory(LoginRequest request) - { - _transaction.Execute(x => x.ApplyHistory(request)); - } - - - public void Audit(T log) where T : AuditMessage - { - persistAudit(log); - } - - private void persistAudit(AuditMessage message) - { - var audit = new Audit - { - Message = message, - Timestamp = _systemTime.UtcNow() - }; - - _transaction.WithRepository(repo => repo.Update(audit)); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Membership/PersistedMembership.cs b/src/FubuMVC.RavenDb/Membership/PersistedMembership.cs deleted file mode 100644 index 16b9fcebcd..0000000000 --- a/src/FubuMVC.RavenDb/Membership/PersistedMembership.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using FubuMVC.Core; -using FubuMVC.Core.Security.Authentication; -using FubuMVC.Core.Security.Authentication.Auditing; -using FubuMVC.Core.Security.Authentication.Membership; - -namespace FubuMVC.RavenDb.Membership -{ - public class PersistedMembership : IFubuRegistryExtension where T : User - { - public void Configure(FubuRegistry registry) - { - registry.Services.ReplaceService>(); - registry.Services.SetServiceIfNone(); - registry.Services.ReplaceService(); - - registry.AlterSettings(x => - { - x.Strategies.AddToEnd(new MembershipNode(typeof (MembershipRepository))); - - x.Strategies.OfType() - .Where(node => node.MembershipType == typeof (MembershipAuthentication)) - .ToArray() - .Each(node => node.Remove()); - }); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Membership/User.cs b/src/FubuMVC.RavenDb/Membership/User.cs deleted file mode 100644 index 602e0f3a51..0000000000 --- a/src/FubuMVC.RavenDb/Membership/User.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using FubuMVC.Core.Security.Authentication.Membership; - -namespace FubuMVC.RavenDb.Membership -{ - public class User : UserInfo, IEntity - { - public Guid Id { get; set; } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/MultiTenancy/ByTenantEntityStorage.cs b/src/FubuMVC.RavenDb/MultiTenancy/ByTenantEntityStorage.cs deleted file mode 100644 index 172cec7916..0000000000 --- a/src/FubuMVC.RavenDb/MultiTenancy/ByTenantEntityStorage.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using FubuMVC.RavenDb.Storage; - -namespace FubuMVC.RavenDb.MultiTenancy -{ - public class ByTenantEntityStorage : IEntityStorage where T : class, ITenantedEntity - { - private readonly IEntityStorage _inner; - private readonly ITenantContext _context; - - public ByTenantEntityStorage(IEntityStorage inner, ITenantContext context) - { - _inner = inner; - _context = context; - - if (_context.CurrentTenant == Guid.Empty) throw new InvalidOperationException(); - } - - public ITenantContext Context - { - get { return _context; } - } - - public T Find(Guid id) - { - assertHasContext(); - - var subject = _inner.Find(id); - if (subject == null) return null; - - return subject.TenantId == _context.CurrentTenant ? subject : null; - } - - public void Update(T entity) - { - assertHasContext(); - ifMatchesTenant(entity.Id, () => - { - entity.TenantId = _context.CurrentTenant; - _inner.Update(entity); - }); - } - - public void Remove(T entity) - { - assertHasContext(); - ifMatchesTenant(entity.Id, () => _inner.Remove(entity)); - } - - public IQueryable All() - { - assertHasContext(); - return _inner.All().Where(x => x.TenantId == _context.CurrentTenant); - } - - // Not too worried about how awful this is because it's only used in testing with - // very small data sets - public void DeleteAll() - { - assertHasContext(); - - _inner.All().Where(x => x.TenantId == _context.CurrentTenant).ToList().Each( x => _inner.Remove(x)); - } - - public T FindSingle(Expression> filter) - { - assertHasContext(); - return _inner.All().Where(x => x.TenantId == _context.CurrentTenant).Where(filter).FirstOrDefault(); - } - - private void ifMatchesTenant(Guid id, Action continuation) - { - var subject = _inner.Find(id); - if (subject == null || subject.TenantId == _context.CurrentTenant) - { - continuation(); - - return; - } - - throw new ArgumentOutOfRangeException("This entity is not owned by the current Tenant"); - } - - private void assertHasContext() - { - if (_context.CurrentTenant == Guid.Empty) - { - throw new InvalidOperationException("No current Tenant is available in this context"); - } - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/MultiTenancy/ByTenantStoragePolicy.cs b/src/FubuMVC.RavenDb/MultiTenancy/ByTenantStoragePolicy.cs deleted file mode 100644 index 219759e6ca..0000000000 --- a/src/FubuMVC.RavenDb/MultiTenancy/ByTenantStoragePolicy.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using FubuCore; -using FubuMVC.RavenDb.Storage; - -namespace FubuMVC.RavenDb.MultiTenancy -{ - public class ByTenantStoragePolicy : IEntityStoragePolicy - { - private readonly ITenantContext _context; - - public ByTenantStoragePolicy(ITenantContext context) - { - _context = context; - } - - public bool Matches() where T : class, IEntity - { - return typeof (T).CanBeCastTo(); - } - - public IEntityStorage Wrap(IEntityStorage inner) where T : class, IEntity - { - var storageType = typeof (ByTenantEntityStorage<>).MakeGenericType(typeof (T)); - return (IEntityStorage) Activator.CreateInstance(storageType, inner, _context); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/MultiTenancy/ITenantContext.cs b/src/FubuMVC.RavenDb/MultiTenancy/ITenantContext.cs deleted file mode 100644 index 0d560da669..0000000000 --- a/src/FubuMVC.RavenDb/MultiTenancy/ITenantContext.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace FubuMVC.RavenDb.MultiTenancy -{ - public interface ITenantContext - { - Guid CurrentTenant { get; } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/MultiTenancy/ITenantedEntity.cs b/src/FubuMVC.RavenDb/MultiTenancy/ITenantedEntity.cs deleted file mode 100644 index f5310870a5..0000000000 --- a/src/FubuMVC.RavenDb/MultiTenancy/ITenantedEntity.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace FubuMVC.RavenDb.MultiTenancy -{ - public interface ITenantedEntity : IEntity - { - Guid TenantId { get; set; } - } - - public abstract class TenantedEntity : Entity, ITenantedEntity - { - public Guid TenantId { get; set; } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/MultiTenancy/NulloTenantContext.cs b/src/FubuMVC.RavenDb/MultiTenancy/NulloTenantContext.cs deleted file mode 100644 index f4a3c3d6b2..0000000000 --- a/src/FubuMVC.RavenDb/MultiTenancy/NulloTenantContext.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace FubuMVC.RavenDb.MultiTenancy -{ - public class NulloTenantContext : ITenantContext - { - public Guid CurrentTenant - { - get { return Guid.Empty; } - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/MultiTenancy/SimpleTenantContext.cs b/src/FubuMVC.RavenDb/MultiTenancy/SimpleTenantContext.cs deleted file mode 100644 index fcfdfb45b7..0000000000 --- a/src/FubuMVC.RavenDb/MultiTenancy/SimpleTenantContext.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using FubuCore.Binding; - -namespace FubuMVC.RavenDb.MultiTenancy -{ - public class SimpleTenantContext : ITenantContext - { - public Guid CurrentTenant { get; set; } - - public static ServiceArguments ArgumentsForTenant(Guid tenantId) - { - return new ServiceArguments().With(new SimpleTenantContext{CurrentTenant = tenantId}); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Properties/AssemblyInfo.cs b/src/FubuMVC.RavenDb/Properties/AssemblyInfo.cs deleted file mode 100644 index 35ad0a7ea7..0000000000 --- a/src/FubuMVC.RavenDb/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using FubuMVC.Core; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("FubuMVC.RavenDb")] -[assembly: FubuModule] \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/CustomizeRavenJsonSerializer.cs b/src/FubuMVC.RavenDb/RavenDb/CustomizeRavenJsonSerializer.cs deleted file mode 100644 index b27aa59afa..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/CustomizeRavenJsonSerializer.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Collections.Generic; -using Raven.Client; -using Raven.Imports.Newtonsoft.Json; - -namespace FubuMVC.RavenDb.RavenDb -{ - public class CustomizeRavenJsonSerializer : IDocumentStoreConfigurationAction - { - private readonly IEnumerable _converters; - - public CustomizeRavenJsonSerializer(IEnumerable converters) - { - _converters = converters; - } - - public void Configure(IDocumentStore documentStore) - { - documentStore.Conventions.CustomizeJsonSerializer = s => - { - s.TypeNameHandling = TypeNameHandling.All; - s.Converters.AddRange(_converters); - }; - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/DisposeRavenSessionMessage.cs b/src/FubuMVC.RavenDb/RavenDb/DisposeRavenSessionMessage.cs deleted file mode 100644 index 4041bc7261..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/DisposeRavenSessionMessage.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Threading; -using FubuCore; -using FubuCore.Logging; -using Raven.Client; - -namespace FubuMVC.RavenDb.RavenDb -{ - public class DisposeRavenSessionMessage : LogRecord - { - public int Requests { get; set; } - public string UserName { get; set; } - - public static DisposeRavenSessionMessage For(IDocumentSession session) - { - var userName = Thread.CurrentPrincipal.IfNotNull(x => x.Identity.Name); - var requests = session.Advanced.NumberOfRequests; - return new DisposeRavenSessionMessage - { - UserName = userName, - Requests = requests - }; - } - - public override string ToString() - { - return string.Format("Disposing Raven Session. Requests: {0}, UserName: {1}", Requests, UserName); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/EmbeddedDatabaseRunner.cs b/src/FubuMVC.RavenDb/RavenDb/EmbeddedDatabaseRunner.cs deleted file mode 100644 index 02e33dc268..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/EmbeddedDatabaseRunner.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using FubuCore; -using FubuMVC.RavenDb.Reset; -using Raven.Client; -using Raven.Database.Server; - -namespace FubuMVC.RavenDb.RavenDb -{ - public class EmbeddedDatabaseRunner : IDisposable, IPersistenceReset - { - private IDocumentStore _store; - - public IDocumentStore Store - { - get { return _store; } - } - - public void Dispose() - { - _store.Dispose(); - } - - public void Start() - { - NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8080); - - RavenDbSettings settings = RavenDbSettings.InMemory(); - settings.UseEmbeddedHttpServer = true; - - _store = settings.Create(); - _store.Initialize(); - } - - public RavenDbSettings SettingsToConnect() - { - return new RavenDbSettings{Url = "http://localhost:8080"}; - } - - public void ClearPersistedState() - { - IEnumerable types = AppDomain.CurrentDomain.GetAssemblies() - .SelectMany(a => - { - try - { - return a.GetExportedTypes(); - } - catch (Exception) - { - return new Type[0]; - } - }).Where(x => x.IsConcreteTypeOf()); - - - using (IDocumentSession session = _store.OpenSession()) - { - types.Each(type => - { - typeof(Deleter<>).CloseAndBuildAs(type) - .Delete(session); - }); - - session.SaveChanges(); - } - } - - public class Deleter : IDeleter - { - public void Delete(IDocumentSession session) - { - T[] all = session.Query().ToArray(); - all.Each(x => session.Delete(x)); - } - } - - public interface IDeleter - { - void Delete(IDocumentSession session); - } - - - public void CommitAllChanges() - { - // do nothing - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/IDocumentStoreBuilder.cs b/src/FubuMVC.RavenDb/RavenDb/IDocumentStoreBuilder.cs deleted file mode 100644 index ea9aa9194e..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/IDocumentStoreBuilder.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections.Generic; -using Raven.Client; - -namespace FubuMVC.RavenDb.RavenDb -{ - public interface IDocumentStoreBuilder - { - IDocumentStore Build(); - } - - public class DocumentStoreBuilder : IDocumentStoreBuilder - { - private readonly IEnumerable _configurations; - private readonly RavenDbSettings _settings; - - public DocumentStoreBuilder(RavenDbSettings settings, IEnumerable configurations) - { - _settings = settings; - _configurations = configurations; - } - - public IDocumentStore Build() - { - var documentStore = _settings.Create(); - - documentStore.Identifier = "Default"; - - _configurations.Each(x => x.Configure(documentStore)); - - documentStore.Initialize(); - - return documentStore; - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/IDocumentStoreConfigurationAction.cs b/src/FubuMVC.RavenDb/RavenDb/IDocumentStoreConfigurationAction.cs deleted file mode 100644 index 2d4f50723b..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/IDocumentStoreConfigurationAction.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using FubuMVC.RavenDb.RavenDb.Multiple; -using Raven.Client; -using StructureMap; - -namespace FubuMVC.RavenDb.RavenDb -{ - public interface IDocumentStoreConfigurationAction - { - void Configure(IDocumentStore documentStore); - } - - public interface IDocumentStoreConfigurationAction : IDocumentStoreConfigurationAction where T : RavenDbSettings - { - - } - - public class LambdaDocumentStoreConfigurationAction : IDocumentStoreConfigurationAction where T : RavenDbSettings - { - private readonly Action _configuration; - - public static IDocumentStoreConfigurationAction For(Action configuration) - { - return new LambdaDocumentStoreConfigurationAction(configuration); - } - - private LambdaDocumentStoreConfigurationAction(Action configuration) - { - _configuration = configuration; - } - - public void Configure(IDocumentStore documentStore) - { - _configuration(documentStore); - } - } - - public static class StructureMapRegistryExtensions - { - public static void RavenDbConfiguration(this Registry registry, Action configuration) - { - var action = LambdaDocumentStoreConfigurationAction.For(configuration); - registry.For() - .Add(action); - } - - public static MultipleDatabaseRegistrationExpression ConnectToRavenDb(this Registry registry, Action configuration = null) where T : RavenDbSettings - { - registry.ForSingletonOf>().UseInstance(new DocumentStoreInstance()); - - if (configuration != null) - { - var action = LambdaDocumentStoreConfigurationAction.For(configuration); - registry.For>() - .Add(action); - } - - return new MultipleDatabaseRegistrationExpression(registry); - } - - } - - - public class MultipleDatabaseRegistrationExpression where T : RavenDbSettings - { - private readonly Registry _registry; - - public MultipleDatabaseRegistrationExpression(Registry registry) - { - _registry = registry; - } - - public void Using() - where TInterface : IDocumentSession - where TClass : DocumentSession, TInterface - { - _registry.For().Use(); - } - - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/ISessionBoundary.cs b/src/FubuMVC.RavenDb/RavenDb/ISessionBoundary.cs deleted file mode 100644 index d29d95e765..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/ISessionBoundary.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Threading.Tasks; -using Raven.Client; - -namespace FubuMVC.RavenDb.RavenDb -{ - public interface ISessionBoundary : IDisposable - { - IDocumentSession Session(); - IDocumentSession Session() where T : RavenDbSettings; - void WithOpenSession(Action action); - Task SaveChanges(); - void Start(); - void MakeReadOnly(); - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentSession.cs b/src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentSession.cs deleted file mode 100644 index ef05ebd30d..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentSession.cs +++ /dev/null @@ -1,139 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using Raven.Abstractions.Data; -using Raven.Client; -using Raven.Client.Document; -using Raven.Client.Indexes; -using Raven.Client.Linq; - -namespace FubuMVC.RavenDb.RavenDb.Multiple -{ - public class DocumentSession : IDocumentSession where TSettings : RavenDbSettings - { - private readonly IDocumentSession _inner; - - public DocumentSession(ISessionBoundary boundary) - { - _inner = boundary.Session(); - } - - - public void Dispose() - { - _inner.Dispose(); - } - - public void Delete(T entity) - { - _inner.Delete(entity); - } - - public T Load(string id) - { - return _inner.Load(id); - } - - public T[] Load(params string[] ids) - { - return _inner.Load(ids); - } - - public T[] Load(IEnumerable ids) - { - return _inner.Load(ids); - } - - public T Load(ValueType id) - { - return _inner.Load(id); - } - - public T[] Load(params ValueType[] ids) - { - return _inner.Load(ids); - } - - public T[] Load(IEnumerable ids) - { - return _inner.Load(ids); - } - - public IRavenQueryable Query(string indexName, bool isMapReduce = false) - { - return _inner.Query(indexName, isMapReduce); - } - - public IRavenQueryable Query() - { - return _inner.Query(); - } - - public IRavenQueryable Query() where TIndexCreator : AbstractIndexCreationTask, new() - { - return _inner.Query(); - } - - public ILoaderWithInclude Include(string path) - { - return _inner.Include(path); - } - - public ILoaderWithInclude Include(Expression> path) - { - return _inner.Include(path); - } - - public ILoaderWithInclude Include(Expression> path) - { - return _inner.Include(path); - } - - public TResult Load(string id) where TTransformer : AbstractTransformerCreationTask, new() - { - return _inner.Load(id); - } - - public TResult Load(string id, Action configure) where TTransformer : AbstractTransformerCreationTask, new() - { - return _inner.Load(id, configure); - } - - public TResult[] Load(params string[] ids) where TTransformer : AbstractTransformerCreationTask, new() - { - return _inner.Load(ids); - } - - public TResult[] Load(IEnumerable ids, Action configure) where TTransformer : AbstractTransformerCreationTask, new() - { - return _inner.Load(ids, configure); - } - - public void SaveChanges() - { - _inner.SaveChanges(); - } - - public void Store(object entity, Etag etag) - { - _inner.Store(entity, etag); - } - - public void Store(object entity, Etag etag, string id) - { - _inner.Store(entity, etag, id); - } - - public void Store(object entity) - { - _inner.Store(entity); - } - - public void Store(object entity, string id) - { - _inner.Store(entity, id); - } - - public ISyncAdvancedSessionOperation Advanced { get { return _inner.Advanced; } } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentStore.cs b/src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentStore.cs deleted file mode 100644 index 546627f554..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentStore.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Collections.Specialized; -using Raven.Abstractions.Data; -using Raven.Client; -using Raven.Client.Changes; -using Raven.Client.Connection; -using Raven.Client.Connection.Async; -using Raven.Client.Document; -using Raven.Client.Indexes; - -namespace FubuMVC.RavenDb.RavenDb.Multiple -{ - public interface IDocumentStore : IDocumentStore where T : RavenDbSettings - { - - } - - public class DocumentStore : IDocumentStore where T : RavenDbSettings - { - private readonly IDocumentStore _inner; - - public DocumentStore(IDocumentStore inner) - { - _inner = inner; - } - - public void Dispose() - { - _inner.Dispose(); - } - - public bool WasDisposed - { - get { return _inner.WasDisposed; } - } - - public event EventHandler AfterDispose - { - add { _inner.AfterDispose += value; } - remove { _inner.AfterDispose -= value; } - } - - public IDatabaseChanges Changes(string database = null) - { - return _inner.Changes(database); - } - - public IDisposable AggressivelyCacheFor(TimeSpan cacheDuration) - { - return _inner.AggressivelyCacheFor(cacheDuration); - } - - public IDisposable AggressivelyCache() - { - return _inner.AggressivelyCache(); - } - - public IDisposable DisableAggressiveCaching() - { - return _inner.DisableAggressiveCaching(); - } - - public IDisposable SetRequestsTimeoutFor(TimeSpan timeout) - { - return _inner.SetRequestsTimeoutFor(timeout); - } - - public IDocumentStore Initialize() - { - throw new NotSupportedException("This is a wrapped IDocumentStore that will already be initialized"); - } - - public IAsyncDocumentSession OpenAsyncSession() - { - return _inner.OpenAsyncSession(); - } - - public IAsyncDocumentSession OpenAsyncSession(string database) - { - return _inner.OpenAsyncSession(database); - } - - public IDocumentSession OpenSession() - { - return _inner.OpenSession(); - } - - public IDocumentSession OpenSession(string database) - { - return _inner.OpenSession(database); - } - - public IDocumentSession OpenSession(OpenSessionOptions sessionOptions) - { - return _inner.OpenSession(sessionOptions); - } - - public void ExecuteIndex(AbstractIndexCreationTask indexCreationTask) - { - _inner.ExecuteIndex(indexCreationTask); - } - - public void ExecuteTransformer(AbstractTransformerCreationTask transformerCreationTask) - { - _inner.ExecuteTransformer(transformerCreationTask); - } - - public Etag GetLastWrittenEtag() - { - return _inner.GetLastWrittenEtag(); - } - - public BulkInsertOperation BulkInsert(string database = null, BulkInsertOptions options = null) - { - return _inner.BulkInsert(database, options); - } - - public NameValueCollection SharedOperationsHeaders { get { return _inner.SharedOperationsHeaders; } } - public HttpJsonRequestFactory JsonRequestFactory { get { return _inner.JsonRequestFactory; } } - public string Identifier - { - get { return typeof (T).Name; } - set - { - // no-op; - } - } - public IAsyncDatabaseCommands AsyncDatabaseCommands { get { return _inner.AsyncDatabaseCommands; } } - public IDatabaseCommands DatabaseCommands { get { return _inner.DatabaseCommands; } } - public DocumentConvention Conventions { get { return _inner.Conventions; } } - public string Url { get { return _inner.Url; } } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentStoreBuilder.cs b/src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentStoreBuilder.cs deleted file mode 100644 index 9a5347417c..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentStoreBuilder.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections.Generic; - -namespace FubuMVC.RavenDb.RavenDb.Multiple -{ - public class DocumentStoreBuilder : DocumentStoreBuilder where T : RavenDbSettings - { - public DocumentStoreBuilder(T settings, IEnumerable> configurations) : base(settings, configurations) - { - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentStoreInstance.cs b/src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentStoreInstance.cs deleted file mode 100644 index e6f1722335..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/Multiple/DocumentStoreInstance.cs +++ /dev/null @@ -1,16 +0,0 @@ -using StructureMap.Pipeline; - -namespace FubuMVC.RavenDb.RavenDb.Multiple -{ - public class DocumentStoreInstance : LambdaInstance> where T : RavenDbSettings - { - public DocumentStoreInstance() : base("Builds the IDocumentStore for settings class " + typeof (T).Name, - c => { - var inner = c.GetInstance>().Build(); - return new DocumentStore(inner); - }) - { - } - - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/Multiple/IDocumentSession.cs b/src/FubuMVC.RavenDb/RavenDb/Multiple/IDocumentSession.cs deleted file mode 100644 index a30481cfaf..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/Multiple/IDocumentSession.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Raven.Client; - -namespace FubuMVC.RavenDb.RavenDb.Multiple -{ - public interface IDocumentSession : IDocumentSession where TSettings : RavenDbSettings - { - - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/RavenDbRegistry.cs b/src/FubuMVC.RavenDb/RavenDb/RavenDbRegistry.cs deleted file mode 100644 index 52f4abf832..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/RavenDbRegistry.cs +++ /dev/null @@ -1,39 +0,0 @@ -using FubuMVC.Core.Registration; -using FubuMVC.RavenDb.InMemory; -using FubuMVC.RavenDb.RavenDb.Multiple; -using FubuMVC.RavenDb.Reset; -using Raven.Client; - -namespace FubuMVC.RavenDb.RavenDb -{ - public class RavenDbRegistry : ServiceRegistry - { - public RavenDbRegistry() - { - IncludeRegistry(); - - Scan(x => - { - x.AssemblyContainingType(); - x.AddAllTypesOf(); - }); - - - ForSingletonOf().Use(c => c.GetInstance().Build()); - - For().Use(c => c.GetInstance().Session()); - - For().Use(); - - For().Use(); - - For().Use(); - - For().Use(); - - ForSingletonOf().Use(); - - For(typeof(IDocumentSession<>)).Use(typeof(DocumentSession<>)); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/RavenDbSettings.cs b/src/FubuMVC.RavenDb/RavenDb/RavenDbSettings.cs deleted file mode 100644 index b4f0e8bef3..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/RavenDbSettings.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using FubuCore; -using FubuCore.Binding; -using Raven.Client; -using Raven.Client.Document; -using Raven.Client.Embedded; - -namespace FubuMVC.RavenDb.RavenDb -{ - public class RavenDbSettings - { - public string DataDirectory { get; set; } - public bool RunInMemory { get; set; } - public string Url { get; set; } - public bool UseEmbeddedHttpServer { get; set; } - public int Port { get; set; } - - public static RavenDbSettings InMemory() - { - return new RavenDbSettings - { - ConnectionString = null, - DataDirectory = null, - RunInMemory = true - }; - } - - [ConnectionString] - public string ConnectionString { get; set; } - - public bool IsEmpty() - { - return !RunInMemory && DataDirectory.IsEmpty() && Url.IsEmpty(); - } - - public IDocumentStore Create() - { - if (IsEmpty()) - { - var defaultDataDirectory = AppDomain.CurrentDomain.SetupInformation.ApplicationBase.ParentDirectory().AppendPath("data"); - return new RavenDbSettings {DataDirectory = defaultDataDirectory}.Create(); - } - - if (Url.IsNotEmpty()) - { - var store = new DocumentStore - { - Url = Url - }; - - if (ConnectionString.IsNotEmpty()) - { - store.ParseConnectionString(ConnectionString); - } - - return store; - } - - if (DataDirectory.IsNotEmpty()) - { - return new EmbeddableDocumentStore - { - DataDirectory = DataDirectory, - UseEmbeddedHttpServer = UseEmbeddedHttpServer - }; - } - - if (RunInMemory) - { - var store = new EmbeddableDocumentStore - { - RunInMemory = true, - UseEmbeddedHttpServer = UseEmbeddedHttpServer - }; - - if (Url.IsNotEmpty()) - { - store.Url = Url; - } - - if (Port > 0) - { - store.Configuration.Port = Port; - } - - return store; - } - - throw new ArgumentOutOfRangeException("settings"); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/RavenPersistenceReset.cs b/src/FubuMVC.RavenDb/RavenDb/RavenPersistenceReset.cs deleted file mode 100644 index cedfb5343f..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/RavenPersistenceReset.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using FubuCore; -using FubuMVC.RavenDb.RavenDb.Multiple; -using FubuMVC.RavenDb.Reset; -using Raven.Client; -using StructureMap; - -namespace FubuMVC.RavenDb.RavenDb -{ - public class RavenPersistenceReset : IPersistenceReset - { - private readonly IContainer _container; - - public RavenPersistenceReset(IContainer container) - { - _container = container; - } - - public void ClearPersistedState() - { - var ports = new List(); - - _container.Model.For().Default.EjectObject(); - _container.Inject(new RavenDbSettings - { - RunInMemory = true, - UseEmbeddedHttpServer = true - }); - - ports.Add(8080); - - // Force the container to spin it up now just in case other things - // are trying access the store remotely - var store = _container.GetInstance(); - Debug.WriteLine("Opening up a new in memory RavenDb IDocumentStore at " + store.Url); - - - var otherSettingTypes = FindOtherSettingTypes(); - - otherSettingTypes.Each(type => { - var settings = Activator.CreateInstance(type).As(); - settings.Url = null; - settings.ConnectionString = null; - settings.RunInMemory = true; - - if (ports.Contains(settings.Port)) - { - var port = ports.Max() + 1; - settings.Port = port; - ports.Add(port); - } - - Debug.WriteLine("Starting a new database for {0} at http://localhost:{1}", type.Name, settings.Port); - - settings.UseEmbeddedHttpServer = true; - - _container.Inject(type, settings); - - var documentStoreType = typeof (IDocumentStore<>).MakeGenericType(type); - _container.Model.For(documentStoreType).Default.EjectObject(); - - // Force the container to spin it up now just in case other things - // are trying access the store remotely - _container.GetInstance(documentStoreType); - }); - - } - - public IList FindOtherSettingTypes() - { - var otherSettingTypes = _container.Model.PluginTypes.Where(x => x.PluginType.IsConcreteTypeOf() && x.PluginType != typeof(RavenDbSettings)) - .Select(x => x.PluginType).ToList(); - return otherSettingTypes; - } - - public void CommitAllChanges() - { - // no-op for now - } - - public static void Try() - { - - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/RavenPersistor.cs b/src/FubuMVC.RavenDb/RavenDb/RavenPersistor.cs deleted file mode 100644 index 5c9d44e351..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/RavenPersistor.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using Raven.Client; - -namespace FubuMVC.RavenDb.RavenDb -{ - public class RavenPersistor : IPersistor - { - private readonly Lazy _session; - - public RavenPersistor(ISessionBoundary boundary) - { - _session = new Lazy(() => - { - return boundary.Session(); - }); - } - - private IDocumentSession session - { - get { return _session.Value; } - } - - public IQueryable LoadAll() where T : IEntity - { - return session.Query(); - } - - public void Persist(T subject) where T : class, IEntity - { - session.Store(subject); - } - - /// - /// Not really worried about perf here because it's - /// only going to be used for testing on little bitty - /// data sets - /// - /// - public void DeleteAll() where T : IEntity - { - var subjects = session.Query().ToList(); - subjects.Each(Remove); - } - - public void Remove(T target) where T : IEntity - { - session.Delete(target); - } - - public T FindSingle(Expression> filter) where T : class, IEntity - { - var queriedCopy = session.Query().FirstOrDefault(filter); - if (queriedCopy == null) return null; - - return Find(queriedCopy.Id); - } - - public T Find(Guid id) where T : class, IEntity - { - return session.Load(id); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/RavenTransaction.cs b/src/FubuMVC.RavenDb/RavenDb/RavenTransaction.cs deleted file mode 100644 index 29a8aba5b6..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/RavenTransaction.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using FubuCore.Binding; -using StructureMap; - -namespace FubuMVC.RavenDb.RavenDb -{ - public class RavenTransaction : TransactionBase - { - private readonly IContainer _container; - - public RavenTransaction(IContainer container) - { - _container = container; - } - - public override void Execute(ServiceArguments arguments, Action action) - { - using (IContainer nested = _container.GetNestedContainer()) - { - nested.Apply(arguments); - - var service = nested.GetInstance(); - action(service); - - nested.GetInstance().SaveChanges(); - } - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/RavenUnitOfWork.cs b/src/FubuMVC.RavenDb/RavenDb/RavenUnitOfWork.cs deleted file mode 100644 index 9a43140aec..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/RavenUnitOfWork.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using FubuMVC.RavenDb.MultiTenancy; -using StructureMap; - -namespace FubuMVC.RavenDb.RavenDb -{ - public class RavenUnitOfWork : IUnitOfWork, IDisposable - { - private Lazy _nested; - private readonly IContainer _container; - - public RavenUnitOfWork(IContainer container) - { - _container = container; - reset(); - } - - private void reset() - { - _nested = new Lazy(_container.GetNestedContainer); - } - - public IEntityRepository Start() - { - assertNotAlreadyStarted(); - - return _nested.Value.GetInstance(); - } - - private void assertNotAlreadyStarted() - { - if (_nested.IsValueCreated) throw new InvalidOperationException("Start or Start(tenantId) can only be called once"); - } - - public IEntityRepository Start(Guid tenantId) - { - assertNotAlreadyStarted(); - - return _nested.Value.With(new SimpleTenantContext { CurrentTenant = tenantId }).GetInstance(); - } - - public void Commit() - { - if (_nested.IsValueCreated) - { - _nested.Value.GetInstance().SaveChanges(); - } - - reset(); - } - - public void Reject() - { - Dispose(); - reset(); - } - - public void Dispose() - { - if (_nested.IsValueCreated) - { - _nested.Value.Dispose(); - } - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDb/SessionBoundary.cs b/src/FubuMVC.RavenDb/RavenDb/SessionBoundary.cs deleted file mode 100644 index 7d32606fa6..0000000000 --- a/src/FubuMVC.RavenDb/RavenDb/SessionBoundary.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Threading.Tasks; -using FubuCore.Logging; -using FubuCore.Util; -using FubuMVC.RavenDb.RavenDb.Multiple; -using Raven.Client; -using StructureMap; - -namespace FubuMVC.RavenDb.RavenDb -{ - public class SessionBoundary : ISessionBoundary - { - private readonly IDocumentStore _store; - private readonly ILogger _logger; - - private Lazy _session; - private readonly Cache _otherSessions; - - public SessionBoundary(IDocumentStore store, IContainer container, ILogger logger) - { - _store = store; - _logger = logger; - _otherSessions = new Cache(type => { - var otherStore = container.ForGenericType(typeof (IDocumentStore<>)) - .WithParameters(type) - .GetInstanceAs(); - - return otherStore.OpenSession(); - }); - - reset(); - } - - private IEnumerable openSessions() - { - if (_session != null && _session.IsValueCreated) - { - yield return _session.Value; - } - - foreach (var session in _otherSessions) - { - yield return session; - } - } - - public void Dispose() - { - WithOpenSession(s => - { - _logger.DebugMessage(() => DisposeRavenSessionMessage.For(s)); - s.Dispose(); - }); - _otherSessions.ClearAll(); - } - - public IDocumentSession Session() - { - return _session.Value; - } - - public IDocumentSession Session() where T : RavenDbSettings - { - return _otherSessions[typeof (T)]; - } - - public void WithOpenSession(Action action) - { - openSessions().Each(action); - } - - public Task SaveChanges() - { - WithOpenSession(s => s.SaveChanges()); - - return Task.CompletedTask; - } - - public void Start() - { - reset(); - } - - public void MakeReadOnly() - { - // TODO -- figure out how to make the entire document store / session be readonly - // Nothing yet, dadgummit - } - - private void reset() - { - WithOpenSession(s => s.Dispose()); - _session = new Lazy(() => - { - return _store.OpenSession(); - }); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/RavenDbFubuRegistryExtension.cs b/src/FubuMVC.RavenDb/RavenDbFubuRegistryExtension.cs deleted file mode 100644 index e59ca2be7c..0000000000 --- a/src/FubuMVC.RavenDb/RavenDbFubuRegistryExtension.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using FubuMVC.Core; -using FubuMVC.Core.Registration; -using FubuMVC.Core.Registration.Nodes; -using FubuMVC.RavenDb.RavenDb; - -namespace FubuMVC.RavenDb -{ - public class RavenDbFubuRegistryExtension : IFubuRegistryExtension - { - public void Configure(FubuRegistry registry) - { - registry.Services.IncludeRegistry(); - } - } - - public class TransactionalBehaviorPolicy : IConfigurationAction - { - public void Configure(BehaviorGraph graph) - { - graph.Chains.OfType() - .Where( - x => - x.Route.RespondsToMethod("POST") || x.Route.RespondsToMethod("PUT") || - x.Route.RespondsToMethod("DELETE")) - .Each(x => x.InsertFirst(Wrapper.For())); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Reset/CompleteReset.cs b/src/FubuMVC.RavenDb/Reset/CompleteReset.cs deleted file mode 100644 index eaac296f5d..0000000000 --- a/src/FubuMVC.RavenDb/Reset/CompleteReset.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using FubuCore; -using FubuCore.Logging; - -namespace FubuMVC.RavenDb.Reset -{ - public class CompleteReset : ICompleteReset - { - private readonly ILogger _logger; - private readonly IInitialState _initialState; - private readonly IPersistenceReset _persistence; - private readonly IEnumerable _serviceResets; - - public CompleteReset(ILogger logger, IInitialState initialState, IPersistenceReset persistence, IEnumerable serviceResets) - { - _logger = logger; - _initialState = initialState; - _persistence = persistence; - _serviceResets = serviceResets; - } - - private void trace(string text, params object[] args) - { - if (args.Any()) - { - _logger.DebugMessage(() => new ResetMessage{Message = text.ToFormat(args)}); - } - else - { - _logger.DebugMessage(() => new ResetMessage { Message = text }); - } - } - - public void ResetState() - { - _serviceResets.Each(x => { - trace("Stopping services with {0}", x.GetType().Name); - x.Stop(); - }); - - trace("Clearing persisted state"); - _persistence.ClearPersistedState(); - - // Think it's pretty likely that this changes - trace("Loading initial data"); - _initialState.Load(); - - _serviceResets.Each(x => { - - trace("Starting services with {0}", x.GetType().Name); - x.Start(); - }); - } - - public void CommitChanges() - { - trace("Committing changes"); - _persistence.CommitAllChanges(); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Reset/ICompleteReset.cs b/src/FubuMVC.RavenDb/Reset/ICompleteReset.cs deleted file mode 100644 index 900a65e7fb..0000000000 --- a/src/FubuMVC.RavenDb/Reset/ICompleteReset.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace FubuMVC.RavenDb.Reset -{ - public interface ICompleteReset - { - void ResetState(); - void CommitChanges(); - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Reset/IInitialState.cs b/src/FubuMVC.RavenDb/Reset/IInitialState.cs deleted file mode 100644 index d16166676b..0000000000 --- a/src/FubuMVC.RavenDb/Reset/IInitialState.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace FubuMVC.RavenDb.Reset -{ - public interface IInitialState - { - void Load(); - } - - public class NulloInitialState : IInitialState - { - public void Load() - { - // nothing - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Reset/IPersistenceReset.cs b/src/FubuMVC.RavenDb/Reset/IPersistenceReset.cs deleted file mode 100644 index 476acf5eaf..0000000000 --- a/src/FubuMVC.RavenDb/Reset/IPersistenceReset.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace FubuMVC.RavenDb.Reset -{ - public interface IPersistenceReset - { - void ClearPersistedState(); - void CommitAllChanges(); - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Reset/IServiceReset.cs b/src/FubuMVC.RavenDb/Reset/IServiceReset.cs deleted file mode 100644 index c97135b262..0000000000 --- a/src/FubuMVC.RavenDb/Reset/IServiceReset.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace FubuMVC.RavenDb.Reset -{ - public interface IServiceReset - { - void Stop(); - void Start(); - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Reset/ResetMessage.cs b/src/FubuMVC.RavenDb/Reset/ResetMessage.cs deleted file mode 100644 index f020b1eaca..0000000000 --- a/src/FubuMVC.RavenDb/Reset/ResetMessage.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FubuCore.Logging; - -namespace FubuMVC.RavenDb.Reset -{ - public class ResetMessage : LogTopic - { - public string Message { get; set; } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/ServiceBus/RavenDbSchedulePersistence.cs b/src/FubuMVC.RavenDb/ServiceBus/RavenDbSchedulePersistence.cs deleted file mode 100644 index 52737b8d01..0000000000 --- a/src/FubuMVC.RavenDb/ServiceBus/RavenDbSchedulePersistence.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using FubuMVC.Core.ServiceBus.ScheduledJobs; -using FubuMVC.Core.ServiceBus.ScheduledJobs.Persistence; -using Raven.Client; - -namespace FubuMVC.RavenDb.ServiceBus -{ - public class RavenDbSchedulePersistence : ISchedulePersistence - { - private readonly ITransaction _transaction; - private readonly IDocumentStore _store; - private readonly int _maxHistory; - - public RavenDbSchedulePersistence(ITransaction transaction, IDocumentStore store, ScheduledJobGraph jobs) - { - _transaction = transaction; - _store = store; - _maxHistory = jobs.MaxJobExecutionRecordsToKeepInHistory; - } - - public IEnumerable FindAll(string nodeName) - { - using (var session = _store.OpenSession()) - { - return session - .Query() - .Customize(x => x.WaitForNonStaleResultsAsOfLastWrite()) - .Where(x => x.NodeName == nodeName) - .ToArray(); - } - } - - public IEnumerable FindAllActive(string nodeName) - { - using (var session = _store.OpenSession()) - { - return session - .Query() - .Customize(x => x.WaitForNonStaleResultsAsOfLastWrite()) - .Where(x => x.NodeName == nodeName) - .Where(x => x.Status != JobExecutionStatus.Inactive) - .ToArray(); - } - } - - public void Persist(IEnumerable statuses) - { - _transaction.Execute(session => { statuses.Each(x => session.Store(x)); }); - } - - public void Persist(JobStatusDTO status) - { - _transaction.Execute(session => { session.Store(status); }); - } - - public JobStatusDTO Find(string nodeName, string jobKey) - { - var id = JobStatusDTO.ToId(nodeName, jobKey); - using (var session = _store.OpenSession()) - { - return session.Load(id); - } - } - - - public void RecordHistory(string nodeName, string jobKey, JobExecutionRecord record) - { - var id = ScheduledRunHistory.ToId(nodeName, jobKey); - - _transaction.Execute(session => { - var history = session.Load(id) - ?? new ScheduledRunHistory{JobKey = jobKey, NodeName = nodeName}; - - history.Append(record, _maxHistory); - session.Store(history); - }); - } - - public IEnumerable FindHistory(string nodeName, string jobKey) - { - var id = ScheduledRunHistory.ToId(nodeName, jobKey); - using (var session = _store.OpenSession()) - { - var history = session.Load(id); - return history == null ? new JobExecutionRecord[0] : history.Records.ToArray(); - } - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/ServiceBus/RavenDbSubscriptionPersistence.cs b/src/FubuMVC.RavenDb/ServiceBus/RavenDbSubscriptionPersistence.cs deleted file mode 100644 index 74cc2fc3ce..0000000000 --- a/src/FubuMVC.RavenDb/ServiceBus/RavenDbSubscriptionPersistence.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using FubuMVC.Core.ServiceBus.Subscriptions; -using Raven.Client; - -namespace FubuMVC.RavenDb.ServiceBus -{ - public class RavenDbSubscriptionPersistence : ISubscriptionPersistence - { - private readonly ITransaction _transaction; - private readonly IDocumentStore _store; - - public RavenDbSubscriptionPersistence(ITransaction transaction, IDocumentStore store) - { - _transaction = transaction; - _store = store; - } - - public IEnumerable LoadSubscriptions(string name, SubscriptionRole role) - { - using (var session = _store.OpenSession()) - { - return session.Query() - .Customize(x => x.WaitForNonStaleResultsAsOfLastWrite()) - .Where(x => x.NodeName == name && x.Role == role) - .ToList(); - } - } - - public void Persist(IEnumerable subscriptions) - { - _transaction.Execute(session => subscriptions.Each(s => session.Store(s))); - } - - public void Persist(Subscription subscription) - { - _transaction.Execute(x => x.Store(subscription)); - } - - public IEnumerable NodesForGroup(string name) - { - using (var session = _store.OpenSession()) - { - return session - .Query() - .Customize(x => x.WaitForNonStaleResultsAsOfLastWrite()) - .Where(x => x.NodeName == name) - .ToList(); - } - } - - public void Persist(params TransportNode[] nodes) - { - _transaction.Execute(x => { - nodes.Each(node => x.Store(node)); - }); - } - - public IEnumerable AllNodes() - { - using (var session = _store.OpenSession()) - { - - return session.Query() - .Customize(x => x.WaitForNonStaleResultsAsOfLastWrite()) - .ToArray(); - } - } - - public IEnumerable AllSubscriptions() - { - using (var session = _store.OpenSession()) - { - return session - .Query() - .Customize(x => x.WaitForNonStaleResultsAsOfLastWrite()).ToArray(); - } - } - - public TransportNode LoadNode(string nodeId) - { - using (var session = _store.OpenSession()) - { - return session.Load(nodeId); - } - } - - public void Alter(string id, Action alteration) - { - _transaction.Execute(session => { - var node = session.Load(id); - if (node != null) - { - alteration(node); - session.Store(node); - } - }); - } - - public void DeleteSubscriptions(IEnumerable subscriptions) - { - _transaction.Execute(session => { - var docs = session.Load(subscriptions.Select(x => x.Id).Cast()); - docs.Each(x => session.Delete(x)); - }); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Storage/EntityStorage.cs b/src/FubuMVC.RavenDb/Storage/EntityStorage.cs deleted file mode 100644 index 960f349fd1..0000000000 --- a/src/FubuMVC.RavenDb/Storage/EntityStorage.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Linq; -using System.Linq.Expressions; - -namespace FubuMVC.RavenDb.Storage -{ - public class EntityStorage : IEntityStorage where T : class, IEntity - { - private readonly IPersistor _persistor; - - public EntityStorage(IPersistor persistor) - { - _persistor = persistor; - } - - public T Find(Guid id) - { - return _persistor.Find(id); - } - - public void Update(T entity) - { - _persistor.Persist(entity); - } - - public void Remove(T entity) - { - _persistor.Remove(entity); - } - - public IQueryable All() - { - return _persistor.LoadAll(); - } - - public void DeleteAll() - { - _persistor.DeleteAll(); - } - - public T FindSingle(Expression> filter) - { - return _persistor.FindSingle(filter); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Storage/IEntityStorage.cs b/src/FubuMVC.RavenDb/Storage/IEntityStorage.cs deleted file mode 100644 index e1cb53d279..0000000000 --- a/src/FubuMVC.RavenDb/Storage/IEntityStorage.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Linq; -using System.Linq.Expressions; - -namespace FubuMVC.RavenDb.Storage -{ - public interface IEntityStorage where T : class, IEntity - { - T Find(Guid id); - void Update(T entity); - void Remove(T entity); - - IQueryable All(); - void DeleteAll(); - T FindSingle(Expression> filter); - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Storage/IEntityStoragePolicy.cs b/src/FubuMVC.RavenDb/Storage/IEntityStoragePolicy.cs deleted file mode 100644 index 857126398b..0000000000 --- a/src/FubuMVC.RavenDb/Storage/IEntityStoragePolicy.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace FubuMVC.RavenDb.Storage -{ - public interface IEntityStoragePolicy - { - bool Matches() where T : class, IEntity; - IEntityStorage Wrap(IEntityStorage inner) where T : class, IEntity; - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Storage/IStorageFactory.cs b/src/FubuMVC.RavenDb/Storage/IStorageFactory.cs deleted file mode 100644 index acc5fb14eb..0000000000 --- a/src/FubuMVC.RavenDb/Storage/IStorageFactory.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace FubuMVC.RavenDb.Storage -{ - public interface IStorageFactory - { - IEntityStorage StorageFor() where T : class, IEntity; - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Storage/SoftDeletedEntityStorage.cs b/src/FubuMVC.RavenDb/Storage/SoftDeletedEntityStorage.cs deleted file mode 100644 index 40064c42ec..0000000000 --- a/src/FubuMVC.RavenDb/Storage/SoftDeletedEntityStorage.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Linq; -using System.Linq.Expressions; -using FubuCore.Dates; - -namespace FubuMVC.RavenDb.Storage -{ - public class SoftDeletedEntityStorage : IEntityStorage where T : class, ISoftDeletedEntity - { - private readonly IEntityStorage _inner; - private readonly ISystemTime _systemTime; - - public SoftDeletedEntityStorage(IEntityStorage inner, ISystemTime systemTime) - { - _inner = inner; - _systemTime = systemTime; - } - - public IEntityStorage Inner - { - get { return _inner; } - } - - public T Find(Guid id) - { - return _inner.Find(id); - } - - public void Update(T entity) - { - _inner.Update(entity); - } - - public void Remove(T entity) - { - entity.Deleted = new Milestone(_systemTime.UtcNow()); - - Update(entity); - } - - public IQueryable All() - { - return _inner.All().Where(x => x.Deleted == null); - } - - public void DeleteAll() - { - _inner.DeleteAll(); - } - - public T FindSingle(Expression> filter) - { - return _inner.FindSingle(filter); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Storage/SoftDeletedStoragePolicy.cs b/src/FubuMVC.RavenDb/Storage/SoftDeletedStoragePolicy.cs deleted file mode 100644 index c5fe3173f2..0000000000 --- a/src/FubuMVC.RavenDb/Storage/SoftDeletedStoragePolicy.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using FubuCore; -using FubuCore.Dates; - -namespace FubuMVC.RavenDb.Storage -{ - public class SoftDeletedStoragePolicy : IEntityStoragePolicy - { - private readonly ISystemTime _systemTime; - - public SoftDeletedStoragePolicy(ISystemTime systemTime) - { - _systemTime = systemTime; - } - - public bool Matches() where T : class, IEntity - { - return typeof (T).CanBeCastTo(); - } - - public IEntityStorage Wrap(IEntityStorage inner) where T : class, IEntity - { - var storageType = typeof (SoftDeletedEntityStorage<>).MakeGenericType(typeof (T)); - return (IEntityStorage) Activator.CreateInstance(storageType, inner, _systemTime); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/Storage/StorageFactory.cs b/src/FubuMVC.RavenDb/Storage/StorageFactory.cs deleted file mode 100644 index 4b681d25f7..0000000000 --- a/src/FubuMVC.RavenDb/Storage/StorageFactory.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -namespace FubuMVC.RavenDb.Storage -{ - public class StorageFactory : IStorageFactory - { - private readonly IPersistor _persistor; - private readonly IEnumerable _policies; - - public StorageFactory(IPersistor persistor, IEnumerable policies) - { - _persistor = persistor; - _policies = policies; - } - - public IEntityStorage StorageFor() where T : class, IEntity - { - IEntityStorage storage = new EntityStorage(_persistor); - _policies.Where(x => x.Matches()).Each(policy => { - storage = policy.Wrap(storage); - }); - - return storage; - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/TransactionalBehavior.cs b/src/FubuMVC.RavenDb/TransactionalBehavior.cs deleted file mode 100644 index e37b224c8b..0000000000 --- a/src/FubuMVC.RavenDb/TransactionalBehavior.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Threading.Tasks; -using FubuCore.Logging; -using FubuMVC.Core.Behaviors; -using FubuMVC.Core.Http; -using FubuMVC.RavenDb.RavenDb; - -namespace FubuMVC.RavenDb -{ - public class TransactionalBehavior : WrappingBehavior - { - private readonly ISessionBoundary _session; - private readonly ILogger _logger; - private readonly IHttpRequest _httpRequest; - - public TransactionalBehavior(ISessionBoundary session, ILogger logger, IHttpRequest httpRequest) - { - _session = session; - _logger = logger; - _httpRequest = httpRequest; - } - - protected override async Task invoke(Func func) - { - await func().ConfigureAwait(false); - await _session.SaveChanges().ConfigureAwait(false); - _session.WithOpenSession(x => - _logger.DebugMessage(() => - TransactionalBehaviorRavenSessionUsageMessage.For(x, _httpRequest))); - } - - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/TransactionalBehaviorRavenSessionUsageMessage.cs b/src/FubuMVC.RavenDb/TransactionalBehaviorRavenSessionUsageMessage.cs deleted file mode 100644 index 3236e42ca9..0000000000 --- a/src/FubuMVC.RavenDb/TransactionalBehaviorRavenSessionUsageMessage.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Threading; -using FubuCore; -using FubuCore.Logging; -using FubuMVC.Core.Http; -using Raven.Client; - -namespace FubuMVC.RavenDb -{ - public class TransactionalBehaviorRavenSessionUsageMessage : LogRecord - { - public string Url { get; set; } - public string HttpMethod { get; set; } - public int Requests { get; set; } - public string UserName { get; set; } - - public static TransactionalBehaviorRavenSessionUsageMessage For(IDocumentSession session, IHttpRequest request) - { - var userName = Thread.CurrentPrincipal.IfNotNull(x => x.Identity.Name); - var requests = session.Advanced.NumberOfRequests; - var url = request.FullUrl(); - var method = request.HttpMethod(); - return new TransactionalBehaviorRavenSessionUsageMessage - { - UserName = userName, - Requests = requests, - Url = url, - HttpMethod = method - }; - } - - public override string ToString() - { - return string.Format("Raven Session Usage for Url: {0}, Method: {1}, Requests: {2}, UserName: {3}", - Url, HttpMethod, Requests, UserName); - } - } -} \ No newline at end of file diff --git a/src/FubuMVC.RavenDb/paket.references b/src/FubuMVC.RavenDb/paket.references deleted file mode 100644 index 587cea9e22..0000000000 --- a/src/FubuMVC.RavenDb/paket.references +++ /dev/null @@ -1,14 +0,0 @@ -FubuCore -HtmlTags -Microsoft.CompilerServices.AsyncTargetingPack -Microsoft.Data.Edm -Microsoft.Data.OData -Microsoft.Data.Services.Client -Microsoft.WindowsAzure.ConfigurationManager -Owin -RavenDB.Client -RavenDB.Database -RavenDB.Embedded -structuremap -System.Spatial -WindowsAzure.Storage \ No newline at end of file diff --git a/src/FubuMVC.sln b/src/FubuMVC.sln index 7d434dffdc..7d85f2f62a 100755 --- a/src/FubuMVC.sln +++ b/src/FubuMVC.sln @@ -1,22 +1,21 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "__Build_Utilities", "__Build_Utilities", "{7AC4D197-535A-4686-8E21-18257B2ADB3A}" ProjectSection(SolutionItems) = preProject - ..\rakefile.rb = ..\rakefile.rb ..\packaging\nuget\fubumvc.aspnet.nuspec = ..\packaging\nuget\fubumvc.aspnet.nuspec ..\packaging\nuget\fubumvc.core.nuspec = ..\packaging\nuget\fubumvc.core.nuspec ..\packaging\nuget\fubumvc.lightningqueues.nuspec = ..\packaging\nuget\fubumvc.lightningqueues.nuspec ..\packaging\nuget\fubumvc.marten.nuspec = ..\packaging\nuget\fubumvc.marten.nuspec - ..\packaging\nuget\fubumvc.ravendb.nuspec = ..\packaging\nuget\fubumvc.ravendb.nuspec ..\packaging\nuget\fubumvc.razor.nuspec = ..\packaging\nuget\fubumvc.razor.nuspec ..\packaging\nuget\fubumvc.spark.nuspec = ..\packaging\nuget\fubumvc.spark.nuspec ..\packaging\nuget\jasperservice.nuspec = ..\packaging\nuget\jasperservice.nuspec + ..\paket.dependencies = ..\paket.dependencies + ..\rakefile.rb = ..\rakefile.rb ..\packaging\nuget\serenity.nuspec = ..\packaging\nuget\serenity.nuspec ..\packaging\nuget\web.config.transform = ..\packaging\nuget\web.config.transform - ..\paket.dependencies = ..\paket.dependencies EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ViewEngines", "ViewEngines", "{5600609A-D061-40E7-9CB2-92D3350EA31B}" @@ -45,8 +44,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestProjects", "TestProject EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteService", "RemoteService\RemoteService.csproj", "{F8186EC7-237A-4C24-AA48-1CFCDD099A8D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FubuMVC.RavenDb", "FubuMVC.RavenDb\FubuMVC.RavenDb.csproj", "{02441E35-668B-4713-9279-BD51948B95EB}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LQ", "LQ", "{79F0A938-58F7-47CB-B800-0BB3990E1A3A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FubuMVC.LightningQueues", "FubuMVC.LightningQueues\FubuMVC.LightningQueues.csproj", "{F151167C-4736-4C67-9697-7876574C05D0}" @@ -61,12 +58,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScheduledJobHarness", "Sche EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleService", "SampleService\SampleService.csproj", "{EDDD686C-2DB1-411C-833F-ABAFCAE5498D}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RavenDb", "RavenDb", "{9E95E0D5-0FED-41B6-A24E-C7D499933A19}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FubuMVC.LightningQueues.Testing", "FubuMVC.LightningQueues.Testing\FubuMVC.LightningQueues.Testing.csproj", "{289E231C-190E-4595-BD10-4007CA10CEE2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FubuMVC.RavenDb.Tests", "FubuMVC.RavenDb.Tests\FubuMVC.RavenDb.Tests.csproj", "{E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JasperService", "JasperService\JasperService.csproj", "{8C498075-DAFE-4DAB-91AB-4919BBF7365B}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serenity", "Serenity\Serenity.csproj", "{900A0419-3579-4DAE-85BE-71A3E4B34239}" @@ -257,21 +250,6 @@ Global {F8186EC7-237A-4C24-AA48-1CFCDD099A8D}.Retail|Mixed Platforms.ActiveCfg = Release|Any CPU {F8186EC7-237A-4C24-AA48-1CFCDD099A8D}.Retail|Mixed Platforms.Build.0 = Release|Any CPU {F8186EC7-237A-4C24-AA48-1CFCDD099A8D}.Retail|x86.ActiveCfg = Release|Any CPU - {02441E35-668B-4713-9279-BD51948B95EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {02441E35-668B-4713-9279-BD51948B95EB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {02441E35-668B-4713-9279-BD51948B95EB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {02441E35-668B-4713-9279-BD51948B95EB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {02441E35-668B-4713-9279-BD51948B95EB}.Debug|x86.ActiveCfg = Debug|Any CPU - {02441E35-668B-4713-9279-BD51948B95EB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {02441E35-668B-4713-9279-BD51948B95EB}.Release|Any CPU.Build.0 = Release|Any CPU - {02441E35-668B-4713-9279-BD51948B95EB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {02441E35-668B-4713-9279-BD51948B95EB}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {02441E35-668B-4713-9279-BD51948B95EB}.Release|x86.ActiveCfg = Release|Any CPU - {02441E35-668B-4713-9279-BD51948B95EB}.Retail|Any CPU.ActiveCfg = Release|Any CPU - {02441E35-668B-4713-9279-BD51948B95EB}.Retail|Any CPU.Build.0 = Release|Any CPU - {02441E35-668B-4713-9279-BD51948B95EB}.Retail|Mixed Platforms.ActiveCfg = Release|Any CPU - {02441E35-668B-4713-9279-BD51948B95EB}.Retail|Mixed Platforms.Build.0 = Release|Any CPU - {02441E35-668B-4713-9279-BD51948B95EB}.Retail|x86.ActiveCfg = Release|Any CPU {F151167C-4736-4C67-9697-7876574C05D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F151167C-4736-4C67-9697-7876574C05D0}.Debug|Any CPU.Build.0 = Debug|Any CPU {F151167C-4736-4C67-9697-7876574C05D0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -377,21 +355,6 @@ Global {289E231C-190E-4595-BD10-4007CA10CEE2}.Retail|Mixed Platforms.ActiveCfg = Release|Any CPU {289E231C-190E-4595-BD10-4007CA10CEE2}.Retail|Mixed Platforms.Build.0 = Release|Any CPU {289E231C-190E-4595-BD10-4007CA10CEE2}.Retail|x86.ActiveCfg = Release|Any CPU - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}.Debug|x86.ActiveCfg = Debug|Any CPU - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}.Release|Any CPU.Build.0 = Release|Any CPU - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}.Release|x86.ActiveCfg = Release|Any CPU - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}.Retail|Any CPU.ActiveCfg = Release|Any CPU - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}.Retail|Any CPU.Build.0 = Release|Any CPU - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}.Retail|Mixed Platforms.ActiveCfg = Release|Any CPU - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}.Retail|Mixed Platforms.Build.0 = Release|Any CPU - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB}.Retail|x86.ActiveCfg = Release|Any CPU {8C498075-DAFE-4DAB-91AB-4919BBF7365B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8C498075-DAFE-4DAB-91AB-4919BBF7365B}.Debug|Any CPU.Build.0 = Debug|Any CPU {8C498075-DAFE-4DAB-91AB-4919BBF7365B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -485,7 +448,6 @@ Global {9D6BF559-6461-4EAC-BB16-F976FF43E8DA} = {5600609A-D061-40E7-9CB2-92D3350EA31B} {F6CAF85F-ED02-44F2-AE6B-08170DF1E13E} = {DE130877-DDCB-425C-9C20-BF1B73D4191D} {F8186EC7-237A-4C24-AA48-1CFCDD099A8D} = {DE130877-DDCB-425C-9C20-BF1B73D4191D} - {02441E35-668B-4713-9279-BD51948B95EB} = {9E95E0D5-0FED-41B6-A24E-C7D499933A19} {F151167C-4736-4C67-9697-7876574C05D0} = {79F0A938-58F7-47CB-B800-0BB3990E1A3A} {5A9E17DD-A8E3-4ABD-AC6C-9A6A97F6CDA9} = {DE130877-DDCB-425C-9C20-BF1B73D4191D} {C71136AE-8197-4A9A-AA5F-9102F657C502} = {DE130877-DDCB-425C-9C20-BF1B73D4191D} @@ -493,7 +455,6 @@ Global {B1066655-D67C-44EE-AEA4-32C7CE17A745} = {DE130877-DDCB-425C-9C20-BF1B73D4191D} {EDDD686C-2DB1-411C-833F-ABAFCAE5498D} = {DE130877-DDCB-425C-9C20-BF1B73D4191D} {289E231C-190E-4595-BD10-4007CA10CEE2} = {79F0A938-58F7-47CB-B800-0BB3990E1A3A} - {E80DC8C6-3BC3-4F00-9939-12BA2B34A4EB} = {9E95E0D5-0FED-41B6-A24E-C7D499933A19} {1431A58D-34DC-4EFB-9E3D-DC545D51BE6A} = {0437EB5A-0401-4C38-A4B9-2DA6AA23A953} {32C9310D-75D0-4616-9017-42BDC6C3EFDA} = {0437EB5A-0401-4C38-A4B9-2DA6AA23A953} EndGlobalSection diff --git a/src/ScheduledJobHarness/MonitoredNode.cs b/src/ScheduledJobHarness/MonitoredNode.cs index 8190c5e018..2bb24ff887 100644 --- a/src/ScheduledJobHarness/MonitoredNode.cs +++ b/src/ScheduledJobHarness/MonitoredNode.cs @@ -7,7 +7,6 @@ using FubuMVC.Core.ServiceBus.ScheduledJobs; using FubuMVC.Core.ServiceBus.ScheduledJobs.Persistence; using FubuMVC.Core.ServiceBus.Subscriptions; -using FubuMVC.RavenDb.ServiceBus; using Raven.Client; namespace ScheduledJobHarness @@ -53,8 +52,6 @@ public MonitoredNode(string nodeId, Uri incoming, IDocumentStore store) ServiceBus.EnableInMemoryTransport(incoming); - Services.ReplaceService(); - Services.ReplaceService(); Services.ReplaceService(store); Services.AddService(); diff --git a/src/ScheduledJobHarness/MonitoredNodeGroup.cs b/src/ScheduledJobHarness/MonitoredNodeGroup.cs index 0eda09f9d8..2ac8b74bdb 100644 --- a/src/ScheduledJobHarness/MonitoredNodeGroup.cs +++ b/src/ScheduledJobHarness/MonitoredNodeGroup.cs @@ -5,14 +5,6 @@ using FubuCore.Util; using FubuMVC.Core; using FubuMVC.Core.Runtime; -using FubuMVC.Core.ServiceBus.Configuration; -using FubuMVC.Core.ServiceBus.ScheduledJobs; -using FubuMVC.Core.ServiceBus.ScheduledJobs.Persistence; -using FubuMVC.Core.ServiceBus.Subscriptions; -using FubuMVC.RavenDb.RavenDb; -using FubuMVC.RavenDb.ServiceBus; -using Raven.Client; -using StructureMap; namespace ScheduledJobHarness { @@ -66,6 +58,12 @@ public MonitoredNodeGroup() * */ } + public void Dispose() + { + _nodes.Each(x => x.SafeDispose()); + //_runtime.Dispose(); + } + public IEnumerable Nodes() { return _nodes; @@ -94,12 +92,6 @@ public void Startup() //container.Configure(_ => _.For().Use(jobs)); } - public void Dispose() - { - _nodes.Each(x => x.SafeDispose()); - //_runtime.Dispose(); - } - public void ShutdownNode(string node) { _nodes[node].Shutdown(); diff --git a/src/ScheduledJobHarness/ScheduledJobHarness.csproj b/src/ScheduledJobHarness/ScheduledJobHarness.csproj index d31d69c684..06b5d2b679 100644 --- a/src/ScheduledJobHarness/ScheduledJobHarness.csproj +++ b/src/ScheduledJobHarness/ScheduledJobHarness.csproj @@ -70,10 +70,6 @@ {e18fd922-0e7a-49cd-b89f-473826077b9d} FubuMVC.Core - - {02441e35-668b-4713-9279-bd51948b95eb} - FubuMVC.RavenDb -