Skip to content

Commit 11e8705

Browse files
committed
PR changes
1 parent bc17579 commit 11e8705

File tree

5 files changed

+238
-50
lines changed

5 files changed

+238
-50
lines changed

src/LogicApp/LogicApp.Test/ScenarioTests/IntegrationAccountGeneratedIcnTests.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# ----------------------------------------------------------------------------------
1414

1515
# Constants used in the tests.
16+
# To see up new resources for the tests, see "how-to-create-a-session.md"
1617
$SESSION_RG = "flowrg"
1718
$SESSION_IA = "PS-Tests-Sessions"
1819
$AGREEMENT_X12_Name = "PS-X12-Agreement"

src/LogicApp/LogicApp.Test/ScenarioTests/IntegrationAccountReceivedIcnTests.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# ----------------------------------------------------------------------------------
1414

1515
# Constants used in the tests.
16+
# To see up new resources for the tests, see "how-to-create-a-session.md"
1617
$SESSION_RG = "flowrg"
1718
$SESSION_IA = "PS-Tests-Sessions"
1819
$AGREEMENT_X12_Name = "PS-X12-Agreement"

src/LogicApp/LogicApp.Test/ScenarioTests/WorkflowTests.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,16 @@ function Test-ValidateLogicApp
315315
$definition = [IO.File]::ReadAllText($definitionFilePath)
316316
Test-AzLogicApp -ResourceGroupName $resourceGroup.ResourceGroupName -Name $workflowName -Location $locationName -Definition $definition -ParameterFilePath $parameterFilePath
317317

318+
# Test 3: Failure for an invalid definition.
319+
try
320+
{
321+
Test-AzLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName -Location $locationName -Definition '{}'
322+
}
323+
catch
324+
{
325+
Assert-AreEqual $_.Exception.Message "The request content is not valid and could not be deserialized: 'Required property '`$schema' not found in JSON. Path 'properties.definition', line 4, position 20.'."
326+
}
327+
318328
Remove-AzLogicApp -ResourceGroupName $resourceGroupName -Name $workflowName -Force
319329
}
320330

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
The session integration account artifact is unique amongst the rest of the artifacts. It is a byproduct of connecting 2 partners with an agreement and sending a message from partner 1 to partner 2. The session is required for the RecievedIcn and GeneratedIcn tests.
2+
3+
## Regenerate Sessions Using Existing Logic App
4+
There should be a Logic App already in the location specified by the test constants. If it is still there, all you need to do is trigger the run and it should create everything that is needed. If it isn't there and the sessions don't exist, you'll need to create the Logic App yourself.
5+
6+
## How to Create a new Logic App to generate Sessions
7+
8+
1. Create an Integration Account
9+
2. Create 2 partners. Use the ZZ qualifier and give each partner a different value. You can use "ZZ" for one and "AA" for the other as an example
10+
3. Create an X12 agreement
11+
4. Create an Edifact agreement
12+
5. Create a Logic App in the same sub, resource group, and location to keep things tidy
13+
6. Add a Request trigger
14+
7. Add a "Add X12 Control Numbers" action (name might not be exact). You might need to recreate the connection as well. Fill out the data in the action to match the data expected in the test. You might want to rename the action to keep it clear which action is which. You need both a Send and Receive section and all should be type "Icn"
15+
8. Add a "Add EDIFACT Control Numbers" action (name might not be exact). You might need to recreate the connection as well. Fill out the data in the action to match the data expected in the test. You might want to rename the action to keep it clear which action is which. You need both a Send and Receive section and all should be type "Icn"
16+
9. Save and run. Check the results of the run. Don't just look to see if the actions succeeded, you need to actually check the output and see that the response says success.
17+
18+
## Sample Logic App Definition
19+
This is for reference. You might be able to use this in code view, but you'd need to make the connections first and those were included here for security reasons
20+
21+
```json
22+
"definition": {
23+
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
24+
"actions": {
25+
"Add_Edifact_Control_Numbers": {
26+
"inputs": {
27+
"body": [
28+
{
29+
"AgreementName": "PS-Edifact-Agreement",
30+
"ControlNumber": "1234",
31+
"ControlNumberType": "Icn",
32+
"IsAcknowledgement": false,
33+
"IsMessageProcessingFailed": false,
34+
"MessageDirection": "Receive"
35+
},
36+
{
37+
"AgreementName": "PS-Edifact-Agreement",
38+
"ControlNumber": "1234",
39+
"ControlNumberType": "Icn",
40+
"IsAcknowledgement": false,
41+
"IsMessageProcessingFailed": false,
42+
"MessageDirection": "Send"
43+
}
44+
],
45+
"host": {
46+
"connection": {
47+
"name": "@parameters('$connections')['edifact']['connectionId']"
48+
}
49+
},
50+
"method": "put",
51+
"path": "/controlnumbers"
52+
},
53+
"runAfter": {
54+
"Add_X12_Control_Numbers": [
55+
"Succeeded"
56+
]
57+
},
58+
"type": "ApiConnection"
59+
},
60+
"Add_X12_Control_Numbers": {
61+
"inputs": {
62+
"body": [
63+
{
64+
"AgreementName": "PS-X12-Agreement",
65+
"ControlNumber": "1234",
66+
"ControlNumberType": "Icn",
67+
"IsAcknowledgement": false,
68+
"IsMessageProcessingFailed": false,
69+
"MessageDirection": "Receive"
70+
},
71+
{
72+
"AgreementName": "PS-X12-Agreement",
73+
"ControlNumber": "1234",
74+
"ControlNumberType": "Icn",
75+
"IsAcknowledgement": false,
76+
"IsMessageProcessingFailed": false,
77+
"MessageDirection": "Send"
78+
}
79+
],
80+
"host": {
81+
"connection": {
82+
"name": "@parameters('$connections')['x12_1']['connectionId']"
83+
}
84+
},
85+
"method": "put",
86+
"path": "/controlNumbers"
87+
},
88+
"runAfter": {},
89+
"type": "ApiConnection"
90+
}
91+
},
92+
"contentVersion": "1.0.0.0",
93+
"outputs": {},
94+
"parameters": {
95+
"$connections": {
96+
"defaultValue": {},
97+
"type": "Object"
98+
}
99+
},
100+
"triggers": {
101+
"manual": {
102+
"inputs": {
103+
"schema": {}
104+
},
105+
"kind": "Http",
106+
"type": "Request"
107+
}
108+
}
109+
}
110+
```

0 commit comments

Comments
 (0)