Package com.google.common.eventbus

Examples of com.google.common.eventbus.EventBus$EventWithHandler


        assertNotNull(injector.getInstance(AsyncEventBus.class));
    }

    public void testAsyncAnnotatedEventBusIsBound() {
        Key<EventBus> eventBusKey = Key.get(EventBus.class, AsyncBus.class);
        EventBus eventBus = injector.getInstance(eventBusKey);

        assertNotNull(eventBus);
        assertTrue(eventBus instanceof AsyncEventBus);
    }
View Full Code Here


        assertNotNull(eventBus);
        assertTrue(eventBus instanceof AsyncEventBus);
    }

    public void testEventBusIsSingleton() {
        EventBus eventBus1 = injector.getInstance(EventBus.class);
        EventBus eventBus2 = injector.getInstance(EventBus.class);

        assertTrue(eventBus1 == eventBus2);
    }
View Full Code Here

                    //Since sorting applies to all tracks, we only need to have 1 handler
                    AlignmentTrack track = null;
                    try {
                        track = Iterables.filter(igv.getAllTracks(), AlignmentTrack.class).iterator().next();
                        EventBus bus = track.getDataManager().getEventBus();
                        bus.register(new SortAlignmentsHandler(igv, bus, sortOption, sortTag));
                    } catch (NoSuchElementException e) {
                        //No alignment tracks found.
                        log.warn("Sort argument provided but no alignment tracks found");
                    }
                } catch (InterruptedException e) {
View Full Code Here

    }

    public void setGame(Game game) {
        assert gamePanel != null;
        this.game = game;
        this.eventBus = new EventBus(new EventBusExceptionHandler("ui event bus"));
        game.setReportingTool(reportingTool);
        reportingTool.setGame(game);
        eventBus.register(new ClientController(this, game, gamePanel));
        InvokeInSwingUiAdapter uiAdapter = new InvokeInSwingUiAdapter(eventBus);
        uiAdapter.setReportingTool(reportingTool);
View Full Code Here

        oldConfiguration = new Configuration(new MapConfigurationBackend());
      }
    }

    final Configuration startConfiguration = oldConfiguration;
    final EventBus eventBus = new EventBus();

    /* Freenet injector configuration. */
    AbstractModule freenetModule = new AbstractModule() {

      @Override
      @SuppressWarnings("synthetic-access")
      protected void configure() {
        bind(PluginRespirator.class).toInstance(SonePlugin.this.pluginRespirator);
        bind(Node.class).toInstance(SonePlugin.this.pluginRespirator.getNode());
      }
    };
    /* Sone injector configuration. */
    AbstractModule soneModule = new AbstractModule() {

      @Override
      protected void configure() {
        bind(Core.class).in(Singleton.class);
        bind(MemoryDatabase.class).in(Singleton.class);
        bind(EventBus.class).toInstance(eventBus);
        bind(Configuration.class).toInstance(startConfiguration);
        bind(FreenetInterface.class).in(Singleton.class);
        bind(PluginConnector.class).in(Singleton.class);
        bind(WebOfTrustConnector.class).in(Singleton.class);
        bind(WebOfTrustUpdater.class).in(Singleton.class);
        bind(IdentityManager.class).in(Singleton.class);
        bind(String.class).annotatedWith(Names.named("WebOfTrustContext")).toInstance("Sone");
        bind(SonePlugin.class).toInstance(SonePlugin.this);
        bind(FcpInterface.class).in(Singleton.class);
        bind(Database.class).to(MemoryDatabase.class);
        bind(PostBuilderFactory.class).to(MemoryDatabase.class);
        bind(PostReplyBuilderFactory.class).to(MemoryDatabase.class);
        bind(SoneProvider.class).to(Core.class).in(Singleton.class);
        bind(PostProvider.class).to(MemoryDatabase.class);
        bindListener(Matchers.any(), new TypeListener() {

          @Override
          public <I> void hear(TypeLiteral<I> typeLiteral, TypeEncounter<I> typeEncounter) {
            typeEncounter.register(new InjectionListener<I>() {

              @Override
              public void afterInjection(I injectee) {
                eventBus.register(injectee);
              }
            });
          }
        });
      }
View Full Code Here

    this.eventBusName = eventBusName;

    if (executor != null) {
      eventBus = new AsyncEventBus(eventBusName, executor);
    } else {
      eventBus = new EventBus(eventBusName);
    }

    eventBus.register(this);
    log.info("Created EventBus: {} -> {}", beanName, eventBus.getClass().getName());
  }
View Full Code Here

        File identityStoreTestFile=new File(TrConstants.IDENTITY_STORE_TEST_FILE_PATH);
       createFileIfNotExists(identityStoreTestFile);
        RSAPublicKey user1Key = TrCrypto.createRsaKeyPair().a;
        final String user1nick = "name1";
        IdentityStore testStore=new IdentityStore(identityStoreTestFile);
        EventBus testEventBus = new EventBus();
        testStore.setEventBus(testEventBus);
        UserIdentity identityOne=new UserIdentity(user1nick, user1Key, Optional.<RSAPrivateKey>absent());
        final String label= "Following";

        testStore.addIdentityWithLabel(label, identityOne);
View Full Code Here

    @Test
    public void addIdentityToNickTest(){
        File identityStoreTestFile=new File(TrConstants.IDENTITY_STORE_TEST_FILE_PATH);
        createFileIfNotExists(identityStoreTestFile);
        IdentityStore testStore=new IdentityStore(identityStoreTestFile);
        EventBus testEventBus = new EventBus();
        testStore.setEventBus(testEventBus);
        RSAPublicKey user2Key = TrCrypto.createRsaKeyPair().a;
        final String user2nick = "name2";
        UserIdentity identityTwo=new UserIdentity(user2nick, user2Key, Optional.<RSAPrivateKey>absent());
View Full Code Here

        File identityStoreTestFile=new File(TrConstants.IDENTITY_STORE_TEST_FILE_PATH);
        createFileIfNotExists(identityStoreTestFile);
        RSAPublicKey user1Key = TrCrypto.createRsaKeyPair().a;
        final String user1nick = "name1";
        IdentityStore testStore=new IdentityStore(identityStoreTestFile);
        EventBus testEventBus = new EventBus();
        testStore.setEventBus(testEventBus);
        UserIdentity identityOne=new UserIdentity(user1nick, user1Key, Optional.<RSAPrivateKey>absent());
        final String label= "Following";

        testStore.addIdentityWithLabel(label, identityOne);
View Full Code Here

        File identityStoreTestFile=new File(TrConstants.IDENTITY_STORE_TEST_FILE_PATH);
        createFileIfNotExists(identityStoreTestFile);
        RSAPublicKey user1Key = TrCrypto.createRsaKeyPair().a;
        final String user1nick = "name2";
        IdentityStore testStore=new IdentityStore(identityStoreTestFile);
        EventBus testEventBus = new EventBus();
        testStore.setEventBus(testEventBus);
        UserIdentity identityTwo=new UserIdentity(user1nick, user1Key, Optional.<RSAPrivateKey>absent());
        final String label= "Following";

        testStore.addIdentityWithLabel(label, identityTwo);
View Full Code Here

TOP

Related Classes of com.google.common.eventbus.EventBus$EventWithHandler

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.