Subversion Repositories DevTools

Rev

Rev 4477 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4477 Rev 4482
Line 33... Line 33...
33
Dim oJSON
33
Dim oJSON
34
Set oJSON = New aspJSON
34
Set oJSON = New aspJSON
35
 
35
 
36
'
36
'
37
'   Determine the operation to be performed
37
'   Determine the operation to be performed
-
 
38
'   Invoke target routine
-
 
39
'   Expect:
-
 
40
'       result                    - test result
-
 
41
'       oJSON.data("emsgSummary") - Error detail
-
 
42
'
38
'
43
'
39
If (parOpr = "zipTest") Then
44
If (parOpr = "zipTest") Then
-
 
45
    Call zipFile
-
 
46
ElseIf (parOpr = "eventTest") Then
-
 
47
    Call sendEvent
-
 
48
ElseIf (parOpr = "emailTest") Then
-
 
49
    Call sendEmail
-
 
50
ElseIf (parOpr = "emailWshTest") Then
-
 
51
    Call sendWshEmail
-
 
52
ElseIf (parOpr = "remExecTest") Then
-
 
53
    Call remExec
-
 
54
ElseIf (parOpr = "pkgAccessTest") Then
-
 
55
    Call pkgAccess
-
 
56
Else
-
 
57
    oJSON.data("emsgSummary") = "Unknown operation requested:" & parOpr
-
 
58
End If
-
 
59
 
-
 
60
'
-
 
61
'   Create JSON data for the user
-
 
62
'   Important fields
-
 
63
'       result
-
 
64
'
-
 
65
'   Debug fields
-
 
66
'       Request (Array)
-
 
67
'
-
 
68
'Write single value
-
 
69
oJSON.data("result") = result
40
 
70
 
-
 
71
' DEBUG: An array of the user provided requests
-
 
72
Set oJSON.data("Request") = oJSON.Collection()
-
 
73
Set newitem = oJSON.AddToCollection(oJSON.data("Request"))
-
 
74
Dim variableName
-
 
75
for each variableName in Request.QueryString
-
 
76
    newitem.add variableName, Request.QueryString(variableName)
-
 
77
next
-
 
78
 
-
 
79
'Return the object
-
 
80
Response.Write oJSON.JSONoutput()
-
 
81
 
-
 
82
'-------------------------------------------------
-
 
83
' Function:    zipFile
-
 
84
' Description: Test the File Zipping process
-
 
85
Sub zipFile
41
    '
86
    '
42
    ' Create a test file in a known directory
87
    ' Create a test file in a known directory
43
    '
88
    '
44
    Dim objZIPObject, ZipFile
89
    Dim objZIPObject, ZipFile
45
    Dim outFile, objFSO, LocalDir, objFile
90
    Dim outFile, objFSO, LocalDir, objFile
Line 94... Line 139...
94
 
139
 
95
        objZIPObject = Nothing
140
        objZIPObject = Nothing
96
 
141
 
97
    End If
142
    End If
98
    set objFSO = Nothing
143
    set objFSO = Nothing
-
 
144
End Sub
99
 
145
 
-
 
146
'-------------------------------------------------
-
 
147
' Function:    sendEvent
-
 
148
' Description: Send an Event to the Windows Log
-
 
149
Sub sendEvent
-
 
150
   Dim objWSH, rv
-
 
151
    Set objWSH = Server.CreateObject("WScript.Shell")
-
 
152
    rv = objWSH.Run ("cmd.exe /c cscript.exe //B //NoLogo " & rootPath & SCRIPTS_FOLDER & "\Admin_Test.wsf //job:onRaiseEvent", 0, TRUE)
-
 
153
    Set objWSH = Nothing
-
 
154
    If rv = 0 Then
-
 
155
        result = 0
100
Else
156
    Else
-
 
157
        result = 1
101
    oJSON.data("emsgSummary") = "Unknown operation requested:" & parOpr
158
        oJSON.data("emsgSummary") = "Error:("&rv&")"
-
 
159
    End If
102
End If
160
End Sub
103
 
161
 
-
 
162
'-------------------------------------------------
-
 
163
' Function:     sendEmail
-
 
164
' Description:  Send an email
-
 
165
Sub sendEmail
-
 
166
   Dim Mode, Attachment, Message
-
 
167
 
-
 
168
   Attachment = Null
