changeset 33:fe04ff3547c7

added more sophisticated testing
author gyorgyf
date Tue, 09 Jul 2013 16:30:47 +0100
parents cb57e554ae80
children c35b12f53728 ea2ec5f95ad8
files mcserver/mcserver.py visualclient/visclient.py
diffstat 2 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mcserver/mcserver.py	Tue Jul 09 16:20:08 2013 +0100
+++ b/mcserver/mcserver.py	Tue Jul 09 16:30:47 2013 +0100
@@ -67,8 +67,14 @@
 	# 	return str()
 	
 	@cp.expose
+	def test(self):
+		print "Server test function accessed."
+		cp.log.error("Server test function accessed.")
+		return "Server: Test passed."
+	
+	@cp.expose
 	def mood(self,x,y):
-		print "Received coordinates", x,y, "\n"
+		print "Received coordinates", x,y
 		i = Input(x,y,self.age,self.dist)
 		if i in self.inputs :
 			self.inputs[self.inputs.index(i)].inc()
@@ -114,7 +120,7 @@
 	result = w.stdout.readlines()
 	exitcode = w.wait()
 	if not result : 
-		print "getProcessPid:: Unable to obtain process pid. (lsof returned nothing. exitcode: %s)" %str(exitcode)
+		print "getProcessPid:: Unable to obtain process pid. (lsof returned nothing. exitcode: %s) This is fine in most cases..." %str(exitcode)
 		return False
 	import pprint
 	pprint.pprint(result)
@@ -172,6 +178,7 @@
 	ip = cp.server.socket_host
 	print "Trying to bind: %(ip)s:%(port)s" %locals()
 	getProcessPids(port,kill=True)
+	print "Starting..."
 	cp.quickstart()
 
 if __name__ == "__main__":
--- a/visualclient/visclient.py	Tue Jul 09 16:20:08 2013 +0100
+++ b/visualclient/visclient.py	Tue Jul 09 16:30:47 2013 +0100
@@ -540,11 +540,12 @@
 			
 		try:
 			print "Testing connection."
-			self.conn.putrequest("GET","/moodconductor/index.html", skip_host=True)
+			# self.conn.putrequest("GET","/moodconductor/index.html", skip_host=True)
+			self.conn.putrequest("GET","/moodconductor/test", skip_host=True)
 			self.conn.putheader("Host", "www.isophonics.net")
 			self.conn.endheaders()
 			res = self.conn.getresponse()
-			res.read()
+			print res.read()
 			if res.status == 200 :
 				self.indicators["conn"].on()
 			else :