Exemplo n.º 1
0
	def __runTest2KP(self,test,repetitions,triple):
		# connessione automatica
		smartSpace=SmartSpaceData()
		smartSpace.setSmartSpaceName("X")
		smartSpace.setIPADDR("localhost")
		smartSpace.setPort(10010)

		if not smartSpace.joinSpace():
			sys.exit('Could not join to Smart Space')

		node=smartSpace.getNode()
		ss_handle = smartSpace.getSmartSpace()

		elapsedTime=[]
		if test == "insert":
			for index in range(repetitions):
				qs=node.CreateInsertTransaction(ss_handle)
				start=time.time()
				qs.send(triple, confirm = True)
				elapsedTime.append(time.time()-start)
				node.CloseInsertTransaction(qs)

				qs=node.CreateRemoveTransaction(ss_handle)
				qs.remove(triple, confirm = True)
				node.CloseRemoveTransaction(qs)
		if test == "remove":
			for index in range(repetitions):
				qs=node.CreateInsertTransaction(ss_handle)
				qs.send(triple, confirm = True)
				node.CloseInsertTransaction(qs)

				qs=node.CreateRemoveTransaction(ss_handle)
				start=time.time()
				qs.remove(triple, confirm = True)
				elapsedTime.append(time.time()-start)
				node.CloseRemoveTransaction(qs)
		smartSpace.leaveSpace()
		return sum(elapsedTime)/len(elapsedTime)
Exemplo n.º 2
0
Arquivo: test.py Projeto: h0st/pygcss
	SUBGen.setRDFGraph(RDFGraph)
	SUBGen.setMedia(50)
	SUBGen.setStep(20)
	SUBGen.setTriple(1)
	SUBGen.runTest("insert")
	SUBGen.closeSubscriptions()
	

	## protection performance test ("insert" - "remove")
	#PROTGen=ProtectionsTest(node,ss_handle)
	#PROTGen.setProtectionsNumber(10)
	#PROTGen.setMedia(10)
	#PROTGen.setStep(1)
	#PROTGen.setTriple(1)
	#PROTGen.runTest("insert",1)
	#PROTGen.closeProtections()


	## test lunghezza uri triple inserite
	#URITest=StringTest(node,ss_handle)
	#URITest.setMedia(10)
	#URITest.runTest(10000)


	smartSpace.leaveSpace()
	print "leave SIB..."