Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added: test verifying correct passing of event data into $created han…

…dler
  • Loading branch information...
commit 3253d2ef63f745fd431da487ff63f1b7e169bfd7 1 parent 4c8fd15
@ysw ysw authored
Showing with 197 additions and 82 deletions.
  1. +26 −25 src/EventStore/EventStore.Projections.Core.Tests/EventStore.Projections.Core.Tests.csproj
  2. +1 −2  src/EventStore/EventStore.Projections.Core.Tests/Services/core_projection/FakeProjectionHandler.cs
  3. +2 −1  ...e.Tests/Services/{core_projection → }/emitted_stream/a_checkpoint_requested_on_a_non_started_stream.cs
  4. +2 −1  ...r; }/emitted_stream/another_epoch/when_handling_an_emit_with_expected_tag_the_started_in_recovery_stream.cs
  5. +3 −1 ...; }/emitted_stream/another_epoch/when_handling_emits_with_previously_written_events_at_the_same_position.cs
  6. +2 −1  ...r; }/emitted_stream/another_epoch/when_handling_emits_with_previously_written_events_in_different_epochs.cs
  7. +2 −1  ...emitted_stream/another_projection/when_handling_an_emit_with_expected_tag_the_started_in_recovery_stream.cs
  8. +2 −1  ...Store.Projections.Core.Tests/Services/{core_projection → }/emitted_stream/when_checkpoint_requested.cs
  9. +2 −1  ...ions.Core.Tests/Services/{core_projection → }/emitted_stream/when_checkpoint_requested_but_disabled.cs
  10. +3 −2 ...ces/{core_projection → }/emitted_stream/when_checkpoint_requested_with_all_writes_already_completed.cs
  11. +2 −2 ...re.Tests/Services/{core_projection → }/emitted_stream/when_checkpoint_requested_with_pending_writes.cs
  12. +2 −1  ...Projections.Core.Tests/Services/{core_projection → }/emitted_stream/when_creating_an_emitted_stream.cs
  13. +2 −1  ...ore.Tests/Services/{core_projection → }/emitted_stream/when_handling_an_emit_the_not_started_stream.cs
  14. +2 −1  ...s/Services/{core_projection → }/emitted_stream/when_handling_an_emit_the_started_in_recovery_stream.cs
  15. +2 −1  ....Tests/Services/{core_projection → }/emitted_stream/when_handling_an_emit_to_the_nonexisting_stream.cs
  16. +3 −1 ...ervices/{core_projection → }/emitted_stream/when_handling_an_emit_with_caused_by_and_correlation_id.cs
  17. +2 −1  ...re.Tests/Services/{core_projection → }/emitted_stream/when_handling_an_emit_with_committed_callback.cs
  18. +2 −1  ...rojection → }/emitted_stream/when_handling_an_emit_with_expected_tag_the_started_in_recovery_stream.cs
  19. +3 −1 ...s.Core.Tests/Services/{core_projection → }/emitted_stream/when_handling_an_emit_with_extra_metadata.cs
  20. +2 −2 ....Core.Tests/Services/{core_projection → }/emitted_stream/when_handling_an_emit_with_not_ready_event.cs
  21. +2 −1  ....Core.Tests/Services/{core_projection → }/emitted_stream/when_handling_an_emit_with_stream_metadata.cs
  22. +2 −2 ...e.Tests/Services/{core_projection → }/emitted_stream/when_handling_an_emit_with_write_as_configured.cs
  23. +2 −1  ...ctions.Core.Tests/Services/{core_projection → }/emitted_stream/when_handling_emits_in_invalid_order.cs
  24. +2 −1  ...sts/Services/{core_projection → }/emitted_stream/when_handling_emits_with_previously_written_events.cs
  25. +2 −1  ...ojection → }/emitted_stream/when_handling_emits_with_previously_written_events_at_the_same_position.cs
  26. +2 −1  ...tore.Projections.Core.Tests/Services/{core_projection → }/emitted_stream/when_the_stream_is_started.cs
  27. +2 −1  ...Services/{core_projection → }/emitted_stream/when_the_stream_is_started_with_already_emitted_events.cs
  28. +1 −2  src/EventStore/EventStore.Projections.Core.Tests/Services/projections_manager/FakeBiStateProjection.cs
  29. +1 −2  src/EventStore/EventStore.Projections.Core.Tests/Services/projections_manager/FakeForeachStreamProjection.cs
  30. +1 −2  ...ventStore/EventStore.Projections.Core.Tests/Services/projections_manager/FakeFromCatalogStreamProjection.cs
  31. +1 −2  src/EventStore/EventStore.Projections.Core.Tests/Services/projections_manager/FakeProjection.cs
  32. +95 −0 src/EventStore/EventStore.Projections.Core.Tests/Services/v8/when_running_a_projection_with_created_handler.cs
  33. +2 −1  src/EventStore/EventStore.Projections.Core/Services/IProjectionStateHandler.cs
  34. +1 −1  src/EventStore/EventStore.Projections.Core/Services/Processing/EventProcessingProjectionProcessingPhase.cs
  35. +8 −4 src/EventStore/EventStore.Projections.Core/Services/v8/V8ProjectionStateHandler.cs
  36. +1 −2  src/EventStore/EventStore.Projections.Core/Standard/CategorizeEventsByStreamPath.cs
  37. +1 −2  src/EventStore/EventStore.Projections.Core/Standard/CategorizeStreamByPath.cs
  38. +1 −2  src/EventStore/EventStore.Projections.Core/Standard/IndexEventsByEventType.cs
  39. +1 −2  src/EventStore/EventStore.Projections.Core/Standard/IndexStreams.cs
  40. +1 −2  src/EventStore/EventStore.Projections.Core/Standard/StubHandler.cs
  41. +1 −2  src/EventStore/EventStore.Web/Users/IndexUsersProjectionHandler.cs
