mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-05 07:38:26 +00:00
This commit is contained in:
parent
f7cc5160cc
commit
001ec69b09
@ -107,7 +107,19 @@ public final class Entity {
|
|||||||
//
|
//
|
||||||
// List of entities whose changes should not be published to the Activity Feed
|
// List of entities whose changes should not be published to the Activity Feed
|
||||||
//
|
//
|
||||||
public static final List<String> ACTIVITY_FEED_EXCLUDED_ENTITIES = List.of(USER, TEAM, ROLE, POLICY, BOTS);
|
public static final List<String> ACTIVITY_FEED_EXCLUDED_ENTITIES =
|
||||||
|
List.of(
|
||||||
|
USER,
|
||||||
|
TEAM,
|
||||||
|
ROLE,
|
||||||
|
POLICY,
|
||||||
|
BOTS,
|
||||||
|
AIRFLOW_PIPELINE,
|
||||||
|
DATABASE_SERVICE,
|
||||||
|
PIPELINE_SERVICE,
|
||||||
|
DASHBOARD_SERVICE,
|
||||||
|
STORAGE_SERVICE,
|
||||||
|
MESSAGING_SERVICE);
|
||||||
|
|
||||||
private Entity() {}
|
private Entity() {}
|
||||||
|
|
||||||
|
@ -18,11 +18,13 @@ import static org.openmetadata.catalog.fernet.Fernet.decryptIfTokenized;
|
|||||||
import static org.openmetadata.catalog.fernet.Fernet.isTokenized;
|
import static org.openmetadata.catalog.fernet.Fernet.isTokenized;
|
||||||
import static org.openmetadata.catalog.util.EntityUtil.toBoolean;
|
import static org.openmetadata.catalog.util.EntityUtil.toBoolean;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import org.openmetadata.catalog.Entity;
|
import org.openmetadata.catalog.Entity;
|
||||||
import org.openmetadata.catalog.entity.services.DatabaseService;
|
import org.openmetadata.catalog.entity.services.DatabaseService;
|
||||||
@ -275,5 +277,24 @@ public class DatabaseServiceRepository extends EntityRepository<DatabaseService>
|
|||||||
public DatabaseServiceUpdater(DatabaseService original, DatabaseService updated, Operation operation) {
|
public DatabaseServiceUpdater(DatabaseService original, DatabaseService updated, Operation operation) {
|
||||||
super(original, updated, operation);
|
super(original, updated, operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void entitySpecificUpdate() throws IOException {
|
||||||
|
updateDatabaseConnectionConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateDatabaseConnectionConfig() throws JsonProcessingException {
|
||||||
|
DatabaseConnection origConn = original.getEntity().getDatabaseConnection();
|
||||||
|
DatabaseConnection updatedConn = updated.getEntity().getDatabaseConnection();
|
||||||
|
if (origConn != null
|
||||||
|
&& updatedConn != null
|
||||||
|
&& Objects.equals(
|
||||||
|
Fernet.decryptIfTokenized(origConn.getPassword()),
|
||||||
|
Fernet.decryptIfTokenized(updatedConn.getPassword()))) {
|
||||||
|
// Password in clear didn't change. The tokenized changed because it's time-dependent.
|
||||||
|
updatedConn.setPassword(origConn.getPassword());
|
||||||
|
}
|
||||||
|
recordChange("databaseConnection", origConn, updatedConn, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,11 +120,14 @@ public class DatabaseServiceResourceTest extends EntityResourceTest<DatabaseServ
|
|||||||
databaseConnection.withConnectionArguments(connectionArguments).withConnectionOptions(connectionOptions);
|
databaseConnection.withConnectionArguments(connectionArguments).withConnectionOptions(connectionOptions);
|
||||||
update.withDatabaseConnection(databaseConnection);
|
update.withDatabaseConnection(databaseConnection);
|
||||||
service = updateEntity(update, OK, ADMIN_AUTH_HEADERS);
|
service = updateEntity(update, OK, ADMIN_AUTH_HEADERS);
|
||||||
|
// Get the recently updated entity and verify the changes
|
||||||
|
service = getEntity(service.getId(), ADMIN_AUTH_HEADERS);
|
||||||
assertEquals(databaseConnection, service.getDatabaseConnection());
|
assertEquals(databaseConnection, service.getDatabaseConnection());
|
||||||
|
assertEquals("description1", service.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void put_addIngestion_as_admin_2xx(TestInfo test) throws IOException, ParseException {
|
void put_addIngestion_as_admin_2xx(TestInfo test) throws IOException {
|
||||||
DatabaseService service = createAndCheckEntity(createRequest(test).withDescription(null), ADMIN_AUTH_HEADERS);
|
DatabaseService service = createAndCheckEntity(createRequest(test).withDescription(null), ADMIN_AUTH_HEADERS);
|
||||||
EntityReference serviceRef = new DatabaseServiceEntityInterface(service).getEntityReference();
|
EntityReference serviceRef = new DatabaseServiceEntityInterface(service).getEntityReference();
|
||||||
|
|
||||||
@ -142,6 +145,8 @@ public class DatabaseServiceResourceTest extends EntityResourceTest<DatabaseServ
|
|||||||
.withUsername("username");
|
.withUsername("username");
|
||||||
update.withDatabaseConnection(databaseConnection);
|
update.withDatabaseConnection(databaseConnection);
|
||||||
service = updateEntity(update, OK, ADMIN_AUTH_HEADERS);
|
service = updateEntity(update, OK, ADMIN_AUTH_HEADERS);
|
||||||
|
// Get the recently updated entity and verify the changes
|
||||||
|
service = getEntity(service.getId(), ADMIN_AUTH_HEADERS);
|
||||||
assertEquals(databaseConnection, service.getDatabaseConnection());
|
assertEquals(databaseConnection, service.getDatabaseConnection());
|
||||||
ConnectionArguments connectionArguments =
|
ConnectionArguments connectionArguments =
|
||||||
new ConnectionArguments()
|
new ConnectionArguments()
|
||||||
@ -152,6 +157,8 @@ public class DatabaseServiceResourceTest extends EntityResourceTest<DatabaseServ
|
|||||||
databaseConnection.withConnectionArguments(connectionArguments).withConnectionOptions(connectionOptions);
|
databaseConnection.withConnectionArguments(connectionArguments).withConnectionOptions(connectionOptions);
|
||||||
update.withDatabaseConnection(databaseConnection);
|
update.withDatabaseConnection(databaseConnection);
|
||||||
service = updateEntity(update, OK, ADMIN_AUTH_HEADERS);
|
service = updateEntity(update, OK, ADMIN_AUTH_HEADERS);
|
||||||
|
// Get the recently updated entity and verify the changes
|
||||||
|
service = getEntity(service.getId(), ADMIN_AUTH_HEADERS);
|
||||||
assertEquals(databaseConnection, service.getDatabaseConnection());
|
assertEquals(databaseConnection, service.getDatabaseConnection());
|
||||||
|
|
||||||
AirflowPipelineResourceTest airflowPipelineResourceTest = new AirflowPipelineResourceTest();
|
AirflowPipelineResourceTest airflowPipelineResourceTest = new AirflowPipelineResourceTest();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user