Search in sources :

Example 1 with OperationParameters

use of org.springframework.boot.actuate.endpoint.invoke.OperationParameters in project spring-boot by spring-projects.

the class CachingOperationInvokerAdvisorTests method applyWhenTimeToLiveIsZeroShouldNotAddAdvise.

@Test
void applyWhenTimeToLiveIsZeroShouldNotAddAdvise() {
    OperationParameters parameters = getParameters("get");
    given(this.timeToLive.apply(any())).willReturn(0L);
    OperationInvoker advised = this.advisor.apply(EndpointId.of("foo"), OperationType.READ, parameters, this.invoker);
    assertThat(advised).isSameAs(this.invoker);
    then(this.timeToLive).should().apply(EndpointId.of("foo"));
}
Also used : OperationParameters(org.springframework.boot.actuate.endpoint.invoke.OperationParameters) OperationInvoker(org.springframework.boot.actuate.endpoint.invoke.OperationInvoker) Test(org.junit.jupiter.api.Test)

Example 2 with OperationParameters

use of org.springframework.boot.actuate.endpoint.invoke.OperationParameters in project spring-boot by spring-projects.

the class CachingOperationInvokerAdvisorTests method applyWhenTimeToLiveReturnsNullShouldNotAddAdvise.

@Test
void applyWhenTimeToLiveReturnsNullShouldNotAddAdvise() {
    OperationParameters parameters = getParameters("get");
    given(this.timeToLive.apply(any())).willReturn(null);
    OperationInvoker advised = this.advisor.apply(EndpointId.of("foo"), OperationType.READ, parameters, this.invoker);
    assertThat(advised).isSameAs(this.invoker);
    then(this.timeToLive).should().apply(EndpointId.of("foo"));
}
Also used : OperationParameters(org.springframework.boot.actuate.endpoint.invoke.OperationParameters) OperationInvoker(org.springframework.boot.actuate.endpoint.invoke.OperationInvoker) Test(org.junit.jupiter.api.Test)

Example 3 with OperationParameters

use of org.springframework.boot.actuate.endpoint.invoke.OperationParameters in project spring-boot by spring-projects.

the class CachingOperationInvokerAdvisorTests method applyWithSecurityContextShouldAddAdvise.

@Test
void applyWithSecurityContextShouldAddAdvise() {
    OperationParameters parameters = getParameters("getWithSecurityContext", SecurityContext.class, String.class);
    given(this.timeToLive.apply(any())).willReturn(100L);
    assertAdviseIsApplied(parameters);
}
Also used : OperationParameters(org.springframework.boot.actuate.endpoint.invoke.OperationParameters) Test(org.junit.jupiter.api.Test)

Example 4 with OperationParameters

use of org.springframework.boot.actuate.endpoint.invoke.OperationParameters in project spring-boot by spring-projects.

the class CachingOperationInvokerAdvisorTests method applyWhenOperationIsNotReadShouldNotAddAdvise.

@Test
void applyWhenOperationIsNotReadShouldNotAddAdvise() {
    OperationParameters parameters = getParameters("get");
    OperationInvoker advised = this.advisor.apply(EndpointId.of("foo"), OperationType.WRITE, parameters, this.invoker);
    assertThat(advised).isSameAs(this.invoker);
}
Also used : OperationParameters(org.springframework.boot.actuate.endpoint.invoke.OperationParameters) OperationInvoker(org.springframework.boot.actuate.endpoint.invoke.OperationInvoker) Test(org.junit.jupiter.api.Test)

Example 5 with OperationParameters

use of org.springframework.boot.actuate.endpoint.invoke.OperationParameters in project spring-boot by spring-projects.

the class CachingOperationInvokerAdvisorTests method applyWithAllOptionalParametersShouldAddAdvise.

@Test
void applyWithAllOptionalParametersShouldAddAdvise() {
    OperationParameters parameters = getParameters("getWithAllOptionalParameters", String.class, String.class);
    given(this.timeToLive.apply(any())).willReturn(100L);
    assertAdviseIsApplied(parameters);
}
Also used : OperationParameters(org.springframework.boot.actuate.endpoint.invoke.OperationParameters) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)11 OperationParameters (org.springframework.boot.actuate.endpoint.invoke.OperationParameters)11 OperationInvoker (org.springframework.boot.actuate.endpoint.invoke.OperationInvoker)5