You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by gp...@apache.org on 2012/01/02 20:16:56 UTC
git commit: DELTASPIKE-35 changed test-package
Updated Branches:
refs/heads/master 2b580841e -> 9804c0d8b
DELTASPIKE-35 changed test-package
(this change allows to use ShrinkWrapArchiveUtil in
combination with ClassContainer#addClass correctly)
Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/9804c0d8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/9804c0d8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/9804c0d8
Branch: refs/heads/master
Commit: 9804c0d8be183925d28a71b47bf25a0281434944
Parents: 2b58084
Author: gpetracek <gp...@apache.org>
Authored: Mon Jan 2 20:09:06 2012 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Mon Jan 2 20:09:06 2012 +0100
----------------------------------------------------------------------
.../core/test/api/config/ConfigSourceTest.java | 84 ----
.../api/projectstage/ProjectStageProducerTest.java | 66 ----
.../test/api/projectstage/ProjectStageTest.java | 51 ---
.../test/api/projectstage/TestProjectStages.java | 41 --
.../test/api/provider/BeanManagerProviderTest.java | 62 ---
.../core/test/api/provider/BeanProviderTest.java | 122 ------
.../deltaspike/core/test/api/provider/MBean01.java | 29 --
.../deltaspike/core/test/api/provider/MBean02.java | 29 --
.../core/test/api/provider/MultiBean.java | 26 --
.../deltaspike/core/test/api/provider/NoBean.java | 26 --
.../core/test/api/provider/TestBean.java | 39 --
.../api/temptestutil/ShrinkWrapArchiveUtil.java | 298 ---------------
.../test/core/api/config/ConfigSourceTest.java | 84 ++++
.../api/projectstage/ProjectStageProducerTest.java | 66 ++++
.../core/api/projectstage/ProjectStageTest.java | 51 +++
.../core/api/projectstage/TestProjectStages.java | 41 ++
.../core/api/provider/BeanManagerProviderTest.java | 62 +++
.../test/core/api/provider/BeanProviderTest.java | 122 ++++++
.../deltaspike/test/core/api/provider/MBean01.java | 29 ++
.../deltaspike/test/core/api/provider/MBean02.java | 29 ++
.../test/core/api/provider/MultiBean.java | 26 ++
.../deltaspike/test/core/api/provider/NoBean.java | 26 ++
.../test/core/api/provider/TestBean.java | 39 ++
.../api/temptestutil/ShrinkWrapArchiveUtil.java | 298 +++++++++++++++
...aspike.core.api.projectstage.ProjectStageHolder | 2 +-
25 files changed, 874 insertions(+), 874 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/config/ConfigSourceTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/config/ConfigSourceTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/config/ConfigSourceTest.java
deleted file mode 100644
index 425700d..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/config/ConfigSourceTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.core.test.api.config;
-
-import org.apache.deltaspike.core.api.config.ConfigResolver;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Unit tests for {@link org.apache.deltaspike.core.spi.config.ConfigSource}
- */
-public class ConfigSourceTest
-{
- @Test
- public void testConfigViaSystemProperty()
- {
- String key = "testProperty01";
- String value = "test_value_01";
- System.setProperty(key, value);
-
- String configuredValue = ConfigResolver.getPropertyValue(key);
-
- Assert.assertEquals(value, configuredValue);
-
- System.setProperty(key, "");
-
- configuredValue = ConfigResolver.getPropertyValue(key);
-
- Assert.assertEquals("", configuredValue);
- }
-
- @Test
- public void testConfigViaClasspathPropertyFile()
- {
- String key = "testProperty02";
- String value = "test_value_02";
-
- String configuredValue = ConfigResolver.getPropertyValue(key);
-
- Assert.assertEquals(value, configuredValue);
- }
-
- @Test
- public void testConfigViaMetaInfPropertyFile()
- {
- String key = "testProperty03";
- String value = "test_value_03";
-
- String configuredValue = ConfigResolver.getPropertyValue(key);
-
- Assert.assertEquals(value, configuredValue);
- }
-
- /*
- //X TODO discuss marker
- @Test
- public void testConfigViaSystemPropertyAndMarker()
- {
- String key = "testProperty01";
- String value = "test_value";
- System.setProperty("org.apache.deltaspike." + key, value);
-
- String configuredValue = ConfigResolver.getPropertyValue("@@deltaspike@@" + key);
-
- Assert.assertEquals(value, configuredValue);
- }
- */
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/projectstage/ProjectStageProducerTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/projectstage/ProjectStageProducerTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/projectstage/ProjectStageProducerTest.java
deleted file mode 100644
index 9352191..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/projectstage/ProjectStageProducerTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* 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.core.test.api.projectstage;
-
-import org.apache.deltaspike.core.api.projectstage.ProjectStage;
-import org.apache.deltaspike.core.impl.projectstage.ProjectStageProducer;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- *
- */
-public class ProjectStageProducerTest
-{
- /**
- * Test a ProjectStage which got set by the <i>javax.faces.ProjectStage</i>
- */
- @Test
- public void testProjectStageSetByEnvironment()
- {
- String envName = "org.apache.deltaspike.ProjectStage";
- String oldEnvVal = "" + System.getProperty(envName);
- try
- {
- System.setProperty(envName, "SystemTest");
-
- ProjectStageProducer psp = ProjectStageProducer.getInstance();
- Assert.assertNotNull(psp);
-
- ProjectStageProducer.setProjectStage(null);
-
- ProjectStage ps = psp.getProjectStage();
- Assert.assertNotNull(ps);
- Assert.assertEquals(ps, ProjectStage.SystemTest);
- Assert.assertTrue(ps == ProjectStage.SystemTest);
-
- ProjectStageProducer.setProjectStage(null);
- System.setProperty(envName, "IntegrationTest");
-
- ps = psp.getProjectStage();
- Assert.assertNotNull(ps);
- Assert.assertEquals(ps, ProjectStage.IntegrationTest);
- Assert.assertTrue(ps == ProjectStage.IntegrationTest);
- }
- finally
- {
- System.setProperty(envName, oldEnvVal);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/projectstage/ProjectStageTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/projectstage/ProjectStageTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/projectstage/ProjectStageTest.java
deleted file mode 100644
index 757eb4f..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/projectstage/ProjectStageTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-* 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.core.test.api.projectstage;
-
-
-import org.junit.Test;
-import org.junit.Assert;
-
-import org.apache.deltaspike.core.api.projectstage.ProjectStage;
-
-/**
- * Test for {@link ProjectStage}
- */
-public class ProjectStageTest {
-
- @Test
- public void testProjectStages() throws Exception
- {
- ProjectStage ps = ProjectStage.Development;
- Assert.assertNotNull(ps);
-
- ProjectStage psOther = ProjectStage.valueOf("CustomProjectStage");
- Assert.assertNotNull(psOther);
-
- psOther = TestProjectStages.CustomProjectStage;
- Assert.assertNotNull(psOther);
-
- ProjectStage psProd = ProjectStage.valueOf("Production");
- Assert.assertNotNull(psProd);
-
- ProjectStage[] values = ProjectStage.values();
- Assert.assertNotNull(values);
- Assert.assertTrue(values.length == 7);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/projectstage/TestProjectStages.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/projectstage/TestProjectStages.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/projectstage/TestProjectStages.java
deleted file mode 100644
index 8d7d743..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/projectstage/TestProjectStages.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-* 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.core.test.api.projectstage;
-
-
-import org.apache.deltaspike.core.api.projectstage.ProjectStage;
-import org.apache.deltaspike.core.api.projectstage.ProjectStageHolder;
-
-/**
- * This is a test ProjectStage. It demonstrates how to add custom ProjectStages.
- * This TestProjectStage must get registered via the {@link java.util.ServiceLoader}
- * mechanism. Please see the file
- * <pre>
- * META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder
- * </pre>
- */
-public class TestProjectStages implements ProjectStageHolder
-{
- public static final class CustomProjectStage extends ProjectStage
- {
- private static final long serialVersionUID = 1029095387976167179L;
- }
-
- public static final CustomProjectStage CustomProjectStage = new CustomProjectStage();
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/BeanManagerProviderTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/BeanManagerProviderTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/BeanManagerProviderTest.java
deleted file mode 100644
index 1d637df..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/BeanManagerProviderTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-* 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.core.test.api.provider;
-
-
-import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
-import org.apache.deltaspike.core.test.api.temptestutil.ShrinkWrapArchiveUtil;
-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.WebArchive;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import javax.enterprise.inject.spi.BeanManager;
-
-@RunWith(Arquillian.class)
-public class BeanManagerProviderTest
-{
- /**
- *X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain other archives.
- */
- @Deployment
- public static WebArchive deploy()
- {
- return ShrinkWrap.create(WebArchive.class)
- .addAsLibraries(ShrinkWrapArchiveUtil.getArchives(null,
- "META-INF/beans.xml",
- new String[]{"org.apache.deltaspike"},
- null))
- .addClass(TestBean.class)
- .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
- }
-
- @Test
- public void testBeanManagerProvider() throws Exception
- {
- BeanManagerProvider bmp = BeanManagerProvider.getInstance();
- Assert.assertNotNull(bmp);
-
- BeanManager bm = bmp.getBeanManager();
- Assert.assertNotNull(bm);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/BeanProviderTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/BeanProviderTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/BeanProviderTest.java
deleted file mode 100644
index 065be35..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/BeanProviderTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
-* 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.core.test.api.provider;
-
-
-import org.apache.deltaspike.core.api.provider.BeanProvider;
-import org.apache.deltaspike.core.test.api.temptestutil.ShrinkWrapArchiveUtil;
-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.WebArchive;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.List;
-
-@RunWith(Arquillian.class)
-public class BeanProviderTest
-{
- /**
- *X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain other archives.
- */
- @Deployment
- public static WebArchive deploy()
- {
- return ShrinkWrap.create(WebArchive.class)
- .addAsLibraries(ShrinkWrapArchiveUtil.getArchives(null,
- "META-INF/beans.xml",
- new String[]{"org.apache.deltaspike.core"},
- null))
- .addClass(TestBean.class)
- .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
- }
-
- /**
- * lookup by type
- */
- @Test
- public void simpleBeanLookupByType()
- {
- TestBean testBean = BeanProvider.getContextualReference(TestBean.class, false);
-
- Assert.assertNotNull(testBean);
- }
-
- /**
- * lookup by name with expected type
- */
- @Test
- public void simpleBeanLookupByName()
- {
- TestBean testBean = BeanProvider.getContextualReference("extraNameBean", false, TestBean.class);
-
- Assert.assertNotNull(testBean);
- }
-
- /**
- * lookup by name without type
- */
- @Test
- public void simpleBeanLookupByNameWithoutType()
- {
- Object testBean = BeanProvider.getContextualReference("extraNameBean", false);
-
- Assert.assertNotNull(testBean);
- }
-
- /*
- * lookup without result
- */
- @Test
- public void optionalBeanLookup()
- {
- NoBean result = BeanProvider.getContextualReference(NoBean.class, true);
-
- Assert.assertNull(result);
- }
-
- /*
- * lookup of all beans of a given type
- */
- @Test
- public void multiBeanLookupWithDependentBean() throws Exception
- {
- List<MultiBean> result = BeanProvider.getContextualReferences(MultiBean.class, false);
-
- Assert.assertNotNull(result);
-
- Assert.assertEquals(2, result.size());
- }
-
- /*
- * lookup of all beans of a given type which aren't dependent scoped
- */
- @Test
- public void multiBeanLookupWithoutDependentBean() throws Exception
- {
- List<MultiBean> result = BeanProvider.getContextualReferences(MultiBean.class, false, false);
-
- Assert.assertNotNull(result);
-
- Assert.assertEquals(1, result.size());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/MBean01.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/MBean01.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/MBean01.java
deleted file mode 100644
index cf97a44..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/MBean01.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-* 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.core.test.api.provider;
-
-import javax.enterprise.context.ApplicationScoped;
-
-/**
- * Impl #1
- */
-@ApplicationScoped
-public class MBean01 implements MultiBean
-{
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/MBean02.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/MBean02.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/MBean02.java
deleted file mode 100644
index 58f311f..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/MBean02.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-* 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.core.test.api.provider;
-
-import javax.enterprise.context.Dependent;
-
-/**
- * Impl #2
- */
-@Dependent
-public class MBean02 implements MultiBean
-{
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/MultiBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/MultiBean.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/MultiBean.java
deleted file mode 100644
index edc193c..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/MultiBean.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-* 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.core.test.api.provider;
-
-/**
- * Interface for multiple beans
- */
-public interface MultiBean
-{
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/NoBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/NoBean.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/NoBean.java
deleted file mode 100644
index 52b21d1..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/NoBean.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-* 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.core.test.api.provider;
-
-/**
- * Interface without implementation
- */
-public interface NoBean
-{
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/TestBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/TestBean.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/TestBean.java
deleted file mode 100644
index 6f88e53..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/provider/TestBean.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-* 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.core.test.api.provider;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Named;
-
-@Named("extraNameBean")
-@ApplicationScoped
-public class TestBean
-{
- int i=4711;
-
- public int getI()
- {
- return i;
- }
-
- public void setI(int i)
- {
- this.i = i;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/temptestutil/ShrinkWrapArchiveUtil.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/temptestutil/ShrinkWrapArchiveUtil.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/temptestutil/ShrinkWrapArchiveUtil.java
deleted file mode 100644
index 4c1f3c3..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/core/test/api/temptestutil/ShrinkWrapArchiveUtil.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * 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.core.test.api.temptestutil;
-
-
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.jar.JarInputStream;
-import java.util.logging.Logger;
-import java.util.zip.ZipEntry;
-
-
-/**
- * Lots of neat little helpers to more easily create JavaArchives from marker files on the classpath.
- * This should finally get moved to ShrinkWrap core!
- *
- * @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
- * @deprecated This class should get moved to ShrinkWrap itself!
- */
-public class ShrinkWrapArchiveUtil
-{
- private static final Logger LOG = Logger.getLogger(ShrinkWrapArchiveUtil.class.getName());
- /**
- * Resolve all markerFiles from the current ClassPath and package the root nodes
- * into a JavaArchive.
- * @param classLoader to use
- * @param markerFile
- * @param includeIfPackageExists if not null, we will only create JavaArchives if the given package exists
- * @param excludeIfPackageExists if not null, we will <b>not</b> create JavaArchives if the given package exists.
- * This has a higher precedence than includeIfPackageExists.
- * @return
- */
- public static JavaArchive[] getArchives(ClassLoader classLoader,
- String markerFile,
- String[] includeIfPackageExists,
- String[] excludeIfPackageExists)
- {
- if (classLoader == null) {
- classLoader = ShrinkWrapArchiveUtil.class.getClassLoader();
- }
-
- try {
- Enumeration<URL> foundFiles = classLoader.getResources(markerFile);
-
- List<JavaArchive> archives = new ArrayList<JavaArchive>();
-
- while (foundFiles.hasMoreElements()) {
- URL foundFile = foundFiles.nextElement();
- LOG.fine("Evaluating Java ClassPath URL " + foundFile.toExternalForm());
-
- JavaArchive archive = createArchive(foundFile, markerFile, includeIfPackageExists, excludeIfPackageExists);
- if (archive != null) {
- LOG.info("Adding Java ClassPath URL as JavaArchive " + foundFile.toExternalForm());
- archives.add(archive);
- }
- }
-
- return archives.toArray(new JavaArchive[archives.size()]);
- }
- catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
-
- }
-
- private static JavaArchive createArchive(URL foundFile, String markerFile,
- String[] includeIfPackageExists, String[] excludeIfPackageExists)
- throws IOException {
- String urlString = foundFile.toString();
- int idx = urlString.lastIndexOf(markerFile);
- urlString = urlString.substring(0, idx);
-
- String jarUrlPath = isJarUrl(urlString);
- if (jarUrlPath != null)
- {
- return addJarArchive((new URL(ensureCorrectUrlFormat(jarUrlPath))).openStream(),
- includeIfPackageExists, excludeIfPackageExists);
- }
- else
- {
- File f = new File( (new URL(ensureCorrectUrlFormat(urlString))).getFile() );
- if (!f.exists())
- {
- // try a fallback if the URL contains %20 -> spaces
- if (urlString.contains("%20"))
- {
- urlString = urlString.replaceAll("%20", " ");
- f = new File( (new URL(ensureCorrectUrlFormat(urlString))).getFile() );
- }
-
- }
-
- return addFileArchive(f, includeIfPackageExists, excludeIfPackageExists);
- }
- }
-
- private static JavaArchive addJarArchive(InputStream inputStream,
- String[] includeIfPackageExists,
- String[] excludeIfPackageExists)
- throws IOException {
- JavaArchive ret = null;
- JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class);
-
- if (includeIfPackageExists == null) {
- // no include rule, thus add it immediately
- ret = javaArchive;
- }
-
- JarInputStream jar = new JarInputStream(inputStream);
- try {
- for (ZipEntry jarEntry = jar.getNextEntry(); jarEntry != null; jarEntry = jar.getNextEntry()) {
- String entryName = jarEntry.getName();
-
- if (jarEntry.isDirectory()) {
- // exclude rule
- if (excludeIfPackageExists(entryName, excludeIfPackageExists)) {
- return null;
- }
-
- if (ret == null && includeIfPackageExists(entryName, includeIfPackageExists)) {
- ret = javaArchive;
- }
-
- continue;
- }
-
- if (entryName.endsWith(".class")) {
- String className = pathToClassName(entryName.substring(0, entryName.length()-(".class".length())));
- javaArchive.addClass(className);
- }
- else {
- javaArchive.addAsResource(entryName);
- }
- }
- }
- finally {
- try {
- jar.close();
- }
- catch (IOException ignored) {
- // all fine
- }
- }
-
- return ret;
- }
-
- private static JavaArchive addFileArchive(File archiveBasePath,
- String[] includeIfPackageExists,
- String[] excludeIfPackageExists)
- throws IOException {
- if (!archiveBasePath.exists()) {
- return null;
- }
-
- JavaArchive ret = null;
- JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class);
-
- if (includeIfPackageExists == null) {
- // no include rule, thus add it immediately
- ret = javaArchive;
- }
-
- int basePathLength = archiveBasePath.getAbsolutePath().length() + 1;
-
- for (File archiveEntry : collectArchiveEntries(archiveBasePath) ) {
- String entryName = archiveEntry.getAbsolutePath().substring(basePathLength);
-
- // exclude rule
- if (excludeIfPackageExists(entryName, excludeIfPackageExists)) {
- return null;
- }
-
- // include rule
- if (ret == null && includeIfPackageExists(entryName, includeIfPackageExists)) {
- ret = javaArchive;
- }
-
- if (entryName.endsWith(".class")) {
- String className = pathToClassName(entryName.substring(0, entryName.length()-(".class".length())));
-
- javaArchive.addClass(className);
- }
- else {
- javaArchive.addAsResource(entryName.replace('\\', '/'));
- }
- }
-
- return ret;
- }
-
- private static List<File> collectArchiveEntries(File archiveBasePath)
- {
- if (archiveBasePath.isDirectory()) {
- List<File> archiveEntries = new ArrayList<File>();
- File[] files = archiveBasePath.listFiles();
-
- for (File file : files) {
- if (file.isDirectory()) {
- archiveEntries.addAll(collectArchiveEntries(file));
- }
- else {
- archiveEntries.add(file);
- }
- }
-
- return archiveEntries;
- }
-
- return Collections.EMPTY_LIST;
- }
-
-
- private static boolean excludeIfPackageExists(String jarEntryName, String[] excludeOnPackages) {
- if (excludeOnPackages != null) {
- String packageName = pathToClassName(jarEntryName);
-
- for (String excludeOnPackage : excludeOnPackages) {
- if (packageName.startsWith(excludeOnPackage)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- private static boolean includeIfPackageExists(String jarEntryName, String[] includeOnPackages) {
- if (includeOnPackages == null ) {
- return true;
- }
-
- String packageName = pathToClassName(jarEntryName);
-
- for (String includeOnPackage : includeOnPackages) {
- if (packageName.startsWith(includeOnPackage)) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * check if the given url path is a Jar
- * @param urlPath
- * @return
- */
- private static String isJarUrl(String urlPath) {
- // common prefixes of the url are: jar: (tomcat), zip: (weblogic) and wsjar: (websphere)
- final int jarColon = urlPath.indexOf(':');
- if (urlPath.endsWith("!/") && jarColon > 0) {
- urlPath = urlPath.substring(jarColon + 1, urlPath.length() - 2);
- return urlPath;
- }
-
- return null;
- }
-
- private static String ensureCorrectUrlFormat(String url) {
- //fix for wls
- if(!url.startsWith("file:/")) {
- url = "file:/" + url;
- }
- return url;
- }
-
- private static String pathToClassName(String pathName) {
- return pathName.replace('/', '.').replace('\\', '.'); // replace unix and windows separators
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/ConfigSourceTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/ConfigSourceTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/ConfigSourceTest.java
new file mode 100644
index 0000000..fff0a1d
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/ConfigSourceTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.config;
+
+import org.apache.deltaspike.core.api.config.ConfigResolver;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Unit tests for {@link org.apache.deltaspike.core.spi.config.ConfigSource}
+ */
+public class ConfigSourceTest
+{
+ @Test
+ public void testConfigViaSystemProperty()
+ {
+ String key = "testProperty01";
+ String value = "test_value_01";
+ System.setProperty(key, value);
+
+ String configuredValue = ConfigResolver.getPropertyValue(key);
+
+ Assert.assertEquals(value, configuredValue);
+
+ System.setProperty(key, "");
+
+ configuredValue = ConfigResolver.getPropertyValue(key);
+
+ Assert.assertEquals("", configuredValue);
+ }
+
+ @Test
+ public void testConfigViaClasspathPropertyFile()
+ {
+ String key = "testProperty02";
+ String value = "test_value_02";
+
+ String configuredValue = ConfigResolver.getPropertyValue(key);
+
+ Assert.assertEquals(value, configuredValue);
+ }
+
+ @Test
+ public void testConfigViaMetaInfPropertyFile()
+ {
+ String key = "testProperty03";
+ String value = "test_value_03";
+
+ String configuredValue = ConfigResolver.getPropertyValue(key);
+
+ Assert.assertEquals(value, configuredValue);
+ }
+
+ /*
+ //X TODO discuss marker
+ @Test
+ public void testConfigViaSystemPropertyAndMarker()
+ {
+ String key = "testProperty01";
+ String value = "test_value";
+ System.setProperty("org.apache.deltaspike." + key, value);
+
+ String configuredValue = ConfigResolver.getPropertyValue("@@deltaspike@@" + key);
+
+ Assert.assertEquals(value, configuredValue);
+ }
+ */
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/projectstage/ProjectStageProducerTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/projectstage/ProjectStageProducerTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/projectstage/ProjectStageProducerTest.java
new file mode 100644
index 0000000..664cad1
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/projectstage/ProjectStageProducerTest.java
@@ -0,0 +1,66 @@
+/*
+* 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.projectstage;
+
+import org.apache.deltaspike.core.api.projectstage.ProjectStage;
+import org.apache.deltaspike.core.impl.projectstage.ProjectStageProducer;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class ProjectStageProducerTest
+{
+ /**
+ * Test a ProjectStage which got set by the <i>javax.faces.ProjectStage</i>
+ */
+ @Test
+ public void testProjectStageSetByEnvironment()
+ {
+ String envName = "org.apache.deltaspike.ProjectStage";
+ String oldEnvVal = "" + System.getProperty(envName);
+ try
+ {
+ System.setProperty(envName, "SystemTest");
+
+ ProjectStageProducer psp = ProjectStageProducer.getInstance();
+ Assert.assertNotNull(psp);
+
+ ProjectStageProducer.setProjectStage(null);
+
+ ProjectStage ps = psp.getProjectStage();
+ Assert.assertNotNull(ps);
+ Assert.assertEquals(ps, ProjectStage.SystemTest);
+ Assert.assertTrue(ps == ProjectStage.SystemTest);
+
+ ProjectStageProducer.setProjectStage(null);
+ System.setProperty(envName, "IntegrationTest");
+
+ ps = psp.getProjectStage();
+ Assert.assertNotNull(ps);
+ Assert.assertEquals(ps, ProjectStage.IntegrationTest);
+ Assert.assertTrue(ps == ProjectStage.IntegrationTest);
+ }
+ finally
+ {
+ System.setProperty(envName, oldEnvVal);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/projectstage/ProjectStageTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/projectstage/ProjectStageTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/projectstage/ProjectStageTest.java
new file mode 100644
index 0000000..319e098
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/projectstage/ProjectStageTest.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.projectstage;
+
+
+import org.junit.Test;
+import org.junit.Assert;
+
+import org.apache.deltaspike.core.api.projectstage.ProjectStage;
+
+/**
+ * Test for {@link ProjectStage}
+ */
+public class ProjectStageTest {
+
+ @Test
+ public void testProjectStages() throws Exception
+ {
+ ProjectStage ps = ProjectStage.Development;
+ Assert.assertNotNull(ps);
+
+ ProjectStage psOther = ProjectStage.valueOf("CustomProjectStage");
+ Assert.assertNotNull(psOther);
+
+ psOther = TestProjectStages.CustomProjectStage;
+ Assert.assertNotNull(psOther);
+
+ ProjectStage psProd = ProjectStage.valueOf("Production");
+ Assert.assertNotNull(psProd);
+
+ ProjectStage[] values = ProjectStage.values();
+ Assert.assertNotNull(values);
+ Assert.assertTrue(values.length == 7);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/projectstage/TestProjectStages.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/projectstage/TestProjectStages.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/projectstage/TestProjectStages.java
new file mode 100644
index 0000000..0e5eafb
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/projectstage/TestProjectStages.java
@@ -0,0 +1,41 @@
+/*
+* 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.projectstage;
+
+
+import org.apache.deltaspike.core.api.projectstage.ProjectStage;
+import org.apache.deltaspike.core.api.projectstage.ProjectStageHolder;
+
+/**
+ * This is a test ProjectStage. It demonstrates how to add custom ProjectStages.
+ * This TestProjectStage must get registered via the {@link java.util.ServiceLoader}
+ * mechanism. Please see the file
+ * <pre>
+ * META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder
+ * </pre>
+ */
+public class TestProjectStages implements ProjectStageHolder
+{
+ public static final class CustomProjectStage extends ProjectStage
+ {
+ private static final long serialVersionUID = 1029095387976167179L;
+ }
+
+ public static final CustomProjectStage CustomProjectStage = new CustomProjectStage();
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderTest.java
new file mode 100644
index 0000000..aa8b948
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderTest.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.provider;
+
+
+import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
+import org.apache.deltaspike.test.core.api.temptestutil.ShrinkWrapArchiveUtil;
+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.WebArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+@RunWith(Arquillian.class)
+public class BeanManagerProviderTest
+{
+ /**
+ *X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain other archives.
+ */
+ @Deployment
+ public static WebArchive deploy()
+ {
+ return ShrinkWrap.create(WebArchive.class)
+ .addAsLibraries(ShrinkWrapArchiveUtil.getArchives(null,
+ "META-INF/beans.xml",
+ new String[]{"org.apache.deltaspike"},
+ null))
+ .addClass(TestBean.class)
+ .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+ }
+
+ @Test
+ public void testBeanManagerProvider() throws Exception
+ {
+ BeanManagerProvider bmp = BeanManagerProvider.getInstance();
+ Assert.assertNotNull(bmp);
+
+ BeanManager bm = bmp.getBeanManager();
+ Assert.assertNotNull(bm);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanProviderTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanProviderTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanProviderTest.java
new file mode 100644
index 0000000..6268db8
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanProviderTest.java
@@ -0,0 +1,122 @@
+/*
+* 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.provider;
+
+
+import org.apache.deltaspike.core.api.provider.BeanProvider;
+import org.apache.deltaspike.test.core.api.temptestutil.ShrinkWrapArchiveUtil;
+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.WebArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.List;
+
+@RunWith(Arquillian.class)
+public class BeanProviderTest
+{
+ /**
+ *X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain other archives.
+ */
+ @Deployment
+ public static WebArchive deploy()
+ {
+ return ShrinkWrap.create(WebArchive.class)
+ .addAsLibraries(ShrinkWrapArchiveUtil.getArchives(null,
+ "META-INF/beans.xml",
+ new String[]{"org.apache.deltaspike.core",
+ "org.apache.deltaspike.test.core.api.provider"},
+ null))
+ .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+ }
+
+ /**
+ * lookup by type
+ */
+ @Test
+ public void simpleBeanLookupByType()
+ {
+ TestBean testBean = BeanProvider.getContextualReference(TestBean.class, false);
+
+ Assert.assertNotNull(testBean);
+ }
+
+ /**
+ * lookup by name with expected type
+ */
+ @Test
+ public void simpleBeanLookupByName()
+ {
+ TestBean testBean = BeanProvider.getContextualReference("extraNameBean", false, TestBean.class);
+
+ Assert.assertNotNull(testBean);
+ }
+
+ /**
+ * lookup by name without type
+ */
+ @Test
+ public void simpleBeanLookupByNameWithoutType()
+ {
+ Object testBean = BeanProvider.getContextualReference("extraNameBean", false);
+
+ Assert.assertNotNull(testBean);
+ }
+
+ /*
+ * lookup without result
+ */
+ @Test
+ public void optionalBeanLookup()
+ {
+ NoBean result = BeanProvider.getContextualReference(NoBean.class, true);
+
+ Assert.assertNull(result);
+ }
+
+ /*
+ * lookup of all beans of a given type
+ */
+ @Test
+ public void multiBeanLookupWithDependentBean() throws Exception
+ {
+ List<MultiBean> result = BeanProvider.getContextualReferences(MultiBean.class, false);
+
+ Assert.assertNotNull(result);
+
+ Assert.assertEquals(2, result.size());
+ }
+
+ /*
+ * lookup of all beans of a given type which aren't dependent scoped
+ */
+ @Test
+ public void multiBeanLookupWithoutDependentBean() throws Exception
+ {
+ List<MultiBean> result = BeanProvider.getContextualReferences(MultiBean.class, false, false);
+
+ Assert.assertNotNull(result);
+
+ Assert.assertEquals(1, result.size());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/MBean01.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/MBean01.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/MBean01.java
new file mode 100644
index 0000000..ab8e30a
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/MBean01.java
@@ -0,0 +1,29 @@
+/*
+* 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.provider;
+
+import javax.enterprise.context.ApplicationScoped;
+
+/**
+ * Impl #1
+ */
+@ApplicationScoped
+public class MBean01 implements MultiBean
+{
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/MBean02.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/MBean02.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/MBean02.java
new file mode 100644
index 0000000..2bbd5d4
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/MBean02.java
@@ -0,0 +1,29 @@
+/*
+* 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.provider;
+
+import javax.enterprise.context.Dependent;
+
+/**
+ * Impl #2
+ */
+@Dependent
+public class MBean02 implements MultiBean
+{
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/MultiBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/MultiBean.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/MultiBean.java
new file mode 100644
index 0000000..c2ca342
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/MultiBean.java
@@ -0,0 +1,26 @@
+/*
+* 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.provider;
+
+/**
+ * Interface for multiple beans
+ */
+public interface MultiBean
+{
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/NoBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/NoBean.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/NoBean.java
new file mode 100644
index 0000000..2aaed98
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/NoBean.java
@@ -0,0 +1,26 @@
+/*
+* 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.provider;
+
+/**
+ * Interface without implementation
+ */
+public interface NoBean
+{
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/TestBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/TestBean.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/TestBean.java
new file mode 100644
index 0000000..e4e73e4
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/TestBean.java
@@ -0,0 +1,39 @@
+/*
+* 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.provider;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+
+@Named("extraNameBean")
+@ApplicationScoped
+public class TestBean
+{
+ int i=4711;
+
+ public int getI()
+ {
+ return i;
+ }
+
+ public void setI(int i)
+ {
+ this.i = i;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/temptestutil/ShrinkWrapArchiveUtil.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/temptestutil/ShrinkWrapArchiveUtil.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/temptestutil/ShrinkWrapArchiveUtil.java
new file mode 100644
index 0000000..c6305b8
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/temptestutil/ShrinkWrapArchiveUtil.java
@@ -0,0 +1,298 @@
+/*
+ * 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.temptestutil;
+
+
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.jar.JarInputStream;
+import java.util.logging.Logger;
+import java.util.zip.ZipEntry;
+
+
+/**
+ * Lots of neat little helpers to more easily create JavaArchives from marker files on the classpath.
+ * This should finally get moved to ShrinkWrap core!
+ *
+ * @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
+ * @deprecated This class should get moved to ShrinkWrap itself!
+ */
+public class ShrinkWrapArchiveUtil
+{
+ private static final Logger LOG = Logger.getLogger(ShrinkWrapArchiveUtil.class.getName());
+ /**
+ * Resolve all markerFiles from the current ClassPath and package the root nodes
+ * into a JavaArchive.
+ * @param classLoader to use
+ * @param markerFile
+ * @param includeIfPackageExists if not null, we will only create JavaArchives if the given package exists
+ * @param excludeIfPackageExists if not null, we will <b>not</b> create JavaArchives if the given package exists.
+ * This has a higher precedence than includeIfPackageExists.
+ * @return
+ */
+ public static JavaArchive[] getArchives(ClassLoader classLoader,
+ String markerFile,
+ String[] includeIfPackageExists,
+ String[] excludeIfPackageExists)
+ {
+ if (classLoader == null) {
+ classLoader = ShrinkWrapArchiveUtil.class.getClassLoader();
+ }
+
+ try {
+ Enumeration<URL> foundFiles = classLoader.getResources(markerFile);
+
+ List<JavaArchive> archives = new ArrayList<JavaArchive>();
+
+ while (foundFiles.hasMoreElements()) {
+ URL foundFile = foundFiles.nextElement();
+ LOG.fine("Evaluating Java ClassPath URL " + foundFile.toExternalForm());
+
+ JavaArchive archive = createArchive(foundFile, markerFile, includeIfPackageExists, excludeIfPackageExists);
+ if (archive != null) {
+ LOG.info("Adding Java ClassPath URL as JavaArchive " + foundFile.toExternalForm());
+ archives.add(archive);
+ }
+ }
+
+ return archives.toArray(new JavaArchive[archives.size()]);
+ }
+ catch (IOException ioe) {
+ throw new RuntimeException(ioe);
+ }
+
+ }
+
+ private static JavaArchive createArchive(URL foundFile, String markerFile,
+ String[] includeIfPackageExists, String[] excludeIfPackageExists)
+ throws IOException {
+ String urlString = foundFile.toString();
+ int idx = urlString.lastIndexOf(markerFile);
+ urlString = urlString.substring(0, idx);
+
+ String jarUrlPath = isJarUrl(urlString);
+ if (jarUrlPath != null)
+ {
+ return addJarArchive((new URL(ensureCorrectUrlFormat(jarUrlPath))).openStream(),
+ includeIfPackageExists, excludeIfPackageExists);
+ }
+ else
+ {
+ File f = new File( (new URL(ensureCorrectUrlFormat(urlString))).getFile() );
+ if (!f.exists())
+ {
+ // try a fallback if the URL contains %20 -> spaces
+ if (urlString.contains("%20"))
+ {
+ urlString = urlString.replaceAll("%20", " ");
+ f = new File( (new URL(ensureCorrectUrlFormat(urlString))).getFile() );
+ }
+
+ }
+
+ return addFileArchive(f, includeIfPackageExists, excludeIfPackageExists);
+ }
+ }
+
+ private static JavaArchive addJarArchive(InputStream inputStream,
+ String[] includeIfPackageExists,
+ String[] excludeIfPackageExists)
+ throws IOException {
+ JavaArchive ret = null;
+ JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class);
+
+ if (includeIfPackageExists == null) {
+ // no include rule, thus add it immediately
+ ret = javaArchive;
+ }
+
+ JarInputStream jar = new JarInputStream(inputStream);
+ try {
+ for (ZipEntry jarEntry = jar.getNextEntry(); jarEntry != null; jarEntry = jar.getNextEntry()) {
+ String entryName = jarEntry.getName();
+
+ if (jarEntry.isDirectory()) {
+ // exclude rule
+ if (excludeIfPackageExists(entryName, excludeIfPackageExists)) {
+ return null;
+ }
+
+ if (ret == null && includeIfPackageExists(entryName, includeIfPackageExists)) {
+ ret = javaArchive;
+ }
+
+ continue;
+ }
+
+ if (entryName.endsWith(".class")) {
+ String className = pathToClassName(entryName.substring(0, entryName.length()-(".class".length())));
+ javaArchive.addClass(className);
+ }
+ else {
+ javaArchive.addAsResource(entryName);
+ }
+ }
+ }
+ finally {
+ try {
+ jar.close();
+ }
+ catch (IOException ignored) {
+ // all fine
+ }
+ }
+
+ return ret;
+ }
+
+ private static JavaArchive addFileArchive(File archiveBasePath,
+ String[] includeIfPackageExists,
+ String[] excludeIfPackageExists)
+ throws IOException {
+ if (!archiveBasePath.exists()) {
+ return null;
+ }
+
+ JavaArchive ret = null;
+ JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class);
+
+ if (includeIfPackageExists == null) {
+ // no include rule, thus add it immediately
+ ret = javaArchive;
+ }
+
+ int basePathLength = archiveBasePath.getAbsolutePath().length() + 1;
+
+ for (File archiveEntry : collectArchiveEntries(archiveBasePath) ) {
+ String entryName = archiveEntry.getAbsolutePath().substring(basePathLength);
+
+ // exclude rule
+ if (excludeIfPackageExists(entryName, excludeIfPackageExists)) {
+ return null;
+ }
+
+ // include rule
+ if (ret == null && includeIfPackageExists(entryName, includeIfPackageExists)) {
+ ret = javaArchive;
+ }
+
+ if (entryName.endsWith(".class")) {
+ String className = pathToClassName(entryName.substring(0, entryName.length()-(".class".length())));
+
+ javaArchive.addClass(className);
+ }
+ else {
+ javaArchive.addAsResource(entryName.replace('\\', '/'));
+ }
+ }
+
+ return ret;
+ }
+
+ private static List<File> collectArchiveEntries(File archiveBasePath)
+ {
+ if (archiveBasePath.isDirectory()) {
+ List<File> archiveEntries = new ArrayList<File>();
+ File[] files = archiveBasePath.listFiles();
+
+ for (File file : files) {
+ if (file.isDirectory()) {
+ archiveEntries.addAll(collectArchiveEntries(file));
+ }
+ else {
+ archiveEntries.add(file);
+ }
+ }
+
+ return archiveEntries;
+ }
+
+ return Collections.EMPTY_LIST;
+ }
+
+
+ private static boolean excludeIfPackageExists(String jarEntryName, String[] excludeOnPackages) {
+ if (excludeOnPackages != null) {
+ String packageName = pathToClassName(jarEntryName);
+
+ for (String excludeOnPackage : excludeOnPackages) {
+ if (packageName.startsWith(excludeOnPackage)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private static boolean includeIfPackageExists(String jarEntryName, String[] includeOnPackages) {
+ if (includeOnPackages == null ) {
+ return true;
+ }
+
+ String packageName = pathToClassName(jarEntryName);
+
+ for (String includeOnPackage : includeOnPackages) {
+ if (packageName.startsWith(includeOnPackage)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * check if the given url path is a Jar
+ * @param urlPath
+ * @return
+ */
+ private static String isJarUrl(String urlPath) {
+ // common prefixes of the url are: jar: (tomcat), zip: (weblogic) and wsjar: (websphere)
+ final int jarColon = urlPath.indexOf(':');
+ if (urlPath.endsWith("!/") && jarColon > 0) {
+ urlPath = urlPath.substring(jarColon + 1, urlPath.length() - 2);
+ return urlPath;
+ }
+
+ return null;
+ }
+
+ private static String ensureCorrectUrlFormat(String url) {
+ //fix for wls
+ if(!url.startsWith("file:/")) {
+ url = "file:/" + url;
+ }
+ return url;
+ }
+
+ private static String pathToClassName(String pathName) {
+ return pathName.replace('/', '.').replace('\\', '.'); // replace unix and windows separators
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9804c0d8/deltaspike/core/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder b/deltaspike/core/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder
index fbe4ba7..df08d94 100644
--- a/deltaspike/core/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder
+++ b/deltaspike/core/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder
@@ -17,4 +17,4 @@
# Test file to register a test ProjectStageHolder which contains
# a few additional ProjectStages
-org.apache.deltaspike.core.test.api.projectstage.TestProjectStages
+org.apache.deltaspike.test.core.api.projectstage.TestProjectStages