use of org.apache.ofbiz.base.start.StartupCommand in project ofbiz-framework by apache.
the class RunTestEvents method runTest.
public static String runTest(HttpServletRequest request, HttpServletResponse response) throws ContainerException {
String component = request.getParameter("compName");
String suiteName = request.getParameter("suiteName");
String caseName = request.getParameter("caseName");
String result = null;
List<StartupCommand> ofbizCommands = new ArrayList<StartupCommand>();
if (caseName == null) {
ofbizCommands.add(new StartupCommand.Builder("test").properties(UtilMisc.toMap("component", component, "suitename", suiteName)).build());
} else {
ofbizCommands.add(new StartupCommand.Builder("test").properties(UtilMisc.toMap("component", component, "suitename", suiteName, "case", caseName)).build());
}
TestRunContainer testRunContainer = new TestRunContainer();
testRunContainer.init(ofbizCommands, "frontend test run", " ");
if (testRunContainer.start() == false) {
result = "error";
} else {
result = "success";
}
return result;
}
use of org.apache.ofbiz.base.start.StartupCommand in project ofbiz-framework by apache.
the class EntityDataLoadContainer method init.
@Override
public void init(List<StartupCommand> ofbizCommands, String name, String configFile) throws ContainerException {
this.name = name;
// get the data-load properties passed by the user in the command line
Map<String, String> loadDataProps = ofbizCommands.stream().filter(command -> command.getName().equals(StartupCommandUtil.StartupOption.LOAD_DATA.getName())).map(command -> command.getProperties()).findFirst().get();
/* disable job scheduler, JMS listener and startup services
* FIXME: This is not thread-safe. */
ServiceDispatcher.enableJM(false);
ServiceDispatcher.enableJMS(false);
ServiceDispatcher.enableSvcs(false);
Configuration configuration = ContainerConfig.getConfiguration(name, configFile);
Property delegatorNameProp = configuration.getProperty("delegator-name");
String overrideDelegator = loadDataProps.get(DELEGATOR_NAME);
if ("all-tenants".equals(overrideDelegator)) {
// load data for all tenants
for (GenericValue tenant : getTenantList(delegatorNameProp)) {
String tenantDelegator = delegatorNameProp.value + "#" + tenant.getString("tenantId");
loadDataForDelegator(loadDataProps, configuration, delegatorNameProp, tenantDelegator);
}
} else {
// load data for a single delegator
loadDataForDelegator(loadDataProps, configuration, delegatorNameProp, overrideDelegator);
}
}
use of org.apache.ofbiz.base.start.StartupCommand in project ofbiz-framework by apache.
the class TestRunContainer method init.
@Override
public void init(List<StartupCommand> ofbizCommands, String name, String configFile) throws ContainerException {
this.name = name;
new File(logDir).mkdir();
// get the test properties passed by the user in the command line
Map<String, String> testProps = ofbizCommands.stream().filter(command -> command.getName().equals(StartupCommandUtil.StartupOption.TEST.getName())).map(command -> command.getProperties()).findFirst().get();
// set selected log level if passed by user
setLoggerLevel(testProps.get("loglevel"));
this.jsWrapper = prepareJunitSuiteWrapper(testProps);
}
Aggregations