Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class ConnectionEntity {
@Column(unique = true, nullable = false)
private String name;

private String description;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private Type type;
Expand Down Expand Up @@ -87,6 +89,14 @@ public void setName(String name) {
this.name = name;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public Type getType() {
return type;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public interface Connection extends NamedView {

void setName(String name);

String getDescription();

void setDescription(String description);

ConnectionEntity.Type getType();

void setType(ConnectionEntity.Type type);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- DBZ-1245 Add description field to connection table
alter table if exists connection add column description varchar(255);
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;

import org.junit.jupiter.api.Test;

Expand All @@ -21,6 +22,7 @@ private String createTestConnectionJson(String nameSuffix) {
return """
{
"name": "test-connection-%s",
"description": "Test connection description",
"type": "POSTGRESQL",
"config": {
"host": "localhost",
Expand All @@ -37,6 +39,7 @@ private String createUpdatedConnectionJson(Integer id, String nameSuffix) {
{
"id": %d,
"name": "updated-connection-%s",
"description": "Updated connection description",
"type": "POSTGRESQL",
"config": {
"host": "updated-host",
Expand Down Expand Up @@ -74,12 +77,47 @@ public void testCreateConnection() {
.header("Location", notNullValue())
.body("id", notNullValue())
.body("name", is("test-connection-" + nameSuffix))
.body("description", is("Test connection description"))
.body("type", is("POSTGRESQL"))
.body("config.host", is("localhost"))
.body("config.port", is(5432))
.body("config.username", is("testuser"));
}

@Test
public void testCreateConnection_WithoutDescription() {
String nameSuffix = String.valueOf(System.currentTimeMillis());
String json = """
{
"name": "test-connection-no-desc-%s",
"type": "POSTGRESQL",
"config": {
"host": "localhost",
"port": 5432,
"username": "testuser",
"password": "testpass"
}
}
""".formatted(nameSuffix);

Integer connectionId = given()
.contentType(ContentType.JSON)
.body(json)
.when()
.post("api/connections")
.then()
.statusCode(201)
.contentType(ContentType.JSON)
.body("id", notNullValue())
.body("name", is("test-connection-no-desc-" + nameSuffix))
.body("description", nullValue())
.body("type", is("POSTGRESQL"))
.extract()
.path("id");

cleanUp(connectionId);
}

@Test
public void testGetConnectionById() {
String nameSuffix = String.valueOf(System.currentTimeMillis());
Expand All @@ -103,6 +141,7 @@ public void testGetConnectionById() {
.statusCode(200)
.body("id", is(connectionId.intValue()))
.body("name", is("test-connection-" + nameSuffix))
.body("description", is("Test connection description"))
.body("type", is("POSTGRESQL"))
.body("config.host", is("localhost"))
.body("config.port", is(5432))
Expand Down Expand Up @@ -149,6 +188,7 @@ public void testUpdateConnection() {
.statusCode(200)
.body("id", is(connectionId.intValue()))
.body("name", is("updated-connection-" + updatedNameSuffix))
.body("description", is("Updated connection description"))
.body("config.host", is("updated-host"))
.body("config.port", is(5433))
.body("config.username", is("updateduser"));
Expand Down
2 changes: 2 additions & 0 deletions debezium-platform-stage/src/__mocks__/data/Connections.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"username": "debezium",
"additional-key": "additional-val"
},
"description": "MariaDB connection for testing",
"name": "mariaconnection",
"type": "MARIADB"
},
Expand All @@ -17,6 +18,7 @@
"config": {
"test-value": "test-key"
},
"description": "Kinesis connection for streaming",
"name": "kinesis-connection",
"type": "AMAZON_KINESIS"
}
Expand Down
2 changes: 2 additions & 0 deletions debezium-platform-stage/src/apis/apis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export type ConnectionPayload = {
type: string;
id?: string;
config: ConnectionUnknownConfig | ConnectionAdditionalConfig;
description?: string;
name: string;
};

Expand Down Expand Up @@ -132,6 +133,7 @@ export type ConnectionSchema = {
export type Connection = {
type: string;
config: ConnectionUnknownConfig;
description?: string;
name: string;
id: number;
};
Expand Down
Loading