You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by li...@apache.org on 2022/02/21 05:16:00 UTC

[rocketmq-client-csharp] branch develop updated: Setup continuous integration (#8)

This is an automated email from the ASF dual-hosted git repository.

lizhanhui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-csharp.git


The following commit(s) were added to refs/heads/develop by this push:
     new 80f7bc0  Setup continuous integration (#8)
80f7bc0 is described below

commit 80f7bc08b3e91f1f0f04ed0fe25dc9e8f20f5bcb
Author: Zhanhui Li <li...@apache.org>
AuthorDate: Mon Feb 21 13:15:56 2022 +0800

    Setup continuous integration (#8)
    
    * Setup github action
    
    * Add build status badge
---
 .github/workflows/main.yml       | 18 ++++++++++++++++++
 README.md                        |  2 ++
 rocketmq-client-csharp/Client.cs | 12 +-----------
 tests/ProducerTest.cs            |  3 ++-
 4 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..4c41e55
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,18 @@
+name: CI
+on: [push, pull_request]
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout 
+        uses: actions/checkout@v2
+      - name: Setup dotnet
+        uses: actions/setup-dotnet@v1
+        with:
+          dotnet-version: | 
+            5.0.x
+            6.0.x
+      - name: Build artifacts
+        run: |
+          dotnet --version
+          dotnet build
\ No newline at end of file
diff --git a/README.md b/README.md
index 7c8935d..bdc2bba 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+[![CI](https://github.com/lizhanhui/rocketmq-client-csharp/actions/workflows/main.yml/badge.svg)](https://github.com/lizhanhui/rocketmq-client-csharp/actions/workflows/main.yml)
+
 Introduction
 --------------
 Project rocketmq-client-csharp is targeted to implement C# binding in native C# code. At the current moment, it is still a work-in-progress project. Do not use it in production till it grows mature enough.
diff --git a/rocketmq-client-csharp/Client.cs b/rocketmq-client-csharp/Client.cs
index cbc5160..dac6d89 100644
--- a/rocketmq-client-csharp/Client.cs
+++ b/rocketmq-client-csharp/Client.cs
@@ -185,17 +185,7 @@ namespace org.apache.rocketmq
             request.Endpoints.Scheme = rmq::AddressScheme.Ipv4;
             var address = new rmq::Address();
             int pos = nameServer.LastIndexOf(':');
-            int protocolPrefix = 0;
-            if (nameServer.StartsWith("http://"))
-            {
-                protocolPrefix = 7;
-            }
-            else if (nameServer.StartsWith("https://"))
-            {
-                protocolPrefix = 8;
-            }
-
-            address.Host = nameServer.Substring(protocolPrefix, pos - protocolPrefix);
+            address.Host = nameServer.Substring(0, pos);
             address.Port = Int32.Parse(nameServer.Substring(pos + 1));
             request.Endpoints.Addresses.Add(address);
             var target = string.Format("https://{0}:{1}", address.Host, address.Port);
diff --git a/tests/ProducerTest.cs b/tests/ProducerTest.cs
index ebf045e..961b167 100644
--- a/tests/ProducerTest.cs
+++ b/tests/ProducerTest.cs
@@ -29,7 +29,7 @@ namespace org.apache.rocketmq
         public static void SetUp(TestContext context)
         {
             List<string> nameServerAddress = new List<string>();
-            nameServerAddress.Add(string.Format("https://{0}:{1}", host, port));
+            nameServerAddress.Add(string.Format("{0}:{1}", host, port));
             resolver = new StaticNameServerResolver(nameServerAddress);
 
             credentialsProvider = new ConfigFileCredentialsProvider();
@@ -54,6 +54,7 @@ namespace org.apache.rocketmq
             Array.Fill(body, (byte)'x');
             var msg = new Message(topic, body);
             var sendResult = producer.send(msg).GetAwaiter().GetResult();
+            Assert.IsNotNull(sendResult);
             producer.shutdown();
         }