You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/07/18 09:11:41 UTC
[shardingsphere] branch master updated: Create MemoryPipelineChannelCreatorTest.java (#19286)
This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 4b600fceff5 Create MemoryPipelineChannelCreatorTest.java (#19286)
4b600fceff5 is described below
commit 4b600fceff52e0201eb33d09159f659bc77590d8
Author: skai <su...@gmail.com>
AuthorDate: Mon Jul 18 17:11:27 2022 +0800
Create MemoryPipelineChannelCreatorTest.java (#19286)
* Create MemoryPipelineChannelCreatorTest.java
* change from review
---
.../memory/MemoryPipelineChannelCreatorTest.java | 51 ++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/channel/memory/MemoryPipelineChannelCreatorTest.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/channel/memory/MemoryPipelineChannelCreatorTest.java
new file mode 100644
index 00000000000..38240ec7861
--- /dev/null
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/channel/memory/MemoryPipelineChannelCreatorTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.data.pipeline.core.ingest.channel.memory;
+
+import org.apache.shardingsphere.data.pipeline.api.ingest.channel.PipelineChannel;
+import org.apache.shardingsphere.data.pipeline.core.util.ReflectionUtil;
+import org.junit.Test;
+
+import java.util.Properties;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public final class MemoryPipelineChannelCreatorTest {
+
+ @Test
+ public void assertInit() throws Exception {
+ Properties result = new Properties();
+ result.setProperty("block-queue-size", "200");
+ MemoryPipelineChannelCreator memoryPipelineChannelCreator = new MemoryPipelineChannelCreator();
+ memoryPipelineChannelCreator.init(result);
+ assertThat(memoryPipelineChannelCreator.getProps(), is(result));
+ Integer blockQueueSize = ReflectionUtil.getFieldValue(memoryPipelineChannelCreator, "blockQueueSize", Integer.class);
+ assertThat(blockQueueSize, is(200));
+ }
+
+ @Test
+ public void assertCreatePipelineChannel() {
+ MemoryPipelineChannelCreator memoryPipelineChannelCreator = new MemoryPipelineChannelCreator();
+ PipelineChannel pipelineChannel = memoryPipelineChannelCreator.createPipelineChannel(1, records -> { });
+ assertThat(pipelineChannel, instanceOf(SimpleMemoryPipelineChannel.class));
+ PipelineChannel pipelineChannelMultiplex = memoryPipelineChannelCreator.createPipelineChannel(2, records -> { });
+ assertThat(pipelineChannelMultiplex, instanceOf(MultiplexMemoryPipelineChannel.class));
+ }
+}