def testCreateTestbedClientConfDefault(self):
     conf = TestbedClientConfiguration(2)
     
     self.assertEquals(2, conf.get_id())
     self.assertNotEquals(None, conf.get_port())
     self.assertEquals("", conf.get_base_directory())
     self.assertEquals(32, conf.get_uprate())
     self.assertEquals(32, conf.get_downrate())
     self.assertEquals(0, len(conf.get_leeching_list()))
     self.assertEquals(0, len(conf.get_seeding_list()))
     self.assertEquals("none", conf.get_peer_selection_mode())
     self.assertEquals("none", conf.get_neighbour_selection_mode())
    def testAssertionErrorsOnInvalidArguments(self):
        conf = TestbedClientConfiguration(1)

        self.assertRaises(AssertionError, conf.set_uprate, -1)
        self.assertRaises(AssertionError, conf.set_downrate, -1)
        self.assertRaises(AssertionError, conf.set_port, 1000)
        self.assertRaises(AssertionError, conf.set_peer_selection_mode, "lala")
        self.assertRaises(AssertionError, conf.set_neighbour_selection_mode,
                          "lala")
Ejemplo n.º 3
0
    def testNoConditionObjectPassed(self):
        conf = TestbedConfiguration("test" + os.path.normcase('/'))

        try:
            conf.add_condition(TestbedClientConfiguration(1))
        except AssertionError:
            pass
        else:
            self.fail("Expected an AssertionError")
Ejemplo n.º 4
0
def _build_schema_configuration(parser, section):
    '''Constructs a TestbedClientConfiguration object from a given schema
    section of the deployment file. This object will be used later on to
    parameterize the clients for a specific deployment.
    
    Parameters:
        parser  -- ConfigParser.ConfigParser object that was used to parse
                   a deployment file before.
        section -- String value that represents the name of a concrete
                   schema section of the deployment file.
                   
    Return:
        TestbedClientConfiguration object which holds the information
        associated with the given client configuration schema.
    '''
    cc = TestbedClientConfiguration(-1)
    _set_class_attributes_from_section(cc, parser, section)
    return cc
    def testCreateTestbedClientConfDefault(self):
        conf = TestbedClientConfiguration(2)

        self.assertEquals(2, conf.get_id())
        self.assertNotEquals(None, conf.get_port())
        self.assertEquals("", conf.get_base_directory())
        self.assertEquals(32, conf.get_uprate())
        self.assertEquals(32, conf.get_downrate())
        self.assertEquals(0, len(conf.get_leeching_list()))
        self.assertEquals(0, len(conf.get_seeding_list()))
        self.assertEquals("none", conf.get_peer_selection_mode())
        self.assertEquals("none", conf.get_neighbour_selection_mode())
    def testCreateTestbedClientConf(self):
        conf = TestbedClientConfiguration(id=1,
                                          port=8859,
                                          uprate=64,
                                          downrate=64,
                                          peerSelection="local",
                                          neighbourSelection="local")
        conf.add_file_to_leech(0)
        conf.add_file_to_leech(1)
        conf.add_file_to_seed(2)

        self.assertEquals(1, conf.get_id())
        self.assertEquals(8859, conf.get_port())
        self.assertEquals(64, conf.get_uprate())
        self.assertEquals(64, conf.get_downrate())
        self.assertEquals(0, conf.get_leeching_list()[0])
        self.assertEquals(1, conf.get_leeching_list()[1])
        self.assertEquals(2, conf.get_seeding_list()[0])
        self.assertEquals("local", conf.get_peer_selection_mode())
        self.assertEquals("local", conf.get_neighbour_selection_mode())
 def testCreateTestbedClientConf(self):
     conf = TestbedClientConfiguration(id=1,
                                       port=8859,
                                       uprate=64,
                                       downrate=64,
                                       peerSelection="local",
                                       neighbourSelection="local")
     conf.add_file_to_leech(0)
     conf.add_file_to_leech(1)
     conf.add_file_to_seed(2)
     
     self.assertEquals(1, conf.get_id())
     self.assertEquals(8859, conf.get_port())
     self.assertEquals(64, conf.get_uprate())
     self.assertEquals(64, conf.get_downrate())
     self.assertEquals(0, conf.get_leeching_list()[0])
     self.assertEquals(1, conf.get_leeching_list()[1])
     self.assertEquals(2, conf.get_seeding_list()[0])
     self.assertEquals("local", conf.get_peer_selection_mode())
     self.assertEquals("local", conf.get_neighbour_selection_mode())