示例#1
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)

        # Enable buddycast and crawler handling
        self.config.set_buddycast(True)
        self.config.set_crawler(True)
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     # Enable buddycast
     self.config.set_buddycast(True)
     self.config.set_start_recommender(True)
     self.config.set_bartercast(True)
 def setUpPreSession(self):
     """ override TestAsServer """
     print >> sys.stderr,"test: Pre Tribler Init"
     TestAsServer.setUpPreSession(self)
     print >> sys.stderr,"test: Pre Tribler Init: config_path",self.config_path
     # Enable remote querying
     self.config.set_remote_query(True)
示例#4
0
 def setUpPreSession(self):
     """ override TestAsServer """
     print >> sys.stderr, "test: Pre Tribler Init"
     TestAsServer.setUpPreSession(self)
     print >> sys.stderr, "test: Pre Tribler Init: config_path", self.config_path
     # Enable remote querying
     self.config.set_remote_query(True)
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     # Enable buddycast
     self.config.set_buddycast(True)
     self.config.set_start_recommender(True)
     self.config.set_bartercast(True)
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     
     self.config.set_overlay(False)
     self.config.set_internal_tracker(True)
     
     self.mylistenport = 4810
示例#7
0
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     
     self.config.set_megacache(False)        
     self.config.set_internal_tracker(True)
     #self.config.set_tracker_nat_check(0)
     
     self.mylistenport = 4810
    def setUpPreSession(self):
        """ override TestAsServer """
        print >> sys.stderr,"test: Pre Tribler Init"
        TestAsServer.setUpPreSession(self)
        print >> sys.stderr,"test: Pre Tribler Init: config_path",self.config_path
        # Enable dialback support
        self.config.set_dialback(True)
        self.config.set_buddycast(True) # make sure overlay connections are being made
        self.config.set_start_recommender(True)

        # Write superpeers.txt
        self.install_path = tempfile.mkdtemp()
        spdir = os.path.join(self.install_path, LIBRARYNAME, 'Core')
        os.makedirs(spdir)

        statsdir = os.path.join(self.install_path, LIBRARYNAME, 'Core', 'Statistics')
        os.makedirs(statsdir)
        
        superpeerfilename = os.path.join(spdir, 'superpeer.txt')
        print >> sys.stderr,"test: writing",self.NLISTENERS,"superpeers to",superpeerfilename
        f = open(superpeerfilename, "w")

        self.mylistenport = []
        self.myss = []
        self.mykeypairs = []
        self.mypermids = []
        for i in range(self.NLISTENERS):
            # Start our server side, to with Tribler will try to connect
            self.mylistenport.append(4810+i)
            self.myss.append(socket.socket(socket.AF_INET, socket.SOCK_STREAM))
            self.myss[i].setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
            self.myss[i].bind(('', self.mylistenport[i]))
            self.myss[i].listen(1)

            self.mykeypairs.append(EC.gen_params(EC.NID_sect233k1))
            self.mykeypairs[i].gen_key()
            self.mypermids.append(str(self.mykeypairs[i].pub().get_der()))

            content = '127.0.0.1, '+str(self.mylistenport[i])+', '+show_permid(self.mypermids[i])+', FakeSuperPeer\n'
            f.write(content)
        f.close()
        
        self.config.set_install_dir(self.install_path)
        
        srcfiles = []
        srcfiles.append(os.path.join(LIBRARYNAME,"schema_sdb_v"+str(CURRENT_MAIN_DB_VERSION)+".sql"))
        srcfiles.append(os.path.join(LIBRARYNAME,"Core","Statistics","tribler_seedingstats_sdb.sql"))
        srcfiles.append(os.path.join(LIBRARYNAME,"Core","Statistics","tribler_friendship_stats_sdb.sql"))
        srcfiles.append(os.path.join(LIBRARYNAME,"Core","Statistics","tribler_videoplayback_stats.sql"))
        for srcfile in srcfiles:
            sfn = os.path.join('..','..',srcfile)
            dfn = os.path.join(self.install_path,srcfile)
            print >>sys.stderr,"test: copying",sfn,dfn
            shutil.copyfile(sfn,dfn)

        """
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)

        # Enable dialback
        self.config.set_dialback(True)
        # H4X0R: testing only
        self.config.sessconfig['dialback_active'] = 0

        self.setUpMyListenSocket()
示例#10
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)

        # Enable dialback
        self.config.set_dialback(True)
        # H4X0R: testing only
        self.config.sessconfig['dialback_active'] = 0

        self.setUpMyListenSocket()
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     # BuddyCast
     self.config.set_buddycast(True)
     self.config.set_start_recommender(True)
     
     fd,self.superpeerfilename = tempfile.mkstemp()
     os.write(fd,'')
     os.close(fd)
     self.config.set_superpeer_file(self.superpeerfilename)
示例#12
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)
        # BuddyCast
        self.config.set_buddycast(True)
        self.config.set_start_recommender(True)

        fd, self.superpeerfilename = tempfile.mkstemp()
        os.write(fd, '')
        os.close(fd)
        self.config.set_superpeer_file(self.superpeerfilename)
示例#13
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)
        # Enable social networking
        self.config.set_social_networking(True)

        # Give him a usericon to send
        fn = self.make_filename('usericon-ok.jpg')
        f = open(fn, "rb")
        data = f.read()
        f.close()
        self.config.set_mugshot(data, 'image/jpeg')
示例#14
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)
        # Enable social networking
        self.config.set_social_networking(True)

        # Give him a usericon to send
        fn = self.make_filename('usericon-ok.jpg')
        f = open(fn,"rb")
        data = f.read()
        f.close()
        self.config.set_mugshot(data,'image/jpeg')
示例#15
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)

        self.setUpMyListenSockets()
        
        # Must be changed in test/extend_hs_dir/proxyservice.test.torrent as well
        self.mytrackerport = 4901
        self.myid = 'R410-----HgUyPu56789'
        self.mytracker = MyTracker(self.mytrackerport,self.myid,'127.0.0.1',self.mylistenport)
        self.mytracker.background_serve()

        self.myid2 = 'R410-----56789HuGyx0'
示例#16
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)
        self.config.set_buddycast(True)
        BuddyCastCore.TESTASSERVER = True
        ChannelCastCore.TESTASSERVER = True
        VoteCastCore.TESTASSERVER = True
        self.config.set_start_recommender(True)
        self.config.set_bartercast(True) 
        self.config.set_remote_query(True)
        self.config.set_crawler(False)       
        self.config.set_torrent_collecting_dir(os.path.join(self.config_path, "tmp_torrent_collecting"))
        
        self.collecting_dir = os.path.join(self.config_path, "temp_subtitles_collecting")
        os.makedirs(self.collecting_dir)
        self.config.set_subtitles_collecting(True)
        self.config.set_subtitles_collecting_dir(self.collecting_dir)
        
        

#        # Write superpeers.txt and DB schema
        self.install_path = tempfile.mkdtemp()
        spdir = os.path.join(self.install_path, LIBRARYNAME, 'Core')
        os.makedirs(spdir)

        statsdir = os.path.join(self.install_path, LIBRARYNAME, 'Core', 'Statistics')
        os.makedirs(statsdir)
        
        superpeerfilename = os.path.join(spdir, 'superpeer.txt')
        print >> sys.stderr,time.asctime(),'-', "test: writing empty superpeers to",superpeerfilename
        f = open(superpeerfilename, "w")
        f.write('# Leeg')
        f.close()

        self.config.set_install_dir(self.install_path)
        
        srcfiles = []
        srcfiles.append(os.path.join(LIBRARYNAME,"schema_sdb_v5.sql"))
        for srcfile in srcfiles:
            sfn = os.path.join('..','..',srcfile)
            dfn = os.path.join(self.install_path,srcfile)
            print >>sys.stderr,time.asctime(),'-', "test: copying",sfn,dfn
            shutil.copyfile(sfn,dfn)
            
        #copy subtitles files in the appropriate subtitles folder
        self.src1 = os.path.join(RES_DIR,'fake.srt')
        self.src2 = os.path.join(RES_DIR,'fake0.srt')
示例#17
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)

        self.setUpMyListenSockets()
        
        # Must be changed in test/extend_hs_dir/dummydata.merkle.torrent as well
        self.mytrackerport = 4901
        self.myid = 'R410-----HgUyPu56789'
        self.mytracker = MyTracker(self.mytrackerport,self.myid,'127.0.0.1',self.mylistenport)
        self.mytracker.background_serve()

        self.myid2 = 'R410-----56789HuGyx0'
        
        # Arno, 2009-12-15: Make sure coop downloads have their own destdir
        destdir = tempfile.mkdtemp()
        self.config.set_download_help_dir(destdir)
示例#18
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)

        # Start our server side, to with Tribler will try to connect
        self.mylistenport = 4810
        self.myss = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.myss.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        self.myss.bind(('', self.mylistenport))
        self.myss.listen(1)
        
        # Must be changed in test/extend_hs_dir/dummydata.merkle.torrent as well
        self.mytrackerport = 4901
        self.myid = 'R410-----HgUyPu56789'
        self.mytracker = MyTracker(self.mytrackerport,self.myid,'127.0.0.1',self.mylistenport)
        self.mytracker.background_serve()

        self.myid2 = 'R410-----56789HuGyx0'
示例#19
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)

        self.setUpMyListenSockets()

        # Must be changed in test/extend_hs_dir/dummydata.merkle.torrent as well
        self.mytrackerport = 4901
        self.myid = 'R410-----HgUyPu56789'
        self.mytracker = MyTracker(self.mytrackerport, self.myid, '127.0.0.1',
                                   self.mylistenport)
        self.mytracker.background_serve()

        self.myid2 = 'R410-----56789HuGyx0'

        # Arno, 2009-12-15: Make sure coop downloads have their own destdir
        destdir = tempfile.mkdtemp()
        self.config.set_download_help_dir(destdir)
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)

        self.setUpMyListenSockets()
        
        # Must be changed in test/extend_hs_dir/proxyservice.test.torrent as well
        self.mytrackerport = 4901
        self.myid = 'R410-----HgUyPu56789'
        self.mytracker = MyTracker(self.mytrackerport,self.myid,'127.0.0.1',self.mylistenport)
        self.mytracker.background_serve()

        self.myid2 = 'R410-----56789HuGyx0' # used for the coordinator
        
        # Arno, 2009-12-15: Make sure coop downloads have their own destdir
        destdir = tempfile.mkdtemp()
        self.config.set_download_help_dir(destdir)
        
        # Set the proxyservice to full speed
        self.config.set_proxyservice_status(1) #PROXYSERVICE_ON=1
示例#21
0
    def setUpPreSession(self):
        """ override TestAsServer """
        TestAsServer.setUpPreSession(self)
        # Enable buddycast
        self.config.set_buddycast(True)
        BuddyCastCore.TESTASSERVER = True
        self.config.set_start_recommender(True)
        self.config.set_bartercast(True)
        
        # Arno, 2010-02-02: Install empty superpeers.txt so no interference from 
        # real BuddyCast.
        self.config.set_crawler(False)
        
        # Write superpeers.txt
        self.install_path = tempfile.mkdtemp()
        spdir = os.path.join(self.install_path, LIBRARYNAME, 'Core')
        os.makedirs(spdir)

        statsdir = os.path.join(self.install_path, LIBRARYNAME, 'Core', 'Statistics')
        os.makedirs(statsdir)
        
        superpeerfilename = os.path.join(spdir, 'superpeer.txt')
        print >> sys.stderr,"test: writing empty superpeers to",superpeerfilename
        f = open(superpeerfilename, "w")
        f.write('# Leeg')
        f.close()

        self.config.set_install_dir(self.install_path)
        
        srcfiles = []
        srcfiles.append(os.path.join(LIBRARYNAME,"schema_sdb_v"+str(CURRENT_MAIN_DB_VERSION)+".sql"))
        for srcfile in srcfiles:
            sfn = os.path.join('..','..',srcfile)
            dfn = os.path.join(self.install_path,srcfile)
            print >>sys.stderr,"test: copying",sfn,dfn
            shutil.copyfile(sfn,dfn)
示例#22
0
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     # Enable buddycast
     self.config.set_buddycast(True)
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     # Enable buddycast
     self.config.set_buddycast(True)
示例#25
0
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     # FRIENDSHIP
     self.config.set_social_networking(True)
示例#26
0
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     # Enable remote query
     self.config.set_remote_query(True)
     self.config.set_torrent_collecting_dir(os.path.join(self.config_path, "tmp_torrent_collecting"))
示例#27
0
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     self.config.set_overlay(False)
     self.config.set_megacache(False)
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     # Enable remote query
     self.config.set_remote_query(True)
     self.config.set_torrent_collecting_dir(os.path.join(self.config_path, "tmp_torrent_collecting"))
示例#30
0
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     self.config.set_overlay(False)
     self.config.set_megacache(False)
示例#31
0
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     # FRIENDSHIP
     self.config.set_social_networking(True)
    def setUpPreSession(self):
        """ override TestAsServer """
        print >> sys.stderr, "test: Pre Tribler Init"
        TestAsServer.setUpPreSession(self)
        print >> sys.stderr, "test: Pre Tribler Init: config_path", self.config_path
        # Enable dialback support
        self.config.set_dialback(True)
        self.config.set_buddycast(
            True)  # make sure overlay connections are being made
        self.config.set_start_recommender(True)

        # Write superpeers.txt
        self.install_path = tempfile.mkdtemp()
        spdir = os.path.join(self.install_path, LIBRARYNAME, 'Core')
        os.makedirs(spdir)

        statsdir = os.path.join(self.install_path, LIBRARYNAME, 'Core',
                                'Statistics')
        os.makedirs(statsdir)

        superpeerfilename = os.path.join(spdir, 'superpeer.txt')
        print >> sys.stderr, "test: writing", self.NLISTENERS, "superpeers to", superpeerfilename
        f = open(superpeerfilename, "w")

        self.mylistenport = []
        self.myss = []
        self.mykeypairs = []
        self.mypermids = []
        for i in range(self.NLISTENERS):
            # Start our server side, to with Tribler will try to connect
            self.mylistenport.append(4810 + i)
            self.myss.append(socket.socket(socket.AF_INET, socket.SOCK_STREAM))
            self.myss[i].setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
            self.myss[i].bind(('', self.mylistenport[i]))
            self.myss[i].listen(1)

            self.mykeypairs.append(EC.gen_params(EC.NID_sect233k1))
            self.mykeypairs[i].gen_key()
            self.mypermids.append(str(self.mykeypairs[i].pub().get_der()))

            content = '127.0.0.1, ' + str(
                self.mylistenport[i]) + ', ' + show_permid(
                    self.mypermids[i]) + ', FakeSuperPeer\n'
            f.write(content)
        f.close()

        self.config.set_install_dir(self.install_path)

        srcfiles = []
        srcfiles.append(os.path.join(LIBRARYNAME, "schema_sdb_v4.sql"))
        srcfiles.append(
            os.path.join(LIBRARYNAME, "Core", "Statistics",
                         "tribler_seedingstats_sdb.sql"))
        srcfiles.append(
            os.path.join(LIBRARYNAME, "Core", "Statistics",
                         "tribler_friendship_stats_sdb.sql"))
        srcfiles.append(
            os.path.join(LIBRARYNAME, "Core", "Statistics",
                         "tribler_videoplayback_stats.sql"))
        for srcfile in srcfiles:
            sfn = os.path.join('..', '..', srcfile)
            dfn = os.path.join(self.install_path, srcfile)
            print >> sys.stderr, "test: copying", sfn, dfn
            shutil.copyfile(sfn, dfn)
        """
示例#33
0
 def setUpPreSession(self):
     """ override TestAsServer """
     TestAsServer.setUpPreSession(self)
     
     self.config.set_megacache(False)
     self.config.set_internal_tracker(True)