Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce ActiveProfilesResolver in the TestContext framework [SPR-10338] #14972

Closed
4 tasks done
spring-projects-issues opened this issue Feb 27, 2013 · 7 comments
Closed
4 tasks done

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Feb 27, 2013

Michail Nikolaev opened SPR-10338 and commented

Overview

See the related discussion on GitHub for details.


Deliverables

  1. Introduce an ActiveProfilesResolver API. (see Proposal)
  2. Add a resolver attribute to @ActiveProfiles. (see Proposal)
  3. Update ContextLoaderUtils.resolveActiveProfiles(Class<?>\) to support an ActiveProfilesResolver.
    • Make it a configuration error (i.e., by throwing an IllegalStateException) if both active profiles and a resolver are declared.
  4. Document these new features in the reference manual.

Proposal

interface ActiveProfilesResolver {
    String[] resolve(Class<?> testClass);
}
public @interface ActiveProfiles {

    String[] value() default {};

    String[] profiles() default {};

    boolean inheritProfiles() default true;

    Class<? extends ActiveProfilesResolver> resolver() default ActiveProfilesResolver.class;
}

Affects: 3.1 GA

Reference URL: #240

Referenced from: commits 044f512, 4542f36

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Feb 27, 2013

Michail Nikolaev commented

Looks like it is not time-critical issue :) Could I try to contribute the implementation?

Loading

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Feb 27, 2013

Sam Brannen commented

Michail Nikolaev, yes, feel free to submit a pull request for the implementation.

However, I would recommend that you wait until after Spring Framework 3.2.2 has been released in order to reduce the complexity of possible merge conflicts.

Loading

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Mar 5, 2013

Michail Nikolaev commented

Pull request:
#246

if it is hard to merge, i'll resubmit it later

Loading

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 23, 2013

Michail Nikolaev commented

Have you any thoughts - will this issue moved to 4.0 M1?
Thanks.

Loading

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 15, 2013

Sam Brannen commented

Completed as described in comments for GitHub commit 044f51283b:

Introduce ActiveProfilesResolver in the TCF

Prior to this commit, the active bean definition profiles to use when
loading an ApplicationContext for tests could only be configured
declaratively (i.e., via hard-coded values supplied to the 'value' or
'profiles' attribute of @ActiveProfiles).

This commit makes it possible to programmatically configure active bean
definition profiles in tests via a new ActiveProfileResolver interface.
Custom resolvers can be registered via a new 'resolver' attribute
introduced in @ActiveProfiles.

Overview of changes:

  • Introduced a new ActiveProfilesResolver API.
  • Added a 'resolver' attribute to @ActiveProfiles.
  • Updated ContextLoaderUtils.resolveActiveProfiles() to support
    ActiveProfilesResolvers.
  • Documented these new features in the reference manual.
  • Added new content to the reference manual regarding the
    'inheritProfiles' attribute of @ActiveProfiles
  • Removed the use of <lineannotation> Docbook markup in the testing
    chapter of the reference manual for Java code examples in order to
    allow comments to have proper syntax highlighting in the generated
    HTML and PDF.

Loading

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 15, 2013

Sam Brannen commented

Michail Nikolaev, thanks for all of your hard work!

You'll notice that I unfortunately wasn't able to merge your pull request directly due to significant changes in the 4.0 (i.e., master) branch; however, I was still able to use a lot of your code (albeit with some rather tedious copying-n-pasting ;)).

Also, your thorough unit and integration tests were especially helpful.

Cheers,

Sam

Loading

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 15, 2013

Michail Nikolaev commented

Thanks for your work, your help and attention.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants