def test_SendCommand(self):
     tested = server.Server(self.checkInCallback, self.doneCallback, self.progressCallback)
     try:
         tested.listenOnID("eliran")
         talk = talktoserver.TalkToServer(config.AMQP_URL, "eliran")
         tested.provideLabel("eliran", "fake label")
         self.assertEqualsWithinTimeout(talk.label, "fake label")
     finally:
         talk.close()
         tested.close()
 def test_ProvideLabel(self):
     tested = server.Server(self.checkInCallback, self.doneCallback, self.progressCallback)
     try:
         tested.listenOnID("yuvu")
         self.validateCheckIn(tested, "yuvu")
         talk = talktoserver.TalkToServer(config.AMQP_URL, "yuvu")
         tested.provideLabel("yuvu", "thecoolestlabel")
         self.assertEqualsWithinTimeout(talk.label, "thecoolestlabel")
     finally:
         talk.close()
         tested.close()
示例#3
0
 def _initializeNetworkIfNeeded(self):
     if self._args.inauguratorSource == 'network' and \
             not self._args.inauguratorIsNetworkAlreadyConfigured:
         network.Network(macAddress=self._args.inauguratorUseNICWithMAC,
                         ipAddress=self._args.inauguratorIPAddress,
                         netmask=self._args.inauguratorNetmask,
                         gateway=self._args.inauguratorGateway)
         if self._args.inauguratorServerAMQPURL:
             self._talkToServer = talktoserver.TalkToServer(
                 amqpURL=self._args.inauguratorServerAMQPURL,
                 myID=self._args.inauguratorMyIDForServer)
示例#4
0
 def _osmosFromNetwork(self, destination):
     network.Network(macAddress=self._args.inauguratorUseNICWithMAC,
                     ipAddress=self._args.inauguratorIPAddress,
                     netmask=self._args.inauguratorNetmask,
                     gateway=self._args.inauguratorGateway)
     if self._args.inauguratorServerAMQPURL:
         self._talkToServer = talktoserver.TalkToServer(
             amqpURL=self._args.inauguratorServerAMQPURL,
             myID=self._args.inauguratorMyIDForServer)
         self._talkToServer.checkIn()
     osmos = osmose.Osmose(
         destination=destination,
         objectStores=self._args.inauguratorOsmosisObjectStores,
         withLocalObjectStore=self._args.inauguratorWithLocalObjectStore,
         ignoreDirs=self._args.inauguratorIgnoreDirs,
         talkToServer=self._talkToServer)
     if self._args.inauguratorServerAMQPURL:
         self._label = self._talkToServer.label()
     else:
         self._label = self._args.inauguratorNetworkLabel
     osmos.tellLabel(self._label)
     osmos.wait()
 def sendDone(self, id):
     talk = talktoserver.TalkToServer(config.AMQP_URL, id)
     talk.done()
     talk.close()
 def sendProgress(self, id, message):
     talk = talktoserver.TalkToServer(config.AMQP_URL, id)
     talk.progress(message)
     talk.close()
 def sendCheckIn(self, id):
     talk = talktoserver.TalkToServer(config.AMQP_URL, id)
     talk.checkIn()
     talk.close()
 def generateTalkToServer(self, id):
     talkToServer = talktoserver.TalkToServer(config.AMQP_URL, id)
     self.talkToServerInstances.add(talkToServer)
     return talkToServer