Skip to content

Commit 199be55

Browse files
khotynliujianjun.ljj鲁直
authored
Fix mac aarch compilation (#1303)
* Add historic contributors Add histoic contributors, should thank them for their contribution. * Fix compatible problem with mac chips. Fix #1302 * Update nacos-test, nacos, sofa-registry version. * Fix test case * Fix test case * Update version * Delete comment out code. * Update pom --------- Co-authored-by: liujianjun.ljj <[email protected]> Co-authored-by: 鲁直 <[email protected]>
1 parent 8ca4f28 commit 199be55

File tree

19 files changed

+475
-443
lines changed

19 files changed

+475
-443
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ logs/
2121

2222
#protobuf
2323
example/build/*
24-
test/test-integration/build/*
24+
test/test-integration/build/*
25+
26+
registry/registry-polaris/polaris/

all/pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,16 @@
6161
<netty.version>4.1.44.Final</netty.version>
6262
<hessian.version>3.4.0</hessian.version>
6363
<resteasy.version>3.6.3.Final</resteasy.version>
64-
<bolt.version>1.5.10</bolt.version>
64+
<bolt.version>1.6.6</bolt.version>
6565
<tracer.version>3.0.8</tracer.version>
6666
<lookout.version>1.4.1</lookout.version>
6767
<bytebuddy.version>1.9.8</bytebuddy.version>
68-
<sofa.registry.version>5.2.0</sofa.registry.version>
68+
<sofa.registry.version>6.3.0</sofa.registry.version>
6969
<bolt.swagger.version>1.6.9</bolt.swagger.version>
7070
<asm.version>7.0</asm.version>
7171
<httpclient.version>4.5.13</httpclient.version>
7272
<httpcore.version>4.4.13</httpcore.version>
73-
<grpc.version>1.33.1</grpc.version>
73+
<grpc.version>1.53.0</grpc.version>
7474
<guava.version>27.0-jre</guava.version>
7575
<transmittable.version>2.12.1</transmittable.version>
7676
</properties>

bom/pom.xml

+11-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<opentracing.version>0.22.0</opentracing.version>
2525
<dubbo.version>2.6.9</dubbo.version>
2626
<nacos.version>2.0.3</nacos.version>
27-
<sofa.registry.version>5.2.0</sofa.registry.version>
27+
<sofa.registry.version>6.3.0</sofa.registry.version>
2828
<polaris.version>1.2.2</polaris.version>
2929
<swagger.version>1.6.9</swagger.version>
3030
<asm.version>7.0</asm.version>
@@ -33,12 +33,12 @@
3333
<!-- serialization -->
3434
<hessian.version>3.4.0</hessian.version>
3535
<thrift.version>0.9.2</thrift.version>
36-
<protobuf.version>3.16.3</protobuf.version>
36+
<protobuf.version>3.22.0</protobuf.version>
3737
<jackson.version>2.12.7</jackson.version>
3838
<jackson.databind.version>2.12.7.1</jackson.databind.version>
3939
<msgpack.version>0.6.12</msgpack.version>
4040
<protostuff.version>1.5.9</protostuff.version>
41-
<grpc.version>1.33.1</grpc.version>
41+
<grpc.version>1.53.0</grpc.version>
4242

4343
<!--common-->
4444
<httpcore.version>4.4.13</httpcore.version>
@@ -51,7 +51,7 @@
5151
<!-- Test libs -->
5252
<junit.version>4.13.1</junit.version>
5353
<!-- alipay libs -->
54-
<bolt.version>1.5.10</bolt.version>
54+
<bolt.version>1.6.6</bolt.version>
5555
<sofa.common.tools.version>1.3.2</sofa.common.tools.version>
5656
<tracer.version>3.0.8</tracer.version>
5757
<lookout.version>1.4.1</lookout.version>
@@ -514,7 +514,7 @@
514514
<dependency>
515515
<groupId>io.netty</groupId>
516516
<artifactId>netty-tcnative-boringssl-static</artifactId>
517-
<version>2.0.25.Final</version>
517+
<version>2.0.59.Final</version>
518518
<classifier>${os.detected.classifier}</classifier>
519519
</dependency>
520520
<dependency>
@@ -557,6 +557,12 @@
557557
<version>${prometheus.client.version}</version>
558558
<scope>test</scope>
559559
</dependency>
560+
<dependency>
561+
<groupId>io.prometheus</groupId>
562+
<artifactId>simpleclient_hotspot</artifactId>
563+
<version>0.16.0</version>
564+
<scope>test</scope>
565+
</dependency>
560566
</dependencies>
561567
</dependencyManagement>
562568

example/pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
</parent>
1212

1313
<properties>
14-
<protoc.version>3.11.0</protoc.version>
15-
<protoc-gen-grpc-java.version>1.17.0</protoc-gen-grpc-java.version>
14+
<protoc.version>3.22.0</protoc.version>
15+
<protoc-gen-grpc-java.version>1.53.0</protoc-gen-grpc-java.version>
1616
<sofa.rpc.compiler.version>0.0.3</sofa.rpc.compiler.version>
17-
<grpc.version>1.33.1</grpc.version>
17+
<grpc.version>1.53.0</grpc.version>
1818
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
1919
</properties>
2020

@@ -194,7 +194,7 @@
194194
<artifactId>protobuf-maven-plugin</artifactId>
195195
<version>0.5.1</version>
196196
<configuration>
197-
<protocArtifact>com.google.protobuf:protoc:3.7.1:exe:${os.detected.classifier}</protocArtifact>
197+
<protocArtifact>com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}</protocArtifact>
198198
<pluginId>grpc-java</pluginId>
199199
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
200200
<outputDirectory>build/generated/source/proto/main/java</outputDirectory>

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@
8787
<maven.compiler.target>1.8</maven.compiler.target>
8888
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
8989
<skipTests>false</skipTests>
90-
<protoc.version>3.7.1</protoc.version>
91-
<grpc.version>1.27.2</grpc.version>
90+
<protoc.version>3.22.0</protoc.version>
91+
<grpc.version>1.53.0</grpc.version>
9292
<sofa.rpc.compiler.version>0.0.2</sofa.rpc.compiler.version>
9393
</properties>
9494

registry/registry-nacos/pom.xml

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@
3737
<dependency>
3838
<groupId>name.jervyshi</groupId>
3939
<artifactId>nacos-embedded</artifactId>
40-
<version>0.2.0</version>
40+
<version>0.3.0</version>
4141
<scope>test</scope>
4242
</dependency>
43+
<dependency>
44+
<groupId>commons-io</groupId>
45+
<artifactId>commons-io</artifactId>
46+
</dependency>
4347
</dependencies>
4448

4549
<profiles>

registry/registry-nacos/src/test/java/com/alipay/sofa/rpc/registry/nacos/NacosRegistryTest.java

+39-39
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public void tearDown() {
8181
}
8282

8383
/**
84-
* 测试Zookeeper Provider Observer
84+
* 测试 Nacos Provider Observer
8585
*
8686
* @throws Exception the exception
8787
*/
@@ -93,21 +93,21 @@ public void testProviderObserver() throws Exception {
9393
TimeUnit.SECONDS.sleep(10);
9494

9595
serverConfig = new ServerConfig()
96-
.setProtocol("bolt")
97-
.setHost("0.0.0.0")
98-
.setPort(12200);
96+
.setProtocol("bolt")
97+
.setHost("0.0.0.0")
98+
.setPort(12200);
9999

100100
ProviderConfig<?> provider = new ProviderConfig();
101101
provider.setInterfaceId("com.alipay.xxx.NacosTestService")
102-
.setApplication(new ApplicationConfig().setAppName("test-server"))
103-
.setUniqueId("nacos-test")
104-
.setProxy("javassist")
105-
.setRegister(true)
106-
.setRegistry(registryConfig)
107-
.setSerialization("hessian2")
108-
.setServer(serverConfig)
109-
.setWeight(222)
110-
.setTimeout(3000);
102+
.setApplication(new ApplicationConfig().setAppName("test-server"))
103+
.setUniqueId("nacos-test")
104+
.setProxy("javassist")
105+
.setRegister(true)
106+
.setRegistry(registryConfig)
107+
.setSerialization("hessian2")
108+
.setServer(serverConfig)
109+
.setWeight(222)
110+
.setTimeout(3000);
111111

112112
// 注册
113113
try {
@@ -120,13 +120,13 @@ public void testProviderObserver() throws Exception {
120120

121121
ConsumerConfig<?> consumer = new ConsumerConfig();
122122
consumer.setInterfaceId("com.alipay.xxx.NacosTestService")
123-
.setApplication(new ApplicationConfig().setAppName("test-server"))
124-
.setUniqueId("nacos-test")
125-
.setProxy("javassist")
126-
.setSubscribe(true)
127-
.setSerialization("java")
128-
.setInvokeType("sync")
129-
.setTimeout(4444);
123+
.setApplication(new ApplicationConfig().setAppName("test-server"))
124+
.setUniqueId("nacos-test")
125+
.setProxy("javassist")
126+
.setSubscribe(true)
127+
.setSerialization("java")
128+
.setInvokeType("sync")
129+
.setTimeout(4444);
130130

131131
// 订阅
132132
CountDownLatch latch = new CountDownLatch(1);
@@ -144,12 +144,12 @@ public void testProviderObserver() throws Exception {
144144
// 订阅 错误的uniqueId
145145
ConsumerConfig<?> consumerNoUniqueId = new ConsumerConfig();
146146
consumerNoUniqueId.setInterfaceId("com.alipay.xxx.NacosTestService")
147-
.setApplication(new ApplicationConfig().setAppName("test-server"))
148-
.setProxy("javassist")
149-
.setSubscribe(true)
150-
.setSerialization("java")
151-
.setInvokeType("sync")
152-
.setTimeout(4444);
147+
.setApplication(new ApplicationConfig().setAppName("test-server"))
148+
.setProxy("javassist")
149+
.setSubscribe(true)
150+
.setSerialization("java")
151+
.setInvokeType("sync")
152+
.setTimeout(4444);
153153
latch = new CountDownLatch(1);
154154
MockProviderInfoListener wrongProviderInfoListener = new MockProviderInfoListener();
155155
wrongProviderInfoListener.setCountDownLatch(latch);
@@ -174,9 +174,9 @@ public void testProviderObserver() throws Exception {
174174
latch = new CountDownLatch(2);
175175
providerInfoListener.setCountDownLatch(latch);
176176
provider.getServer().add(new ServerConfig()
177-
.setProtocol("bolt")
178-
.setHost("0.0.0.0")
179-
.setPort(12201));
177+
.setProtocol("bolt")
178+
.setHost("0.0.0.0")
179+
.setPort(12201));
180180
registry.register(provider);
181181

182182
latch.await(timeoutPerSub * 2, TimeUnit.MILLISECONDS);
@@ -189,13 +189,13 @@ public void testProviderObserver() throws Exception {
189189
// 重复订阅
190190
ConsumerConfig<?> consumer2 = new ConsumerConfig();
191191
consumer2.setInterfaceId("com.alipay.xxx.NacosTestService")
192-
.setUniqueId("nacos-test")
193-
.setApplication(new ApplicationConfig().setAppName("test-server"))
194-
.setProxy("javassist")
195-
.setSubscribe(true)
196-
.setSerialization("java")
197-
.setInvokeType("sync")
198-
.setTimeout(4444);
192+
.setUniqueId("nacos-test")
193+
.setApplication(new ApplicationConfig().setAppName("test-server"))
194+
.setProxy("javassist")
195+
.setSubscribe(true)
196+
.setSerialization("java")
197+
.setInvokeType("sync")
198+
.setTimeout(4444);
199199
CountDownLatch latch2 = new CountDownLatch(1);
200200
MockProviderInfoListener providerInfoListener2 = new MockProviderInfoListener();
201201
providerInfoListener2.setCountDownLatch(latch2);
@@ -214,17 +214,17 @@ public void testProviderObserver() throws Exception {
214214
// 批量反注册,判断订阅者2的数据
215215
latch = new CountDownLatch(2);
216216
providerInfoListener2.setCountDownLatch(latch);
217-
List<ProviderConfig> providerConfigList = new ArrayList<ProviderConfig>();
217+
List<ProviderConfig> providerConfigList = new ArrayList<>();
218218
providerConfigList.add(provider);
219219
registry.batchUnRegister(providerConfigList);
220220

221221
latch.await(timeoutPerSub * 2, TimeUnit.MILLISECONDS);
222-
Assert.assertEquals("after unregister: 1", 1, ps2.size());
222+
Assert.assertEquals("after unregister: 0", 0, ps2.size()); // 所有的 Provider 都已经反向注册了,应该是 0
223223

224224
LOGGER.info("after unregister consumer, and consumer2 {}", ps);
225225

226226
// 批量取消订阅
227-
List<ConsumerConfig> consumerConfigList = new ArrayList<ConsumerConfig>();
227+
List<ConsumerConfig> consumerConfigList = new ArrayList<>();
228228
consumerConfigList.add(consumer2);
229229
registry.batchUnSubscribe(consumerConfigList);
230230
}

registry/registry-nacos/src/test/java/com/alipay/sofa/rpc/registry/nacos/base/BaseNacosTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static void adAfterClass() {
6060
@Before
6161
public void setup() {
6262
//see https://nacos.io/zh-cn/docs/2.0.0-compatibility.html
63-
nacosProcess = NacosStarterBuilder.nacosStarter().withServerPort(8848).withNacosVersion("2.0.3").build()
63+
nacosProcess = NacosStarterBuilder.nacosStarter().withServerPort(8848).withNacosVersion("2.2.3").build()
6464
.start();
6565
}
6666

registry/registry-sofa/pom.xml

+6-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<artifactId>sofa-rpc-registry-sofa</artifactId>
1414
<properties>
15-
<sofa.registry.version>5.2.0</sofa.registry.version>
15+
<sofa.registry.version>6.3.0</sofa.registry.version>
1616
<argLine>-Dnetwork_interface_denylist=docker0</argLine>
1717
</properties>
1818
<dependencies>
@@ -66,21 +66,18 @@
6666
<artifactId>log4j-jcl</artifactId>
6767
<groupId>org.apache.logging.log4j</groupId>
6868
</exclusion>
69-
<exclusion>
70-
<artifactId>log4j-core</artifactId>
71-
<groupId>org.apache.logging.log4j</groupId>
72-
</exclusion>
73-
<exclusion>
74-
<artifactId>log4j-api</artifactId>
75-
<groupId>org.apache.logging.log4j</groupId>
76-
</exclusion>
7769
</exclusions>
7870
</dependency>
7971
<dependency>
8072
<groupId>junit</groupId>
8173
<artifactId>junit</artifactId>
8274
<scope>test</scope>
8375
</dependency>
76+
<dependency>
77+
<groupId>io.prometheus</groupId>
78+
<artifactId>simpleclient_hotspot</artifactId>
79+
<scope>test</scope>
80+
</dependency>
8481
</dependencies>
8582

8683
<profiles>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package com.alipay.sofa.common.profile;
18+
19+
/**
20+
* @author khotyn
21+
* @version StringUtil.java, v 0.1 2023年07月05日 14:40 khotyn
22+
*/
23+
public class StringUtil {
24+
public static boolean equals(String str1, String str2) {
25+
return str1 == null ? str2 == null : str1.equals(str2);
26+
}
27+
28+
public static boolean isNotEmpty(String str) {
29+
return str != null && str.length() > 0;
30+
}
31+
32+
public static boolean isNotBlank(String str) {
33+
int length;
34+
if (str != null && (length = str.length()) != 0) {
35+
for (int i = 0; i < length; ++i) {
36+
if (!Character.isWhitespace(str.charAt(i))) {
37+
return true;
38+
}
39+
}
40+
41+
return false;
42+
} else {
43+
return false;
44+
}
45+
}
46+
47+
public static boolean isBlank(String str) {
48+
int length;
49+
if (str != null && (length = str.length()) != 0) {
50+
for (int i = 0; i < length; ++i) {
51+
if (!Character.isWhitespace(str.charAt(i))) {
52+
return false;
53+
}
54+
}
55+
56+
return true;
57+
} else {
58+
return true;
59+
}
60+
}
61+
}

0 commit comments

Comments
 (0)