Package tahrir.io.net.broadcasts.broadcastMessages

Examples of tahrir.io.net.broadcasts.broadcastMessages.BroadcastMessage


            node.mbClasses.identityStore.addIdentityWithLabel(TrConstants.OWN, user4);
            node.mbClasses.identityStore.addIdentityWithLabel(TrConstants.OWN, user5);
            node.mbClasses.identityStore.addIdentityWithLabel(TrConstants.OWN, user6);


            BroadcastMessage fromRand = TrUtils.TestUtils.getBroadcastMessage(node);
            BroadcastMessage fromUser1 = TrUtils.TestUtils.getBroadcastMessageFrom(node, user1);
            BroadcastMessage fromUser2 = TrUtils.TestUtils.getBroadcastMessage(user2, user3, node);
            BroadcastMessage fromUser3 = TrUtils.TestUtils.getBroadcastMessageFrom(node, user3);
            SortedSet<BroadcastMessage> broadcastMessages = Sets.newTreeSet(new BroadcastMessageInbox.BroadcastMessageTimeComparator());
            broadcastMessages.add(fromRand);
            broadcastMessages.add(fromUser1);
            broadcastMessages.add(fromUser2);
            broadcastMessages.add(fromUser3);
View Full Code Here


                else{
                    String message = newPostPane.getText();
                    //TODO: get the language from config or settings page.
                    ParsedBroadcastMessage parsedBroadcastMessage = ParsedBroadcastMessage.createFromPlaintext(message, "en", node.mbClasses.identityStore, System.currentTimeMillis());
                    SignedBroadcastMessage signedBroadcastMessage = new SignedBroadcastMessage(parsedBroadcastMessage, node.getConfig().currentUserIdentity);
                    final BroadcastMessage broadcastMessage = new BroadcastMessage(signedBroadcastMessage);
                    node.mbClasses.incomingMbHandler.handleInsertion(broadcastMessage);
                    newPostPane.setText("");
                }
            }
        });
View Full Code Here

    public static BroadcastMessage getBroadcastMessage(TrNode node1) {
            UserIdentity randomUser = new UserIdentity("Random User", TrCrypto.createRsaKeyPair().a, Optional.of(TrCrypto.createRsaKeyPair().b));
            node1.mbClasses.identityStore.addIdentity(randomUser);
      ParsedBroadcastMessage parsedBroadcastMessage = ParsedBroadcastMessage.createFromPlaintext("Hi @User3, How are you?", "en", node1.mbClasses.identityStore, System.currentTimeMillis());
            SignedBroadcastMessage signedBroadcastMessage = new SignedBroadcastMessage(parsedBroadcastMessage, randomUser);
            BroadcastMessage broadcastMessage = new BroadcastMessage(signedBroadcastMessage);
          return broadcastMessage;
    }
View Full Code Here

     * Get a microblog from a user that mentions another user twice.
     */
    public static BroadcastMessage getBroadcastMessage(UserIdentity from, UserIdentity mention, TrNode node) {
            ParsedBroadcastMessage parsedBroadcastMessage = ParsedBroadcastMessage.createFromPlaintext("Hi @"+mention.getNick()+", this is a sample with mention", "en", node.mbClasses.identityStore, System.currentTimeMillis());
            SignedBroadcastMessage signedBroadcastMessage = new SignedBroadcastMessage(parsedBroadcastMessage, from);
            BroadcastMessage broadcastMessage = new BroadcastMessage(signedBroadcastMessage);
            return broadcastMessage;
    }
View Full Code Here

     * Get broadcastMessage from a user which is just text, no mentions.
     */
    public static BroadcastMessage getBroadcastMessageFrom(TrNode node) {
            ParsedBroadcastMessage parsedBroadcastMessage = ParsedBroadcastMessage.createFromPlaintext("Some post from a user.", "en", node.mbClasses.identityStore, System.currentTimeMillis());
            SignedBroadcastMessage signedBroadcastMessage = new SignedBroadcastMessage(parsedBroadcastMessage, node.getConfig().currentUserIdentity);
            BroadcastMessage broadcastMessage = new BroadcastMessage(signedBroadcastMessage);
            return broadcastMessage;

    }
