Пример #1
0
    def encode(cls, xml):
        #TODO: give messageId an uniq uuid
        #import uuid
        #messageId = str(uuid.uuid1())
        #import re
        #xml = re.sub(r'"messageId">[^<>]+</member>', r'"messageId">'+messageId+r'</member>', xml)

        fromxml = FromXML(xml)
        packet = fromxml.get_packet()
        encoder = AMFEncoder(packet)
        return encoder.encode()
Пример #2
0
	def runEncoderDecoderXML2(self, sample):
		decoder = AMFDecoder(sample)
		packet = decoder.decode()
		toxml = ToXML(packet)
		xml = toxml.get_xml()
		fromxml = FromXML(xml)
		new_packet = fromxml.get_packet()
		encoder = AMFEncoder(new_packet)
		sample2 = encoder.encode()

		decoder = AMFDecoder(sample2)
		packet = decoder.decode()
		toxml = ToXML(packet)
		xml = toxml.get_xml()
		fromxml = FromXML(xml)
		new_packet = fromxml.get_packet()
		encoder = AMFEncoder(new_packet)
		sample3 = encoder.encode()

		self.assertEqual(sample2, sample3)
Пример #3
0
	def runEncoderDecoderXML(self, sample):
		decoder = AMFDecoder(sample)
		packet = decoder.decode()
		toxml = ToXML(packet)
		xml = toxml.get_xml()
		fromxml = FromXML(xml)
		new_packet = fromxml.get_packet()
		encoder = AMFEncoder(new_packet)
		result = encoder.encode()

		self.assertRawPacketEqual(sample, result)
Пример #4
0
    def runEncoderDecoderXML2(self, sample):
        decoder = AMFDecoder(sample)
        packet = decoder.decode()
        toxml = ToXML(packet)
        xml = toxml.get_xml()
        fromxml = FromXML(xml)
        new_packet = fromxml.get_packet()
        encoder = AMFEncoder(new_packet)
        sample2 = encoder.encode()

        decoder = AMFDecoder(sample2)
        packet = decoder.decode()
        toxml = ToXML(packet)
        xml = toxml.get_xml()
        fromxml = FromXML(xml)
        new_packet = fromxml.get_packet()
        encoder = AMFEncoder(new_packet)
        sample3 = encoder.encode()

        self.assertEqual(sample2, sample3)
Пример #5
0
    def runEncoderDecoderXML(self, sample):
        decoder = AMFDecoder(sample)
        packet = decoder.decode()
        toxml = ToXML(packet)
        xml = toxml.get_xml()
        fromxml = FromXML(xml)
        new_packet = fromxml.get_packet()
        encoder = AMFEncoder(new_packet)
        result = encoder.encode()

        self.assertRawPacketEqual(sample, result)
Пример #6
0
	def encode(cls, xml):
		#TODO: give messageId an uniq uuid
		#import uuid
		#messageId = str(uuid.uuid1())
		#import re
		#xml = re.sub(r'"messageId">[^<>]+</member>', r'"messageId">'+messageId+r'</member>', xml)

		fromxml = FromXML(xml)
		packet = fromxml.get_packet()
		encoder = AMFEncoder(packet)
		return encoder.encode()