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

Adding tags dynamically #172

Closed
janschaefer opened this issue Dec 3, 2015 · 4 comments · Fixed by #213
Closed

Adding tags dynamically #172

janschaefer opened this issue Dec 3, 2015 · 4 comments · Fixed by #213

Comments

@janschaefer
Copy link
Contributor

It might sometimes be useful to add tags dynamically to scenarios

@Airblader
Copy link
Contributor

What should this look like from a design point of view? Do you want a method which takes a TagConfiguration?

@janschaefer
Copy link
Contributor Author

I haven't really thought about that. I am not sure whether TagConfiguration is the right thing to use here. The TagConfiguration class is actually used to configure a tag. For applying a tag there should be a more narrow interface. In fact, it should only take the class of the annotation and and optional value, IMO.

@Airblader
Copy link
Contributor

Airblader commented Jun 28, 2016

This could be more challenging than I originally anticipated. We need an actual instance of the annotation, not just its class, because we need to pass some instance to the DescriptionGenerator and HrefGenerator if they are being used.

However, creating a proper instance of an annotation isn't exactly easy. For example, Hibernate has this proxy class for that problem.

There's three obvious (and maybe other, non-obvious) ways out:

  • Pass null to the generators for the annotation instance and document this. Since it's only the case for a new feature, it's a backwards-compatible change. It also somewhat makes sense not to have an instance of the annotation in case of dynamically added tags since there is no annotation.
  • Disallow (i.e., either do not execute or throw an exception) generators for dynamically added tags. I'm not a fan of this because it's rather unexpected behavior. Even if documented.
  • Implement an annotation proxy similar to Hibernate. I really don't like this because it's a lot of bloat.

@Airblader
Copy link
Contributor

On a side note, could it be that there's a bug in ScenarioModelBuilder#toTags? The method exits early if ignoreValue is set. Both nested tags and the href attribute won't be set in this case, neither of which sounds right to me. Bug?

Airblader added a commit to Airblader/JGiven that referenced this issue Jul 1, 2016
This commit allows adding tags dynamically to a scenario at runtime.
Furthermore, it implicitly fixes an issue where nested tags, description
and href would not be evaluated if ignoreValue was set to true.

fixes TNG#172
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 1, 2016
This commit allows adding tags dynamically to a scenario at runtime.
Furthermore, it implicitly fixes an issue where nested tags, description
and href would not be evaluated if ignoreValue was set to true.

fixes TNG#172
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 1, 2016
This commit allows adding tags dynamically to a scenario at runtime.
Furthermore, it implicitly fixes an issue where nested tags, description
and href would not be evaluated if ignoreValue was set to true.

fixes TNG#172
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 2, 2016
This commit allows adding tags dynamically to a scenario at runtime.
Furthermore, it implicitly fixes an issue where nested tags, description
and href would not be evaluated if ignoreValue was set to true.

fixes TNG#172
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 2, 2016
This commit allows adding tags dynamically to a scenario at runtime.
Furthermore, it implicitly fixes an issue where nested tags, description
and href would not be evaluated if ignoreValue was set to true.

fixes TNG#172
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 2, 2016
This commit allows adding tags dynamically to a scenario at runtime.
Furthermore, it implicitly fixes an issue where nested tags, description
and href would not be evaluated if ignoreValue was set to true.

fixes TNG#172
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 5, 2016
We introduce a new interface CurrentScenario similar to CurrentStep which
can be injected into stages. The previously introduced addTag() method is
moved from ScenarioBase to this new interface.

relates to TNG#172
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 5, 2016
We introduce a new interface CurrentScenario similar to CurrentStep which
can be injected into stages. The previously introduced addTag() method is
moved from ScenarioBase to this new interface.

relates to TNG#172
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 5, 2016
We introduce a new interface CurrentScenario similar to CurrentStep which
can be injected into stages. The previously introduced addTag() method is
moved from ScenarioBase to this new interface.

relates to TNG#172
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 5, 2016
We introduce a new interface CurrentScenario similar to CurrentStep which
can be injected into stages. The previously introduced addTag() method is
moved from ScenarioBase to this new interface.

relates to TNG#172
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 5, 2016
This commit allows adding tags dynamically to a scenario at runtime.
Furthermore, it implicitly fixes an issue where nested tags, description
and href would not be evaluated if ignoreValue was set to true.

fixes TNG#172
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 5, 2016
We introduce a new interface CurrentScenario similar to CurrentStep which
can be injected into stages. The previously introduced addTag() method is
moved from ScenarioBase to this new interface.

relates to TNG#172
Airblader added a commit to Airblader/JGiven that referenced this issue Jul 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants