Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Seam Compatibility tests - iteration 3 / CDITCK-230
- Loading branch information
Showing
21 changed files
with
877 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/packaging/ear/BarBean.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,29 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011, Red Hat, Inc. and/or its affiliates, and individual | ||
* contributors by the @authors tag. See the copyright.txt in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* Licensed 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.jboss.jsr299.tck.tests.deployment.packaging.ear; | ||
|
||
import javax.inject.Inject; | ||
|
||
public class BarBean { | ||
|
||
@Inject | ||
private BarExtension extension; | ||
|
||
public BarExtension getExtension() { | ||
return extension; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/packaging/ear/BarExtension.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,28 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011, Red Hat, Inc. and/or its affiliates, and individual | ||
* contributors by the @authors tag. See the copyright.txt in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* Licensed 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.jboss.jsr299.tck.tests.deployment.packaging.ear; | ||
|
||
import javax.enterprise.event.Observes; | ||
import javax.enterprise.inject.spi.BeforeBeanDiscovery; | ||
import javax.enterprise.inject.spi.Extension; | ||
|
||
public class BarExtension implements Extension { | ||
|
||
public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event) { | ||
System.out.println("bar"); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/packaging/ear/BarWebBean.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,34 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011, Red Hat, Inc. and/or its affiliates, and individual | ||
* contributors by the @authors tag. See the copyright.txt in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* Licensed 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.jboss.jsr299.tck.tests.deployment.packaging.ear; | ||
|
||
import javax.inject.Inject; | ||
|
||
/** | ||
* | ||
* @author Martin Kouba | ||
*/ | ||
public class BarWebBean { | ||
|
||
@Inject | ||
FooBean fooBean; | ||
|
||
public void ping() { | ||
fooBean.getExtension(); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/packaging/ear/FooBean.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,29 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011, Red Hat, Inc. and/or its affiliates, and individual | ||
* contributors by the @authors tag. See the copyright.txt in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* Licensed 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.jboss.jsr299.tck.tests.deployment.packaging.ear; | ||
|
||
import javax.inject.Inject; | ||
|
||
public class FooBean { | ||
|
||
@Inject | ||
private FooExtension extension; | ||
|
||
public FooExtension getExtension() { | ||
return extension; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/packaging/ear/FooExtension.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,28 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011, Red Hat, Inc. and/or its affiliates, and individual | ||
* contributors by the @authors tag. See the copyright.txt in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* Licensed 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.jboss.jsr299.tck.tests.deployment.packaging.ear; | ||
|
||
import javax.enterprise.event.Observes; | ||
import javax.enterprise.inject.spi.BeforeBeanDiscovery; | ||
import javax.enterprise.inject.spi.Extension; | ||
|
||
public class FooExtension implements Extension { | ||
|
||
public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event) { | ||
System.out.println("foo"); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/packaging/ear/FooWebBean.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,34 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011, Red Hat, Inc. and/or its affiliates, and individual | ||
* contributors by the @authors tag. See the copyright.txt in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* Licensed 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.jboss.jsr299.tck.tests.deployment.packaging.ear; | ||
|
||
import javax.inject.Inject; | ||
|
||
/** | ||
* | ||
* @author Martin Kouba | ||
*/ | ||
public class FooWebBean { | ||
|
||
@Inject | ||
FooBean fooBean; | ||
|
||
public void ping() { | ||
fooBean.getExtension(); | ||
} | ||
|
||
} |
72 changes: 72 additions & 0 deletions
72
impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/packaging/ear/MultiWebAppTest.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,72 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011, Red Hat, Inc. and/or its affiliates, and individual | ||
* contributors by the @authors tag. See the copyright.txt in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* Licensed 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.jboss.jsr299.tck.tests.deployment.packaging.ear; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.jsr299.tck.shrinkwrap.EnterpriseArchiveBuilder; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.jboss.shrinkwrap.descriptor.api.Descriptors; | ||
import org.jboss.shrinkwrap.descriptor.api.application6.ApplicationDescriptor; | ||
import org.jboss.test.audit.annotations.SpecAssertion; | ||
import org.jboss.test.audit.annotations.SpecAssertions; | ||
import org.jboss.test.audit.annotations.SpecVersion; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* This test verifies that multiple CDI-enabled web applications can be bundled inside of an enterprise archive (.ear) | ||
* | ||
* <p> | ||
* This test was originally part of Seam Compatibility project. | ||
* <p> | ||
* | ||
* TODO verify assertions | ||
* | ||
* @author <a href="http://community.jboss.org/people/jharting">Jozef Hartinger</a> | ||
* @author Martin Kouba | ||
* @see http://java.net/jira/browse/GLASSFISH-16303 | ||
*/ | ||
@SpecVersion(spec = "cdi", version = "20091101") | ||
public class MultiWebAppTest extends SingleWebAppTest { | ||
|
||
@Deployment(testable = false) | ||
public static EnterpriseArchive createTestArchive() { | ||
|
||
EnterpriseArchive enterpriseArchive = new EnterpriseArchiveBuilder().withTestClass(MultiWebAppTest.class).build(); | ||
StringAsset applicationXml = new StringAsset(Descriptors.create(ApplicationDescriptor.class).applicationName("Test") | ||
.createModule().getOrCreateWeb().webUri("foo.war").contextRoot("/foo").up().up().createModule() | ||
.getOrCreateWeb().webUri("bar.war").contextRoot("/bar").up().up().exportAsString()); | ||
enterpriseArchive.setApplicationXML(applicationXml); | ||
|
||
WebArchive fooArchive = createWar("foo.war", createJar("foo.jar", FooExtension.class, FooBean.class)); | ||
fooArchive.addClass(FooWebBean.class); | ||
enterpriseArchive.addAsModule(fooArchive); | ||
|
||
WebArchive barArchive = createWar("bar.war", createJar("bar.jar", BarExtension.class, BarBean.class)); | ||
barArchive.addClass(BarWebBean.class); | ||
enterpriseArchive.addAsModule(barArchive); | ||
|
||
return enterpriseArchive; | ||
} | ||
|
||
@Test | ||
@SpecAssertions({ @SpecAssertion(section = "12.1", id = "bbc"), @SpecAssertion(section = "12.1", id = "bbe") }) | ||
public void test() { | ||
} | ||
|
||
} |
89 changes: 89 additions & 0 deletions
89
impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/packaging/ear/SingleWebAppTest.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,89 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011, Red Hat, Inc. and/or its affiliates, and individual | ||
* contributors by the @authors tag. See the copyright.txt in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* Licensed 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.jboss.jsr299.tck.tests.deployment.packaging.ear; | ||
|
||
import javax.enterprise.inject.spi.Extension; | ||
import javax.inject.Inject; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.jsr299.tck.AbstractJSR299Test; | ||
import org.jboss.jsr299.tck.shrinkwrap.EnterpriseArchiveBuilder; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.jboss.shrinkwrap.descriptor.api.Descriptors; | ||
import org.jboss.shrinkwrap.descriptor.api.application6.ApplicationDescriptor; | ||
import org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor; | ||
import org.jboss.test.audit.annotations.SpecAssertion; | ||
import org.jboss.test.audit.annotations.SpecAssertions; | ||
import org.jboss.test.audit.annotations.SpecVersion; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* This test verifies that a CDI extension can be used with a web application bundled inside of an enterprise archive (.ear) | ||
* | ||
* <p> | ||
* This test was originally part of Seam Compatibility project. | ||
* <p> | ||
* | ||
* TODO verify assertions | ||
* | ||
* @author <a href="http://community.jboss.org/people/jharting">Jozef Hartinger</a> | ||
* @author Martin Kouba | ||
* @see https://issues.jboss.org/browse/JBAS-8683 | ||
*/ | ||
@SpecVersion(spec = "cdi", version = "20091101") | ||
public class SingleWebAppTest extends AbstractJSR299Test { | ||
|
||
@Deployment | ||
public static EnterpriseArchive createTestArchive() { | ||
|
||
EnterpriseArchive enterpriseArchive = new EnterpriseArchiveBuilder().withTestClass(SingleWebAppTest.class).build(); | ||
StringAsset applicationXml = new StringAsset(Descriptors.create(ApplicationDescriptor.class).applicationName("Test") | ||
.createModule().getOrCreateWeb().webUri("test.war").contextRoot("/test").up().up().exportAsString()); | ||
enterpriseArchive.setApplicationXML(applicationXml); | ||
|
||
WebArchive webArchive = createWar("test.war", createJar("test.jar", FooExtension.class, FooBean.class)); | ||
webArchive.addClass(FooWebBean.class); | ||
|
||
enterpriseArchive.addAsModule(webArchive); | ||
return enterpriseArchive; | ||
} | ||
|
||
public static WebArchive createWar(String name, JavaArchive... libraries) { | ||
StringAsset webXml = new StringAsset(Descriptors.create(WebAppDescriptor.class).exportAsString()); | ||
return ShrinkWrap.create(WebArchive.class, name).setWebXML(webXml) | ||
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml").addAsLibraries(libraries); | ||
} | ||
|
||
public static JavaArchive createJar(String name, Class<? extends Extension> extension, Class<?>... classes) { | ||
return ShrinkWrap.create(JavaArchive.class, name).addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") | ||
.addClasses(classes).addClass(extension).addAsServiceProvider(Extension.class, extension); | ||
} | ||
|
||
@Inject | ||
FooWebBean fooWebBean; | ||
|
||
@Test | ||
@SpecAssertions({ @SpecAssertion(section = "12.1", id = "bbc"), @SpecAssertion(section = "12.1", id = "bbe") }) | ||
public void test() { | ||
fooWebBean.ping(); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/packaging/visibility/American.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,36 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011, Red Hat, Inc. and/or its affiliates, and individual | ||
* contributors by the @authors tag. See the copyright.txt in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* Licensed 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.jboss.jsr299.tck.tests.deployment.packaging.visibility; | ||
|
||
import static java.lang.annotation.ElementType.FIELD; | ||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.ElementType.PARAMETER; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import javax.inject.Qualifier; | ||
|
||
@Qualifier | ||
@Target({ TYPE, METHOD, PARAMETER, FIELD }) | ||
@Retention(RUNTIME) | ||
@Documented | ||
public @interface American { | ||
} |
Oops, something went wrong.