Example #1
0
 def testNonLocalAddressRevocationAssociation(self):
     myAddress = 'me'
     am = ActorAddressManager(None, myAddress)
     lclAddr, mainAddr = self._makeLocalAndAssociated(myAddress, am)
     am.deadAddress(mainAddr)
     assert mainAddr == am.sendToAddress(lclAddr)
     assert mainAddr == am.sendToAddress(mainAddr)
     assert am.isDeadAddress(lclAddr)
     assert am.isDeadAddress(mainAddr)
     assert am.isDeadAddress(am.sendToAddress(mainAddr))
     assert am.isDeadAddress(am.sendToAddress(lclAddr))
Example #2
0
 def testNonLocalAddressRevocationAssociation(self):
     myAddress = 'me'
     am = ActorAddressManager(None, myAddress)
     lclAddr, mainAddr = self._makeLocalAndAssociated(myAddress, am)
     am.deadAddress(mainAddr)
     assert mainAddr == am.sendToAddress(lclAddr)
     assert mainAddr == am.sendToAddress(mainAddr)
     assert am.isDeadAddress(lclAddr)
     assert am.isDeadAddress(mainAddr)
     assert am.isDeadAddress(am.sendToAddress(mainAddr))
     assert am.isDeadAddress(am.sendToAddress(lclAddr))
Example #3
0
 def testMainAddressRevocation(self):
     myAddress = 'me'
     am = ActorAddressManager(None, myAddress)
     addr = ActorAddress(id(self))
     am.deadAddress(addr)
     assert addr == am.sendToAddress(addr)
     assert am.isDeadAddress(addr)
Example #4
0
 def testMainAddressRevocation(self):
     myAddress = 'me'
     am = ActorAddressManager(None, myAddress)
     addr = ActorAddress(id(self))
     am.deadAddress(addr)
     assert addr == am.sendToAddress(addr)
     assert am.isDeadAddress(addr)
Example #5
0
 def testLocalAddressRevocation(self):
     myAddress = 'me'
     am = ActorAddressManager(None, myAddress)
     lcladdr = am.createLocalAddress()
     am.deadAddress(lcladdr)
     assert am.sendToAddress(lcladdr) is None
     assert am.isDeadAddress(lcladdr)
     assert lcladdr == am.getLocalAddress(
         lcladdr.addressDetails.addressInstanceNum)
Example #6
0
 def testLocalAddressRevocation(self):
     myAddress = 'me'
     am = ActorAddressManager(None, myAddress)
     lcladdr = am.createLocalAddress()
     am.deadAddress(lcladdr)
     assert am.sendToAddress(lcladdr) is None
     assert am.isDeadAddress(lcladdr)
     assert lcladdr == am.getLocalAddress(
         lcladdr.addressDetails.addressInstanceNum)
Example #7
0
    def testAssociatedAddressRevocationIsUnique(self):
        myAddress = 'me'
        am = ActorAddressManager(None, myAddress)
        lclAddr1, mainAddr1 = self._makeLocalAndAssociated(myAddress, am)
        print('1', str(lclAddr1), str(mainAddr1))
        lclAddr2, mainAddr2 = self._makeLocalAndAssociated(myAddress, am)
        print('2', str(lclAddr2), str(mainAddr2))
        lclAddr3, mainAddr3 = self._makeLocalAndAssociated(myAddress, am)
        print('3', str(lclAddr3), str(mainAddr3))

        assert not am.isDeadAddress(lclAddr1)
        assert not am.isDeadAddress(mainAddr1)
        print('1sm', str(am.sendToAddress(mainAddr1)))
        assert not am.isDeadAddress(am.sendToAddress(mainAddr1))
        print('1sl', str(am.sendToAddress(lclAddr1)))
        assert not am.isDeadAddress(am.sendToAddress(lclAddr1))

        assert not am.isDeadAddress(lclAddr2)
        assert not am.isDeadAddress(mainAddr2)
        assert not am.isDeadAddress(am.sendToAddress(mainAddr2))
        assert not am.isDeadAddress(am.sendToAddress(lclAddr2))

        assert not am.isDeadAddress(lclAddr3)
        assert not am.isDeadAddress(mainAddr3)
        assert not am.isDeadAddress(am.sendToAddress(mainAddr3))
        assert not am.isDeadAddress(am.sendToAddress(lclAddr3))

        am.deadAddress(lclAddr1)
        am.deadAddress(mainAddr2)

        assert am.isDeadAddress(lclAddr1)
        assert am.isDeadAddress(mainAddr1)
        assert am.isDeadAddress(am.sendToAddress(mainAddr1))
        assert am.isDeadAddress(am.sendToAddress(lclAddr1))

        assert am.isDeadAddress(lclAddr2)
        assert am.isDeadAddress(mainAddr2)
        assert am.isDeadAddress(am.sendToAddress(mainAddr2))
        assert am.isDeadAddress(am.sendToAddress(lclAddr2))

        assert not am.isDeadAddress(lclAddr3)
        assert not am.isDeadAddress(mainAddr3)
        assert not am.isDeadAddress(am.sendToAddress(mainAddr3))
        assert not am.isDeadAddress(am.sendToAddress(lclAddr3))
