Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ public void customize(AsyncAPI asyncAPI) {
}

try {
log.debug("Generate json-schema for {}", entry.getKey());
log.trace("Generate json-schema for {}", entry.getKey());

Object jsonSchema = jsonSchemaGenerator.fromSchema(componentSchema, componentSchemas);
if (jsonSchema != null) {
schema.getExtensionFields().putIfAbsent(EXTENSION_JSON_SCHEMA, jsonSchema);
}
} catch (Exception ex) {
log.warn("Unable to create json-schema for {}", entry.getKey(), ex);
log.info("Unable to create json-schema for {}", entry.getKey(), ex);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Map<String, ChannelObject> findChannels() {
Map<String, ChannelObject> channels = scanner.scan();
foundChannelItems.addAll(channels.values());
} catch (Exception e) {
log.error("An error was encountered during channel scanning with {}: {}", scanner, e.getMessage(), e);
log.warn("An error was encountered during channel scanning with {}: {}", scanner, e.getMessage(), e);
}
}
return ChannelMerger.mergeChannels(foundChannelItems);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public ComponentSchema resolvePayloadSchema(Type type, String contentType) {
*/
@Override
public String registerSchema(SchemaObject schemaWithoutRef) {
log.debug("Registering schema for {}", schemaWithoutRef.getTitle());
log.trace("Registering schema for {}", schemaWithoutRef.getTitle());

ComponentSchema processedSchema = schemaService.postProcessSchemaWithoutRef(schemaWithoutRef);
this.schemas.putIfAbsent(schemaWithoutRef.getTitle(), processedSchema);
Expand All @@ -98,7 +98,7 @@ public Map<String, Message> getMessages() {
*/
@Override
public MessageReference registerMessage(MessageObject message) {
log.debug("Registering message for {}", message.getMessageId());
log.trace("Registering message for {}", message.getMessageId());

messages.putIfAbsent(message.getMessageId(), message);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public R fromSchema(Schema schema, Map<String, Schema> definitions) {

private Optional<T> buildExample(
Optional<String> name, Schema schema, Map<String, Schema> definitions, Set<Schema> visited) {
log.debug("Building example for schema {}", schema);
log.trace("Building example for schema {}", schema);

Optional<T> exampleValue = getExampleFromSchemaAnnotation(name, schema);
if (exampleValue.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public JsonNode createRaw(Object exampleValue) {
try {
return yamlMapper.readTree(exampleValue.toString());
} catch (JacksonException e) {
log.info("Unable to parse example to JsonNode: {}", exampleValue, e);
log.debug("Unable to parse example to JsonNode: {}", exampleValue, e);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public String prepareForSerialization(Schema schema, Node exampleObject) {

return xml;
} catch (TransformerException | DOMException e) {
log.error("Unable to serialize example for schema {}", schema.getName(), e);
log.warn("Unable to serialize example for schema {}", schema.getName(), e);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public String prepareForSerialization(Schema schema, JsonNode exampleObject) {

return exampleYamlValueSerializer.writeDocumentAsYamlString(exampleObject);
} catch (JacksonException e) {
log.error("Serialize {}", name, e);
log.warn("Serialize {}", name, e);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ExampleGeneratorPostProcessor implements SchemasPostProcessor {
@Override
public void process(Schema schema, Map<String, Schema> definitions, String contentType) {
if (schema.getExample() == null) {
log.debug("Generate example for {}", schema.getName());
log.trace("Generate example for {}", schema.getName());

Optional<SchemaWalker> schemaWalkerOptional = schemaWalkerProvider.generatorFor(contentType);
if (schemaWalkerOptional.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Map<String, Operation> findOperations() {
Map<String, Operation> channels = scanner.scan();
foundOperations.addAll(channels.values());
} catch (Exception e) {
log.error("An error was encountered during operation scanning with {}: {}", scanner, e.getMessage(), e);
log.warn("An error was encountered during operation scanning with {}: {}", scanner, e.getMessage(), e);
}
}
return OperationMerger.mergeOperations(foundOperations);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static List<Class<?>> getClasses(String basePackages, TypeFilter filter,

private static Optional<Class<?>> getClass(String className) {
try {
log.debug("Found candidate class: {}", className);
log.trace("Found candidate class: {}", className);
return Optional.of(Class.forName(className));
} catch (ClassNotFoundException e) {
log.warn("Failed to get class for name: {}", className);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ public static <C extends Annotation, M extends Annotation, R> Stream<R> findAnno
Class<C> classAnnotationClass,
Class<M> methodAnnotationClass,
BiFunction<Class<?>, Set<MethodAndAnnotation<M>>, Stream<R>> transformer) {
log.debug("Scanning class \"{}\" for @\"{}\" annotation", clazz.getName(), classAnnotationClass.getName());
log.trace("Scanning class {} for @{} annotation", clazz.getName(), classAnnotationClass.getName());
Set<MethodAndAnnotation<M>> methods = Stream.of(clazz)
.filter(it -> AnnotationScannerUtil.isClassRelevant(it, classAnnotationClass))
.peek(it -> log.debug("Mapping class \"{}\"", it.getName()))
.flatMap(it -> AnnotationScannerUtil.findAnnotatedMethods(it, methodAnnotationClass))
.peek(it -> log.debug(
"Detected class method {}#{}",
clazz.getName(),
it.method().getName()))
.collect(Collectors.toSet());

if (methods.isEmpty()) {
Expand All @@ -51,22 +54,19 @@ static <A extends Annotation> boolean isClassRelevant(Class<?> clazz, Class<A> a

public static <A extends Annotation> Stream<MethodAndAnnotation<A>> findAnnotatedMethods(
Class<?> clazz, Class<A> methodAnnotationClass) {
log.debug(
"Scanning class \"{}\" for @\"{}\" annotated methods",
clazz.getName(),
methodAnnotationClass.getName());
log.trace("Scanning class {} for @{} annotated methods", clazz.getName(), methodAnnotationClass.getName());

Stream<Method> methods = Arrays.stream(ReflectionUtils.getAllDeclaredMethods(clazz))
.filter(ReflectionUtils.USER_DECLARED_METHODS::matches)
.filter(AnnotationScannerUtil::isNotHidden);

if (methodAnnotationClass == AllMethods.class) {
return methods.peek(method -> log.debug("Mapping method \"{}\"", method.getName()))
return methods.peek(method -> log.debug("Detected (all) method {}#{}", clazz.getName(), method.getName()))
.map(method -> new MethodAndAnnotation<>(method, null));
}

return methods.filter(method -> AnnotationUtil.findFirstAnnotation(methodAnnotationClass, method) != null)
.peek(method -> log.debug("Mapping method \"{}\"", method.getName()))
.peek(method -> log.debug("Detected method {}#{}", clazz.getName(), method.getName()))
.flatMap(method -> AnnotationUtil.findAnnotations(methodAnnotationClass, method).stream()
.map(annotation -> new MethodAndAnnotation<>(method, annotation)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class HeaderClassExtractor {

public SchemaObject extractHeader(Method method, PayloadSchemaObject payload) {
String methodName = "%s::%s".formatted(method.getDeclaringClass().getSimpleName(), method.getName());
log.debug("Extract header for {}", methodName);
log.trace("Extract header for {}", methodName);

SchemaObject headers = SchemaObject.builder()
.type(SchemaType.OBJECT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class PayloadExtractor {

public Optional<Type> extractFrom(Method method) {
String methodName = "%s::%s".formatted(method.getDeclaringClass().getSimpleName(), method.getName());
log.debug("Finding payload type for {}", methodName);
log.trace("Finding payload type for {}", methodName);

return getPayloadParameterIndex(method.getParameterTypes(), method.getParameterAnnotations(), methodName)
.map((parameterPayloadIndex) -> method.getGenericParameterTypes()[parameterPayloadIndex])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public ResponseEntity<String> publish(@RequestParam String topic, @RequestBody M
if (!isEnabled()) {
String errorMessage = "Publishing using %s is not enabled - message will not be published"
.formatted(this.getClass().getSimpleName());
log.warn(errorMessage);
log.info(errorMessage);
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(errorMessage);
}

Expand Down
11 changes: 11 additions & 0 deletions springwolf-examples/e2e/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ tasks.register('pnpm_run_install_deps', PnpmTask) {
inputs.file 'pnpm-lock.yaml'
outputs.upToDateWhen { true }
}
tasks.register('pnpmStart', PnpmTask) {
group = "pnpm"
dependsOn pnpmInstall

args = ['start']

inputs.file 'playwright.config.ts'
inputs.file 'package.json'
inputs.file 'pnpm-lock.yaml'
outputs.upToDateWhen { true }
}

tasks.register('pnpm_run_lint', PnpmTask) {
group = "pnpm"
Expand Down
4 changes: 3 additions & 1 deletion springwolf-examples/e2e/util/external_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ export function verifyNoErrorLogs(dockerLogs: MonitorDockerLogsResponse) {
.filter((message) => message.includes("i.g.s")) // io.github.springwolf
.filter(
(message) =>
message.includes("FATAL") ||
message.includes("ERROR") ||
message.includes("WARN") ||
message.includes("INFO") ||
message.includes("Failed")
);

expect(errorMessages, {
message: "expect: No Springwolf ERROR or WARN log messages found",
message: "expect: No Springwolf FATAL, ERROR, WARN or INFO log messages found",
}).toHaveLength(0);
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ExampleConsumer {

@RabbitListener(queues = AmqpConstants.QUEUE_EXAMPLE_QUEUE)
public void receiveExamplePayload(ExamplePayloadDto payload) {
log.info("Received new message in {}: {}", AmqpConstants.QUEUE_EXAMPLE_QUEUE, payload.toString());
log.debug("Received new message in {}: {}", AmqpConstants.QUEUE_EXAMPLE_QUEUE, payload.toString());

AnotherPayloadDto example = new AnotherPayloadDto();
example.setExample(payload);
Expand All @@ -37,7 +37,7 @@ public void receiveExamplePayload(ExamplePayloadDto payload) {

@RabbitListener(queues = AmqpConstants.QUEUE_ANOTHER_QUEUE)
public void receiveAnotherPayload(AnotherPayloadDto payload) {
log.info("Received new message in {}: {}", AmqpConstants.QUEUE_ANOTHER_QUEUE, payload.toString());
log.debug("Received new message in {}: {}", AmqpConstants.QUEUE_ANOTHER_QUEUE, payload.toString());
}

@RabbitListener(
Expand All @@ -56,7 +56,7 @@ public void receiveAnotherPayload(AnotherPayloadDto payload) {
key = AmqpConstants.ROUTING_KEY_EXAMPLE_TOPIC_ROUTING_KEY)
})
public void bindingsExample(ExamplePayloadDto payload) {
log.info(
log.debug(
"Received new message in {}" + " through exchange {}" + " using routing key {}: {}",
AmqpConstants.QUEUE_EXAMPLE_BINDINGS_QUEUE,
AmqpConstants.EXCHANGE_EXAMPLE_TOPIC_EXCHANGE,
Expand All @@ -66,23 +66,23 @@ public void bindingsExample(ExamplePayloadDto payload) {

@RabbitListener(queues = AmqpConstants.QUEUE_MULTI_PAYLOAD_QUEUE)
public void bindingsBeanExample(AnotherPayloadDto payload) {
log.info(
log.debug(
"Received new message in {} (AnotherPayloadDto): {}",
AmqpConstants.QUEUE_MULTI_PAYLOAD_QUEUE,
payload.toString());
}

@RabbitListener(queues = AmqpConstants.QUEUE_MULTI_PAYLOAD_QUEUE)
public void bindingsBeanExample(ExamplePayloadDto payload) {
log.info(
log.debug(
"Received new message in {} (ExamplePayloadDto): {}",
AmqpConstants.QUEUE_MULTI_PAYLOAD_QUEUE,
payload.toString());
}

@RabbitListener(queuesToDeclare = @Queue(name = AmqpConstants.QUEUE_CREATE, autoDelete = "false", durable = "true"))
public void queuesToDeclareCreate(Message message, @Payload GenericPayloadDto<String> payload) {
log.info(
log.debug(
"Received new message {} in {} (GenericPayloadDto<String>): {}",
message,
AmqpConstants.QUEUE_CREATE,
Expand All @@ -91,7 +91,7 @@ public void queuesToDeclareCreate(Message message, @Payload GenericPayloadDto<St

@RabbitListener(queuesToDeclare = @Queue(name = AmqpConstants.QUEUE_DELETE, autoDelete = "false", durable = "true"))
public void queuesToDeclareDelete(Message message, @Payload GenericPayloadDto<Long> payload) {
log.info(
log.debug(
"Received new message {} in {} (GenericPayloadDto<Long>): {}",
message,
AmqpConstants.QUEUE_DELETE,
Expand All @@ -109,7 +109,7 @@ public void queuesToDeclareDelete(Message message, @Payload GenericPayloadDto<Lo
key = AmqpConstants.ROUTING_KEY_ALL_MESSAGES,
value = @Queue(name = AmqpConstants.QUEUE_UPDATE, durable = "true", autoDelete = "false")))
public void bindingsUpdate(Message message, @Payload GenericPayloadDto<ExamplePayloadDto> payload) {
log.info(
log.debug(
"Received new message {} in {} (GenericPayloadDto<ExamplePayloadDto>): {}",
message,
AmqpConstants.EXCHANGE_CRUD_TOPIC_EXCHANGE_1,
Expand All @@ -127,7 +127,7 @@ public void bindingsUpdate(Message message, @Payload GenericPayloadDto<ExamplePa
key = AmqpConstants.ROUTING_KEY_ALL_MESSAGES,
value = @Queue(name = AmqpConstants.QUEUE_READ, durable = "false", autoDelete = "false")))
public void bindingsRead(Message message, @Payload ExamplePayloadDto payload) {
log.info(
log.debug(
"Received new message {} in {} (ExamplePayloadDto): {}",
message,
AmqpConstants.EXCHANGE_CRUD_TOPIC_EXCHANGE_2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,39 @@ public class CloudstreamConfiguration {
@Bean
public Function<ExamplePayloadDto, AnotherPayloadDto> process() {
return input -> {
log.info("Received new message in example-topic: {}", input);
log.debug("Received new message in example-topic: {}", input);
AnotherPayloadDto output = new AnotherPayloadDto("foo", input);
log.info("Publishing output: {}", output);
log.debug("Publishing output: {}", output);
return output;
};
}

@Bean
public BiFunction<ExamplePayloadDto, Map<String, Object>, AnotherPayloadDto> biProcess() {
return (input, headers) -> {
log.info("Received new message in bifunction-topic: {}. Headers: {}", input, headers);
log.debug("Received new message in bifunction-topic: {}. Headers: {}", input, headers);
AnotherPayloadDto output = new AnotherPayloadDto("foo", input);
log.info("Publishing output: {}", output);
log.debug("Publishing output: {}", output);
return output;
};
}

@Bean
public Consumer<AnotherPayloadDto> consumerMethod() {
return input -> log.info("Received new message in another-topic: {}", input.toString());
return input -> log.debug("Received new message in another-topic: {}", input.toString());
}

@Bean
public BiConsumer<AnotherPayloadDto, Map<String, Object>> biConsumerMethod() {
return (input, headers) ->
log.info("Received new message in biconsumer-topic: {}. Headers {}.", input.toString(), headers);
log.debug("Received new message in biconsumer-topic: {}. Headers {}.", input.toString(), headers);
}

@GooglePubSubAsyncChannelBinding(
schemaSettings = @GooglePubSubAsyncSchemaSetting(encoding = "BINARY", name = "project/test"))
@GooglePubSubAsyncMessageBinding(schema = @GooglePubSubAsyncMessageSchema(name = "project/test"))
@Bean
public Consumer<GooglePubSubPayloadDto> googlePubSubConsumerMethod() {
return input -> log.info("Received new message in google-pubsub-topic: {}", input.toString());
return input -> log.debug("Received new message in google-pubsub-topic: {}", input.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public class ConsumerClass implements Consumer<ExamplePayloadDto> {

@Override
public void accept(ExamplePayloadDto payload) {
log.info("Called with payload: {}", payload);
log.debug("Called with payload: {}", payload);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ExampleConsumer {

@JmsListener(destination = "example-queue")
public void receiveExamplePayload(ExamplePayloadDto payload) {
log.info("Received new message in example-queue: {}", payload.toString());
log.debug("Received new message in example-queue: {}", payload.toString());

AnotherPayloadDto example = new AnotherPayloadDto();
example.setExample(payload);
Expand All @@ -28,6 +28,6 @@ public void receiveExamplePayload(ExamplePayloadDto payload) {

@JmsListener(destination = "another-queue")
public void receiveAnotherPayload(AnotherPayloadDto payload) {
log.info("Received new message in another-queue: {}", payload.toString());
log.debug("Received new message in another-queue: {}", payload.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void producerCanUseSpringwolfConfigurationToSendMessage() {
// Awaitility is used, because message sent before amqp is ready are lost
Awaitility.await().atMost(10, TimeUnit.SECONDS).untilAsserted(() -> {
// when
log.info("Waiting for message in {} on {}", exampleConsumer, brokerUrl);
log.debug("Waiting for message in {} on {}", exampleConsumer, brokerUrl);
springwolfJmsProducer.send("example-queue", Map.of(), payload);

// then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ public class AvroConsumer {
"Requires a running kafka-schema-registry. See docker-compose.yml to start it"))
@KafkaAsyncOperationBinding
public void receiveExampleAvroPayload(AnotherPayloadAvroDto payloads) {
log.info("Received new message in avro-topic: {}", payloads.toString());
log.debug("Received new message in avro-topic: {}", payloads.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public class DiscriminatorConsumer {

@KafkaListener(topics = "vehicle-topic")
public void receiveExamplePayload(VehicleBase payload) {
log.info("Received new message in vehicle-topic: {}", payload.toString());
log.debug("Received new message in vehicle-topic: {}", payload.toString());
}
}
Loading
Loading