View Full Code Here

    }

        public static BroadcastMessage getBroadcastMessageFrom(TrNode node, UserIdentity identity) {
            ParsedBroadcastMessage parsedBroadcastMessage = ParsedBroadcastMessage.createFromPlaintext("From a given node, given user.", "en", node.mbClasses.identityStore, System.currentTimeMillis());
            SignedBroadcastMessage signedBroadcastMessage = new SignedBroadcastMessage(parsedBroadcastMessage, identity);
            BroadcastMessage broadcastMessage = new BroadcastMessage(signedBroadcastMessage);
            return broadcastMessage;

        }
View Full Code Here

        }
        sendingNode.getConfig().currentUserIdentity = new UserIdentity("user1", TrCrypto.createRsaKeyPair().a, Optional.of(TrCrypto.createRsaKeyPair().b));
        String langCode = "en";
        final ParsedBroadcastMessage parsedBroadcastMessage = ParsedBroadcastMessage.createFromPlaintext("Hello world", langCode, sendingNode.mbClasses.identityStore, System.currentTimeMillis());
        final SignedBroadcastMessage signedBroadcastMessage = new SignedBroadcastMessage(parsedBroadcastMessage, sendingNode.getConfig().currentUserIdentity);
        final BroadcastMessage broadcastMessage = new BroadcastMessage(signedBroadcastMessage);
        sendingNode.mbClasses.mbsForBroadcast.insert(broadcastMessage);

        // stop the receiver from broadcasting
        receivingNode.mbClasses.mbScheduler.disable();
View Full Code Here

        }

        sendingNode.getConfig().currentUserIdentity = new UserIdentity("user1", TrCrypto.createRsaKeyPair().a, Optional.of(TrCrypto.createRsaKeyPair().b));
        final ParsedBroadcastMessage parsedBroadcastMessage = ParsedBroadcastMessage.createFromPlaintext("You SHOULD have this microblog!", "en", sendingNode.mbClasses.identityStore, System.currentTimeMillis());
        final SignedBroadcastMessage signedBroadcastMessage = new SignedBroadcastMessage(parsedBroadcastMessage, sendingNode.getConfig().currentUserIdentity);
        final BroadcastMessage broadcastMessage1 = new BroadcastMessage(signedBroadcastMessage);

        final ParsedBroadcastMessage parsedBroadcastMessage1 = ParsedBroadcastMessage.createFromPlaintext("You should NOT have this microblog!", "en", sendingNode.mbClasses.identityStore, System.currentTimeMillis());
        final SignedBroadcastMessage signedBroadcastMessage1 = new SignedBroadcastMessage(parsedBroadcastMessage1, sendingNode.getConfig().currentUserIdentity);
        final BroadcastMessage broadcastMessage2 = new BroadcastMessage(signedBroadcastMessage1);

        sendingNode.mbClasses.mbsForBroadcast.insert(broadcastMessage1);
        sendingNode.mbClasses.mbsForBroadcast.insert(broadcastMessage2);

        // stop the receiver from broadcasting
View Full Code Here

    @Override
    public void run() {
        if (!disabled) {
            Set<PhysicalNetworkLocation> peersThatReceiveMessageBroadcasts = findPeersThatReceiveMessageBroadcasts(node.getPeerManager().peers);
            final BroadcastMessage broadcastMessageForBroadcast = node.mbClasses.mbsForBroadcast.getMessageForBroadcast();
            for (PhysicalNetworkLocation recepient : peersThatReceiveMessageBroadcasts) {
                final TransmitMicroblogSessionImpl localMicroblogBroadcastSession = node.sessionMgr.getOrCreateLocalSession(TransmitMicroblogSessionImpl.class);
                localMicroblogBroadcastSession.attemptToSendMicroblogAndWaitUntilComplete(broadcastMessageForBroadcast, recepient);

            }
View Full Code Here

TOP

Related Classes of tahrir.io.net.broadcasts.broadcastMessages.BroadcastMessage

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.