View
51 src/EventStore/EventStore.Projections.Core.Tests/EventStore.Projections.Core.Tests.csproj
@@ -166,21 +166,21 @@
<Compile Include="Services\core_projection\checkpoint_manager\multi_stream\TestFixtureWithMultiStreamCheckpointManager.cs" />
<Compile Include="Services\core_projection\checkpoint_manager\multi_stream\when_starting_with_prerecorded_events_after_the_last_checkpoint.cs" />
<Compile Include="Services\core_projection\checkpoint_manager\multi_stream\when_starting_with_prerecorded_events_in_past_epoch.cs" />
- <Compile Include="Services\core_projection\emitted_stream\another_epoch\when_handling_an_emit_with_expected_tag_the_started_in_recovery_stream.cs" />
- <Compile Include="Services\core_projection\emitted_stream\another_epoch\when_handling_emits_with_previously_written_events_at_the_same_position.cs" />
- <Compile Include="Services\core_projection\emitted_stream\another_epoch\when_handling_emits_with_previously_written_events_in_different_epochs.cs" />
- <Compile Include="Services\core_projection\emitted_stream\another_projection\when_handling_an_emit_with_expected_tag_the_started_in_recovery_stream.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_handling_an_emit_to_the_nonexisting_stream.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_handling_an_emit_with_caused_by_and_correlation_id.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_handling_an_emit_with_stream_metadata.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_handling_an_emit_with_write_as_configured.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_checkpoint_requested_but_disabled.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_handling_an_emit_with_committed_callback.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_handling_an_emit_with_extra_metadata.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_handling_an_emit_with_not_ready_event.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_handling_emits_in_invalid_order.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_handling_emits_with_previously_written_events.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_handling_emits_with_previously_written_events_at_the_same_position.cs" />
+ <Compile Include="Services\emitted_stream\another_epoch\when_handling_an_emit_with_expected_tag_the_started_in_recovery_stream.cs" />
+ <Compile Include="Services\emitted_stream\another_epoch\when_handling_emits_with_previously_written_events_at_the_same_position.cs" />
+ <Compile Include="Services\emitted_stream\another_epoch\when_handling_emits_with_previously_written_events_in_different_epochs.cs" />
+ <Compile Include="Services\emitted_stream\another_projection\when_handling_an_emit_with_expected_tag_the_started_in_recovery_stream.cs" />
+ <Compile Include="Services\emitted_stream\when_handling_an_emit_to_the_nonexisting_stream.cs" />
+ <Compile Include="Services\emitted_stream\when_handling_an_emit_with_caused_by_and_correlation_id.cs" />
+ <Compile Include="Services\emitted_stream\when_handling_an_emit_with_stream_metadata.cs" />
+ <Compile Include="Services\emitted_stream\when_handling_an_emit_with_write_as_configured.cs" />
+ <Compile Include="Services\emitted_stream\when_checkpoint_requested_but_disabled.cs" />
+ <Compile Include="Services\emitted_stream\when_handling_an_emit_with_committed_callback.cs" />
+ <Compile Include="Services\emitted_stream\when_handling_an_emit_with_extra_metadata.cs" />
+ <Compile Include="Services\emitted_stream\when_handling_an_emit_with_not_ready_event.cs" />
+ <Compile Include="Services\emitted_stream\when_handling_emits_in_invalid_order.cs" />
+ <Compile Include="Services\emitted_stream\when_handling_emits_with_previously_written_events.cs" />
+ <Compile Include="Services\emitted_stream\when_handling_emits_with_previously_written_events_at_the_same_position.cs" />
<Compile Include="Services\core_projection\multi_phase\specification_with_multi_phase_core_projection.cs" />
<Compile Include="Services\core_projection\multi_phase\when_completing_phase1_of_a_multiphase_projection.cs" />
<Compile Include="Services\core_projection\multi_phase\when_creating_a_multi_phase_projection.cs" />
@@ -272,7 +272,7 @@
<Compile Include="Services\event_reordering_projection_subscription\when_handling_two_subsequent_events.cs" />
<Compile Include="Services\event_reordering_projection_subscription\when_receiving_multiple_events_not_passing_event_filter.cs" />
<Compile Include="Services\core_projection\checkpoint_manager\when_a_default_checkpoint_manager_has_been_reinitialized.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_handling_an_emit_with_expected_tag_the_started_in_recovery_stream.cs" />
+ <Compile Include="Services\emitted_stream\when_handling_an_emit_with_expected_tag_the_started_in_recovery_stream.cs" />
<Compile Include="Services\core_projection\TestCheckpointManagerMessageHandler.cs" />
<Compile Include="Services\core_projection\TestFixtureWithCoreProjection.cs" />
<Compile Include="Services\core_projection\TestFixtureWithCoreProjectionLoaded.cs" />
@@ -345,6 +345,7 @@
<Compile Include="Services\v8\when_initializing_state.cs" />
<Compile Include="Services\v8\when_not_returning_state_from_a_js_handler.cs" />
<Compile Include="Services\v8\when_partitioning_by_custom_rule.cs" />
+ <Compile Include="Services\v8\when_running_a_projection_with_created_handler.cs" />
<Compile Include="Services\v8\when_running_a_v8_projection_emitting_metadata.cs" />
<Compile Include="Services\v8\when_running_a_v8_projection_emitting_stream_links.cs" />
<Compile Include="Services\v8\when_running_a_v8_projection_with_not_passing_filter_by.cs" />
@@ -428,15 +429,15 @@
<Compile Include="Services\projections_manager\when_updating_a_persistent_projection_query_text.cs" />
<Compile Include="Services\v8\when_v8_projection_loading_state.cs" />
<Compile Include="Services\not_started_event_distribution_point_should.cs" />
- <Compile Include="Services\core_projection\emitted_stream\a_checkpoint_requested_on_a_non_started_stream.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_checkpoint_requested.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_checkpoint_requested_with_all_writes_already_completed.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_checkpoint_requested_with_pending_writes.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_creating_an_emitted_stream.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_handling_an_emit_the_started_in_recovery_stream.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_handling_an_emit_the_not_started_stream.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_the_stream_is_started.cs" />
- <Compile Include="Services\core_projection\emitted_stream\when_the_stream_is_started_with_already_emitted_events.cs" />
+ <Compile Include="Services\emitted_stream\a_checkpoint_requested_on_a_non_started_stream.cs" />
+ <Compile Include="Services\emitted_stream\when_checkpoint_requested.cs" />
+ <Compile Include="Services\emitted_stream\when_checkpoint_requested_with_all_writes_already_completed.cs" />
+ <Compile Include="Services\emitted_stream\when_checkpoint_requested_with_pending_writes.cs" />
+ <Compile Include="Services\emitted_stream\when_creating_an_emitted_stream.cs" />
+ <Compile Include="Services\emitted_stream\when_handling_an_emit_the_started_in_recovery_stream.cs" />
+ <Compile Include="Services\emitted_stream\when_handling_an_emit_the_not_started_stream.cs" />
+ <Compile Include="Services\emitted_stream\when_the_stream_is_started.cs" />
+ <Compile Include="Services\emitted_stream\when_the_stream_is_started_with_already_emitted_events.cs" />
<Compile Include="Services\core_projection\FakeProjectionHandler.cs" />
<Compile Include="Services\core_projection\projection_checkpoint\the_non_started_checkpoint.cs" />
<Compile Include="Services\core_projection\projection_checkpoint\the_started_checkpoint_with_some_events_emitted.cs" />
View
3  src/EventStore/EventStore.Projections.Core.Tests/Services/core_projection/FakeProjectionHandler.cs
@@ -235,8 +235,7 @@ public string TransformCatalogEvent(CheckpointTag eventPosition, ResolvedEvent d
}
}
- public bool ProcessPartitionCreated(
- string partition, CheckpointTag createPosition, out EmittedEventEnvelope[] emittedEvents)
+ public bool ProcessPartitionCreated(string partition, CheckpointTag createPosition, ResolvedEvent data, out EmittedEventEnvelope[] emittedEvents)
{
_partitionCreatedProcessed++;
emittedEvents = null;
View
3  ...a_checkpoint_requested_on_a_non_started_stream.cs → ...a_checkpoint_requested_on_a_non_started_stream.cs
@@ -28,9 +28,10 @@
using System;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class a_checkpoint_requested_on_a_non_started_stream : TestFixtureWithReadWriteDispatchers
View
3  ...th_expected_tag_the_started_in_recovery_stream.cs → ...th_expected_tag_the_started_in_recovery_stream.cs
@@ -31,9 +31,10 @@
using EventStore.Core.Messages;
using EventStore.Core.Services;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream.another_epoch
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream.another_epoch
{
[TestFixture]
public class when_handling_an_emit_with_expected_tag_the_started_in_recovery_stream : TestFixtureWithExistingEvents
View
4 ...previously_written_events_at_the_same_position.cs → ...previously_written_events_at_the_same_position.cs
@@ -33,10 +33,12 @@
using EventStore.Core.Services;
using EventStore.Core.Tests.Helpers;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
+using TestFixtureWithExistingEvents = EventStore.Projections.Core.Tests.Services.core_projection.TestFixtureWithExistingEvents;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream.another_epoch
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream.another_epoch
{
[TestFixture]
public class when_handling_emits_with_previously_written_events_at_the_same_position : TestFixtureWithExistingEvents
View
3  ..._previously_written_events_in_different_epochs.cs → ..._previously_written_events_in_different_epochs.cs
@@ -31,9 +31,10 @@
using EventStore.Core.Messages;
using EventStore.Core.Services;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream.another_epoch
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream.another_epoch
{
[TestFixture]
public class when_handling_emits_with_previously_written_events_in_different_epochs : TestFixtureWithExistingEvents
View
3  ...th_expected_tag_the_started_in_recovery_stream.cs → ...th_expected_tag_the_started_in_recovery_stream.cs
@@ -30,9 +30,10 @@
using System.Linq;
using EventStore.Core.Messages;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream.another_projection
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream.another_projection
{
[TestFixture]
public class when_handling_an_emit_with_expected_tag_the_started_in_recovery_stream : TestFixtureWithExistingEvents
View
3  ...ction/emitted_stream/when_checkpoint_requested.cs → ...vices/emitted_stream/when_checkpoint_requested.cs
@@ -28,9 +28,10 @@
using System;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_checkpoint_requested : TestFixtureWithReadWriteDispatchers
View
3  ..._stream/when_checkpoint_requested_but_disabled.cs → ..._stream/when_checkpoint_requested_but_disabled.cs
@@ -28,9 +28,10 @@
using System;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_checkpoint_requested_but_disabled : TestFixtureWithReadWriteDispatchers
View
5 ...nt_requested_with_all_writes_already_completed.cs → ...nt_requested_with_all_writes_already_completed.cs
@@ -30,11 +30,12 @@
using System.Linq;
using EventStore.Core.Messages;
using EventStore.Core.Tests.Helpers;
-using EventStore.Projections.Core.Messages;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
+using TestFixtureWithExistingEvents = EventStore.Projections.Core.Tests.Services.core_projection.TestFixtureWithExistingEvents;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_checkpoint_requested_with_all_writes_already_completed : TestFixtureWithExistingEvents
View
4 .../when_checkpoint_requested_with_pending_writes.cs → .../when_checkpoint_requested_with_pending_writes.cs
@@ -29,11 +29,11 @@
using System;
using System.Linq;
using EventStore.Core.Messages;
-using EventStore.Projections.Core.Messages;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_checkpoint_requested_with_pending_writes : TestFixtureWithExistingEvents
View
3  ...emitted_stream/when_creating_an_emitted_stream.cs → ...emitted_stream/when_creating_an_emitted_stream.cs
@@ -31,9 +31,10 @@
using EventStore.Core.Messaging;
using EventStore.Core.Tests.Fakes;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_creating_an_emitted_stream
View
3  ...m/when_handling_an_emit_the_not_started_stream.cs → ...m/when_handling_an_emit_the_not_started_stream.cs
@@ -30,9 +30,10 @@
using System.Linq;
using EventStore.Core.Messages;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_handling_an_emit_the_not_started_stream : TestFixtureWithExistingEvents
View
3  ...andling_an_emit_the_started_in_recovery_stream.cs → ...andling_an_emit_the_started_in_recovery_stream.cs
@@ -30,9 +30,10 @@
using System.Linq;
using EventStore.Core.Messages;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_handling_an_emit_the_started_in_recovery_stream : TestFixtureWithExistingEvents
View
3  ...hen_handling_an_emit_to_the_nonexisting_stream.cs → ...hen_handling_an_emit_to_the_nonexisting_stream.cs
@@ -31,9 +31,10 @@
using EventStore.Core.Messages;
using EventStore.Core.Services;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_handling_an_emit_to_the_nonexisting_stream : TestFixtureWithExistingEvents
View
4 ...ling_an_emit_with_caused_by_and_correlation_id.cs → ...ling_an_emit_with_caused_by_and_correlation_id.cs
@@ -33,10 +33,12 @@
using EventStore.Core.Services;
using EventStore.Core.Tests.Helpers;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
+using TestFixtureWithExistingEvents = EventStore.Projections.Core.Tests.Services.core_projection.TestFixtureWithExistingEvents;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_handling_an_emit_with_caused_by_and_correlation_id : TestFixtureWithExistingEvents
View
3  .../when_handling_an_emit_with_committed_callback.cs → .../when_handling_an_emit_with_committed_callback.cs
@@ -28,9 +28,10 @@
using System;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_handling_an_emit_with_committed_callback : TestFixtureWithExistingEvents
View
3  ...th_expected_tag_the_started_in_recovery_stream.cs → ...th_expected_tag_the_started_in_recovery_stream.cs
@@ -30,9 +30,10 @@
using System.Linq;
using EventStore.Core.Messages;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_handling_an_emit_with_expected_tag_the_started_in_recovery_stream : TestFixtureWithExistingEvents
View
4 ...ream/when_handling_an_emit_with_extra_metadata.cs → ...ream/when_handling_an_emit_with_extra_metadata.cs
@@ -33,10 +33,12 @@
using EventStore.Core.Messages;
using EventStore.Core.Tests.Helpers;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
+using TestFixtureWithExistingEvents = EventStore.Projections.Core.Tests.Services.core_projection.TestFixtureWithExistingEvents;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_handling_an_emit_with_extra_metadata : TestFixtureWithExistingEvents
View
4 ...eam/when_handling_an_emit_with_not_ready_event.cs → ...eam/when_handling_an_emit_with_not_ready_event.cs
@@ -30,11 +30,11 @@
using System.Linq;
using EventStore.Core.Messages;
using EventStore.Core.Services;
-using EventStore.Projections.Core.Messages;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_handling_an_emit_with_not_ready_event : TestFixtureWithExistingEvents
View
3  ...eam/when_handling_an_emit_with_stream_metadata.cs → ...eam/when_handling_an_emit_with_stream_metadata.cs
@@ -30,9 +30,10 @@
using System.Linq;
using EventStore.Core.Messages;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_handling_an_emit_with_stream_metadata_to_empty_stream : TestFixtureWithExistingEvents
View
4 ...when_handling_an_emit_with_write_as_configured.cs → ...when_handling_an_emit_with_write_as_configured.cs
@@ -30,11 +30,11 @@
using System.Linq;
using EventStore.Core.Authentication;
using EventStore.Core.Messages;
-using EventStore.Core.Services.Transport.Http.Authentication;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_handling_an_emit_with_write_as_configured : TestFixtureWithExistingEvents
View
3  ...ed_stream/when_handling_emits_in_invalid_order.cs → ...ed_stream/when_handling_emits_in_invalid_order.cs
@@ -28,9 +28,10 @@
using System;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_handling_emits_in_invalid_order : TestFixtureWithExistingEvents
View
3  ..._handling_emits_with_previously_written_events.cs → ..._handling_emits_with_previously_written_events.cs
@@ -30,9 +30,10 @@
using System.Linq;
using EventStore.Core.Messages;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_handling_emits_with_previously_written_events : TestFixtureWithExistingEvents
View
3  ...previously_written_events_at_the_same_position.cs → ...previously_written_events_at_the_same_position.cs
@@ -30,9 +30,10 @@
using System.Linq;
using EventStore.Core.Messages;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_handling_emits_with_previously_written_events_at_the_same_position : TestFixtureWithExistingEvents
View
3  ...tion/emitted_stream/when_the_stream_is_started.cs → ...ices/emitted_stream/when_the_stream_is_started.cs
@@ -28,9 +28,10 @@
using System;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_the_stream_is_started : TestFixtureWithReadWriteDispatchers
View
3  ..._stream_is_started_with_already_emitted_events.cs → ..._stream_is_started_with_already_emitted_events.cs
@@ -30,9 +30,10 @@
using System.Linq;
using EventStore.Core.Messages;
using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.core_projection;
using NUnit.Framework;
-namespace EventStore.Projections.Core.Tests.Services.core_projection.emitted_stream
+namespace EventStore.Projections.Core.Tests.Services.emitted_stream
{
[TestFixture]
public class when_the_stream_is_started_with_already_emitted_events : TestFixtureWithExistingEvents
View
3  src/EventStore/EventStore.Projections.Core.Tests/Services/projections_manager/FakeBiStateProjection.cs
@@ -102,8 +102,7 @@ public string TransformCatalogEvent(CheckpointTag eventPosition, ResolvedEvent d
return true;
}
- public bool ProcessPartitionCreated(
- string partition, CheckpointTag createPosition, out EmittedEventEnvelope[] emittedEvents)
+ public bool ProcessPartitionCreated(string partition, CheckpointTag createPosition, ResolvedEvent data, out EmittedEventEnvelope[] emittedEvents)
{
_logger("ProcessPartitionCreated");
emittedEvents = null;
View
3  ...EventStore/EventStore.Projections.Core.Tests/Services/projections_manager/FakeForeachStreamProjection.cs
@@ -105,8 +105,7 @@ public string TransformCatalogEvent(CheckpointTag eventPosition, ResolvedEvent d
return true;
}
- public bool ProcessPartitionCreated(
- string partition, CheckpointTag createPosition, out EmittedEventEnvelope[] emittedEvents)
+ public bool ProcessPartitionCreated(string partition, CheckpointTag createPosition, ResolvedEvent data, out EmittedEventEnvelope[] emittedEvents)
{
_logger("Process ProcessPartitionCreated");
emittedEvents = null;
View
3  ...tStore/EventStore.Projections.Core.Tests/Services/projections_manager/FakeFromCatalogStreamProjection.cs
@@ -104,8 +104,7 @@ public string TransformCatalogEvent(CheckpointTag eventPosition, ResolvedEvent d
return true;
}
- public bool ProcessPartitionCreated(
- string partition, CheckpointTag createPosition, out EmittedEventEnvelope[] emittedEvents)
+ public bool ProcessPartitionCreated(string partition, CheckpointTag createPosition, ResolvedEvent data, out EmittedEventEnvelope[] emittedEvents)
{
throw new NotImplementedException();
}
View
3  src/EventStore/EventStore.Projections.Core.Tests/Services/projections_manager/FakeProjection.cs
@@ -100,8 +100,7 @@ public string TransformCatalogEvent(CheckpointTag eventPosition, ResolvedEvent d
return true;
}
- public bool ProcessPartitionCreated(
- string partition, CheckpointTag createPosition, out EmittedEventEnvelope[] emittedEvents)
+ public bool ProcessPartitionCreated(string partition, CheckpointTag createPosition, ResolvedEvent data, out EmittedEventEnvelope[] emittedEvents)
{
_logger("Process ProcessPartitionCreated");
emittedEvents = null;
View
95 ...entStore/EventStore.Projections.Core.Tests/Services/v8/when_running_a_projection_with_created_handler.cs
@@ -0,0 +1,95 @@
+// Copyright (c) 2012, Event Store LLP
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// Neither the name of the Event Store LLP nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+using System;
+using EventStore.Core.Data;
+using EventStore.Projections.Core.Services.Processing;
+using EventStore.Projections.Core.Tests.Services.projections_manager;
+using NUnit.Framework;
+using ResolvedEvent = EventStore.Projections.Core.Services.Processing.ResolvedEvent;
+
+namespace EventStore.Projections.Core.Tests.Services.v8
+{
+ [TestFixture]
+ public class when_running_a_projection_with_created_handler : TestFixtureWithJsProjection
+ {
+ protected override void Given()
+ {
+ _projection = @"
+ fromAll().foreachStream().when({
+ $created: function(s, e) {
+ log('handler-invoked');
+ log(e.streamId);
+ log(e.eventType);
+ log(e.body);
+ log(e.metadata);
+ emit('stream1', 'event1', {a:1});
+ }
+ });
+ ";
+ _state = @"{}";
+ }
+
+ [Test, Category("v8")]
+ public void invokes_created_handler()
+ {
+
+ var e = new ResolvedEvent(
+ "stream", 0, "stream", 0, false, new TFPos(1000, 900), Guid.NewGuid(), "event", true, "{}", "{\"m\":1}");
+
+ EmittedEventEnvelope[] emittedEvents;
+ _stateHandler.ProcessPartitionCreated(
+ "partition", CheckpointTag.FromPosition(0, 10, 5), e, out emittedEvents);
+
+ Assert.AreEqual(5, _logged.Count);
+ Assert.AreEqual(@"handler-invoked", _logged[0]);
+ Assert.AreEqual(@"stream", _logged[1]);
+ Assert.AreEqual(@"event", _logged[2]);
+ Assert.AreEqual(@"{}", _logged[3]);
+ Assert.AreEqual(@"{""m"":1}", _logged[4]);
+ }
+
+ [Test, Category("v8")]
+ public void returns_emitted_events()
+ {
+
+ var e = new ResolvedEvent(
+ "stream", 0, "stream", 0, false, new TFPos(1000, 900), Guid.NewGuid(), "event", true, "{}", "{\"m\":1}");
+
+ EmittedEventEnvelope[] emittedEvents;
+ _stateHandler.ProcessPartitionCreated(
+ "partition", CheckpointTag.FromPosition(0, 10, 5), e, out emittedEvents);
+
+ Assert.IsNotNull(emittedEvents);
+ Assert.AreEqual(1, emittedEvents.Length);
+ Assert.AreEqual("stream1", emittedEvents[0].Event.StreamId);
+ Assert.AreEqual("event1", emittedEvents[0].Event.EventType);
+ Assert.AreEqual("{\"a\":1}", emittedEvents[0].Event.Data);
+ }
+ }
+}
View
3  src/EventStore/EventStore.Projections.Core/Services/IProjectionStateHandler.cs
@@ -75,10 +75,11 @@ public interface IProjectionStateHandler : IDisposable, ISourceDefinitionSource
/// </summary>
/// <param name="partition"></param>
/// <param name="createPosition"></param>
+ /// <param name="data"></param>
/// <param name="emittedEvents"></param>
/// <returns>true - if notification was processed (new state must be returned)</returns>
bool ProcessPartitionCreated(
- string partition, CheckpointTag createPosition, out EmittedEventEnvelope[] emittedEvents);
+ string partition, CheckpointTag createPosition, ResolvedEvent data, out EmittedEventEnvelope[] emittedEvents);
/// <summary>
/// Processes partition deleted notification and updates internal state if necessary.
View
2  src/EventStore/EventStore.Projections.Core/Services/Processing/EventProcessingProjectionProcessingPhase.cs
@@ -317,7 +317,7 @@ private string GetHandlerTypeName()
if (newPatitionInitialized)
{
_projectionStateHandler.ProcessPartitionCreated(
- partition, message.CheckpointTag, out eventsEmittedOnInitialization);
+ partition, message.CheckpointTag, message.Data, out eventsEmittedOnInitialization);
}
var result = _projectionStateHandler.ProcessEvent(
View
12 src/EventStore/EventStore.Projections.Core/Services/v8/V8ProjectionStateHandler.cs
@@ -219,15 +219,19 @@ public string TransformCatalogEvent(CheckpointTag eventPosition, ResolvedEvent d
return true;
}
- public bool ProcessPartitionCreated(
- string partition, CheckpointTag createPosition, out EmittedEventEnvelope[] emittedEvents)
+ public bool ProcessPartitionCreated(string partition, CheckpointTag createPosition, ResolvedEvent data, out EmittedEventEnvelope[] emittedEvents)
{
CheckDisposed();
_eventPosition = createPosition;
_emittedEvents = null;
var newStates = _query.NotifyCreated(
- "", // trimming data passed to a JS
- new[] {partition, "" /* isSoftDedleted */});
+ data.Data.Trim(), // trimming data passed to a JS
+ new[]
+ {
+ data.IsJson ? "1" : "", data.EventStreamId, data.EventType, "",
+ data.EventSequenceNumber.ToString(CultureInfo.InvariantCulture), data.Metadata ?? "",
+ data.PositionMetadata ?? "", partition, ""
+ });
emittedEvents = _emittedEvents == null ? null : _emittedEvents.ToArray();
return true;
}
View
3  src/EventStore/EventStore.Projections.Core/Standard/CategorizeEventsByStreamPath.cs
@@ -115,8 +115,7 @@ public string TransformCatalogEvent(CheckpointTag eventPosition, ResolvedEvent d
return true;
}
- public bool ProcessPartitionCreated(
- string partition, CheckpointTag createPosition, out EmittedEventEnvelope[] emittedEvents)
+ public bool ProcessPartitionCreated(string partition, CheckpointTag createPosition, ResolvedEvent data, out EmittedEventEnvelope[] emittedEvents)
{
emittedEvents = null;
return false;
View
3  src/EventStore/EventStore.Projections.Core/Standard/CategorizeStreamByPath.cs
@@ -104,8 +104,7 @@ public string TransformCatalogEvent(CheckpointTag eventPosition, ResolvedEvent d
return true;
}
- public bool ProcessPartitionCreated(
- string partition, CheckpointTag createPosition, out EmittedEventEnvelope[] emittedEvents)
+ public bool ProcessPartitionCreated(string partition, CheckpointTag createPosition, ResolvedEvent data, out EmittedEventEnvelope[] emittedEvents)
{
emittedEvents = null;
return false;
View
3  src/EventStore/EventStore.Projections.Core/Standard/IndexEventsByEventType.cs
@@ -120,8 +120,7 @@ public string TransformCatalogEvent(CheckpointTag eventPosition, ResolvedEvent d
return true;
}
- public bool ProcessPartitionCreated(
- string partition, CheckpointTag createPosition, out EmittedEventEnvelope[] emittedEvents)
+ public bool ProcessPartitionCreated(string partition, CheckpointTag createPosition, ResolvedEvent data, out EmittedEventEnvelope[] emittedEvents)
{
emittedEvents = null;
return false;
View
3  src/EventStore/EventStore.Projections.Core/Standard/IndexStreams.cs
@@ -102,8 +102,7 @@ public string TransformCatalogEvent(CheckpointTag eventPosition, ResolvedEvent d
return true;
}
- public bool ProcessPartitionCreated(
- string partition, CheckpointTag createPosition, out EmittedEventEnvelope[] emittedEvents)
+ public bool ProcessPartitionCreated(string partition, CheckpointTag createPosition, ResolvedEvent data, out EmittedEventEnvelope[] emittedEvents)
{
emittedEvents = null;
return false;
View
3  src/EventStore/EventStore.Projections.Core/Standard/StubHandler.cs
@@ -88,8 +88,7 @@ public string TransformCatalogEvent(CheckpointTag eventPosition, ResolvedEvent d
return true;
}
- public bool ProcessPartitionCreated(
- string partition, CheckpointTag createPosition, out EmittedEventEnvelope[] emittedEvents)
+ public bool ProcessPartitionCreated(string partition, CheckpointTag createPosition, ResolvedEvent data, out EmittedEventEnvelope[] emittedEvents)
{
throw new NotImplementedException();
}
View
3  src/EventStore/EventStore.Web/Users/IndexUsersProjectionHandler.cs
@@ -113,8 +113,7 @@ public string TransformCatalogEvent(CheckpointTag eventPosition, ResolvedEvent d
return true;
}
- public bool ProcessPartitionCreated(
- string partition, CheckpointTag createPosition, out EmittedEventEnvelope[] emittedEvents)
+ public bool ProcessPartitionCreated(string partition, CheckpointTag createPosition, ResolvedEvent data, out EmittedEventEnvelope[] emittedEvents)
{
throw new NotImplementedException();
}
Please sign in to comment.
Something went wrong with that request. Please try again.