You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2006/02/11 20:26:51 UTC
svn commit: r377022 - in /incubator/tuscany/java/sca:
container.java/src/test/java/org/apache/tuscany/container/java/integration/
core/src/main/java/org/apache/tuscany/core/builder/
core/src/main/java/org/apache/tuscany/core/system/context/ core/src/te...
Author: jboynes
Date: Sat Feb 11 11:26:50 2006
New Revision: 377022
URL: http://svn.apache.org/viewcvs?rev=377022&view=rev
Log:
make system context a child of runtime rather than root
Added:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaIntegrationTestCase.java (with props)
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/builder/RuntimeConfigurationBuilder.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/RuntimeContextImpl.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemAggregateContextImpl.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/context/AbstractAggregateHierarchyTests.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockSystemAssemblyFactory.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/impl/AssemblyVisitorTestCase.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/RuntimeBootTestCase.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/RuntimeContextImplTestCase.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemAggregateComponentContextRegisterTestCase.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemAggregateComponentContextTestCase.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemAggregateHierarchyTestCase.java
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemBootstrapTestCase.java
Added: incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaIntegrationTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaIntegrationTestCase.java?rev=377022&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaIntegrationTestCase.java (added)
+++ incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaIntegrationTestCase.java Sat Feb 11 11:26:50 2006
@@ -0,0 +1,64 @@
+/**
+ *
+ * Copyright 2005 BEA Systems Inc.
+ * Copyright 2005 International Business Machines Corporation
+ *
+ * Licensed 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.container.java.integration;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory;
+import org.apache.tuscany.container.java.assembly.impl.JavaAssemblyFactoryImpl;
+import org.apache.tuscany.core.system.context.RuntimeContext;
+import org.apache.tuscany.core.system.context.RuntimeContextImpl;
+import org.apache.tuscany.model.assembly.Module;
+import org.apache.tuscany.model.assembly.ModuleComponent;
+
+/**
+ * Integration test that verifies container.java can be used to host components.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaIntegrationTestCase extends TestCase {
+ private JavaAssemblyFactory factory;
+ private RuntimeContext runtime;
+
+ public void testModuleWithOneComponent() throws Exception {
+ Module module = factory.createModule();
+ ModuleComponent moduleComponent = factory.createModuleComponent();
+ moduleComponent.setModuleImplementation(module);
+
+// runtime.registerModelObject(moduleComponent);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ // Create a factory for model objects
+ factory = new JavaAssemblyFactoryImpl();
+
+ // Create and bootstrap an empty Tuscany runtime
+ this.runtime = new RuntimeContextImpl();
+ this.runtime.start();
+
+// Component component = MockSystemAssemblyFactory.createComponent(RuntimeContext.SYSTEM, SystemAggregateContextImpl.class.getName(), ContextConstants.AGGREGATE_SCOPE_ENUM);
+// runtime.registerModelObject(component);
+ }
+
+ protected void tearDown() throws Exception {
+ runtime.stop();
+ super.tearDown();
+ }
+}
Propchange: incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaIntegrationTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaIntegrationTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/builder/RuntimeConfigurationBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/builder/RuntimeConfigurationBuilder.java?rev=377022&r1=377021&r2=377022&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/builder/RuntimeConfigurationBuilder.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/builder/RuntimeConfigurationBuilder.java Sat Feb 11 11:26:50 2006
@@ -9,7 +9,6 @@
* decorated with the runtime configuration model (RCM).
*
* @version $Rev$ $Date$
- * @param <T>
* @see RuntimeConfiguration
*/
public interface RuntimeConfigurationBuilder<Y extends Context> {
Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/RuntimeContextImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/RuntimeContextImpl.java?rev=377022&r1=377021&r2=377022&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/RuntimeContextImpl.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/RuntimeContextImpl.java Sat Feb 11 11:26:50 2006
@@ -27,10 +27,8 @@
import org.apache.tuscany.core.context.AutowireContext;
import org.apache.tuscany.core.context.AutowireResolutionException;
import org.apache.tuscany.core.context.ConfigurationContext;
-import org.apache.tuscany.core.context.ContextRuntimeException;
import org.apache.tuscany.core.context.CoreRuntimeException;
import org.apache.tuscany.core.context.EventException;
-import org.apache.tuscany.core.context.InstanceContext;
import org.apache.tuscany.core.context.QualifiedName;
import org.apache.tuscany.core.context.RuntimeEventListener;
import org.apache.tuscany.core.context.TargetException;
@@ -39,8 +37,8 @@
import org.apache.tuscany.model.assembly.ExtensibleModelObject;
/**
- * Serves as the runtime bootstrap
- *
+ * Implementation of a RuntimeContext that forms the foundation for a Tuscany environment.
+ *
* @version $Rev$ $Date$
*/
public class RuntimeContextImpl extends AbstractContext implements RuntimeContext {
@@ -49,45 +47,69 @@
private final List<RuntimeEventListener> listeners = new ArrayList(1);
- private AggregateContext rootContext;
+ private final AggregateContext rootContext;
- // the cached system context
- private AutowireContext systemContext;
+ private final AutowireContext systemContext;
- private MonitorFactory monitorFactory;
-
- // ----------------------------------
- // Constructors
- // ----------------------------------
+ private final MonitorFactory monitorFactory;
+ /**
+ * Default constructor that creates a runtime with a NullMonitorFactory and no builders.
+ */
public RuntimeContextImpl() {
this(new NullMonitorFactory(), null);
}
+ /**
+ * Constructor for creating a runtime with a specified MonitorFactory and pre-defined builders.
+ *
+ * @param monitorFactory the default {@link MonitorFactory} for this runtime
+ * @param builders a list of builders automatically made available; may be null
+ */
public RuntimeContextImpl(MonitorFactory monitorFactory, List<RuntimeConfigurationBuilder> builders) {
super(RUNTIME);
this.monitorFactory = monitorFactory;
- if (builders == null) {
- this.builders = new ArrayList(1);
- } else {
- this.builders = new ArrayList(builders);
- }
+ this.builders = (builders == null) ? new ArrayList(1) : new ArrayList(builders);
+
+ rootContext = new AggregateContextImpl(ROOT, this, this, new RuntimeScopeStrategy(), new EventContextImpl(), this, monitorFactory);
+ systemContext = new SystemAggregateContextImpl(SYSTEM, this, this, new SystemScopeStrategy(), new EventContextImpl(), this, monitorFactory);
}
- // ----------------------------------
- // Methods
- // ----------------------------------
+ /**
+ * Specicalized constructor that allows the default implementations of the root and system contexts
+ * to be overridden.
+ *
+ * @param monitorFactory the default {@link MonitorFactory} for this runtime
+ * @param rootContext the context to use for the root of the user context tree
+ * @param systemContext the context to use for the root of the system context tree
+ * @param builders a list of builders automatically made available; may be null
+ */
+ public RuntimeContextImpl(MonitorFactory monitorFactory,
+ AggregateContext rootContext,
+ AutowireContext systemContext,
+ List<RuntimeConfigurationBuilder> builders) {
+ super(RUNTIME);
+ this.rootContext = rootContext;
+ this.systemContext = systemContext;
+ this.monitorFactory = monitorFactory;
+ this.builders = (builders == null) ? new ArrayList(1) : new ArrayList(builders);
+ }
public void start() throws CoreRuntimeException {
- rootContext = new AggregateContextImpl(ROOT, this, this, new RuntimeScopeStrategy(), new EventContextImpl(), this,
- monitorFactory);
+ if (lifecycleState == RUNNING) {
+ return;
+ }
+ systemContext.start();
rootContext.start();
lifecycleState = RUNNING;
}
public void stop() throws CoreRuntimeException {
- checkRunning();
+ if (lifecycleState == STOPPED) {
+ return;
+ }
rootContext.stop();
+ systemContext.stop();
lifecycleState = STOPPED;
}
@@ -101,7 +123,7 @@
if (ROOT.equals(ctxName)) {
return rootContext;
} else if (SYSTEM.equals(ctxName)) {
- return getSystemContext();
+ return systemContext;
}
return (AggregateContext) rootContext.getContext(ctxName);
}
@@ -111,6 +133,11 @@
return rootContext;
}
+ public AutowireContext getSystemContext() {
+ checkRunning();
+ return systemContext;
+ }
+
public MonitorFactory getMonitorFactory() {
return monitorFactory;
}
@@ -157,23 +184,6 @@
public Object getInstance(QualifiedName qName, boolean notify) throws TargetException {
return getInstance(qName);
- }
-
- public AutowireContext getSystemContext() {
- checkRunning();
- if (systemContext == null) {
- InstanceContext ctx = rootContext.getContext(SYSTEM);
- if (ctx == null) {
- throw new ContextRuntimeException("System context not found");
- } else if (!(ctx instanceof AutowireContext)) {
- ContextRuntimeException e = new ContextRuntimeException("Invalid type for system context: it must implement "
- + AutowireContext.class.getName());
- e.setIdentifier(ctx.getClass().getName());
- throw e;
- }
- systemContext = (AutowireContext) ctx;
- }
- return systemContext;
}
// ----------------------------------
Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemAggregateContextImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemAggregateContextImpl.java?rev=377022&r1=377021&r2=377022&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemAggregateContextImpl.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemAggregateContextImpl.java Sat Feb 11 11:26:50 2006
@@ -143,15 +143,16 @@
scopeStrategy = new SystemScopeStrategy();
}
- public SystemAggregateContextImpl(String name, AggregateContext parent, ScopeStrategy strategy, EventContext ctx,
- ConfigurationContext configCtx, MonitorFactory factory) {
+ public SystemAggregateContextImpl(String name, AggregateContext parent, AutowireContext autowire, ScopeStrategy strategy, EventContext ctx,
+ ConfigurationContext configCtx, MonitorFactory factory) {
super(name);
+ this.parentContext = parent;
+ this.autowireContext = autowire;
this.scopeStrategy = strategy;
this.eventContext = ctx;
this.configurationContext = configCtx;
this.monitorFactory = factory;
scopeIndex = new ConcurrentHashMap();
- parentContext = parent;
module = new PojoModule();
}
Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/context/AbstractAggregateHierarchyTests.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/context/AbstractAggregateHierarchyTests.java?rev=377022&r1=377021&r2=377022&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/context/AbstractAggregateHierarchyTests.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/context/AbstractAggregateHierarchyTests.java Sat Feb 11 11:26:50 2006
@@ -39,6 +39,7 @@
* @version $Rev$ $Date$
*/
public abstract class AbstractAggregateHierarchyTests extends TestCase {
+ protected List<RuntimeConfigurationBuilder> builders;
public void testParentContextIsolation() throws Exception {
AggregateContext parent = createContextHierachy();
@@ -68,7 +69,6 @@
* Checks that registration of duplicate named model objects before context start throws an exception
*/
public void testRegisterSameName() throws Exception {
- List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
AggregateContext parent = new AggregateContextImpl("test.parent", null, new DefaultScopeStrategy(),
new EventContextImpl(), new MockConfigContext(builders), new NullMonitorFactory());
parent.registerModelObject(MockSystemAssemblyFactory.createComponent("test.child", AggregateContextImpl.class.getName(),
@@ -87,7 +87,6 @@
* Checks that registration of duplicate named model objects after context start throws an exception
*/
public void testRegisterSameNameAfterStart() throws Exception {
- List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
AggregateContext parent = new AggregateContextImpl("test.parent", null, new DefaultScopeStrategy(),
new EventContextImpl(), new MockConfigContext(builders), new NullMonitorFactory());
parent.registerModelObject(MockSystemAssemblyFactory.createComponent("test.child", AggregateContextImpl.class.getName(),
@@ -106,4 +105,8 @@
protected abstract AggregateContext createContextHierachy() throws Exception;
+ protected void setUp() throws Exception {
+ super.setUp();
+ builders = MockSystemAssemblyFactory.createBuilders();
+ }
}
Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockSystemAssemblyFactory.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockSystemAssemblyFactory.java?rev=377022&r1=377021&r2=377022&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockSystemAssemblyFactory.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockSystemAssemblyFactory.java Sat Feb 11 11:26:50 2006
@@ -75,7 +75,6 @@
* @param name the name of the component
* @param type the component implementation class name
* @param scope the scope of the component implementation
- * @param aggregateContext the containing aggregate context
* @throws NoSuchMethodException
* @throws ClassNotFoundException
* @see RuntimeConfiguration
Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/impl/AssemblyVisitorTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/impl/AssemblyVisitorTestCase.java?rev=377022&r1=377021&r2=377022&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/impl/AssemblyVisitorTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/impl/AssemblyVisitorTestCase.java Sat Feb 11 11:26:50 2006
@@ -79,7 +79,7 @@
}
- private class TestBuilder implements RuntimeConfigurationBuilder {
+ private static class TestBuilder implements RuntimeConfigurationBuilder {
private AssemblyModelObject model;
Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/RuntimeBootTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/RuntimeBootTestCase.java?rev=377022&r1=377021&r2=377022&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/RuntimeBootTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/RuntimeBootTestCase.java Sat Feb 11 11:26:50 2006
@@ -18,14 +18,12 @@
import junit.framework.Assert;
import junit.framework.TestCase;
+import org.apache.tuscany.common.monitor.impl.NullMonitorFactory;
import org.apache.tuscany.core.builder.RuntimeConfigurationBuilder;
import org.apache.tuscany.core.context.AggregateContext;
-import org.apache.tuscany.core.context.EventContext;
import org.apache.tuscany.core.context.Context;
-import org.apache.tuscany.core.context.ContextConstants;
+import org.apache.tuscany.core.context.EventContext;
import org.apache.tuscany.core.mock.MockSystemAssemblyFactory;
-import org.apache.tuscany.model.assembly.Component;
-import org.apache.tuscany.common.monitor.impl.NullMonitorFactory;
/**
* Tests runtime boot scenarios
@@ -40,11 +38,6 @@
// start the runtime context
RuntimeContext runtimeContext = new RuntimeContextImpl(new NullMonitorFactory(), builders);
runtimeContext.start();
-
- // create the system context
- Component component = MockSystemAssemblyFactory.createComponent(RuntimeContext.SYSTEM,
- SystemAggregateContextImpl.class.getName(), ContextConstants.AGGREGATE_SCOPE_ENUM);
- runtimeContext.registerModelObject(component);
AggregateContext system = runtimeContext.getSystemContext();
Assert.assertNotNull(system);
Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/RuntimeContextImplTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/RuntimeContextImplTestCase.java?rev=377022&r1=377021&r2=377022&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/RuntimeContextImplTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/RuntimeContextImplTestCase.java Sat Feb 11 11:26:50 2006
@@ -50,14 +50,13 @@
* @version $Rev$ $Date$
*/
public class RuntimeContextImplTestCase extends TestCase {
+ private List<RuntimeConfigurationBuilder> builders;
/**
* Tests explicit wiring of an external service to a system entry point that is wired to a child system module entry
* point
*/
public void testSystemExplicitWiring() throws Exception {
- List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
-
RuntimeContext runtime = new RuntimeContextImpl(new NullMonitorFactory(), builders);
runtime.start();
@@ -65,9 +64,6 @@
Assert.assertNotNull(root);
Assert.assertTrue(root.getLifecycleState() == Context.RUNNING);
- // register the system context
- runtime.registerModelObject(MockSystemAssemblyFactory.createComponent(RuntimeContext.SYSTEM,
- SystemAggregateContextImpl.class.getName(), ContextConstants.AGGREGATE_SCOPE_ENUM));
AggregateContext system = runtime.getSystemContext();
Assert.assertNotNull(system);
system.registerModelObject(MockSystemAssemblyFactory.createSystemModule());
@@ -115,8 +111,6 @@
* Tests autowiring an external service to a system entry point
*/
public void testSystemAutoWiring() throws Exception {
- List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
-
RuntimeContext runtime = new RuntimeContextImpl(new NullMonitorFactory(), builders);
runtime.start();
@@ -124,9 +118,6 @@
Assert.assertNotNull(root);
Assert.assertTrue(root.getLifecycleState() == Context.RUNNING);
- // register the system context
- runtime.registerModelObject(MockSystemAssemblyFactory.createComponent(RuntimeContext.SYSTEM,
- SystemAggregateContextImpl.class.getName(), ContextConstants.AGGREGATE_SCOPE_ENUM));
AggregateContext system = runtime.getSystemContext();
Assert.assertNotNull(system);
system.registerModelObject(MockSystemAssemblyFactory.createSystemModule());
@@ -152,13 +143,9 @@
}
public void testServiceNotFound() throws Exception {
- List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
-
RuntimeContext runtime = new RuntimeContextImpl(new NullMonitorFactory(), builders);
runtime.start();
- Component systemComponent = MockSystemAssemblyFactory.createComponent(RuntimeContext.SYSTEM, SystemAggregateContextImpl.class.getName(),
- ContextConstants.AGGREGATE_SCOPE_ENUM);
- runtime.registerModelObject(systemComponent);
+
// create a test module
Component moduleComponent = MockSystemAssemblyFactory.createComponent("module", AggregateContextImpl.class.getName(),
ContextConstants.AGGREGATE_SCOPE_ENUM);
@@ -176,14 +163,8 @@
}
public void testExternalServiceReferenceNotFound() throws Exception {
- List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
-
RuntimeContext runtime = new RuntimeContextImpl(new NullMonitorFactory(), builders);
runtime.start();
- // create the system context
- Component component = MockSystemAssemblyFactory.createComponent(RuntimeContext.SYSTEM, SystemAggregateContextImpl.class
- .getName(), ContextConstants.AGGREGATE_SCOPE_ENUM);
- runtime.registerModelObject(component);
AggregateContext system = runtime.getSystemContext();
// create a test module
@@ -209,13 +190,8 @@
}
public void testEntryPointReferenceNotFound() throws Exception {
- List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
-
RuntimeContext runtime = new RuntimeContextImpl(new NullMonitorFactory(), builders);
runtime.start();
- Component systemComponent = MockSystemAssemblyFactory.createComponent(RuntimeContext.SYSTEM, SystemAggregateContextImpl.class.getName(),
- ContextConstants.AGGREGATE_SCOPE_ENUM);
- runtime.registerModelObject(systemComponent);
// create a test module
Component moduleComponent = MockSystemAssemblyFactory.createComponent("module", AggregateContextImpl.class.getName(),
@@ -245,12 +221,8 @@
* Test two module components that have external services wired to entry points contained in each
*/
public void testCircularWires() throws Exception {
- List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
RuntimeContext runtime = new RuntimeContextImpl(new NullMonitorFactory(), builders);
runtime.start();
- Component systemComponent = MockSystemAssemblyFactory.createComponent(RuntimeContext.SYSTEM, SystemAggregateContextImpl.class.getName(),
- ContextConstants.AGGREGATE_SCOPE_ENUM);
- runtime.registerModelObject(systemComponent);
// create a test modules
Component module1 = MockSystemAssemblyFactory.createComponent("module1", AggregateContextImpl.class.getName(),
@@ -295,13 +267,8 @@
* as an error condition FIXME this must be implemented
*/
public void testInterModuleCircularReference() throws Exception {
- List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
-
RuntimeContext runtime = new RuntimeContextImpl(new NullMonitorFactory(), builders);
runtime.start();
- Component systemComponent = MockSystemAssemblyFactory.createComponent(RuntimeContext.SYSTEM, SystemAggregateContextImpl.class.getName(),
- ContextConstants.AGGREGATE_SCOPE_ENUM);
- runtime.registerModelObject(systemComponent);
// create a test modules
Component module1 = MockSystemAssemblyFactory.createComponent("module1", AggregateContextImpl.class.getName(),
@@ -334,13 +301,9 @@
}
public void testRuntimeBuilderAutowire() throws Exception {
- List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
RuntimeContext runtime = new RuntimeContextImpl(new NullMonitorFactory(), builders);
runtime.start();
- Component systemComponent = MockSystemAssemblyFactory.createComponent(RuntimeContext.SYSTEM,
- SystemAggregateContextImpl.class.getName(), ContextConstants.AGGREGATE_SCOPE_ENUM);
- runtime.registerModelObject(systemComponent);
AggregateContext system = runtime.getSystemContext();
Component builder = MockSystemAssemblyFactory.createComponent("TestBuilder", TestBuilder.class.getName(),
@@ -357,4 +320,8 @@
}
+ protected void setUp() throws Exception {
+ super.setUp();
+ builders = MockSystemAssemblyFactory.createBuilders();
+ }
}
Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemAggregateComponentContextRegisterTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemAggregateComponentContextRegisterTestCase.java?rev=377022&r1=377021&r2=377022&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemAggregateComponentContextRegisterTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemAggregateComponentContextRegisterTestCase.java Sat Feb 11 11:26:50 2006
@@ -34,7 +34,7 @@
protected AggregateContext createContext() {
List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
AggregateContext moduleContext = new SystemAggregateContextImpl("test.context", null,
- new DefaultScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders), new NullMonitorFactory());
+ null, new DefaultScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders), new NullMonitorFactory());
return moduleContext;
}
}
Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemAggregateComponentContextTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemAggregateComponentContextTestCase.java?rev=377022&r1=377021&r2=377022&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemAggregateComponentContextTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemAggregateComponentContextTestCase.java Sat Feb 11 11:26:50 2006
@@ -44,7 +44,7 @@
List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
SystemAggregateContextImpl system = new SystemAggregateContextImpl("system", null,
- new SystemScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders), new NullMonitorFactory());
+ null, new SystemScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders), new NullMonitorFactory());
system.start();
Component aggregateComponent = MockSystemAssemblyFactory.createComponent("system.child",
@@ -68,7 +68,7 @@
public void testAutowire() throws Exception {
List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
SystemAggregateContextImpl system = new SystemAggregateContextImpl("system", null,
- new SystemScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders), new NullMonitorFactory());
+ null, new SystemScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders), new NullMonitorFactory());
Component component = MockSystemAssemblyFactory.createComponent("TestService1", ModuleScopeSystemComponentImpl.class
.getName(), ScopeEnum.MODULE_LITERAL);
@@ -87,7 +87,7 @@
List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
SystemAggregateContextImpl system = new SystemAggregateContextImpl("system", null,
- new SystemScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders), new NullMonitorFactory());
+ null, new SystemScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders), new NullMonitorFactory());
Component component = MockSystemAssemblyFactory.createComponent("TestService1", ModuleScopeSystemComponentImpl.class
.getName(), ScopeEnum.MODULE_LITERAL);
@@ -106,7 +106,7 @@
List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
SystemAggregateContextImpl system = new SystemAggregateContextImpl("system", null,
- new SystemScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders), new NullMonitorFactory());
+ null, new SystemScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders), new NullMonitorFactory());
system.registerModelObject(MockSystemAssemblyFactory.createSystemModule());
system.start();
system.fireEvent(EventContext.MODULE_START, null);
@@ -118,7 +118,7 @@
public void testAutowireModuleRegisterAfterStart() throws Exception {
List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
SystemAggregateContextImpl system = new SystemAggregateContextImpl("system", null,
- new SystemScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders), new NullMonitorFactory());
+ null, new SystemScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders), new NullMonitorFactory());
system.start();
system.fireEvent(EventContext.MODULE_START, null);
system.registerModelObject(MockSystemAssemblyFactory.createSystemModule());
Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemAggregateHierarchyTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemAggregateHierarchyTestCase.java?rev=377022&r1=377021&r2=377022&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemAggregateHierarchyTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemAggregateHierarchyTestCase.java Sat Feb 11 11:26:50 2006
@@ -39,7 +39,7 @@
protected AggregateContext createContextHierachy() throws Exception {
List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
- AggregateContext parent = new SystemAggregateContextImpl("test.parent", null, new DefaultScopeStrategy(),
+ AggregateContext parent = new SystemAggregateContextImpl("test.parent", null, null, new DefaultScopeStrategy(),
new EventContextImpl(), new MockConfigContext(builders), new NullMonitorFactory());
parent.registerModelObject(MockSystemAssemblyFactory.createComponent("test.child", AggregateContextImpl.class.getName(),
ContextConstants.AGGREGATE_SCOPE_ENUM));
Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemBootstrapTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemBootstrapTestCase.java?rev=377022&r1=377021&r2=377022&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemBootstrapTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemBootstrapTestCase.java Sat Feb 11 11:26:50 2006
@@ -47,19 +47,15 @@
* @version $Rev$ $Date$
*/
public class SystemBootstrapTestCase extends TestCase {
+ private List<RuntimeConfigurationBuilder> builders;
/**
* Simulates booting a runtime process
*/
public void testBoot() throws Exception {
- List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
-
RuntimeContext runtimeContext = new RuntimeContextImpl(new NullMonitorFactory(), builders);
runtimeContext.start();
- // create the system context
- Component component = MockSystemAssemblyFactory.createComponent(RuntimeContext.SYSTEM,
- SystemAggregateContextImpl.class.getName(), ContextConstants.AGGREGATE_SCOPE_ENUM);
- runtimeContext.registerModelObject(component);
+
AggregateContext systemContext = runtimeContext.getSystemContext();
Assert.assertNotNull(systemContext);
Module systemModule = MockSystemAssemblyFactory.createSystemModule();
@@ -88,12 +84,10 @@
}
public void testRuntimeBoot() throws Exception {
- List<RuntimeConfigurationBuilder> builders = MockSystemAssemblyFactory.createBuilders();
RuntimeContext runtime = new RuntimeContextImpl(new NullMonitorFactory(), builders);
runtime.start();
runtime.getRootContext();
- runtime.registerModelObject(MockSystemAssemblyFactory.createComponent(RuntimeContext.SYSTEM,
- SystemAggregateContextImpl.class.getName(), ContextConstants.AGGREGATE_SCOPE_ENUM));
+
AggregateContext system = runtime.getSystemContext();
system.registerModelObject(MockSystemAssemblyFactory.createSystemModule());
system.registerModelObject(MockSystemAssemblyFactory.createComponent("module2", SystemAggregateContextImpl.class
@@ -169,4 +163,8 @@
// }
+ protected void setUp() throws Exception {
+ super.setUp();
+ builders = MockSystemAssemblyFactory.createBuilders();
+ }
}