[New] Implemented EMPTY and TRANSIENT dataStoreModes.
Refactored Agent to be responsible for starting the container. And it requires the runtime configuration.
This commit is contained in:
parent
afda69d236
commit
9bc5f46f2a
|
@ -22,6 +22,7 @@
|
||||||
package li.strolch.testbase.model;
|
package li.strolch.testbase.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import li.strolch.model.Order;
|
import li.strolch.model.Order;
|
||||||
import li.strolch.model.ParameterBag;
|
import li.strolch.model.ParameterBag;
|
||||||
|
@ -106,7 +107,7 @@ public class ModelBuilder {
|
||||||
*
|
*
|
||||||
* @return the newly created {@link Order}
|
* @return the newly created {@link Order}
|
||||||
*/
|
*/
|
||||||
public static Order createOrder(String id, String name, String type, long date, State state) {
|
public static Order createOrder(String id, String name, String type, Date date, State state) {
|
||||||
|
|
||||||
Order order = new Order(id, name, type, date, state);
|
Order order = new Order(id, name, type, date, state);
|
||||||
ParameterBag bag = createParameterBag(BAG_ID, BAG_NAME, BAG_TYPE);
|
ParameterBag bag = createParameterBag(BAG_ID, BAG_NAME, BAG_TYPE);
|
||||||
|
@ -166,7 +167,7 @@ public class ModelBuilder {
|
||||||
StringParameter stringParam = new StringParameter(PARAM_STRING_ID, PARAM_STRING_NAME, "Strolch");
|
StringParameter stringParam = new StringParameter(PARAM_STRING_ID, PARAM_STRING_NAME, "Strolch");
|
||||||
bag.addParameter(stringParam);
|
bag.addParameter(stringParam);
|
||||||
|
|
||||||
DateParameter dateParam = new DateParameter(PARAM_DATE_ID, PARAM_DATE_NAME, 1354295525628L);
|
DateParameter dateParam = new DateParameter(PARAM_DATE_ID, PARAM_DATE_NAME, new Date(1354295525628L));
|
||||||
bag.addParameter(dateParam);
|
bag.addParameter(dateParam);
|
||||||
|
|
||||||
ArrayList<String> stringList = new ArrayList<String>();
|
ArrayList<String> stringList = new ArrayList<String>();
|
||||||
|
|
|
@ -3,6 +3,7 @@ package li.strolch.testbase.runtime;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
|
import li.strolch.runtime.agent.StrolchAgent;
|
||||||
import li.strolch.runtime.component.ComponentContainer;
|
import li.strolch.runtime.component.ComponentContainer;
|
||||||
import li.strolch.runtime.configuration.RuntimeConfiguration;
|
import li.strolch.runtime.configuration.RuntimeConfiguration;
|
||||||
import li.strolch.runtime.privilege.StrolchPrivilegeHandler;
|
import li.strolch.runtime.privilege.StrolchPrivilegeHandler;
|
||||||
|
@ -18,6 +19,7 @@ public class RuntimeMock {
|
||||||
private static final String TARGET = "target"; //$NON-NLS-1$
|
private static final String TARGET = "target"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static ComponentContainer container;
|
private static ComponentContainer container;
|
||||||
|
private static StrolchAgent agent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the container
|
* @return the container
|
||||||
|
@ -70,14 +72,14 @@ public class RuntimeMock {
|
||||||
|
|
||||||
public static void startContainer(File rootPathF) {
|
public static void startContainer(File rootPathF) {
|
||||||
|
|
||||||
ComponentContainer container = new ComponentContainer();
|
|
||||||
try {
|
try {
|
||||||
|
StrolchAgent agent = new StrolchAgent();
|
||||||
|
agent.setup(rootPathF);
|
||||||
|
agent.initialize();
|
||||||
|
agent.start();
|
||||||
|
|
||||||
container.setup(rootPathF);
|
RuntimeMock.agent = agent;
|
||||||
container.initialize();
|
RuntimeMock.container = agent.getContainer();
|
||||||
container.start();
|
|
||||||
|
|
||||||
RuntimeMock.container = container;
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Failed to start mocked container due to: " + e.getMessage(), e); //$NON-NLS-1$
|
logger.error("Failed to start mocked container due to: " + e.getMessage(), e); //$NON-NLS-1$
|
||||||
|
@ -88,17 +90,17 @@ public class RuntimeMock {
|
||||||
|
|
||||||
public static void destroyRuntime() {
|
public static void destroyRuntime() {
|
||||||
|
|
||||||
if (container == null)
|
if (agent == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
container.stop();
|
agent.stop();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.info("Failed to stop container: " + e.getMessage()); //$NON-NLS-1$
|
logger.info("Failed to stop container: " + e.getMessage()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
container.destroy();
|
agent.destroy();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.info("Failed to destroy container: " + e.getMessage()); //$NON-NLS-1$
|
logger.info("Failed to destroy container: " + e.getMessage()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue