Package org.springframework.context

Examples of org.springframework.context.ApplicationEvent


*/
public class ApplicationContextEventBrokerTest {

    @Test
    public void testOnApplicationEvent() {
        ApplicationEvent event = new ApplicationEvent(this) {
            @Override
            public Object getSource() {
                return "mySource";
            }
        };
View Full Code Here


  @Test
  public void emitsRepositoriesPopulatedEventIfPublisherConfigured() throws Exception {

    RepositoryPopulator populator = setUpReferenceAndInititalize(new User(), publisher);

    ApplicationEvent event = new RepositoriesPopulatedEvent(populator, repositories);
    verify(publisher, times(1)).publishEvent(event);
  }
View Full Code Here

                    }
                }),
                new Button("Publish Application Context Event", new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        applicationContext.publishEvent(new ApplicationEvent("Hello World from ApplicationContext") {
                            @Override
                            public Object getSource() {
                                return EventsUI.this;
                            }
                        });
View Full Code Here

                    }
                }),
                new Button("Publish Application Context Event", new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        applicationContext.publishEvent(new ApplicationEvent("Hello World from ApplicationContext") {
                            @Override
                            public Object getSource() {
                                return EventBusUI.this;
                            }
                        });
View Full Code Here

    public Producer createProducer() throws Exception {
        ObjectHelper.notNull(applicationContext, "applicationContext");
        return new DefaultProducer(this) {
            public void process(Exchange exchange) throws Exception {
                ApplicationEvent event = toApplicationEvent(exchange);
                applicationContext.publishEvent(event);
            }
        };
    }
View Full Code Here

    protected LoadBalancer createLoadBalancer() {
        return new TopicLoadBalancer();
    }

    protected ApplicationEvent toApplicationEvent(Exchange exchange) {
        ApplicationEvent event = exchange.getIn().getBody(ApplicationEvent.class);
        if (event != null) {
            return event;
        }
        return new CamelEvent(this, exchange);
    }
View Full Code Here

    }
   
    private class Producer implements Callable {
        public Object call() throws Exception {
            for (int i = 0; i < 5; i++) {
                ApplicationEvent produced = new PayloadEvent(this, new String("test-" + i), null);
                BlockingCollectorTest.this.collector.onApplicationEvent(produced);
                ApplicationEvent polled = BlockingCollectorTest.this.exchanger.exchange(produced);
                BlockingCollectorTest.this.assertSame(produced, polled);
            }
            return null;
        }
View Full Code Here

    }
   
    private class Consumer implements Callable {
        public Object call() throws Exception {
            for (int i = 0; i < 5; i++) {
                ApplicationEvent polled = BlockingCollectorTest.this.collector.pollEvent();
                ApplicationEvent produced = BlockingCollectorTest.this.exchanger.exchange(polled);
                BlockingCollectorTest.this.assertSame(polled, produced);
            }
            return null;
        }
View Full Code Here

    }

    public Producer<Exchange> createProducer() throws Exception {
        return new DefaultProducer<Exchange>(this) {
            public void process(Exchange exchange) throws Exception {
                ApplicationEvent event = toApplicationEvent(exchange);
                getApplicationContext().publishEvent(event);
            }
        };
    }
View Full Code Here

    protected LoadBalancer createLoadBalancer() {
        return new TopicLoadBalancer();
    }

    protected ApplicationEvent toApplicationEvent(Exchange exchange) {
        ApplicationEvent event = exchange.getIn().getBody(ApplicationEvent.class);
        if (event == null) {
            event = new CamelEvent(this, exchange);
        }
        return event;
    }
View Full Code Here

TOP

Related Classes of org.springframework.context.ApplicationEvent

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.