-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
fcf6867
commit 98dd621
Showing
13 changed files
with
245 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# 相当于脚本用途的一个声明 | ||
name: Release | ||
# 触发脚本的事件 这里为发布release之后触发 | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Maven Central Repository | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
server-id: ossrh | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
|
||
- name: "Publish package" | ||
if: matrix.type == 'OSSRH' | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | ||
run: | | ||
cat <(echo -e "${{ secrets.GPG_PRIVATE_KEY }}") | gpg --batch --import; | ||
mvn clean install deploy -P release -Dgpg.passphrase=${{ secrets.GPG_PRIVATE_KEY }} |
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,27 @@ | ||
# 相当于脚本用途的一个声明 | ||
name: Snapshot | ||
# 触发脚本的事件 这里为发布release之后触发 | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- release* | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Maven Central Repository | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
server-id: ossrh | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
- name: Publish package | ||
run: mvn --batch-mode deploy | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} |
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
85 changes: 85 additions & 0 deletions
85
...-common/polaris-model/src/test/java/com/tencent/polaris/api/pojo/ServiceEventKeyTest.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,85 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making Polaris available. | ||
* | ||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* Licensed under the BSD 3-Clause License (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://opensource.org/licenses/BSD-3-Clause | ||
* | ||
* 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 com.tencent.polaris.api.pojo; | ||
|
||
import com.tencent.polaris.api.pojo.ServiceEventKey.EventType; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
public class ServiceEventKeyTest { | ||
|
||
@Test | ||
public void verifyCase1() { | ||
int receiveExceptionCnt = 0; | ||
int expectExceptionCnt = 5; | ||
for (EventType eventType : EventType.values()) { | ||
try { | ||
ServiceEventKey key = new ServiceEventKey(new ServiceKey("", ""), eventType); | ||
key.verify(); | ||
} catch (IllegalArgumentException ignore) { | ||
receiveExceptionCnt++; | ||
} | ||
} | ||
Assert.assertEquals(expectExceptionCnt, receiveExceptionCnt); | ||
} | ||
|
||
@Test | ||
public void verifyCase2() { | ||
int receiveExceptionCnt = 0; | ||
int expectExceptionCnt = 5; | ||
for (EventType eventType : EventType.values()) { | ||
try { | ||
ServiceEventKey key = new ServiceEventKey(new ServiceKey("test_ns", ""), eventType); | ||
key.verify(); | ||
} catch (IllegalArgumentException ignore) { | ||
receiveExceptionCnt++; | ||
} | ||
} | ||
Assert.assertEquals(expectExceptionCnt, receiveExceptionCnt); | ||
} | ||
|
||
@Test | ||
public void verifyCase3() { | ||
int receiveExceptionCnt = 0; | ||
int expectExceptionCnt = 5; | ||
for (EventType eventType : EventType.values()) { | ||
try { | ||
ServiceEventKey key = new ServiceEventKey(new ServiceKey("", "test_svc"), eventType); | ||
key.verify(); | ||
} catch (IllegalArgumentException ignore) { | ||
receiveExceptionCnt++; | ||
} | ||
} | ||
Assert.assertEquals(expectExceptionCnt, receiveExceptionCnt); | ||
} | ||
|
||
@Test | ||
public void verifyCase4() { | ||
int receiveExceptionCnt = 0; | ||
int expectExceptionCnt = 0; | ||
for (EventType eventType : EventType.values()) { | ||
try { | ||
ServiceEventKey key = new ServiceEventKey(new ServiceKey("test_ns", "test_svc"), eventType); | ||
key.verify(); | ||
} catch (IllegalArgumentException ignore) { | ||
receiveExceptionCnt++; | ||
} | ||
} | ||
Assert.assertEquals(expectExceptionCnt, receiveExceptionCnt); | ||
} | ||
} |
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.