-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
160 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
// Verwendet IntelliSense zum Ermitteln möglicher Attribute. | ||
// Zeigen Sie auf vorhandene Attribute, um die zugehörigen Beschreibungen anzuzeigen. | ||
// Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "TestInject", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "test", | ||
"program": "${workspaceFolder}", | ||
"showLog": true, | ||
"args": [ | ||
"-test.v", | ||
"^TestInject$" | ||
] | ||
}, | ||
{ | ||
"name": "TestEmbeddedInject", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "test", | ||
"program": "${workspaceFolder}", | ||
"showLog": true, | ||
"args": [ | ||
"-test.v", | ||
"^TestEmbeddedInject$" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2024 Salvatore Gonda | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
/* | ||
Module gobpmnHash is a simple implementation of the BPMN 2.0 hash algorithm. | ||
Hash values are used to generate unique IDs for each element of a process. | ||
* The hash value is generated using the crypto/rand package and the hash/fnv package to generate a 32-bit FNV-1a hash. | ||
* The suffix is used to generate a unique ID for each element of a process. | ||
Injections are used to inject hash values into the fields of a struct. | ||
* The injectConfig method sets the bool type. | ||
* The injectCurrentField method injects the current field with a hash value. | ||
* The injectNextField method injects the next field with a hash value. | ||
*/ | ||
|
||
package gobpmn_hash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
github.com/deemount/gobpmnReflection v0.0.0-20240312074456-8746db163823 h1:I9O9SXz0sHqwDdZOso8frhpw2wPaiAG+SioKn/jLXFY= | ||
github.com/deemount/gobpmnReflection v0.0.0-20240312074456-8746db163823/go.mod h1:NhbSOQE5lfqYvNkZXsm6xWTq3Wpy5xBPaERNqM/0OgI= | ||
github.com/deemount/gobpmnModels v0.0.0-20240316085912-7831ff39ffa4 h1:xAqg4ZIeMDxME0O8O4UpwpcS3AeXB+3IspauNX2G2AA= | ||
github.com/deemount/gobpmnModels v0.0.0-20240316085912-7831ff39ffa4/go.mod h1:bv2zkkqCzzaGV5gYP3gDQfMXuqjxMBjSl9GjHFo2mY8= | ||
github.com/deemount/gobpmnReflection v0.0.0-20240315112013-036495e4c08d h1:yQY4ikw/HuvVlPu3hGc0X8gntQnSbLqMnUw/nHRRCKU= | ||
github.com/deemount/gobpmnReflection v0.0.0-20240315112013-036495e4c08d/go.mod h1:j8WCmdzEkTq/FVsWJAdoPtjTiRryLZp/WjOLcIqtt5c= | ||
github.com/deemount/gobpmnTypes v0.0.0-20240315111519-43046016ad9f h1:0gux6KtY8XgrN/L9tiZ7B+wx3th7x4hBYu1+wtUkHYY= | ||
github.com/deemount/gobpmnTypes v0.0.0-20240315111519-43046016ad9f/go.mod h1:Dw7Jo8/vr0DzNHNMnbwQu0JSMWm2klNdo00rcxHCzJs= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package gobpmn_hash_test | ||
|
||
import ( | ||
"testing" | ||
|
||
gobpmn_hash "github.com/deemount/gobpmnHash" | ||
"github.com/deemount/gobpmnModels/pkg/core" | ||
) | ||
|
||
type Injection struct { | ||
Suffix string | ||
} | ||
|
||
type TestProcess struct { | ||
Def core.DefinitionsRepository | ||
IsExecutable bool | ||
Process gobpmn_hash.Injection | ||
StartEvent gobpmn_hash.Injection | ||
FromStartEvent gobpmn_hash.Injection | ||
Task gobpmn_hash.Injection | ||
FromTask gobpmn_hash.Injection | ||
EndEvent gobpmn_hash.Injection | ||
} | ||
|
||
type TestEmbeddedProcess struct { | ||
Def core.DefinitionsRepository | ||
TestEmbeddedPool | ||
TestEmbeddedTenant | ||
} | ||
|
||
type TestEmbeddedPool struct { | ||
XYZIsExecutable bool | ||
XYZProcess gobpmn_hash.Injection | ||
} | ||
|
||
type TestEmbeddedTenant struct { | ||
XYZStartEvent gobpmn_hash.Injection | ||
} | ||
|
||
func TestInject(t *testing.T) { | ||
t.Log("TestInjectEmbedded") | ||
var hash gobpmn_hash.Injection | ||
p := hash.Inject(TestProcess{}).(TestProcess) | ||
p.Def = core.NewDefinitions() | ||
t.Logf("p: %#+v", p) | ||
} | ||
|
||
func TestInjectEmbedded(t *testing.T) { | ||
t.Log("TestInjectEmbedded") | ||
var hash gobpmn_hash.Injection | ||
p := hash.Inject(TestEmbeddedProcess{}).(TestEmbeddedProcess) | ||
p.Def = core.NewDefinitions() | ||
t.Logf("p: %#+v", p) | ||
} | ||
|
||
func BenchmarkInject(b *testing.B) { | ||
var hash gobpmn_hash.Injection | ||
for n := 0; n < b.N; n++ { | ||
p := hash.Inject(TestProcess{}).(TestProcess) | ||
p.Def = core.NewDefinitions() | ||
b.Logf("p: %#+v", p) | ||
} | ||
} | ||
|
||
func BenchmarkInjectEmbedded(b *testing.B) { | ||
var hash gobpmn_hash.Injection | ||
for n := 0; n < b.N; n++ { | ||
p := hash.Inject(TestEmbeddedProcess{}).(TestEmbeddedProcess) | ||
p.Def = core.NewDefinitions() | ||
b.Logf("p: %#+v", p) | ||
} | ||
} |