Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tenischev committed Nov 25, 2023
1 parent 5353b91 commit b6e05c8
Show file tree
Hide file tree
Showing 6 changed files with 227 additions and 54 deletions.
2 changes: 1 addition & 1 deletion partials/AmqpPublisherImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

@Generated(value="com.asyncapi.generator.template.spring", date="{{''|currentTime }}")
@Service
public class PublisherServiceImpl {
public class PublisherServiceImpl implements PublisherService {
@Autowired
private RabbitTemplate template;

Expand Down
2 changes: 1 addition & 1 deletion partials/KafkaPublisherImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

@Generated(value="com.asyncapi.generator.template.spring", date="{{''|currentTime }}")
@Service
public class PublisherService {
public class PublisherServiceImpl implements PublisherService {

@Autowired
private KafkaTemplate<Integer, Object> kafkaTemplate;
Expand Down
51 changes: 34 additions & 17 deletions tests/__snapshots__/kafka.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -101,31 +101,16 @@ public class Config {
exports[`template integration tests for generated files using the generator and kafka example should generate proper config, services and DTOs files for provided kafka 2`] = `
"package com.asyncapi.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.support.KafkaHeaders;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;
import com.asyncapi.model.LightMeasuredPayload;
import javax.annotation.processing.Generated;
@Generated(value="com.asyncapi.generator.template.spring", date="AnyDate")
@Service
public class PublisherService {
public interface PublisherService {
@Autowired
private KafkaTemplate<Integer, Object> kafkaTemplate;
public void updateLightMeasurement(Integer key, LightMeasuredPayload lightMeasuredPayload) {
Message<LightMeasuredPayload> message = MessageBuilder.withPayload(lightMeasuredPayload)
.setHeader(KafkaHeaders.TOPIC, "event.lighting.measured")
.setHeader(KafkaHeaders.KEY, key)
.build();
kafkaTemplate.send(message);
}
public void updateLightMeasurement(Integer key, LightMeasuredPayload lightMeasuredPayload);
}
"
`;
Expand Down Expand Up @@ -520,6 +505,38 @@ exports[`template integration tests for generated files using the generator and
springDependencyManager=1.1.3"
`;
exports[`template integration tests for generated files using the generator and kafka example should generate proper config, services and DTOs files for provided kafka 9`] = `
"package com.asyncapi.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.support.KafkaHeaders;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;
import com.asyncapi.model.LightMeasuredPayload;
import javax.annotation.processing.Generated;
@Generated(value="com.asyncapi.generator.template.spring", date="AnyDate")
@Service
public class PublisherServiceImpl implements PublisherService {
@Autowired
private KafkaTemplate<Integer, Object> kafkaTemplate;
public void updateLightMeasurement(Integer key, LightMeasuredPayload lightMeasuredPayload) {
Message<LightMeasuredPayload> message = MessageBuilder.withPayload(lightMeasuredPayload)
.setHeader(KafkaHeaders.TOPIC, "event.lighting.measured")
.setHeader(KafkaHeaders.KEY, key)
.build();
kafkaTemplate.send(message);
}
}
"
`;
exports[`template integration tests for generated files using the generator and kafka with parameters example should generate proper config and message handler for provided kafka 1`] = `
"package com.asyncapi.infrastructure;
Expand Down
Loading

0 comments on commit b6e05c8

Please sign in to comment.