forked from jakartaee/concurrency
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request jakartaee#416 from KyleAure/404-qualifier-anno-tests
Add qualifier injection tests for Annotation defined resources
- Loading branch information
Showing
14 changed files
with
851 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/anno/AnnotationFullTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
* Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
* | ||
* 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 ee.jakarta.tck.concurrent.spec.Platform.anno; | ||
|
||
import java.net.URL; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.container.test.api.RunAsClient; | ||
import org.jboss.arquillian.test.api.ArquillianResource; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
|
||
import ee.jakarta.tck.concurrent.common.context.providers.IntContextProvider; | ||
import ee.jakarta.tck.concurrent.common.context.providers.StringContextProvider; | ||
import ee.jakarta.tck.concurrent.framework.TestClient; | ||
import ee.jakarta.tck.concurrent.framework.junit.anno.Assertion; | ||
import ee.jakarta.tck.concurrent.framework.junit.anno.Challenge; | ||
import ee.jakarta.tck.concurrent.framework.junit.anno.Full; | ||
import ee.jakarta.tck.concurrent.framework.junit.anno.TestName; | ||
import ee.jakarta.tck.concurrent.framework.junit.anno.Common.PACKAGE; | ||
import jakarta.enterprise.concurrent.spi.ThreadContextProvider; | ||
|
||
/** | ||
* Covers ContextServiceDefinition, ManagedExecutorDefinition, ManagedScheduledExecutorDefinition, and | ||
* ManagedThreadFactoryDefinition annotations and their interaction with Deployment Descriptors. | ||
*/ | ||
@Full | ||
@RunAsClient // Requires client testing due to annotation configuration | ||
public class AnnotationFullTests extends TestClient { | ||
|
||
@ArquillianResource(AnnotationServlet.class) | ||
private URL baseURL; | ||
|
||
@Deployment(name = "AnnotationTests") | ||
public static EnterpriseArchive createDeployment() { | ||
|
||
WebArchive war = ShrinkWrap.create(WebArchive.class, "AnnotationTests_web.war") | ||
.addClasses(AnnotationServlet.class); | ||
|
||
JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "AnnotationTests_ejb.jar") | ||
.addClasses(AnnotationTestBean.class, AnnotationTestBeanInterface.class) | ||
.addPackages(false, | ||
PACKAGE.CONTEXT.getPackageName(), | ||
PACKAGE.CONTEXT_PROVIDERS.getPackageName(), | ||
PACKAGE.QUALIFIERS.getPackageName()) | ||
.addAsServiceProvider(ThreadContextProvider.class.getName(), IntContextProvider.class.getName(), | ||
StringContextProvider.class.getName()); | ||
|
||
EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "AnnotationTests.ear") | ||
.addAsManifestResource(AnnotationFullTests.class.getPackage(), "application.xml", | ||
"application.xml") | ||
.addAsModules(war, jar); | ||
|
||
return ear; | ||
} | ||
|
||
@TestName | ||
private String testname; | ||
|
||
@Override | ||
protected String getServletPath() { | ||
return "AnnotationServlet"; | ||
} | ||
|
||
@Assertion(id = "GIT:404", strategy = "Tests injection of concurrent resources defined in a annotation with qualifier(s).") | ||
public void testAnnotationDefinesQualifiers() { | ||
runTest(baseURL, testname); | ||
} | ||
|
||
@Assertion(id = "GIT:404", strategy = "Tests context-service defined in a annotation.") | ||
public void testAnnotationDefinesContextService() { | ||
runTest(baseURL, testname); | ||
} | ||
|
||
@Assertion(id = "GIT:404", strategy = "Tests managed-executor defined in a annotation.") | ||
public void testAnnotationDefinesManagedExecutor() { | ||
runTest(baseURL, testname); | ||
} | ||
|
||
@Assertion(id = "GIT:404", strategy = "Tests managed-scheduled-executor defined in a annotation.") | ||
public void testAnnotationDefinesManagedScheduledExecutor() { | ||
runTest(baseURL, testname); | ||
} | ||
|
||
@Challenge(link = "https://github.com/jakartaee/concurrency/issues/226", version = "3.0.0") | ||
@Assertion(id = "GIT:404", strategy = "Tests managed-thread-factory defined in a annotation.") | ||
public void testAnnotationDefinesManagedThreadFactory() { | ||
runTest(baseURL, testname); | ||
} | ||
} |
Oops, something went wrong.