Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v8 #247

Closed
wants to merge 1 commit into from
Closed

v8 #247

wants to merge 1 commit into from

Conversation

tjololo
Copy link
Member

@tjololo tjololo commented May 30, 2023

Draft pullrequest to keep v8 up to date with main


Description

Related Issue(s)

  • #{issue number}

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)
  • All tests run green

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

#207 (#237)

* New process engine seems to work.
Needs more tests and verification

* refactored to make class more testable

* added tests for ProcessEngine

* Refactor and delete old and unused code

* added tests for ProcessEventDispatcher

* Add tests and fix ProcessNavigator

* add available actions to currentTask and perform authcheck

* action passed along from PUT process/next to gateway filters

* fix bug in AppProcessState ctor

* add fields for read/write and check users permissions

* Fix test stub implementation of IProcessExclusiveGateway

* Fixing some reported code smells

* Some code smell fixes.
Added logic to dispatch abandon event if action is reject

* remove unfinished test file

* add tests for method in ProcessClient

* add test for classes extending storage classes

* add test for null values in extensions

* revert code changes due to test

* add frontend feature and parse request body on process/next if present

* add frontend feature and parse request body on process/next if present

* fix codeql warning

* add v8 as target of github workflows in addition to main

* Fix return type of all methods in ProcessController returning ProcessState

* Authorize action moved to AuthorizationClient
TaskType is substituted with corresponding action earlier
Resolvs #207

* Fixed some issues after review and added some more tests

* fix codeQL warning and improve test

* Fix some code smells

* Update src/Altinn.App.Api/Controllers/InstancesController.cs

Co-authored-by: Ronny Birkeli <ronny.birkeli@gmail.com>

* fix build error

---------

Co-authored-by: Ronny Birkeli <ronny.birkeli@gmail.com>
Comment on lines +73 to +76
catch (Exception exception)
{
_logger.LogWarning(exception, "Exception when sending event with the Events component");
}

Check notice

Code scanning / CodeQL

Generic catch clause

Generic catch clause.
Comment on lines +105 to +130
foreach (InstanceEvent instanceEvent in events)
{
if (Enum.TryParse<InstanceEventType>(instanceEvent.EventType, true, out InstanceEventType eventType))
{
string? elementId = instanceEvent.ProcessInfo?.CurrentTask?.ElementId;
ITask task = GetProcessTask(instanceEvent.ProcessInfo?.CurrentTask?.AltinnTaskType);
switch (eventType)
{
case InstanceEventType.process_StartEvent:
break;
case InstanceEventType.process_StartTask:
await task.HandleTaskStart(elementId, instance, prefill);
break;
case InstanceEventType.process_EndTask:
await task.HandleTaskComplete(elementId, instance);
break;
case InstanceEventType.process_AbandonTask:
await task.HandleTaskAbandon(elementId, instance);
await _instanceService.UpdateProcess(instance);
break;
case InstanceEventType.process_EndEvent:
await _appEvents.OnEndAppEvent(instanceEvent.ProcessInfo?.EndEvent, instance);
break;
}
}
}

Check notice

Code scanning / CodeQL

Missed opportunity to use Where

This foreach loop [implicitly filters its target sequence](1) - consider filtering the sequence explicitly using '.Where(...)'.
@tjololo tjololo changed the title Rewrite of process engine to support actions in tasks resolves #205 a… v8 May 30, 2023
@tjololo tjololo closed this May 30, 2023
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 19 Code Smells

72.0% 72.0% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant