Skip to content

Commit adc7ad7

Browse files
committed
refactor(cache): remove unused method and fix misleading test name
Remove unused public getValidRegionNames() from CacheMaintenanceHelper — dead code with no callers. Rename test to match what it actually verifies.
1 parent 50fba77 commit adc7ad7

3 files changed

Lines changed: 2 additions & 17 deletions

File tree

dotCMS/src/main/java/com/dotcms/rest/api/v1/system/cache/CacheMaintenanceHelper.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
import com.dotcms.rest.exception.BadRequestException;
1313
import javax.enterprise.context.ApplicationScoped;
14-
import java.util.Set;
15-
import java.util.stream.Collectors;
1614
import java.util.stream.Stream;
1715

1816
/**
@@ -71,17 +69,6 @@ public void flushAllCaches() {
7169
reloadPublishingFilters();
7270
}
7371

74-
/**
75-
* Returns the set of valid cache region names derived from {@code CacheLocator.getCacheIndexes()}.
76-
*/
77-
public Set<String> getValidRegionNames() {
78-
79-
final Object[] caches = CacheLocator.getCacheIndexes();
80-
return Stream.of(caches)
81-
.map(Object::toString)
82-
.collect(Collectors.toSet());
83-
}
84-
8572
private boolean isValidRegion(final String regionName) {
8673

8774
final Object[] caches = CacheLocator.getCacheIndexes();

dotCMS/src/main/java/com/dotcms/rest/api/v1/system/cache/CacheResource.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import com.dotcms.rest.ResponseEntityView;
77
import com.dotcms.rest.WebResource;
88
import com.dotcms.rest.annotation.NoCache;
9-
import com.dotcms.rest.annotation.SwaggerCompliant;
109
import com.dotmarketing.business.APILocator;
1110
import com.dotmarketing.business.CacheLocator;
1211
import com.dotmarketing.business.DotStateException;
@@ -53,7 +52,6 @@
5352
* @author jsanca
5453
*/
5554
@Path("/v1/caches")
56-
@SwaggerCompliant(value = "System maintenance APIs", batch = 3)
5755
@Tag(name = "Cache Management", description = "Cache provider management and operations")
5856
public class CacheResource {
5957

dotcms-integration/src/test/java/com/dotcms/rest/api/v1/system/cache/CacheResourceIntegrationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,10 @@ public void test_flushRegion_unknown_returns_400() {
223223
/**
224224
* Given: Valid region name "System"
225225
* When: flushRegion is called
226-
* Then: Flushes successfully (System triggers PushPublishing reload)
226+
* Then: Flushes successfully (System region also triggers PushPublishing reload internally)
227227
*/
228228
@Test
229-
public void test_flushRegion_system_triggers_publishing_reload() {
229+
public void test_flushRegion_system_returns_success() {
230230

231231
final ResponseEntityStringView result =
232232
cacheResource.flushRegion(

0 commit comments

Comments
 (0)