@@ -48,7 +48,6 @@ Method TestEditProduction()
48
48
set %request .Data (" pageclass" ,1 ) = " EnsPortal.dummy"
49
49
do $System .OBJ .Delete (..#ProductionName)
50
50
$$$ThrowOnError(##class (SourceControl.Git.Utils ).NewBranch (" branch1" ))
51
- $$$ThrowOnError(##class (SourceControl.Git.Utils ).SwitchBranch (" branch1" ))
52
51
$$$ThrowOnError(##class (SourceControl.Git.Production ).CreateProduction (..#ProductionName))
53
52
do ##class (%Studio.SourceControl.Interface ).SourceControlCreate ()
54
53
$$$ThrowOnError(##class (SourceControl.Git.Utils ).AddToSourceControl (..#ProductionName_" .cls" ))
@@ -60,7 +59,7 @@ Method TestEditProduction()
60
59
$$$ThrowOnError(%SourceControl .OnAfterSave (..#ProductionName_" .cls" ))
61
60
do $$$AssertTrue(##class (SourceControl.Git.Utils ).IsInSourceControl (" UnitTest.SampleProduction||ProductionSettings-UnitTest.SampleProduction.PTD" ))
62
61
63
- do $$$LogMessage(" adding a production item" )
62
+ do $$$LogMessage(" adding a production item should add it to source control " )
64
63
$$$ThrowOnError(%SourceControl .OnBeforeSave (..#ProductionName_" .cls" ))
65
64
do ..ReplaceProductionDefinition (" ProductionDefinition1" )
66
65
$$$ThrowOnError(%SourceControl .OnAfterSave (..#ProductionName_" .cls" ))
@@ -73,22 +72,26 @@ Method TestEditProduction()
73
72
74
73
do $$$LogMessage(" switching to a new branch" )
75
74
$$$ThrowOnError(##class (SourceControl.Git.Utils ).NewBranch (" branch2" ))
76
- $$$ThrowOnError(##class (SourceControl.Git.Utils ).SwitchBranch (" branch2" ))
77
75
78
- do $$$LogMessage(" modifying an existing item and adding a new item" )
76
+ do $$$LogMessage(" adding a new item and modifying an existing item" )
79
77
$$$ThrowOnError(%SourceControl .OnBeforeSave (..#ProductionName_" .cls" ))
80
- set production = ##class (Ens.Config.Production ).%OpenId (..#ProductionName)
81
- set production .Items .GetAt (1 ).Enabled = 0
82
78
do ..ReplaceProductionDefinition (" ProductionDefinition2" )
83
79
$$$ThrowOnError(%SourceControl .OnAfterSave (..#ProductionName_" .cls" ))
80
+ set production = ##class (Ens.Config.Production ).%OpenId (..#ProductionName)
81
+ set production .Items .GetAt (1 ).Settings .GetAt (1 ).Value = 71
82
+ $$$ThrowOnError(%SourceControl .OnBeforeSave (..#ProductionName_" .cls" ))
83
+ do ..ReplaceProductionDefinition (" ProductionDefinition3" )
84
+ $$$ThrowOnError(%SourceControl .OnAfterSave (..#ProductionName_" .cls" ))
84
85
do $$$AssertTrue(##class (SourceControl.Git.Utils ).IsInSourceControl (" UnitTest.SampleProduction||Settings-b|Ens.Activity.Operation.Local.PTD" ))
85
86
do ##class (SourceControl.Git.Utils ).RunGitCommand (" add" ,,," ." )
86
87
do ##class (SourceControl.Git.Utils ).Commit (" UnitTest.SampleProduction||Settings-a|Ens.Activity.Operation.Local.PTD" )
87
88
do ##class (SourceControl.Git.Utils ).Commit (" UnitTest.SampleProduction||Settings-b|Ens.Activity.Operation.Local.PTD" )
88
89
$$$ThrowOnError(production .%Reload ())
89
90
do $$$AssertEquals(production .Items .Count (), 2 )
91
+ do $$$AssertEquals(production .Items .GetAt (1 ).Settings .GetAt (1 ).Name , " RecordStatsInterval" )
92
+ do $$$AssertEquals(production .Items .GetAt (1 ).Settings .GetAt (1 ).Value , 71 )
90
93
91
- do $$$LogMessage(" switching back to the original branch" )
94
+ do $$$LogMessage(" switching back to the original branch should modify and delete items " )
92
95
$$$ThrowOnError(##class (SourceControl.Git.Utils ).SwitchBranch (" branch1" ))
93
96
$$$ThrowOnError(production .%Reload ())
94
97
do $$$AssertEquals(production .Items .Count (), 1 )
@@ -120,10 +123,12 @@ XData ProductionDefinition1
120
123
{
121
124
<Production Name =" UnitTest.SampleProduction" LogGeneralTraceEvents =" false" >
122
125
<Item Name =" a" Category =" " ClassName =" Ens.Activity.Operation.Local" PoolSize =" 1" Enabled =" true" Foreground =" false" Comment =" " LogTraceEvents =" false" Schedule =" " >
126
+ <Setting Target =" Host" Name =" RecordStatsInterval" >61 </Setting >
123
127
</Item >
124
128
</Production >
125
129
}
126
130
131
+ /// adds item b
127
132
XData ProductionDefinition2
128
133
{
129
134
<Production Name =" UnitTest.SampleProduction" LogGeneralTraceEvents =" false" >
@@ -135,6 +140,18 @@ XData ProductionDefinition2
135
140
</Production >
136
141
}
137
142
143
+ /// modifies a setting for item a
144
+ XData ProductionDefinition3
145
+ {
146
+ <Production Name =" UnitTest.SampleProduction" LogGeneralTraceEvents =" false" >
147
+ <Item Name =" a" Category =" " ClassName =" Ens.Activity.Operation.Local" PoolSize =" 1" Enabled =" true" Foreground =" false" Comment =" " LogTraceEvents =" false" Schedule =" " >
148
+ <Setting Target =" Host" Name =" RecordStatsInterval" >71 </Setting >
149
+ </Item >
150
+ <Item Name =" b" Category =" " ClassName =" Ens.Activity.Operation.Local" PoolSize =" 1" Enabled =" true" Foreground =" false" Comment =" " LogTraceEvents =" false" Schedule =" " >
151
+ </Item >
152
+ </Production >
153
+ }
154
+
138
155
Method OnBeforeAllTests () As %Status
139
156
{
140
157
merge ..SourceControlGlobal = ^SYS (" SourceControl" )
0 commit comments