Example #8
0
class TestAddressManagerAddressRevocation(unittest.TestCase):
    scope = 'unit'

    def setUp(self):
        self.myAddress = 'me'
        self.am = ActorAddressManager(None, self.myAddress)

    def _makeLocalAndAssociated(self):
        lclAddr = self.am.createLocalAddress()
        mainAddr = ActorAddress(id(lclAddr))
        self.am.associateUseableAddress(
            self.myAddress, lclAddr.addressDetails.addressInstanceNum,
            mainAddr)
        return lclAddr, mainAddr

    def testLocalAddressRevocation(self):
        lcladdr = self.am.createLocalAddress()
        self.am.deadAddress(lcladdr)
        self.assertIsNone(self.am.sendToAddress(lcladdr))
        self.assertTrue(self.am.isDeadAddress(lcladdr))
        self.assertEqual(
            lcladdr,
            self.am.getLocalAddress(lcladdr.addressDetails.addressInstanceNum))

    def testMainAddressRevocation(self):
        addr = ActorAddress(id(self))
        self.am.deadAddress(addr)
        self.assertEqual(addr, self.am.sendToAddress(addr))
        self.assertTrue(self.am.isDeadAddress(addr))

    def testLocalAddressRevocationAssociation(self):
        lclAddr, mainAddr = self._makeLocalAndAssociated()
        self.am.deadAddress(lclAddr)
        self.assertEqual(mainAddr, self.am.sendToAddress(lclAddr))
        self.assertEqual(mainAddr, self.am.sendToAddress(mainAddr))
        self.assertTrue(self.am.isDeadAddress(lclAddr))
        self.assertTrue(self.am.isDeadAddress(mainAddr))
        self.assertTrue(self.am.isDeadAddress(self.am.sendToAddress(mainAddr)))
        self.assertTrue(self.am.isDeadAddress(self.am.sendToAddress(lclAddr)))

    def testNonLocalAddressRevocationAssociation(self):
        lclAddr, mainAddr = self._makeLocalAndAssociated()
        self.am.deadAddress(mainAddr)
        self.assertEqual(mainAddr, self.am.sendToAddress(lclAddr))
        self.assertEqual(mainAddr, self.am.sendToAddress(mainAddr))
        self.assertTrue(self.am.isDeadAddress(lclAddr))
        self.assertTrue(self.am.isDeadAddress(mainAddr))
        self.assertTrue(self.am.isDeadAddress(self.am.sendToAddress(mainAddr)))
        self.assertTrue(self.am.isDeadAddress(self.am.sendToAddress(lclAddr)))

    def testAssociatedAddressRevocationIsUnique(self):
        lclAddr1, mainAddr1 = self._makeLocalAndAssociated()
        lclAddr2, mainAddr2 = self._makeLocalAndAssociated()
        lclAddr3, mainAddr3 = self._makeLocalAndAssociated()

        self.assertFalse(self.am.isDeadAddress(lclAddr1))
        self.assertFalse(self.am.isDeadAddress(mainAddr1))
        self.assertFalse(
            self.am.isDeadAddress(self.am.sendToAddress(mainAddr1)))
        self.assertFalse(self.am.isDeadAddress(
            self.am.sendToAddress(lclAddr1)))

        self.assertFalse(self.am.isDeadAddress(lclAddr2))
        self.assertFalse(self.am.isDeadAddress(mainAddr2))
        self.assertFalse(
            self.am.isDeadAddress(self.am.sendToAddress(mainAddr2)))
        self.assertFalse(self.am.isDeadAddress(
            self.am.sendToAddress(lclAddr2)))

        self.assertFalse(self.am.isDeadAddress(lclAddr3))
        self.assertFalse(self.am.isDeadAddress(mainAddr3))
        self.assertFalse(
            self.am.isDeadAddress(self.am.sendToAddress(mainAddr3)))
        self.assertFalse(self.am.isDeadAddress(
            self.am.sendToAddress(lclAddr3)))

        self.am.deadAddress(lclAddr1)
        self.am.deadAddress(mainAddr2)

        self.assertTrue(self.am.isDeadAddress(lclAddr1))
        self.assertTrue(self.am.isDeadAddress(mainAddr1))
        self.assertTrue(self.am.isDeadAddress(
            self.am.sendToAddress(mainAddr1)))
        self.assertTrue(self.am.isDeadAddress(self.am.sendToAddress(lclAddr1)))

        self.assertTrue(self.am.isDeadAddress(lclAddr2))
        self.assertTrue(self.am.isDeadAddress(mainAddr2))
        self.assertTrue(self.am.isDeadAddress(
            self.am.sendToAddress(mainAddr2)))
        self.assertTrue(self.am.isDeadAddress(self.am.sendToAddress(lclAddr2)))

        self.assertFalse(self.am.isDeadAddress(lclAddr3))
        self.assertFalse(self.am.isDeadAddress(mainAddr3))
        self.assertFalse(
            self.am.isDeadAddress(self.am.sendToAddress(mainAddr3)))
        self.assertFalse(self.am.isDeadAddress(
            self.am.sendToAddress(lclAddr3)))
