Ejemplo n.º 1
0
 def test_get(self):
     rp_context = get_debug_test_context(is_standalone, manager_port_host,
                                         egg_port_host, transfer_port_host,
                                         'testing')
     context = RollSiteContext("atest",
                               self_role='host',
                               self_partyId=host_partyId,
                               rs_ip=host_ip,
                               rs_port=host_rs_port,
                               rp_ctx=rp_context)
     _tag = "Hello2"
     rs = context.load(name="RsaIntersectTransferVariable.rsa_pubkey",
                       tag="{}".format(_tag))
     futures = rs.pull(get_parties)
     for future in futures:
         obj = future.result()
         if isinstance(obj, RollPair):
             key = 'hello'
             print("obj:", obj.get(key))
         else:
             print("obj:", obj)
Ejemplo n.º 2
0
    def test_get_rollpair(self):
        rp_context = get_debug_test_context(is_standalone, manager_port_host,
                                            egg_port_host, transfer_port_host,
                                            'testing')
        context = RollSiteContext("atest2",
                                  self_role='host',
                                  self_partyId=host_partyId,
                                  rs_ip=host_ip,
                                  rs_port=host_rs_port,
                                  rp_ctx=rp_context)

        _tag = "roll_pair_tag"
        rs = context.load(name="roll_pair_name.table", tag="{}".format(_tag))
        futures = rs.pull(get_parties)
        for future in futures:
            obj = future.result()
            if isinstance(obj, RollPair):
                key = "k1"
                print("obj:", obj.get(key))
            else:
                print("obj:", obj)
Ejemplo n.º 3
0
    def test_remote(self):
        rp_context = get_debug_test_context(is_standalone, manager_port_guest,
                                            egg_port_guest,
                                            transfer_port_guest,
                                            'testing_guest')
        context = RollSiteContext("atest",
                                  self_role='guest',
                                  self_partyId=guest_partyId,
                                  rs_ip=guest_ip,
                                  rs_port=guest_rs_port,
                                  rp_ctx=rp_context)

        _tag = "Hello2"
        rs = context.load(name="RsaIntersectTransferVariable.rsa_pubkey",
                          tag="{}".format(_tag))
        fp = open("testA.model", 'r')
        obj = fp.read(35)
        futures = rs.push(obj, remote_parties)
        fp.close()
        for future in futures:
            role, party = future.result()
            print("result:", role, party)
Ejemplo n.º 4
0
    def test_remote_rollpair(self):
        rp_context = get_debug_test_context(is_standalone, manager_port_guest,
                                            egg_port_guest,
                                            transfer_port_guest,
                                            'testing_guest')
        data = [("k1", "v1"), ("k2", "v2"), ("k3", "v3"), ("k4", "v4"),
                ("k5", "v5"), ("k6", "v6")]
        context = RollSiteContext("atest2",
                                  self_role='guest',
                                  self_partyId=guest_partyId,
                                  rs_ip=guest_ip,
                                  rs_port=guest_rs_port,
                                  rp_ctx=rp_context)

        rp_options = {'include_key': True}
        rp = rp_context.load("namespace", "name").put_all(data,
                                                          options=rp_options)
        _tag = "Hello"
        rs = context.load(name="roll_pair_name.table", tag="roll_pair_tag")
        futures = rs.push(rp, remote_parties)
        for future in futures:
            role, party = future.result()
            print("result:", role, party)