use of org.junit.jupiter.api.Order in project dubbo by alibaba.
the class FailbackClusterInvokerTest method testInvokeRetryTimesWithIllegalValue.
@Test
@Order(8)
public void testInvokeRetryTimesWithIllegalValue() throws InterruptedException, NoSuchFieldException, IllegalAccessException {
resetInvokerToException();
given(dic.getConsumerUrl()).willReturn(url.addParameter(RETRIES_KEY, -100));
FailbackClusterInvoker<FailbackClusterInvokerTest> invoker = new FailbackClusterInvoker<>(dic);
LogUtil.start();
DubboAppender.clear();
invocation.setMethodName("testInvokeRetryTimesWithIllegalValue");
invoker.invoke(invocation);
CountDownLatch countDown = new CountDownLatch(1);
countDown.await(getRetryFailedPeriod() * (CommonConstants.DEFAULT_FAILBACK_TIMES + 1), TimeUnit.SECONDS);
LogUtil.stop();
Assertions.assertEquals(3, LogUtil.findMessage(Level.INFO, "Attempt to retry to invoke method " + "testInvokeRetryTimesWithIllegalValue"), "Must have three error message ");
}
use of org.junit.jupiter.api.Order in project dubbo by alibaba.
the class FailbackClusterInvokerTest method testInvokeRetryTimesWithTwoValue.
@Test
@Order(6)
public void testInvokeRetryTimesWithTwoValue() throws InterruptedException, NoSuchFieldException, IllegalAccessException {
int retries = 2;
resetInvokerToException();
given(dic.getConsumerUrl()).willReturn(url.addParameter(RETRIES_KEY, retries));
FailbackClusterInvoker<FailbackClusterInvokerTest> invoker = new FailbackClusterInvoker<>(dic);
LogUtil.start();
DubboAppender.clear();
invocation.setMethodName("testInvokeRetryTimesWithTwoValue");
invoker.invoke(invocation);
CountDownLatch countDown = new CountDownLatch(1);
countDown.await(getRetryFailedPeriod() * (retries + 1), TimeUnit.SECONDS);
LogUtil.stop();
Assertions.assertEquals(2, LogUtil.findMessage(Level.INFO, "Attempt to retry to invoke method " + "testInvokeRetryTimesWithTwoValue"), "Must have two error message ");
}
use of org.junit.jupiter.api.Order in project dubbo by alibaba.
the class ApolloDynamicConfigurationTest method testAddListener.
/**
* Test add listener.
*
* @throws Exception the exception
*/
@Test
@Order(3)
public void testAddListener() throws Exception {
String mockKey = "mockKey3";
String mockValue = String.valueOf(new Random().nextInt());
final SettableFuture<org.apache.dubbo.common.config.configcenter.ConfigChangedEvent> future = SettableFuture.create();
apolloDynamicConfiguration = new ApolloDynamicConfiguration(url);
apolloDynamicConfiguration.addListener(mockKey, DEFAULT_NAMESPACE, new ConfigurationListener() {
@Override
public void process(org.apache.dubbo.common.config.configcenter.ConfigChangedEvent event) {
future.set(event);
}
});
putData(mockKey, mockValue);
org.apache.dubbo.common.config.configcenter.ConfigChangedEvent result = future.get(3000, TimeUnit.MILLISECONDS);
assertEquals(mockValue, result.getContent());
assertEquals(mockKey, result.getKey());
assertEquals(ConfigChangeType.MODIFIED, result.getChangeType());
}
use of org.junit.jupiter.api.Order in project cas by apereo.
the class AdaptiveMultifactorAuthenticationTriggerTests method verifyNoProviders.
@Test
@Order(0)
@Tag("DisableProviderRegistration")
public void verifyNoProviders() {
val props = new CasConfigurationProperties();
props.getAuthn().getAdaptive().getPolicy().getRequireMultifactor().put("mfa-dummy", ".+London.+");
val trigger = new AdaptiveMultifactorAuthenticationTrigger(null, props, this.applicationContext);
assertThrows(AuthenticationException.class, () -> trigger.isActivated(authentication, registeredService, this.httpRequest, this.httpResponse, mock(Service.class)));
}
use of org.junit.jupiter.api.Order in project cas by apereo.
the class AdaptiveMultifactorAuthenticationTriggerTests method verifyOperationByRequestGeoLocation.
@Test
@Order(3)
public void verifyOperationByRequestGeoLocation() {
val props = new CasConfigurationProperties();
props.getAuthn().getAdaptive().getPolicy().getRequireMultifactor().put("mfa-dummy", ".+London.+");
val geoResponse = new GeoLocationResponse();
geoResponse.addAddress("123 Main St London UK");
when(this.geoLocationService.locate(anyString(), any(GeoLocationRequest.class))).thenReturn(geoResponse);
val trigger = new AdaptiveMultifactorAuthenticationTrigger(this.geoLocationService, props, this.applicationContext);
val result = trigger.isActivated(authentication, registeredService, this.httpRequest, this.httpResponse, mock(Service.class));
assertTrue(result.isPresent());
}
Aggregations