zack
5 years ago
5 changed files with 78 additions and 86 deletions
@ -1,33 +0,0 @@
|
||||
package com.fanruan.api.env.shell; |
||||
|
||||
import com.fr.module.Module; |
||||
|
||||
/** |
||||
* 模块封装 |
||||
*/ |
||||
public class ModuleShell { |
||||
private Module module; |
||||
|
||||
public ModuleShell(Module module) { |
||||
this.module = module; |
||||
} |
||||
|
||||
/** |
||||
* 启动模块 |
||||
*/ |
||||
public void start() { |
||||
if (module != null) { |
||||
module.start(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 关闭模块 |
||||
*/ |
||||
public void stop() { |
||||
if (module != null) { |
||||
module.stop(); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,52 @@
|
||||
package com.fanruan.api; |
||||
|
||||
import com.fr.base.operator.common.CommonOperator; |
||||
import com.fr.cluster.engine.activator.standalone.StandaloneModeActivator; |
||||
import com.fr.config.activator.BaseDBActivator; |
||||
import com.fr.config.activator.ConfigurationActivator; |
||||
import com.fr.env.operator.CommonOperatorImpl; |
||||
import com.fr.general.I18nResource; |
||||
import com.fr.module.Module; |
||||
import com.fr.module.tool.ActivatorToolBox; |
||||
import com.fr.report.ReportActivator; |
||||
import com.fr.report.RestrictionActivator; |
||||
import com.fr.report.module.ReportBaseActivator; |
||||
import com.fr.scheduler.SchedulerActivator; |
||||
import com.fr.store.StateServerActivator; |
||||
import com.fr.workspace.simple.SimpleWork; |
||||
import org.junit.After; |
||||
import org.junit.Before; |
||||
|
||||
/** |
||||
* @ClassName ModulePrepare |
||||
* @Author zack |
||||
* @Date 2019/8/26 |
||||
* @Version 10.0 |
||||
*/ |
||||
public class ModulePrepare { |
||||
Module module = null; |
||||
|
||||
@Before |
||||
public void start() { |
||||
module = ActivatorToolBox.simpleLink( |
||||
new BaseDBActivator(), |
||||
new ConfigurationActivator(), |
||||
new StandaloneModeActivator(), |
||||
new StateServerActivator(), |
||||
new SchedulerActivator(), |
||||
new ReportBaseActivator(), |
||||
new RestrictionActivator(), |
||||
new ReportActivator() |
||||
); |
||||
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl()); |
||||
I18nResource.getInstance(); |
||||
module.start(); |
||||
} |
||||
|
||||
@After |
||||
public void stop() { |
||||
if (module != null) { |
||||
module.stop(); |
||||
} |
||||
} |
||||
} |
@ -1,29 +1,44 @@
|
||||
package com.fanruan.api; |
||||
|
||||
import com.fanruan.api.env.EnvKit; |
||||
import com.fanruan.api.env.shell.ModuleShell; |
||||
import com.fr.config.dao.DaoContext; |
||||
import com.fr.config.dao.impl.LocalClassHelperDao; |
||||
import com.fr.config.dao.impl.LocalEntityDao; |
||||
import com.fr.config.dao.impl.LocalXmlEntityDao; |
||||
import com.fr.runtime.FineRuntime; |
||||
import com.fr.store.StateHubManager; |
||||
import com.fr.store.impl.MemoryLock; |
||||
import com.fr.store.impl.MemoryStore; |
||||
import com.fr.transaction.Configurations; |
||||
import com.fr.transaction.LocalConfigurationHelper; |
||||
import org.junit.After; |
||||
import org.junit.Before; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-09 |
||||
* Created by richie on 2019-08-09 |
||||
*/ |
||||
public class Prepare { |
||||
private ModuleShell module; |
||||
|
||||
@Before |
||||
public void start() { |
||||
module = EnvKit.createLocalStartModule(""); |
||||
module.start(); |
||||
FineRuntime.start(); |
||||
DaoContext.setEntityDao(new LocalEntityDao()); |
||||
DaoContext.setClassHelperDao(new LocalClassHelperDao()); |
||||
DaoContext.setXmlEntityDao(new LocalXmlEntityDao()); |
||||
Configurations.setHelper(new LocalConfigurationHelper()); |
||||
StateHubManager.setStorage(new MemoryStore()); |
||||
StateHubManager.setLock(new MemoryLock()); |
||||
} |
||||
|
||||
@After |
||||
public void stop() { |
||||
if (module != null) { |
||||
module.stop(); |
||||
} |
||||
DaoContext.setEntityDao(null); |
||||
DaoContext.setClassHelperDao(null); |
||||
DaoContext.setXmlEntityDao(null); |
||||
Configurations.setHelper(null); |
||||
StateHubManager.setStorage(null); |
||||
StateHubManager.setLock(null); |
||||
} |
||||
|
||||
} |
||||
|
Loading…
Reference in new issue