From f173c759786855c3d55110e37edac4a5e108a64a Mon Sep 17 00:00:00 2001 From: erik Date: Sat, 12 Apr 2008 16:33:59 +0000 Subject: [PATCH] --- .../system/core/AbstractComponent.java | 9 -------- .../org/wamblee/system/core/Component.java | 10 -------- .../wamblee/system/core/ContainerTest.java | 23 ++----------------- 3 files changed, 2 insertions(+), 40 deletions(-) diff --git a/trunk/system/general/src/main/java/org/wamblee/system/core/AbstractComponent.java b/trunk/system/general/src/main/java/org/wamblee/system/core/AbstractComponent.java index b202f285..01eff741 100644 --- a/trunk/system/general/src/main/java/org/wamblee/system/core/AbstractComponent.java +++ b/trunk/system/general/src/main/java/org/wamblee/system/core/AbstractComponent.java @@ -31,7 +31,6 @@ public abstract class AbstractComponent implements Component { private static final Log LOG = LogFactory.getLog(AbstractComponent.class); - private Status _status; private String _context; private String _name; private List _provided; @@ -50,7 +49,6 @@ public abstract class AbstractComponent implements Component { */ protected AbstractComponent(String aName, ProvidedInterface[] aProvided, RequiredInterface[] aRequired) { - _status = Status.NOT_STARTED; _context = null; _name = aName; _provided = new ArrayList(); @@ -59,11 +57,6 @@ public abstract class AbstractComponent implements Component { _required.addAll(Arrays.asList(aRequired)); _running = new HashSet(); } - - @Override - public Status getStatus() { - return _status; - } @Override public final String getName() { @@ -102,7 +95,6 @@ public abstract class AbstractComponent implements Component { public final void start() { LOG.info("Initializing '" + getQualifiedName() + "'"); doStart(); - _status = Status.RUNNING; if ( _running.size() != _provided.size()) { List remaining = new ArrayList(_provided); @@ -143,7 +135,6 @@ public abstract class AbstractComponent implements Component { // programming error. throw new RuntimeException(getQualifiedName() + ": still services running after the stop call."); } - _status = Status.STOPPED; } protected abstract void doStop(); diff --git a/trunk/system/general/src/main/java/org/wamblee/system/core/Component.java b/trunk/system/general/src/main/java/org/wamblee/system/core/Component.java index b36fe56b..ff80ee69 100644 --- a/trunk/system/general/src/main/java/org/wamblee/system/core/Component.java +++ b/trunk/system/general/src/main/java/org/wamblee/system/core/Component.java @@ -23,16 +23,6 @@ package org.wamblee.system.core; */ public interface Component { - enum Status { - NOT_STARTED, RUNNING, STOPPED - } - - /** - * Gets the status of the component. - * @return Status. - */ - Status getStatus(); - /** * Gets the name of the subsystem. * @return Subsystem name. diff --git a/trunk/system/general/src/test/java/org/wamblee/system/core/ContainerTest.java b/trunk/system/general/src/test/java/org/wamblee/system/core/ContainerTest.java index ee5b4e50..bcca8cc1 100644 --- a/trunk/system/general/src/test/java/org/wamblee/system/core/ContainerTest.java +++ b/trunk/system/general/src/test/java/org/wamblee/system/core/ContainerTest.java @@ -16,25 +16,16 @@ package org.wamblee.system.core; import java.io.Serializable; -import java.util.ArrayList; import java.util.Arrays; +import junit.framework.TestCase; + import org.easymock.classextension.ConstructorArgs; import org.easymock.classextension.EasyMock; import org.easymock.classextension.IMocksControl; -import org.wamblee.system.core.Component; -import org.wamblee.system.core.Container; -import org.wamblee.system.core.DefaultProvidedInterface; -import org.wamblee.system.core.DefaultRequiredInterface; -import org.wamblee.system.core.ProvidedInterface; -import org.wamblee.system.core.RequiredInterface; -import org.wamblee.system.core.SystemAssemblyException; -import org.wamblee.system.core.Component.Status; import org.wamblee.test.AssertionUtils; import org.wamblee.test.EventTracker; -import junit.framework.TestCase; - public class ContainerTest extends TestCase { private EventTracker _tracker; @@ -125,21 +116,15 @@ public class ContainerTest extends TestCase { Component environment = new Environment(_tracker); Component application = new Application(_tracker); assertEquals(0, _tracker.getEventCount()); - assertEquals(Status.NOT_STARTED, environment.getStatus()); - assertEquals(Status.NOT_STARTED, application.getStatus()); Container system = new Container("all", new Component[] { environment, application }, new ProvidedInterface[0], new RequiredInterface[0]); - assertEquals(Status.NOT_STARTED, system.getStatus()); system.start(); RequiredInterface[] required = system.getRequiredInterfaces(); assertEquals(0, required.length); ProvidedInterface[] provided = system.getProvidedInterfaces(); assertEquals(0, provided.length); - assertEquals(Status.RUNNING, environment.getStatus()); - assertEquals(Status.RUNNING, application.getStatus()); - assertEquals(Status.RUNNING, system.getStatus()); AssertionUtils.assertEquals(new String[] { "start.environment", "start.application" }, _tracker.getEvents( @@ -147,10 +132,6 @@ public class ContainerTest extends TestCase { _tracker.clear(); system.stop(); - assertEquals(Status.STOPPED, environment.getStatus()); - assertEquals(Status.STOPPED, application.getStatus()); - assertEquals(Status.STOPPED, system.getStatus()); - AssertionUtils.assertEquals(new String[] { "stop.application", "stop.environment" }, _tracker .getEvents(Thread.currentThread()).toArray(new String[0])); -- 2.31.1