Subversion Repositories DevTools

Rev

Rev 5442 | Rev 5671 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|
'|  ADMIN Page
'|  Build Service
'|  admin_build_test_page.asp
'|
'=====================================================
%>
<%
Option explicit
' Good idea to set when using redirect
Response.Expires = 0   ' always load the page, dont store
%>
<!--#include file="common/conf.asp"-->
<!--#include file="common/globals.asp"-->
<!--#include file="common/qstr.asp"-->
<!--#include file="common/common_subs.asp"-->
<!--#include file="_jquery_includes.asp"-->

<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_general.asp"-->
<%
'------------ Variable Definition -------------
Dim active
Dim FileSystemObject
Dim dpkgArchiveAvailable

'------------ Constants Declaration -----------
'------------ Variable Init -------------------
active = canActionControl("ConfigureBuildService")

'   Determine if dpkg_archive can be accessed directly via a UNC
If testArchiveAccessPkg("","") Then
    dpkgArchiveAvailable = "Exists" 
Else
    dpkgArchiveAvailable = "Not Accessible" 
End If

'----------------------------------------------
function testFromRegistry (strRegistryKey )
    Dim WSHShell, value

    On Error Resume Next
    Set WSHShell = CreateObject("WScript.Shell")
    value = WSHShell.RegRead( strRegistryKey )

    testFromRegistry = NOT (err.number <> 0)

    set WSHShell = nothing
end function
'----------------------------------------------
'Returns the current database date-time
Function getDataBaseDateTime()
   Dim sqry: sqry = "SELECT TO_CHAR (ora_sysdatetime, 'DD-Mon-YYYY HH24:MI:SS') FROM DUAL"
   Dim rsTemp
   Set rsTemp = OraDatabase.DbCreateDynaset( sqry , cint(0) )
   getDataBaseDateTime = rsTemp(0)
   rsTemp.Close()
   Set rsTemp = Nothing
End Function

'----------------------------------------------
Function WebServerDateTime ()
    Dim dDate : dDate = Now()
    Dim mName(13) : 
    mName(0) =  "???"
    mName(1) =  "Jan"
    mName(2) =  "Feb"
    mName(3) =  "Mar"
    mName(4) =  "Apr"
    mName(5) =  "May"
    mName(6) =  "Jun"
    mName(7) =  "Jul"
    mName(8) =  "Aug"
    mName(9) =  "Sep"
    mName(10) = "Oct"
    mName(11) = "Nov"
    mName(12) = "Dec"
        If IsNull(dDate) Then Exit Function
        WebServerDateTime = Day(dDate) &"-"& mName(Month(dDate)) &"-"& Year(dDate) &" "& Right("0" & Hour(dDate), 2) & ":" & Minute(dDate) & ":" & Second(dDate)
End Function

