-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
qifanwang
committed
Nov 5, 2024
1 parent
97e9741
commit 548d41a
Showing
13 changed files
with
394 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
core/src/test/java/com/ctrip/xpipe/api/migration/MonitorClusterMetaTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package com.ctrip.xpipe.api.migration; | ||
|
||
import com.ctrip.xpipe.api.migration.auto.data.MonitorClusterMeta; | ||
import com.ctrip.xpipe.api.migration.auto.data.MonitorGroupMeta; | ||
import com.ctrip.xpipe.endpoint.HostPort; | ||
import com.google.common.collect.Sets; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import java.util.Set; | ||
|
||
public class MonitorClusterMetaTest { | ||
|
||
@Test | ||
public void testMonitorClusterMeta(){ | ||
Set<MonitorGroupMeta> group1 = getMonitorGroupMeta1(); | ||
MonitorClusterMeta monitorClusterMeta1 = new MonitorClusterMeta(group1); | ||
|
||
Set<MonitorGroupMeta> group2 = getMonitorGroupMeta2(); | ||
MonitorClusterMeta monitorClusterMeta2 = new MonitorClusterMeta(group2); | ||
|
||
Set<MonitorGroupMeta> group3 = getMonitorGroupMeta3(); | ||
MonitorClusterMeta monitorClusterMeta3 = new MonitorClusterMeta(group3); | ||
|
||
Set<MonitorGroupMeta> group4 = getMonitorGroupMeta4(); | ||
MonitorClusterMeta monitorClusterMeta4 = new MonitorClusterMeta(group4); | ||
|
||
Assert.assertEquals(monitorClusterMeta1.hashCode(), monitorClusterMeta2.hashCode()); | ||
Assert.assertNotEquals(monitorClusterMeta1.hashCode(), monitorClusterMeta3.hashCode()); | ||
Assert.assertNotEquals(monitorClusterMeta1.hashCode(), monitorClusterMeta4.hashCode()); | ||
System.out.println(monitorClusterMeta1.hashCode()); | ||
System.out.println(monitorClusterMeta2.hashCode()); | ||
System.out.println(monitorClusterMeta3.hashCode()); | ||
System.out.println(monitorClusterMeta4.hashCode()); | ||
} | ||
|
||
|
||
private Set<MonitorGroupMeta> getMonitorGroupMeta1() { | ||
return Sets.newHashSet( | ||
new MonitorGroupMeta("shard1+jq", "jq", Sets.newHashSet(HostPort.fromString("127.0.0.1:6379"), HostPort.fromString("127.0.0.1:6380")), true), | ||
new MonitorGroupMeta("shard2+jq", "jq", Sets.newHashSet(HostPort.fromString("127.0.0.1:6381"), HostPort.fromString("127.0.0.1:6382")), true), | ||
new MonitorGroupMeta("shard1+oy", "oy", Sets.newHashSet(HostPort.fromString("127.0.0.1:6383"), HostPort.fromString("127.0.0.1:6384")), false), | ||
new MonitorGroupMeta("shard2+oy", "oy", Sets.newHashSet(HostPort.fromString("127.0.0.1:6385"), HostPort.fromString("127.0.0.1:6386")), false) | ||
); | ||
} | ||
|
||
private Set<MonitorGroupMeta> getMonitorGroupMeta2() { | ||
return Sets.newHashSet( | ||
new MonitorGroupMeta("shard1+oy", "oy", Sets.newHashSet(HostPort.fromString("127.0.0.1:6383"), HostPort.fromString("127.0.0.1:6384")), false), | ||
new MonitorGroupMeta("shard1+jq", "jq", Sets.newHashSet(HostPort.fromString("127.0.0.1:6379"), HostPort.fromString("127.0.0.1:6380")), true), | ||
new MonitorGroupMeta("shard2+jq", "jq", Sets.newHashSet(HostPort.fromString("127.0.0.1:6381"), HostPort.fromString("127.0.0.1:6382")), true), | ||
new MonitorGroupMeta("shard2+oy", "oy", Sets.newHashSet(HostPort.fromString("127.0.0.1:6385"), HostPort.fromString("127.0.0.1:6386")), false) | ||
); | ||
} | ||
|
||
private Set<MonitorGroupMeta> getMonitorGroupMeta3() { | ||
return Sets.newHashSet( | ||
new MonitorGroupMeta("shard1+jq", "jq", Sets.newHashSet(HostPort.fromString("127.0.0.1:6379"), HostPort.fromString("127.0.0.1:6380")), false), | ||
new MonitorGroupMeta("shard2+jq", "jq", Sets.newHashSet(HostPort.fromString("127.0.0.1:6381"), HostPort.fromString("127.0.0.1:6382")), false), | ||
new MonitorGroupMeta("shard1+oy", "oy", Sets.newHashSet(HostPort.fromString("127.0.0.1:6383"), HostPort.fromString("127.0.0.1:6384")), true), | ||
new MonitorGroupMeta("shard2+oy", "oy", Sets.newHashSet(HostPort.fromString("127.0.0.1:6385"), HostPort.fromString("127.0.0.1:6386")), true) | ||
); | ||
} | ||
|
||
private Set<MonitorGroupMeta> getMonitorGroupMeta4() { | ||
return Sets.newHashSet( | ||
new MonitorGroupMeta("shard1+jq", "jq", Sets.newHashSet(HostPort.fromString("127.0.0.1:6379"), HostPort.fromString("127.0.0.1:6380")), true), | ||
new MonitorGroupMeta("shard2+jq", "oy", Sets.newHashSet(HostPort.fromString("127.0.0.1:6381"), HostPort.fromString("127.0.0.1:6382")), true), | ||
new MonitorGroupMeta("shard1+oy", "oy", Sets.newHashSet(HostPort.fromString("127.0.0.1:6383"), HostPort.fromString("127.0.0.1:6384")), false), | ||
new MonitorGroupMeta("shard2+oy", "oy", Sets.newHashSet(HostPort.fromString("127.0.0.1:6385"), HostPort.fromString("127.0.0.1:6386")), false) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.