-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pom and code for running CDI TCK
Signed-off-by: Arjan Tijms <arjan.tijms@gmail.com>
- Loading branch information
1 parent
32ab589
commit 4f1810f
Showing
7 changed files
with
621 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
85 changes: 85 additions & 0 deletions
85
...i/src/test/java/org/jboss/weld/tck/glassfish/GlassFishDeploymentExceptionTransformer.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,85 @@ | ||
/* | ||
* 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 org.jboss.weld.tck.glassfish; | ||
|
||
import java.util.List; | ||
|
||
import jakarta.enterprise.inject.spi.DefinitionException; | ||
import jakarta.enterprise.inject.spi.DeploymentException; | ||
|
||
import org.apache.commons.lang.exception.ExceptionUtils; | ||
import org.jboss.arquillian.container.spi.client.container.DeploymentExceptionTransformer; | ||
|
||
/** | ||
* | ||
* See AS7-1197 for more details. | ||
* | ||
* @see org.jboss.weld.tck.glassfish.GlassFishExtension | ||
* @author J J Snyder (j.j.snyder@oracle.com) | ||
*/ | ||
public class GlassFishDeploymentExceptionTransformer implements DeploymentExceptionTransformer { | ||
|
||
private static final String[] DEPLOYMENT_EXCEPTION_FRAGMENTS = new String[] { | ||
"org.jboss.weld.exceptions.DeploymentException", | ||
"org.jboss.weld.exceptions.UnserializableDependencyException", | ||
"org.jboss.weld.exceptions.InconsistentSpecializationException", | ||
"CDI deployment failure:", | ||
"org.jboss.weld.exceptions.NullableDependencyException" }; | ||
|
||
private static final String[] DEFINITION_EXCEPTION_FRAGMENTS = new String[] | ||
{ "CDI definition failure:", | ||
"org.jboss.weld.exceptions.DefinitionException" }; | ||
|
||
public Throwable transform(Throwable throwable) { | ||
|
||
// Arquillian sometimes returns InvocationException with nested AS7 | ||
// exception and sometimes AS7 exception itself | ||
@SuppressWarnings("unchecked") | ||
List<Throwable> throwableList = ExceptionUtils.getThrowableList(throwable); | ||
if (throwableList.size() < 1) | ||
return throwable; | ||
|
||
Throwable root = null; | ||
|
||
if (throwableList.size() == 1) { | ||
root = throwable; | ||
} else { | ||
root = ExceptionUtils.getRootCause(throwable); | ||
} | ||
|
||
if (root instanceof DeploymentException || root instanceof DefinitionException) { | ||
return root; | ||
} | ||
if (isFragmentFound(DEPLOYMENT_EXCEPTION_FRAGMENTS, root)) { | ||
return new DeploymentException(root); | ||
} | ||
if (isFragmentFound(DEFINITION_EXCEPTION_FRAGMENTS, root)) { | ||
return new DefinitionException(root); | ||
} | ||
return throwable; | ||
} | ||
|
||
private boolean isFragmentFound(String[] fragments, Throwable rootException) { | ||
for (String fragment : fragments) { | ||
if (rootException.getMessage().contains(fragment)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
appserver/tests/tck/cdi/src/test/java/org/jboss/weld/tck/glassfish/GlassFishExtension.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,38 @@ | ||
/* | ||
* 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 | ||
*/ | ||
|
||
package org.jboss.weld.tck.glassfish; | ||
|
||
import org.jboss.arquillian.container.spi.client.container.DeploymentExceptionTransformer; | ||
import org.jboss.arquillian.core.spi.LoadableExtension; | ||
|
||
/** | ||
* Registers the exception transformer to properly identify deployment failures. | ||
* | ||
* @author J J Snyder (j.j.snyder@oracle.com) | ||
*/ | ||
public class GlassFishExtension implements LoadableExtension { | ||
|
||
private static final String GLASSFISH_CLIENTUTILS_CLASS = "org.omnifaces.arquillian.container.glassfish.clientutils.GlassFishClientUtil"; | ||
|
||
@Override | ||
public void register(ExtensionBuilder builder) { | ||
if (Validate.classExists(GLASSFISH_CLIENTUTILS_CLASS)) { | ||
builder.service(DeploymentExceptionTransformer.class, GlassFishDeploymentExceptionTransformer.class); | ||
} | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
.../cdi/src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
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 @@ | ||
org.jboss.weld.tck.glassfish.GlassFishExtension |
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,77 @@ | ||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> | ||
<!-- | ||
Copyright (c) 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 | ||
--> | ||
|
||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> | ||
|
||
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> | ||
<param name="Target" value="System.out"/> | ||
<layout class="org.apache.log4j.PatternLayout"> | ||
<!-- The default pattern: Date Priority [Category] Message\n --> | ||
<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{2}] %m%n"/> | ||
</layout> | ||
<filter class="org.apache.log4j.varia.StringMatchFilter"> | ||
<param name="AcceptOnMatch" value="false" /> | ||
<param name="StringToMatch" value="Failure while notifying an observer of event [a]" /> | ||
</filter> | ||
<filter class="org.apache.log4j.varia.StringMatchFilter"> | ||
<param name="AcceptOnMatch" value="false" /> | ||
<param name="StringToMatch" value="Error destroying org.jboss.weld.bean-test-ManagedBean-class org.jboss.jsr299.tck.tests.implementation.simple.lifecycle.Cod" /> | ||
</filter> | ||
</appender> | ||
|
||
<!-- ############### Embedded EJB3 ################# --> | ||
<category name="org.jboss"> | ||
<priority value="ERROR"/> | ||
</category> | ||
|
||
<category name="org.jboss.test"> | ||
<priority value="ERROR"/> | ||
</category> | ||
|
||
<category name="com.arjuna"> | ||
<priority value="ERROR"/> | ||
</category> | ||
|
||
<!-- ############### Hibernate logging ################# --> | ||
|
||
<category name="org.hibernate"> | ||
<priority value="ERROR"/> | ||
</category> | ||
|
||
|
||
<!-- ############### Weld logging ################### --> | ||
|
||
<category name="org.jboss.weld"> | ||
<priority value="WARN"/> | ||
</category> | ||
|
||
<category name="org.jboss.weld.tck"> | ||
<priority value="INFO"/> | ||
</category> | ||
|
||
<category name="org.jboss.testharness"> | ||
<priority value="INFO"/> | ||
</category> | ||
|
||
<root> | ||
<priority value="INFO"/> | ||
<appender-ref ref="CONSOLE"/> | ||
</root> | ||
|
||
</log4j:configuration> |
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,3 @@ | ||
AS_ADMIN_MASTERPASSWORD= | ||
AS_ADMIN_PASSWORD= | ||
AS_ADMIN_USERPASSWORD= |
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