Author: jmarino
Date: Sun Dec 3 18:33:12 2006
New Revision: 482017
URL: http://svn.apache.org/viewvc?view=rev&rev=482017
Log:
make root composite names unique from their immediate children; add start/stop
for root composites
Added:
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/bootstrap/DefaultRuntimeTestCase.java
(with props)
Modified:
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultRuntime.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java
Modified:
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java?view=diff&rev=482017&r1=482016&r2=482017
==============================================================================
---
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java
(original)
+++
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java
Sun Dec 3 18:33:12 2006
@@ -116,10 +116,10 @@
public RuntimeComponent createRuntime() {
DefaultRuntime runtime = new DefaultRuntime();
CompositeComponent systemComponent =
- new CompositeComponentImpl(ComponentNames.TUSCANY_SYSTEM, runtime,
null, null);
+ new CompositeComponentImpl(ComponentNames.TUSCANY_SYSTEM_ROOT,
runtime, null, null);
runtime.setSystemComponent(systemComponent);
CompositeComponent rootComponent =
- new CompositeComponentImpl(ComponentNames.TUSCANY_ROOT, runtime,
null, null);
+ new
CompositeComponentImpl(ComponentNames.TUSCANY_APPLICATION_ROOT, runtime, null,
null);
runtime.setRootComponent(rootComponent);
return runtime;
}
Modified:
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultRuntime.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultRuntime.java?view=diff&rev=482017&r1=482016&r2=482017
==============================================================================
---
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultRuntime.java
(original)
+++
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultRuntime.java
Sun Dec 3 18:33:12 2006
@@ -74,4 +74,24 @@
public Deployer getDeployer() {
return systemComponent.resolveExternalInstance(Deployer.class);
}
+
+ public void start() {
+ super.start();
+ if (rootComponent != null) {
+ rootComponent.start();
+ }
+ if (systemComponent != null) {
+ systemComponent.start();
+ }
+ }
+
+ public void stop() {
+ if (rootComponent != null) {
+ rootComponent.stop();
+ }
+ if (systemComponent != null) {
+ systemComponent.stop();
+ }
+ super.stop();
+ }
}
Added:
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/bootstrap/DefaultRuntimeTestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/bootstrap/DefaultRuntimeTestCase.java?view=auto&rev=482017
==============================================================================
---
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/bootstrap/DefaultRuntimeTestCase.java
(added)
+++
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/bootstrap/DefaultRuntimeTestCase.java
Sun Dec 3 18:33:12 2006
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.bootstrap;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DefaultRuntimeTestCase extends TestCase {
+
+ public void testLifecycleInitialization() {
+ DefaultRuntime runtime = new DefaultRuntime();
+ CompositeComponent app = EasyMock.createMock(CompositeComponent.class);
+ app.start();
+ app.stop();
+ EasyMock.replay(app);
+ CompositeComponent system =
EasyMock.createMock(CompositeComponent.class);
+ system.start();
+ system.stop();
+ EasyMock.replay(system);
+ runtime.setSystemComponent(system);
+ runtime.setRootComponent(app);
+ runtime.start();
+ runtime.stop();
+ EasyMock.verify(system);
+ EasyMock.verify(app);
+ }
+
+ public void testLifecycleInitializationNoAppAnSystemComposites() {
+ DefaultRuntime runtime = new DefaultRuntime();
+ runtime.start();
+ runtime.stop();
+ }
+
+}
Propchange:
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/bootstrap/DefaultRuntimeTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/bootstrap/DefaultRuntimeTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java?view=diff&rev=482017&r1=482016&r2=482017
==============================================================================
---
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java
(original)
+++
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java
Sun Dec 3 18:33:12 2006
@@ -30,12 +30,17 @@
public static final String TUSCANY_RUNTIME = "tuscany.runtime";
/**
- * The name of the component that forms the root of the application
context tree.
+ * The name of the component that is the root of the application composite
tree.
*/
- public static final String TUSCANY_ROOT = "tuscany.root";
+ public static final String TUSCANY_APPLICATION_ROOT =
"tuscany.root.application";
/**
- * The name of the component that form the root of the system context tree.
+ * The name of the component that is the root of the system composite tree.
+ */
+ public static final String TUSCANY_SYSTEM_ROOT = "tuscany.root.system";
+
+ /**
+ * The name of the top-level component in the system composite tree.
*/
public static final String TUSCANY_SYSTEM = "tuscany.system";
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]