Skip to content

Commit b75689b

Browse files
committed
Enable arquillian on transaction tests
Update spec tests to use Arquillian Update api tests to use Arquillian
1 parent a974224 commit b75689b

File tree

163 files changed

+2664
-5127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+2664
-5127
lines changed

tck/src/main/java/ee/jakarta/tck/concurrent/api/AbortedException/AbortedExceptionTests.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,25 @@
1616

1717
package jakarta.enterprise.concurrent.api.AbortedException;
1818

19-
import jakarta.enterprise.concurrent.tck.framework.TestClient;
20-
import jakarta.enterprise.concurrent.tck.framework.TestUtil;
21-
19+
import org.jboss.arquillian.container.test.api.Deployment;
20+
import org.jboss.shrinkwrap.api.ShrinkWrap;
21+
import org.jboss.shrinkwrap.api.spec.WebArchive;
2222
import org.testng.annotations.Test;
2323

2424
import jakarta.enterprise.concurrent.AbortedException;
25+
import jakarta.enterprise.concurrent.tck.framework.ArquillianTests;
2526
import jakarta.enterprise.concurrent.tck.framework.TestLogger;
2627

27-
public class AbortedExceptionTests extends TestClient {
28+
public class AbortedExceptionTests extends ArquillianTests {
29+
2830
private static final TestLogger log = TestLogger.get(AbortedExceptionTests.class);
31+
32+
//TODO deploy as EJB and JSP artifacts
33+
@Deployment(name="AbortedException")
34+
public static WebArchive createDeployment() {
35+
return ShrinkWrap.create(WebArchive.class)
36+
.addPackages(true, getFrameworkPackage(), AbortedExceptionTests.class.getPackage());
37+
}
2938

3039
/*
3140
* @testName: AbortedExceptionNoArgTest

tck/src/main/java/ee/jakarta/tck/concurrent/api/AbortedException/build.xml

Lines changed: 0 additions & 32 deletions
This file was deleted.

tck/src/main/java/ee/jakarta/tck/concurrent/api/ContextService/ContextServiceTests.java

Lines changed: 28 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,26 @@
1919
import java.util.HashMap;
2020
import java.util.Map;
2121

22-
import javax.naming.InitialContext;
23-
import javax.naming.NamingException;
24-
22+
import org.jboss.arquillian.container.test.api.Deployment;
23+
import org.jboss.shrinkwrap.api.ShrinkWrap;
24+
import org.jboss.shrinkwrap.api.spec.WebArchive;
2525
import org.testng.annotations.Test;
2626

27-
import jakarta.enterprise.concurrent.tck.framework.TestClient;
28-
import jakarta.enterprise.concurrent.tck.framework.TestUtil;
29-
30-
import jakarta.enterprise.concurrent.ContextService;
3127
import jakarta.enterprise.concurrent.ManagedTaskListener;
28+
import jakarta.enterprise.concurrent.tck.framework.ArquillianTests;
3229
import jakarta.enterprise.concurrent.tck.framework.TestLogger;
30+
import jakarta.enterprise.concurrent.tck.framework.TestUtil;
3331

34-
public class ContextServiceTests extends TestClient {
32+
public class ContextServiceTests extends ArquillianTests {
3533

3634
private static final TestLogger log = TestLogger.get(ContextServiceTests.class);
35+
36+
//TODO deploy as EJB and JSP artifacts
37+
@Deployment(name="ContextService")
38+
public static WebArchive createDeployment() {
39+
return ShrinkWrap.create(WebArchive.class)
40+
.addPackages(true, getFrameworkPackage(), ContextServiceTests.class.getPackage());
41+
}
3742

3843
/*
3944
* @testName: ContextServiceWithIntf
@@ -47,12 +52,8 @@ public class ContextServiceTests extends TestClient {
4752
public void ContextServiceWithIntf() {
4853
boolean pass = false;
4954
try {
50-
InitialContext ctx = new InitialContext();
51-
ContextService cs = (ContextService) ctx.lookup("java:comp/DefaultContextService");
52-
Runnable proxy = (Runnable) cs.createContextualProxy(new TestRunnableWork(), Runnable.class);
55+
Runnable proxy = (Runnable) TestUtil.getContextService().createContextualProxy(new TestRunnableWork(), Runnable.class);
5356
pass = true;
54-
} catch (NamingException ne) {
55-
log.severe("Failed to lookup default ContextService" + ne);
5657
} catch (Exception e) {
5758
log.severe("Unexpected Exception Caught", e);
5859
}
@@ -72,11 +73,7 @@ public void ContextServiceWithIntf() {
7273
public void ContextServiceWithIntfAndIntfNoImplemented() {
7374
boolean pass = false;
7475
try {
75-
InitialContext ctx = new InitialContext();
76-
ContextService cs = (ContextService) ctx.lookup("java:comp/DefaultContextService");
77-
Object proxy = cs.createContextualProxy(new Object(), Runnable.class);
78-
} catch (NamingException ne) {
79-
log.severe("Failed to lookup default ContextService" + ne);
76+
Object proxy = TestUtil.getContextService().createContextualProxy(new Object(), Runnable.class);
8077
} catch (IllegalArgumentException ie) {
8178
pass = true;
8279
} catch (Exception e) {
@@ -98,12 +95,8 @@ public void ContextServiceWithIntfAndIntfNoImplemented() {
9895
public void ContextServiceWithIntfAndInstanceIsNull() {
9996
boolean pass = false;
10097
try {
101-
InitialContext ctx = new InitialContext();
102-
ContextService cs = (ContextService) ctx.lookup("java:comp/DefaultContextService");
103-
Object proxy = cs.createContextualProxy(null, Runnable.class);
98+
Object proxy = TestUtil.getContextService().createContextualProxy(null, Runnable.class);
10499
log.info(proxy.toString());
105-
} catch (NamingException ne) {
106-
log.severe("Failed to lookup default ContextService" + ne);
107100
} catch (IllegalArgumentException ie) {
108101
pass = true;
109102
} catch (Exception e) {
@@ -124,12 +117,8 @@ public void ContextServiceWithIntfAndInstanceIsNull() {
124117
public void ContextServiceWithMultiIntfs() {
125118
boolean pass = false;
126119
try {
127-
InitialContext ctx = new InitialContext();
128-
ContextService cs = (ContextService) ctx.lookup("java:comp/DefaultContextService");
129-
Object proxy = cs.createContextualProxy(new TestRunnableWork(), Runnable.class, TestWorkInterface.class);
120+
Object proxy = TestUtil.getContextService().createContextualProxy(new TestRunnableWork(), Runnable.class, TestWorkInterface.class);
130121
pass = proxy instanceof Runnable && proxy instanceof TestWorkInterface;
131-
} catch (NamingException ne) {
132-
log.severe("Failed to lookup default ContextService" + ne);
133122
} catch (Exception e) {
134123
log.severe("Unexpected Exception Caught", e);
135124
}
@@ -149,12 +138,8 @@ public void ContextServiceWithMultiIntfs() {
149138
public void ContextServiceWithMultiIntfsAndIntfNoImplemented() {
150139
boolean pass = false;
151140
try {
152-
InitialContext ctx = new InitialContext();
153-
ContextService cs = (ContextService) ctx.lookup("java:comp/DefaultContextService");
154-
Object proxy = cs.createContextualProxy(new TestRunnableWork(), Runnable.class, TestWorkInterface.class,
141+
Object proxy = TestUtil.getContextService().createContextualProxy(new TestRunnableWork(), Runnable.class, TestWorkInterface.class,
155142
ManagedTaskListener.class);
156-
} catch (NamingException ne) {
157-
log.severe("Failed to lookup default ContextService" + ne);
158143
} catch (IllegalArgumentException ie) {
159144
pass = true;
160145
} catch (Exception e) {
@@ -176,12 +161,8 @@ public void ContextServiceWithMultiIntfsAndIntfNoImplemented() {
176161
public void ContextServiceWithMultiIntfsAndInstanceIsNull() {
177162
boolean pass = false;
178163
try {
179-
InitialContext ctx = new InitialContext();
180-
ContextService cs = (ContextService) ctx.lookup("java:comp/DefaultContextService");
181-
Object proxy = cs.createContextualProxy(null, Runnable.class, TestWorkInterface.class);
164+
Object proxy = TestUtil.getContextService().createContextualProxy(null, Runnable.class, TestWorkInterface.class);
182165
log.info(proxy.toString());
183-
} catch (NamingException ne) {
184-
log.severe("Failed to lookup default ContextService" + ne);
185166
} catch (IllegalArgumentException ie) {
186167
pass = true;
187168
} catch (Exception e) {
@@ -202,18 +183,12 @@ public void ContextServiceWithMultiIntfsAndInstanceIsNull() {
202183
public void ContextServiceWithIntfAndProperties() {
203184
boolean pass = false;
204185
try {
205-
InitialContext ctx = new InitialContext();
206-
ContextService cs = (ContextService) ctx.lookup("java:comp/DefaultContextService");
207-
208186
Map<String, String> execProps = new HashMap<String, String>();
209187
execProps.put("vendor_a.security.tokenexpiration", "15000");
210188
execProps.put("USE_PARENT_TRANSACTION", "true");
211189

212-
Runnable proxy = (Runnable) cs.createContextualProxy(new TestRunnableWork(), execProps, Runnable.class);
190+
Runnable proxy = (Runnable) TestUtil.getContextService().createContextualProxy(new TestRunnableWork(), execProps, Runnable.class);
213191
pass = true;
214-
215-
} catch (NamingException ne) {
216-
log.severe("Failed to lookup default ContextService" + ne);
217192
} catch (Exception e) {
218193
log.severe("Unexpected Exception Caught", e);
219194
}
@@ -232,18 +207,13 @@ public void ContextServiceWithIntfAndProperties() {
232207
public void ContextServiceWithMultiIntfsAndProperties() {
233208
boolean pass = false;
234209
try {
235-
InitialContext ctx = new InitialContext();
236-
ContextService cs = (ContextService) ctx.lookup("java:comp/DefaultContextService");
237-
238210
Map<String, String> execProps = new HashMap<String, String>();
239211
execProps.put("vendor_a.security.tokenexpiration", "15000");
240212
execProps.put("USE_PARENT_TRANSACTION", "true");
241213

242-
Object proxy = cs.createContextualProxy(new TestRunnableWork(), execProps, Runnable.class,
214+
Object proxy = TestUtil.getContextService().createContextualProxy(new TestRunnableWork(), execProps, Runnable.class,
243215
TestWorkInterface.class);
244216
pass = proxy instanceof Runnable && proxy instanceof TestWorkInterface;
245-
} catch (NamingException ne) {
246-
log.severe("Failed to lookup default ContextService" + ne);
247217
} catch (Exception e) {
248218
log.severe("Unexpected Exception Caught", e);
249219
}
@@ -263,17 +233,12 @@ public void ContextServiceWithMultiIntfsAndProperties() {
263233
public void ContextServiceWithIntfAndPropertiesAndIntfNoImplemented() {
264234
boolean pass = false;
265235
try {
266-
InitialContext ctx = new InitialContext();
267-
ContextService cs = (ContextService) ctx.lookup("java:comp/DefaultContextService");
268-
269236
Map<String, String> execProps = new HashMap<String, String>();
270237
execProps.put("vendor_a.security.tokenexpiration", "15000");
271238
execProps.put("USE_PARENT_TRANSACTION", "true");
272239

273-
Object proxy = cs.createContextualProxy(new TestRunnableWork(), execProps, Runnable.class,
240+
Object proxy = TestUtil.getContextService().createContextualProxy(new TestRunnableWork(), execProps, Runnable.class,
274241
ManagedTaskListener.class);
275-
} catch (NamingException ne) {
276-
log.severe("Failed to lookup default ContextService" + ne);
277242
} catch (IllegalArgumentException ie) {
278243
pass = true;
279244
} catch (Exception e) {
@@ -295,17 +260,12 @@ public void ContextServiceWithIntfAndPropertiesAndIntfNoImplemented() {
295260
public void ContextServiceWithIntfsAndPropertiesAndInstanceIsNull() {
296261
boolean pass = false;
297262
try {
298-
InitialContext ctx = new InitialContext();
299-
ContextService cs = (ContextService) ctx.lookup("java:comp/DefaultContextService");
300-
301263
Map<String, String> execProps = new HashMap<String, String>();
302264
execProps.put("vendor_a.security.tokenexpiration", "15000");
303265
execProps.put("USE_PARENT_TRANSACTION", "true");
304266

305-
Object proxy = cs.createContextualProxy(null, execProps, Runnable.class);
267+
Object proxy = TestUtil.getContextService().createContextualProxy(null, execProps, Runnable.class);
306268
log.info(proxy.toString());
307-
} catch (NamingException ne) {
308-
log.severe("Failed to lookup default ContextService" + ne);
309269
} catch (IllegalArgumentException ie) {
310270
pass = true;
311271
} catch (Exception e) {
@@ -327,17 +287,12 @@ public void ContextServiceWithIntfsAndPropertiesAndInstanceIsNull() {
327287
public void ContextServiceWithMultiIntfsAndPropertiesAndIntfNoImplemented() {
328288
boolean pass = false;
329289
try {
330-
InitialContext ctx = new InitialContext();
331-
ContextService cs = (ContextService) ctx.lookup("java:comp/DefaultContextService");
332-
333290
Map<String, String> execProps = new HashMap<String, String>();
334291
execProps.put("vendor_a.security.tokenexpiration", "15000");
335292
execProps.put("USE_PARENT_TRANSACTION", "true");
336293

337-
Object proxy = cs.createContextualProxy(new TestRunnableWork(), execProps, Runnable.class,
294+
Object proxy = TestUtil.getContextService().createContextualProxy(new TestRunnableWork(), execProps, Runnable.class,
338295
TestWorkInterface.class, ManagedTaskListener.class);
339-
} catch (NamingException ne) {
340-
log.severe("Failed to lookup default ContextService" + ne);
341296
} catch (IllegalArgumentException ie) {
342297
pass = true;
343298
} catch (Exception e) {
@@ -359,17 +314,12 @@ public void ContextServiceWithMultiIntfsAndPropertiesAndIntfNoImplemented() {
359314
public void ContextServiceWithMultiIntfsAndPropertiesAndInstanceIsNull() {
360315
boolean pass = false;
361316
try {
362-
InitialContext ctx = new InitialContext();
363-
ContextService cs = (ContextService) ctx.lookup("java:comp/DefaultContextService");
364-
365317
Map<String, String> execProps = new HashMap<String, String>();
366318
execProps.put("vendor_a.security.tokenexpiration", "15000");
367319
execProps.put("USE_PARENT_TRANSACTION", "true");
368320

369-
Object proxy = cs.createContextualProxy(null, execProps, Runnable.class, TestWorkInterface.class);
321+
Object proxy = TestUtil.getContextService().createContextualProxy(null, execProps, Runnable.class, TestWorkInterface.class);
370322
log.info(proxy.toString());
371-
} catch (NamingException ne) {
372-
log.severe("Failed to lookup default ContextService" + ne);
373323
} catch (IllegalArgumentException ie) {
374324
pass = true;
375325
} catch (Exception e) {
@@ -391,23 +341,18 @@ public void ContextServiceWithMultiIntfsAndPropertiesAndInstanceIsNull() {
391341
public void GetExecutionProperties() {
392342
boolean pass = false;
393343
try {
394-
InitialContext ctx = new InitialContext();
395-
ContextService cs = (ContextService) ctx.lookup("java:comp/DefaultContextService");
396-
397344
Map<String, String> execProps = new HashMap<String, String>();
398345
execProps.put("USE_PARENT_TRANSACTION", "true");
399346

400-
Object proxy = cs.createContextualProxy(new TestRunnableWork(), execProps, Runnable.class,
347+
Object proxy = TestUtil.getContextService().createContextualProxy(new TestRunnableWork(), execProps, Runnable.class,
401348
TestWorkInterface.class);
402-
Map<String, String> returnedExecProps = cs.getExecutionProperties(proxy);
349+
Map<String, String> returnedExecProps = TestUtil.getContextService().getExecutionProperties(proxy);
403350

404351
if (!"true".equals(returnedExecProps.get("USE_PARENT_TRANSACTION"))) {
405352
log.severe("Expected:true, actual message=" + returnedExecProps.get("USE_PARENT_TRANSACTION"));
406353
} else {
407354
pass = true;
408355
}
409-
} catch (NamingException ne) {
410-
log.severe("Failed to lookup default ContextService" + ne);
411356
} catch (Exception e) {
412357
log.severe("Unexpected Exception Caught", e);
413358
}
@@ -426,12 +371,8 @@ public void GetExecutionProperties() {
426371
public void GetExecutionPropertiesNoProxy() {
427372
boolean pass = false;
428373
try {
429-
InitialContext ctx = new InitialContext();
430-
ContextService cs = (ContextService) ctx.lookup("java:comp/DefaultContextService");
431-
Map<String, String> returnedExecProps = cs.getExecutionProperties(new Object());
374+
Map<String, String> returnedExecProps = TestUtil.getContextService().getExecutionProperties(new Object());
432375
pass = true;
433-
} catch (NamingException ne) {
434-
log.severe("Failed to lookup default ContextService" + ne);
435376
} catch (IllegalArgumentException ie) {
436377
pass = true;
437378
} catch (Exception e) {

tck/src/main/java/ee/jakarta/tck/concurrent/api/ContextService/build.xml

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)