Repository: deltaspike Updated Branches: refs/heads/master 8522181c1 -> 29cd1ce10
DELTASPIKE-648 we need to use ServiceLoader for PropertyFileConfig in EARs Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/29cd1ce1 Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/29cd1ce1 Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/29cd1ce1 Branch: refs/heads/master Commit: 29cd1ce101556d76fae1dd161c7b57e3a24b8a70 Parents: 8522181 Author: Mark Struberg <[email protected]> Authored: Mon Mar 2 13:22:43 2015 +0100 Committer: Mark Struberg <[email protected]> Committed: Mon Mar 2 13:22:43 2015 +0100 ---------------------------------------------------------------------- .../ConfigPropertyEARTest.java | 4 +- .../MyCustomEarPropertyFileConfig.java | 43 ++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/29cd1ce1/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/ConfigPropertyEARTest.java ---------------------------------------------------------------------- diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/ConfigPropertyEARTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/ConfigPropertyEARTest.java index ec82507..be0683a 100644 --- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/ConfigPropertyEARTest.java +++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/ConfigPropertyEARTest.java @@ -18,6 +18,7 @@ */ package org.apache.deltaspike.test.core.api.config.propertyconfigsource; +import org.apache.deltaspike.core.api.config.PropertyFileConfig; import org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory; import org.apache.deltaspike.test.util.ArchiveUtils; import org.jboss.arquillian.container.test.api.Deployment; @@ -42,8 +43,9 @@ public class ConfigPropertyEARTest extends BaseTestConfigProperty JavaArchive ejbJar = ShrinkWrap .create(JavaArchive.class, "ejb-jar.jar") .addClasses(BaseTestConfigProperty.class, ConfigPropertyEARTest.class, - MyCustomPropertyFileConfig.class, MyBean.class) + MyBean.class, MyCustomEarPropertyFileConfig.class) .addAsResource(CONFIG_FILE_NAME) + .addAsServiceProvider(PropertyFileConfig.class, MyCustomEarPropertyFileConfig.class) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war") http://git-wip-us.apache.org/repos/asf/deltaspike/blob/29cd1ce1/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/MyCustomEarPropertyFileConfig.java ---------------------------------------------------------------------- diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/MyCustomEarPropertyFileConfig.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/MyCustomEarPropertyFileConfig.java new file mode 100644 index 0000000..ab9b00e --- /dev/null +++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/propertyconfigsource/MyCustomEarPropertyFileConfig.java @@ -0,0 +1,43 @@ +/* + * 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.propertyconfigsource; + +import org.apache.deltaspike.core.api.config.PropertyFileConfig; +import org.apache.deltaspike.core.api.exclude.Exclude; + +/** + * Custom PropertyFileConfig which gets picked up during + * {@link javax.enterprise.inject.spi.ProcessAnnotatedType}. + * We need to do this hack to avoid + */ +@Exclude +public class MyCustomEarPropertyFileConfig implements PropertyFileConfig +{ + @Override + public String getPropertyFileName() + { + return "myconfig.properties"; + } + + @Override + public boolean isOptional() + { + return false; + } +}
