# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # #****************************************************************************** # # "@(#) $Id: ngamsSrvTestKillAfterOrgStagingFile.py,v 1.3 2008/08/19 20:51:50 jknudstr Exp $" # # Who When What # -------- ---------- ------------------------------------------------------- # jknudstr 07/10/2004 Created # """ Child class of ngamsServer killing itself immediately after creating the Original Staging File. """ from ngamsServer import ngamsServer class ngamsSrvTestKillAfterOrgStagingFile(ngamsServer.ngamsServer): def test_AfterCreateOrgStagingFile(self): self.killServer() if __name__ == '__main__': ngamsServer.main(server_class=ngamsSrvTestKillAfterOrgStagingFile)
# This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # #****************************************************************************** # # "@(#) $Id: ngamsSrvTestBeforeDapiInvocation.py,v 1.3 2008/08/19 20:51:50 jknudstr Exp $" # # Who When What # -------- ---------- ------------------------------------------------------- # jknudstr 07/10/2004 Created # """ Child class of ngamsServer killing itself immediately before invoking the DAPI. """ from ngamsServer import ngamsServer class ngamsSrvTestBeforeDapiInvocation(ngamsServer.ngamsServer): def test_BeforeDapiInvocation(self): self.killServer() if __name__ == '__main__': ngamsServer.main(server_class=ngamsSrvTestBeforeDapiInvocation)
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # #****************************************************************************** # # "@(#) $Id: ngamsSrvTestKillBeforeDbUpdateRepFile.py,v 1.3 2008/08/19 20:51:50 jknudstr Exp $" # # Who When What # -------- ---------- ------------------------------------------------------- # jknudstr 07/10/2004 Created # """ Child class of ngamsServer killing itself after creating the Replication File, before updating its info in the DB. """ from ngamsServer import ngamsServer class ngamsSrvTestKillBeforeDbUpdateRepFile(ngamsServer.ngamsServer): def test_BeforeDbUpdateRepFile(self): self.killServer() if __name__ == '__main__': ngamsServer.main(server_class=ngamsSrvTestKillBeforeDbUpdateRepFile)
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # #****************************************************************************** # # "@(#) $Id: ngamsSrvTestAfterDapiInvocation.py,v 1.3 2008/08/19 20:51:50 jknudstr Exp $" # # Who When What # -------- ---------- ------------------------------------------------------- # jknudstr 07/10/2004 Created # """ Child class of ngamsServer killing itself immediately before invoking the DAPI. """ from ngamsServer import ngamsServer class ngamsSrvTestAfterDapiInvocation(ngamsServer.ngamsServer): def test_AfterDapiInvocation(self): self.killServer() if __name__ == '__main__': ngamsServer.main(server_class=ngamsSrvTestAfterDapiInvocation)
refFilename = resObj.getRefFilename() contDisp = 'attachment; filename="%s"' % refFilename hdrs = { 'Content-Disposition': contDisp, 'Content-Length': str(dataSize), 'Content-Type': mimeType } httpRef.send_response(200, hdrs=hdrs) httpRef.end_headers() ############################################################# # TEST: SIMULATE BROKEN SOCKET BY TERMINATING WHEN HALF OF # THE DATA HAS BEEN SENT. ############################################################# srvObj.killServer() ############################################################# except Exception as e: cleanUpAfterProc(statusObjList) raise e if __name__ == '__main__': # Replace the function ngamsRetrieveCmd.genReplyRetrieve() used to # reply to the RETRIEVE Command with the test version provoking a # broken socket situation. from ngamsServer import ngamsRetrieveCmd ngamsRetrieveCmd.genReplyRetrieve = genReplyRetrieveFail ngamsServer.main()
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # #****************************************************************************** # # "@(#) $Id: ngamsSrvTestKillAfterMvStgFile.py,v 1.3 2008/08/19 20:51:50 jknudstr Exp $" # # Who When What # -------- ---------- ------------------------------------------------------- # jknudstr 07/10/2004 Created # """ Child class of ngamsServer killing itself immediately after moving the Staging File to the final destination (Main File). """ from ngamsServer import ngamsServer class ngamsSrvTestKillAfterMvStgFile(ngamsServer.ngamsServer): def test_AfterMovingStagingFile(self): self.killServer() if __name__ == '__main__': ngamsServer.main(server_class=ngamsSrvTestKillAfterMvStgFile)
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # #****************************************************************************** # # "@(#) $Id: ngamsSrvTestKillAfterTmpReqPropFile.py,v 1.3 2008/08/19 20:51:50 jknudstr Exp $" # # Who When What # -------- ---------- ------------------------------------------------------- # jknudstr 07/10/2004 Created # """ Child class of ngamsServer crashing immediately after creating the Temp. Req. Prop. File. """ from ngamsServer import ngamsServer class ngamsSrvTestKillAfterTmpReqPropFile(ngamsServer.ngamsServer): def test_AfterCreateTmpPropFile(self): self.killServer() if __name__ == '__main__': ngamsServer.main(server_class=ngamsSrvTestKillAfterTmpReqPropFile)
Only command that is handled is: STATUS. """ path = kwargs['path'] if 'path' in kwargs else args[3] cmd = path.strip().split('?')[0] if cmd == NGAMS_STATUS_CMD: super(ngamsServerTestDynReqCallBack, self).reqCallBack(*args, **kwargs) else: time.sleep(0.250) self.killServer() def reqCallBack_SrvCrash2(self, *args, **kwargs): """ Override ngamsServer.reqCallBack(). This version simply kills itself. The input socket it first flushed. Only command that is handled is: STATUS. """ path = kwargs['path'] if 'path' in kwargs else args[3] cmd = path.strip().split('?')[0] if cmd in (NGAMS_ARCHIVE_CMD, NGAMS_STATUS_CMD): super(ngamsServerTestDynReqCallBack, self).reqCallBack(*args, **kwargs) else: time.sleep(0.250) self.killServer() if __name__ == '__main__': ngamsServer.main(server_class=ngamsServerTestDynReqCallBack)