use of com.alibaba.dubbo.common.extensionloader.ext8_add.AddExt1 in project dubbo by alibaba.
the class ExtensionLoaderTest method test_AddExtension_ExceptionWhenExistedExtension.
@Test
public void test_AddExtension_ExceptionWhenExistedExtension() throws Exception {
SimpleExt ext = ExtensionLoader.getExtensionLoader(SimpleExt.class).getExtension("impl1");
try {
ExtensionLoader.getExtensionLoader(AddExt1.class).addExtension("impl1", AddExt1_ManualAdd1.class);
fail();
} catch (IllegalStateException expected) {
assertThat(expected.getMessage(), containsString("Extension name impl1 already existed(Extension interface com.alibaba.dubbo.common.extensionloader.ext8_add.AddExt1)!"));
}
}
use of com.alibaba.dubbo.common.extensionloader.ext8_add.AddExt1 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));
}
use of com.alibaba.dubbo.common.extensionloader.ext8_add.AddExt1 in project dubbo by alibaba.
the class ExtensionLoaderTest method test_replaceExtension_ExceptionWhenNotExistedExtension.
@Test
public void test_replaceExtension_ExceptionWhenNotExistedExtension() throws Exception {
AddExt1 ext = ExtensionLoader.getExtensionLoader(AddExt1.class).getExtension("impl1");
try {
ExtensionLoader.getExtensionLoader(AddExt1.class).replaceExtension("NotExistedExtension", AddExt1_ManualAdd1.class);
fail();
} catch (IllegalStateException expected) {
assertThat(expected.getMessage(), containsString("Extension name NotExistedExtension not existed(Extension interface com.alibaba.dubbo.common.extensionloader.ext8_add.AddExt1)"));
}
}
Aggregations