Skip to content

Commit

Permalink
Rebased and checkstyle fixed.
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Langer <tomas.langer@oracle.com>
  • Loading branch information
tomas-langer committed Sep 15, 2020
1 parent 0b7ee07 commit 5729e78
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,18 @@
@Target({ElementType.TYPE, ElementType.METHOD})
public @interface Configuration {
/**
* You can configure the {@link org.eclipse.microprofile.config.Config} a
* @return
* If set to {@code true}, the existing (or default) MicroProfile configuration would be used.
* By default uses a configuration constructed using all {@link io.helidon.microprofile.tests.junit5.AddConfig}
* annotations and {@link #configSources()}.
*
* @return whether to use existing (or default) configuration, or customized one
*/
boolean useExisting() default false;

/**
* Class path properties config sources to add to configuration of this test class or method.
*
* @return config sources to add
*/
String[] configSources() default {};
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,13 @@
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
public @interface DisableDiscovery {
/**
* By default if you annotate a class or a method, discovery gets disabled.
* If you want to override configuration on method to differ from class, you
* can configure the value to {@code false}, effectively enabling discovery.
*
* @return whether to disable discovery ({@code true}), or enable it ({@code false}). If this
* annotation is not present, discovery is enabled
*/
boolean value() default true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class HelidonJunitExtension implements BeforeAllCallback,
private static final Set<Class<? extends Annotation>> HELIDON_TEST_ANNOTATIONS =
Set.of(AddBean.class, AddConfig.class, AddExtension.class, Configuration.class);


private final List<AddExtension> classLevelExtensions = new ArrayList<>();
private final List<AddBean> classLevelBeans = new ArrayList<>();
private final ConfigMeta classLevelConfigMeta = new ConfigMeta();
Expand Down Expand Up @@ -123,14 +122,13 @@ public void beforeAll(ExtensionContext context) {

@Override
public void beforeEach(ExtensionContext context) throws Exception {
if(resetPerTest) {
if (resetPerTest) {
Method method = context.getRequiredTestMethod();
AddConfig[] configs = method.getAnnotationsByType(AddConfig.class);
ConfigMeta methodLevelConfigMeta = classLevelConfigMeta.nextMethod();
methodLevelConfigMeta.addConfig(configs);
methodLevelConfigMeta.configuration(method.getAnnotation(Configuration.class));


configure(methodLevelConfigMeta);

List<AddExtension> methodLevelExtensions = new ArrayList<>(classLevelExtensions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# limitations under the License.
#

some.key=some.value
some.key=some.value

0 comments on commit 5729e78

Please sign in to comment.