Skip to content

Commit

Permalink
#995: Fix code snippets in the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
picimako committed Sep 24, 2023
1 parent 442a323 commit bb34617
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 26 deletions.
4 changes: 1 addition & 3 deletions src/manual/endpoint-channel.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ reply to that channel. The basic configuration for a synchronous channel endpoin
public ChannelSyncEndpoint helloEndpoint() {
return new ChannelSyncEndpointBuilder()
.channel("helloChannel")
.replyTimeout(1000L)
.pollingInterval(1000L)
.pollingInterval(1000)
.build();
}
----
Expand All @@ -159,7 +158,6 @@ public ChannelSyncEndpoint helloEndpoint() {
----
<citrus-si:channel-sync-endpoint id="helloSyncEndpoint"
channel="helloChannel"
reply-timeout="1000"
polling-interval="1000"/>
----

Expand Down
4 changes: 1 addition & 3 deletions src/manual/endpoint-direct.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ reply to that queue. The basic configuration for a synchronous direct endpoint c
public ChannelSyncEndpoint helloEndpoint() {
return new ChannelSyncEndpointBuilder()
.queue("helloChannel")
.replyTimeout(1000L)
.pollingInterval(1000L)
.pollingInterval(1000)
.build();
}
----
Expand All @@ -133,7 +132,6 @@ public ChannelSyncEndpoint helloEndpoint() {
----
<citrus:direct-sync-endpoint id="helloSyncEndpoint"
queue="helloChannel"
reply-timeout="1000"
polling-interval="1000"/>
----

Expand Down
8 changes: 4 additions & 4 deletions src/manual/endpoint-http.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ Http response. In the next section you will see how to simulate server side Http
----
@Bean
public HttpServer httpServer() {
return new HttpClientBuilder()
return new HttpServerBuilder()
.port(8080)
.autoStart(true)
.build();
Expand Down Expand Up @@ -752,7 +752,7 @@ http().server("httpServer")
</http:send-response>
----

Once more we set the custom header entry (*X-CustomHeaderId*) and a Http reserved header (*Content-Type*) for the response
Once more we set the custom header entry (*X-CustomHeaderId*) and an Http reserved header (*Content-Type*) for the response
message. On top of this we are able to set the response status for the Http response. We use the reserved header names *status*
in order to mark the success of the server operation. With this mechanism we can easily simulate different server behaviour
such as Http error response codes (e.g. 404 - Not found, 500 - Internal error). Let us have a closer look at the generated
Expand Down Expand Up @@ -1248,10 +1248,10 @@ public BasicAuthClientHttpRequestFactory basicAuthFactory() {
BasicAuthClientHttpRequestFactory factory = new BasicAuthClientHttpRequestFactory();
AuthScope scope = new AuthScope("localhost", "8080", "", "basic");
factory.setAuthScope();
factory.setAuthScope(scope);
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("someUsername", "somePassword");
factory.setCredentials();
factory.setCredentials(credentials);
return factory;
}
Expand Down
9 changes: 5 additions & 4 deletions src/manual/endpoint-jms.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ bean names.
public JmsEndpoint helloServiceEndpoint() {
return new JmsEndpointBuilder()
.destination("Citrus.HelloService.Request.Queue")
.connectionFactory("myConnectionFactory")
.connectionFactory(myConnectionFactory())
.build();
}
----
Expand All @@ -166,7 +166,7 @@ As an alternative to that you may want to use a special Spring JMS template impl
public JmsEndpoint helloServiceEndpoint() {
return new JmsEndpointBuilder()
.destination("Citrus.HelloService.Request.Queue")
.jmsTemplate("myJmsTemplate")
.jmsTemplate(myJmsTemplate())
.build();
}
----
Expand Down Expand Up @@ -241,7 +241,7 @@ a JMS connection factory in the configuration as the component needs to connect
----
@Bean
public JmsSyncEndpoint helloServiceSyncEndpoint() {
return new JmsEndpointBuilder()
return new JmsSyncEndpointBuilder()
.destination("Citrus.HelloService.InOut.Queue")
.build();
}
Expand Down Expand Up @@ -313,7 +313,7 @@ component as follows.
----
@Bean
public JmsSyncEndpoint helloServiceSyncEndpoint() {
return new JmsEndpointBuilder()
return new JmsSyncEndpointBuilder()
.destination("Citrus.HelloService.InOut.Queue")
.replyDestination("Citrus.HelloService.Reply.Queue")
.build();
Expand Down Expand Up @@ -527,6 +527,7 @@ public JmsSyncEndpoint helloServiceSyncEndpoint() {
return new JmsEndpointBuilder()
.destination("Citrus.HelloService.Topic")
.pubSubDomain(true)
.durableSubscription(true)
.autoStart(true)
.build();
}
Expand Down
20 changes: 10 additions & 10 deletions src/manual/endpoint-kafka.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ can set or verify those headers in send and receive actions as follows:
----
send(helloKafkaEndpoint)
.message()
.header("KafkaMessageHeaders.TOPIC", "my.very.special.topic")
.header("KafkaMessageHeaders.MESSAGE_KEY", "myKey")
.header("KafkaMessageHeaders.PARTITION", 1);
.header(KafkaMessageHeaders.TOPIC, "my.very.special.topic")
.header(KafkaMessageHeaders.MESSAGE_KEY, "myKey")
.header(KafkaMessageHeaders.PARTITION, 1);
----

.XML
Expand All @@ -332,7 +332,7 @@ the Kafka endpoint configuration.
----
send(helloKafkaEndpoint)
.message()
.header("KafkaMessageHeaders.MESSAGE_KEY", 1L);
.header(KafkaMessageHeaders.MESSAGE_KEY, 1L);
----

.XML
Expand All @@ -351,11 +351,11 @@ an expected behavior.
----
receive(helloKafkaEndpoint)
.message()
.header("KafkaMessageHeaders.TIMESTAMP", Matchers.greaterThan(0))
.header("KafkaMessageHeaders.TOPIC", "my.expected.topic")
.header("KafkaMessageHeaders.MESSAGE_KEY", "myKey")
.header("KafkaMessageHeaders.PARTITION", 1)
.header("KafkaMessageHeaders.OFFSET", Matchers.greaterThanOrEqualTo(0));
.header(KafkaMessageHeaders.TIMESTAMP, Matchers.greaterThan(0))
.header(KafkaMessageHeaders.TOPIC, "my.expected.topic")
.header(KafkaMessageHeaders.MESSAGE_KEY, "myKey")
.header(KafkaMessageHeaders.PARTITION, 1)
.header(KafkaMessageHeaders.OFFSET, Matchers.greaterThanOrEqualTo(0));
----

.XML
Expand Down Expand Up @@ -436,7 +436,7 @@ test as follows:
send("kafka:hello")
.message()
.body("foo")
.header("KafkaMessageHeaders.MESSAGE_KEY", 1);
.header(KafkaMessageHeaders.MESSAGE_KEY, 1);
----

.XML
Expand Down
4 changes: 2 additions & 2 deletions src/manual/validation-matchers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ As you can see the library defines one to many validation matcher members either
[source,xml]
----
@foo:isNumber()@
@foo:contains()@
@foo:customMatcher()@
@foo:contains()@
@foo:customMatcher()@
----

TIP: You can add custom validation matcher implementations and custom validation matcher libraries. Just use a custom prefix for your library. The default Citrus validation matcher library uses no prefix. See now the following sections describing the default validation matcher in Citrus.
Expand Down

0 comments on commit bb34617

Please sign in to comment.