Skip to content

Commit

Permalink
move test case to sqlserver.source.utils
Browse files Browse the repository at this point in the history
  • Loading branch information
Kael committed Jul 29, 2024
1 parent 86ca43f commit 546b5ae
Showing 1 changed file with 8 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package org.apache.flink.cdc.connectors.sqlserver.testutils;
package org.apache.flink.cdc.connectors.sqlserver.source.utils;

import org.apache.flink.cdc.connectors.base.utils.ObjectUtils;
import org.apache.flink.cdc.connectors.sqlserver.source.utils.SqlServerUtils;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class SqlserverCompareUuidTest {
private static final Logger LOG = LoggerFactory.getLogger(SqlserverCompareUuidTest.class);
@Test
public void testWorkWithGuids() throws Exception {
// Create an ArrayList and fill it with Guid values.
Expand All @@ -20,23 +17,12 @@ public void testWorkWithGuids() throws Exception {
guidList.add(UUID.fromString("2AAAAAAA-BBBB-CCCC-DDDD-1EEEEEEEEEEE"));
guidList.add(UUID.fromString("1AAAAAAA-BBBB-CCCC-DDDD-3EEEEEEEEEEE"));

// Display the unsorted Guid values.
LOG.info("Unsorted Guids:");
for (UUID uuid : guidList) {
LOG.info("{}", uuid);
}

LOG.info("");

// Sort the Guids.
guidList.sort(ObjectUtils::compare);

// Display the sorted Guid values.
LOG.info("Sorted Guids:");
for (UUID uuid : guidList) {
LOG.info("{}", uuid);
}
LOG.info("");
Assert.assertEquals(guidList.get(0).toString().toUpperCase(), "1AAAAAAA-BBBB-CCCC-DDDD-3EEEEEEEEEEE");
Assert.assertEquals(guidList.get(1).toString().toUpperCase(), "2AAAAAAA-BBBB-CCCC-DDDD-1EEEEEEEEEEE");
Assert.assertEquals(guidList.get(2).toString().toUpperCase(), "3AAAAAAA-BBBB-CCCC-DDDD-2EEEEEEEEEEE");

// Create an ArrayList of SqlGuids.
List<UUID> sqlGuidList = new ArrayList<>();
Expand All @@ -50,9 +36,8 @@ public void testWorkWithGuids() throws Exception {

// Display the sorted SqlGuids. The sorted SqlGuid values are ordered
// differently than the Guid values.
LOG.info("Sorted SqlGuids:");
for (UUID uuid : sqlGuidList) {
LOG.info("{}", uuid);
}
Assert.assertEquals(sqlGuidList.get(0).toString().toUpperCase(), "2AAAAAAA-BBBB-CCCC-DDDD-1EEEEEEEEEEE");
Assert.assertEquals(sqlGuidList.get(1).toString().toUpperCase(), "3AAAAAAA-BBBB-CCCC-DDDD-2EEEEEEEEEEE");
Assert.assertEquals(sqlGuidList.get(2).toString().toUpperCase(), "1AAAAAAA-BBBB-CCCC-DDDD-3EEEEEEEEEEE");
}
}

0 comments on commit 546b5ae

Please sign in to comment.