Function makeAjaxButton( text, script )
    If active Then
        makeAjaxButton = "&nbsp;&nbsp;<a id="""&script &""" href="""" class=""form_btn"" title=""" &text& """ onclick="""&script&"();return false;"">"&text&"</a>"
    Else
        makeAjaxButton = "&nbsp;&nbsp;<a class=""form_btn_disabled"" title=""" &text& """>"&text&"</a>"
    End If
End Function
%>
<script type="text/javascript" charset="utf-8">
///////////////////////////////////////////////
//  Function:    ajaxOpr
//  Description: Perform an ajax operation
//  Args       :    prog        - Progam to invoke
//                  args        - Part of URL to pass to script
//                  callback    - Callback on success
//                  ecall       - Callback on error            
//
function ajaxOpr(prog, args, callback, ecall)
{
    $.ajax({
        method: "GET",
        url: prog,
        data: args,
        dataType: 'json'
    })
    .done(function( myJson, textStatus, jqXHR ) {
        try {
            //alert("ajaxOprCallback:" + myJson);
            if (myJson.result != 0) {
                ecall('Error');
                vixAlert("AJAX request error: " + myJson.emsgSummary);
            }
            else {
                callback(myJson);
            }
        }
        catch(e) {
            ecall('Error');
            vixAlert("JSON Parse Error: " + e);
        }
    })
    .fail(function(  jqXHR, textStatus, errorThrown ) {
        ecall('Bad Status');
        vixAlert("Internal AJAX error<br>Status: " + textStatus + "<br>Msg: " + errorThrown);
    });
}

///////////////////////////////////////////////
//  Function:       jiraTest   
//  Description:    Get the list of projects from the Jira Server
//
function jiraTest()
{
    //  Show that testing has started
    var el = document.getElementById("jiraTest");
    el.innerHTML = 'Testing';

    ajaxOpr('_json_jiraIssues.asp',
            {Opr:'getAllKeys'}, 
            function(myJson){ el.innerHTML = 'Test OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}

///////////////////////////////////////////////
//  Function:       LXRTest   
//  Description:    Get some data fromthe LXR Server
//
function LXRTest()
{
    //  Show that testing has started
    var el = document.getElementById("LXRTest");
    el.innerHTML = 'Testing';

    ajaxOpr('_json_RmTests.asp',
            {Opr:'lxrAccessTest'}, 
            function(myJson){ el.innerHTML = 'Test OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}

///////////////////////////////////////////////
//  Function:       zipTest   
//  Description:    Test that the server can ZIP a file
//
function zipTest()
{
    //  Show that testing has started
    var el = document.getElementById("zipTest");
    el.innerHTML = 'Testing';

    ajaxOpr('_json_RmTests.asp',
            {Opr:'zipTest'}, 
            function(myJson){ el.innerHTML = 'Test OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}

///////////////////////////////////////////////
//  Function:       eventTest   
//  Description:    Test that the server can send an Event
//
function eventTest()
{
    //  Show that testing has started
    var el = document.getElementById("eventTest");
    el.innerHTML = 'Sending';

    ajaxOpr('_json_RmTests.asp',
            {Opr:'eventTest'}, 
            function(myJson){ el.innerHTML = 'Sent OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}

///////////////////////////////////////////////
//  Function:       reportEvent
//  Description:    Test that the server can report and event
//
function reportEvent()
{
    //  Show that testing has started
    var el = document.getElementById("reportEvent");
    el.innerHTML = 'Reporting';

    ajaxOpr('_json_RmTests.asp',
            {Opr:'reportEvent'}, 
            function(myJson){ el.innerHTML = 'Reported OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}

///////////////////////////////////////////////
//  Function:       emailTest   
//  Description:    Test that the server can send an email
//
function emailTest()
{
    //  Show that testing has started
    var el = document.getElementById("emailTest");
    el.innerHTML = 'Sending';

    ajaxOpr('_json_RmTests.asp',
            {Opr:'emailTest'}, 
            function(myJson){ el.innerHTML = 'Sent OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}
///////////////////////////////////////////////
//  Function:       emailTest1   
//  Description:    Test that the server can send an email with an attachment
//
function emailTest1()
{
    //  Show that testing has started
    var el = document.getElementById("emailTest1");
    el.innerHTML = 'Sending';

    ajaxOpr('_json_RmTests.asp',
            {Opr:'emailTest', Mode:'Attach'}, 
            function(myJson){ el.innerHTML = 'Sent OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}

///////////////////////////////////////////////
//  Function:       remExec
//  Description:    Test Remote Execution
//
function remExec()
{
    //  Show that testing has started
    var el = document.getElementById("remExec");
    el.innerHTML = 'Testing';

    ajaxOpr('_json_RmTests.asp',
            {Opr:'remExecTest'}, 
            function(myJson){ el.innerHTML = 'Test OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}

///////////////////////////////////////////////
//  Function:       pkgAccess
//  Description:    http access of package
//
function pkgAccess()
{
    //  Show that testing has started
    var el = document.getElementById("pkgAccess");
    el.innerHTML = 'Testing';

    ajaxOpr('_json_RmTests.asp',
            {Opr:'pkgAccessTest'}, 
            function(myJson){ el.innerHTML = 'Test OK'; },
            function(txt){ el.innerHTML = "Test Failed:" + txt}
           );
}

</script>
<html>
<head>

<title>Admin Test Page</title>
<link rel="shortcut icon" href="<%=FavIcon%>"/>

<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
<link rel="stylesheet" href="images/navigation.css" type="text/css">
<!-- DROPDOWN MENUS -->
<!--#include file="_menu_def.asp"-->
<script language="JavaScript1.2" src="images/popup_menu.js"></script>
<!-- StyleSheet Extensions -->
<style>
.pagebody {margin-left:auto; margin-right:auto; width:50%;border-width: 0px;border-spacing: 2px; background-color: rgb(255, 204, 0)}
.pagebody td{white-space:nowrap;vertical-align: top;text-align: left;padding-left: 3px;padding-right: 3px; background: #f2f0e4}
.tablehdr td{background-color: rgb(255, 204, 0)}
</style>
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" >
<!-- MENU LAYERS -------------------------------------->
<div id="popmenu" class="menuskin" onMouseover="clearhidemenu();highlightmenu(event,'on')" onMouseout="highlightmenu(event,'off');dynamichide(event)">
</div>
<!-- TIPS LAYERS -------------------------------------->
<div id="formTipsLayer" style="position: absolute; z-index: 1000; visibility: hidden; left:0; top: 0; width: 10">&nbsp;</div>
<!-- HEADER -->
<!--#include file="_header.asp"-->
<p>
<!-- Body of the page -->
<table class="pagebody">
   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_col tablehdr">
      <td>Test</td>
      <td>Result</td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>User ID</td>
      <td><%=objAccessControl.UserId%></td>
   </tr>
   <tr class="body_row">
      <td>User Name</td>
      <td><%=objAccessControl.UserName%></td>
   </tr>
   <tr class="body_row">
      <td>User Email</td>
      <td><%=objAccessControl.UserEmail%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>Database Name</td>
      <td><%=OraDatabase.DatabaseName%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>Database Time</td>
      <td><%=getDataBaseDateTime()%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>Web Server Time</td>
      <td><%=WebServerDateTime()%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>Archive Server</td>
      <td><%=archive_server%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>Archive Root: <%=dpkg_archiveURL%></td>
      <td><%=dpkgArchiveAvailable%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>Package Archive Access - Check Presence</td>
      <td><%=makeAjaxButton("Test", "pkgAccess")%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <%
       Dim sKey2, sValue2, kFragment
       kFragment = "rsa2@22:" & archive_server
       sKey2 = "HKEY_USERS\.DEFAULT\Software\SimonTatham\PuTTY\SshHostKeys\" & kFragment
       sValue2 = testFromRegistry(sKey2)
   %>
    <tr class="body_row">
      <td>Plink Key [<%=sKey2%>]</td>
      <td><%=sValue2%></td>
   </tr>
   
    <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
    <tr class="body_row">
       <td>Package Archive Access - Remote cmd execution</td>
       <td><%=makeAjaxButton("Test", "remExec")%></td>
    </tr>

  <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
     <td>Zip File</td>
     <td><%=makeAjaxButton("Test", "zipTest")%></td>
   </tr>

  <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>Email Server</td>
      <td><%=MAIL_SERVER%></td>
   </tr>
   <tr class="body_row">
      <td>Admin Email</td>
      <td><%=ADMIN_EMAIL%></td>
   </tr>
   <tr class="body_row">
      <td>Fault Email List</td>
      <td><%=FAULT_EMAIL_LIST%></td>
   </tr>
   <tr class="body_row">
      <td>Send Email</td>
      <td><%=makeAjaxButton("eMail", "emailTest")%></td>
   </tr>
   <tr class="body_row">
      <td>Send Email With attachment</td>
      <td><%=makeAjaxButton("eMail", "emailTest1")%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
    <td>Generate error event</td>
    <td><%=makeAjaxButton("Event", "eventTest")%></td>
   </tr>

   <tr class="body_row">
    <td>Report Event</td>
    <td><%=makeAjaxButton("Report", "reportEvent")%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>Jira Server</td>
      <td><%=Application("JIRA_URL")%></td>
   </tr>
   <tr class="body_row">
      <td>Jira Test</td>
      <td><%=makeAjaxButton("Test", "jiraTest")%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_row">
      <td>LXR Server</td>
      <td><%=LXR_URL%></td>
   </tr>
   <tr class="body_row">
      <td>LXR Test</td>
      <td><%=makeAjaxButton("Test", "LXRTest")%></td>
   </tr>

   <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
   <tr class="body_col tablehdr">
      <td>End of Tests</td>
      <td><a class="form_btn" href="admin_build_test_page.asp" title="Refresh Page">Refresh</a></td>
   </tr>
   
</table>
<input type="hidden" name="action" value="true">
<p>
</body>
</html>
<!-- FOOTER -->
<!--#include file="_footer.asp"-->
<%
Call Destroy_All_Objects
%>