diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/ResourceRegistry.java b/openmetadata-service/src/main/java/org/openmetadata/service/ResourceRegistry.java index 86872657f2cd..86bf260b87e9 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/ResourceRegistry.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/ResourceRegistry.java @@ -65,13 +65,13 @@ public static void addResource( ResourceDescriptor resourceDescriptor = new ResourceDescriptor() .withName(resourceName) - .withOperations(getOperations(resourceName, entitySpecificOperations, new ArrayList<>(entityFields))); + .withOperations(getOperations(entitySpecificOperations, new ArrayList<>(entityFields))); RESOURCE_DESCRIPTORS.sort(Comparator.comparing(ResourceDescriptor::getName)); RESOURCE_DESCRIPTORS.add(resourceDescriptor); } private static List getOperations( - String resourceName, List entitySpecificOperations, List entityFields) { + List entitySpecificOperations, List entityFields) { Set operations = new TreeSet<>(COMMON_OPERATIONS); if (!nullOrEmpty(entitySpecificOperations)) { operations.addAll(entitySpecificOperations); 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 5ce5659c84d1..4c744a7e794d 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 @@ -197,11 +197,11 @@ public static AppRuntime getAppRuntime(App app) { return JsonUtils.convertValue(app.getRuntime(), ScheduledExecutionContext.class); } - protected IngestionPipeline getIngestionPipeline(CreateIngestionPipeline create, String botname, String user) { + protected IngestionPipeline getIngestionPipeline(CreateIngestionPipeline create, String botName, String user) { IngestionPipelineRepository ingestionPipelineRepository = (IngestionPipelineRepository) Entity.getEntityRepository(Entity.INGESTION_PIPELINE); OpenMetadataConnection openMetadataServerConnection = - new OpenMetadataConnectionBuilder(ingestionPipelineRepository.getOpenMetadataApplicationConfig(), botname) + new OpenMetadataConnectionBuilder(ingestionPipelineRepository.getOpenMetadataApplicationConfig(), botName) .build(); return ingestionPipelineRepository .copy(new IngestionPipeline(), create, user) @@ -224,8 +224,8 @@ protected AppRunRecord getJobRecord(JobExecutionContext jobExecutionContext) { } @SneakyThrows - protected void pushAppStausUpdates(JobExecutionContext jobExecutionContext, AppRunRecord record, boolean update) { + protected void pushAppStatusUpdates(JobExecutionContext jobExecutionContext, AppRunRecord appRecord, boolean update) { OmAppJobListener listener = getJobListener(jobExecutionContext); - listener.pushApplicationStatusUpdates(jobExecutionContext, record, update); + listener.pushApplicationStatusUpdates(jobExecutionContext, appRecord, update); } } 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 4280c34191b1..bd78b640ef85 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 @@ -151,7 +151,7 @@ public void updateRecordToDb(JobExecutionContext jobExecutionContext) { appRecord.setSuccessContext(new SuccessContext().withAdditionalProperty("stats", jobData.getStats())); } - pushAppStausUpdates(jobExecutionContext, appRecord, true); + pushAppStatusUpdates(jobExecutionContext, appRecord, true); } private void entitiesReIndex() { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/apps/scheduler/AbstractOmAppJobListener.java b/openmetadata-service/src/main/java/org/openmetadata/service/apps/scheduler/AbstractOmAppJobListener.java index e89b765ab17a..d96bfd7a621f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/apps/scheduler/AbstractOmAppJobListener.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/apps/scheduler/AbstractOmAppJobListener.java @@ -109,13 +109,13 @@ public void pushApplicationStatusUpdates(JobExecutionContext context, AppRunReco } } - private void updateStatus(UUID appId, AppRunRecord record, boolean update) { + private void updateStatus(UUID appId, AppRunRecord appRunRecord, boolean update) { if (update) { collectionDAO .appExtensionTimeSeriesDao() - .update(appId.toString(), JsonUtils.pojoToJson(record), record.getTimestamp()); + .update(appId.toString(), JsonUtils.pojoToJson(appRunRecord), appRunRecord.getTimestamp()); } else { - collectionDAO.appExtensionTimeSeriesDao().insert(JsonUtils.pojoToJson(record)); + collectionDAO.appExtensionTimeSeriesDao().insert(JsonUtils.pojoToJson(appRunRecord)); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsCountAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsCountAggregator.java index 6ed6bb87127f..64e7d584df67 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsCountAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsCountAggregator.java @@ -9,7 +9,7 @@ public abstract class AggregatedUnusedAssetsCountAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public AggregatedUnusedAssetsCountAggregator(A aggregations) { + protected AggregatedUnusedAssetsCountAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsSizeAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsSizeAggregator.java index 43dcd0ea1888..cd0bfcd4658e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsSizeAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUnusedAssetsSizeAggregator.java @@ -9,7 +9,7 @@ public abstract class AggregatedUnusedAssetsSizeAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public AggregatedUnusedAssetsSizeAggregator(A aggregations) { + protected AggregatedUnusedAssetsSizeAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsCountAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsCountAggregator.java index 55da7c43ff35..903fc223a408 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsCountAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsCountAggregator.java @@ -10,7 +10,7 @@ public abstract class AggregatedUsedvsUnusedAssetsCountAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public AggregatedUsedvsUnusedAssetsCountAggregator(A aggregations) { + protected AggregatedUsedvsUnusedAssetsCountAggregator(A aggregations) { this.aggregations = aggregations; } @@ -26,8 +26,8 @@ public List aggregate() throws ParseException { Double used = Objects.requireNonNullElse(getValue(totalUsed), 0.0); Double unused = Objects.requireNonNullElse(getValue(totalUnused), 0.0); Double total = used + unused; - Double usedPercentage = 0.0; - Double unusedPercentage = 0.0; + double usedPercentage = 0.0; + double unusedPercentage = 0.0; if (total != 0.0) { usedPercentage = used / total; unusedPercentage = unused / total; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsSizeAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsSizeAggregator.java index c308befe3d39..8fb0059897ec 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsSizeAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/AggregatedUsedvsUnusedAssetsSizeAggregator.java @@ -9,7 +9,7 @@ public abstract class AggregatedUsedvsUnusedAssetsSizeAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public AggregatedUsedvsUnusedAssetsSizeAggregator(A aggregations) { + protected AggregatedUsedvsUnusedAssetsSizeAggregator(A aggregations) { this.aggregations = aggregations; } @@ -25,8 +25,8 @@ public List aggregate() throws ParseException { Double used = Objects.requireNonNullElse(getValue(totalUsed), 0.0); Double unused = Objects.requireNonNullElse(getValue(totalUnused), 0.0); Double total = used + unused; - Double usedPercentage = 0.0; - Double unusedPercentage = 0.0; + double usedPercentage = 0.0; + double unusedPercentage = 0.0; if (total != 0.0) { usedPercentage = used / total; unusedPercentage = unused / total; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesDescriptionAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesDescriptionAggregator.java index d830ba17284f..9c439e8eefc1 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesDescriptionAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesDescriptionAggregator.java @@ -8,7 +8,7 @@ public abstract class EntitiesDescriptionAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public EntitiesDescriptionAggregator(A aggregations) { + protected EntitiesDescriptionAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesOwnerAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesOwnerAggregator.java index b7f135f0b67b..43160b3ca4fd 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesOwnerAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/EntitiesOwnerAggregator.java @@ -8,7 +8,7 @@ public abstract class EntitiesOwnerAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public EntitiesOwnerAggregator(A aggregations) { + protected EntitiesOwnerAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostActiveUsersAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostActiveUsersAggregator.java index f4e09c3822d1..6777ca85d13f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostActiveUsersAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostActiveUsersAggregator.java @@ -7,7 +7,7 @@ public abstract class MostActiveUsersAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public MostActiveUsersAggregator(A aggregations) { + protected MostActiveUsersAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostViewedEntitiesAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostViewedEntitiesAggregator.java index 3a64f31f4632..8027b47a293e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostViewedEntitiesAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/MostViewedEntitiesAggregator.java @@ -7,7 +7,7 @@ public abstract class MostViewedEntitiesAggregator implements DataInsightAggregatorInterface { protected final A aggregations; - public MostViewedEntitiesAggregator(A aggregations) { + protected MostViewedEntitiesAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesDescriptionAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesDescriptionAggregator.java index 705bafd48274..22271271646d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesDescriptionAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesDescriptionAggregator.java @@ -8,7 +8,7 @@ public abstract class ServicesDescriptionAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public ServicesDescriptionAggregator(A aggregations) { + protected ServicesDescriptionAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesOwnerAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesOwnerAggregator.java index 71e92e15bedb..14f7df6fa520 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesOwnerAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/ServicesOwnerAggregator.java @@ -8,7 +8,7 @@ public abstract class ServicesOwnerAggregator implements DataInsightAggregatorInterface { protected final A aggregations; - public ServicesOwnerAggregator(A aggregations) { + protected ServicesOwnerAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesAggregator.java index e458401ea0ec..d7d7d121f180 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesAggregator.java @@ -8,7 +8,7 @@ public abstract class TotalEntitiesAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public TotalEntitiesAggregator(A aggregations) { + protected TotalEntitiesAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesByTierAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesByTierAggregator.java index 0ce0327dfcd3..3aa52e8e8180 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesByTierAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/TotalEntitiesByTierAggregator.java @@ -8,7 +8,7 @@ public abstract class TotalEntitiesByTierAggregator implements DataInsightAggregatorInterface { private final A aggregations; - public TotalEntitiesByTierAggregator(A aggregations) { + protected TotalEntitiesByTierAggregator(A aggregations) { this.aggregations = aggregations; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/UnusedAssetsAggregator.java b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/UnusedAssetsAggregator.java index 8734611a3367..4170c2542d75 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/UnusedAssetsAggregator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/dataInsight/UnusedAssetsAggregator.java @@ -14,7 +14,7 @@ public abstract class UnusedAssetsAggregator, S, T> implements DataInsightAggregatorInterface { private final H hits; - public UnusedAssetsAggregator(H hits) { + protected UnusedAssetsAggregator(H hits) { this.hits = hits; } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/PipelineServiceStatusJobHandler.java b/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/PipelineServiceStatusJobHandler.java index 8385d15b3c6e..f1b3eabf1880 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/PipelineServiceStatusJobHandler.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/events/scheduled/PipelineServiceStatusJobHandler.java @@ -33,7 +33,7 @@ public class PipelineServiceStatusJobHandler { private final Integer healthCheckInterval; private final Scheduler scheduler = new StdSchedulerFactory().getScheduler(); - private static PipelineServiceStatusJobHandler INSTANCE; + private static PipelineServiceStatusJobHandler instance; private PipelineServiceStatusJobHandler(PipelineServiceClientConfiguration config, String clusterName) throws SchedulerException { @@ -46,15 +46,14 @@ private PipelineServiceStatusJobHandler(PipelineServiceClientConfiguration confi } public static PipelineServiceStatusJobHandler create(PipelineServiceClientConfiguration config, String clusterName) { - if (INSTANCE != null) return INSTANCE; + if (instance != null) return instance; try { - INSTANCE = new PipelineServiceStatusJobHandler(config, clusterName); + instance = new PipelineServiceStatusJobHandler(config, clusterName); } catch (Exception ex) { LOG.error("Failed to initialize the Pipeline Service Status Handler"); } - - return INSTANCE; + return instance; } private JobDetail jobBuilder() { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertUtil.java index e1faf1c191cf..908dfb4485a8 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/events/subscription/AlertUtil.java @@ -98,14 +98,14 @@ public static void validateSubscriptionConfig(EventSubscription eventSubscriptio } } - public static T validateExpression(String condition, Class clz) { + public static void validateExpression(String condition, Class clz) { if (condition == null) { - return null; + return; } Expression expression = parseExpression(condition); AlertsRuleEvaluator ruleEvaluator = new AlertsRuleEvaluator(null); try { - return expression.getValue(ruleEvaluator, clz); + expression.getValue(ruleEvaluator, clz); } catch (Exception exception) { // Remove unnecessary class details in the exception message String message = exception.getMessage().replaceAll("on type .*$", "").replaceAll("on object .*$", ""); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/exception/AlertRetriableException.java b/openmetadata-service/src/main/java/org/openmetadata/service/exception/AlertRetriableException.java deleted file mode 100644 index ce64ceb1e9b9..000000000000 --- a/openmetadata-service/src/main/java/org/openmetadata/service/exception/AlertRetriableException.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.openmetadata.service.exception; - -import org.openmetadata.service.events.errors.RetriableException; - -public class AlertRetriableException extends RetriableException { - private static final long serialVersionUID = 1L; - - public AlertRetriableException(String message) { - super(message); - } - - public AlertRetriableException(Throwable cause) { - super(cause); - } -} diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/AppRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/AppRepository.java index 94b6b0fe6c7a..37592acbaab9 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/AppRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/AppRepository.java @@ -29,7 +29,7 @@ @Slf4j public class AppRepository extends EntityRepository { - public static String APP_BOT_ROLE = "ApplicationBotRole"; + public static final String APP_BOT_ROLE = "ApplicationBotRole"; public static final String UPDATE_FIELDS = "appConfiguration,appSchedule"; @@ -199,8 +199,7 @@ public ResultList listAppRuns(UUID appId, int limitParam, int offs protected void cleanup(App app) { // Remove the Pipelines for Application List pipelineRef = getIngestionPipelines(app); - pipelineRef.forEach( - (reference) -> Entity.deleteEntity("admin", reference.getType(), reference.getId(), true, true)); + pipelineRef.forEach(reference -> Entity.deleteEntity("admin", reference.getType(), reference.getId(), true, true)); super.cleanup(app); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java index 35cb3d946894..f741098c6d85 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java @@ -1853,7 +1853,7 @@ public class EntityUpdater { protected T previous; protected T original; protected T updated; - protected Operation operation; + protected final Operation operation; protected ChangeDescription changeDescription = null; protected boolean majorVersionChange = false; protected final User updatingUser; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java index 87e2b66629dd..2e2b2e1a69cb 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/GlossaryTermRepository.java @@ -244,6 +244,7 @@ protected void postDelete(GlossaryTerm entity) { daoCollection.tagUsageDAO().deleteTagLabels(TagSource.GLOSSARY.ordinal(), entity.getFullyQualifiedName()); } + @Override public TaskWorkflow getTaskWorkflow(ThreadContext threadContext) { validateTaskThread(threadContext); TaskType taskType = threadContext.getThread().getTask().getType(); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java index 59c0e7873b61..c625693b1a6a 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java @@ -187,12 +187,12 @@ private String getTestSuiteTypeCondition() { switch (testSuiteType) { case ("executable"): - if (DatasourceConfig.getInstance().isMySQL()) { + if (Boolean.TRUE.equals(DatasourceConfig.getInstance().isMySQL())) { return "(JSON_UNQUOTE(JSON_EXTRACT(json, '$.executable')) = 'true')"; } return "(json->>'executable' = 'true')"; case ("logical"): - if (DatasourceConfig.getInstance().isMySQL()) { + if (Boolean.TRUE.equals(DatasourceConfig.getInstance().isMySQL())) { return "(JSON_UNQUOTE(JSON_EXTRACT(json, '$.executable')) = 'false' OR JSON_UNQUOTE(JSON_EXTRACT(json, '$.executable')) IS NULL)"; } return "(json->>'executable' = 'false' or json -> 'executable' is null)"; @@ -218,7 +218,7 @@ private String getWebhookTypePrefixCondition(String tableName, String typePrefix private String getPipelineTypePrefixCondition(String tableName, String pipelineType) { pipelineType = escape(pipelineType); String inCondition = getInConditionFromString(pipelineType); - if (DatasourceConfig.getInstance().isMySQL()) { + if (Boolean.TRUE.equals(DatasourceConfig.getInstance().isMySQL())) { return tableName == null ? String.format( "JSON_UNQUOTE(JSON_EXTRACT(ingestion_pipeline_entity.json, '$.pipelineType')) IN (%s)", inCondition) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/QueryRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/QueryRepository.java index d513af4c5809..ab4d2c8b5bc6 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/QueryRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/QueryRepository.java @@ -128,7 +128,7 @@ private void storeQueryUsedIn( } } - public RestUtil.PutResponse AddQueryUser( + public RestUtil.PutResponse addQueryUser( UriInfo uriInfo, String updatedBy, UUID queryId, List userFqnList) { Query query = Entity.getEntity(Entity.QUERY, queryId, QUERY_USERS_FIELD, Include.NON_DELETED); List oldValue = query.getUsers(); @@ -146,7 +146,7 @@ public RestUtil.PutResponse AddQueryUser( return new RestUtil.PutResponse<>(Response.Status.CREATED, changeEvent, RestUtil.ENTITY_FIELDS_CHANGED); } - public RestUtil.PutResponse AddQueryUsedBy( + public RestUtil.PutResponse addQueryUsedBy( UriInfo uriInfo, String updatedBy, UUID queryId, List userList) { Query query = Entity.getEntity(Entity.QUERY, queryId, QUERY_UPDATE_FIELDS, Include.NON_DELETED); Query oldQuery = JsonUtils.readValue(JsonUtils.pojoToJson(query), Query.class); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ReportDataRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ReportDataRepository.java index 807ecb5cc19a..e13c2953178d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ReportDataRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ReportDataRepository.java @@ -5,7 +5,6 @@ import org.openmetadata.schema.analytics.ReportData; import org.openmetadata.schema.analytics.ReportData.ReportDataType; import org.openmetadata.service.Entity; -import org.openmetadata.service.search.SearchRepository; import org.openmetadata.service.util.JsonUtils; import org.openmetadata.service.util.ResultList; @@ -13,15 +12,12 @@ public class ReportDataRepository extends EntityTimeSeriesRepository public static final String COLLECTION_PATH = "/v1/analytics/report"; public static final String REPORT_DATA_EXTENSION = "reportData.reportDataResult"; - private final SearchRepository searchRepository; - public ReportDataRepository() { super( COLLECTION_PATH, Entity.getCollectionDAO().reportDataTimeSeriesDao(), ReportData.class, Entity.ENTITY_REPORT_DATA); - searchRepository = Entity.getSearchRepository(); } public ResultList getReportData(ReportDataType reportDataType, Long startTs, Long endTs) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java index 35e13c865e14..f7ae625ea51c 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestCaseRepository.java @@ -472,8 +472,8 @@ public RestUtil.DeleteResponse deleteTestCaseFromLogicalTestSuite(UUID return new RestUtil.DeleteResponse<>(testCase, RestUtil.ENTITY_DELETED); } - @Transaction /** Remove test case from test suite summary and update test suite */ + @Transaction private void removeTestCaseFromTestSuiteResultSummary(UUID testSuiteId, String testCaseFqn) { TestSuite testSuite = Entity.getEntity(TEST_SUITE, testSuiteId, "*", Include.ALL, false); testSuite.setSummary(null); // we don't want to store the summary in the database diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestSuiteRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestSuiteRepository.java index b7e0eae832d1..d954d5d6e401 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestSuiteRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestSuiteRepository.java @@ -14,7 +14,6 @@ import org.jdbi.v3.sqlobject.transaction.Transaction; import org.openmetadata.schema.entity.data.Table; import org.openmetadata.schema.tests.ResultSummary; -import org.openmetadata.schema.tests.TestCase; import org.openmetadata.schema.tests.TestSuite; import org.openmetadata.schema.tests.type.TestCaseStatus; import org.openmetadata.schema.tests.type.TestSummary; @@ -88,13 +87,6 @@ private HashMap getResultSummary(TestSuite testSuite) { return testCaseSummary; } - private ResultSummary getResultSummary(TestCase testCase, Long timestamp, TestCaseStatus testCaseStatus) { - return new ResultSummary() - .withTestCaseName(testCase.getFullyQualifiedName()) - .withStatus(testCaseStatus) - .withTimestamp(timestamp); - } - private TestSummary getTestCasesExecutionSummary(TestSuite entity) { if (entity.getTestCaseResultSummary().isEmpty()) return new TestSummary(); HashMap testSummary = getResultSummary(entity); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TopicRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TopicRepository.java index 2445e9bdecc6..5bac3a01beca 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TopicRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TopicRepository.java @@ -178,19 +178,6 @@ private void setFieldFQN(String parentFQN, List fields) { }); } - private void addDerivedFieldTags(List fields) { - if (nullOrEmpty(fields)) { - return; - } - - for (Field field : fields) { - field.setTags(addDerivedTags(field.getTags())); - if (field.getChildren() != null) { - addDerivedFieldTags(field.getChildren()); - } - } - } - List cloneWithoutTags(List fields) { if (nullOrEmpty(fields)) { return fields; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/api/MigrationProcessImpl.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/api/MigrationProcessImpl.java index 86b2528f3f52..c3e021a0afa9 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/api/MigrationProcessImpl.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/api/MigrationProcessImpl.java @@ -14,7 +14,6 @@ @Slf4j public class MigrationProcessImpl implements MigrationProcess { - private CollectionDAO collectionDAO; private MigrationDAO migrationDAO; private Handle handle; private final MigrationFile migrationFile; @@ -28,7 +27,7 @@ public MigrationProcessImpl(MigrationFile migrationFile) { @Override public void initialize(Handle handle) { this.handle = handle; - this.collectionDAO = handle.attach(CollectionDAO.class); + handle.attach(CollectionDAO.class); this.migrationDAO = handle.attach(MigrationDAO.class); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/context/MigrationContext.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/context/MigrationContext.java index ab898421f00a..7d953f515495 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/context/MigrationContext.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/context/MigrationContext.java @@ -33,6 +33,6 @@ public void compute() { } public void show() { - LOG.info(String.format("Version [%s] context is [%s]", version, results.toString())); + LOG.info(String.format("Version [%s] context is [%s]", version, results)); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/mysql/v117/Migration.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/mysql/v117/Migration.java index fd563fd6c0ed..7b04945e4e9e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/mysql/v117/Migration.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/mysql/v117/Migration.java @@ -27,7 +27,7 @@ public void initialize(Handle handle) { @Override @SneakyThrows public void runDataMigration() { - // tests cases coming from dbt for case-sensitive services are not properly linked to a table + // testcases coming from dbt for case-sensitive services are not properly linked to a table fixTestCases(handle, collectionDAO); // Try again the 1.1.6 test suite migration fixTestSuites(collectionDAO); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/MigrationFile.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/MigrationFile.java index 1052452680ee..41ff25ac68d4 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/MigrationFile.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/MigrationFile.java @@ -27,7 +27,8 @@ public class MigrationFile implements Comparable { private final MigrationDAO migrationDAO; private final List schemaChanges; private final List postDDLScripts; - public final String DEFAULT_MIGRATION_PROCESS_CLASS = "org.openmetadata.service.migration.api.MigrationProcessImpl"; + public static final String DEFAULT_MIGRATION_PROCESS_CLASS = + "org.openmetadata.service.migration.api.MigrationProcessImpl"; public MigrationFile(File dir, MigrationDAO migrationDAO, ConnectionType connectionType) { this.dir = dir; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V114/MigrationUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V114/MigrationUtil.java index 863f4b818977..81cbd04188c3 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V114/MigrationUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V114/MigrationUtil.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import lombok.extern.slf4j.Slf4j; import org.openmetadata.schema.api.tests.CreateTestSuite; @@ -33,11 +34,11 @@ private MigrationUtil() { * Step 1: re-run the fix for FQN to catch any issues from previous release where we were quoting the FQN Step 2: * Group all the testCases with the table. We will create a Map with Table FQN as the key and all the test cases * belonging to that Table Step 3: Iterate through the Map keySet, which is table names. For each table name we create - * a executable test suite FQN Step 4: Fetch executable testSuite using step 3 FQN Step 5: Iterate through the test + * an executable test suite FQN Step 4: Fetch executable testSuite using step 3 FQN Step 5: Iterate through the test * case list associated with the current table FQN in the loop Step 6: for each test case fetch TestSuite * relationships Step 7: Iterate through the testSuite relation to check if the executableTestSuite FQN matches. If it - * matches there exists a relation from testCase to a executable Test suite Step 8: If we can't find a match, create a - * relationship. + * matches there exists a relation from testCase to an executable Test suite Step 8: If we can't find a match, create + * a relationship. */ public static void fixTestSuites(CollectionDAO collectionDAO) { // Fix any FQN issues for executable TestSuite @@ -58,9 +59,10 @@ public static void fixTestSuites(CollectionDAO collectionDAO) { // Let's iterate through the test cases and make sure there exists a relationship between testcases and its native // TestSuite Map> testCasesGroupByTable = groupTestCasesByTable(); - for (String tableFQN : testCasesGroupByTable.keySet()) { + for (Entry> entry : testCasesGroupByTable.entrySet()) { + String tableFQN = entry.getKey(); try { - List testCases = testCasesGroupByTable.get(tableFQN); + List testCases = entry.getValue(); String executableTestSuiteFQN = tableFQN + ".testSuite"; TestSuite executableTestSuite = getOrCreateExecutableTestSuite(collectionDAO, testCases, testSuiteRepository, executableTestSuiteFQN); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V117/MigrationUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V117/MigrationUtil.java index a49c5f0482c9..5c33d66001b7 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V117/MigrationUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/V117/MigrationUtil.java @@ -33,34 +33,29 @@ public static void fixTestCases(Handle handle, CollectionDAO collectionDAO) { List testCases = testCaseRepository.listAll(new EntityUtil.Fields(Set.of("id")), new ListFilter(Include.ALL)); - try { - List fqnList; - if (Boolean.TRUE.equals(DatasourceConfig.getInstance().isMySQL())) { - fqnList = handle.createQuery(MYSQL_LIST_TABLE_FQNS).mapTo(String.class).list(); - } else { - fqnList = handle.createQuery(POSTGRES_LIST_TABLE_FQNS).mapTo(String.class).list(); - } - Map tableMap = new HashMap<>(); - for (String fqn : fqnList) { - tableMap.put(fqn.toLowerCase(), fqn); - } + List fqnList; + if (Boolean.TRUE.equals(DatasourceConfig.getInstance().isMySQL())) { + fqnList = handle.createQuery(MYSQL_LIST_TABLE_FQNS).mapTo(String.class).list(); + } else { + fqnList = handle.createQuery(POSTGRES_LIST_TABLE_FQNS).mapTo(String.class).list(); + } + Map tableMap = new HashMap<>(); + for (String fqn : fqnList) { + tableMap.put(fqn.toLowerCase(), fqn); + } - for (TestCase testCase : testCases) { - // Create New Executable Test Suites - MessageParser.EntityLink entityLink = MessageParser.EntityLink.parse(testCase.getEntityLink()); - String fqn = entityLink.getEntityFQN(); - Table table = JsonUtils.readValue(tableRepository.getDao().findJsonByFqn(fqn, Include.ALL), Table.class); - if (table == null) { - String findTableFQN = tableMap.get(fqn.toLowerCase()); - MessageParser.EntityLink newEntityLink = - new MessageParser.EntityLink(entityLink.getEntityType(), findTableFQN); - testCase.setEntityLink(newEntityLink.getLinkString()); - testCase.setEntityFQN(findTableFQN); - collectionDAO.testCaseDAO().update(testCase); - } + for (TestCase testCase : testCases) { + // Create New Executable Test Suites + MessageParser.EntityLink entityLink = MessageParser.EntityLink.parse(testCase.getEntityLink()); + String fqn = entityLink.getEntityFQN(); + Table table = JsonUtils.readValue(tableRepository.getDao().findJsonByFqn(fqn, Include.ALL), Table.class); + if (table == null) { + String findTableFQN = tableMap.get(fqn.toLowerCase()); + MessageParser.EntityLink newEntityLink = new MessageParser.EntityLink(entityLink.getEntityType(), findTableFQN); + testCase.setEntityLink(newEntityLink.getLinkString()); + testCase.setEntityFQN(findTableFQN); + collectionDAO.testCaseDAO().update(testCase); } - } catch (Exception exc) { - throw exc; } } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v110/MigrationUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v110/MigrationUtil.java index 6605c012b99b..14bd0b580bc7 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v110/MigrationUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v110/MigrationUtil.java @@ -7,6 +7,7 @@ import static org.openmetadata.service.util.EntityUtil.hash; import java.util.*; +import java.util.Map.Entry; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.tuple.Pair; @@ -163,8 +164,8 @@ public static void readAndProcessEntity( String nameHashColumn) { LOG.debug("Starting Migration for table : {}", dao.getTableName()); if (dao instanceof CollectionDAO.TestSuiteDAO) { - // We have to do this since this column in changed in the dao in latest version after this , and this will fail - // the migrations here + // We have to do this since this column in changed in the dao in the latest version after this , and this will + // fail the migrations here nameHashColumn = "nameHash"; } while (true) { @@ -470,9 +471,10 @@ public static void testSuitesMigration(CollectionDAO collectionDAO) { // create native test suites TestSuiteRepository testSuiteRepository = (TestSuiteRepository) Entity.getEntityRepository(TEST_SUITE); Map> testCasesByTable = groupTestCasesByTable(); - for (String tableFQN : testCasesByTable.keySet()) { + for (Entry> entry : testCasesByTable.entrySet()) { + String tableFQN = entry.getKey(); String nativeTestSuiteFqn = tableFQN + ".testSuite"; - List testCases = testCasesByTable.get(tableFQN); + List testCases = entry.getValue(); if (testCases != null && !testCases.isEmpty()) { MessageParser.EntityLink entityLink = MessageParser.EntityLink.parse(testCases.stream().findFirst().get().getEntityLink()); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v120/MigrationUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v120/MigrationUtil.java index 64685c61993f..03010997b09d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v120/MigrationUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v120/MigrationUtil.java @@ -120,8 +120,8 @@ public static void addQueryService(Handle handle, CollectionDAO collectionDAO) { } /** - * Before Release 1.2, Glossary and all of the Glossary terms , even the deeply nested glossary terms have contains - * relation with Glossary and also its parent GlossaryTerm. This causes delete issue as we recursively delete the + * Before Release 1.2, Glossary and all the Glossary terms , even the deeply nested glossary terms have contains + * relation with Glossary and also its parent GlossaryTerm. These causes delete issue as we recursively delete the * GlossaryTerms When Glossary gets deleted. We have updated the Glossary -> nested GlossaryTerm to be "Has". This * migration does following update 1. List all GlossaryTerms, update the status to Accepted , since we introduced the * Glossary Approval Workflow 2. For each term we look at who is the parent is, There should be only one parent in diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java index 159aeca2c94f..72a41ec2d3cb 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/apps/AppResource.java @@ -758,7 +758,7 @@ public Response deployApplicationFlow( } private void decryptOrNullify( - SecurityContext securityContext, IngestionPipeline ingestionPipeline, String botname, boolean forceNotMask) { + SecurityContext securityContext, IngestionPipeline ingestionPipeline, String botName, boolean forceNotMask) { SecretsManager secretsManager = SecretsManagerFactory.getSecretsManager(); try { authorizer.authorize( @@ -770,7 +770,7 @@ private void decryptOrNullify( } secretsManager.decryptIngestionPipeline(ingestionPipeline); OpenMetadataConnection openMetadataServerConnection = - new OpenMetadataConnectionBuilder(openMetadataApplicationConfig, botname).build(); + new OpenMetadataConnectionBuilder(openMetadataApplicationConfig, botName).build(); ingestionPipeline.setOpenMetadataServerConnection( secretsManager.encryptOpenMetadataConnection(openMetadataServerConnection, false)); if (authorizer.shouldMaskPasswords(securityContext) && !forceNotMask) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/charts/ChartResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/charts/ChartResource.java index 5ffae063a1ff..74f020609c36 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/charts/ChartResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/charts/ChartResource.java @@ -430,7 +430,6 @@ private Chart getChart(CreateChart create, String user) { .copy(new Chart(), create, user) .withService(EntityUtil.getEntityReference(Entity.DASHBOARD_SERVICE, create.getService())) .withChartType(create.getChartType()) - .withSourceUrl(create.getSourceUrl()) - .withTags(create.getTags()); + .withSourceUrl(create.getSourceUrl()); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dashboards/DashboardResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dashboards/DashboardResource.java index dfedc791afb3..994dfd29d53c 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dashboards/DashboardResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dashboards/DashboardResource.java @@ -444,7 +444,6 @@ private Dashboard getDashboard(CreateDashboard create, String user) { .withDataModels(getEntityReferences(Entity.DASHBOARD_DATA_MODEL, create.getDataModels())) .withSourceUrl(create.getSourceUrl()) .withDashboardType(create.getDashboardType()) - .withProject(create.getProject()) - .withTags(create.getTags()); + .withProject(create.getProject()); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseSchemaResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseSchemaResource.java index 52d2f7d47e22..ff47391af2be 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseSchemaResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/DatabaseSchemaResource.java @@ -476,7 +476,6 @@ private DatabaseSchema getDatabaseSchema(CreateDatabaseSchema create, String use return repository .copy(new DatabaseSchema(), create, user) .withDatabase(getEntityReference(Entity.DATABASE, create.getDatabase())) - .withTags(create.getTags()) .withSourceUrl(create.getSourceUrl()) .withRetentionPeriod(create.getRetentionPeriod()); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/StoredProcedureResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/StoredProcedureResource.java index 8e1afd486582..78339150c976 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/StoredProcedureResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/StoredProcedureResource.java @@ -417,7 +417,6 @@ private StoredProcedure getStoredProcedure(CreateStoredProcedure create, String return repository .copy(new StoredProcedure(), create, user) .withDatabaseSchema(getEntityReference(Entity.DATABASE_SCHEMA, create.getDatabaseSchema())) - .withTags(create.getTags()) .withStoredProcedureCode(create.getStoredProcedureCode()) .withSourceUrl(create.getSourceUrl()); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java index 2226d4065fd8..8129c5b3ecbd 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java @@ -968,7 +968,6 @@ private Table getTable(CreateTable create, String user) { .withTableConstraints(create.getTableConstraints()) .withTablePartition(create.getTablePartition()) .withTableType(create.getTableType()) - .withTags(create.getTags()) .withFileFormat(create.getFileFormat()) .withViewDefinition(create.getViewDefinition()) .withTableProfilerConfig(create.getTableProfilerConfig()) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/datamodels/DashboardDataModelResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/datamodels/DashboardDataModelResource.java index a86b798fa8de..2d14cccbd3cc 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/datamodels/DashboardDataModelResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/datamodels/DashboardDataModelResource.java @@ -447,7 +447,6 @@ private DashboardDataModel getDataModel(CreateDashboardDataModel create, String .withDataModelType(create.getDataModelType()) .withServiceType(create.getServiceType()) .withColumns(create.getColumns()) - .withProject(create.getProject()) - .withTags(create.getTags()); + .withProject(create.getProject()); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryResource.java index f40085ac4c04..cec3ff14f59d 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryResource.java @@ -456,7 +456,6 @@ public static Glossary getGlossary(GlossaryRepository repository, CreateGlossary return repository .copy(new Glossary(), create, updatedBy) .withReviewers(getEntityReferences(Entity.USER, create.getReviewers())) - .withTags(create.getTags()) .withProvider(create.getProvider()) .withMutuallyExclusive(create.getMutuallyExclusive()); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryTermResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryTermResource.java index c757a42aa329..13e3a23da4de 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryTermResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/GlossaryTermResource.java @@ -491,7 +491,6 @@ private GlossaryTerm getGlossaryTerm(CreateGlossaryTerm create, String user) { .withRelatedTerms(getEntityReferences(Entity.GLOSSARY_TERM, create.getRelatedTerms())) .withReferences(create.getReferences()) .withReviewers(getEntityReferences(Entity.USER, create.getReviewers())) - .withTags(create.getTags()) .withProvider(create.getProvider()) .withMutuallyExclusive(create.getMutuallyExclusive()); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/mlmodels/MlModelResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/mlmodels/MlModelResource.java index 3267ed9f2316..ca702265ce76 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/mlmodels/MlModelResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/mlmodels/MlModelResource.java @@ -450,7 +450,6 @@ private MlModel getMlModel(CreateMlModel create, String user) { .withMlStore(create.getMlStore()) .withServer(create.getServer()) .withTarget(create.getTarget()) - .withSourceUrl(create.getSourceUrl()) - .withTags(create.getTags()); + .withSourceUrl(create.getSourceUrl()); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/pipelines/PipelineResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/pipelines/PipelineResource.java index 4201e374d61f..4217ed7835bd 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/pipelines/PipelineResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/pipelines/PipelineResource.java @@ -547,7 +547,6 @@ private Pipeline getPipeline(CreatePipeline create, String user) { .withService(getEntityReference(Entity.PIPELINE_SERVICE, create.getService())) .withTasks(create.getTasks()) .withSourceUrl(create.getSourceUrl()) - .withTags(create.getTags()) .withConcurrency(create.getConcurrency()) .withStartDate(create.getStartDate()) .withPipelineLocation(create.getPipelineLocation()) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/query/QueryResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/query/QueryResource.java index 108c21ed5285..5869f6a132a4 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/query/QueryResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/query/QueryResource.java @@ -405,7 +405,7 @@ public Response addQueryUsers( @Valid List userFqnList) { OperationContext operationContext = new OperationContext(entityType, MetadataOperation.EDIT_ALL); authorizer.authorize(securityContext, operationContext, getResourceContextById(id)); - return repository.AddQueryUser(uriInfo, securityContext.getUserPrincipal().getName(), id, userFqnList).toResponse(); + return repository.addQueryUser(uriInfo, securityContext.getUserPrincipal().getName(), id, userFqnList).toResponse(); } @PUT @@ -427,7 +427,8 @@ public Response addQueryUsedBy( @Valid List usedByList) { OperationContext operationContext = new OperationContext(entityType, MetadataOperation.EDIT_ALL); authorizer.authorize(securityContext, operationContext, getResourceContextById(id)); - return repository.AddQueryUsedBy(uriInfo, securityContext.getUserPrincipal().getName(), id, usedByList) + return repository + .addQueryUsedBy(uriInfo, securityContext.getUserPrincipal().getName(), id, usedByList) .toResponse(); } @@ -511,7 +512,6 @@ public Response delete( private Query getQuery(CreateQuery create, String user) { return repository .copy(new Query(), create, user) - .withTags(create.getTags()) .withQuery(create.getQuery()) .withService(getEntityReference(Entity.DATABASE_SERVICE, create.getService())) .withDuration(create.getDuration()) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/searchindex/SearchIndexResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/searchindex/SearchIndexResource.java index 10f4c961406f..480ea39bbfc2 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/searchindex/SearchIndexResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/searchindex/SearchIndexResource.java @@ -494,7 +494,6 @@ private SearchIndex getSearchIndex(CreateSearchIndex create, String user) { .copy(new SearchIndex(), create, user) .withService(getEntityReference(Entity.SEARCH_SERVICE, create.getService())) .withFields(create.getFields()) - .withSearchIndexSettings(create.getSearchIndexSettings()) - .withTags(create.getTags()); + .withSearchIndexSettings(create.getSearchIndexSettings()); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/storages/ContainerResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/storages/ContainerResource.java index 7308e6df5fec..f52e1c1d0e53 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/storages/ContainerResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/storages/ContainerResource.java @@ -449,7 +449,6 @@ private Container getContainer(CreateContainer create, String user) { .withNumberOfObjects(create.getNumberOfObjects()) .withSize(create.getSize()) .withFileFormats(create.getFileFormats()) - .withSourceUrl(create.getSourceUrl()) - .withTags(create.getTags()); + .withSourceUrl(create.getSourceUrl()); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/TagResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/TagResource.java index 9965061c8c08..f711b6fff0e2 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/TagResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/tags/TagResource.java @@ -107,7 +107,7 @@ protected List getEntitySpecificOperations() { private void migrateTags() { // Just want to run it when upgrading to version above 0.13.1 where tag relationship are not there , once we have // any entries we don't need to run it - if (!(repository.getDaoCollection().relationshipDAO().findIfAnyRelationExist(CLASSIFICATION, TAG) > 0)) { + if (repository.getDaoCollection().relationshipDAO().findIfAnyRelationExist(CLASSIFICATION, TAG) <= 0) { // We are missing relationship for classification -> tag, and also tag -> tag (parent relationship) // Find tag definitions and load classifications from the json file, if necessary ClassificationRepository classificationRepository = diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/topics/TopicResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/topics/TopicResource.java index ee54b3efdc22..d32aee51d266 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/topics/TopicResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/topics/TopicResource.java @@ -501,7 +501,6 @@ private Topic getTopic(CreateTopic create, String user) { .withRetentionTime(create.getRetentionTime()) .withReplicationFactor(create.getReplicationFactor()) .withTopicConfig(create.getTopicConfig()) - .withSourceUrl(create.getSourceUrl()) - .withTags(create.getTags()); + .withSourceUrl(create.getSourceUrl()); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java index 4c6bba00e81a..9e32fd90645e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java @@ -32,7 +32,7 @@ import java.util.Map; import java.util.Objects; import java.util.Set; -import java.util.TreeMap; +import java.util.SortedMap; import javax.json.JsonObject; import javax.ws.rs.core.Response; import lombok.Getter; @@ -81,7 +81,6 @@ public class SearchRepository { AGGREGATED_COST_ANALYSIS_REPORT_DATA); public static final String ELASTIC_SEARCH_EXTENSION = "service.eventPublisher"; - public static final String ELASTIC_SEARCH_ENTITY_FQN_STREAM = "eventPublisher:ElasticSearch:STREAM"; public SearchRepository(ElasticSearchConfiguration config) { elasticSearchConfiguration = config; @@ -122,20 +121,20 @@ public ElasticSearchConfiguration.SearchType getSearchType() { } public void createIndexes() { - for (String entityType : entityIndexMap.keySet()) { - createIndex(entityIndexMap.get(entityType)); + for (IndexMapping indexMapping : entityIndexMap.values()) { + createIndex(indexMapping); } } public void updateIndexes() { - for (String entityType : entityIndexMap.keySet()) { - updateIndex(entityIndexMap.get(entityType)); + for (IndexMapping indexMapping : entityIndexMap.values()) { + updateIndex(indexMapping); } } public void dropIndexes() { - for (String entityType : entityIndexMap.keySet()) { - deleteIndex(entityIndexMap.get(entityType)); + for (IndexMapping indexMapping : entityIndexMap.values()) { + deleteIndex(indexMapping); } } @@ -521,7 +520,7 @@ public Response suggest(SearchRequest request) throws IOException { return searchClient.suggest(request); } - public TreeMap> getSortedDate( + public SortedMap> getSortedDate( String team, Long scheduleTime, Long currentTime, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/BasicAuthenticator.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/BasicAuthenticator.java index a2be8c0da5c7..c1f66e63d95a 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/BasicAuthenticator.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/BasicAuthenticator.java @@ -96,7 +96,7 @@ public void init(OpenMetadataApplicationConfig config) { this.userRepository = (UserRepository) Entity.getEntityRepository(Entity.USER); this.tokenRepository = Entity.getTokenRepository(); this.authorizerConfiguration = config.getAuthorizerConfiguration(); - this.loginAttemptCache = new LoginAttemptCache(config); + this.loginAttemptCache = new LoginAttemptCache(); SmtpSettings smtpSettings = config.getSmtpSettings(); this.isEmailServiceEnabled = smtpSettings != null && smtpSettings.getEnableSmtpServer(); this.isSelfSignUpAvailable = config.getAuthenticationConfiguration().getEnableSelfSignup(); 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 ce44128eda06..fb915f06bfc1 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 @@ -70,7 +70,7 @@ public void init(OpenMetadataApplicationConfig config) { this.userRepository = (UserRepository) Entity.getEntityRepository(Entity.USER); this.tokenRepository = Entity.getTokenRepository(); this.ldapConfiguration = config.getAuthenticationConfiguration().getLdapConfiguration(); - this.loginAttemptCache = new LoginAttemptCache(config); + this.loginAttemptCache = new LoginAttemptCache(); this.loginConfiguration = SettingsCache.getSetting(SettingsType.LOGIN_CONFIGURATION, LoginConfiguration.class); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LoginAttemptCache.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LoginAttemptCache.java index 273a75dff455..0ceb672d098c 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LoginAttemptCache.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/auth/LoginAttemptCache.java @@ -9,14 +9,13 @@ import org.jetbrains.annotations.NotNull; import org.openmetadata.schema.api.configuration.LoginConfiguration; import org.openmetadata.schema.settings.SettingsType; -import org.openmetadata.service.OpenMetadataApplicationConfig; import org.openmetadata.service.resources.settings.SettingsCache; public class LoginAttemptCache { private int maxAttempt = 3; private final LoadingCache attemptsCache; - public LoginAttemptCache(OpenMetadataApplicationConfig config) { + public LoginAttemptCache() { LoginConfiguration loginConfiguration = SettingsCache.getSetting(SettingsType.LOGIN_CONFIGURATION, LoginConfiguration.class); long accessBlockTime = 600; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlSettingsHolder.java b/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlSettingsHolder.java index 75849c8dc975..5ca7d4ec76e9 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlSettingsHolder.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/security/saml/SamlSettingsHolder.java @@ -102,7 +102,7 @@ public void initDefaultSettings(OpenMetadataApplicationConfig catalogApplication samlData.put(SettingsBuilder.SECURITY_DIGEST_ALGORITHM, "http://www.w3.org/2001/04/xmlenc#sha256"); if (securityConfig.getSendSignedAuthRequest() || securityConfig.getWantAssertionEncrypted() - || securityConfig.getWantNameIdEncrypted()) { + || Boolean.TRUE.equals(securityConfig.getWantNameIdEncrypted())) { if (!CommonUtil.nullOrEmpty(securityConfig.getKeyStoreFilePath()) && !CommonUtil.nullOrEmpty(securityConfig.getKeyStorePassword()) && !CommonUtil.nullOrEmpty(securityConfig.getKeyStoreAlias())) { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/socket/WebSocketManager.java b/openmetadata-service/src/main/java/org/openmetadata/service/socket/WebSocketManager.java index e7ffd56a4aed..b1205dbf89e4 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/socket/WebSocketManager.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/socket/WebSocketManager.java @@ -113,7 +113,7 @@ public void sendToOne(String username, String event, String message) { } } - public void sendToManyWithUUID(HashSet receivers, String event, String message) { + public void sendToManyWithUUID(Set receivers, String event, String message) { receivers.forEach(e -> sendToOne(e, event, message)); } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/NotificationHandler.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/NotificationHandler.java index 4b39bdfc2406..e21461b5ec87 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/NotificationHandler.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/NotificationHandler.java @@ -21,7 +21,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import freemarker.template.TemplateException; import java.io.IOException; -import java.net.URI; import java.time.Instant; import java.util.HashSet; import java.util.List; @@ -81,7 +80,7 @@ private void handleNotifications(ContainerResponseContext responseContext, Colle handleConversationNotification(thread, collectionDAO); break; case Announcement: - handleAnnouncementNotification(thread, collectionDAO); + handleAnnouncementNotification(thread); break; } } @@ -114,8 +113,7 @@ private void handleTaskNotification(Thread thread, CollectionDAO collectionDAO) } } - private void handleAnnouncementNotification(Thread thread, CollectionDAO collectionDAO) - throws JsonProcessingException { + private void handleAnnouncementNotification(Thread thread) throws JsonProcessingException { String jsonThread = mapper.writeValueAsString(thread); AnnouncementDetails announcementDetails = thread.getAnnouncement(); Long currentTimestamp = Instant.now().getEpochSecond(); @@ -155,7 +153,6 @@ private void handleConversationNotification(Thread thread, CollectionDAO collect private void handleEmailNotifications(HashSet userList, Thread thread) { UserRepository repository = (UserRepository) Entity.getEntityRepository(USER); - URI urlInstance = thread.getHref(); userList.forEach( id -> { try { diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/TablesInitializer.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/TablesInitializer.java index f5bf8f52f691..801d6df86e5e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/TablesInitializer.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/TablesInitializer.java @@ -56,10 +56,6 @@ public final class TablesInitializer { private static final String DEBUG_MODE_ENABLED = "debug_mode"; - private static final String OPTION_FLYWAY_SCRIPT_ROOT_PATH = "flyway-sql-root"; - - private static final String OPTION_NATIVE_SQL_ROOT_PATH = "native-sql-root"; - private static final String OPTION_EXTENSION_SQL_ROOT_PATH = "extension-sql-root"; private static final String OPTION_CONFIG_FILE_PATH = "config"; private static final String OPTION_FORCE_MIGRATIONS = "force"; private static final String DISABLE_VALIDATE_ON_MIGRATE = "disable-validate-on-migrate"; diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/pipelineService/PipelineServiceClientTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/pipelineService/PipelineServiceClientTest.java index cce419b22aca..aef5b1b59ea5 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/pipelineService/PipelineServiceClientTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/pipelineService/PipelineServiceClientTest.java @@ -38,12 +38,12 @@ public void testGetVersionFromStringRaises() { public void testBuildVersionMismatchErrorMessage() { String res = mockPipelineServiceClient.buildVersionMismatchErrorMessage("1.1.0.dev0", "1.0.0"); assertEquals( - res, - "Server version [1.0.0] is older than Ingestion Version [1.1.0.dev0]. Please upgrade your server or downgrade the ingestion client."); + "Server version [1.0.0] is older than Ingestion Version [1.1.0.dev0]. Please upgrade your server or downgrade the ingestion client.", + res); res = mockPipelineServiceClient.buildVersionMismatchErrorMessage("1.0.0.dev0", "1.0.1"); assertEquals( - res, - "Ingestion version [1.0.0.dev0] is older than Server Version [1.0.1]. Please upgrade your ingestion client."); + "Ingestion version [1.0.0.dev0] is older than Server Version [1.0.1]. Please upgrade your ingestion client.", + res); } } diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/apps/AppsResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/apps/AppsResourceTest.java index bf3e8fa942c1..44940568228d 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/apps/AppsResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/apps/AppsResourceTest.java @@ -31,7 +31,7 @@ public AppsResourceTest() { public CreateApp createRequest(String name) { // Create AppMarketPlaceDefinition AppMarketPlaceResourceTest appMarketPlaceResourceTest = new AppMarketPlaceResourceTest(); - AppMarketPlaceDefinition appMarketPlaceDefinition = null; + AppMarketPlaceDefinition appMarketPlaceDefinition; try { appMarketPlaceDefinition = appMarketPlaceResourceTest.getEntityByName(name, ADMIN_AUTH_HEADERS); } catch (EntityNotFoundException | HttpResponseException ex) { 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 bf850ebae01e..feaec5df5835 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 @@ -1417,13 +1417,13 @@ void createUpdateDeleteCustomMetrics(Table table, Map authHeader CreateCustomMetric createTableMetric = new CreateCustomMetric().withName("customTable").withExpression("SELECT SUM(xyz) + SUM(def) FROM abc"); Table tablePutResponse = putCustomMetric(table.getId(), createTableMetric, authHeaders); - assertEquals(tablePutResponse.getCustomMetrics().size(), 1); + assertEquals(1, tablePutResponse.getCustomMetrics().size()); // Add another table custom metric CreateCustomMetric createTableMetric2 = new CreateCustomMetric().withName("custom2Table").withExpression("SELECT SUM(xyz) / SUM(def) FROM abc"); tablePutResponse = putCustomMetric(table.getId(), createTableMetric2, authHeaders); - assertEquals(tablePutResponse.getCustomMetrics().size(), 2); + assertEquals(2, tablePutResponse.getCustomMetrics().size()); // check we can get the custom metrics Map customMetrics = @@ -1449,8 +1449,8 @@ void createUpdateDeleteCustomMetrics(Table table, Map authHeader // Delete table custom metric deleteTableCustomMetric(table.getId(), updatedTableMetric.getName(), authHeaders); table = getEntity(table.getId(), "customMetrics,columns", authHeaders); - assertEquals(table.getCustomMetrics().size(), 1); - assertEquals(table.getCustomMetrics().get(0).getName(), createTableMetric2.getName()); + assertEquals(1, table.getCustomMetrics().size()); + assertEquals(createTableMetric2.getName(), table.getCustomMetrics().get(0).getName()); } @Test diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/datainsight/DataInsightChartResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/datainsight/DataInsightChartResourceTest.java index b80b3a12dae8..535b2bce306b 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/datainsight/DataInsightChartResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/datainsight/DataInsightChartResourceTest.java @@ -110,7 +110,7 @@ void get_data_insight_data_403() throws IOException, ParseException { true); } - /* We need elasticsearch to fecth data so we'll only test permission are + /* We need elasticsearch to fetch data, so we'll only test permission are * handled correctly in the request for a restricted user. * */ public void getDataInsightData( 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 7c882ac93cc2..607b7dffb5a7 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 @@ -363,7 +363,7 @@ void put_testCaseResults_200(TestInfo test) throws IOException, ParseException { // add a new test case to the logical test suite to validate if the // summary is updated correctly - testCaseIds.removeAll(testCaseIds); + testCaseIds.clear(); testCaseIds.add(testCase.getId()); testSuiteResourceTest.addTestCasesToLogicalTestSuite(logicalTestSuite, testCaseIds); @@ -418,7 +418,7 @@ void test_resultSummaryCascadeToAllSuites(TestInfo test) throws IOException, Par // test we get the right summary for the logical test suite TestSummary logicalTestSummary = getTestSummary(ADMIN_AUTH_HEADERS, logicalTestSuite.getId().toString()); assertEquals(1, logicalTestSummary.getTotal()); - testCaseIds.removeAll(testCaseIds); + testCaseIds.clear(); testCaseIds.add(testCase.getId()); testSuiteResourceTest.addTestCasesToLogicalTestSuite(logicalTestSuite, testCaseIds); logicalTestSummary = getTestSummary(ADMIN_AUTH_HEADERS, logicalTestSuite.getId().toString()); @@ -443,10 +443,8 @@ void test_resultSummaryCascadeToAllSuites(TestInfo test) throws IOException, Par // test suite deleteLogicalTestCase(logicalTestSuite, testCase.getId()); logicalTestSummary = getTestSummary(ADMIN_AUTH_HEADERS, logicalTestSuite.getId().toString()); - assertEquals( - null, - logicalTestSummary - .getTotal()); // check the deletion of the test case from the logical test suite is reflected in the summary + // check the deletion of the test case from the logical test suite is reflected in the summary + assertNull(logicalTestSummary.getTotal()); } @Test diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/events/EventSubscriptionResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/events/EventSubscriptionResourceTest.java index 9b0eb1452742..db9172ce7c8d 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/events/EventSubscriptionResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/events/EventSubscriptionResourceTest.java @@ -72,7 +72,7 @@ void post_alertActionWithEnabledStateChange(TestInfo test) throws IOException { CreateEventSubscription genericWebhookActionRequest = createRequest(webhookName).withEnabled(false).withSubscriptionConfig(genericWebhook); EventSubscription alert = createAndCheckEntity(genericWebhookActionRequest, ADMIN_AUTH_HEADERS); - // For the DISABLED Publisher are not available so it will have no status + // For the DISABLED Publisher are not available, so it will have no status SubscriptionStatus status = getStatus(alert.getId(), Response.Status.OK.getStatusCode()); assertEquals(DISABLED, status.getStatus()); WebhookCallbackResource.EventDetails details = webhookCallbackResource.getEventDetails(webhookName); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/services/connections/TestConnectionDefinitionResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/services/connections/TestConnectionDefinitionResourceTest.java index 536cf01554da..1021378dd9af 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/services/connections/TestConnectionDefinitionResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/services/connections/TestConnectionDefinitionResourceTest.java @@ -24,14 +24,14 @@ public class TestConnectionDefinitionResourceTest extends OpenMetadataApplicatio public void test_get_test_connection_definition() throws HttpResponseException { WebTarget target = getResourceByName(TEST_CONNECTION_NAME); TestConnectionDefinition mysqlTest = TestUtils.get(target, TestConnectionDefinition.class, ADMIN_AUTH_HEADERS); - assertEquals(mysqlTest.getName(), "Mysql"); - assertEquals(mysqlTest.getSteps().size(), 4); + assertEquals("Mysql", mysqlTest.getName()); + assertEquals(4, mysqlTest.getSteps().size()); WebTarget idTarget = getResourceById(mysqlTest.getId()); TestConnectionDefinition mysqlTestById = TestUtils.get(idTarget, TestConnectionDefinition.class, ADMIN_AUTH_HEADERS); - assertEquals(mysqlTestById.getName(), "Mysql"); - assertEquals(mysqlTestById.getSteps().size(), 4); + assertEquals("Mysql", mysqlTestById.getName()); + assertEquals(4, mysqlTestById.getSteps().size()); } @Test @@ -39,7 +39,7 @@ public void test_list_test_connection_definition() throws HttpResponseException WebTarget target = listResource(); ResultList testConnectionDefinitions = TestUtils.get(target, ResultList.class, ADMIN_AUTH_HEADERS); // we get 10 as it's the default paging size - assertEquals(testConnectionDefinitions.getData().size(), 10); + assertEquals(10, testConnectionDefinitions.getData().size()); } protected final WebTarget getResourceByName(String name) { diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/PersonaResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/PersonaResourceTest.java index aa53389def75..535a1ddada01 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/PersonaResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/teams/PersonaResourceTest.java @@ -109,7 +109,7 @@ void delete_validPersona_200_OK(TestInfo test) throws IOException { // Ensure that the user does not have relationship to this persona User user = userResourceTest.getEntity(user1.getId(), "personas", ADMIN_AUTH_HEADERS); - assertEquals(user.getPersonas().size(), 0); + assertEquals(0, user.getPersonas().size()); } @Test diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/secrets/SecretsManagerLifecycleTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/secrets/SecretsManagerLifecycleTest.java index 90a0f3860a17..b381bc32ccc9 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/secrets/SecretsManagerLifecycleTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/secrets/SecretsManagerLifecycleTest.java @@ -66,7 +66,7 @@ void testDatabaseServiceConnectionConfigLifecycle() { // SM will have the key stored String secretValue = secretsManager.getSecret(secretName); - assertEquals(secretValue, DECRYPTED_VALUE); + assertEquals(DECRYPTED_VALUE, secretValue); // Now we delete the service secretsManager.deleteSecretsFromServiceConnectionConfig( @@ -114,7 +114,7 @@ void testWorkflowLifecycle() { // SM will have the key stored String secretValue = secretsManager.getSecret(secretName); - assertEquals(secretValue, DECRYPTED_VALUE); + assertEquals(DECRYPTED_VALUE, secretValue); // Now we delete the service secretsManager.deleteSecretsFromWorkflow(workflow); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/secrets/masker/TestEntityMasker.java b/openmetadata-service/src/test/java/org/openmetadata/service/secrets/masker/TestEntityMasker.java index b76495830f6a..e24977ca8a56 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/secrets/masker/TestEntityMasker.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/secrets/masker/TestEntityMasker.java @@ -62,9 +62,9 @@ void testAirflowConnectionMasker() { EntityMaskerFactory.createEntityMasker() .unmaskServiceConnectionConfig(masked, airflowConnection, "Airflow", ServiceType.PIPELINE); assertEquals( + PASSWORD, JsonUtils.convertValue(((MysqlConnection) unmasked.getConnection()).getAuthType(), basicAuth.class) - .getPassword(), - PASSWORD); + .getPassword()); } @Test @@ -80,7 +80,7 @@ void testBigQueryConnectionMasker() { (BigQueryConnection) EntityMaskerFactory.createEntityMasker() .unmaskServiceConnectionConfig(masked, bigQueryConnection, "BigQuery", ServiceType.DATABASE); - assertEquals(getPrivateKeyFromGcsConfig(unmasked.getCredentials()), PASSWORD); + assertEquals(PASSWORD, getPrivateKeyFromGcsConfig(unmasked.getCredentials())); } @Test @@ -97,7 +97,7 @@ void testDatalakeConnectionMasker() { (DatalakeConnection) EntityMaskerFactory.createEntityMasker() .unmaskServiceConnectionConfig(masked, datalakeConnection, "Datalake", ServiceType.DATABASE); - assertEquals(getPrivateKeyFromGcsConfig(((GCSConfig) unmasked.getConfigSource()).getSecurityConfig()), PASSWORD); + assertEquals(PASSWORD, getPrivateKeyFromGcsConfig(((GCSConfig) unmasked.getConfigSource()).getSecurityConfig())); } @Test @@ -116,13 +116,13 @@ void testDbtPipelineMasker() { getMaskedPassword()); EntityMaskerFactory.createEntityMasker().unmaskIngestionPipeline(dbtPipeline, originalDbtPipeline); assertEquals( + PASSWORD, getPrivateKeyFromGcsConfig( ((DbtGCSConfig) ((DbtPipeline) dbtPipeline.getSourceConfig().getConfig()).getDbtConfigSource()) - .getDbtSecurityConfig()), - PASSWORD); + .getDbtSecurityConfig())); assertEquals( - ((GoogleSSOClientConfig) dbtPipeline.getOpenMetadataServerConnection().getSecurityConfig()).getSecretKey(), - PASSWORD); + PASSWORD, + ((GoogleSSOClientConfig) dbtPipeline.getOpenMetadataServerConnection().getSecurityConfig()).getSecretKey()); } @Test @@ -140,9 +140,9 @@ void testSSOAuthenticationMechanismMasker() { EntityMaskerFactory.createEntityMasker() .unmaskAuthenticationMechanism("test", authenticationMechanism, originalSsoAuthenticationMechanism); assertEquals( + PASSWORD, ((GoogleSSOClientConfig) ((SSOAuthMechanism) authenticationMechanism.getConfig()).getAuthConfig()) - .getSecretKey(), - PASSWORD); + .getSecretKey()); } @Test @@ -174,9 +174,9 @@ void testSupersetConnectionMasker() { EntityMaskerFactory.createEntityMasker() .unmaskServiceConnectionConfig(masked, supersetConnection, "Superset", ServiceType.DASHBOARD); assertEquals( + PASSWORD, JsonUtils.convertValue(((MysqlConnection) unmasked.getConnection()).getAuthType(), basicAuth.class) - .getPassword(), - PASSWORD); + .getPassword()); } @Test @@ -205,17 +205,17 @@ void testWorkflowMasker() { getMaskedPassword()); Workflow unmasked = EntityMaskerFactory.createEntityMasker().unmaskWorkflow(masked, workflow); assertEquals( + PASSWORD, JsonUtils.convertValue( ((MysqlConnection) ((DatabaseConnection) ((TestServiceConnectionRequest) unmasked.getRequest()).getConnection()) .getConfig()) .getAuthType(), basicAuth.class) - .getPassword(), - PASSWORD); + .getPassword()); assertEquals( - ((GoogleSSOClientConfig) unmasked.getOpenMetadataServerConnection().getSecurityConfig()).getSecretKey(), - PASSWORD); + PASSWORD, + ((GoogleSSOClientConfig) unmasked.getOpenMetadataServerConnection().getSecurityConfig()).getSecretKey()); } @Test @@ -231,7 +231,7 @@ void testObjectMaskerWithoutACustomClassConverter() { (MysqlConnection) EntityMaskerFactory.createEntityMasker() .unmaskServiceConnectionConfig(masked, mysqlConnection, "Mysql", ServiceType.DATABASE); - assertEquals(JsonUtils.convertValue(unmasked.getAuthType(), basicAuth.class).getPassword(), PASSWORD); + assertEquals(PASSWORD, JsonUtils.convertValue(unmasked.getAuthType(), basicAuth.class).getPassword()); } protected String getMaskedPassword() {