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

fix: Check global and deprecated region for usage of deprecated api #230

Merged
merged 1 commit into from
Jul 25, 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
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ private void applyDefaultTaskConfigurations() {
config.computeIfAbsent("api-regions-crossfeature-dups", (key) -> apiRegionsCrossfeatureDupsDefaults());
config.computeIfAbsent("content-packages-validation", (key) -> contentPackagesValidationDefaults());
config.computeIfAbsent("api-regions-check-order", (key) -> apiRegionsCheckOrderDefaults());
config.computeIfAbsent("region-deprecated-api", (key) -> apiRegionsDeprecationDefaults());
}

private Map<String, String> apiRegionsCrossfeatureDupsDefaults() {
Expand All @@ -169,6 +170,9 @@ private Map<String, String> apiRegionsCheckOrderDefaults() {
return singletonMap("order", "global,com.adobe.aem.deprecated,com.adobe.aem.internal");
}

private Map<String, String> apiRegionsDeprecationDefaults() {
return singletonMap("regions", "global,com.adobe.aem.deprecated");
}
/**
* @return the artifactProvider
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public class AemAnalyserTest {
final AemAnalyser analyser = new AemAnalyser();
assertNotNull(analyser.getTaskConfigurations());

// 3 configs by default
assertEquals(3, analyser.getTaskConfigurations().size());
// 4 configs by default
assertEquals(4, analyser.getTaskConfigurations().size());

// check first config
Map<String, String> config = analyser.getTaskConfigurations().get("api-regions-crossfeature-dups");
Expand All @@ -66,6 +66,11 @@ public class AemAnalyserTest {
config = analyser.getTaskConfigurations().get("content-packages-validation");
assertNotNull(config);
assertEquals(1, config.size());

// check deprecation api config
config = analyser.getTaskConfigurations().get("region-deprecated-api");
assertNotNull(config);
assertEquals(1, config.size());
}

@Test public void testSetTaskConfigurations() throws Exception {
Expand All @@ -81,8 +86,8 @@ public class AemAnalyserTest {
final AemAnalyser analyser = new AemAnalyser();
analyser.setTaskConfigurations(taskConfigurations);

// 4 configurations (3 default + 1 custom)
assertEquals(4, analyser.getTaskConfigurations().size());
// 5 configurations (4 default + 1 custom)
assertEquals(5, analyser.getTaskConfigurations().size());

// check overridden default config
Map<String, String> config = analyser.getTaskConfigurations().get("api-regions-crossfeature-dups");
Expand All @@ -101,6 +106,12 @@ public class AemAnalyserTest {
assertNotNull(config);
assertEquals(1, config.size());
assertEquals("global,com.adobe.aem.deprecated,com.adobe.aem.internal", config.get("order"));

// check deprecation api config - unchanged
config = analyser.getTaskConfigurations().get("region-deprecated-api");
assertNotNull(config);
assertEquals(1, config.size());
assertEquals("global,com.adobe.aem.deprecated", config.get("regions"));
}

@Test public void testSetIncludedTasks() throws Exception {
Expand Down
Loading