Search in sources :

Example 1 with CrossOrigin

use of org.springframework.integration.http.inbound.CrossOrigin in project spring-integration by spring-projects.

the class WebFluxInboundGatewayParserTests method reactiveFullConfig.

@Test
@SuppressWarnings("unchecked")
public void reactiveFullConfig() {
    DirectFieldAccessor endpointAccessor = new DirectFieldAccessor(this.reactiveFullConfig);
    assertSame(this.requests, endpointAccessor.getPropertyValue("requestChannel"));
    assertNotNull(endpointAccessor.getPropertyValue("errorChannel"));
    assertFalse((boolean) endpointAccessor.getPropertyValue("autoStartup"));
    assertEquals(101, endpointAccessor.getPropertyValue("phase"));
    assertTrue((boolean) endpointAccessor.getPropertyValue("expectReply"));
    assertEquals("'504'", ((SpelExpression) endpointAccessor.getPropertyValue("statusCodeExpression")).getExpressionString());
    assertEquals("payload", ((SpelExpression) endpointAccessor.getPropertyValue("payloadExpression")).getExpressionString());
    Map<String, Expression> headerExpressions = (Map<String, Expression>) endpointAccessor.getPropertyValue("headerExpressions");
    assertTrue(headerExpressions.containsKey("foo"));
    assertEquals("foo", headerExpressions.get("foo").getValue());
    CrossOrigin crossOrigin = (CrossOrigin) endpointAccessor.getPropertyValue("crossOrigin");
    assertNotNull(crossOrigin);
    assertArrayEquals(new String[] { "foo" }, crossOrigin.getOrigin());
    assertEquals(ResolvableType.forClass(byte[].class), endpointAccessor.getPropertyValue("requestPayloadType"));
    assertSame(this.headerMapper, endpointAccessor.getPropertyValue("headerMapper"));
    assertSame(this.serverCodecConfigurer, endpointAccessor.getPropertyValue("codecConfigurer"));
    assertSame(this.requestedContentTypeResolver, endpointAccessor.getPropertyValue("requestedContentTypeResolver"));
    assertSame(this.reactiveAdapterRegistry, endpointAccessor.getPropertyValue("adapterRegistry"));
}
Also used : CrossOrigin(org.springframework.integration.http.inbound.CrossOrigin) SpelExpression(org.springframework.expression.spel.standard.SpelExpression) Expression(org.springframework.expression.Expression) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) Map(java.util.Map) Test(org.junit.Test)

Example 2 with CrossOrigin

use of org.springframework.integration.http.inbound.CrossOrigin in project spring-integration by spring-projects.

the class WebFluxInboundChannelAdapterParserTests method reactiveFullConfig.

@Test
@SuppressWarnings("unchecked")
public void reactiveFullConfig() {
    DirectFieldAccessor endpointAccessor = new DirectFieldAccessor(this.reactiveFullConfig);
    assertSame(this.requests, endpointAccessor.getPropertyValue("requestChannel"));
    assertNotNull(endpointAccessor.getPropertyValue("errorChannel"));
    assertFalse((boolean) endpointAccessor.getPropertyValue("autoStartup"));
    assertEquals(101, endpointAccessor.getPropertyValue("phase"));
    assertFalse((boolean) endpointAccessor.getPropertyValue("expectReply"));
    assertEquals("'202'", ((SpelExpression) endpointAccessor.getPropertyValue("statusCodeExpression")).getExpressionString());
    assertEquals("payload", ((SpelExpression) endpointAccessor.getPropertyValue("payloadExpression")).getExpressionString());
    Map<String, Expression> headerExpressions = (Map<String, Expression>) endpointAccessor.getPropertyValue("headerExpressions");
    assertTrue(headerExpressions.containsKey("foo"));
    assertEquals("foo", headerExpressions.get("foo").getValue());
    CrossOrigin crossOrigin = (CrossOrigin) endpointAccessor.getPropertyValue("crossOrigin");
    assertNotNull(crossOrigin);
    assertArrayEquals(new String[] { "foo" }, crossOrigin.getOrigin());
    assertEquals(ResolvableType.forClass(byte[].class), endpointAccessor.getPropertyValue("requestPayloadType"));
    assertSame(this.headerMapper, endpointAccessor.getPropertyValue("headerMapper"));
    assertSame(this.serverCodecConfigurer, endpointAccessor.getPropertyValue("codecConfigurer"));
    assertSame(this.requestedContentTypeResolver, endpointAccessor.getPropertyValue("requestedContentTypeResolver"));
    assertSame(this.reactiveAdapterRegistry, endpointAccessor.getPropertyValue("adapterRegistry"));
}
Also used : CrossOrigin(org.springframework.integration.http.inbound.CrossOrigin) SpelExpression(org.springframework.expression.spel.standard.SpelExpression) Expression(org.springframework.expression.Expression) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) Map(java.util.Map) Test(org.junit.Test)

Aggregations

Map (java.util.Map)2 Test (org.junit.Test)2 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)2 Expression (org.springframework.expression.Expression)2 SpelExpression (org.springframework.expression.spel.standard.SpelExpression)2 CrossOrigin (org.springframework.integration.http.inbound.CrossOrigin)2