Example #9
0
    def testAssociatedAddressRevocationIsUnique(self):
        myAddress = 'me'
        am = ActorAddressManager(None, myAddress)
        lclAddr1, mainAddr1 = self._makeLocalAndAssociated(myAddress, am)
        print('1',str(lclAddr1),str(mainAddr1))
        lclAddr2, mainAddr2 = self._makeLocalAndAssociated(myAddress, am)
        print('2',str(lclAddr2),str(mainAddr2))
        lclAddr3, mainAddr3 = self._makeLocalAndAssociated(myAddress, am)
        print('3',str(lclAddr3),str(mainAddr3))

        assert not am.isDeadAddress(lclAddr1)
        assert not am.isDeadAddress(mainAddr1)
        print('1sm',str(am.sendToAddress(mainAddr1)))
        assert not am.isDeadAddress(am.sendToAddress(mainAddr1))
        print('1sl',str(am.sendToAddress(lclAddr1)))
        assert not am.isDeadAddress(am.sendToAddress(lclAddr1))

        assert not am.isDeadAddress(lclAddr2)
        assert not am.isDeadAddress(mainAddr2)
        assert not am.isDeadAddress(am.sendToAddress(mainAddr2))
        assert not am.isDeadAddress(am.sendToAddress(lclAddr2))

        assert not am.isDeadAddress(lclAddr3)
        assert not am.isDeadAddress(mainAddr3)
        assert not am.isDeadAddress(am.sendToAddress(mainAddr3))
        assert not am.isDeadAddress(am.sendToAddress(lclAddr3))

        am.deadAddress(lclAddr1)
        am.deadAddress(mainAddr2)

        assert am.isDeadAddress(lclAddr1)
        assert am.isDeadAddress(mainAddr1)
        assert am.isDeadAddress(am.sendToAddress(mainAddr1))
        assert am.isDeadAddress(am.sendToAddress(lclAddr1))

        assert am.isDeadAddress(lclAddr2)
        assert am.isDeadAddress(mainAddr2)
        assert am.isDeadAddress(am.sendToAddress(mainAddr2))
        assert am.isDeadAddress(am.sendToAddress(lclAddr2))

        assert not am.isDeadAddress(lclAddr3)
        assert not am.isDeadAddress(mainAddr3)
        assert not am.isDeadAddress(am.sendToAddress(mainAddr3))
        assert not am.isDeadAddress(am.sendToAddress(lclAddr3))
