use of com.alipay.sofa.ark.container.model.BizModel in project sofa-ark by alipay.
the class NoneDelegateTestClassLoader method createTestBiz.
private Biz createTestBiz(String bizIdentity) {
String[] bizNameAndVersion = bizIdentity.split(":");
if (bizNameAndVersion.length != 2) {
throw new ArkRuntimeException("error bizIdentity format.");
}
BizManagerService bizManagerService = ArkServiceContainerHolder.getContainer().getService(BizManagerService.class);
Biz testBiz = new BizModel().setBizName(bizNameAndVersion[0]).setBizVersion(bizNameAndVersion[1]).setClassLoader(this).setDenyImportPackages("").setDenyImportClasses("").setDenyImportResources("").setBizState(BizState.RESOLVED);
bizManagerService.registerBiz(testBiz);
return testBiz;
}
use of com.alipay.sofa.ark.container.model.BizModel in project sofa-ark by alipay.
the class BaseTest method registerMockBiz.
protected void registerMockBiz() {
if (arkContainer == null) {
String[] args = new String[] { "-Ajar=" + jarURL.toExternalForm() };
arkContainer = (ArkContainer) ArkContainer.main(args);
}
BizManagerService bizManagerService = ArkServiceContainerHolder.getContainer().getService(BizManagerService.class);
Biz biz = new BizModel().setBizName("mock").setBizVersion("1.0").setClassLoader(this.getClass().getClassLoader()).setDenyImportPackages("").setDenyImportClasses("").setDenyImportResources("").setBizState(BizState.RESOLVED);
bizManagerService.registerBiz(biz);
((BizModel) biz).setBizState(BizState.ACTIVATED);
}
use of com.alipay.sofa.ark.container.model.BizModel in project sofa-ark by alipay.
the class TestClassLoader method createTestBiz.
private Biz createTestBiz(String bizIdentity) {
String[] bizNameAndVersion = bizIdentity.split(":");
if (bizNameAndVersion.length != 2) {
throw new ArkRuntimeException("error bizIdentity format.");
}
BizManagerService bizManagerService = ArkServiceContainerHolder.getContainer().getService(BizManagerService.class);
Biz testBiz = new BizModel().setBizName(bizNameAndVersion[0]).setBizVersion(bizNameAndVersion[1]).setClassLoader(this).setDenyImportPackages("").setDenyImportClasses("").setDenyImportResources("").setBizState(BizState.RESOLVED);
bizManagerService.registerBiz(testBiz);
return testBiz;
}
use of com.alipay.sofa.ark.container.model.BizModel in project sofa-ark by alipay.
the class BizManagerServiceTest method testRemovingAndAddBiz.
@Test
public void testRemovingAndAddBiz() {
Biz adding = new BizModel().setBizName("test-biz-adding").setBizVersion("1.0.0").setBizState(BizState.ACTIVATED);
Biz removing = new BizModel().setBizName("test-biz-removing").setBizVersion("1.0.0").setBizState(BizState.RESOLVED);
bizManagerService.registerBiz(removing);
((BizModel) removing).setBizState(BizState.ACTIVATED);
bizManagerService.removeAndAddBiz(adding, removing);
List<Biz> biz = bizManagerService.getBiz("test-biz-adding");
Assert.assertTrue(biz.size() == 1);
biz = bizManagerService.getBiz("test-biz-removing");
Assert.assertTrue(biz.size() == 0);
bizManagerService.unRegisterBiz(adding.getBizName(), adding.getBizVersion());
}
use of com.alipay.sofa.ark.container.model.BizModel in project sofa-ark by alipay.
the class BizManagerServiceTest method before.
@Before
public void before() {
super.before();
Biz biz = new BizModel().setBizName("test-biz").setBizVersion("1.0.0").setBizState(BizState.RESOLVED);
bizManagerService.registerBiz(biz);
}
Aggregations