Skip to content

Commit

Permalink
Initial version of TCK tests unmodified from jakartaee-tck repo
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAure committed Jan 12, 2022
1 parent caf1381 commit 9143fbf
Show file tree
Hide file tree
Showing 190 changed files with 14,572 additions and 0 deletions.
63 changes: 63 additions & 0 deletions tck/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.eclipse.ee4j</groupId>
<artifactId>project</artifactId>
<version>1.0.6</version>
</parent>

<groupId>jakarta.enterprise.concurrent</groupId>
<artifactId>jakarta.enterprise.concurrent-tck</artifactId>
<version>2.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Jakarta Concurrency TCK</name>
<description>Jakarta Concurrency TCK Tests</description>

<licenses>
<license>
<name>Eclipse Public License 2.0</name>
<url>https://projects.eclipse.org/license/epl-2.0</url>
<distribution>repo</distribution>
</license>
<license>
<name>GNU General Public License, version 2 with the GNU Classpath Exception</name>
<url>https://projects.eclipse.org/license/secondary-gpl-2.0-cp</url>
<distribution>repo</distribution>
</license>
</licenses>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jakarta.concurrent.version>2.0.0</jakarta.concurrent.version>
</properties>

<dependencies>
<dependency>
<groupId>jakarta.enterprise.concurrent</groupId>
<artifactId>jakarta.enterprise.concurrent-api</artifactId>
<version>${jakarta.concurrent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
/*
* Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package com.sun.ts.tests.concurrency.api.AbortedException;

import java.util.Properties;

import com.sun.javatest.Status;
import com.sun.ts.lib.harness.ServiceEETest;
import com.sun.ts.lib.util.TestUtil;

import jakarta.enterprise.concurrent.AbortedException;

public class Client extends ServiceEETest implements java.io.Serializable {

public Client() {
}

public static void main(String[] args) {
Client theTests = new Client();
Status s = theTests.run(args, System.out, System.err);
s.exit();
}

public void setup(String[] args, Properties p) throws Fault {
TestUtil.logTrace("setup");
try {
// do your setup if any here
} catch (Exception e) {
TestUtil.logErr("Exception: ", e);
throw new Fault("Setup failed:", e);
}
}

public void cleanup() throws Fault {
TestUtil.logTrace("cleanup");
}

/*
* @testName: AbortedExceptionNoArgTest
*
* @assertion_ids: CONCURRENCY:JAVADOC:1
*
* @test_Strategy: Constructs an AbortedException.
*/
public void AbortedExceptionNoArgTest() throws Fault {
boolean pass = false;
try {
throw new AbortedException();
} catch (AbortedException ae) {
TestUtil.logTrace("AbortedException Caught as Expected");
if (ae.getMessage() == null) {
TestUtil.logTrace("Received expected null message");
pass = true;
} else {
TestUtil.logErr(
"AbortedException should have had null message, actual message="
+ ae.getMessage());
}
} catch (Exception e) {
TestUtil.logErr("Unexpected Exception Caught", e);
}
if (!pass)
throw new Fault("AbortedExceptionNoArgTest failed");
}

/*
* @testName: AbortedExceptionStringTest
*
* @assertion_ids: CONCURRENCY:JAVADOC:3
*
* @test_Strategy: Constructs an AbortedException.
*/
public void AbortedExceptionStringTest() throws Fault {
boolean pass = false;
String expected = "thisisthedetailmessage";
try {
throw new AbortedException(expected);
} catch (AbortedException ae) {
TestUtil.logTrace("AbortedException Caught as Expected");
if (ae.getMessage().equals(expected)) {
TestUtil.logTrace("Received expected message");
pass = true;
} else {
TestUtil.logErr(
"Expected:" + expected + ", actual message=" + ae.getMessage());
}
} catch (Exception e) {
TestUtil.logErr("Unexpected Exception Caught", e);
}
if (!pass)
throw new Fault("AbortedExceptionStringTest failed");
}

/*
* @testName: AbortedExceptionThrowableTest
*
* @assertion_ids: CONCURRENCY:JAVADOC:4
*
* @test_Strategy: Constructs an AbortedException.
*/
public void AbortedExceptionThrowableTest() throws Fault {
boolean pass1 = false;
boolean pass2 = false;
Throwable expected = new Throwable("thisisthethrowable");
try {
throw new AbortedException(expected);
} catch (AbortedException ae) {
TestUtil.logTrace("AbortedException Caught as Expected");
Throwable cause = ae.getCause();
if (cause.equals(expected)) {
TestUtil.logTrace("Received expected cause");
pass1 = true;
} else {
TestUtil.logErr("Expected:" + expected + ", actual message=" + cause);
}
} catch (Exception e) {
TestUtil.logErr("Unexpected Exception Caught", e);
}

expected = null;
try {
throw new AbortedException(expected);
} catch (AbortedException ae) {
TestUtil.logTrace("AbortedException Caught as Expected");
Throwable cause = ae.getCause();
if (cause == null) {
TestUtil.logTrace("Received expected null cause");
pass2 = true;
} else {
TestUtil.logErr("Expected:null, actual message=" + cause);
}
} catch (Exception e) {
TestUtil.logErr("Unexpected Exception Caught", e);
}
if (!pass1 || !pass2)
throw new Fault("AbortedExceptionThrowableTest failed");
}

/*
* @testName: AbortedExceptionStringThrowableTest
*
* @assertion_ids: CONCURRENCY:JAVADOC:2
*
* @test_Strategy: Constructs an AbortedException.
*/
public void AbortedExceptionStringThrowableTest() throws Fault {
boolean pass1 = false;
boolean pass2 = false;
boolean pass3 = false;
boolean pass4 = false;
String sExpected = "thisisthedetailmessage";
Throwable tExpected = new Throwable("thisisthethrowable");
try {
throw new AbortedException(sExpected, tExpected);
} catch (AbortedException ae) {
TestUtil.logTrace("AbortedException Caught as Expected");
if (ae.getMessage().equals(sExpected)) {
TestUtil.logTrace("Received expected message");
pass1 = true;
} else {
TestUtil.logErr(
"Expected:" + sExpected + ", actual message=" + ae.getMessage());
}
Throwable cause = ae.getCause();
if (cause.equals(tExpected)) {
TestUtil.logTrace("Received expected cause");
pass2 = true;
} else {
TestUtil.logErr("Expected:" + tExpected + ", actual message=" + cause);
}
} catch (Exception e) {
TestUtil.logErr("Unexpected Exception Caught", e);
}

tExpected = null;
try {
throw new AbortedException(sExpected, tExpected);
} catch (AbortedException ae) {
TestUtil.logTrace("AbortedException Caught as Expected");
if (ae.getMessage().equals(sExpected)) {
TestUtil.logTrace("Received expected message");
pass3 = true;
} else {
TestUtil.logErr(
"Expected:" + sExpected + ", actual message=" + ae.getMessage());
}
Throwable cause = ae.getCause();
if (cause == null) {
TestUtil.logTrace("Received expected null cause");
pass4 = true;
} else {
TestUtil.logErr("Expected:null, actual message=" + cause);
}
} catch (Exception e) {
TestUtil.logErr("Unexpected Exception Caught", e);
}
if (!pass1 || !pass2 || !pass3 || !pass4)
throw new Fault("AbortedExceptionStringThrowableTest failed");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->

<project name="concurrency_api_AbortedException" basedir="." default="usage">

<!-- IMPORTS -->

<import file="../../../../../../../../bin/xml/ts.import.xml"/>

<property name="app.name" value="${ant.project.name}"/>

<target name="package" >
<ts.vehicles name="${app.name}" singleear="true" />
</target>

</project>

0 comments on commit 9143fbf

Please sign in to comment.