From 9bc5f46f2a25f8ba40f8ac630487c6fc515303a7 Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Mon, 25 Nov 2013 18:53:59 +0100 Subject: [PATCH] [New] Implemented EMPTY and TRANSIENT dataStoreModes. Refactored Agent to be responsible for starting the container. And it requires the runtime configuration. --- .../strolch/testbase/model/ModelBuilder.java | 5 +++-- .../strolch/testbase/runtime/RuntimeMock.java | 20 ++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/li/strolch/testbase/model/ModelBuilder.java b/src/main/java/li/strolch/testbase/model/ModelBuilder.java index 77dda9446..004530d8f 100644 --- a/src/main/java/li/strolch/testbase/model/ModelBuilder.java +++ b/src/main/java/li/strolch/testbase/model/ModelBuilder.java @@ -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 stringList = new ArrayList(); diff --git a/src/main/java/li/strolch/testbase/runtime/RuntimeMock.java b/src/main/java/li/strolch/testbase/runtime/RuntimeMock.java index 12f6069af..6cf4578b3 100644 --- a/src/main/java/li/strolch/testbase/runtime/RuntimeMock.java +++ b/src/main/java/li/strolch/testbase/runtime/RuntimeMock.java @@ -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$ }