Search in sources :

Example 1 with AddExt1_ManualAdd1

use of com.alibaba.dubbo.common.extensionloader.ext8_add.impl.AddExt1_ManualAdd1 in project dubbo by alibaba.

the class ExtensionLoaderTest method test_AddExtension.

@Test
public void test_AddExtension() throws Exception {
    try {
        ExtensionLoader.getExtensionLoader(AddExt1.class).getExtension("Manual1");
        fail();
    } catch (IllegalStateException expected) {
        assertThat(expected.getMessage(), containsString("No such extension com.alibaba.dubbo.common.extensionloader.ext8_add.AddExt1 by name Manual"));
    }
    ExtensionLoader.getExtensionLoader(AddExt1.class).addExtension("Manual1", AddExt1_ManualAdd1.class);
    AddExt1 ext = ExtensionLoader.getExtensionLoader(AddExt1.class).getExtension("Manual1");
    assertThat(ext, instanceOf(AddExt1_ManualAdd1.class));
    assertEquals("Manual1", ExtensionLoader.getExtensionLoader(AddExt1.class).getExtensionName(AddExt1_ManualAdd1.class));
}
Also used : AddExt1_ManualAdd1(com.alibaba.dubbo.common.extensionloader.ext8_add.impl.AddExt1_ManualAdd1) AddExt1(com.alibaba.dubbo.common.extensionloader.ext8_add.AddExt1) Test(org.junit.Test)

Aggregations

AddExt1 (com.alibaba.dubbo.common.extensionloader.ext8_add.AddExt1)1 AddExt1_ManualAdd1 (com.alibaba.dubbo.common.extensionloader.ext8_add.impl.AddExt1_ManualAdd1)1 Test (org.junit.Test)1