DELTASPIKE-479 added test
Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/97bde124 Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/97bde124 Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/97bde124 Branch: refs/heads/master Commit: 97bde124179e03afa70ff92e4ccd24f6592fa745 Parents: 90c0129 Author: gpetracek <[email protected]> Authored: Wed Dec 25 17:35:38 2013 +0100 Committer: gpetracek <[email protected]> Committed: Wed Dec 25 17:35:38 2013 +0100 ---------------------------------------------------------------------- .../ExcludeTestProjectStageDevelopment.java | 28 +-------- ...cludeTestProjectStageEarFileDevelopment.java | 51 ++++++++++++++++ ...cludeTestProjectStageWarFileDevelopment.java | 62 ++++++++++++++++++++ 3 files changed, 114 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/97bde124/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageDevelopment.java ---------------------------------------------------------------------- diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageDevelopment.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageDevelopment.java index a54e8ea..2628a27 100644 --- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageDevelopment.java +++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageDevelopment.java @@ -20,14 +20,7 @@ package org.apache.deltaspike.test.core.api.exclude; import org.apache.deltaspike.core.api.provider.BeanProvider; -import org.apache.deltaspike.core.util.ProjectStageProducer; -import org.apache.deltaspike.test.util.ArchiveUtils; -import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.asset.EmptyAsset; -import org.jboss.shrinkwrap.api.spec.JavaArchive; -import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -36,28 +29,9 @@ import org.junit.runner.RunWith; * Tests for {@link org.apache.deltaspike.core.api.exclude.Exclude} */ @RunWith(Arquillian.class) -public class ExcludeTestProjectStageDevelopment +public abstract class ExcludeTestProjectStageDevelopment { /** - * X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain other archives. - */ - @Deployment - public static WebArchive deploy() - { - System.setProperty("org.apache.deltaspike.ProjectStage", "Development"); - ProjectStageProducer.setProjectStage(null); - - JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "excludeTestProjectStageDevelopmentTest.jar") - .addPackage(ExcludeTestProjectStageDevelopment.class.getPackage()) - .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); - - return ShrinkWrap.create(WebArchive.class, "excludeProjectStageDevelopment.war") - .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive()) - .addAsLibraries(testJar) - .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); - } - - /** * bean included in case of project-stage development */ @Test http://git-wip-us.apache.org/repos/asf/deltaspike/blob/97bde124/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageEarFileDevelopment.java ---------------------------------------------------------------------- diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageEarFileDevelopment.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageEarFileDevelopment.java new file mode 100644 index 0000000..473429f --- /dev/null +++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageEarFileDevelopment.java @@ -0,0 +1,51 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you 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.apache.deltaspike.test.core.api.exclude; + + +import org.apache.deltaspike.core.util.ProjectStageProducer; +import org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory; +import org.apache.deltaspike.test.util.ArchiveUtils; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.EnterpriseArchive; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; + +/** + * Tests for {@link org.apache.deltaspike.core.api.exclude.Exclude} + */ +@RunWith(Arquillian.class) +@Category(EnterpriseArchiveProfileCategory.class) +public abstract class ExcludeTestProjectStageEarFileDevelopment extends ExcludeTestProjectStageDevelopment +{ + @Deployment + public static EnterpriseArchive deployEar() + { + String simpleName = ExcludeTestProjectStageEarFileDevelopment.class.getSimpleName(); + String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1); + + return ShrinkWrap.create(EnterpriseArchive.class, archiveName + ".ear") + .addAsModule(ExcludeTestProjectStageWarFileDevelopment.deploy()); + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/97bde124/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageWarFileDevelopment.java ---------------------------------------------------------------------- diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageWarFileDevelopment.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageWarFileDevelopment.java new file mode 100644 index 0000000..990034e --- /dev/null +++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/exclude/ExcludeTestProjectStageWarFileDevelopment.java @@ -0,0 +1,62 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you 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.apache.deltaspike.test.core.api.exclude; + + +import org.apache.deltaspike.core.api.provider.BeanProvider; +import org.apache.deltaspike.core.util.ProjectStageProducer; +import org.apache.deltaspike.test.util.ArchiveUtils; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Tests for {@link org.apache.deltaspike.core.api.exclude.Exclude} + */ +@RunWith(Arquillian.class) +public abstract class ExcludeTestProjectStageWarFileDevelopment extends ExcludeTestProjectStageDevelopment +{ + /** + * X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain other archives. + */ + @Deployment + public static WebArchive deploy() + { + String simpleName = ExcludeTestProjectStageWarFileDevelopment.class.getSimpleName(); + String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1); + + System.setProperty("org.apache.deltaspike.ProjectStage", "Development"); + ProjectStageProducer.setProjectStage(null); + + JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "excludeTestProjectStageDevelopmentTest.jar") + .addPackage(ExcludeTestProjectStageWarFileDevelopment.class.getPackage()) + .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); + + return ShrinkWrap.create(WebArchive.class, archiveName + ".war") + .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive()) + .addAsLibraries(testJar) + .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); + } +}
