summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/test/java/org/apache/tuscany/core/implementation/PhysicalComponentTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/test/java/org/apache/tuscany/core/implementation/PhysicalComponentTestCase.java')
-rw-r--r--sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/test/java/org/apache/tuscany/core/implementation/PhysicalComponentTestCase.java80
1 files changed, 80 insertions, 0 deletions
diff --git a/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/test/java/org/apache/tuscany/core/implementation/PhysicalComponentTestCase.java b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/test/java/org/apache/tuscany/core/implementation/PhysicalComponentTestCase.java
new file mode 100644
index 0000000000..f3bdf5e332
--- /dev/null
+++ b/sca-java-1.x/tags/kernel/2.0-alpha-incubating/core/src/test/java/org/apache/tuscany/core/implementation/PhysicalComponentTestCase.java
@@ -0,0 +1,80 @@
+/*
+ * 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.implementation;
+
+import junit.framework.TestCase;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+
+import org.apache.tuscany.core.component.InstanceFactory;
+import org.apache.tuscany.core.component.scope.InstanceWrapper;
+import org.apache.tuscany.core.component.scope.InstanceWrapperBase;
+import org.apache.tuscany.spi.component.TargetDestructionException;
+import org.apache.tuscany.spi.component.TargetInitializationException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PhysicalComponentTestCase extends TestCase {
+ public void testSomething() {
+
+ }
+
+ /**
+ * This is the class supplied by the user.
+ */
+ public static class UserImplementation {
+ @Init
+ void init() {
+ }
+
+ @Destroy
+ void destroy() {
+ }
+ }
+
+ /**
+ * This is the generated wrapper class.
+ */
+ public static class UserWrapper extends InstanceWrapperBase<UserImplementation> {
+ public UserWrapper(UserImplementation instance) {
+ super(instance);
+ }
+
+ public void start() throws TargetInitializationException {
+ instance.init();
+ super.start();
+ }
+
+ public void stop() throws TargetDestructionException {
+ super.stop();
+ instance.destroy();
+ }
+ }
+
+ /**
+ * This is the generated factory class.
+ */
+ public static class UserFactory implements InstanceFactory<UserImplementation> {
+ public InstanceWrapper<UserImplementation> newInstance() {
+ UserImplementation instance = new UserImplementation();
+ return new UserWrapper(instance);
+ }
+ }
+}