Skip to content

Commit

Permalink
chore: rename MeasurementPoint to MeteringPoint (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
MadsDue authored Jan 15, 2025
1 parent 04b5726 commit 5d58dc5
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ProcessManager.Orchestrations.Abstractions Release Notes

## Version 0.6.2

- Rename MeteredDataForMeasurementPointMessageInputV1 to MeteredDataForMeteredPointMessageInputV1

## Version 0.6.1

- No functional changes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public MeasurementsMeteredDataClientTests()
public async Task SendAsync_WhenCalledWithMeteredData_SendsExpectedDataOnEventHub()
{
// Arrange
var meteredData = new MeteredDataForMeasurementPoint(
var meteredData = new MeteredDataForMeteringPoint(
"test-orchestration-id",
"test-metering-point-id",
"test-transaction-id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public interface IMeasurementsMeteredDataClient
/// <summary>
/// Responsible for sending metered data for a measurement point to Measurements.
/// </summary>
/// <param name="meteredDataForMeasurementPoint"></param>
/// <param name="meteredDataForMeteringPoint"></param>
/// <param name="cancellationToken"></param>
public Task SendAsync(MeteredDataForMeasurementPoint meteredDataForMeasurementPoint, CancellationToken cancellationToken);
public Task SendAsync(MeteredDataForMeteringPoint meteredDataForMeteringPoint, CancellationToken cancellationToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,24 @@ public class MeasurementsMeteredDataClient(
private readonly EventHubProducerClient _eventHubProducerClient =
eventHubClientFactory.CreateClient(EventHubProducerClientNames.MeasurementsEventHub);

public async Task SendAsync(MeteredDataForMeasurementPoint meteredDataForMeasurementPoint, CancellationToken cancellationToken)
public async Task SendAsync(MeteredDataForMeteringPoint meteredDataForMeteringPoint, CancellationToken cancellationToken)
{
var data = new PersistSubmittedTransaction()
{
OrchestrationInstanceId = meteredDataForMeasurementPoint.OrchestrationId,
OrchestrationInstanceId = meteredDataForMeteringPoint.OrchestrationId,
OrchestrationType = OrchestrationType.OtSubmittedMeasureData,
MeteringPointId = meteredDataForMeasurementPoint.MeteringPointId,
TransactionId = meteredDataForMeasurementPoint.TransactionId,
TransactionCreationDatetime = MapDateTime(meteredDataForMeasurementPoint.CreatedAt),
StartDatetime = MapDateTime(meteredDataForMeasurementPoint.StartDateTime),
EndDatetime = MapDateTime(meteredDataForMeasurementPoint.EndDateTime),
MeteringPointType = MeteredDataToMeasurementMapper.MeteringPointType.Map(meteredDataForMeasurementPoint.MeteringPointType),
Product = meteredDataForMeasurementPoint.Product,
Unit = MeteredDataToMeasurementMapper.MeasurementUnit.Map(meteredDataForMeasurementPoint.Unit),
Resolution = MeteredDataToMeasurementMapper.Resolution.Map(meteredDataForMeasurementPoint.Resolution),
MeteringPointId = meteredDataForMeteringPoint.MeteringPointId,
TransactionId = meteredDataForMeteringPoint.TransactionId,
TransactionCreationDatetime = MapDateTime(meteredDataForMeteringPoint.CreatedAt),
StartDatetime = MapDateTime(meteredDataForMeteringPoint.StartDateTime),
EndDatetime = MapDateTime(meteredDataForMeteringPoint.EndDateTime),
MeteringPointType = MeteredDataToMeasurementMapper.MeteringPointType.Map(meteredDataForMeteringPoint.MeteringPointType),
Product = meteredDataForMeteringPoint.Product,
Unit = MeteredDataToMeasurementMapper.MeasurementUnit.Map(meteredDataForMeteringPoint.Unit),
Resolution = MeteredDataToMeasurementMapper.Resolution.Map(meteredDataForMeteringPoint.Resolution),
};

data.Points.AddRange(meteredDataForMeasurementPoint.Points.Select(p => new Point()
data.Points.AddRange(meteredDataForMeteringPoint.Points.Select(p => new Point()
{
Position = p.Position,
Quantity = DecimalValueMapper.Map(p.Quantity),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace Energinet.DataHub.ProcessManager.Components.Measurements.Model;

public record MeteredDataForMeasurementPoint(
public record MeteredDataForMeteringPoint(
string OrchestrationId,
string MeteringPointId,
string TransactionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<PropertyGroup>
<PackageId>Energinet.DataHub.ProcessManager.Orchestrations.Abstractions</PackageId>
<PackageVersion>0.6.1$(VersionSuffix)</PackageVersion>
<PackageVersion>0.6.2$(VersionSuffix)</PackageVersion>
<Title>DH3 Process Manager Orchestrations Abstractions library</Title>
<Company>Energinet-DataHub</Company>
<Authors>Energinet-DataHub</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Energinet.DataHub.ProcessManager.Orchestrations.Abstractions.Processes
/// <summary>
/// An immutable input to start the orchestration instance for "BRS_021_ForwardMeteredData" V1.
/// </summary>
public record MeteredDataForMeasurementPointMessageInputV1(
public record MeteredDataForMeteringPointMessageInputV1(
Guid AuthenticatedActorId,
string TransactionId,
string? MeteringPointId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Energinet.DataHub.ProcessManager.Orchestrations.Abstractions.Processes
/// Must be JSON serializable.
/// </summary>
public record StartForwardMeteredDataCommandV1
: MessageCommand<MeteredDataForMeasurementPointMessageInputV1>
: MessageCommand<MeteredDataForMeteringPointMessageInputV1>
{
/// <summary>
/// Construct command.
Expand All @@ -32,7 +32,7 @@ public record StartForwardMeteredDataCommandV1
/// <param name="messageId">Id of the message that casued this command to be executed.</param>
public StartForwardMeteredDataCommandV1(
ActorIdentityDto operatingIdentity,
MeteredDataForMeasurementPointMessageInputV1 inputParameter,
MeteredDataForMeteringPointMessageInputV1 inputParameter,
string messageId)
: base(
operatingIdentity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public async Task DisposeAsync()
public async Task ForwardMeteredData_WhenStartedUsingClient_CanMonitorLifecycle()
{
// Arrange
var input = CreateMeteredDataForMeasurementPointMessageInputV1();
var input = CreateMeteredDataForMeteringPointMessageInputV1();

var startCommand = new StartForwardMeteredDataCommandV1(
new ActorIdentityDto(input.AuthenticatedActorId),
Expand All @@ -110,9 +110,9 @@ public async Task ForwardMeteredData_WhenStartedUsingClient_CanMonitorLifecycle(
await _fixture.EventHubListener.WhenAny().VerifyOnceAsync();
}

private static MeteredDataForMeasurementPointMessageInputV1 CreateMeteredDataForMeasurementPointMessageInputV1()
private static MeteredDataForMeteringPointMessageInputV1 CreateMeteredDataForMeteringPointMessageInputV1()
{
var input = new MeteredDataForMeasurementPointMessageInputV1(
var input = new MeteredDataForMeteringPointMessageInputV1(
Guid.NewGuid(),
"EGU9B8E2630F9CB4089BDE22B597DFA4EA5",
"571313101700011887",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System.Globalization;
using Energinet.DataHub.ProcessManager.Components.Datahub.ValueObjects;
using Energinet.DataHub.ProcessManager.Components.Measurements;
using Energinet.DataHub.ProcessManager.Components.Measurements.Model;
Expand All @@ -22,11 +21,10 @@
using Energinet.DataHub.ProcessManager.Orchestrations.Processes.BRS_021.ForwardMeteredData.V1.Extensions;
using Microsoft.Azure.Functions.Worker;
using NodaTime;
using NodaTime.Text;

namespace Energinet.DataHub.ProcessManager.Orchestrations.Processes.BRS_021.ForwardMeteredData.V1.Activities;

internal class StoreMeteredDataForMeasurementPointActivity_Brs_021_ForwardMeteredData_V1(
internal class StoreMeteredDataForMeteringPointActivity_Brs_021_ForwardMeteredData_V1(
IClock clock,
IOrchestrationInstanceProgressRepository progressRepository,
IMeasurementsMeteredDataClient measurementsMeteredDataClient)
Expand All @@ -36,7 +34,7 @@ internal class StoreMeteredDataForMeasurementPointActivity_Brs_021_ForwardMetere
{
private readonly IMeasurementsMeteredDataClient _measurementsMeteredDataClient = measurementsMeteredDataClient;

[Function(nameof(StoreMeteredDataForMeasurementPointActivity_Brs_021_ForwardMeteredData_V1))]
[Function(nameof(StoreMeteredDataForMeteringPointActivity_Brs_021_ForwardMeteredData_V1))]
public async Task Run(
[ActivityTrigger] ActivityInput input)
{
Expand All @@ -49,24 +47,24 @@ await TransitionStepToRunningAsync(
orchestrationInstance)
.ConfigureAwait(false);

var points = input.MeteredDataForMeasurementPointMessageInput.EnergyObservations
var points = input.MeteredDataForMeteringPointMessageInput.EnergyObservations
.Select(x => new Point(
ParsePosition(x.Position),
ParseQuantity(x.EnergyQuantity),
ParseQuality(x.QuantityQuality)))
.ToList();

var meteredData = new MeteredDataForMeasurementPoint(
var meteredData = new MeteredDataForMeteringPoint(
input.OrchestrationInstanceId.ToString(),
input.MeteredDataForMeasurementPointMessageInput.MeteringPointId!,
input.MeteredDataForMeasurementPointMessageInput.TransactionId,
ParseDateTime(input.MeteredDataForMeasurementPointMessageInput.RegistrationDateTime),
ParseDateTime(input.MeteredDataForMeasurementPointMessageInput.StartDateTime),
ParseDateTime(input.MeteredDataForMeasurementPointMessageInput.EndDateTime),
ParseMeteringPointType(input.MeteredDataForMeasurementPointMessageInput.MeteringPointType),
input.MeteredDataForMeasurementPointMessageInput.ProductNumber!,
ParseMeasureUnit(input.MeteredDataForMeasurementPointMessageInput.MeasureUnit),
ParseResolution(input.MeteredDataForMeasurementPointMessageInput.Resolution),
input.MeteredDataForMeteringPointMessageInput.MeteringPointId!,
input.MeteredDataForMeteringPointMessageInput.TransactionId,
ParseDateTime(input.MeteredDataForMeteringPointMessageInput.RegistrationDateTime),
ParseDateTime(input.MeteredDataForMeteringPointMessageInput.StartDateTime),
ParseDateTime(input.MeteredDataForMeteringPointMessageInput.EndDateTime),
ParseMeteringPointType(input.MeteredDataForMeteringPointMessageInput.MeteringPointType),
input.MeteredDataForMeteringPointMessageInput.ProductNumber!,
ParseMeasureUnit(input.MeteredDataForMeteringPointMessageInput.MeasureUnit),
ParseResolution(input.MeteredDataForMeteringPointMessageInput.Resolution),
points);

await _measurementsMeteredDataClient.SendAsync(meteredData, CancellationToken.None).ConfigureAwait(false);
Expand Down Expand Up @@ -149,5 +147,5 @@ private int ParsePosition(string? sourcePosition)

public record ActivityInput(
OrchestrationInstanceId OrchestrationInstanceId,
MeteredDataForMeasurementPointMessageInputV1 MeteredDataForMeasurementPointMessageInput);
MeteredDataForMeteringPointMessageInputV1 MeteredDataForMeteringPointMessageInput);
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public OrchestrationDescription Build()
canBeScheduled: false,
functionName: nameof(Orchestration_Brs_021_ForwardMeteredData_V1));

description.ParameterDefinition.SetFromType<MeteredDataForMeasurementPointMessageInputV1>();
description.ParameterDefinition.SetFromType<MeteredDataForMeteringPointMessageInputV1>();
description.AppendStepDescription("Asynkron validering");
description.AppendStepDescription("Gemmer");
description.AppendStepDescription("Finder modtagere");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public Orchestration_Brs_021_ForwardMeteredData_V1()
public async Task<string> Run(
[OrchestrationTrigger] TaskOrchestrationContext context)
{
var input = context.GetOrchestrationParameterValue<MeteredDataForMeasurementPointMessageInputV1>();
var input = context.GetOrchestrationParameterValue<MeteredDataForMeteringPointMessageInputV1>();

if (input == null)
return "Error: No input specified.";
Expand Down Expand Up @@ -74,8 +74,8 @@ await context

// Step: Storing
await context.CallActivityAsync(
nameof(StoreMeteredDataForMeasurementPointActivity_Brs_021_ForwardMeteredData_V1),
new StoreMeteredDataForMeasurementPointActivity_Brs_021_ForwardMeteredData_V1.ActivityInput(
nameof(StoreMeteredDataForMeteringPointActivity_Brs_021_ForwardMeteredData_V1),
new StoreMeteredDataForMeteringPointActivity_Brs_021_ForwardMeteredData_V1.ActivityInput(
instanceId,
input),
_defaultRetryOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ namespace Energinet.DataHub.ProcessManager.Orchestrations.Processes.BRS_021.Forw
public class StartForwardMeteredDataHandlerV1(
ILogger<StartForwardMeteredDataHandlerV1> logger,
IStartOrchestrationInstanceCommands commands)
: StartOrchestrationInstanceFromMessageHandlerBase<MeteredDataForMeasurementPointMessageInputV1>(logger)
: StartOrchestrationInstanceFromMessageHandlerBase<MeteredDataForMeteringPointMessageInputV1>(logger)
{
private readonly IStartOrchestrationInstanceCommands _commands = commands;

protected override async Task StartOrchestrationInstanceAsync(ActorIdentity actorIdentity, MeteredDataForMeasurementPointMessageInputV1 input)
protected override async Task StartOrchestrationInstanceAsync(ActorIdentity actorIdentity, MeteredDataForMeteringPointMessageInputV1 input)
{
var orchestrationDescriptionUniqueName = new Brs_021_ForwardedMeteredData_V1();

Expand Down

0 comments on commit 5d58dc5

Please sign in to comment.