class TestAddressManagerAddressRevocation(unittest.TestCase):
    scope='unit'

    def setUp(self):
        self.myAddress = 'me'
        self.am = ActorAddressManager(None, self.myAddress)

    def _makeLocalAndAssociated(self):
        lclAddr = self.am.createLocalAddress()
        mainAddr = ActorAddress(id(lclAddr))
        self.am.associateUseableAddress(self.myAddress,
                                        lclAddr.addressDetails.addressInstanceNum,
                                        mainAddr)
        return lclAddr, mainAddr

    def testLocalAddressRevocation(self):
        lcladdr = self.am.createLocalAddress()
        self.am.deadAddress(lcladdr)
        self.assertIsNone(self.am.sendToAddress(lcladdr))
        self.assertTrue(self.am.isDeadAddress(lcladdr))
        self.assertEqual(lcladdr,
                         self.am.getLocalAddress(lcladdr.addressDetails.addressInstanceNum))

    def testMainAddressRevocation(self):
        addr = ActorAddress(id(self))
        self.am.deadAddress(addr)
        self.assertEqual(addr, self.am.sendToAddress(addr))
        self.assertTrue(self.am.isDeadAddress(addr))

    def testLocalAddressRevocationAssociation(self):
        lclAddr, mainAddr = self._makeLocalAndAssociated()
        self.am.deadAddress(lclAddr)
        self.assertEqual(mainAddr, self.am.sendToAddress(lclAddr))
        self.assertEqual(mainAddr, self.am.sendToAddress(mainAddr))
        self.assertTrue(self.am.isDeadAddress(lclAddr))
        self.assertTrue(self.am.isDeadAddress(mainAddr))
        self.assertTrue(self.am.isDeadAddress(self.am.sendToAddress(mainAddr)))
        self.assertTrue(self.am.isDeadAddress(self.am.sendToAddress(lclAddr)))

    def testNonLocalAddressRevocationAssociation(self):
        lclAddr, mainAddr = self._makeLocalAndAssociated()
        self.am.deadAddress(mainAddr)
        self.assertEqual(mainAddr, self.am.sendToAddress(lclAddr))
        self.assertEqual(mainAddr, self.am.sendToAddress(mainAddr))
        self.assertTrue(self.am.isDeadAddress(lclAddr))
        self.assertTrue(self.am.isDeadAddress(mainAddr))
        self.assertTrue(self.am.isDeadAddress(self.am.sendToAddress(mainAddr)))
        self.assertTrue(self.am.isDeadAddress(self.am.sendToAddress(lclAddr)))

    def testAssociatedAddressRevocationIsUnique(self):
        lclAddr1, mainAddr1 = self._makeLocalAndAssociated()
        lclAddr2, mainAddr2 = self._makeLocalAndAssociated()
        lclAddr3, mainAddr3 = self._makeLocalAndAssociated()

        self.assertFalse(self.am.isDeadAddress(lclAddr1))
        self.assertFalse(self.am.isDeadAddress(mainAddr1))
        self.assertFalse(self.am.isDeadAddress(self.am.sendToAddress(mainAddr1)))
        self.assertFalse(self.am.isDeadAddress(self.am.sendToAddress(lclAddr1)))

        self.assertFalse(self.am.isDeadAddress(lclAddr2))
        self.assertFalse(self.am.isDeadAddress(mainAddr2))
        self.assertFalse(self.am.isDeadAddress(self.am.sendToAddress(mainAddr2)))
        self.assertFalse(self.am.isDeadAddress(self.am.sendToAddress(lclAddr2)))

        self.assertFalse(self.am.isDeadAddress(lclAddr3))
        self.assertFalse(self.am.isDeadAddress(mainAddr3))
        self.assertFalse(self.am.isDeadAddress(self.am.sendToAddress(mainAddr3)))
        self.assertFalse(self.am.isDeadAddress(self.am.sendToAddress(lclAddr3)))

        self.am.deadAddress(lclAddr1)
        self.am.deadAddress(mainAddr2)

        self.assertTrue(self.am.isDeadAddress(lclAddr1))
        self.assertTrue(self.am.isDeadAddress(mainAddr1))
        self.assertTrue(self.am.isDeadAddress(self.am.sendToAddress(mainAddr1)))
        self.assertTrue(self.am.isDeadAddress(self.am.sendToAddress(lclAddr1)))

        self.assertTrue(self.am.isDeadAddress(lclAddr2))
        self.assertTrue(self.am.isDeadAddress(mainAddr2))
        self.assertTrue(self.am.isDeadAddress(self.am.sendToAddress(mainAddr2)))
        self.assertTrue(self.am.isDeadAddress(self.am.sendToAddress(lclAddr2)))

        self.assertFalse(self.am.isDeadAddress(lclAddr3))
        self.assertFalse(self.am.isDeadAddress(mainAddr3))
        self.assertFalse(self.am.isDeadAddress(self.am.sendToAddress(mainAddr3)))
        self.assertFalse(self.am.isDeadAddress(self.am.sendToAddress(lclAddr3)))