Search in sources :

Example 1 with AbstractArkEvent

use of com.alipay.sofa.ark.spi.event.AbstractArkEvent in project sofa-ark by alipay.

the class GlobalEventHandlerTest method testEvent.

@Test
public void testEvent() {
    Biz biz = new BizModel().setBizName("test-biz").setBizVersion("1.0.0").setBizState(BizState.RESOLVED);
    Plugin plugin = new PluginModel().setPluginName("test-plugin").setVersion("1.0.0");
    eventAdminService.sendEvent(new AfterBizStartupEvent(biz));
    Assert.assertTrue(result.size() == 3);
    Assert.assertTrue(result.contains("AbstractArkEvent->AfterBizStartupEvent"));
    eventAdminService.sendEvent(new BeforePluginStartupEvent(plugin));
    Assert.assertTrue(result.size() == 5);
    // test for ArkEvent.class.isAssignableFrom(event.getClass()
    eventAdminService.sendEvent(new ArkEvent() {

        @Override
        public String getTopic() {
            return "ark-event";
        }
    });
    Assert.assertTrue(result.size() == 7);
}
Also used : PluginModel(com.alipay.sofa.ark.container.model.PluginModel) BeforePluginStartupEvent(com.alipay.sofa.ark.spi.event.plugin.BeforePluginStartupEvent) Biz(com.alipay.sofa.ark.spi.model.Biz) AfterBizStartupEvent(com.alipay.sofa.ark.spi.event.biz.AfterBizStartupEvent) BizModel(com.alipay.sofa.ark.container.model.BizModel) ArkEvent(com.alipay.sofa.ark.spi.event.ArkEvent) AbstractArkEvent(com.alipay.sofa.ark.spi.event.AbstractArkEvent) Plugin(com.alipay.sofa.ark.spi.model.Plugin) Test(org.junit.Test) BaseTest(com.alipay.sofa.ark.container.BaseTest)

Aggregations

BaseTest (com.alipay.sofa.ark.container.BaseTest)1 BizModel (com.alipay.sofa.ark.container.model.BizModel)1 PluginModel (com.alipay.sofa.ark.container.model.PluginModel)1 AbstractArkEvent (com.alipay.sofa.ark.spi.event.AbstractArkEvent)1 ArkEvent (com.alipay.sofa.ark.spi.event.ArkEvent)1 AfterBizStartupEvent (com.alipay.sofa.ark.spi.event.biz.AfterBizStartupEvent)1 BeforePluginStartupEvent (com.alipay.sofa.ark.spi.event.plugin.BeforePluginStartupEvent)1 Biz (com.alipay.sofa.ark.spi.model.Biz)1 Plugin (com.alipay.sofa.ark.spi.model.Plugin)1 Test (org.junit.Test)1