Skip to content

Commit

Permalink
Upgrade to Debezium 1.2.0.Beta2 apache#1418
Browse files Browse the repository at this point in the history
  • Loading branch information
JiriOndrusek committed Jun 26, 2020
1 parent d82a7a4 commit a67971e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 20 deletions.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public abstract class AbstractDebeziumTest {
private static String COMPANY_2 = "Even Better Company";
private static String CITY_1 = "Prague";
private static String CITY_2 = "Paris";
private static int REPEAT_COUNT = 3;
public static int REPEAT_COUNT = 3;

/**
* Each impleentation is responsible for connection creation and its closure.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,25 @@ protected String getCompanyTableName() {
@Order(0)
@EnabledIfSystemProperty(named = PROPERTY_JDBC, matches = ".*")
public void testReceiveInitCompany() {
//receive first record (operation r) for the init company - using larger timeout
Response response = receiveResponse("/receiveAsRecord");
int i = 0;

response.then()
.statusCode(200);
while (i++ < AbstractDebeziumTest.REPEAT_COUNT) {
//receive first record (operation r) for the init company - using larger timeout
Response response = receiveResponse("/receiveAsRecord");

Record record = response.getBody().as(Record.class);
Assert.assertEquals("r", record.getOperation());
Assert.assertEquals("Struct{NAME=init,CITY=init}", record.getValue());
response.then()
.statusCode(200);

Record record = response.getBody().as(Record.class);

if (record.getOperation() == null) {
continue;
}

Assert.assertEquals("r", record.getOperation());
Assert.assertEquals("Struct{NAME=init,CITY=init}", record.getValue());
break;
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ public Map<String, String> start() {
return Collections.emptyMap();
}

Map<String, String> properties = super.start();
Map<String, String> properties;
try {
properties = super.start();
} catch (Exception e) {
LOG.warn("If initSqlScript.sql fails with the message 'The error returned was 14258: " +
"'Cannot perform this operation while SQLServerAgent is starting.', " +
"please increase a delay interval in the script.");
throw e;
}

try {
historyFile = Files.createTempFile(getClass().getSimpleName() + "-history-file-", "");
Expand Down
17 changes: 7 additions & 10 deletions integration-tests/debezium/src/test/resources/initSqlserver.sql
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,15 @@ CREATE TABLE Test.COMPANY(
CITY varchar(255),
PRIMARY KEY (NAME)
);
-- by using system property, sql agent is started, but it could happen that it is not running yet, which will fail
-- during setting of cdc for table. We are waiting for max 20 seconds if service is running
DECLARE @Counter INT
SET @Counter=1
WHILE (SELECT dss.[status] FROM sys.dm_server_services dss WHERE dss.[servicename] LIKE N'SQL Server Agent (%') != 4 AND @Counter <= 20
BEGIN
WAITFOR DELAY '00:00:01'
SET @Counter = @Counter + 1
END
-- sql agent is started by providing of the system property, but it could happen that it is still starting during this
-- execution. In that case, this script fails during setting of cdc for table. In case of failure because of:
-- 'The error returned was 14258: Cannot perform this operation while SQLServerAgent is starting.'
-- please increase following delay accordingly
WAITFOR DELAY '00:00:10'

INSERT INTO Test.COMPANY (name, city) VALUES ('init', 'init');
EXEC sys.sp_cdc_enable_table @source_schema=N'Test', @source_name=N'COMPANY', @role_name = NULL,@filegroup_name=N'PRIMARY', @supports_net_changes=0;
INSERT INTO Test.COMPANY (name, city) VALUES ('init', 'init');




2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<awssdk1-swf-libs.version>1.11.22</awssdk1-swf-libs.version>
<awssdk2.version>2.13.33</awssdk2.version>
<camel.version>3.4.0</camel.version>
<debezium.version>1.1.2.Final</debezium.version>
<debezium.version>1.2.0.Final</debezium.version>
<elasticsearch.version>7.6.1</elasticsearch.version>
<freemarker.version>2.3.30</freemarker.version>
<github-api.version>1.111</github-api.version>
Expand Down

0 comments on commit a67971e

Please sign in to comment.