コード例 #1
0
 def testParseSimple(self):
     f = self._buildPlanet('')
     config = PlanetConfigParser(f)
     config.parse()
     self.failIf(config.flows)
     self.failIf(config.path)
     self.failIf(config.atmosphere.components)
コード例 #2
0
 def testParseSimple(self):
     f = self._buildPlanet('')
     config = PlanetConfigParser(f)
     config.parse()
     self.failIf(config.flows)
     self.failIf(config.path)
     self.failIf(config.atmosphere.components)
コード例 #3
0
 def testParseAtmosphereWithComponent(self):
     f = self._buildAtmosphere(
         '<component name="cname" type="http-server" worker="worker"/>')
     config = PlanetConfigParser(f)
     config.parse()
     components = config.atmosphere.components
     self.failUnless(components)
     self.failUnless('cname' in components)
     component = components.pop('cname')
     self.failUnless(component)
     self.failUnless(isinstance(component, ConfigEntryComponent))
     self.assertEquals(component.worker, 'worker')
     self.assertEquals(component.type, 'http-server')
     self.assertEquals(component.config['avatarId'], '/atmosphere/cname')
     self.failIf(flatten(component.config['plugs'].values()))
コード例 #4
0
 def testParseAtmosphereWithComponent(self):
     f = self._buildAtmosphere(
         '<component name="cname" type="http-server" worker="worker"/>')
     config = PlanetConfigParser(f)
     config.parse()
     components = config.atmosphere.components
     self.failUnless(components)
     self.failUnless('cname' in components)
     component = components.pop('cname')
     self.failUnless(component)
     self.failUnless(isinstance(component, ConfigEntryComponent))
     self.assertEquals(component.worker, 'worker')
     self.assertEquals(component.type, 'http-server')
     self.assertEquals(component.config['avatarId'], '/atmosphere/cname')
     self.failIf(flatten(component.config['plugs'].values()))
コード例 #5
0
 def testParseAtmosphereInvalid(self):
     f = self._buildAtmosphere(
         '<component name="cname" type="http-server" worker="worker">'
         '  <clock-master>true</clock-master>'
         '</component>')
     config = PlanetConfigParser(f)
     self.assertRaises(ConfigError, config.parse)
コード例 #6
0
    def testParseFlowInvalid(self):
        # missing name
        f = self._buildPlanet('<flow/>')
        config = PlanetConfigParser(f)
        self.assertRaises(ConfigError, config.parse)

        # invalid name
        for name in ['atmosphere', 'manager']:
            f = self._buildFlow('', name=name)
            config = PlanetConfigParser(f)
            self.assertRaises(ConfigError, config.parse)

        # multiple clock master
        f = self._buildFlow(
            '<component name="one" type="http-server" worker="worker">'
            '  <clock-master>true</clock-master>'
            '</component>'
            '<component name="two" type="http-server" worker="worker">'
            '  <clock-master>true</clock-master>'
            '</component>')
        config = PlanetConfigParser(f)
        self.assertRaises(ConfigError, config.parse)
コード例 #7
0
 def testParseFlow(self):
     f = self._buildFlow(
         '<component name="audio" type="audiotest-producer" '
         'worker="worker">'
         '  <clock-master>true</clock-master>'
         '</component>'
         '<component name="video" type="videotest-producer" '
         'worker="worker">'
         '</component>')
     config = PlanetConfigParser(f)
     config.parse()
     self.failUnless(config.flows)
     self.assertEquals(len(config.flows), 1)
     components = config.flows[0].components
     self.failUnless(components)
     self.failUnless('video' in components)
     component = components.pop('audio')
     self.assertEquals(component.type, 'audiotest-producer')
     self.assertEquals(component.config['clock-master'], '/flow/audio')
     component = components.pop('video')
     self.assertEquals(component.type, 'videotest-producer')
     self.assertEquals(component.config['clock-master'], '/flow/audio')
     self.failIf(components)
コード例 #8
0
 def testParseFlow(self):
     f = self._buildFlow(
         '<component name="audio" type="audiotest-producer" '
         'worker="worker">'
         '  <clock-master>true</clock-master>'
         '</component>'
         '<component name="video" type="videotest-producer" '
         'worker="worker">'
         '</component>')
     config = PlanetConfigParser(f)
     config.parse()
     self.failUnless(config.flows)
     self.assertEquals(len(config.flows), 1)
     components = config.flows[0].components
     self.failUnless(components)
     self.failUnless('video' in components)
     component = components.pop('audio')
     self.assertEquals(component.type, 'audiotest-producer')
     self.assertEquals(component.config['clock-master'], '/flow/audio')
     component = components.pop('video')
     self.assertEquals(component.type, 'videotest-producer')
     self.assertEquals(component.config['clock-master'], '/flow/audio')
     self.failIf(components)
コード例 #9
0
 def testParseAtmosphereEmpty(self):
     f = self._buildAtmosphere('')
     config = PlanetConfigParser(f)
     config.parse()
     self.failIf(config.atmosphere.components)
コード例 #10
0
 def testParseAtmosphereEmpty(self):
     f = self._buildAtmosphere('')
     config = PlanetConfigParser(f)
     config.parse()
     self.failIf(config.atmosphere.components)
コード例 #11
0
 def testParseInvalid(self):
     f = StringIO("<xxx/>")
     config = PlanetConfigParser(f)
     self.assertRaises(ConfigError, config.parse)