Package tahrir

Examples of tahrir.TrNode$PrivateNodeId


*/
public class GUIMain {

        public static void main(final String[] args) {
            try {
                final TrNode testNode = TrUtils.TestUtils.makeNode(9003, false, false, false, true, 0, 0);

                final TrMainWindow mainWindow = new TrMainWindow(testNode, "Default");
                mainWindow.getContentPanel().revalidate();

                /*if(testNode.mbClasses.identityStore.labelsOfUser.keySet().isEmpty()){
 
View Full Code Here


    setTrConfig(trCfg1);

    final TrNodeConfig trCfg2 = new TrNodeConfig();
    setTrConfig(trCfg2);

    final TrNode node1 = new TrNode(TestUtils.createTempDirectory(), trCfg1);
    final TrSessionManager sessionMgr1 = new TrSessionManager(node1, iface1, false);

    sessionMgr1.registerSessionClass(TestSession.class, TestSessionImpl.class);

    final TrNode node2 = new TrNode(TestUtils.createTempDirectory(), trCfg2);
    final TrSessionManager sessionMgr2 = new TrSessionManager(node2, iface2, false);

    sessionMgr2.registerSessionClass(TestSession.class, TestSessionImpl.class);

    final TrRemoteConnection one2two = sessionMgr1.connectionManager.getConnection(
View Full Code Here


    @Test
  public void simpleTextTest() throws Exception {

            TrNode node = TrUtils.TestUtils.makeNode(9003, false, false, false, true, 0, 0);

    String xml = "<?xml version=\"1.0\"?>\n<bm><txt lang=\"en\">Hello there this is simple test.</txt></bm>\n" ;
        ParsedBroadcastMessage parsedBroadcastMessage = ParsedBroadcastMessage.createFromPlaintext("Hello there this is simple test.", "en", node.mbClasses.identityStore, System.currentTimeMillis());
    // convert back to XML and compare with original
    Assert.assertEquals(parsedBroadcastMessage.asXmlString(), xml);
View Full Code Here

      final File joinerPubNodeIdsDir = new File(nodeDir, nodeConfig.publicNodeIdsDir);

      joinerPubNodeIdsDir.mkdir();

      return new TrNode(nodeDir, nodeConfig);
    }
View Full Code Here

    seedConfig.peers.runMaintainance = false;
    seedConfig.peers.runBroadcast = false;
    seedConfig.localHostName = "localhost";
    seedConfig.udp.listenPort = 7643;
    final File seedDir = TestUtils.createTempDirectory();
    final TrNode seedNode = new TrNode(seedDir, seedConfig);
    final RemoteNodeAddress seedPublicNodeId = seedNode.getRemoteNodeAddress();

    final File joinerDir = TestUtils.createTempDirectory();

    final TrNodeConfig joinerConfig = new TrNodeConfig();

    joinerConfig.udp.listenPort = 7644;
    joinerConfig.localHostName = "localhost";
    joinerConfig.peers.runMaintainance = true;
    joinerConfig.peers.topologyMaintenance = false;
    joinerConfig.peers.runBroadcast = false;

    final File joinerPubNodeIdsDir = new File(joinerDir, joinerConfig.publicNodeIdsDir);

    joinerPubNodeIdsDir.mkdir();

    // Ok, we should be getting this TrPeerInfo out of seedNode somehow rather
    // than needing to set its capabilities manually like this
    final TrPeerManager.TrPeerInfo seedPeerInfo = new TrPeerManager.TrPeerInfo(seedPublicNodeId);
    seedPeerInfo.capabilities = seedConfig.capabilities;

    Persistence.save(new File(joinerPubNodeIdsDir, "joiner-id"), seedPeerInfo);

    final TrNode joinerNode = new TrNode(joinerDir, joinerConfig);

    for (int x=0; x<50; x++) {
      Thread.sleep(200);
      if (joinerNode.getPeerManager().peers.containsKey(seedNode.getRemoteNodeAddress().physicalLocation)
          && seedNode.getPeerManager().peers.containsKey(joinerNode.getRemoteNodeAddress().physicalLocation)) {
        break;
      }
    }
    // Verify that they are now connected
    Assert.assertTrue(joinerNode.getPeerManager().peers.containsKey(seedNode.getRemoteNodeAddress().physicalLocation), "The joiner peer manager should contain the seed peer");
    Assert.assertTrue(seedNode.getPeerManager().peers.containsKey(joinerNode.getRemoteNodeAddress().physicalLocation), "The seed peer manager should contain the joiner peer");
  }
View Full Code Here

        seedConfig.peers.runMaintainance = false;
        seedConfig.peers.runBroadcast = false;
        seedConfig.localHostName = "localhost";
        seedConfig.udp.listenPort = 7643;
        final File seedDir = TestUtils.createTempDirectory();
        final TrNode seedNode = new TrNode(seedDir, seedConfig);
        final RemoteNodeAddress seedPublicNodeId = seedNode.getRemoteNodeAddress();

        final File joinerDir = TestUtils.createTempDirectory();

        final TrNodeConfig joinerConfig = new TrNodeConfig();

        joinerConfig.udp.listenPort = 7644;
        joinerConfig.localHostName = "localhost";
        joinerConfig.peers.runMaintainance = true;
        joinerConfig.peers.topologyMaintenance = true;
        joinerConfig.peers.runBroadcast = true;
        joinerConfig.capabilities.allowsAssimilation = true;
        joinerConfig.capabilities.allowsUnsolicitiedInbound = false;
        joinerConfig.capabilities.receivesMessageBroadcasts = true;

        final File joinerPubNodeIdsDir = new File(joinerDir, joinerConfig.publicNodeIdsDir);

        joinerPubNodeIdsDir.mkdir();

        final File joinerDir2 = TestUtils.createTempDirectory();

        final TrNodeConfig joinerConfig2 = new TrNodeConfig();

        joinerConfig2.udp.listenPort = 7645;
        joinerConfig2.localHostName = "localhost";
        joinerConfig2.peers.runMaintainance = true;
        joinerConfig2.peers.topologyMaintenance = true;
        joinerConfig2.peers.runBroadcast = true;
        joinerConfig2.capabilities.allowsAssimilation = true;
        joinerConfig2.capabilities.allowsUnsolicitiedInbound = false;
        joinerConfig2.capabilities.receivesMessageBroadcasts = true;

        final File joinerPubNodeIdsDir2 = new File(joinerDir2, joinerConfig2.publicNodeIdsDir);

        joinerPubNodeIdsDir2.mkdir();


        final TrPeerManager.TrPeerInfo seedPeerInfo = new TrPeerManager.TrPeerInfo(seedPublicNodeId);
        seedPeerInfo.capabilities = seedConfig.capabilities;

        Persistence.save(new File(joinerPubNodeIdsDir, "joiner-id"), seedPeerInfo);
        Persistence.save(new File(joinerPubNodeIdsDir2, "joiner-id2"), seedPeerInfo);
        final TrNode joinerNode = new TrNode(joinerDir, joinerConfig);
        final TrNode joinerNode2 = new TrNode(joinerDir2, joinerConfig2);

        try{
            final TrMainWindow mainWindow = new TrMainWindow(joinerNode, "Default");
            mainWindow.getContentPanel().revalidate();
View Full Code Here

public class BroadcastMessageBroadcastTest {

    @Test
    public void simpleTest() throws Exception {

        TrNode sendingNode = TrUtils.TestUtils.makeNode(8932, false, false, false, true, 1, 1);
        TrNode receivingNode = TrUtils.TestUtils.makeNode(8933, false, false, false, true, 1, 1);
        TrUtils.TestUtils.createBidirectionalConnection(sendingNode, receivingNode);
        for (final TrPeerInfo pi : sendingNode.getPeerManager().peers.values()) {
            pi.capabilities.receivesMessageBroadcasts = true;
        }
        sendingNode.getConfig().currentUserIdentity = new UserIdentity("user1", TrCrypto.createRsaKeyPair().a, Optional.of(TrCrypto.createRsaKeyPair().b));
View Full Code Here

        Assert.assertTrue(receivingNode.mbClasses.mbsForBroadcast.contains(broadcastMessage));
    }

    @Test
    public void priorityTest() throws Exception {
        TrNode sendingNode = TrUtils.TestUtils.makeNode(8769, false, false, false, true, 1, 1);
        TrNode receivingNode = TrUtils.TestUtils.makeNode(8645, false, false, false, true, 1, 1);
        TrUtils.TestUtils.createBidirectionalConnection(sendingNode, receivingNode);
        for (final TrPeerInfo pi : sendingNode.getPeerManager().peers.values()) {
            pi.capabilities.receivesMessageBroadcasts = true;
        }
View Full Code Here

  /**
   * Nodes initially connected initiator<->forwarder1<->forwader2<->responder
   */
  @Test
  public void smallWorldMaintenanceTest() throws Exception {
    final TrNode initiator = TrUtils.TestUtils.makeNode(port++, true, false, true, false, 4, 4);
    final TrNode forwarder1 = TrUtils.TestUtils.makeNode(port++, false, false, false, false, 4, 4);
    final TrNode forwarder2 = TrUtils.TestUtils.makeNode(port++, false, false, false, false, 4, 4);
    final TrNode responder = TrUtils.TestUtils.makeNode(port++, false, false, false, false, 4, 4);

    initiator.getPeerManager().getLocInfo().setLocation(0);
    forwarder1.getPeerManager().getLocInfo().setLocation(1);
    forwarder2.getPeerManager().getLocInfo().setLocation(2);
    responder.getPeerManager().getLocInfo().setLocation(3);

    TrUtils.TestUtils.createBidirectionalConnection(initiator, forwarder1);
    TrUtils.TestUtils.createBidirectionalConnection(forwarder1, forwarder2);
    TrUtils.TestUtils.createBidirectionalConnection(forwarder2, responder);

View Full Code Here

TOP

Related Classes of tahrir.TrNode$PrivateNodeId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.