Fix #7516: Move data folder into openmetadta-service (#7517)

This commit is contained in:
Sriharsha Chintalapani 2022-09-17 11:35:45 -07:00 committed by GitHub
parent 3a9576a75c
commit b2bdc54ac7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
85 changed files with 234 additions and 224 deletions

View File

@ -110,7 +110,7 @@ if [ -z "$OPENMETADATA_JVM_PERFORMANCE_OPTS" ]; then
fi
#Application classname
APP_CLASS="org.openmetadata.service.CatalogApplication"
APP_CLASS="org.openmetadata.service.OpenMetadataApplication"
# Launch mode
if [ "x$DAEMON_MODE" = "xtrue" ]; then

View File

@ -30,7 +30,7 @@ function catalogStart {
if [[ $? -eq 0 ]]; then
rm -f ${PID_FILE}
echo "Starting OpenMetadata"
APP_CLASS="org.openmetadata.service.CatalogApplication"
APP_CLASS="org.openmetadata.service.OpenMetadataApplication"
cd ${CATALOG_HOME}
nohup ${JAVA} ${CATALOG_HEAP_OPTS} ${CATALOG_JVM_PERF_OPTS} ${CATALOG_DEBUG_OPTS} ${CATALOG_GC_LOG_OPTS} ${CATALOG_JMX_OPTS} -cp ${CLASSPATH} "${APP_CLASS}" "server" "$@" 2>>"${ERR_FILE}" 1>>"${OUT_FILE}" &
cd - &> /dev/null

View File

@ -87,11 +87,11 @@ import org.openmetadata.service.socket.WebSocketManager;
/** Main catalog application */
@Slf4j
public class CatalogApplication extends Application<CatalogApplicationConfig> {
public class OpenMetadataApplication extends Application<OpenMetadataApplicationConfig> {
private Authorizer authorizer;
@Override
public void run(CatalogApplicationConfig catalogConfig, Environment environment)
public void run(OpenMetadataApplicationConfig catalogConfig, Environment environment)
throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException,
InvocationTargetException, IOException {
final Jdbi jdbi = createAndSetupJDBI(environment, catalogConfig.getDataSourceFactory());
@ -182,14 +182,15 @@ public class CatalogApplication extends Application<CatalogApplicationConfig> {
@SneakyThrows
@Override
public void initialize(Bootstrap<CatalogApplicationConfig> bootstrap) {
public void initialize(Bootstrap<OpenMetadataApplicationConfig> bootstrap) {
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(
bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false)));
bootstrap.addBundle(
new SwaggerBundle<>() {
@Override
protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(CatalogApplicationConfig catalogConfig) {
protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(
OpenMetadataApplicationConfig catalogConfig) {
return catalogConfig.getSwaggerBundleConfig();
}
});
@ -197,7 +198,7 @@ public class CatalogApplication extends Application<CatalogApplicationConfig> {
bootstrap.addBundle(
new HealthCheckBundle<>() {
@Override
protected HealthConfiguration getHealthConfiguration(final CatalogApplicationConfig configuration) {
protected HealthConfiguration getHealthConfiguration(final OpenMetadataApplicationConfig configuration) {
return configuration.getHealthConfiguration();
}
});
@ -223,7 +224,7 @@ public class CatalogApplication extends Application<CatalogApplicationConfig> {
}
}
private void registerAuthorizer(CatalogApplicationConfig catalogConfig, Environment environment)
private void registerAuthorizer(OpenMetadataApplicationConfig catalogConfig, Environment environment)
throws NoSuchMethodException, ClassNotFoundException, IllegalAccessException, InvocationTargetException,
InstantiationException {
AuthorizerConfiguration authorizerConf = catalogConfig.getAuthorizerConfiguration();
@ -251,24 +252,24 @@ public class CatalogApplication extends Application<CatalogApplicationConfig> {
}
}
private void registerEventFilter(CatalogApplicationConfig catalogConfig, Environment environment, Jdbi jdbi) {
private void registerEventFilter(OpenMetadataApplicationConfig catalogConfig, Environment environment, Jdbi jdbi) {
if (catalogConfig.getEventHandlerConfiguration() != null) {
ContainerResponseFilter eventFilter = new EventFilter(catalogConfig, jdbi);
environment.jersey().register(eventFilter);
}
}
private void registerEventPublisher(CatalogApplicationConfig catalogApplicationConfig) {
private void registerEventPublisher(OpenMetadataApplicationConfig openMetadataApplicationConfig) {
// register ElasticSearch Event publisher
if (catalogApplicationConfig.getElasticSearchConfiguration() != null) {
if (openMetadataApplicationConfig.getElasticSearchConfiguration() != null) {
ElasticSearchEventPublisher elasticSearchEventPublisher =
new ElasticSearchEventPublisher(catalogApplicationConfig.getElasticSearchConfiguration());
new ElasticSearchEventPublisher(openMetadataApplicationConfig.getElasticSearchConfiguration());
EventPubSub.addEventHandler(elasticSearchEventPublisher);
}
}
private void registerResources(
CatalogApplicationConfig config, Environment environment, Jdbi jdbi, SecretsManager secretsManager) {
OpenMetadataApplicationConfig config, Environment environment, Jdbi jdbi, SecretsManager secretsManager) {
CollectionRegistry.getInstance().registerResources(jdbi, environment, config, authorizer, secretsManager);
if (config.getElasticSearchConfiguration() != null) {
environment.jersey().register(new SearchResource(config.getElasticSearchConfiguration()));
@ -279,7 +280,7 @@ public class CatalogApplication extends Application<CatalogApplicationConfig> {
environment.getApplicationContext().setErrorHandler(eph);
}
private void intializeWebsockets(CatalogApplicationConfig catalogConfig, Environment environment) {
private void intializeWebsockets(OpenMetadataApplicationConfig catalogConfig, Environment environment) {
SocketAddressFilter socketAddressFilter;
String pathSpec = "/api/v1/push/feed/*";
if (catalogConfig.getAuthorizerConfiguration() != null) {
@ -312,8 +313,8 @@ public class CatalogApplication extends Application<CatalogApplicationConfig> {
}
public static void main(String[] args) throws Exception {
CatalogApplication catalogApplication = new CatalogApplication();
catalogApplication.run(args);
OpenMetadataApplication OpenMetadataApplication = new OpenMetadataApplication();
OpenMetadataApplication.run(args);
}
public static class ManagedShutdown implements Managed {

View File

@ -36,7 +36,7 @@ import org.openmetadata.service.validators.AirflowConfigValidation;
@Getter
@Setter
public class CatalogApplicationConfig extends Configuration {
public class OpenMetadataApplicationConfig extends Configuration {
@JsonProperty("database")
@NotNull
@Valid

View File

@ -20,7 +20,7 @@ import org.jdbi.v3.core.Jdbi;
import org.openmetadata.schema.EntityInterface;
import org.openmetadata.schema.type.AuditLog;
import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;
@ -28,7 +28,7 @@ import org.slf4j.MarkerFactory;
public class AuditEventHandler implements EventHandler {
private final Marker auditMarker = MarkerFactory.getMarker("AUDIT");
public void init(CatalogApplicationConfig config, Jdbi jdbi) {
public void init(OpenMetadataApplicationConfig config, Jdbi jdbi) {
// Nothing to do
}

View File

@ -45,8 +45,8 @@ import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.schema.type.EventType;
import org.openmetadata.schema.type.Post;
import org.openmetadata.schema.type.Relationship;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.filter.FilterRegistry;
import org.openmetadata.service.jdbi3.CollectionDAO;
import org.openmetadata.service.jdbi3.CollectionDAO.EntityRelationshipRecord;
@ -65,7 +65,7 @@ public class ChangeEventHandler implements EventHandler {
private FeedRepository feedDao;
private ObjectMapper mapper;
public void init(CatalogApplicationConfig config, Jdbi jdbi) {
public void init(OpenMetadataApplicationConfig config, Jdbi jdbi) {
this.dao = jdbi.onDemand(CollectionDAO.class);
this.feedDao = new FeedRepository(dao);
this.mapper = new ObjectMapper();

View File

@ -21,7 +21,7 @@ import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.ext.Provider;
import lombok.extern.slf4j.Slf4j;
import org.jdbi.v3.core.Jdbi;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.util.ParallelStreamUtil;
@Slf4j
@ -32,13 +32,13 @@ public class EventFilter implements ContainerResponseFilter {
private final ForkJoinPool forkJoinPool;
private final List<EventHandler> eventHandlers;
public EventFilter(CatalogApplicationConfig config, Jdbi jdbi) {
public EventFilter(OpenMetadataApplicationConfig config, Jdbi jdbi) {
this.forkJoinPool = new ForkJoinPool(FORK_JOIN_POOL_PARALLELISM);
this.eventHandlers = new ArrayList<>();
registerEventHandlers(config, jdbi);
}
private void registerEventHandlers(CatalogApplicationConfig config, Jdbi jdbi) {
private void registerEventHandlers(OpenMetadataApplicationConfig config, Jdbi jdbi) {
try {
Set<String> eventHandlerClassNames =
new HashSet<>(config.getEventHandlerConfiguration().getEventHandlerClassNames());

View File

@ -16,10 +16,10 @@ package org.openmetadata.service.events;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import org.jdbi.v3.core.Jdbi;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.OpenMetadataApplicationConfig;
public interface EventHandler {
void init(CatalogApplicationConfig config, Jdbi jdbi);
void init(OpenMetadataApplicationConfig config, Jdbi jdbi);
Void process(ContainerRequestContext requestContext, ContainerResponseContext responseContext);

View File

@ -30,7 +30,7 @@ import java.util.List;
import java.util.stream.Collectors;
import lombok.NonNull;
import org.openmetadata.schema.api.fernet.FernetConfiguration;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.OpenMetadataApplicationConfig;
public class Fernet {
private static Fernet instance;
@ -54,7 +54,7 @@ public class Fernet {
return instance;
}
public void setFernetKey(CatalogApplicationConfig config) {
public void setFernetKey(OpenMetadataApplicationConfig config) {
FernetConfiguration fernetConfiguration = config.getFernetConfiguration();
if (fernetConfiguration != null && !FERNET_NO_ENCRYPTION.equals(fernetConfiguration.getFernetKey())) {
setFernetKey(fernetConfiguration.getFernetKey());

View File

@ -74,8 +74,8 @@ import org.openmetadata.schema.type.FieldChange;
import org.openmetadata.schema.type.Include;
import org.openmetadata.schema.type.Relationship;
import org.openmetadata.schema.type.TagLabel;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.TypeRegistry;
import org.openmetadata.service.exception.CatalogExceptionMessage;
import org.openmetadata.service.exception.EntityNotFoundException;
@ -239,7 +239,7 @@ public abstract class EntityRepository<T extends EntityInterface> {
* openmetadata-service/src/main/resources/json/data/{entityType}
*
* <p>This method needs to be explicitly called, typically from initialize method. See {@link
* org.openmetadata.service.resources.teams.RoleResource#initialize(CatalogApplicationConfig)}
* org.openmetadata.service.resources.teams.RoleResource#initialize(OpenMetadataApplicationConfig)}
*/
public void initSeedDataFromResources() throws IOException {
List<String> jsonDataFiles =

View File

@ -39,7 +39,7 @@ import org.jdbi.v3.core.Jdbi;
import org.openmetadata.schema.Function;
import org.openmetadata.schema.type.CollectionDescriptor;
import org.openmetadata.schema.type.CollectionInfo;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.jdbi3.CollectionDAO;
import org.openmetadata.service.secrets.SecretsManager;
import org.openmetadata.service.security.Authorizer;
@ -182,7 +182,7 @@ public final class CollectionRegistry {
public void registerResources(
Jdbi jdbi,
Environment environment,
CatalogApplicationConfig config,
OpenMetadataApplicationConfig config,
Authorizer authorizer,
SecretsManager secretsManager) {
// Build list of ResourceDescriptors
@ -254,7 +254,7 @@ public final class CollectionRegistry {
private static Object createResource(
CollectionDAO daoObject,
String resourceClass,
CatalogApplicationConfig config,
OpenMetadataApplicationConfig config,
Authorizer authorizer,
SecretsManager secretsManager)
throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException,
@ -272,7 +272,7 @@ public final class CollectionRegistry {
.newInstance(daoObject, authorizer, secretsManager);
} catch (NoSuchMethodException ex) {
try {
resource = clz.getDeclaredConstructor(CatalogApplicationConfig.class).newInstance(config);
resource = clz.getDeclaredConstructor(OpenMetadataApplicationConfig.class).newInstance(config);
} catch (NoSuchMethodException exc) {
resource = Class.forName(resourceClass).getConstructor().newInstance();
}
@ -281,7 +281,7 @@ public final class CollectionRegistry {
// Call initialize method, if it exists
try {
Method initializeMethod = resource.getClass().getMethod("initialize", CatalogApplicationConfig.class);
Method initializeMethod = resource.getClass().getMethod("initialize", OpenMetadataApplicationConfig.class);
initializeMethod.invoke(resource, config);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
// Method does not exist and initialize is not called

View File

@ -25,7 +25,7 @@ import javax.ws.rs.core.MediaType;
import org.openmetadata.schema.api.security.AuthenticationConfiguration;
import org.openmetadata.schema.api.security.AuthorizerConfiguration;
import org.openmetadata.schema.api.slackChat.SlackChatConfiguration;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.airflow.AirflowConfigurationForAPI;
import org.openmetadata.service.resources.Collection;
import org.openmetadata.service.sandbox.SandboxConfiguration;
@ -37,11 +37,11 @@ import org.openmetadata.service.security.jwt.JWTTokenGenerator;
@Produces(MediaType.APPLICATION_JSON)
@Collection(name = "config")
public class ConfigResource {
private final CatalogApplicationConfig catalogApplicationConfig;
private final OpenMetadataApplicationConfig openMetadataApplicationConfig;
private final JWTTokenGenerator jwtTokenGenerator;
public ConfigResource(CatalogApplicationConfig catalogApplicationConfig) {
this.catalogApplicationConfig = catalogApplicationConfig;
public ConfigResource(OpenMetadataApplicationConfig openMetadataApplicationConfig) {
this.openMetadataApplicationConfig = openMetadataApplicationConfig;
this.jwtTokenGenerator = JWTTokenGenerator.getInstance();
}
@ -62,8 +62,8 @@ public class ConfigResource {
})
public AuthenticationConfiguration getAuthConfig() {
AuthenticationConfiguration authenticationConfiguration = new AuthenticationConfiguration();
if (catalogApplicationConfig.getAuthenticationConfiguration() != null) {
authenticationConfiguration = catalogApplicationConfig.getAuthenticationConfiguration();
if (openMetadataApplicationConfig.getAuthenticationConfiguration() != null) {
authenticationConfiguration = openMetadataApplicationConfig.getAuthenticationConfiguration();
}
return authenticationConfiguration;
}
@ -85,8 +85,8 @@ public class ConfigResource {
})
public AuthorizerConfiguration getAuthorizerConfig() {
AuthorizerConfiguration authorizerConfiguration = new AuthorizerConfiguration();
if (catalogApplicationConfig.getAuthorizerConfiguration() != null) {
authorizerConfiguration = catalogApplicationConfig.getAuthorizerConfiguration();
if (openMetadataApplicationConfig.getAuthorizerConfiguration() != null) {
authorizerConfiguration = openMetadataApplicationConfig.getAuthorizerConfiguration();
}
return authorizerConfiguration;
}
@ -106,7 +106,7 @@ public class ConfigResource {
})
public SandboxConfiguration getSandboxMode() {
SandboxConfiguration sandboxConfiguration = new SandboxConfiguration();
if (catalogApplicationConfig.isSandboxModeEnabled()) {
if (openMetadataApplicationConfig.isSandboxModeEnabled()) {
sandboxConfiguration.setSandboxModeEnabled(true);
}
return sandboxConfiguration;
@ -129,8 +129,8 @@ public class ConfigResource {
})
public SlackChatConfiguration getSlackChatConfiguration() {
SlackChatConfiguration slackChatConfiguration = new SlackChatConfiguration();
if (catalogApplicationConfig.getSlackChatConfiguration() != null) {
slackChatConfiguration = catalogApplicationConfig.getSlackChatConfiguration();
if (openMetadataApplicationConfig.getSlackChatConfiguration() != null) {
slackChatConfiguration = openMetadataApplicationConfig.getSlackChatConfiguration();
}
return slackChatConfiguration;
}
@ -152,8 +152,9 @@ public class ConfigResource {
})
public AirflowConfigurationForAPI getAirflowConfig() {
AirflowConfigurationForAPI airflowConfigurationForAPI = new AirflowConfigurationForAPI();
if (catalogApplicationConfig.getAirflowConfiguration() != null) {
airflowConfigurationForAPI.setApiEndpoint(catalogApplicationConfig.getAirflowConfiguration().getApiEndpoint());
if (openMetadataApplicationConfig.getAirflowConfiguration() != null) {
airflowConfigurationForAPI.setApiEndpoint(
openMetadataApplicationConfig.getAirflowConfiguration().getApiEndpoint());
}
return airflowConfigurationForAPI;
}

View File

@ -40,8 +40,8 @@ import org.openmetadata.schema.tests.TestDefinition;
import org.openmetadata.schema.type.EntityHistory;
import org.openmetadata.schema.type.Include;
import org.openmetadata.schema.type.TestDefinitionEntityType;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.jdbi3.CollectionDAO;
import org.openmetadata.service.jdbi3.ListFilter;
import org.openmetadata.service.jdbi3.TestDefinitionRepository;
@ -79,7 +79,7 @@ public class TestDefinitionResource extends EntityResource<TestDefinition, TestD
}
@SuppressWarnings("unused") // Method used for reflection
public void initialize(CatalogApplicationConfig config) throws IOException {
public void initialize(OpenMetadataApplicationConfig config) throws IOException {
// Find tag definitions and load tag categories from the json file, if necessary
List<String> testDefinitionFiles = EntityUtil.getJsonDataResources(".*json/data/tests/.*\\.json$");
testDefinitionFiles.forEach(

View File

@ -51,7 +51,7 @@ import org.openmetadata.schema.type.Include;
import org.openmetadata.schema.type.Webhook;
import org.openmetadata.schema.type.Webhook.Status;
import org.openmetadata.schema.type.WebhookType;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.jdbi3.CollectionDAO;
import org.openmetadata.service.jdbi3.CollectionDAO.WebhookDAO;
import org.openmetadata.service.jdbi3.ListFilter;
@ -92,7 +92,7 @@ public class WebhookResource extends EntityResource<Webhook, WebhookRepository>
}
@SuppressWarnings("unused") // Method used for reflection
public void initialize(CatalogApplicationConfig config) throws IOException {
public void initialize(OpenMetadataApplicationConfig config) throws IOException {
try {
List<String> listAllWebhooks = webhookDAO.listAllWebhooks(webhookDAO.getTableName());
List<Webhook> webhookList = JsonUtils.readObjects(listAllWebhooks, Webhook.class);

View File

@ -56,9 +56,9 @@ import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.schema.type.Function;
import org.openmetadata.schema.type.Include;
import org.openmetadata.schema.type.ResourceDescriptor;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.Entity;
import org.openmetadata.service.FunctionList;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.ResourceRegistry;
import org.openmetadata.service.jdbi3.CollectionDAO;
import org.openmetadata.service.jdbi3.ListFilter;
@ -96,7 +96,7 @@ public class PolicyResource extends EntityResource<Policy, PolicyRepository> {
}
@SuppressWarnings("unused") // Method is used for reflection
public void initialize(CatalogApplicationConfig config) throws IOException {
public void initialize(OpenMetadataApplicationConfig config) throws IOException {
// Load any existing rules from database, before loading seed data.
dao.initSeedDataFromResources();
ResourceRegistry.add(listOrEmpty(PolicyResource.getResourceDescriptors()));

View File

@ -60,8 +60,8 @@ import org.openmetadata.schema.services.connections.metadata.OpenMetadataServerC
import org.openmetadata.schema.type.EntityHistory;
import org.openmetadata.schema.type.Include;
import org.openmetadata.schema.type.MetadataOperation;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.airflow.AirflowRESTClient;
import org.openmetadata.service.jdbi3.CollectionDAO;
import org.openmetadata.service.jdbi3.IngestionPipelineRepository;
@ -85,7 +85,7 @@ import org.openmetadata.service.util.ResultList;
public class IngestionPipelineResource extends EntityResource<IngestionPipeline, IngestionPipelineRepository> {
public static final String COLLECTION_PATH = "v1/services/ingestionPipelines/";
private PipelineServiceClient pipelineServiceClient;
private CatalogApplicationConfig catalogApplicationConfig;
private OpenMetadataApplicationConfig openMetadataApplicationConfig;
private final SecretsManager secretsManager;
@Getter private final IngestionPipelineRepository ingestionPipelineRepository;
@ -103,9 +103,9 @@ public class IngestionPipelineResource extends EntityResource<IngestionPipeline,
this.ingestionPipelineRepository = new IngestionPipelineRepository(dao, secretsManager);
}
public void initialize(CatalogApplicationConfig config) {
this.catalogApplicationConfig = config;
this.pipelineServiceClient = new AirflowRESTClient(catalogApplicationConfig.getAirflowConfiguration());
public void initialize(OpenMetadataApplicationConfig config) {
this.openMetadataApplicationConfig = config;
this.pipelineServiceClient = new AirflowRESTClient(openMetadataApplicationConfig.getAirflowConfiguration());
dao.setPipelineServiceClient(pipelineServiceClient);
}
@ -498,7 +498,7 @@ public class IngestionPipelineResource extends EntityResource<IngestionPipeline,
testServiceConnection
.withConnection(secretsManager.storeTestConnectionObject(testServiceConnection))
.withSecretsManagerProvider(secretsManager.getSecretsManagerProvider())
.withClusterName(catalogApplicationConfig.getClusterName());
.withClusterName(openMetadataApplicationConfig.getClusterName());
HttpResponse<String> response = pipelineServiceClient.testConnection(testServiceConnection);
return Response.status(200, response.body()).build();
}
@ -586,8 +586,8 @@ public class IngestionPipelineResource extends EntityResource<IngestionPipeline,
private IngestionPipeline getIngestionPipeline(CreateIngestionPipeline create, String user) throws IOException {
OpenMetadataServerConnection openMetadataServerConnection =
secretsManager.decryptServerConnection(catalogApplicationConfig.getAirflowConfiguration());
openMetadataServerConnection.setClusterName(catalogApplicationConfig.getClusterName());
secretsManager.decryptServerConnection(openMetadataApplicationConfig.getAirflowConfiguration());
openMetadataServerConnection.setClusterName(openMetadataApplicationConfig.getClusterName());
openMetadataServerConnection.setSecretsManagerProvider(this.secretsManager.getSecretsManagerProvider());
return copy(new IngestionPipeline(), create, user)
.withPipelineType(create.getPipelineType())

View File

@ -47,7 +47,7 @@ import org.openmetadata.common.utils.CommonUtil;
import org.openmetadata.schema.filter.EventFilter;
import org.openmetadata.schema.filter.Filters;
import org.openmetadata.schema.settings.Settings;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.filter.FilterRegistry;
import org.openmetadata.service.jdbi3.CollectionDAO;
import org.openmetadata.service.jdbi3.SettingsRepository;
@ -70,7 +70,7 @@ public class SettingsResource {
private List<EventFilter> bootStrappedFilters;
@SuppressWarnings("unused") // Method used for reflection
public void initialize(CatalogApplicationConfig config) throws IOException {
public void initialize(OpenMetadataApplicationConfig config) throws IOException {
initSettings();
}

View File

@ -49,8 +49,8 @@ import org.openmetadata.schema.api.tags.CreateTagCategory;
import org.openmetadata.schema.entity.tags.Tag;
import org.openmetadata.schema.type.Include;
import org.openmetadata.schema.type.TagCategory;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.jdbi3.CollectionDAO;
import org.openmetadata.service.jdbi3.ListFilter;
import org.openmetadata.service.jdbi3.TagCategoryRepository;
@ -93,7 +93,7 @@ public class TagResource {
}
@SuppressWarnings("unused") // Method used for reflection
public void initialize(CatalogApplicationConfig config) throws IOException {
public void initialize(OpenMetadataApplicationConfig config) throws IOException {
// Find tag definitions and load tag categories from the json file, if necessary
List<String> tagFiles = EntityUtil.getJsonDataResources(".*json/data/tags/.*\\.json$");
tagFiles.forEach(

View File

@ -54,8 +54,8 @@ import org.openmetadata.schema.entity.teams.Role;
import org.openmetadata.schema.type.EntityHistory;
import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.schema.type.Include;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.jdbi3.CollectionDAO;
import org.openmetadata.service.jdbi3.ListFilter;
import org.openmetadata.service.jdbi3.RoleRepository;
@ -91,7 +91,7 @@ public class RoleResource extends EntityResource<Role, RoleRepository> {
}
@SuppressWarnings("unused") // Method used for reflection
public void initialize(CatalogApplicationConfig config) throws IOException {
public void initialize(OpenMetadataApplicationConfig config) throws IOException {
List<String> jsonFiles = EntityUtil.getJsonDataResources(String.format(".*json/data/%s/.*\\.json$", Entity.ROLE));
jsonFiles.forEach(
jsonFile -> {

View File

@ -54,8 +54,8 @@ import org.openmetadata.schema.api.teams.CreateTeam.TeamType;
import org.openmetadata.schema.entity.teams.Team;
import org.openmetadata.schema.type.EntityHistory;
import org.openmetadata.schema.type.Include;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.jdbi3.CollectionDAO;
import org.openmetadata.service.jdbi3.ListFilter;
import org.openmetadata.service.jdbi3.TeamRepository;
@ -91,7 +91,7 @@ public class TeamResource extends EntityResource<Team, TeamRepository> {
}
@SuppressWarnings("unused") // Method used for reflection
public void initialize(CatalogApplicationConfig config) throws IOException {
public void initialize(OpenMetadataApplicationConfig config) throws IOException {
dao.initOrganization();
}

View File

@ -55,8 +55,8 @@ import org.openmetadata.schema.entity.type.Category;
import org.openmetadata.schema.entity.type.CustomProperty;
import org.openmetadata.schema.type.EntityHistory;
import org.openmetadata.schema.type.Include;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.jdbi3.CollectionDAO;
import org.openmetadata.service.jdbi3.ListFilter;
import org.openmetadata.service.jdbi3.TypeRepository;
@ -89,7 +89,7 @@ public class TypeResource extends EntityResource<Type, TypeRepository> {
}
@SuppressWarnings("unused") // Method used for reflection
public void initialize(CatalogApplicationConfig config) throws IOException {
public void initialize(OpenMetadataApplicationConfig config) throws IOException {
// Load types defined in OpenMetadata schemas
long now = System.currentTimeMillis();
List<Type> types = JsonUtils.getTypes();

View File

@ -23,7 +23,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import lombok.extern.slf4j.Slf4j;
import org.openmetadata.schema.api.OpenMetadataServerVersion;
import org.openmetadata.service.CatalogApplication;
import org.openmetadata.service.OpenMetadataApplication;
import org.openmetadata.service.resources.Collection;
@Slf4j
@ -37,7 +37,7 @@ public class VersionResource {
static {
OPEN_METADATA_SERVER_VERSION = new OpenMetadataServerVersion();
try {
InputStream fileInput = CatalogApplication.class.getResourceAsStream("/catalog/VERSION");
InputStream fileInput = OpenMetadataApplication.class.getResourceAsStream("/catalog/VERSION");
Properties props = new Properties();
props.load(fileInput);
OPEN_METADATA_SERVER_VERSION.setVersion(props.getProperty("version", "unknown"));

View File

@ -16,7 +16,7 @@ import java.util.regex.Pattern;
import javax.ws.rs.core.Response;
import org.openmetadata.schema.api.services.ingestionPipelines.TestServiceConnection;
import org.openmetadata.schema.entity.services.ingestionPipelines.IngestionPipeline;
import org.openmetadata.service.CatalogApplication;
import org.openmetadata.service.OpenMetadataApplication;
import org.openmetadata.service.exception.PipelineServiceClientException;
import org.openmetadata.service.exception.PipelineServiceVersionException;
@ -92,7 +92,7 @@ public abstract class PipelineServiceClient {
}
public static String getServerVersion() throws IOException {
InputStream fileInput = CatalogApplication.class.getResourceAsStream("/catalog/VERSION");
InputStream fileInput = OpenMetadataApplication.class.getResourceAsStream("/catalog/VERSION");
Properties props = new Properties();
props.load(fileInput);
return props.getProperty("version", "unknown");

View File

@ -49,7 +49,7 @@ import org.openmetadata.schema.entity.teams.User;
import org.openmetadata.schema.teams.authn.GenerateTokenRequest;
import org.openmetadata.schema.teams.authn.JWTAuthMechanism;
import org.openmetadata.schema.teams.authn.JWTTokenExpiry;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.elasticsearch.ElasticSearchIndexDefinition;
import org.openmetadata.service.fernet.Fernet;
import org.openmetadata.service.jdbi3.CollectionDAO;
@ -143,9 +143,9 @@ public final class TablesInitializer {
String confFilePath = commandLine.getOptionValue(OPTION_CONFIG_FILE_PATH);
ObjectMapper objectMapper = Jackson.newObjectMapper();
Validator validator = Validators.newValidator();
YamlConfigurationFactory<CatalogApplicationConfig> factory =
new YamlConfigurationFactory<>(CatalogApplicationConfig.class, validator, objectMapper, "dw");
CatalogApplicationConfig config =
YamlConfigurationFactory<OpenMetadataApplicationConfig> factory =
new YamlConfigurationFactory<>(OpenMetadataApplicationConfig.class, validator, objectMapper, "dw");
OpenMetadataApplicationConfig config =
factory.build(
new SubstitutingSourceProvider(
new FileConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false)),
@ -212,7 +212,7 @@ public final class TablesInitializer {
}
private static void execute(
CatalogApplicationConfig config,
OpenMetadataApplicationConfig config,
Flyway flyway,
RestHighLevelClient client,
SchemaMigrationOption schemaMigrationOption)
@ -301,7 +301,7 @@ public final class TablesInitializer {
System.out.println(message);
}
private static void createIngestionBot(CatalogApplicationConfig config) {
private static void createIngestionBot(OpenMetadataApplicationConfig config) {
final Jdbi jdbi =
Jdbi.create(
config.getDataSourceFactory().getUrl(),
@ -346,7 +346,7 @@ public final class TablesInitializer {
}
}
private static void updateIngestionBot(CatalogApplicationConfig config) {
private static void updateIngestionBot(OpenMetadataApplicationConfig config) {
final Jdbi jdbi =
Jdbi.create(
config.getDataSourceFactory().getUrl(),

View File

@ -35,10 +35,10 @@ import org.openmetadata.service.security.policyevaluator.SubjectCache;
import org.testcontainers.containers.JdbcDatabaseContainer;
@Slf4j
public abstract class CatalogApplicationTest {
public abstract class OpenMetadataApplicationTest {
protected static final String CONFIG_PATH = ResourceHelpers.resourceFilePath("openmetadata-secure-test.yaml");
private static JdbcDatabaseContainer<?> SQL_CONTAINER;
public static DropwizardAppExtension<CatalogApplicationConfig> APP;
public static DropwizardAppExtension<OpenMetadataApplicationConfig> APP;
protected static final WebhookCallbackResource webhookCallbackResource = new WebhookCallbackResource();
public static final String FERNET_KEY_1 = "ihZpp5gmmDvVsgoOG6OVivKWwC9vd5JQ";
@ -76,7 +76,7 @@ public abstract class CatalogApplicationTest {
APP =
new DropwizardAppExtension<>(
CatalogApplication.class,
OpenMetadataApplication.class,
CONFIG_PATH,
// Database overrides
ConfigOverride.config("database.driverClass", SQL_CONTAINER.getDriverClassName()),

View File

@ -13,23 +13,23 @@ import org.openmetadata.schema.security.client.OktaSSOClientConfig;
import org.openmetadata.schema.security.client.OpenMetadataJWTClientConfig;
import org.openmetadata.schema.security.ssl.ValidateSSLClientConfig;
import org.openmetadata.schema.services.connections.metadata.OpenMetadataServerConnection;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.migration.MigrationConfiguration;
public class ConfigurationFixtures {
public static CatalogApplicationConfig buildCatalogApplicationConfig(
public static OpenMetadataApplicationConfig buildOpenMetadataApplicationConfig(
OpenMetadataServerConnection.AuthProvider authProvider) {
CatalogApplicationConfig catalogApplicationConfig = new CatalogApplicationConfig();
OpenMetadataApplicationConfig openMetadataApplicationConfig = new OpenMetadataApplicationConfig();
DataSourceFactory dataSourceFactory = new DataSourceFactory();
dataSourceFactory.setDriverClass("driverClass");
dataSourceFactory.setUrl("http://localhost");
MigrationConfiguration migrationConfiguration = new MigrationConfiguration();
migrationConfiguration.setPath("/fake/path");
catalogApplicationConfig.setDataSourceFactory(dataSourceFactory);
catalogApplicationConfig.setMigrationConfiguration(migrationConfiguration);
catalogApplicationConfig.setAirflowConfiguration(buildAirflowConfig(authProvider));
return catalogApplicationConfig;
openMetadataApplicationConfig.setDataSourceFactory(dataSourceFactory);
openMetadataApplicationConfig.setMigrationConfiguration(migrationConfiguration);
openMetadataApplicationConfig.setAirflowConfiguration(buildAirflowConfig(authProvider));
return openMetadataApplicationConfig;
}
public static AirflowConfiguration buildAirflowConfig(OpenMetadataServerConnection.AuthProvider authProvider) {

View File

@ -40,7 +40,7 @@ import org.openmetadata.schema.type.FieldChange;
import org.openmetadata.schema.type.TagLabel;
import org.openmetadata.schema.type.TagLabel.LabelType;
import org.openmetadata.schema.type.TagLabel.State;
import org.openmetadata.service.CatalogApplicationTest;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.databases.TableResourceTest;
import org.openmetadata.service.resources.feeds.MessageParser.EntityLink;
import org.openmetadata.service.util.ChangeEventParser;
@ -49,7 +49,7 @@ import org.openmetadata.service.util.JsonUtils;
@Slf4j
@TestInstance(Lifecycle.PER_CLASS)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class ChangeEventParserResourceTest extends CatalogApplicationTest {
class ChangeEventParserResourceTest extends OpenMetadataApplicationTest {
Table TABLE;

View File

@ -123,8 +123,8 @@ import org.openmetadata.schema.type.FieldChange;
import org.openmetadata.schema.type.Include;
import org.openmetadata.schema.type.MetadataOperation;
import org.openmetadata.schema.type.TagLabel;
import org.openmetadata.service.CatalogApplicationTest;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.exception.CatalogExceptionMessage;
import org.openmetadata.service.resources.databases.TableResourceTest;
import org.openmetadata.service.resources.dqtests.TestCaseResourceTest;
@ -154,7 +154,7 @@ import org.openmetadata.service.util.TestUtils;
@Slf4j
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public abstract class EntityResourceTest<T extends EntityInterface, K extends CreateEntity>
extends CatalogApplicationTest {
extends OpenMetadataApplicationTest {
private static final Map<String, EntityResourceTest<? extends EntityInterface, ? extends CreateEntity>>
ENTITY_RESOURCE_TEST_MAP = new HashMap<>();
private final String entityType;

View File

@ -32,25 +32,25 @@ import org.junit.jupiter.api.TestInstance;
import org.openmetadata.schema.api.security.AuthenticationConfiguration;
import org.openmetadata.schema.api.security.AuthorizerConfiguration;
import org.openmetadata.schema.api.slackChat.SlackChatConfiguration;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.CatalogApplicationTest;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.airflow.AirflowConfigurationForAPI;
import org.openmetadata.service.security.jwt.JWKSKey;
import org.openmetadata.service.security.jwt.JWKSResponse;
import org.openmetadata.service.util.TestUtils;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class ConfigResourceTest extends CatalogApplicationTest {
class ConfigResourceTest extends OpenMetadataApplicationTest {
static CatalogApplicationConfig config;
static OpenMetadataApplicationConfig config;
@BeforeAll
static void setup() throws IOException, ConfigurationException {
// Get config object from test yaml file
ObjectMapper objectMapper = Jackson.newObjectMapper();
Validator validator = Validators.newValidator();
YamlConfigurationFactory<CatalogApplicationConfig> factory =
new YamlConfigurationFactory<>(CatalogApplicationConfig.class, validator, objectMapper, "dw");
YamlConfigurationFactory<OpenMetadataApplicationConfig> factory =
new YamlConfigurationFactory<>(OpenMetadataApplicationConfig.class, validator, objectMapper, "dw");
config = factory.build(new FileConfigurationSourceProvider(), CONFIG_PATH);
}

View File

@ -119,8 +119,8 @@ import org.openmetadata.schema.type.TableProfilerConfig;
import org.openmetadata.schema.type.TableType;
import org.openmetadata.schema.type.TagLabel;
import org.openmetadata.schema.type.TagLabel.LabelType;
import org.openmetadata.service.CatalogApplicationTest;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.resources.databases.TableResource.TableList;
import org.openmetadata.service.resources.glossary.GlossaryResourceTest;
@ -1733,7 +1733,7 @@ public class TableResourceTest extends EntityResourceTest<Table, CreateTable> {
}
private void deleteAndCheckLocation(Table table, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource(String.format("tables/%s/location", table.getId()));
WebTarget target = OpenMetadataApplicationTest.getResource(String.format("tables/%s/location", table.getId()));
TestUtils.delete(target, authHeaders);
checkLocationDeleted(table.getId(), authHeaders);
}
@ -1745,7 +1745,7 @@ public class TableResourceTest extends EntityResourceTest<Table, CreateTable> {
public void addAndCheckLocation(Table table, UUID locationId, Status status, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource(String.format("tables/%s/location", table.getId()));
WebTarget target = OpenMetadataApplicationTest.getResource(String.format("tables/%s/location", table.getId()));
TestUtils.put(target, locationId, status, authHeaders);
// GET .../tables/{tableId} returns newly added location
@ -1894,70 +1894,70 @@ public class TableResourceTest extends EntityResourceTest<Table, CreateTable> {
public static Table putJoins(UUID tableId, TableJoins joins, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("tables/" + tableId + "/joins");
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/joins");
return TestUtils.put(target, joins, Table.class, OK, authHeaders);
}
public static Table putSampleData(UUID tableId, TableData data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("tables/" + tableId + "/sampleData");
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/sampleData");
return TestUtils.put(target, data, Table.class, OK, authHeaders);
}
public static Table putTableProfilerConfig(UUID tableId, TableProfilerConfig data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("tables/" + tableId + "/tableProfilerConfig");
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/tableProfilerConfig");
return TestUtils.put(target, data, Table.class, OK, authHeaders);
}
public static Table deleteTableProfilerConfig(UUID tableId, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("tables/" + tableId + "/tableProfilerConfig");
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/tableProfilerConfig");
return TestUtils.delete(target, Table.class, authHeaders);
}
public static Table putTableProfileData(UUID tableId, CreateTableProfile data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("tables/" + tableId + "/tableProfile");
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/tableProfile");
return TestUtils.put(target, data, Table.class, OK, authHeaders);
}
public static void deleteTableProfile(String fqn, String entityType, Long timestamp, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target =
CatalogApplicationTest.getResource("tables/" + fqn + "/" + entityType + "/" + timestamp + "/profile");
OpenMetadataApplicationTest.getResource("tables/" + fqn + "/" + entityType + "/" + timestamp + "/profile");
TestUtils.delete(target, authHeaders);
}
public static ResultList<TableProfile> getTableProfiles(String fqn, Integer limit, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("tables/" + fqn + "/tableProfile");
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + fqn + "/tableProfile");
target = limit != null ? target.queryParam("limit", limit) : target;
return TestUtils.get(target, TableResource.TableProfileList.class, authHeaders);
}
public static ResultList<ColumnProfile> getColumnProfiles(String fqn, Integer limit, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("tables/" + fqn + "/columnProfile");
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + fqn + "/columnProfile");
target = limit != null ? target.queryParam("limit", limit) : target;
return TestUtils.get(target, TableResource.ColumnProfileList.class, authHeaders);
}
public static Table putTableQueriesData(UUID tableId, SQLQuery data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("tables/" + tableId + "/tableQuery");
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/tableQuery");
return TestUtils.put(target, data, Table.class, OK, authHeaders);
}
public static Table putTableDataModel(UUID tableId, DataModel dataModel, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("tables/" + tableId + "/dataModel");
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/dataModel");
return TestUtils.put(target, dataModel, Table.class, OK, authHeaders);
}
public static Table putCustomMetric(UUID tableId, CreateCustomMetric data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("tables/" + tableId + "/customMetric");
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/customMetric");
return TestUtils.put(target, data, Table.class, OK, authHeaders);
}
@ -1965,7 +1965,7 @@ public class TableResourceTest extends EntityResourceTest<Table, CreateTable> {
UUID tableId, String columnName, String metricName, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target =
CatalogApplicationTest.getResource("tables/" + tableId + "/customMetric/" + columnName + "/" + metricName);
OpenMetadataApplicationTest.getResource("tables/" + tableId + "/customMetric/" + columnName + "/" + metricName);
return TestUtils.delete(target, Table.class, authHeaders);
}

View File

@ -44,8 +44,8 @@ import org.openmetadata.schema.type.ChangeDescription;
import org.openmetadata.schema.type.Column;
import org.openmetadata.schema.type.ColumnDataType;
import org.openmetadata.schema.type.MetadataOperation;
import org.openmetadata.service.CatalogApplicationTest;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.resources.databases.TableResourceTest;
import org.openmetadata.service.util.JsonUtils;
@ -351,7 +351,7 @@ public class TestCaseResourceTest extends EntityResourceTest<TestCase, CreateTes
public static void putTestCaseResult(String fqn, TestCaseResult data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("testCase/" + fqn + "/testCaseResult");
WebTarget target = OpenMetadataApplicationTest.getResource("testCase/" + fqn + "/testCaseResult");
TestUtils.put(target, data, CREATED, authHeaders);
}
@ -409,13 +409,13 @@ public class TestCaseResourceTest extends EntityResourceTest<TestCase, CreateTes
public static void deleteTestCaseResult(String fqn, Long timestamp, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("testCase/" + fqn + "/testCaseResult/" + timestamp);
WebTarget target = OpenMetadataApplicationTest.getResource("testCase/" + fqn + "/testCaseResult/" + timestamp);
TestUtils.delete(target, authHeaders);
}
public static ResultList<TestCaseResult> getTestCaseResults(
String fqn, Integer limit, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("testCase/" + fqn + "/testCaseResult");
WebTarget target = OpenMetadataApplicationTest.getResource("testCase/" + fqn + "/testCaseResult");
target = limit != null ? target.queryParam("limit", limit) : target;
return TestUtils.get(target, TestCaseResource.TestCaseResultList.class, authHeaders);
}
@ -423,7 +423,7 @@ public class TestCaseResourceTest extends EntityResourceTest<TestCase, CreateTes
public static ResultList<TestCase> getTestCases(
Integer limit, String fields, String link, Boolean includeAll, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("testCase");
WebTarget target = OpenMetadataApplicationTest.getResource("testCase");
target = limit != null ? target.queryParam("limit", limit) : target;
target = target.queryParam("fields", fields);
if (link != null) {
@ -438,7 +438,7 @@ public class TestCaseResourceTest extends EntityResourceTest<TestCase, CreateTes
public static ResultList<TestCase> getTestCases(
Integer limit, String fields, TestSuite testSuite, Boolean includeAll, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("testCase");
WebTarget target = OpenMetadataApplicationTest.getResource("testCase");
target = limit != null ? target.queryParam("limit", limit) : target;
target = target.queryParam("fields", fields);
target = target.queryParam("testSuiteId", testSuite.getId());

View File

@ -22,8 +22,8 @@ import org.openmetadata.schema.api.tests.CreateTestSuite;
import org.openmetadata.schema.tests.TestCase;
import org.openmetadata.schema.tests.TestSuite;
import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.service.CatalogApplicationTest;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.util.ResultList;
import org.openmetadata.service.util.TestUtils;
@ -107,7 +107,7 @@ public class TestSuiteResourceTest extends EntityResourceTest<TestSuite, CreateT
public static ResultList<TestSuite> getTestSuites(Integer limit, String fields, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("testSuite");
WebTarget target = OpenMetadataApplicationTest.getResource("testSuite");
target = limit != null ? target.queryParam("limit", limit) : target;
target = target.queryParam("fields", fields);
return TestUtils.get(target, TestSuiteResource.TestSuiteList.class, authHeaders);

View File

@ -99,8 +99,8 @@ import org.openmetadata.schema.type.TaskDetails;
import org.openmetadata.schema.type.TaskStatus;
import org.openmetadata.schema.type.TaskType;
import org.openmetadata.schema.type.ThreadType;
import org.openmetadata.service.CatalogApplicationTest;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.jdbi3.FeedRepository.FilterType;
import org.openmetadata.service.resources.databases.TableResourceTest;
import org.openmetadata.service.resources.feeds.FeedResource.PostList;
@ -114,7 +114,7 @@ import org.openmetadata.service.util.TestUtils;
@Slf4j
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class FeedResourceTest extends CatalogApplicationTest {
public class FeedResourceTest extends OpenMetadataApplicationTest {
public static Table TABLE;
public static Table TABLE2;
public static String TABLE_LINK;

View File

@ -53,8 +53,8 @@ import org.openmetadata.schema.type.EntityLineage;
import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.schema.type.LineageDetails;
import org.openmetadata.schema.type.MetadataOperation;
import org.openmetadata.service.CatalogApplicationTest;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.databases.TableResourceTest;
import org.openmetadata.service.resources.teams.RoleResource;
import org.openmetadata.service.resources.teams.RoleResourceTest;
@ -63,7 +63,7 @@ import org.openmetadata.service.util.TestUtils;
@Slf4j
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class LineageResourceTest extends CatalogApplicationTest {
public class LineageResourceTest extends OpenMetadataApplicationTest {
public static final List<Table> TABLES = new ArrayList<>();
public static final int TABLE_COUNT = 10;

View File

@ -40,8 +40,8 @@ import org.junit.jupiter.api.TestInfo;
import org.openmetadata.schema.api.data.CreateLocation;
import org.openmetadata.schema.entity.data.Location;
import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.service.CatalogApplicationTest;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.resources.locations.LocationResource.LocationList;
import org.openmetadata.service.util.FullyQualifiedName;
@ -106,7 +106,8 @@ public class LocationResourceTest extends EntityResourceTest<Location, CreateLoc
}
private List<EntityReference> getAssociatedEntity(Location location) throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource(String.format("locations/association/%s", location.getId()));
WebTarget target =
OpenMetadataApplicationTest.getResource(String.format("locations/association/%s", location.getId()));
return (List<EntityReference>) TestUtils.get(target, List.class, ADMIN_AUTH_HEADERS);
}

View File

@ -57,8 +57,8 @@ import org.openmetadata.schema.type.Permission;
import org.openmetadata.schema.type.Permission.Access;
import org.openmetadata.schema.type.ResourceDescriptor;
import org.openmetadata.schema.type.ResourcePermission;
import org.openmetadata.service.CatalogApplicationTest;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.ResourceRegistry;
import org.openmetadata.service.exception.CatalogExceptionMessage;
import org.openmetadata.service.resources.EntityResourceTest;
@ -72,7 +72,7 @@ import org.openmetadata.service.util.TestUtils;
@Slf4j
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class PermissionsResourceTest extends CatalogApplicationTest {
class PermissionsResourceTest extends OpenMetadataApplicationTest {
private static final String ORG_POLICY_NAME = "OrganizationPolicy";
private static List<Rule> ORG_RULES;

View File

@ -57,8 +57,8 @@ import org.openmetadata.schema.type.FieldChange;
import org.openmetadata.schema.type.Status;
import org.openmetadata.schema.type.StatusType;
import org.openmetadata.schema.type.Task;
import org.openmetadata.service.CatalogApplicationTest;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.resources.pipelines.PipelineResource.PipelineList;
import org.openmetadata.service.util.FullyQualifiedName;
@ -545,19 +545,19 @@ public class PipelineResourceTest extends EntityResourceTest<Pipeline, CreatePip
// Prepare Pipeline status endpoint for PUT
public static Pipeline putPipelineStatusData(String fqn, PipelineStatus data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("pipelines/" + fqn + "/status");
WebTarget target = OpenMetadataApplicationTest.getResource("pipelines/" + fqn + "/status");
return TestUtils.put(target, data, Pipeline.class, OK, authHeaders);
}
public static Pipeline deletePipelineStatus(String fqn, Long timestamp, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("pipelines/" + fqn + "/status/" + timestamp);
WebTarget target = OpenMetadataApplicationTest.getResource("pipelines/" + fqn + "/status/" + timestamp);
return TestUtils.delete(target, Pipeline.class, authHeaders);
}
public static ResultList<PipelineStatus> getPipelineStatues(
String fqn, Integer limit, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("pipelines/" + fqn + "/status");
WebTarget target = OpenMetadataApplicationTest.getResource("pipelines/" + fqn + "/status");
target = limit != null ? target.queryParam("limit", limit) : target;
return TestUtils.get(target, PipelineResource.PipelineStatusList.class, authHeaders);
}

View File

@ -51,8 +51,8 @@ import org.openmetadata.schema.entity.services.ingestionPipelines.PipelineType;
import org.openmetadata.schema.metadataIngestion.DatabaseServiceMetadataPipeline;
import org.openmetadata.schema.metadataIngestion.SourceConfig;
import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.airflow.AirflowRESTClient;
import org.openmetadata.service.jdbi3.CollectionDAO;
import org.openmetadata.service.jdbi3.EntityDAO;
@ -76,7 +76,7 @@ public class IngestionPipelineResourceUnitTest {
@Mock CollectionDAO collectionDAO;
@Mock CatalogApplicationConfig catalogApplicationConfig;
@Mock OpenMetadataApplicationConfig openMetadataApplicationConfig;
@Mock SecretsManager secretsManager;
@ -105,7 +105,7 @@ public class IngestionPipelineResourceUnitTest {
Map<String, String> expectedMap = Map.of("task", "log");
try (MockedConstruction<AirflowRESTClient> mocked =
mockConstruction(AirflowRESTClient.class, this::preparePipelineServiceClient)) {
ingestionPipelineResource.initialize(catalogApplicationConfig);
ingestionPipelineResource.initialize(openMetadataApplicationConfig);
assertEquals(
expectedMap, ingestionPipelineResource.getLastIngestionLogs(null, securityContext, DAG_ID).getEntity());
PipelineServiceClient client = mocked.constructed().get(0);
@ -118,7 +118,7 @@ public class IngestionPipelineResourceUnitTest {
TestServiceConnection testServiceConnection = new TestServiceConnection();
try (MockedConstruction<AirflowRESTClient> mocked =
mockConstruction(AirflowRESTClient.class, this::preparePipelineServiceClient)) {
ingestionPipelineResource.initialize(catalogApplicationConfig);
ingestionPipelineResource.initialize(openMetadataApplicationConfig);
PipelineServiceClient client = mocked.constructed().get(0);
HttpResponse<String> httpResponse = mock(HttpResponse.class);
when(client.testConnection(any())).thenReturn(httpResponse);

View File

@ -50,8 +50,8 @@ import org.openmetadata.schema.api.tags.CreateTagCategory.TagCategoryType;
import org.openmetadata.schema.entity.tags.Tag;
import org.openmetadata.schema.type.TagCategory;
import org.openmetadata.schema.type.TagLabel;
import org.openmetadata.service.CatalogApplicationTest;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.resources.tags.TagResource.CategoryList;
import org.openmetadata.service.util.EntityUtil;
@ -62,7 +62,7 @@ import org.openmetadata.service.util.TestUtils;
/** Tests not covered here: Tag category and Tag usage counts are covered in TableResourceTest */
@Slf4j
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class TagResourceTest extends CatalogApplicationTest {
public class TagResourceTest extends OpenMetadataApplicationTest {
public static String TAGS_URL;
public static TagCategory USER_TAG_CATEGORY;
public static Tag ADDRESS_TAG;

View File

@ -44,8 +44,8 @@ import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.schema.type.topic.CleanupPolicy;
import org.openmetadata.schema.type.topic.SchemaType;
import org.openmetadata.schema.type.topic.TopicSampleData;
import org.openmetadata.service.CatalogApplicationTest;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.resources.topics.TopicResource.TopicList;
import org.openmetadata.service.util.JsonUtils;
@ -301,7 +301,7 @@ public class TopicResourceTest extends EntityResourceTest<Topic, CreateTopic> {
public static Topic putSampleData(UUID topicId, TopicSampleData data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("topics/" + topicId + "/sampleData");
WebTarget target = OpenMetadataApplicationTest.getResource("topics/" + topicId + "/sampleData");
return TestUtils.put(target, data, Topic.class, OK, authHeaders);
}
}

View File

@ -50,8 +50,8 @@ import org.openmetadata.schema.entity.data.Table;
import org.openmetadata.schema.type.DailyCount;
import org.openmetadata.schema.type.EntityUsage;
import org.openmetadata.schema.type.UsageDetails;
import org.openmetadata.service.CatalogApplicationTest;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.databases.DatabaseResourceTest;
import org.openmetadata.service.resources.databases.TableResourceTest;
import org.openmetadata.service.util.RestUtil;
@ -59,7 +59,7 @@ import org.openmetadata.service.util.TestUtils;
@Slf4j
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class UsageResourceTest extends CatalogApplicationTest {
class UsageResourceTest extends OpenMetadataApplicationTest {
private static final String PUT = "PUT";
private static final String POST = "POST";
public static final List<Table> TABLES = new ArrayList<>();

View File

@ -28,7 +28,7 @@ import org.openmetadata.schema.api.tests.CreateTestSuite;
import org.openmetadata.schema.entity.data.Table;
import org.openmetadata.schema.util.EntitiesCount;
import org.openmetadata.schema.util.ServicesCount;
import org.openmetadata.service.CatalogApplicationTest;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.resources.dashboards.DashboardResourceTest;
import org.openmetadata.service.resources.databases.TableResourceTest;
@ -46,7 +46,7 @@ import org.openmetadata.service.util.TestUtils;
@Slf4j
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class UtilResourceTest extends CatalogApplicationTest {
public class UtilResourceTest extends OpenMetadataApplicationTest {
@BeforeAll
public static void setup(TestInfo test) throws IOException, URISyntaxException {
@ -55,12 +55,12 @@ public class UtilResourceTest extends CatalogApplicationTest {
}
public static EntitiesCount getEntitiesCount() throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("util/entities/count");
WebTarget target = OpenMetadataApplicationTest.getResource("util/entities/count");
return TestUtils.get(target, EntitiesCount.class, ADMIN_AUTH_HEADERS);
}
public static ServicesCount getServicesCount() throws HttpResponseException {
WebTarget target = CatalogApplicationTest.getResource("util/services/count");
WebTarget target = OpenMetadataApplicationTest.getResource("util/services/count");
return TestUtils.get(target, ServicesCount.class, ADMIN_AUTH_HEADERS);
}

View File

@ -12,7 +12,7 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.openmetadata.api.configuration.airflow.AuthConfiguration;
import org.openmetadata.schema.services.connections.metadata.OpenMetadataServerConnection;
import org.openmetadata.service.CatalogApplicationConfig;
import org.openmetadata.service.OpenMetadataApplicationConfig;
import org.openmetadata.service.fixtures.ConfigurationFixtures;
public class AirflowConfigValidationTest {
@ -27,31 +27,33 @@ public class AirflowConfigValidationTest {
@Test
void testOpenMetadataGoogleClientConfigValidation() {
CatalogApplicationConfig catalogApplicationConfig =
ConfigurationFixtures.buildCatalogApplicationConfig(OpenMetadataServerConnection.AuthProvider.GOOGLE);
catalogApplicationConfig.getAirflowConfiguration().setAuthConfig(ConfigurationFixtures.buildGoogleAuthConfig());
List<ConstraintViolation<CatalogApplicationConfig>> violations =
new ArrayList<>(validator.validate(catalogApplicationConfig));
OpenMetadataApplicationConfig openMetadataApplicationConfig =
ConfigurationFixtures.buildOpenMetadataApplicationConfig(OpenMetadataServerConnection.AuthProvider.GOOGLE);
openMetadataApplicationConfig
.getAirflowConfiguration()
.setAuthConfig(ConfigurationFixtures.buildGoogleAuthConfig());
List<ConstraintViolation<OpenMetadataApplicationConfig>> violations =
new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(0, violations.size());
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getGoogle().setSecretKey("");
violations = new ArrayList<>(validator.validate(catalogApplicationConfig));
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getGoogle().setSecretKey("");
violations = new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(1, violations.size());
assertEquals("\ngoogle SSO client config requires secretKey", violations.get(0).getMessage());
}
@Test
void testOpenMetadataOktaClientConfigValidation() {
CatalogApplicationConfig catalogApplicationConfig =
ConfigurationFixtures.buildCatalogApplicationConfig(OpenMetadataServerConnection.AuthProvider.OKTA);
catalogApplicationConfig.getAirflowConfiguration().setAuthConfig(ConfigurationFixtures.buildOktaAuthConfig());
List<ConstraintViolation<CatalogApplicationConfig>> violations =
new ArrayList<>(validator.validate(catalogApplicationConfig));
OpenMetadataApplicationConfig openMetadataApplicationConfig =
ConfigurationFixtures.buildOpenMetadataApplicationConfig(OpenMetadataServerConnection.AuthProvider.OKTA);
openMetadataApplicationConfig.getAirflowConfiguration().setAuthConfig(ConfigurationFixtures.buildOktaAuthConfig());
List<ConstraintViolation<OpenMetadataApplicationConfig>> violations =
new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(0, violations.size());
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getOkta().setClientId("");
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getOkta().setPrivateKey("");
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getOkta().setEmail("");
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getOkta().setOrgURL("");
violations = new ArrayList<>(validator.validate(catalogApplicationConfig));
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getOkta().setClientId("");
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getOkta().setPrivateKey("");
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getOkta().setEmail("");
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getOkta().setOrgURL("");
violations = new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(1, violations.size());
assertEquals(
"\nokta SSO client config requires clientId\n"
@ -63,16 +65,16 @@ public class AirflowConfigValidationTest {
@Test
void testOpenMetadataAuth0ClientConfigValidation() {
CatalogApplicationConfig catalogApplicationConfig =
ConfigurationFixtures.buildCatalogApplicationConfig(OpenMetadataServerConnection.AuthProvider.AUTH_0);
catalogApplicationConfig.getAirflowConfiguration().setAuthConfig(ConfigurationFixtures.buildAuth0Config());
List<ConstraintViolation<CatalogApplicationConfig>> violations =
new ArrayList<>(validator.validate(catalogApplicationConfig));
OpenMetadataApplicationConfig openMetadataApplicationConfig =
ConfigurationFixtures.buildOpenMetadataApplicationConfig(OpenMetadataServerConnection.AuthProvider.AUTH_0);
openMetadataApplicationConfig.getAirflowConfiguration().setAuthConfig(ConfigurationFixtures.buildAuth0Config());
List<ConstraintViolation<OpenMetadataApplicationConfig>> violations =
new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(0, violations.size());
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getAuth0().setClientId("");
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getAuth0().setSecretKey("");
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getAuth0().setDomain("");
violations = new ArrayList<>(validator.validate(catalogApplicationConfig));
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getAuth0().setClientId("");
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getAuth0().setSecretKey("");
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getAuth0().setDomain("");
violations = new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(1, violations.size());
assertEquals(
"\nauth0 SSO client config requires clientId\n"
@ -83,17 +85,17 @@ public class AirflowConfigValidationTest {
@Test
void testOpenMetadataAzureClientConfigValidation() {
CatalogApplicationConfig catalogApplicationConfig =
ConfigurationFixtures.buildCatalogApplicationConfig(OpenMetadataServerConnection.AuthProvider.AZURE);
catalogApplicationConfig.getAirflowConfiguration().setAuthConfig(ConfigurationFixtures.buildAzureAuthConfig());
List<ConstraintViolation<CatalogApplicationConfig>> violations =
new ArrayList<>(validator.validate(catalogApplicationConfig));
OpenMetadataApplicationConfig openMetadataApplicationConfig =
ConfigurationFixtures.buildOpenMetadataApplicationConfig(OpenMetadataServerConnection.AuthProvider.AZURE);
openMetadataApplicationConfig.getAirflowConfiguration().setAuthConfig(ConfigurationFixtures.buildAzureAuthConfig());
List<ConstraintViolation<OpenMetadataApplicationConfig>> violations =
new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(0, violations.size());
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getAzure().setClientId("");
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getAzure().setClientSecret("");
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getAzure().setAuthority("");
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getAzure().setScopes(List.of());
violations = new ArrayList<>(validator.validate(catalogApplicationConfig));
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getAzure().setClientId("");
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getAzure().setClientSecret("");
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getAzure().setAuthority("");
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getAzure().setScopes(List.of());
violations = new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(1, violations.size());
assertEquals(
"\nazure SSO client config requires clientId\n"
@ -105,16 +107,18 @@ public class AirflowConfigValidationTest {
@Test
void testOpenMetadataCustomOIDCClientConfigValidation() {
CatalogApplicationConfig catalogApplicationConfig =
ConfigurationFixtures.buildCatalogApplicationConfig(OpenMetadataServerConnection.AuthProvider.CUSTOM_OIDC);
catalogApplicationConfig.getAirflowConfiguration().setAuthConfig(ConfigurationFixtures.buildCustomOIDCConfig());
List<ConstraintViolation<CatalogApplicationConfig>> violations =
new ArrayList<>(validator.validate(catalogApplicationConfig));
OpenMetadataApplicationConfig openMetadataApplicationConfig =
ConfigurationFixtures.buildOpenMetadataApplicationConfig(OpenMetadataServerConnection.AuthProvider.CUSTOM_OIDC);
openMetadataApplicationConfig
.getAirflowConfiguration()
.setAuthConfig(ConfigurationFixtures.buildCustomOIDCConfig());
List<ConstraintViolation<OpenMetadataApplicationConfig>> violations =
new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(0, violations.size());
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getCustomOidc().setClientId("");
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getCustomOidc().setSecretKey("");
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getCustomOidc().setTokenEndpoint("");
violations = new ArrayList<>(validator.validate(catalogApplicationConfig));
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getCustomOidc().setClientId("");
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getCustomOidc().setSecretKey("");
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getCustomOidc().setTokenEndpoint("");
violations = new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(1, violations.size());
assertEquals(
"\ncustom-oidc SSO client config requires clientId\n"
@ -125,16 +129,18 @@ public class AirflowConfigValidationTest {
@Test
void testOpenMetadataNoAuthClientConfigValidation() {
CatalogApplicationConfig catalogApplicationConfig =
ConfigurationFixtures.buildCatalogApplicationConfig(OpenMetadataServerConnection.AuthProvider.CUSTOM_OIDC);
catalogApplicationConfig.getAirflowConfiguration().setAuthConfig(ConfigurationFixtures.buildCustomOIDCConfig());
List<ConstraintViolation<CatalogApplicationConfig>> violations =
new ArrayList<>(validator.validate(catalogApplicationConfig));
OpenMetadataApplicationConfig openMetadataApplicationConfig =
ConfigurationFixtures.buildOpenMetadataApplicationConfig(OpenMetadataServerConnection.AuthProvider.CUSTOM_OIDC);
openMetadataApplicationConfig
.getAirflowConfiguration()
.setAuthConfig(ConfigurationFixtures.buildCustomOIDCConfig());
List<ConstraintViolation<OpenMetadataApplicationConfig>> violations =
new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(0, violations.size());
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getCustomOidc().setClientId("");
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getCustomOidc().setSecretKey("");
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getCustomOidc().setTokenEndpoint("");
violations = new ArrayList<>(validator.validate(catalogApplicationConfig));
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getCustomOidc().setClientId("");
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getCustomOidc().setSecretKey("");
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getCustomOidc().setTokenEndpoint("");
violations = new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(1, violations.size());
assertEquals(
"\ncustom-oidc SSO client config requires clientId\n"
@ -145,37 +151,38 @@ public class AirflowConfigValidationTest {
@Test
void testOpenMetadataOpenmetadataClientConfigValidation() {
CatalogApplicationConfig catalogApplicationConfig =
ConfigurationFixtures.buildCatalogApplicationConfig(OpenMetadataServerConnection.AuthProvider.OPENMETADATA);
catalogApplicationConfig
OpenMetadataApplicationConfig openMetadataApplicationConfig =
ConfigurationFixtures.buildOpenMetadataApplicationConfig(
OpenMetadataServerConnection.AuthProvider.OPENMETADATA);
openMetadataApplicationConfig
.getAirflowConfiguration()
.setAuthConfig(ConfigurationFixtures.buildOpenmetadataAuthConfig());
List<ConstraintViolation<CatalogApplicationConfig>> violations =
new ArrayList<>(validator.validate(catalogApplicationConfig));
List<ConstraintViolation<OpenMetadataApplicationConfig>> violations =
new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(0, violations.size());
catalogApplicationConfig.getAirflowConfiguration().getAuthConfig().getOpenmetadata().setJwtToken("");
violations = new ArrayList<>(validator.validate(catalogApplicationConfig));
openMetadataApplicationConfig.getAirflowConfiguration().getAuthConfig().getOpenmetadata().setJwtToken("");
violations = new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(1, violations.size());
assertEquals("\nopenmetadata SSO client config requires jwtToken", violations.get(0).getMessage());
}
@Test
void testNoAuthClientConfigValidation() {
CatalogApplicationConfig catalogApplicationConfig =
ConfigurationFixtures.buildCatalogApplicationConfig(OpenMetadataServerConnection.AuthProvider.NO_AUTH);
catalogApplicationConfig.getAirflowConfiguration().setAuthConfig(new AuthConfiguration());
List<ConstraintViolation<CatalogApplicationConfig>> violations =
new ArrayList<>(validator.validate(catalogApplicationConfig));
OpenMetadataApplicationConfig openMetadataApplicationConfig =
ConfigurationFixtures.buildOpenMetadataApplicationConfig(OpenMetadataServerConnection.AuthProvider.NO_AUTH);
openMetadataApplicationConfig.getAirflowConfiguration().setAuthConfig(new AuthConfiguration());
List<ConstraintViolation<OpenMetadataApplicationConfig>> violations =
new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(0, violations.size());
}
@Test
void testAuthClientConfiguredWithoutConfigValidation() {
CatalogApplicationConfig catalogApplicationConfig =
ConfigurationFixtures.buildCatalogApplicationConfig(OpenMetadataServerConnection.AuthProvider.GOOGLE);
catalogApplicationConfig.getAirflowConfiguration().setAuthConfig(null);
List<ConstraintViolation<CatalogApplicationConfig>> violations =
new ArrayList<>(validator.validate(catalogApplicationConfig));
OpenMetadataApplicationConfig openMetadataApplicationConfig =
ConfigurationFixtures.buildOpenMetadataApplicationConfig(OpenMetadataServerConnection.AuthProvider.GOOGLE);
openMetadataApplicationConfig.getAirflowConfiguration().setAuthConfig(null);
List<ConstraintViolation<OpenMetadataApplicationConfig>> violations =
new ArrayList<>(validator.validate(openMetadataApplicationConfig));
assertEquals(1, violations.size());
assertEquals("\ngoogle SSO client config requires authConfig section", violations.get(0).getMessage());
}