Example #1
0
 def testComponentWithPlug(self):
     c = Component()
     c.name = 'name'
     c.componentType = 'streamer'
     c.worker = 'worker'
     plug = Plug()
     plug.plugType = 'plug-type'
     plug.properties.foo = 'bar'
     c.plugs.append(plug)
     writer = ConfigurationWriter('flow', [c], [])
     testsuite.diffStrings(
         ('<planet>\n'
          '  <flow name="flow">\n'
          '    <component name="name"\n'
          '               type="streamer"\n'
          '               project="flumotion"\n'
          '               worker="worker"\n'
          '               version="%(version)s">\n'
          '      \n'
          '      <plugs>\n'
          '        <plug type="plug-type">\n'
          '          \n'
          '          <property name="foo">bar</property>\n'
          '        </plug>\n'
          '      </plugs>\n'
          '    </component>\n'
          '  </flow>\n'
          '</planet>\n' % dict(version=configure.version)),
         writer.getXML())
Example #2
0
 def testComponentWithPlug(self):
     c = Component()
     c.name = 'name'
     c.componentType = 'streamer'
     c.worker = 'worker'
     plug = Plug()
     plug.plugType = 'plug-type'
     plug.properties.foo = 'bar'
     c.plugs.append(plug)
     writer = ConfigurationWriter('flow', [c], [])
     testsuite.diffStrings(
         XMLWriter.encoding + \
         ('<planet>\n'
          '  <flow name="flow">\n'
          '    <component name="name"\n'
          '               type="streamer"\n'
          '               project="flumotion"\n'
          '               worker="worker"\n'
          '               version="%(version)s">\n'
          '      \n'
          '      <plugs>\n'
          '        <plug type="plug-type">\n'
          '          \n'
          '          <property name="foo">bar</property>\n'
          '        </plug>\n'
          '      </plugs>\n'
          '    </component>\n'
          '  </flow>\n'
          '</planet>\n' % dict(version=configure.version)),
         writer.getXML())
Example #3
0
    def testComponentWithFeeders(self):
        c1 = Component()
        c1.name = 'name'
        c1.componentType = 'first'
        c1.worker = 'worker'
        c2 = Component()
        c2.name = 'name'
        c2.componentType = 'second'
        c2.worker = 'worker'
        c2.link(c1)

        writer = ConfigurationWriter('flow', [c1, c2], [])
        testsuite.diffStrings(
            ('<planet>\n'
             '  <flow name="flow">\n'
             '    <component name="name"\n'
             '               type="first"\n'
             '               project="flumotion"\n'
             '               worker="worker"\n'
             '               version="%(version)s">\n'
             '      <eater name="default">\n'
             '        <feed>name</feed>\n'
             '      </eater>\n'
             '    </component>\n'
             '    <component name="name"\n'
             '               type="second"\n'
             '               project="flumotion"\n'
             '               worker="worker"\n'
             '               version="%(version)s">\n'
             '    </component>\n'
             '  </flow>\n'
             '</planet>\n' % dict(version=configure.version)),
            writer.getXML())
Example #4
0
 def testEmpty(self):
     writer = ConfigurationWriter('', [], [])
     testsuite.diffStrings(
         XMLWriter.encoding + \
         ("<planet>\n"
          "</planet>\n"),
         writer.getXML())
Example #5
0
    def testComponentWithFeeders(self):
        c1 = Component()
        c1.name = 'name'
        c1.componentType = 'first'
        c1.worker = 'worker'
        c2 = Component()
        c2.name = 'name'
        c2.componentType = 'second'
        c2.worker = 'worker'
        c2.link(c1)

        writer = ConfigurationWriter('flow', [c1, c2], [])
        testsuite.diffStrings(
            XMLWriter.encoding + \
            ('<planet>\n'
             '  <flow name="flow">\n'
             '    <component name="name"\n'
             '               type="first"\n'
             '               project="flumotion"\n'
             '               worker="worker"\n'
             '               version="%(version)s">\n'
             '      <eater name="default">\n'
             '        <feed>name</feed>\n'
             '      </eater>\n'
             '    </component>\n'
             '    <component name="name"\n'
             '               type="second"\n'
             '               project="flumotion"\n'
             '               worker="worker"\n'
             '               version="%(version)s">\n'
             '    </component>\n'
             '  </flow>\n'
             '</planet>\n' % dict(version=configure.version)),
            writer.getXML())
 def testEmpty(self):
     writer = ConfigurationWriter('', [], [])
     testsuite.diffStrings(
         XMLWriter.encoding + \
         ("<planet>\n"
          "</planet>\n"),
         writer.getXML())
