From 2c1ccca730bb6919894c3787922d7c3e5a14fc9c Mon Sep 17 00:00:00 2001 From: Suresh Srinivas Date: Sat, 12 Jul 2025 17:26:00 -0700 Subject: [PATCH] Remove unnecessary exception throws, Redundant lambda code and javadoc (#22321) * Remove unnecessary exception throws, Rredundant labmda code and javadoc * Fix java checkstyle issues --- .../service/JsonPatchMessageBodyReader.java | 3 +- .../apps/AbstractNativeApplication.java | 4 +- .../service/apps/McpServerProvider.java | 5 -- .../bundles/changeEvent/AlertPublisher.java | 2 +- .../changeEvent/generic/GenericPublisher.java | 2 +- .../searchIndex/ElasticSearchBulkSink.java | 8 +-- .../searchIndex/ElasticSearchIndexSink.java | 2 +- .../searchIndex/OpenSearchBulkSink.java | 8 +-- .../searchIndex/OpenSearchIndexSink.java | 2 +- .../bundles/searchIndex/SearchIndexApp.java | 5 -- .../service/cache/RedisCacheBundle.java | 2 +- .../events/AbstractEventPublisher.java | 3 +- .../EntityLifecycleEventDispatcher.java | 22 ------- .../EntityLifecycleEventHandler.java | 17 ------ .../handlers/SearchIndexHandler.java | 3 - .../ConstraintViolationExceptionMapper.java | 11 ++-- .../decorators/SlackMessageDecorator.java | 18 +++--- .../governance/workflows/WorkflowHandler.java | 7 +-- .../service/jdbi3/ChangeSummarizer.java | 11 ++-- .../service/jdbi3/ColumnUtil.java | 6 -- .../service/jdbi3/DirectoryRepository.java | 2 +- .../jdbi3/EntityTimeSeriesRepository.java | 5 +- .../service/jdbi3/FileRepository.java | 2 +- .../service/jdbi3/SpreadsheetRepository.java | 4 +- .../service/jdbi3/TableRepository.java | 3 - .../TestCaseResolutionStatusRepository.java | 5 +- .../jdbi3/TestCaseResultRepository.java | 13 ++-- .../service/jdbi3/WorksheetRepository.java | 2 +- .../service/jobs/GenericBackgroundWorker.java | 4 +- .../migration/api/MigrationWorkflow.java | 1 - .../service/monitoring/MetricsExample.java | 2 +- .../monitoring/MetricsRequestFilter.java | 6 +- .../resources/data/DataContractResource.java | 11 ++-- .../system/SearchSettingsHandler.java | 7 --- .../service/resources/teams/TeamResource.java | 2 +- .../service/search/SearchAggregation.java | 3 - .../service/search/SearchClient.java | 22 ------- .../service/search/SearchIndexUtils.java | 37 ++++++------ .../search/SearchSourceBuilderFactory.java | 59 ++++++------------- .../service/search/SearchUtil.java | 2 - .../elasticsearch/ElasticSearchClient.java | 6 +- .../ElasticSearchSourceBuilderFactory.java | 4 +- .../service/search/nlq/NoOpNLQService.java | 4 +- .../search/opensearch/OpenSearchClient.java | 8 +-- .../OpenSearchSourceBuilderFactory.java | 4 +- .../security/auth/LdapAuthenticator.java | 9 --- .../security/auth/UserActivityFilter.java | 3 +- .../security/auth/UserActivityTracker.java | 28 +++------ .../saml/SamlAssertionConsumerServlet.java | 5 +- .../security/saml/SamlLogoutServlet.java | 4 +- .../util/EntityRelationshipCleanup.java | 3 - .../openmetadata/service/util/EntityUtil.java | 4 -- .../service/util/FullyQualifiedName.java | 9 --- .../service/util/ReflectionUtil.java | 4 -- .../openmetadata/service/util/RestUtil.java | 3 +- ...DatabaseAuthenticationProviderFactory.java | 3 - .../dataRetention/DataRetentionAppTest.java | 3 +- .../cache/CacheDisabledCompatibilityTest.java | 27 +++------ .../cache/CacheWarmupIntegrationTest.java | 12 ++-- .../service/cache/CacheWarmupServiceTest.java | 22 +++---- .../cache/RateLimiterComparisonTest.java | 12 ++-- .../RateLimiterProductionReadinessTest.java | 11 ++-- .../monitoring/MicrometerBundleTest.java | 2 +- .../RequestLatencyTrackingSimpleTest.java | 2 +- .../service/resources/EntityResourceTest.java | 14 +---- .../apps/ConfigurationReaderTest.java | 6 +- .../resources/columns/ColumnResourceTest.java | 3 +- .../data/DataContractResourceTest.java | 2 +- .../databases/TableResourceTest.java | 2 +- .../dqtests/TestCaseResourceTest.java | 20 +++---- .../glossary/GlossaryTermResourceTest.java | 6 +- .../lineage/LineageResourceTest.java | 3 +- .../resources/metrics/MetricResourceTest.java | 3 +- .../resources/search/SearchResourceTest.java | 6 +- .../resources/teams/UserResourceTest.java | 2 +- ...asticSearchRBACConditionEvaluatorTest.java | 11 +--- .../security/MultiUrlJwkProviderTest.java | 2 +- .../service/util/JsonPatchUtilsTest.java | 20 +++---- 78 files changed, 185 insertions(+), 440 deletions(-) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/JsonPatchMessageBodyReader.java b/openmetadata-service/src/main/java/org/openmetadata/service/JsonPatchMessageBodyReader.java index e7534459748..8ba539784f3 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/JsonPatchMessageBodyReader.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/JsonPatchMessageBodyReader.java @@ -25,7 +25,6 @@ import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.MultivaluedMap; import jakarta.ws.rs.ext.MessageBodyReader; import jakarta.ws.rs.ext.Provider; -import java.io.IOException; import java.io.InputStream; import java.io.StringReader; import java.lang.annotation.Annotation; @@ -49,7 +48,7 @@ public class JsonPatchMessageBodyReader implements MessageBodyReader MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) - throws IOException, WebApplicationException { + throws WebApplicationException { try { // Use Jackson to read the JSON content first to avoid JsonStructure deserialization issues ObjectMapper mapper = new ObjectMapper(); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/AbstractNativeApplication.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/AbstractNativeApplication.java index 1abf725d632..9c422462ddc 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/AbstractNativeApplication.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/AbstractNativeApplication.java @@ -42,7 +42,6 @@ import org.openmetadata.service.util.FullyQualifiedName; import org.openmetadata.service.util.OpenMetadataConnectionBuilder; import org.quartz.JobExecutionContext; import org.quartz.SchedulerException; -import org.quartz.UnableToInterruptJobException; @Getter @Slf4j @@ -124,7 +123,6 @@ public class AbstractNativeApplication implements NativeApplication { /** * Validate the configuration of the application. This method is called before the application is * triggered. - * @param config */ protected void validateConfig(Map config) { LOG.warn("validateConfig is not implemented for this application. Skipping validation."); @@ -334,7 +332,7 @@ public class AbstractNativeApplication implements NativeApplication { } @Override - public void interrupt() throws UnableToInterruptJobException { + public void interrupt() { LOG.info("Interrupting the job for app: {}", this.app.getName()); stop(); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/McpServerProvider.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/McpServerProvider.java index 428cdf23dbc..5bd3938be37 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/McpServerProvider.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/McpServerProvider.java @@ -12,11 +12,6 @@ import org.openmetadata.service.security.Authorizer; public interface McpServerProvider { /** * Initialize and register the MCP server with the application. - * - * @param environment Dropwizard environment - * @param authorizer Security authorizer - * @param limits Request limits - * @param config Application configuration */ void initializeMcpServer( Environment environment, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/changeEvent/AlertPublisher.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/changeEvent/AlertPublisher.java index 921b001dff8..bdf7c24b58a 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/changeEvent/AlertPublisher.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/changeEvent/AlertPublisher.java @@ -13,7 +13,7 @@ public class AlertPublisher extends AbstractEventConsumer { } @Override - public void sendAlert(UUID receiverId, ChangeEvent event) throws EventPublisherException { + public void sendAlert(UUID receiverId, ChangeEvent event) { if (destinationMap.containsKey(receiverId)) { Destination destination = destinationMap.get(receiverId); if (Boolean.TRUE.equals(destination.getEnabled())) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/changeEvent/generic/GenericPublisher.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/changeEvent/generic/GenericPublisher.java index 9587f85905a..a649ddb3e56 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/changeEvent/generic/GenericPublisher.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/changeEvent/generic/GenericPublisher.java @@ -104,7 +104,7 @@ public class GenericPublisher implements Destination { } } - private void sendActionsToTargets(ChangeEvent event) throws Exception { + private void sendActionsToTargets(ChangeEvent event) { List targets = getTargetsForWebhookAlert( webhook, subscriptionDestination.getCategory(), WEBHOOK, client, event); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/ElasticSearchBulkSink.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/ElasticSearchBulkSink.java index a105d7edb37..a454ca1216c 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/ElasticSearchBulkSink.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/ElasticSearchBulkSink.java @@ -15,7 +15,6 @@ import es.org.elasticsearch.common.unit.ByteSizeUnit; import es.org.elasticsearch.common.unit.ByteSizeValue; import es.org.elasticsearch.core.TimeValue; import es.org.elasticsearch.xcontent.XContentType; -import java.io.IOException; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -216,7 +215,7 @@ public class ElasticSearchBulkSink implements BulkSink { } } - private void addEntity(EntityInterface entity, String indexName) throws Exception { + private void addEntity(EntityInterface entity, String indexName) { // Build the search index document using the proper transformation String entityType = Entity.getEntityTypeFromObject(entity); Object searchIndexDoc = Entity.buildSearchIndex(entityType, entity).buildSearchIndexDoc(); @@ -230,8 +229,7 @@ public class ElasticSearchBulkSink implements BulkSink { bulkProcessor.add(updateRequest); } - private void addTimeSeriesEntity(EntityTimeSeriesInterface entity, String indexName) - throws Exception { + private void addTimeSeriesEntity(EntityTimeSeriesInterface entity, String indexName) { String json = JsonUtils.pojoToJson(entity); String docId = entity.getId().toString(); @@ -263,7 +261,7 @@ public class ElasticSearchBulkSink implements BulkSink { } @Override - public void close() throws IOException { + public void close() { try { // Flush any pending requests bulkProcessor.flush(); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/ElasticSearchIndexSink.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/ElasticSearchIndexSink.java index d125a855c51..ec7e29cd9c7 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/ElasticSearchIndexSink.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/ElasticSearchIndexSink.java @@ -500,7 +500,7 @@ public class ElasticSearchIndexSink implements BulkSink, Closeable { } @Override - public void close() throws IOException { + public void close() { client.close(); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/OpenSearchBulkSink.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/OpenSearchBulkSink.java index 37682b8d808..26c55ae1908 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/OpenSearchBulkSink.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/OpenSearchBulkSink.java @@ -2,7 +2,6 @@ package org.openmetadata.service.apps.bundles.searchIndex; import static org.openmetadata.service.workflows.searchIndex.ReindexingUtil.ENTITY_TYPE_KEY; -import java.io.IOException; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -216,7 +215,7 @@ public class OpenSearchBulkSink implements BulkSink { } } - private void addEntity(EntityInterface entity, String indexName) throws Exception { + private void addEntity(EntityInterface entity, String indexName) { // Build the search index document using the proper transformation String entityType = Entity.getEntityTypeFromObject(entity); Object searchIndexDoc = Entity.buildSearchIndex(entityType, entity).buildSearchIndexDoc(); @@ -230,8 +229,7 @@ public class OpenSearchBulkSink implements BulkSink { bulkProcessor.add(updateRequest); } - private void addTimeSeriesEntity(EntityTimeSeriesInterface entity, String indexName) - throws Exception { + private void addTimeSeriesEntity(EntityTimeSeriesInterface entity, String indexName) { String json = JsonUtils.pojoToJson(entity); String docId = entity.getId().toString(); @@ -263,7 +261,7 @@ public class OpenSearchBulkSink implements BulkSink { } @Override - public void close() throws IOException { + public void close() { try { // Flush any pending requests bulkProcessor.flush(); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/OpenSearchIndexSink.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/OpenSearchIndexSink.java index 23a8f00bda5..8ee3f98123d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/OpenSearchIndexSink.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/OpenSearchIndexSink.java @@ -452,7 +452,7 @@ public class OpenSearchIndexSink implements BulkSink, Closeable { } @Override - public void close() throws IOException { + public void close() { client.close(); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java index 245fe6f31e5..554e38fedc5 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/searchIndex/SearchIndexApp.java @@ -529,11 +529,6 @@ public class SearchIndexApp extends AbstractNativeApplication { /** * Shuts down an executor service gracefully. - * - * @param executor The executor service to shut down. - * @param name The name of the executor for logging. - * @param timeout The timeout duration. - * @param unit The time unit of the timeout. */ private void shutdownExecutor( ExecutorService executor, String name, long timeout, TimeUnit unit) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/cache/RedisCacheBundle.java b/openmetadata-service/src/main/java/org/openmetadata/service/cache/RedisCacheBundle.java index 5c67fecf107..0ab371df661 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/cache/RedisCacheBundle.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/cache/RedisCacheBundle.java @@ -182,7 +182,7 @@ public class RedisCacheBundle implements ConfiguredBundle warmupService.startWarmup()); + .execute(warmupService::startWarmup); } @Override diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/events/AbstractEventPublisher.java b/openmetadata-service/src/main/java/org/openmetadata/service/events/AbstractEventPublisher.java index 90b9191d03e..c1a9e20da6f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/events/AbstractEventPublisher.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/events/AbstractEventPublisher.java @@ -25,8 +25,7 @@ public abstract class AbstractEventPublisher implements EventPublisher { @Override public void onEvent( - EventPubSub.ChangeEventHolder changeEventHolder, long sequence, boolean endOfBatch) - throws Exception { + EventPubSub.ChangeEventHolder changeEventHolder, long sequence, boolean endOfBatch) { // Ignore events that don't match the webhook event filters ChangeEvent changeEvent = changeEventHolder.getEvent(); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/events/lifecycle/EntityLifecycleEventDispatcher.java b/openmetadata-service/src/main/java/org/openmetadata/service/events/lifecycle/EntityLifecycleEventDispatcher.java index 5f671231942..1378a7c5277 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/events/lifecycle/EntityLifecycleEventDispatcher.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/events/lifecycle/EntityLifecycleEventDispatcher.java @@ -56,8 +56,6 @@ public class EntityLifecycleEventDispatcher { /** * Register a new lifecycle event handler. * Handlers are automatically sorted by priority after registration. - * - * @param handler The handler to register */ public synchronized void registerHandler(EntityLifecycleEventHandler handler) { if (handler == null) { @@ -86,9 +84,6 @@ public class EntityLifecycleEventDispatcher { /** * Unregister a lifecycle event handler by name. - * - * @param handlerName The name of the handler to remove - * @return true if handler was found and removed */ public synchronized boolean unregisterHandler(String handlerName) { boolean removed = handlers.removeIf(h -> h.getHandlerName().equals(handlerName)); @@ -109,9 +104,6 @@ public class EntityLifecycleEventDispatcher { /** * Dispatch entity created event to all applicable handlers. - * - * @param entity The entity that was created - * @param subjectContext The security context */ public void onEntityCreated(EntityInterface entity, SubjectContext subjectContext) { if (entity == null) return; @@ -126,10 +118,6 @@ public class EntityLifecycleEventDispatcher { /** * Dispatch entity updated event to all applicable handlers. - * - * @param entity The entity that was updated - * @param changeDescription Description of changes - * @param subjectContext The security context */ public void onEntityUpdated( EntityInterface entity, ChangeDescription changeDescription, SubjectContext subjectContext) { @@ -146,9 +134,6 @@ public class EntityLifecycleEventDispatcher { /** * Dispatch entity updated event to all applicable handlers. - * - * @param entityReference The reference for the entity that was updated - * @param subjectContext The security context */ public void onEntityUpdated(EntityReference entityReference, SubjectContext subjectContext) { if (entityReference == null) return; @@ -163,9 +148,6 @@ public class EntityLifecycleEventDispatcher { /** * Dispatch entity deleted event to all applicable handlers. - * - * @param entity The entity that was deleted - * @param subjectContext The security context */ public void onEntityDeleted(EntityInterface entity, SubjectContext subjectContext) { if (entity == null) return; @@ -180,10 +162,6 @@ public class EntityLifecycleEventDispatcher { /** * Dispatch entity soft deleted or restored event to all applicable handlers. - * - * @param entity The entity that was soft deleted or restored - * @param isDeleted true if soft deleted, false if restored - * @param subjectContext The security context */ public void onEntitySoftDeletedOrRestored( EntityInterface entity, boolean isDeleted, SubjectContext subjectContext) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/events/lifecycle/EntityLifecycleEventHandler.java b/openmetadata-service/src/main/java/org/openmetadata/service/events/lifecycle/EntityLifecycleEventHandler.java index 6df666a03df..7a09f627979 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/events/lifecycle/EntityLifecycleEventHandler.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/events/lifecycle/EntityLifecycleEventHandler.java @@ -27,9 +27,6 @@ public interface EntityLifecycleEventHandler { /** * Called after an entity is successfully created. - * - * @param entity The entity that was created - * @param subjectContext The security context of the user who created the entity */ default void onEntityCreated(EntityInterface entity, SubjectContext subjectContext) { // Default empty implementation @@ -37,10 +34,6 @@ public interface EntityLifecycleEventHandler { /** * Called after an entity is successfully updated. - * - * @param entity The updated entity - * @param changeDescription Description of changes made to the entity - * @param subjectContext The security context of the user who updated the entity */ default void onEntityUpdated( EntityInterface entity, ChangeDescription changeDescription, SubjectContext subjectContext) { @@ -49,9 +42,6 @@ public interface EntityLifecycleEventHandler { /** * Called after an entity is successfully updated. - * - * @param entityRef The updated entity reference - * @param subjectContext The security context of the user who updated the entity */ default void onEntityUpdated(EntityReference entityRef, SubjectContext subjectContext) { // Default empty implementation @@ -59,9 +49,6 @@ public interface EntityLifecycleEventHandler { /** * Called after an entity is successfully deleted. - * - * @param entity The entity that was deleted - * @param subjectContext The security context of the user who deleted the entity */ default void onEntityDeleted(EntityInterface entity, SubjectContext subjectContext) { // Default empty implementation @@ -69,10 +56,6 @@ public interface EntityLifecycleEventHandler { /** * Called after an entity is soft deleted or restored. - * - * @param entity The entity that was soft deleted or restored - * @param isDeleted true if soft deleted, false if restored - * @param subjectContext The security context of the user who performed the action */ default void onEntitySoftDeletedOrRestored( EntityInterface entity, boolean isDeleted, SubjectContext subjectContext) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/events/lifecycle/handlers/SearchIndexHandler.java b/openmetadata-service/src/main/java/org/openmetadata/service/events/lifecycle/handlers/SearchIndexHandler.java index 5cac4ee2e8b..9b8bf650670 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/events/lifecycle/handlers/SearchIndexHandler.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/events/lifecycle/handlers/SearchIndexHandler.java @@ -169,9 +169,6 @@ public class SearchIndexHandler implements EntityLifecycleEventHandler { /** * Handle bulk entity creation for better performance. * This method can be used by the dispatcher for optimized bulk operations. - * - * @param entities List of entities to index - * @param subjectContext Security context */ public void onEntitiesCreated(List entities, SubjectContext subjectContext) { if (entities == null || entities.isEmpty()) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/exception/ConstraintViolationExceptionMapper.java b/openmetadata-service/src/main/java/org/openmetadata/service/exception/ConstraintViolationExceptionMapper.java index bbb847404cc..2fb8959fd94 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/exception/ConstraintViolationExceptionMapper.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/exception/ConstraintViolationExceptionMapper.java @@ -37,12 +37,11 @@ public class ConstraintViolationExceptionMapper List errorMessages = constraintViolations.stream() .map( - constraintViolation -> { - return "query param " - + getLeafNodeName(constraintViolation.getPropertyPath()) - + " " - + constraintViolation.getMessage(); - }) + constraintViolation -> + "query param " + + getLeafNodeName(constraintViolation.getPropertyPath()) + + " " + + constraintViolation.getMessage()) .toList(); return Response.status(Response.Status.BAD_REQUEST) .entity( diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/formatter/decorators/SlackMessageDecorator.java b/openmetadata-service/src/main/java/org/openmetadata/service/formatter/decorators/SlackMessageDecorator.java index c3d6c2b8a12..99f053b5b37 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/formatter/decorators/SlackMessageDecorator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/formatter/decorators/SlackMessageDecorator.java @@ -225,11 +225,10 @@ public class SlackMessageDecorator implements MessageDecorator { // desc about the event List thread_messages = outgoingMessage.getMessages(); thread_messages.forEach( - (message) -> { - blocks.add( - Blocks.section( - section -> section.text(BlockCompositions.markdownText("> " + message)))); - }); + (message) -> + blocks.add( + Blocks.section( + section -> section.text(BlockCompositions.markdownText("> " + message))))); // Divider blocks.add(Blocks.divider()); @@ -312,11 +311,10 @@ public class SlackMessageDecorator implements MessageDecorator { // desc about the event List thread_messages = outgoingMessage.getMessages(); thread_messages.forEach( - (message) -> { - blocks.add( - Blocks.section( - section -> section.text(BlockCompositions.markdownText("> " + message)))); - }); + (message) -> + blocks.add( + Blocks.section( + section -> section.text(BlockCompositions.markdownText("> " + message))))); // Divider blocks.add(Blocks.divider()); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowHandler.java b/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowHandler.java index 504f353bead..fde3c1c6a35 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowHandler.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowHandler.java @@ -432,9 +432,8 @@ public class WorkflowHandler { .processDefinitionKey(getTriggerWorkflowId(workflowName)) .list() .forEach( - instance -> { - runtimeService.deleteProcessInstance( - instance.getId(), "Terminating all instances due to user request."); - }); + instance -> + runtimeService.deleteProcessInstance( + instance.getId(), "Terminating all instances due to user request.")); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ChangeSummarizer.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ChangeSummarizer.java index 39df3e3a6a1..e362979ec63 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ChangeSummarizer.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ChangeSummarizer.java @@ -45,7 +45,7 @@ public class ChangeSummarizer { change -> Optional.ofNullable(currentSummary) .map(summary -> summary.get(change.getName())) - .map(c -> c.getChangedAt()) + .map(ChangeSummary::getChangedAt) .orElse(0L) .compareTo(changedAt) < 0) @@ -98,8 +98,6 @@ public class ChangeSummarizer { /** * Given a list of fields that were deleted, process the fields and return the set of keys to delete - * @param fieldsDeleted list of fields that were deleted - * @return set of keys to delete */ public Set processDeleted(List fieldsDeleted) { Set keysToDelete = new HashSet<>(); @@ -144,10 +142,9 @@ public class ChangeSummarizer { .map(map -> (Map) map) .map(map -> (String) map.get("name")) .forEach( - name -> { - keysToDelete.add( - FullyQualifiedName.build(fieldChange.getName(), name, nestedField)); - }); + name -> + keysToDelete.add( + FullyQualifiedName.build(fieldChange.getName(), name, nestedField))); } catch (JsonParsingException e) { LOG.warn("Error processing deleted fields", e); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ColumnUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ColumnUtil.java index 3eb10ebd00e..0b389f4bfd8 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ColumnUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ColumnUtil.java @@ -96,9 +96,6 @@ public final class ColumnUtil { /** * Finds a column by its Fully Qualified Name (FQN). - * @param columns List of columns in the table. - * @param columnFqn The fully qualified name of the column. - * @return The matched column if found, otherwise null. */ public static Column findColumn(List columns, String columnFqn) { for (Column column : columns) { @@ -119,9 +116,6 @@ public final class ColumnUtil { * Adds or updates a column within the given column list. * If the column exists, it updates its values. * If the column does not exist, it adds it to the list. - * - * @param columns The list of columns where the column should be added/updated. - * @param newColumn The new column to add or update. */ public static void addOrUpdateColumn(List columns, Column newColumn) { Optional existingColumn = diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DirectoryRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DirectoryRepository.java index 4f32084b7a3..06fb9372f36 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DirectoryRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DirectoryRepository.java @@ -349,7 +349,7 @@ public class DirectoryRepository extends EntityRepository { recordList, entity.getDataProducts() != null ? entity.getDataProducts().stream() - .map(ref -> ref.getFullyQualifiedName()) + .map(EntityReference::getFullyQualifiedName) .collect(Collectors.joining(";")) : ""); addOwners(recordList, entity.getExperts()); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityTimeSeriesRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityTimeSeriesRepository.java index acdde6e2248..f60eb6dfa8f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityTimeSeriesRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityTimeSeriesRepository.java @@ -10,9 +10,7 @@ import static org.openmetadata.service.util.jdbi.JdbiUtils.getOffset; import jakarta.json.JsonObject; import jakarta.json.JsonPatch; import jakarta.ws.rs.core.Response; -import java.beans.IntrospectionException; import java.io.IOException; -import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -339,8 +337,7 @@ public abstract class EntityTimeSeriesRepository patch(UUID id, JsonPatch patch, String user) - throws IntrospectionException, InvocationTargetException, IllegalAccessException { + public RestUtil.PatchResponse patch(UUID id, JsonPatch patch, String user) { String originalJson = timeSeriesDao.getById(id); if (originalJson == null) { throw new EntityNotFoundException(String.format("Entity with id %s not found", id)); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/FileRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/FileRepository.java index 26d8201431e..1aee5f2073b 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/FileRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/FileRepository.java @@ -182,7 +182,7 @@ public class FileRepository extends EntityRepository { @Override public CsvImportResult importFromCsv( - String name, String csv, boolean dryRun, String user, boolean recursive) throws IOException { + String name, String csv, boolean dryRun, String user, boolean recursive) { // For files, we need the directory context for import throw new UnsupportedOperationException( "File import requires directory context. Use directory import instead."); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SpreadsheetRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SpreadsheetRepository.java index 9a500c88ea0..b04153450a0 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SpreadsheetRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SpreadsheetRepository.java @@ -234,7 +234,7 @@ public class SpreadsheetRepository extends EntityRepository { @Override public CsvImportResult importFromCsv( - String name, String csv, boolean dryRun, String user, boolean recursive) throws IOException { + String name, String csv, boolean dryRun, String user, boolean recursive) { // For spreadsheets, we need the directory context for import throw new UnsupportedOperationException( "Spreadsheet import requires directory context. Use directory import instead."); @@ -367,7 +367,7 @@ public class SpreadsheetRepository extends EntityRepository { recordList, entity.getDataProducts() != null ? entity.getDataProducts().stream() - .map(ref -> ref.getFullyQualifiedName()) + .map(EntityReference::getFullyQualifiedName) .collect(Collectors.joining(";")) : ""); addOwners(recordList, entity.getExperts()); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java index 24ddd0e5217..ef37cc9a029 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java @@ -998,9 +998,6 @@ public class TableRepository extends EntityRepository { /** * Export columns for a table, handling nested column structure - * - * @param table The table whose columns are being exported - * @param csvFile The CSV file to add column records to */ public void exportColumnsRecursively(Table table, CsvFile csvFile) { if (table.getColumns() != null && !table.getColumns().isEmpty()) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseResolutionStatusRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseResolutionStatusRepository.java index 177885cede7..bfee4ae55fe 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseResolutionStatusRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseResolutionStatusRepository.java @@ -7,10 +7,8 @@ import static org.openmetadata.service.Entity.getEntityReferenceByName; import jakarta.json.JsonPatch; import jakarta.ws.rs.core.Response; import java.beans.BeanInfo; -import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; -import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -95,8 +93,7 @@ public class TestCaseResolutionStatusRepository } public RestUtil.PatchResponse patch( - UUID id, JsonPatch patch, String user) - throws IntrospectionException, InvocationTargetException, IllegalAccessException { + UUID id, JsonPatch patch, String user) { String originalJson = timeSeriesDao.getById(id); if (originalJson == null) { throw new EntityNotFoundException(String.format("Entity with id %s not found", id)); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseResultRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseResultRepository.java index 22d59fdc077..f88c2552cf7 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseResultRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseResultRepository.java @@ -248,13 +248,12 @@ public class TestCaseResultRepository extends EntityTimeSeriesRepository { - resultSummaries.add( - new ResultSummary() - .withTestCaseName(testCase.getFullyQualifiedName()) - .withStatus(testCase.getTestCaseStatus()) - .withTimestamp(testCase.getTestCaseResult().getTimestamp())); - }); + () -> + resultSummaries.add( + new ResultSummary() + .withTestCaseName(testCase.getFullyQualifiedName()) + .withStatus(testCase.getTestCaseStatus()) + .withTimestamp(testCase.getTestCaseResult().getTimestamp()))); } else { testSuite.setTestCaseResultSummary( List.of( diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/WorksheetRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/WorksheetRepository.java index cb29505ee84..e8dee39e136 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/WorksheetRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/WorksheetRepository.java @@ -172,7 +172,7 @@ public class WorksheetRepository extends EntityRepository { @Override public CsvImportResult importFromCsv( - String name, String csv, boolean dryRun, String user, boolean recursive) throws IOException { + String name, String csv, boolean dryRun, String user, boolean recursive) { // For worksheets, we need the spreadsheet context for import throw new UnsupportedOperationException( "Worksheet import requires spreadsheet context. Use spreadsheet import instead."); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jobs/GenericBackgroundWorker.java b/openmetadata-service/src/main/java/org/openmetadata/service/jobs/GenericBackgroundWorker.java index 1860c29d90c..7ae4f88ea19 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jobs/GenericBackgroundWorker.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jobs/GenericBackgroundWorker.java @@ -27,7 +27,7 @@ public class GenericBackgroundWorker implements Managed { } @Override - public void start() throws Exception { + public void start() { LOG.info("Starting background job worker"); Thread workerThread = new Thread(this::runWorker, "background-job-worker"); workerThread.setDaemon(true); @@ -35,7 +35,7 @@ public class GenericBackgroundWorker implements Managed { } @Override - public void stop() throws Exception { + public void stop() { running = false; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/api/MigrationWorkflow.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/api/MigrationWorkflow.java index 78b6686fc72..c57c18ccc48 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/api/MigrationWorkflow.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/api/MigrationWorkflow.java @@ -175,7 +175,6 @@ public class MigrationWorkflow { /* * Parse a version string into an array of integers - * @param version The version string to parse * Follows the format major.minor.patch, patch can contain -extension */ private static int[] parseVersion(String version) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/MetricsExample.java b/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/MetricsExample.java index fbd0ec74f0c..2e68b2da5b6 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/MetricsExample.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/MetricsExample.java @@ -137,7 +137,7 @@ public class MetricsExample { // Example: Using gauges for current state metrics.registerGauge( "example.active_connections", - () -> getActiveConnectionCount(), + this::getActiveConnectionCount, "Number of active connections"); // Example: Distribution summary for response sizes diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/MetricsRequestFilter.java b/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/MetricsRequestFilter.java index b0c8174294e..fb823862ca1 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/MetricsRequestFilter.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/monitoring/MetricsRequestFilter.java @@ -9,7 +9,6 @@ import jakarta.ws.rs.container.ContainerRequestFilter; import jakarta.ws.rs.container.ContainerResponseContext; import jakarta.ws.rs.container.ContainerResponseFilter; import jakarta.ws.rs.ext.Provider; -import java.io.IOException; import lombok.extern.slf4j.Slf4j; /** @@ -33,7 +32,7 @@ public class MetricsRequestFilter implements ContainerRequestFilter, ContainerRe } @Override - public void filter(ContainerRequestContext requestContext) throws IOException { + public void filter(ContainerRequestContext requestContext) { // Start timing the request Timer.Sample sample = metrics.startHttpRequestTimer(); requestContext.setProperty(TIMER_SAMPLE_PROPERTY, sample); @@ -46,8 +45,7 @@ public class MetricsRequestFilter implements ContainerRequestFilter, ContainerRe @Override public void filter( - ContainerRequestContext requestContext, ContainerResponseContext responseContext) - throws IOException { + ContainerRequestContext requestContext, ContainerResponseContext responseContext) { try { // Get timing information Timer.Sample sample = (Timer.Sample) requestContext.getProperty(TIMER_SAMPLE_PROPERTY); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/data/DataContractResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/data/DataContractResource.java index 43248f6236e..0b1b5f3b590 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/data/DataContractResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/data/DataContractResource.java @@ -629,8 +629,7 @@ public class DataContractResource extends EntityResource resourceContext = @@ -747,8 +745,7 @@ public class DataContractResource extends EntityResource { schema = @Schema(implementation = CSVExportResponse.class))) }) public Response exportCsvAsync( - @Context SecurityContext securityContext, @PathParam("name") String name) throws IOException { + @Context SecurityContext securityContext, @PathParam("name") String name) { return exportCsvInternalAsync(securityContext, name, false); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchAggregation.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchAggregation.java index 496dbaa17ee..ebde53e1d73 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchAggregation.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchAggregation.java @@ -24,9 +24,6 @@ public class SearchAggregation { * 1. dimensions: the list of dimensions * 2. metrics: the list of metrics * 3. keys: the list of keys to traverse the aggregation tree - * - * @param aggregationMapList the list of aggregations - * @return the metadata */ public DataQualityReportMetadata getAggregationMetadata() { DataQualityReportMetadata metadata = new DataQualityReportMetadata(); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchClient.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchClient.java index fc691f443ea..344229e8edf 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchClient.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchClient.java @@ -439,10 +439,6 @@ public interface SearchClient { /** * Get a list of data stream names that match the given prefix. - * - * @param prefix The prefix to match data stream names against - * @return List of data stream names that match the prefix - * @throws IOException if there is an error communicating with the search engine */ default List getDataStreams(String prefix) throws IOException { throw new CustomExceptionMessage( @@ -451,9 +447,6 @@ public interface SearchClient { /** * Delete data streams that match the given name or pattern. - * - * @param dataStreamName The name or pattern of data streams to delete - * @throws IOException if there is an error communicating with the search engine */ default void deleteDataStream(String dataStreamName) throws IOException { throw new CustomExceptionMessage( @@ -462,9 +455,6 @@ public interface SearchClient { /** * Delete an Index Lifecycle Management (ILM) policy. - * - * @param policyName The name of the ILM policy to delete - * @throws IOException if there is an error communicating with the search engine */ default void deleteILMPolicy(String policyName) throws IOException { throw new CustomExceptionMessage( @@ -473,9 +463,6 @@ public interface SearchClient { /** * Delete an index template. - * - * @param templateName The name of the index template to delete - * @throws IOException if there is an error communicating with the search engine */ default void deleteIndexTemplate(String templateName) throws IOException { throw new CustomExceptionMessage( @@ -484,9 +471,6 @@ public interface SearchClient { /** * Delete a component template. - * - * @param componentTemplateName The name of the component template to delete - * @throws IOException if there is an error communicating with the search engine */ default void deleteComponentTemplate(String componentTemplateName) throws IOException { throw new CustomExceptionMessage( @@ -495,9 +479,6 @@ public interface SearchClient { /** * Detach an ILM policy from indexes matching the given pattern. - * - * @param indexPattern The pattern of indexes to detach the ILM policy from - * @throws IOException if there is an error communicating with the search engine */ default void dettachIlmPolicyFromIndexes(String indexPattern) throws IOException { throw new CustomExceptionMessage( @@ -507,9 +488,6 @@ public interface SearchClient { /** * Removes ILM policy from a component template while preserving all other settings. * This is only implemented for Elasticsearch as OpenSearch handles ILM differently. - * - * @param componentTemplateName The name of the component template to update - * @throws IOException if there is an error communicating with the search engine */ default void removeILMFromComponentTemplate(String componentTemplateName) throws IOException { // Default implementation does nothing as this is only needed for Elasticsearch diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchIndexUtils.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchIndexUtils.java index 46b1e5a77fd..27c08e41988 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchIndexUtils.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchIndexUtils.java @@ -327,25 +327,24 @@ public final class SearchIndexUtils { List tagList, TagAndTierSources tagAndTierSources) { Optional.ofNullable(tagList) .ifPresent( - tags -> { - tags.forEach( - tag -> { - String tagSource = tag.getLabelType().value(); - if (tag.getTagFQN().startsWith("Tier.")) { - tagAndTierSources - .getTierSources() - .put( - tagSource, - tagAndTierSources.getTierSources().getOrDefault(tagSource, 0) + 1); - } else { - tagAndTierSources - .getTagSources() - .put( - tagSource, - tagAndTierSources.getTagSources().getOrDefault(tagSource, 0) + 1); - } - }); - }); + tags -> + tags.forEach( + tag -> { + String tagSource = tag.getLabelType().value(); + if (tag.getTagFQN().startsWith("Tier.")) { + tagAndTierSources + .getTierSources() + .put( + tagSource, + tagAndTierSources.getTierSources().getOrDefault(tagSource, 0) + 1); + } else { + tagAndTierSources + .getTagSources() + .put( + tagSource, + tagAndTierSources.getTagSources().getOrDefault(tagSource, 0) + 1); + } + })); } private static void processEntityTagSources( diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchSourceBuilderFactory.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchSourceBuilderFactory.java index 4143038fec3..bce26e11380 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchSourceBuilderFactory.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchSourceBuilderFactory.java @@ -19,10 +19,10 @@ import org.openmetadata.service.Entity; * Interface for creating search source builders for different entity types. * This interface provides a common contract for both ElasticSearch and OpenSearch implementations. * - * @param The SearchSourceBuilder type (different for ElasticSearch and OpenSearch) - * @param The QueryBuilder type - * @param The HighlightBuilder type - * @param The FunctionScoreQueryBuilder type + * The SearchSourceBuilder type (different for ElasticSearch and OpenSearch) + * The QueryBuilder type + * The HighlightBuilder type + * The FunctionScoreQueryBuilder type */ public interface SearchSourceBuilderFactory { @@ -64,54 +64,42 @@ public interface SearchSourceBuilderFactory { /** * Get the appropriate search source builder based on the index name. - * - * @param index the index name - * @param q the search query - * @param from the starting offset - * @param size the number of results to return - * @return a search source builder configured for the specific entity type */ - default S getSearchSourceBuilder(String index, String q, int from, int size) { - return getSearchSourceBuilder(index, q, from, size, false); + default S getSearchSourceBuilder(String indexName, String searchQuery, int fromOffset, int size) { + return getSearchSourceBuilder(indexName, searchQuery, fromOffset, size, false); } /** * Get the appropriate search source builder based on the index name. - * - * @param index the index name - * @param q the search query - * @param from the starting offset - * @param size the number of results to return - * @param explain whether to include explanation of the search results - * @return a search source builder configured for the specific entity type */ - default S getSearchSourceBuilder(String index, String q, int from, int size, boolean explain) { - String indexName = Entity.getSearchRepository().getIndexNameWithoutAlias(index); + default S getSearchSourceBuilder( + String indexName, String searchQuery, int fromOffset, int size, boolean includeExplain) { + indexName = Entity.getSearchRepository().getIndexNameWithoutAlias(indexName); if (isTimeSeriesIndex(indexName)) { - return buildTimeSeriesSearchBuilder(indexName, q, from, size); + return buildTimeSeriesSearchBuilder(indexName, searchQuery, fromOffset, size); } if (isServiceIndex(indexName)) { - return buildServiceSearchBuilder(q, from, size); + return buildServiceSearchBuilder(searchQuery, fromOffset, size); } if (isDataQualityIndex(indexName)) { - return buildDataQualitySearchBuilder(indexName, q, from, size); + return buildDataQualitySearchBuilder(indexName, searchQuery, fromOffset, size); } if (isDataAssetIndex(indexName)) { - return buildDataAssetSearchBuilder(indexName, q, from, size, explain); + return buildDataAssetSearchBuilder(indexName, searchQuery, fromOffset, size, includeExplain); } if (indexName.equals("all") || indexName.equals("dataAsset")) { - return buildCommonSearchBuilder(q, from, size); + return buildCommonSearchBuilder(searchQuery, fromOffset, size); } return switch (indexName) { case "user_search_index", "user", "team_search_index", "team" -> buildUserOrTeamSearchBuilder( - q, from, size); - default -> buildAggregateSearchBuilder(q, from, size); + searchQuery, fromOffset, size); + default -> buildAggregateSearchBuilder(searchQuery, fromOffset, size); }; } @@ -214,31 +202,18 @@ public interface SearchSourceBuilderFactory { /** * Build a search query builder with the specified fields and weights. - * - * @param query the search query - * @param fields map of field names to their boost weights - * @return a query string query builder */ Q buildSearchQueryBuilder(String query, Map fields); /** * Build highlights for the specified fields. - * - * @param fields list of field names to highlight - * @return a highlight builder */ H buildHighlights(List fields); /** * Create a search source builder with the specified query builder, highlights, and pagination. - * - * @param queryBuilder the query builder - * @param highlightBuilder the highlight builder - * @param from the starting offset - * @param size the number of results to return - * @return a search source builder */ - S searchBuilder(Q queryBuilder, H highlightBuilder, int from, int size); + S searchBuilder(Q queryBuilder, H highlightBuilder, int fromOffset, int size); S addAggregationsToNLQQuery(S searchSourceBuilder, String indexName); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchUtil.java index 387b883d2e2..81eb832a48f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchUtil.java @@ -7,8 +7,6 @@ import org.openmetadata.service.Entity; public class SearchUtil { /** * Check if the index is a data asset index - * @param indexName name of the index to check - * @return true if index is a data asset, false otherwise */ public static boolean isDataAssetIndex(String indexName) { return switch (indexName) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java index 25eacaab0ab..a30aec7763e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchClient.java @@ -852,8 +852,7 @@ public class ElasticSearchClient implements SearchClient { } @Override - public Response searchWithNLQ(SearchRequest request, SubjectContext subjectContext) - throws IOException { + public Response searchWithNLQ(SearchRequest request, SubjectContext subjectContext) { LOG.info("Searching with NLQ: {}", request.getQuery()); if (nlqService != null) { try { @@ -1457,8 +1456,7 @@ public class ElasticSearchClient implements SearchClient { } @Override - public void createEntities(String indexName, List> docsAndIds) - throws IOException { + public void createEntities(String indexName, List> docsAndIds) { if (isClientAvailable) { BulkRequest bulkRequest = new BulkRequest(); for (Map docAndId : docsAndIds) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchSourceBuilderFactory.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchSourceBuilderFactory.java index b8c6f5a0542..def4f641728 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchSourceBuilderFactory.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchSourceBuilderFactory.java @@ -84,13 +84,13 @@ public class ElasticSearchSourceBuilderFactory @Override public SearchSourceBuilder searchBuilder( - QueryBuilder query, HighlightBuilder highlightBuilder, int from, int size) { + QueryBuilder query, HighlightBuilder highlightBuilder, int fromOffset, int size) { SearchSourceBuilder builder = new SearchSourceBuilder(); builder.query(query); if (highlightBuilder != null) { builder.highlighter(highlightBuilder); } - builder.from(from); + builder.from(fromOffset); builder.size(size); return builder; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/nlq/NoOpNLQService.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/nlq/NoOpNLQService.java index aaf67c80800..f29a1020518 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/nlq/NoOpNLQService.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/nlq/NoOpNLQService.java @@ -1,6 +1,5 @@ package org.openmetadata.service.search.nlq; -import java.io.IOException; import lombok.extern.slf4j.Slf4j; import org.openmetadata.schema.api.search.NLQConfiguration; import org.openmetadata.schema.search.SearchRequest; @@ -21,8 +20,7 @@ public class NoOpNLQService implements NLQService { } @Override - public String transformNaturalLanguageQuery(SearchRequest request, String additionalContext) - throws IOException { + public String transformNaturalLanguageQuery(SearchRequest request, String additionalContext) { return null; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java index 5c7750bbe03..bcfaa24a4a5 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchClient.java @@ -509,8 +509,7 @@ public class OpenSearchClient implements SearchClient { } @Override - public Response searchWithNLQ(SearchRequest request, SubjectContext subjectContext) - throws IOException { + public Response searchWithNLQ(SearchRequest request, SubjectContext subjectContext) { LOG.info("Searching with NLQ: {}", request.getQuery()); if (nlqService != null) { @@ -1611,8 +1610,7 @@ public class OpenSearchClient implements SearchClient { } @Override - public void createEntities(String indexName, List> docsAndIds) - throws IOException { + public void createEntities(String indexName, List> docsAndIds) { if (isClientAvailable) { BulkRequest bulkRequest = new BulkRequest(); for (Map docAndId : docsAndIds) { @@ -2525,7 +2523,7 @@ public class OpenSearchClient implements SearchClient { } @Override - public List getDataStreams(String prefix) throws IOException { + public List getDataStreams(String prefix) { try { GetDataStreamRequest request = new GetDataStreamRequest(prefix + "*"); GetDataStreamResponse response = diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchSourceBuilderFactory.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchSourceBuilderFactory.java index 8e3d55d9ce3..0546c607419 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchSourceBuilderFactory.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchSourceBuilderFactory.java @@ -83,13 +83,13 @@ public class OpenSearchSourceBuilderFactory @Override public SearchSourceBuilder searchBuilder( - QueryBuilder query, HighlightBuilder highlightBuilder, int from, int size) { + QueryBuilder query, HighlightBuilder highlightBuilder, int fromOffset, int size) { SearchSourceBuilder builder = new SearchSourceBuilder(); builder.query(query); if (highlightBuilder != null) { builder.highlighter(highlightBuilder); } - builder.from(from); + builder.from(fromOffset); builder.size(size); return builder; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LdapAuthenticator.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LdapAuthenticator.java index f248c7cd0d3..205dcc38183 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LdapAuthenticator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LdapAuthenticator.java @@ -150,11 +150,6 @@ public class LdapAuthenticator implements AuthenticatorHandler { /** * Check if the user exists in database by userName, if user exist, reassign roles for user according to it's ldap * group else, create a new user and assign roles according to it's ldap group - * - * @param userDn userDn from LDAP - * @param email Email of the User - * @return user info - * @author Eric Wen@2023-07-16 17:06:43 */ private User checkAndCreateUser(String userDn, String email, String userName) throws IOException { // Check if the user exists in OM Database @@ -303,10 +298,6 @@ public class LdapAuthenticator implements AuthenticatorHandler { /** * Getting user's roles according to the mapping between ldap groups and roles - * - * @param user user object - * @param reAssign flag to decide whether to reassign roles - * @author Eric Wen@2023-07-16 17:23:57 */ private void getRoleForLdap(String userDn, User user, Boolean reAssign) throws JsonProcessingException { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/UserActivityFilter.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/UserActivityFilter.java index 5973a0e8ae7..2a92673e2b3 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/UserActivityFilter.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/UserActivityFilter.java @@ -16,7 +16,6 @@ import jakarta.ws.rs.container.ContainerRequestContext; import jakarta.ws.rs.container.ContainerRequestFilter; import jakarta.ws.rs.core.SecurityContext; import jakarta.ws.rs.ext.Provider; -import java.io.IOException; import lombok.extern.slf4j.Slf4j; import org.openmetadata.service.security.policyevaluator.SubjectContext; @@ -30,7 +29,7 @@ import org.openmetadata.service.security.policyevaluator.SubjectContext; public class UserActivityFilter implements ContainerRequestFilter { @Override - public void filter(ContainerRequestContext requestContext) throws IOException { + public void filter(ContainerRequestContext requestContext) { // Only track authenticated users SecurityContext securityContext = requestContext.getSecurityContext(); if (securityContext == null || securityContext.getUserPrincipal() == null) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/UserActivityTracker.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/UserActivityTracker.java index 0914beb283a..8b5f06e5007 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/UserActivityTracker.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/UserActivityTracker.java @@ -59,19 +59,11 @@ public class UserActivityTracker { private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor( - r -> { - return Thread.ofPlatform() - .name("UserActivityTracker-Scheduler") - .daemon(true) - .unstarted(r); - }); + r -> Thread.ofPlatform().name("UserActivityTracker-Scheduler").daemon(true).unstarted(r)); private final ScheduledExecutorService virtualThreadExecutor = Executors.newScheduledThreadPool( - 0, - r -> { - return Thread.ofVirtual().name("UserActivityTracker-VirtualThread-", 0).unstarted(r); - }); + 0, r -> Thread.ofVirtual().name("UserActivityTracker-VirtualThread-", 0).unstarted(r)); private volatile UserRepository userRepository; @@ -191,9 +183,7 @@ public class UserActivityTracker { // Convert to a simple map of userName -> lastActivityTime userActivityMap = new HashMap<>(); localActivityCache.forEach( - (userName, activity) -> { - userActivityMap.put(userName, activity.lastActivityTime); - }); + (userName, activity) -> userActivityMap.put(userName, activity.lastActivityTime)); localActivityCache.clear(); } finally { cacheLock.writeLock().unlock(); @@ -241,10 +231,10 @@ public class UserActivityTracker { cacheLock.writeLock().lock(); try { userActivityMap.forEach( - (userName, lastActivityTime) -> { - localActivityCache.putIfAbsent( - userName, new UserActivity(userName, lastActivityTime, System.currentTimeMillis())); - }); + (userName, lastActivityTime) -> + localActivityCache.putIfAbsent( + userName, + new UserActivity(userName, lastActivityTime, System.currentTimeMillis()))); } finally { cacheLock.writeLock().unlock(); } @@ -310,9 +300,7 @@ public class UserActivityTracker { // Convert to a simple map of userName -> lastActivityTime userActivityMap = new HashMap<>(); localActivityCache.forEach( - (userName, activity) -> { - userActivityMap.put(userName, activity.lastActivityTime); - }); + (userName, activity) -> userActivityMap.put(userName, activity.lastActivityTime)); localActivityCache.clear(); } finally { cacheLock.writeLock().unlock(); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlAssertionConsumerServlet.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlAssertionConsumerServlet.java index 27d8ee3d2be..4a2515f40de 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlAssertionConsumerServlet.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlAssertionConsumerServlet.java @@ -18,13 +18,11 @@ import static org.openmetadata.service.security.AuthenticationCodeFlowHandler.SE import static org.openmetadata.service.util.UserUtil.getRoleListFromUser; import com.onelogin.saml2.Auth; -import jakarta.servlet.ServletException; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.Cookie; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; -import java.io.IOException; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -63,8 +61,7 @@ public class SamlAssertionConsumerServlet extends HttpServlet { } @Override - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + protected void doPost(HttpServletRequest request, HttpServletResponse response) { try { // Convert Jakarta servlet types to javax servlet types using Apache Felix wrappers javax.servlet.http.HttpServletRequest wrappedRequest = new HttpServletRequestWrapper(request); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlLogoutServlet.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlLogoutServlet.java index 9a17ac0ad4d..d4ad10a2c1b 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlLogoutServlet.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlLogoutServlet.java @@ -24,7 +24,6 @@ import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpSession; -import java.io.IOException; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Date; @@ -61,8 +60,7 @@ public class SamlLogoutServlet extends HttpServlet { @Override protected void doGet( - final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) - throws IOException { + final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) { try { LOG.debug("Performing application logout"); HttpSession session = httpServletRequest.getSession(false); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/EntityRelationshipCleanup.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/EntityRelationshipCleanup.java index 4246416e908..acdc9db1f55 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/EntityRelationshipCleanup.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/EntityRelationshipCleanup.java @@ -244,9 +244,6 @@ public class EntityRelationshipCleanup { /** * Deletes orphaned relationships from the database - * - * @param orphanedRelationships List of orphaned relationships to delete - * @return Number of relationships successfully deleted */ private int deleteOrphanedRelationships(List orphanedRelationships) { LOG.info("Deleting {} orphaned relationships", orphanedRelationships.size()); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/EntityUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/EntityUtil.java index ea093c85289..df2f8624d44 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/EntityUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/EntityUtil.java @@ -799,10 +799,6 @@ public final class EntityUtil { * Gets the value of a field from an entity using reflection. * This method checks if the entity supports the given field and returns its value. * If the field is not supported, returns null. - * - * @param entity The entity to get the field value from - * @param fieldName The name of the field to get (corresponds to getter method name without 'get' prefix) - * @return The value of the field, or null if field is not supported by the entity */ public static Object getEntityField(EntityInterface entity, String fieldName) { if (entity == null || fieldName == null || fieldName.isEmpty()) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/FullyQualifiedName.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/FullyQualifiedName.java index 98689127ef9..89ec2c67e32 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/FullyQualifiedName.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/FullyQualifiedName.java @@ -215,9 +215,6 @@ public class FullyQualifiedName { * - Full hierarchy: "service", "service.database", "service.database.schema", "service.database.schema.table" * - Individual parts: "service", "database", "schema", "table" * - Bottom-up combinations: "database.schema.table", "schema.table", "table" - * - * @param fqn The fully qualified name to generate parts from - * @return Set of all possible FQN parts */ public static Set getAllParts(String fqn) { var parts = split(fqn); @@ -239,9 +236,6 @@ public class FullyQualifiedName { * Generates hierarchical FQN parts from root to the full FQN. * For example, given FQN "service.database.schema.table", this method generates: * ["service", "service.database", "service.database.schema", "service.database.schema.table"] - * - * @param fqn The fully qualified name to generate hierarchy from - * @return List of hierarchical FQN parts from root to full FQN */ public static List getHierarchicalParts(String fqn) { var parts = split(fqn); @@ -254,9 +248,6 @@ public class FullyQualifiedName { * Gets all ancestor FQNs for a given FQN. * For example, given FQN "service.database.schema.table", this method returns: * ["service.database.schema", "service.database", "service"] - * - * @param fqn The fully qualified name to get ancestors from - * @return List of ancestor FQNs (excluding the input FQN itself) */ public static List getAncestors(String fqn) { var parts = split(fqn); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/ReflectionUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/ReflectionUtil.java index d9a6229d4a0..0647adda3e7 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/ReflectionUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/ReflectionUtil.java @@ -85,10 +85,6 @@ public class ReflectionUtil { /** * Creates a class instance from a fully qualified class name - * - * @param className The fully qualified class name - * @return Class object - * @throws ClassNotFoundException If class cannot be found */ public static Class createClass(String className) throws ClassNotFoundException { try { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/RestUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/RestUtil.java index 4fd5b532210..64e677130b6 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/RestUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/RestUtil.java @@ -28,7 +28,6 @@ import jakarta.ws.rs.core.UriInfo; import java.net.URI; import java.nio.charset.StandardCharsets; import java.text.DateFormat; -import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; @@ -103,7 +102,7 @@ public final class RestUtil { return getHref(uriInfo, collectionPath, id.toString()); } - public static int compareDates(String date1, String date2) throws ParseException { + public static int compareDates(String date1, String date2) { return LocalDateTime.parse(date1, DATE_FORMAT) .compareTo(LocalDateTime.parse(date2, DATE_FORMAT)); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/jdbi/DatabaseAuthenticationProviderFactory.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/jdbi/DatabaseAuthenticationProviderFactory.java index 77bb1cd267b..e4a0c67baba 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/jdbi/DatabaseAuthenticationProviderFactory.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/jdbi/DatabaseAuthenticationProviderFactory.java @@ -15,9 +15,6 @@ public class DatabaseAuthenticationProviderFactory { /** * Get auth provider based on the given jdbc url. - * - * @param jdbcURL the jdbc url. - * @return instance of {@link DatabaseAuthenticationProvider}. */ public static Optional get(String jdbcURL) { Map queryParams = parseQueryParams(jdbcURL); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/apps/bundles/dataRetention/DataRetentionAppTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/apps/bundles/dataRetention/DataRetentionAppTest.java index 279a8dcfb90..255a3c07ab5 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/apps/bundles/dataRetention/DataRetentionAppTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/apps/bundles/dataRetention/DataRetentionAppTest.java @@ -91,8 +91,7 @@ class DataRetentionAppTest extends OpenMetadataApplicationTest { @Test @Execution(ExecutionMode.CONCURRENT) - void test_dataRetention_withOrphanedRelationshipsCleanup_shouldExecuteSuccessfully() - throws Exception { + void test_dataRetention_withOrphanedRelationshipsCleanup_shouldExecuteSuccessfully() { // Test that the enhanced DataRetention executes the orphaned relationships cleanup // Create a test configuration diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/cache/CacheDisabledCompatibilityTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/cache/CacheDisabledCompatibilityTest.java index 599b163ed1f..a25f72c617c 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/cache/CacheDisabledCompatibilityTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/cache/CacheDisabledCompatibilityTest.java @@ -160,9 +160,7 @@ public class CacheDisabledCompatibilityTest extends OpenMetadataApplicationTest // These operations should not throw exceptions when cache is disabled assertDoesNotThrow( - () -> { - RelationshipCache.put(entityId, testData); - }, + () -> RelationshipCache.put(entityId, testData), "put() should handle disabled cache gracefully"); assertDoesNotThrow( @@ -173,15 +171,10 @@ public class CacheDisabledCompatibilityTest extends OpenMetadataApplicationTest "get() should handle disabled cache gracefully"); assertDoesNotThrow( - () -> { - RelationshipCache.evict(entityId); - }, - "evict() should handle disabled cache gracefully"); + () -> RelationshipCache.evict(entityId), "evict() should handle disabled cache gracefully"); assertDoesNotThrow( - () -> { - RelationshipCache.bumpTag("test-tag", 1); - }, + () -> RelationshipCache.bumpTag("test-tag", 1), "bumpTag() should handle disabled cache gracefully"); assertDoesNotThrow( @@ -254,9 +247,7 @@ public class CacheDisabledCompatibilityTest extends OpenMetadataApplicationTest // Test insert assertDoesNotThrow( - () -> { - entityRelationshipDAO.insert(fromId, toId, fromEntity, toEntity, relation, jsonData); - }, + () -> entityRelationshipDAO.insert(fromId, toId, fromEntity, toEntity, relation, jsonData), "Insert should work without cache"); // Test read @@ -300,9 +291,7 @@ public class CacheDisabledCompatibilityTest extends OpenMetadataApplicationTest // Test bulk insert assertDoesNotThrow( - () -> { - entityRelationshipDAO.bulkInsertTo(relationships); - }, + () -> entityRelationshipDAO.bulkInsertTo(relationships), "Bulk insert should work without cache"); // Test bulk remove @@ -310,9 +299,9 @@ public class CacheDisabledCompatibilityTest extends OpenMetadataApplicationTest relationships.stream().map(CollectionDAO.EntityRelationshipObject::getToId).toList(); assertDoesNotThrow( - () -> { - entityRelationshipDAO.bulkRemoveTo(testTable.getId(), toIds, Entity.TABLE, Entity.TAG, 2); - }, + () -> + entityRelationshipDAO.bulkRemoveTo( + testTable.getId(), toIds, Entity.TABLE, Entity.TAG, 2), "Bulk remove should work without cache"); LOG.info("Bulk operations without cache test passed"); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/cache/CacheWarmupIntegrationTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/cache/CacheWarmupIntegrationTest.java index 3e0e9b85310..92f4c7d7a0e 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/cache/CacheWarmupIntegrationTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/cache/CacheWarmupIntegrationTest.java @@ -294,7 +294,7 @@ class CacheWarmupIntegrationTest extends CachedOpenMetadataApplicationResourceTe @Test @Order(2) @DisplayName("Test cache warmup improves query performance") - public void testCacheWarmupImprovesQueryPerformance() throws Exception { + public void testCacheWarmupImprovesQueryPerformance() { assertTrue(isCacheAvailable(), "Cache should be available for performance testing"); clearCache(); @@ -316,7 +316,7 @@ class CacheWarmupIntegrationTest extends CachedOpenMetadataApplicationResourceTe @Test @DisplayName("Test cache warmup populates relationship data") - public void testCacheWarmupPopulatesRelationshipData() throws Exception { + public void testCacheWarmupPopulatesRelationshipData() { assertTrue(isCacheAvailable(), "Cache should be available for relationship testing"); clearCache(); Map initialStats = getCacheStats(); @@ -341,7 +341,7 @@ class CacheWarmupIntegrationTest extends CachedOpenMetadataApplicationResourceTe @Test @DisplayName("Test cache warmup populates tag data") - public void testCacheWarmupPopulatesTagData() throws Exception { + public void testCacheWarmupPopulatesTagData() { assertTrue(isCacheAvailable(), "Cache should be available for tag testing"); clearCache(); Map> tagResults = new HashMap<>(); @@ -453,7 +453,7 @@ class CacheWarmupIntegrationTest extends CachedOpenMetadataApplicationResourceTe @Test @DisplayName("Test cache warmup handles large dataset efficiently") - public void testCacheWarmupHandlesLargeDatasetEfficiently() throws Exception { + public void testCacheWarmupHandlesLargeDatasetEfficiently() { assertTrue(isCacheAvailable(), "Cache should be available for large dataset testing"); clearCache(); @@ -492,7 +492,7 @@ class CacheWarmupIntegrationTest extends CachedOpenMetadataApplicationResourceTe @Test @DisplayName("Test cache warmup integration with application lifecycle") - public void testCacheWarmupIntegrationWithApplicationLifecycle() throws Exception { + public void testCacheWarmupIntegrationWithApplicationLifecycle() { assertTrue(isCacheAvailable(), "Cache should be available for lifecycle testing"); assertTrue(RelationshipCache.isAvailable(), "Cache should be initialized"); assertFalse(testTables.isEmpty(), "Test entities should be created"); @@ -520,7 +520,7 @@ class CacheWarmupIntegrationTest extends CachedOpenMetadataApplicationResourceTe @Test @DisplayName("Test cache warmup with mixed entity types") - public void testCacheWarmupWithMixedEntityTypes() throws Exception { + public void testCacheWarmupWithMixedEntityTypes() { assertTrue(isCacheAvailable(), "Cache should be available for mixed entity testing"); clearCache(); entityRelationshipDAO.findTo( diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/cache/CacheWarmupServiceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/cache/CacheWarmupServiceTest.java index c93112f4022..56c1580f2b2 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/cache/CacheWarmupServiceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/cache/CacheWarmupServiceTest.java @@ -279,7 +279,7 @@ class CacheWarmupServiceTest extends CachedOpenMetadataApplicationResourceTest { @Test @Order(3) @DisplayName("Test lazy cache initialization and validation") - void testLazyCacheInitialization() throws Exception { + void testLazyCacheInitialization() { assertTrue(isCacheAvailable(), "Cache should be available for lazy loading testing"); CompletableFuture initFuture = lazyCacheService.initializeLazyCache(); @@ -293,16 +293,13 @@ class CacheWarmupServiceTest extends CachedOpenMetadataApplicationResourceTest { // Test that cache connectivity works assertDoesNotThrow( - () -> { - lazyCacheService.testCacheConnectivity(); - }, - "Cache connectivity test should pass"); + () -> lazyCacheService.testCacheConnectivity(), "Cache connectivity test should pass"); } @Test @Order(4) @DisplayName("Test cache statistics and monitoring") - void testCacheStatisticsAndMonitoring() throws Exception { + void testCacheStatisticsAndMonitoring() { LazyCacheService.CacheStats initialStats = lazyCacheService.getCacheStats(); assertEquals(0, initialStats.cacheHits, "Initial cache hits should be 0"); assertEquals(0, initialStats.cacheMisses, "Initial cache misses should be 0"); @@ -329,7 +326,7 @@ class CacheWarmupServiceTest extends CachedOpenMetadataApplicationResourceTest { @Test @Order(5) @DisplayName("Test lazy cache population") - void testLazyCachePopulation() throws Exception { + void testLazyCachePopulation() { if (!isCacheAvailable()) { LOG.warn("Cache not available, skipping lazy cache population test"); return; @@ -352,7 +349,7 @@ class CacheWarmupServiceTest extends CachedOpenMetadataApplicationResourceTest { @Test @Order(6) @DisplayName("Test lazy loading with real entity queries") - void testLazyLoadingWithRealQueries() throws Exception { + void testLazyLoadingWithRealQueries() { if (!isCacheAvailable()) { LOG.warn("Cache not available, skipping real query test"); return; @@ -401,8 +398,7 @@ class CacheWarmupServiceTest extends CachedOpenMetadataApplicationResourceTest { Thread.sleep(50); assertDoesNotThrow( - () -> lifecycleService.shutdown(), - "Shutdown during initialization should not throw exceptions"); + lifecycleService::shutdown, "Shutdown during initialization should not throw exceptions"); try { initFuture.get(5, TimeUnit.SECONDS); @@ -416,7 +412,7 @@ class CacheWarmupServiceTest extends CachedOpenMetadataApplicationResourceTest { @Test @Order(8) @DisplayName("Test lazy cache error handling and resilience") - void testLazyCacheErrorHandlingAndResilience() throws Exception { + void testLazyCacheErrorHandlingAndResilience() { CacheConfiguration minimalConfig = new CacheConfiguration(); minimalConfig.setEnabled(true); minimalConfig.setWarmupEnabled(true); @@ -444,7 +440,7 @@ class CacheWarmupServiceTest extends CachedOpenMetadataApplicationResourceTest { @Test @Order(9) @DisplayName("Test simple background prefetching") - void testSimpleBackgroundPrefetching() throws Exception { + void testSimpleBackgroundPrefetching() { if (!isCacheAvailable()) { LOG.warn("Cache not available, skipping prefetching test"); return; @@ -483,7 +479,7 @@ class CacheWarmupServiceTest extends CachedOpenMetadataApplicationResourceTest { @Test @Order(10) @DisplayName("Test lazy cache thread configuration") - void testLazyCacheThreadConfiguration() throws Exception { + void testLazyCacheThreadConfiguration() { // Test single thread configuration CacheConfiguration singleThreadConfig = new CacheConfiguration(); singleThreadConfig.setEnabled(true); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/cache/RateLimiterComparisonTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/cache/RateLimiterComparisonTest.java index 6380a234987..c6227238195 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/cache/RateLimiterComparisonTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/cache/RateLimiterComparisonTest.java @@ -42,7 +42,7 @@ class RateLimiterComparisonTest { LOG.info("Testing Guava RateLimiter (version: 33.4.8-jre, marked @Beta)"); RateLimiter rateLimiter = RateLimiter.create(TEST_RATE); - RateLimiterTestResult result = performRateLimiterTest("Guava", () -> rateLimiter.acquire()); + RateLimiterTestResult result = performRateLimiterTest("Guava", rateLimiter::acquire); validateRateLimiterResult(result, "Guava RateLimiter"); @@ -156,7 +156,7 @@ class RateLimiterComparisonTest { // Test Guava RateLimiter under concurrency RateLimiter guavaLimiter = RateLimiter.create(TEST_RATE); testConcurrentRateLimiter( - "Guava", executor, threadCount, operationsPerThread, () -> guavaLimiter.acquire()); + "Guava", executor, threadCount, operationsPerThread, guavaLimiter::acquire); // Test Resilience4j RateLimiter under concurrency RateLimiterConfig config = @@ -172,7 +172,7 @@ class RateLimiterComparisonTest { executor, threadCount, operationsPerThread, - () -> resilience4jLimiter.acquirePermission()); + resilience4jLimiter::acquirePermission); // Test production Resilience4j configuration under concurrency RateLimiterConfig prodConfig = @@ -188,7 +188,7 @@ class RateLimiterComparisonTest { executor, threadCount, operationsPerThread, - () -> prodLimiter.acquirePermission()); + prodLimiter::acquirePermission); executor.shutdown(); assertTrue( @@ -373,9 +373,7 @@ class RateLimiterComparisonTest { actualRate <= TEST_RATE * 1.2, name + " should respect rate limits under concurrent load"); } - private RateLimiterTestResult performRateLimiterTest(String name, Runnable acquireOperation) - throws Exception { - + private RateLimiterTestResult performRateLimiterTest(String name, Runnable acquireOperation) { LOG.info("Starting rate limiter test for: {}", name); long startTime = System.currentTimeMillis(); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/cache/RateLimiterProductionReadinessTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/cache/RateLimiterProductionReadinessTest.java index 8171da1e78d..13c5a49553a 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/cache/RateLimiterProductionReadinessTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/cache/RateLimiterProductionReadinessTest.java @@ -52,7 +52,7 @@ class RateLimiterProductionReadinessTest { LOG.info("⚠️ Alternative: Guava RateLimiter - Works but marked @Beta (use with caution)"); } - private void testGuavaRateLimiterProduction(double targetRate, int operations) throws Exception { + private void testGuavaRateLimiterProduction(double targetRate, int operations) { LOG.info("\n--- Testing Guava RateLimiter (v33.4.8-jre) ---"); LOG.info("Status: ⚠️ Marked @Beta - Use with caution in production"); @@ -80,8 +80,7 @@ class RateLimiterProductionReadinessTest { duration >= (operations - 1) * 1000 / targetRate * 0.5, "Should take reasonable time"); } - private void testResilience4jRateLimiterProduction(double targetRate, int operations) - throws Exception { + private void testResilience4jRateLimiterProduction(double targetRate, int operations) { LOG.info("\n--- Testing Resilience4j RateLimiter (v2.2.0) ---"); LOG.info("Status: ✅ Production Ready - Stable and well-maintained"); @@ -144,7 +143,7 @@ class RateLimiterProductionReadinessTest { LOG.info("All rate limiters successfully controlled database load during warmup"); } - private void simulateCacheWarmupWithGuava(double rate, int queries) throws Exception { + private void simulateCacheWarmupWithGuava(double rate, int queries) { LOG.info("\n--- Cache Warmup with Guava RateLimiter ---"); RateLimiter rateLimiter = RateLimiter.create(rate); @@ -165,7 +164,7 @@ class RateLimiterProductionReadinessTest { rate); } - private void simulateCacheWarmupWithResilience4j(double rate, int queries) throws Exception { + private void simulateCacheWarmupWithResilience4j(double rate, int queries) { LOG.info("\n--- Cache Warmup with Resilience4j RateLimiter ---"); RateLimiterConfig config = @@ -227,7 +226,7 @@ class RateLimiterProductionReadinessTest { io.github.resilience4j.ratelimiter.RateLimiter rateLimiter = io.github.resilience4j.ratelimiter.RateLimiter.of("stability-test", config); - return () -> rateLimiter.acquirePermission(); + return rateLimiter::acquirePermission; }, threadCount, operationsPerThread, diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/monitoring/MicrometerBundleTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/monitoring/MicrometerBundleTest.java index 6171981e28d..265388034cd 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/monitoring/MicrometerBundleTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/monitoring/MicrometerBundleTest.java @@ -72,7 +72,7 @@ public class MicrometerBundleTest { } @Test - public void testPrometheusEndpoint() throws Exception { + public void testPrometheusEndpoint() { // Initialize and run bundle bundle.initialize(bootstrap); when(config.getClusterName()).thenReturn("test-cluster"); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/monitoring/RequestLatencyTrackingSimpleTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/monitoring/RequestLatencyTrackingSimpleTest.java index 163427b8a40..d6333e60d14 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/monitoring/RequestLatencyTrackingSimpleTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/monitoring/RequestLatencyTrackingSimpleTest.java @@ -23,7 +23,7 @@ class RequestLatencyTrackingSimpleTest { } @Test - void testRequestLatencyTracking() throws InterruptedException { + void testRequestLatencyTracking() { String endpoint = "/api/v1/test"; RequestLatencyContext.startRequest(endpoint); simulateWork(500); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/EntityResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/EntityResourceTest.java index 5fd9028ce78..4c3d4bdef41 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/EntityResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/EntityResourceTest.java @@ -2583,11 +2583,7 @@ public abstract class EntityResourceTest { - LOG.info("Disconnected from Socket.IO server"); - }); + .on(Socket.EVENT_DISCONNECT, args -> LOG.info("Disconnected from Socket.IO server")); socket.connect(); if (!connectLatch.await(10, TimeUnit.SECONDS)) { @@ -4463,9 +4459,7 @@ public abstract class EntityResourceTest { - System.out.println("Disconnected from Socket.IO server"); - }); + args -> System.out.println("Disconnected from Socket.IO server")); socket.connect(); if (!connectLatch.await(10, TimeUnit.SECONDS)) { @@ -4537,9 +4531,7 @@ public abstract class EntityResourceTest { - System.out.println("Disconnected from Socket.IO server"); - }); + args -> System.out.println("Disconnected from Socket.IO server")); socket.connect(); if (!connectLatch.await(10, TimeUnit.SECONDS)) { diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/apps/ConfigurationReaderTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/apps/ConfigurationReaderTest.java index 22ade489254..46dbe67b498 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/apps/ConfigurationReaderTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/apps/ConfigurationReaderTest.java @@ -48,10 +48,6 @@ public class ConfigurationReaderTest { @Test public void missingConfig() { ConfigurationReader reader = new ConfigurationReader(); - assertThrows( - IOException.class, - () -> { - reader.readConfigFromResource("missing"); - }); + assertThrows(IOException.class, () -> reader.readConfigFromResource("missing")); } } diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/columns/ColumnResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/columns/ColumnResourceTest.java index cbc14236286..f90d7908ca8 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/columns/ColumnResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/columns/ColumnResourceTest.java @@ -1320,8 +1320,7 @@ class ColumnResourceTest extends OpenMetadataApplicationTest { EntityInterface parentEntity, String columnName, List expectedFields, - String entityType) - throws IOException { + String entityType) { String entityLink = String.format("<#E::%s::%s>", entityType, parentEntity.getFullyQualifiedName()); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/data/DataContractResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/data/DataContractResourceTest.java index 6bdaa0b18aa..4e3264f5949 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/data/DataContractResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/data/DataContractResourceTest.java @@ -86,7 +86,7 @@ class DataContractResourceTest extends OpenMetadataApplicationTest { private static String testDatabaseSchemaFQN = null; @AfterEach - void cleanup() throws IOException { + void cleanup() { for (DataContract contract : createdContracts) { try { deleteDataContract(contract.getId()); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/TableResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/TableResourceTest.java index f368815b1ea..5cfdb30d6d9 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/TableResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/databases/TableResourceTest.java @@ -1262,7 +1262,7 @@ public class TableResourceTest extends EntityResourceTest { } @Test - void create_profilerWrongTimestamp(TestInfo testInfo) throws IOException, ParseException { + void create_profilerWrongTimestamp(TestInfo testInfo) throws IOException { Table table = createEntity(createRequest(testInfo), ADMIN_AUTH_HEADERS); Long correctTimestamp = 1725525388000L; Long wrongTimestamp = 1725525388L; diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/dqtests/TestCaseResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/dqtests/TestCaseResourceTest.java index 9d568faaaf4..756856654c1 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/dqtests/TestCaseResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/dqtests/TestCaseResourceTest.java @@ -473,7 +473,7 @@ public class TestCaseResourceTest extends EntityResourceTest { - assertTrue( - tc.getOwners().stream().anyMatch(owner -> owner.getId().equals(user2Ref.getId())), - String.format( - "Test case %s does not contain the expected owner %s", - tc.getName(), user2Ref.getName())); - }); + tc -> + assertTrue( + tc.getOwners().stream() + .anyMatch(owner -> owner.getId().equals(user2Ref.getId())), + String.format( + "Test case %s does not contain the expected owner %s", + tc.getName(), user2Ref.getName()))); queryParams.put("owner", team.getName()); allEntities = listEntitiesFromSearch(queryParams, testCasesNum, 0, ADMIN_AUTH_HEADERS); @@ -3802,7 +3802,7 @@ public class TestCaseResourceTest extends EntityResourceTest"; CreateTestCase create = createRequest(testInfo); @@ -3847,7 +3847,7 @@ public class TestCaseResourceTest extends EntityResourceTest"; diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/glossary/GlossaryTermResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/glossary/GlossaryTermResourceTest.java index e969b714242..bd9b7904ea2 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/glossary/GlossaryTermResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/glossary/GlossaryTermResourceTest.java @@ -2113,11 +2113,7 @@ public class GlossaryTermResourceTest extends EntityResourceTest { - LOG.info("Disconnected from Socket.IO server"); - }); + .on(Socket.EVENT_DISCONNECT, args -> LOG.info("Disconnected from Socket.IO server")); socket.connect(); if (!connectLatch.await(10, TimeUnit.SECONDS)) { diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/lineage/LineageResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/lineage/LineageResourceTest.java index bcde3b19243..cd3c5ba8ab5 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/lineage/LineageResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/lineage/LineageResourceTest.java @@ -475,8 +475,7 @@ public class LineageResourceTest extends OpenMetadataApplicationTest { @Order(6) @Test - void get_dataQualityLineage(TestInfo test) - throws IOException, URISyntaxException, ParseException { + void get_dataQualityLineage(TestInfo test) throws IOException, ParseException { TestSuiteResourceTest testSuiteResourceTest = new TestSuiteResourceTest(); TestCaseResourceTest testCaseResourceTest = new TestCaseResourceTest(); TestDefinitionResourceTest testDefinitionResourceTest = new TestDefinitionResourceTest(); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/metrics/MetricResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/metrics/MetricResourceTest.java index 366582fc61d..655c69c2199 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/metrics/MetricResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/metrics/MetricResourceTest.java @@ -178,8 +178,7 @@ public class MetricResourceTest extends EntityResourceTest } @Override - public void assertFieldChange(String fieldName, Object expected, Object actual) - throws IOException { + public void assertFieldChange(String fieldName, Object expected, Object actual) { if (expected != null && actual != null) { switch (fieldName) { case "relatedMetrics" -> TestUtils.assertEntityReferences( diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/search/SearchResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/search/SearchResourceTest.java index fc1c72d2cae..3e6d33269e8 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/search/SearchResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/search/SearchResourceTest.java @@ -23,7 +23,6 @@ import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS; import jakarta.ws.rs.client.WebTarget; import jakarta.ws.rs.core.Response; import java.io.IOException; -import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -59,7 +58,7 @@ public class SearchResourceTest extends OpenMetadataApplicationTest { private TopicResourceTest topicResourceTest; @BeforeAll - public void setup(TestInfo test) throws IOException, URISyntaxException { + public void setup(TestInfo test) { tableResourceTest = new TableResourceTest(); topicResourceTest = new TopicResourceTest(); @@ -72,8 +71,7 @@ public class SearchResourceTest extends OpenMetadataApplicationTest { } @Test - public void testLongTableNameWithManyColumnsDoesNotCauseClauseExplosion() - throws IOException, InterruptedException { + public void testLongTableNameWithManyColumnsDoesNotCauseClauseExplosion() throws IOException { String longTableName = "int_snowplow_experiment_evaluation_detailed_analytics_processing"; List manyColumns = createManyTableColumns(); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/UserResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/UserResourceTest.java index fd1d3deb71a..5a41d887104 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/UserResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/UserResourceTest.java @@ -2145,7 +2145,7 @@ public class UserResourceTest extends EntityResourceTest { } @Test - void test_botActivityNotTracked() throws HttpResponseException, InterruptedException { + void test_botActivityNotTracked() throws HttpResponseException { // Test that bot activity is not tracked // We'll use a simple approach: update a bot user's activity time directly // and verify it doesn't show in online users (assuming the query filters out bots) diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/search/security/ElasticSearchRBACConditionEvaluatorTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/search/security/ElasticSearchRBACConditionEvaluatorTest.java index b4b51bb8292..96a280e67ab 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/search/security/ElasticSearchRBACConditionEvaluatorTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/search/security/ElasticSearchRBACConditionEvaluatorTest.java @@ -444,17 +444,10 @@ class ElasticSearchRBACConditionEvaluatorTest { count.incrementAndGet(); countBoolQueries(node.get("bool"), count); } else { - node.fields() - .forEachRemaining( - entry -> { - countBoolQueries(entry.getValue(), count); - }); + node.fields().forEachRemaining(entry -> countBoolQueries(entry.getValue(), count)); } } else if (node.isArray()) { - node.forEach( - element -> { - countBoolQueries(element, count); - }); + node.forEach(element -> countBoolQueries(element, count)); } } diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/security/MultiUrlJwkProviderTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/security/MultiUrlJwkProviderTest.java index ba1d84f3ff7..88ecac7ba79 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/security/MultiUrlJwkProviderTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/security/MultiUrlJwkProviderTest.java @@ -43,7 +43,7 @@ class MultiUrlJwkProviderTest { } @Test - void testLocalJwkProviderReturnsKeyForMatchingKid() throws Exception { + void testLocalJwkProviderReturnsKeyForMatchingKid() { // Setup mock JWTTokenGenerator JWKSKey jwksKey = mock(JWKSKey.class); when(jwksKey.getKid()).thenReturn(LOCAL_KID); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/util/JsonPatchUtilsTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/util/JsonPatchUtilsTest.java index fc4449fdd94..e892e6e8662 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/util/JsonPatchUtilsTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/util/JsonPatchUtilsTest.java @@ -5,12 +5,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.when; import static org.openmetadata.common.utils.CommonUtil.listOf; -import com.github.fge.jsonpatch.JsonPatchException; import jakarta.json.Json; import jakarta.json.JsonArray; import jakarta.json.JsonPatch; import jakarta.json.JsonReader; -import java.io.IOException; import java.io.StringReader; import java.util.Set; import java.util.UUID; @@ -87,7 +85,7 @@ class JsonPatchUtilsTest { } @Test - void testAddClassificationTag() throws JsonPatchException, IOException { + void testAddClassificationTag() { // Create a patch to add a new Classification tag String patchString = "[\n" @@ -118,7 +116,7 @@ class JsonPatchUtilsTest { } @Test - void testRemoveGlossaryTag() throws JsonPatchException, IOException { + void testRemoveGlossaryTag() { // Create a patch to remove the Glossary tag String patchString = "[\n" @@ -143,7 +141,7 @@ class JsonPatchUtilsTest { } @Test - void testAddClassificationAndRemoveGlossaryTag() throws IOException { + void testAddClassificationAndRemoveGlossaryTag() { // Create a patch to add a Classification tag and remove a Glossary tag String patchString = "[\n" @@ -179,7 +177,7 @@ class JsonPatchUtilsTest { } @Test - void testReplaceTierTag() throws JsonPatchException, IOException { + void testReplaceTierTag() { // Create a patch to replace the Tier tag String patchString = "[\n" @@ -205,7 +203,7 @@ class JsonPatchUtilsTest { } @Test - void testModifyNonTagField() throws JsonPatchException, IOException { + void testModifyNonTagField() { // Create a patch to modify a non-tag field (e.g., description) String patchString = "[\n" @@ -231,7 +229,7 @@ class JsonPatchUtilsTest { } @Test - void testAddClassificationTagAtColumn() throws Exception { + void testAddClassificationTagAtColumn() { // Create a patch to add a new Classification tag String patchString = "[\n" @@ -280,7 +278,7 @@ class JsonPatchUtilsTest { } @Test - void testAddCertificationTag() throws JsonPatchException, IOException { + void testAddCertificationTag() { // Create a patch to add a new Certification tag long currentTime = System.currentTimeMillis(); String patchString = getPatchString(currentTime, " \"op\": \"add\",\n"); @@ -300,7 +298,7 @@ class JsonPatchUtilsTest { } @Test - void testReplaceCertificationTag() throws JsonPatchException, IOException { + void testReplaceCertificationTag() { // Create a patch to replace the Certification tag long currentTime = System.currentTimeMillis(); String patchString = getPatchString(currentTime, " \"op\": \"replace\",\n"); @@ -320,7 +318,7 @@ class JsonPatchUtilsTest { } @Test - void testRemoveCertificationTag() throws JsonPatchException, IOException { + void testRemoveCertificationTag() { // Create a patch to remove the Certification tag String patchString = """