Skip to content

Commit

Permalink
add configcenter for nacos test case
Browse files Browse the repository at this point in the history
  • Loading branch information
yanhom1314 committed Dec 30, 2023
1 parent 2f02442 commit 297fffa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.dromara.dynamictp.test.configcenter.nacos;

import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.config.ConfigType;
import com.alibaba.nacos.api.config.listener.AbstractListener;
import com.alibaba.nacos.api.config.listener.Listener;
Expand Down Expand Up @@ -77,9 +76,6 @@ public void receiveConfigInfo(String config) {
}
};
listener.receiveConfigInfo(content);
NacosConfigReceivedEvent event = new NacosConfigReceivedEvent(mock(ConfigService.class),
dataId, groupId, content, ConfigType.YAML.getType());
publisher.publishEvent(event);
publisher.publishEvent(mock(NacosConfigReceivedEvent.class));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void mock(MockedStatic<AlarmManager> mockAlarmManager) {
}

@RepeatedTest(100)
public void testRunTimeout() {
void testRunTimeout() {
Executor dtpExecutor = DtpRegistry.getExecutor("testRunTimeoutDtpExecutor");
dtpExecutor.execute(() -> {
try (MockedStatic<AlarmManager> mockAlarmManager = mockStatic(AlarmManager.class)) {
Expand All @@ -73,7 +73,7 @@ public void testRunTimeout() {
}

@RepeatedTest(100)
public void testQueueTimeout() {
void testQueueTimeout() {
Executor dtpExecutor = DtpRegistry.getExecutor("testQueueTimeoutDtpExecutor");
dtpExecutor.execute(() -> {
try (MockedStatic<AlarmManager> mockAlarmManager = mockStatic(AlarmManager.class)) {
Expand All @@ -86,7 +86,7 @@ public void testQueueTimeout() {
}

@RepeatedTest(100)
public void testRejectedQueueTimeoutCancel() {
void testRejectedQueueTimeoutCancel() {
Executor dtpExecutor = DtpRegistry.getExecutor("testRejectedQueueTimeoutCancelDtpExecutor");
dtpExecutor.execute(() -> {
try (MockedStatic<AlarmManager> mockAlarmManager = mockStatic(AlarmManager.class)) {
Expand All @@ -102,6 +102,4 @@ public void testRejectedQueueTimeoutCancel() {
public static void afterAll() throws InterruptedException {
// TimeUnit.SECONDS.sleep(100);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
@ExtendWith(SpringExtension.class)
@EnableDynamicTp
@EnableAutoConfiguration
public class ScheduledDtpExecutorTest {
class ScheduledDtpExecutorTest {

@Test
public void schedule() {
void schedule() {
ScheduledDtpExecutor dtpExecutor12 = (ScheduledDtpExecutor) DtpRegistry.getExecutor("dtpExecutor12");
System.out.println(dtpExecutor12.getClass());
dtpExecutor12.scheduleAtFixedRate(() -> {
Expand All @@ -51,16 +51,15 @@ public void schedule() {
dtpExecutor12.shutdownNow();
}


@Test
public void testScheduleJre8Bug() {
void testScheduleJre8Bug() {
ScheduledDtpExecutor dtpExecutor13 = (ScheduledDtpExecutor) DtpRegistry.getExecutor("dtpExecutor13");
dtpExecutor13.scheduleAtFixedRate(() -> { }, 10, 5, TimeUnit.SECONDS);
dtpExecutor13.shutdownNow();
}

@Test
public void testSubNotify() {
void testSubNotify() {
ScheduledDtpExecutor dtpExecutor14 = (ScheduledDtpExecutor) DtpRegistry.getExecutor("dtpExecutor14");
dtpExecutor14.scheduleAtFixedRate(() -> {
System.out.println("进来了");
Expand Down

0 comments on commit 297fffa

Please sign in to comment.