Commit d6bea1dc authored by Michael Weinrich's avatar Michael Weinrich
Browse files

Testing of control phase can be started using the button when running the GUI...

Testing of control phase can be started using the button when running the GUI (doesn't start automatically)
parent 39eddf69
......@@ -11,7 +11,7 @@ import time
import sys
import os
from twisted.internet import reactor, task
from twisted.internet import reactor, task, defer
import gtk, gtk.glade, gobject
......@@ -71,7 +71,7 @@ class UPnTGUI:
"""Device var that holds the device that is tested when the Execute
Tests button is hit"""
self.deviceToTest = None
self.serviceToTest = None
# TreeView for information about selected device
textrenderer = gtk.CellRendererText()
......@@ -121,7 +121,7 @@ class UPnTGUI:
"""
Update the device tree after inserting a new device or service node.
"""
print 'Updating tree...'
#print 'Updating tree...'
model = self.getWidget("treeviewDeviceTree").get_model()
iter = model.get_iter_first()
current_parent = None
......@@ -165,10 +165,10 @@ class UPnTGUI:
def executeTests(self, widget, data=None):
"""
Run the control test on a device (not implemented yet).
Run the control test on a device.
"""
if self.deviceToTest is not None:
self.deviceToTest.checkDescriptions(self._serverDevices, self._services)
if self.serviceToTest is not None:
self.serviceToTest.startControlTesting(None, defer.succeed(None))
def updateMessageBox(self, message):
"""
......@@ -187,11 +187,12 @@ class UPnTGUI:
object = selected_treemodel.get_value(selected_iter, 2)
if isinstance(object, upntest.device.ServerDevice):
device = object
self.deviceToTest = device
model.append(['Device Type', device.deviceType + ':' + device.deviceVersion])
model.append(['UUID', device.UUID])
model.append(['Description URL', device.location])
elif isinstance(object, upntest.service.Service):
service = object
self.serviceToTest = service
model.append(['Service Type', service.serviceType + ':' + service.serviceVersion])
model.append(['scpdURL', service.scpdUrl])
model.append(['controlURL', service.controlUrl])
......
......@@ -78,12 +78,12 @@ class ServerControl(log.Loggable):
self.info(error)
self._ready = False
except IOError, error:
self.info('Common file for %s:%s not found' % (service_type, service_version))
self.info(error)
self.warning('Common file for %s:%s not found' % (service_type, service_version))
self.warning(error)
self._ready = False
except etree.XMLSyntaxError, error:
self.info('Common file for %s:%s cannot be parsed' % (service_type, service_version))
self.info(error)
self.warning('Common file for %s:%s cannot be parsed' % (service_type, service_version))
self.warning(error)
self._ready = False
if not self._ready:
return
......@@ -159,7 +159,6 @@ class ServerControl(log.Loggable):
finished. If L{_ready} is still C{False}, an already activated C{Deferred}
is returned.
"""
if not self._ready:
return defer.succeed(False)
......@@ -175,6 +174,8 @@ class ServerControl(log.Loggable):
Go through all testcases and send a control message for each test case.
If L{loop_tests} is C{True}, repeat the tests until it is set to C{False}.
"""
#print 'doTesting...'
self.debug('doTesting')
is_looped = True
test_result = True
......
......@@ -334,7 +334,7 @@ class ServerDevice(log.Loggable):
self.debug('Checking device description from %s' % self._descLocation)
d = utils.getPage(self._descLocation)
louie.send('UPnT.running_deferred', None, d)
#louie.send('UPnT.running_deferred', None, d)
d.addCallback(self.validateDescription)
d.addErrback(self.validateDescriptionFailed,
......@@ -535,8 +535,8 @@ class ServerDevice(log.Loggable):
self.checkServiceAnnouncement(device, device_list, service_list, xpath_exp='upnp:deviceList/upnp:device')
if d is not None:
louie.send('UPnT.ending_deferred', None, d)
#if d is not None:
#louie.send('UPnT.ending_deferred', None, d)
return doc
......@@ -556,7 +556,7 @@ class ServerDevice(log.Loggable):
self.debug('checkServiceAnnouncementFailed (%s)' % url)
self.debug(failure)
louie.send('UPnT.ending_deferred', None, d)
#louie.send('UPnT.ending_deferred', None, d)
def removeUnknownTags(self, xmldoc):
......
......@@ -103,7 +103,8 @@ class Host(log.Loggable):
if d is not None:
#d.addCallback(self.updateDeviceTree, header, d)
#d.addErrback(self.showPacketData, header, payload, '', d)
louie.send('UPnT.ending_deferred', None, d)
#louie.send('UPnT.ending_deferred', None, d)
pass
else:
self.showPacketData(None, header, payload, '', None)
elif data.lower().startswith('notify'):
......@@ -185,8 +186,8 @@ class Host(log.Loggable):
self.warning('Datagram header: %s' % header)
self.warning('Datagram payload: %s' % payload)
if d is not None:
louie.send('UPnT.ending_deferred', None, d)
#if d is not None:
#louie.send('UPnT.ending_deferred', None, d)
def updateDeviceTree(self, result, header, d):
"""
......@@ -261,7 +262,7 @@ class Host(log.Loggable):
None,
'Wrong action. Something went really wrong here.')
louie.send('UPnT.ending_deferred', None, d)
#louie.send('UPnT.ending_deferred', None, d)
def showDeviceTree(self, result, device, level=1):
......@@ -292,7 +293,7 @@ class Host(log.Loggable):
self.showDeviceTree(result, sub_device, level + 1)
# GUI update signal
print 'Sending GUI message'
#print 'Sending GUI message'
louie.send('UPnT.host_discovery_end', None, device)
def createAndCheckDeviceTree(self):
......@@ -422,7 +423,7 @@ class Host(log.Loggable):
elif headers['nts'] == 'ssdp:byebye':
self.debug('ssdp:byebye received')
d = defer.succeed(None)
louie.send('UPnT.running_deferred', None, d)
#louie.send('UPnT.running_deferred', None, d)
return d
else:
louie.send('UPnT.errorMessage', None, 'HostValidationError (%s)' % self.ip, 'Wrong NTS header')
......@@ -518,7 +519,7 @@ class Host(log.Loggable):
d = utils.getPage(header['location'], method='HEAD')
else:
d = utils.getPage(header['location'])
louie.send('UPnT.running_deferred', None, d)
#louie.send('UPnT.running_deferred', None, d)
return d
def checkDiscoveryPacket(self, header, payload):
......@@ -612,7 +613,7 @@ class Host(log.Loggable):
return None
d = defer.succeed(None)
louie.send('UPnT.running_deferred', None, d)
#louie.send('UPnT.running_deferred', None, d)
return d
def checkDiscoveryAnswerPacket(self, header, payload):
......@@ -748,5 +749,5 @@ class Host(log.Loggable):
d = utils.getPage(headers['location'], method='HEAD')
else:
d = utils.getPage(headers['location'])
louie.send('UPnT.running_deferred', None, d)
#louie.send('UPnT.running_deferred', None, d)
return d
......@@ -293,7 +293,7 @@ class Service(log.Loggable):
self.debug('Checking service description from %s' % self._urlBase + self._SCPDURL)
d = utils.getPage(self._urlBase + self._SCPDURL)
louie.send('UPnT.running_deferred', None, d)
#louie.send('UPnT.running_deferred', None, d)
d.addCallback(self.validateDescription)
d.addErrback(self.validateDescriptionFailed, self._urlBase + self._SCPDURL)
......@@ -301,8 +301,9 @@ class Service(log.Loggable):
d.addCallback(self.validateDescriptionContent)
d.addErrback(self.validateDescriptionContentFailed, self._urlBase + self._SCPDURL)
d.addCallback(self.startControlTesting, d)
d.addErrback(self.startControlTestingFailed, self._urlBase + self._SCPDURL, d)
if not self._config.get('GUI', False):
d.addCallback(self.startControlTesting, d)
d.addErrback(self.startControlTestingFailed, self._urlBase + self._SCPDURL, d)
def validateDescription(self, desc):
"""
......@@ -752,7 +753,7 @@ class Service(log.Loggable):
"""
self.serverControl.startTesting()
louie.send('UPnT.ending_deferred', None, d)
#louie.send('UPnT.ending_deferred', None, d)
def startControlTestingFailed(self, failure, url, d):
"""
......@@ -768,7 +769,7 @@ class Service(log.Loggable):
self.info('startControlTestingFailed')
self.info(failure)
louie.send('UPnT.ending_deferred', None, d)
#louie.send('UPnT.ending_deferred', None, d)
def serviceExpired(self):
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.2.2 on Thu Oct 11 22:52:47 2007 by micxer@khitomer-->
<!--Generated with glade3 3.2.2 on Sat Oct 13 16:53:59 2007 by micxer@khitomer-->
<glade-interface>
<widget class="GtkWindow" id="windowMain">
<property name="visible">True</property>
......@@ -23,7 +23,7 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="is_important">True</property>
<property name="label" translatable="yes" comments="Starts tests for selected device">Execute tests</property>
<property name="label" translatable="yes" comments="Starts tests for selected device">Execute Control Tests</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-execute</property>
<signal name="clicked" handler="onExecuteTest"/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment