Search in sources :

Example 1 with CollectionMeta

use of org.apache.connect.mongo.initsync.CollectionMeta in project rocketmq-externals by apache.

the class FilterTest method testAsterisk.

@Test
public void testAsterisk() {
    List<String> collections = new ArrayList<>();
    collections.add("*");
    insterest.put("test", collections);
    sourceTaskConfig.setInterestDbAndCollection(JSONObject.toJSONString(insterest));
    OperationFilter operationFilter = new OperationFilter(sourceTaskConfig);
    Assert.assertTrue(operationFilter.filterMeta(new CollectionMeta("test", "testsad")));
    Assert.assertTrue(operationFilter.filterMeta(new CollectionMeta("test", "tests032")));
}
Also used : OperationFilter(org.apache.connect.mongo.replicator.OperationFilter) ArrayList(java.util.ArrayList) CollectionMeta(org.apache.connect.mongo.initsync.CollectionMeta) Test(org.junit.Test)

Example 2 with CollectionMeta

use of org.apache.connect.mongo.initsync.CollectionMeta in project rocketmq-externals by apache.

the class FilterTest method testBlankDb.

@Test
public void testBlankDb() {
    OperationFilter operationFilter = new OperationFilter(sourceTaskConfig);
    Assert.assertTrue(operationFilter.filterMeta(new CollectionMeta("test", "test")));
    Assert.assertTrue(operationFilter.filterMeta(new CollectionMeta("test1", "test01")));
}
Also used : OperationFilter(org.apache.connect.mongo.replicator.OperationFilter) CollectionMeta(org.apache.connect.mongo.initsync.CollectionMeta) Test(org.junit.Test)

Example 3 with CollectionMeta

use of org.apache.connect.mongo.initsync.CollectionMeta in project rocketmq-externals by apache.

the class FilterTest method testSpecialDb.

@Test
public void testSpecialDb() {
    List<String> collections = new ArrayList<>();
    collections.add("person");
    insterest.put("test", collections);
    sourceTaskConfig.setInterestDbAndCollection(JSONObject.toJSONString(insterest));
    OperationFilter operationFilter = new OperationFilter(sourceTaskConfig);
    Assert.assertTrue(operationFilter.filterMeta(new CollectionMeta("test", "person")));
    Assert.assertFalse(operationFilter.filterMeta(new CollectionMeta("test", "person01")));
}
Also used : OperationFilter(org.apache.connect.mongo.replicator.OperationFilter) ArrayList(java.util.ArrayList) CollectionMeta(org.apache.connect.mongo.initsync.CollectionMeta) Test(org.junit.Test)

Aggregations

CollectionMeta (org.apache.connect.mongo.initsync.CollectionMeta)3 OperationFilter (org.apache.connect.mongo.replicator.OperationFilter)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2