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

Dynamic Media with OpenAPI: Do not enable support for remote assets by default #64

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
<action type="add" dev="sseifert" issue="61">
Dynamic Media with OpenAPI: Provide max. width/height in UriTemplate if source image dimension is available in metadata.
</action>
<action type="update" dev="sseifert" issue="64">
Dynamic Media with OpenAPI: Do not enable support for remote assets by default. Since general availability the related configuration services not longer protected by a feature flag, so the feature has to be enabled explicitly via OSGi configuration.
</action>
<action type="update" dev="sseifert">
Eliminate dependency to Commons Lang 2.
</action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class NextGenDynamicMediaConfigServiceImpl implements NextGenDynamicMedia
@AttributeDefinition(
name = "Remote Assets",
description = "Enable Dynamic Media with OpenAPI for remote assets.")
boolean enabledRemoteAssets() default true;
boolean enabledRemoteAssets() default false;

@AttributeDefinition(
name = "Local Assets",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ void setUp() {
MockNextGenDynamicMediaConfig nextGenDynamicMediaConfig = context.registerInjectActivateService(MockNextGenDynamicMediaConfig.class);
nextGenDynamicMediaConfig.setEnabled(true);
nextGenDynamicMediaConfig.setRepositoryId("repo1");
context.registerInjectActivateService(NextGenDynamicMediaConfigServiceImpl.class);
context.registerInjectActivateService(NextGenDynamicMediaConfigServiceImpl.class,
"enabledRemoteAssets", true);
super.setUp();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ void setUp() {

@Test
void testWithConfigService() throws JSONException {
context.registerInjectActivateService(NextGenDynamicMediaConfigServiceImpl.class);
context.registerInjectActivateService(NextGenDynamicMediaConfigServiceImpl.class,
"enabledRemoteAssets", true);

NextGenDynamicMediaConfigModel underTest = AdaptTo.notNull(context.request(), NextGenDynamicMediaConfigModel.class);
assertTrue(underTest.isEnabled());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ void registerMockNextGenDynamicMediaConfig(boolean remoteAssets, boolean localAs
nextGenDynamicMediaConfig.setEnabled(remoteAssets);
nextGenDynamicMediaConfig.setRepositoryId("repo1");
context.registerInjectActivateService(NextGenDynamicMediaConfigServiceImpl.class,
"enabledRemoteAssets", true,
"enabledLocalAssets", localAssets,
"localAssetsRepositoryId", "localrepo1");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ void setUp(WireMockRuntimeInfo wmRuntimeInfo) {
nextGenDynamicMediaConfig = context.registerInjectActivateService(MockNextGenDynamicMediaConfig.class);
nextGenDynamicMediaConfig.setEnabled(true);
nextGenDynamicMediaConfig.setRepositoryId("localhost:" + wmRuntimeInfo.getHttpPort());
context.registerInjectActivateService(NextGenDynamicMediaConfigServiceImpl.class);
context.registerInjectActivateService(NextGenDynamicMediaConfigServiceImpl.class,
"enabledRemoteAssets", true);
context.registerInjectActivateService(NextGenDynamicMediaMetadataServiceImpl.class,
"enabled", true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ void setUp() {
nextGenDynamicMediaConfig.setEnabled(true);
nextGenDynamicMediaConfig.setRepositoryId("repo1");

context.registerInjectActivateService(NextGenDynamicMediaConfigServiceImpl.class);
context.registerInjectActivateService(NextGenDynamicMediaConfigServiceImpl.class,
"enabledRemoteAssets", true);

resource = context.create().resource(context.currentPage(), "test",
MediaNameConstants.PN_MEDIA_REF, SAMPLE_REFERENCE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class NextGenDynamicMediaConfigServiceImplTest {
void testPropertiesDefaultConfig() {
registerNextGenDynamicMediaConfig(context);
NextGenDynamicMediaConfigService underTest = context.registerInjectActivateService(NextGenDynamicMediaConfigServiceImpl.class,
"enabledRemoteAssets", true,
"enabledLocalAssets", true,
"localAssetsRepositoryId", "localrepo1");
assertTrue(underTest.isEnabledRemoteAssets());
Expand Down