Skip to content

Commit

Permalink
Dynamic Media with OpenAPI: Do not enable support for remote assets b…
Browse files Browse the repository at this point in the history
…y default
  • Loading branch information
stefanseifert committed Aug 22, 2024
1 parent b32824c commit d89541b
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 5 deletions.
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">
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

0 comments on commit d89541b

Please sign in to comment.