[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:
Robert von Burg 2013-11-25 18:53:59 +01:00
parent afda69d236
commit 9bc5f46f2a
2 changed files with 14 additions and 11 deletions

View File

@ -22,6 +22,7 @@
package li.strolch.testbase.model;
import java.util.ArrayList;
import java.util.Date;
import li.strolch.model.Order;
import li.strolch.model.ParameterBag;
@ -106,7 +107,7 @@ public class ModelBuilder {
*
* @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);
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");
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);
ArrayList<String> stringList = new ArrayList<String>();

View File

@ -3,6 +3,7 @@ package li.strolch.testbase.runtime;
import java.io.File;
import java.text.MessageFormat;
import li.strolch.runtime.agent.StrolchAgent;
import li.strolch.runtime.component.ComponentContainer;
import li.strolch.runtime.configuration.RuntimeConfiguration;
import li.strolch.runtime.privilege.StrolchPrivilegeHandler;
@ -18,6 +19,7 @@ public class RuntimeMock {
private static final String TARGET = "target"; //$NON-NLS-1$
private static ComponentContainer container;
private static StrolchAgent agent;
/**
* @return the container
@ -70,14 +72,14 @@ public class RuntimeMock {
public static void startContainer(File rootPathF) {
ComponentContainer container = new ComponentContainer();
try {
StrolchAgent agent = new StrolchAgent();
agent.setup(rootPathF);
agent.initialize();
agent.start();
container.setup(rootPathF);
container.initialize();
container.start();
RuntimeMock.container = container;
RuntimeMock.agent = agent;
RuntimeMock.container = agent.getContainer();
} catch (Exception e) {
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() {
if (container == null)
if (agent == null)
return;
try {
container.stop();
agent.stop();
} catch (Exception e) {
logger.info("Failed to stop container: " + e.getMessage()); //$NON-NLS-1$
}
try {
container.destroy();
agent.destroy();
} catch (Exception e) {
logger.info("Failed to destroy container: " + e.getMessage()); //$NON-NLS-1$
}