-
 
169
   Message = "This is a Test Email generated by the Release Manager Test."
-
 
170
   Mode = QStrPar("Mode")
-
 
171
 
-
 
172
   If Mode = "Attach" Then
-
 
173
        Attachment = Server.MapPath("images\img_reports_admin.jpg")
-
 
174
        Message = Message & " This message should have an attachment"
-
 
175
   End If
-
 
176
 
-
 
177
    Call Send_Email ( "Release Manager Notification", _
-
 
178
                       adminEmail, _
-
 
179
                       objAccessControl.UserEmail, _
-
 
180
                       "Test Email", _
-
 
181
                       Message, _
-
 
182
                       Attachment )
-
 
183
    result = Err.Number
-
 
184
    oJSON.data("emsgSummary") = Err.Description
-
 
185
    'oJSON.data("Info1") = Mode
-
 
186
    'oJSON.data("Info2") = Attachment
-
 
187
End Sub
-
 
188
 
-
 
189
'-------------------------------------------------
-
 
190
' Function:     sendWshEmail
-
 
191
' Description:  Send an email from a Wsh Script
-
 
192
Sub sendWshEmail
-
 
193
    Dim objWSH, rv
-
 
194
 
-
 
195
    Set objWSH = Server.CreateObject("WScript.Shell")
-
 
196
    rv = objWSH.Run ("cmd.exe /c cscript.exe //B //NoLogo " & rootPath & SCRIPTS_FOLDER & "\Admin_Test.wsf //job:onTestMail", 0, TRUE)
-
 
197
    Set objWSH = Nothing
-
 
198
    If rv = 0 Then
-
 
199
        result = 0
-
 
200
    Else
-
 
201
        result = 1
-
 
202
        oJSON.data("emsgSummary") = "Error:("&rv&")"
-
 
203
    End If
-
 
204
End Sub
-
 
205
 
-
 
206
'-------------------------------------------------
-
 
207
' Function:    remExec
-
 
208
' Description:  Test Release Manager Remote cmd Execution
-
 
209
Sub remExec
-
 
210
    Dim objWSH, rv
-
 
211
 
-
 
212
    Set objWSH = Server.CreateObject("WScript.Shell")
-
 
213
    rv = objWSH.Run ("cmd.exe /c cscript.exe //B //NoLogo " & rootPath & SCRIPTS_FOLDER & "\Admin_Test.wsf //job:onTestArchiveAccess", 0, TRUE)
-
 
214
    Set objWSH = Nothing
-
 
215
    If rv = 0 Then
-
 
216
        result = 0
-
 
217
    Else
-
 
218
        result = 1
-
 
219
        oJSON.data("emsgSummary") = "Error:("&rv&")"
-
 
220
    End If
-
 
221
End Sub
-
 
222
 
-
 
223
'-------------------------------------------------
-
 
224
' Function:    pkgAccess
-
 
225
' Description: Test dpkg_archive access - can we map it
104
'
226
'
105
'   Create JSON data for the user
-
 
106
'   Important fields
-
 
107
'       result
-
 
108
'
-
 
109
'   Debug fields
227
Sub pkgAccess
110
'       Request (Array)
228
    Dim objWSH, rv
111
'
-
 
112
'Write single value
-
 
113
oJSON.data("result") = result
-
 
114
 
229
 
115
' DEBUG: An array of the user provided requests
230
    Set objWSH = Server.CreateObject("WScript.Shell")
-
 
231
    rv = objWSH.Run ("cmd.exe /c cscript.exe //B //NoLogo " & rootPath & SCRIPTS_FOLDER & "\Admin_Test.wsf //job:onTestMapArchive", 0, TRUE)
116
Set oJSON.data("Request") = oJSON.Collection()
232
    Set objWSH = Nothing
117
Set newitem = oJSON.AddToCollection(oJSON.data("Request"))
233
    If rv = 0 Then
118
Dim variableName
234
        result = 0
-
 
235
    Else
119
for each variableName in Request.QueryString
236
        result = 1
120
    newitem.add variableName, Request.QueryString(variableName)
237
        oJSON.data("emsgSummary") = "Error:("&rv&")"
-
 
238
    End If
121
next
239
End Sub
122
 
240
 
123
'Return the object
-
 
124
Response.Write oJSON.JSONoutput()
-
 
125
%>
241
%>