diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/elasticSearch/BuildSearchIndexResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/elasticSearch/BuildSearchIndexResource.java index fd693a88fa1..bc4c602d24f 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/elasticSearch/BuildSearchIndexResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/elasticSearch/BuildSearchIndexResource.java @@ -80,21 +80,25 @@ public class BuildSearchIndexResource { public static final String ELASTIC_SEARCH_EXTENSION = "service.eventPublisher"; public static final String ELASTIC_SEARCH_ENTITY_FQN_STREAM = "eventPublisher:ElasticSearch:STREAM"; public static final String ELASTIC_SEARCH_ENTITY_FQN_BATCH = "eventPublisher:ElasticSearch:BATCH"; - private final RestHighLevelClient client; - private final ElasticSearchIndexDefinition elasticSearchIndexDefinition; + private RestHighLevelClient client; + private ElasticSearchIndexDefinition elasticSearchIndexDefinition; private final CollectionDAO dao; private final Authorizer authorizer; private final ExecutorService threadScheduler; public BuildSearchIndexResource(CollectionDAO dao, Authorizer authorizer) { - this.client = - ElasticSearchClientUtils.createElasticSearchClient( - ConfigurationHolder.getInstance() - .getConfig( - ConfigurationHolder.ConfigurationType.ELASTICSEARCH_CONFIG, ElasticSearchConfiguration.class)); + if (ConfigurationHolder.getInstance() + .getConfig(ConfigurationHolder.ConfigurationType.ELASTICSEARCH_CONFIG, ElasticSearchConfiguration.class) + != null) { + this.client = + ElasticSearchClientUtils.createElasticSearchClient( + ConfigurationHolder.getInstance() + .getConfig( + ConfigurationHolder.ConfigurationType.ELASTICSEARCH_CONFIG, ElasticSearchConfiguration.class)); + this.elasticSearchIndexDefinition = new ElasticSearchIndexDefinition(client, dao); + } this.dao = dao; this.authorizer = authorizer; - this.elasticSearchIndexDefinition = new ElasticSearchIndexDefinition(client, dao); this.threadScheduler = new ThreadPoolExecutor( 2, 2, 0L, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(5), new ThreadPoolExecutor.CallerRunsPolicy()); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java index 11859d76d51..fdac36fcdcb 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java @@ -798,14 +798,14 @@ public class UserResource extends EntityResource { sendEmailVerification(uriInfo, registeredUser); } catch (Exception e) { LOG.error("Error in sending mail to the User : {}", e.getMessage()); - return Response.status(424).entity(new ErrorMessage(424, EMAIL_SENDING_ISSUE)).build(); + return Response.status(424, EMAIL_SENDING_ISSUE).build(); } } - return Response.status(Response.Status.CREATED).entity("User Registration Successful.").build(); - } else { - return Response.status(Response.Status.BAD_REQUEST) - .entity(new ErrorMessage(400, "Signup is not Available")) + return Response.status(Response.Status.CREATED.getStatusCode(), "User Registration Successful.") + .entity(registeredUser) .build(); + } else { + return Response.status(Response.Status.BAD_REQUEST.getStatusCode(), "Signup is not available").build(); } } diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/ConfigurationHolder.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/ConfigurationHolder.java index 8b618728f16..53d4f03f4f6 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/ConfigurationHolder.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/ConfigurationHolder.java @@ -62,7 +62,9 @@ public class ConfigurationHolder { CONFIG_MAP.put(ConfigurationType.SMTP_CONFIG, config.getSmtpSettings()); break; case ELASTICSEARCH_CONFIG: - CONFIG_MAP.put(ConfigurationType.ELASTICSEARCH_CONFIG, config.getElasticSearchConfiguration()); + if (config.getElasticSearchConfiguration() != null) { + CONFIG_MAP.put(ConfigurationType.ELASTICSEARCH_CONFIG, config.getElasticSearchConfiguration()); + } break; case LOGIN_CONFIG: CONFIG_MAP.put(ConfigurationType.LOGIN_CONFIG, config.getLoginSettings()); diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/OpenMetadataApplicationTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/OpenMetadataApplicationTest.java index 5681df12ec1..62033349878 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/OpenMetadataApplicationTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/OpenMetadataApplicationTest.java @@ -85,6 +85,7 @@ public abstract class OpenMetadataApplicationTest { ConfigOverride.config("database.password", SQL_CONTAINER.getPassword()), // Migration overrides ConfigOverride.config("migrationConfiguration.path", migrationScripsLocation)); + APP.before(); } diff --git a/openmetadata-service/src/test/resources/openmetadata-secure-test.yaml b/openmetadata-service/src/test/resources/openmetadata-secure-test.yaml index 99cb6e846d9..6d5e6c72a47 100644 --- a/openmetadata-service/src/test/resources/openmetadata-secure-test.yaml +++ b/openmetadata-service/src/test/resources/openmetadata-secure-test.yaml @@ -182,18 +182,6 @@ email: password: "" transportationStrategy: "SMTP_TLS" -elasticsearch: - host: "localhost" - port: "9200" - scheme: "http" - username: "" - password: "" - truststorePath: "" - truststorePassword: "" - connectionTimeoutSecs: 5 - socketTimeoutSecs: 60 - batchSize: 10 - slackChat: slackUrl: "http://localhost:8080"