Example #7
0
    def getXML(self):
        """Creates an XML configuration of the state set
        @returns: the xml configuration
        @rtype: string
        """
        self._handleProducers()
        self._handleMuxers()
        # Naming conflicts can only be solved after the rest is done,
        # since some components might get removed
        self._resolveNameConflicts()
        self._validateComponents()

        writer = ConfigurationWriter(self._flowName,
                                     self._flowComponents,
                                     self._atmosphereComponents)
        xml = writer.getXML()
        return xml
Example #8
0
 def testFlowComponent(self):
     c = Component()
     c.name = 'name'
     c.componentType = 'streamer'
     c.worker = 'worker'
     writer = ConfigurationWriter('flow', [c], [])
     testsuite.diffStrings(
         ('<planet>\n'
          '  <flow name="flow">\n'
          '    <component name="name"\n'
          '               type="streamer"\n'
          '               project="flumotion"\n'
          '               worker="worker"\n'
          '               version="%(version)s">\n'
          '    </component>\n'
          '  </flow>\n'
          '</planet>\n' % dict(version=configure.version)),
         writer.getXML())
Example #9
0
 def testFlowComponent(self):
     c = Component()
     c.name = 'name'
     c.componentType = 'streamer'
     c.worker = 'worker'
     writer = ConfigurationWriter('flow', [c], [])
     testsuite.diffStrings(
         XMLWriter.encoding + \
         ('<planet>\n'
          '  <flow name="flow">\n'
          '    <component name="name"\n'
          '               type="streamer"\n'
          '               project="flumotion"\n'
          '               worker="worker"\n'
          '               version="%(version)s">\n'
          '    </component>\n'
          '  </flow>\n'
          '</planet>\n' % dict(version=configure.version)),
         writer.getXML())
Example #10
0
    def getXML(self):
        """Creates an XML configuration of the state set
        @returns: the xml configuration
        @rtype: string
        """
        if self._confXml:
            return self._confXml

        self._handleProducers()
        self._handleMuxers()
        # Naming conflicts can only be solved after the rest is done,
        # since some components might get removed
        self._resolveNameConflicts()
        self._validateComponents()

        writer = ConfigurationWriter(self._flowName, self._flowComponents,
                                     self._atmosphereComponents)
        xml = writer.getXML()
        return xml
Example #11
0
 def testAtmosphereComponent(self):
     c = Component()
     c.name = 'name'
     c.componentType = 'streamer'
     c.worker = 'worker'
     c.properties.foo = 'bar'
     writer = ConfigurationWriter('', [], [c])
     testsuite.diffStrings(
         ('<planet>\n'
          '  <atmosphere>\n'
          '    <component name="name"\n'
          '               type="streamer"\n'
          '               project="flumotion"\n'
          '               worker="worker"\n'
          '               version="%(version)s">\n'
          '      \n'
          '      <property name="foo">bar</property>\n'
          '    </component>\n'
          '  </atmosphere>\n'
          '</planet>\n' % dict(version=configure.version)),
         writer.getXML())
Example #12
0
 def testAtmosphereComponent(self):
     c = Component()
     c.name = 'name'
     c.componentType = 'streamer'
     c.worker = 'worker'
     c.properties.foo = 'bar'
     writer = ConfigurationWriter('', [], [c])
     testsuite.diffStrings(
         XMLWriter.encoding + \
         ('<planet>\n'
          '  <atmosphere>\n'
          '    <component name="name"\n'
          '               type="streamer"\n'
          '               project="flumotion"\n'
          '               worker="worker"\n'
          '               version="%(version)s">\n'
          '      \n'
          '      <property name="foo">bar</property>\n'
          '    </component>\n'
          '  </atmosphere>\n'
          '</planet>\n' % dict(version=configure.version)),
         writer.getXML())