summaryrefslogtreecommitdiffstats
path: root/java/sca/itest/scopes
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-09-25 23:35:55 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-09-25 23:35:55 +0000
commit6e55b9d5cf7afffdb3b5860f735a75ae02964984 (patch)
tree7616e60612cd4a4eb24f8542c5e3e73ed3539218 /java/sca/itest/scopes
parent7ceed60d0af823f42885087a7f17cfd3e5fb9610 (diff)
TUSCANY-3280 - Removing obsolete iTests that were exercising REQUEST Scope
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@819066 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/itest/scopes')
-rw-r--r--java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java51
-rw-r--r--java/sca/itest/scopes/src/main/resources/scopes.composite5
-rw-r--r--java/sca/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java48
3 files changed, 12 insertions, 92 deletions
diff --git a/java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java b/java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java
deleted file mode 100644
index ff116070b5..0000000000
--- a/java/sca/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.sca.itest.scopes;
-
-import org.oasisopen.sca.annotation.Destroy;
-import org.oasisopen.sca.annotation.Init;
-import org.oasisopen.sca.annotation.Scope;
-
-/**
- * Test request scope
- */
-@Scope("REQUEST")
-public class RequestScopeStateVerifierImpl implements StateVerifier {
- // State data for this request thread.
- int requestState;
-
- public void setState(int i) {
- requestState = i;
- }
-
- public boolean checkState(int i) {
- return (requestState == i);
- }
-
- @Init
- public void init() {
- requestState = 0;
- }
-
- @Destroy
- public void destroy() {
- requestState = -1;
- }
-
-}
diff --git a/java/sca/itest/scopes/src/main/resources/scopes.composite b/java/sca/itest/scopes/src/main/resources/scopes.composite
index 3a56beec8d..83a71218f5 100644
--- a/java/sca/itest/scopes/src/main/resources/scopes.composite
+++ b/java/sca/itest/scopes/src/main/resources/scopes.composite
@@ -22,11 +22,6 @@
name="Scopes">
<!-- Components used to test scopes. -->
-
- <component name="RequestScopeComponent">
- <implementation.java class="org.apache.tuscany.sca.itest.scopes.RequestScopeStateVerifierImpl"/>
- </component>
-
<component name="ModuleScopeComponent">
<implementation.java class="org.apache.tuscany.sca.itest.scopes.CompositeScopeStateVerifierImpl"/>
</component>
diff --git a/java/sca/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java b/java/sca/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java
index 959a6067ee..594bdd5038 100644
--- a/java/sca/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java
+++ b/java/sca/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java
@@ -43,32 +43,31 @@ public class ScopeTestCase {
private Node node;
- /**
- * Test scope containers.
- *
- * The request scope container isn't hooked up for some reason so the code below
- * that tests request scope is commented out.
- * Code could be added to test session scope once it is supported in a standalone environment.
- *
- * @throws InterruptedException Test failed
- */
+ @Before
+ public void setUp() throws Exception {
+ String location = ContributionLocationHelper.getContributionLocation("scopes.composite");
+ node = NodeFactory.newInstance().createNode("scopes.composite", new Contribution("c1", location));
+ node.start();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ node.stop();
+ }
+
@Test
public void testScopes() throws InterruptedException {
Thread[] moduleScopeThreadTable = new Thread[NUM_THREADS];
- Thread[] requestScopeThreadTable = new Thread[NUM_THREADS];
for (int i = 0; i < NUM_THREADS; i++) {
moduleScopeThreadTable[i] = new ModuleScopeTestThread();
- requestScopeThreadTable[i] = new RequestScopeTestThread();
}
for (int j = 0; j < NUM_THREADS; j++) {
moduleScopeThreadTable[j].start();
- requestScopeThreadTable[j].start();
}
for (int k = 0; k < NUM_THREADS; k++) {
moduleScopeThreadTable[k].join();
- requestScopeThreadTable[k].join();
}
}
@@ -85,29 +84,6 @@ public class ScopeTestCase {
}
}
- private class RequestScopeTestThread extends Thread {
-
- public void run() {
- StateVerifier requestScopeService = node.getService(StateVerifier.class, "RequestScopeComponent");
- for (int i = 1; i <= ITERATIONS; i++) {
- requestScopeService.setState(i);
- if (!requestScopeService.checkState(i)) {
- fail("The request scope service lost its state on iteration " + i);
- }
- }
- }
- }
-
- @Before
- public void setUp() throws Exception {
- String location = ContributionLocationHelper.getContributionLocation("scopes.composite");
- node = NodeFactory.newInstance().createNode("scopes.composite", new Contribution("c1", location));
- node.start();
- }
- @After
- public void tearDown() throws Exception {
- node.stop();
- }
}