Skip to content

Commit

Permalink
Move and rename packages before 1.0.0 release (#630)
Browse files Browse the repository at this point in the history
* refactor(core): move packages and clarify naming

Co-authored-by: Timon Back <timonback@users.noreply.github.com>

* refactor(core): move test packages

Co-authored-by: Timon Back <timonback@users.noreply.github.com>

* refactor(core): apply spotless formatting

Co-authored-by: Timon Back <timonback@users.noreply.github.com>

---------

Co-authored-by: Timon Back <timonback@users.noreply.github.com>
  • Loading branch information
sam0r040 and timonback authored Mar 1, 2024
1 parent 2b420d1 commit f512448
Show file tree
Hide file tree
Showing 259 changed files with 984 additions and 953 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
package io.github.springwolf.addons.generic_binding.annotation;

import io.github.springwolf.core.asyncapi.scanners.channels.annotation.AsyncOperationBinding;
import io.github.springwolf.core.asyncapi.annotations.AsyncOperationBinding;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import io.github.springwolf.addons.generic_binding.annotation.AsyncGenericOperationBinding;
import io.github.springwolf.asyncapi.v3.bindings.OperationBinding;
import io.github.springwolf.core.asyncapi.scanners.bindings.ProcessedOperationBinding;
import io.github.springwolf.core.asyncapi.scanners.bindings.processor.AbstractOperationBindingProcessor;
import io.github.springwolf.core.asyncapi.scanners.bindings.operations.AbstractOperationBindingProcessor;
import io.github.springwolf.core.asyncapi.scanners.bindings.operations.ProcessedOperationBinding;

import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package io.github.springwolf.addons.generic_binding.annotation.processor;

import io.github.springwolf.addons.generic_binding.annotation.AsyncGenericOperationBinding;
import io.github.springwolf.core.asyncapi.scanners.bindings.ProcessedOperationBinding;
import io.github.springwolf.core.asyncapi.scanners.bindings.operations.ProcessedOperationBinding;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import io.github.springwolf.asyncapi.v3.model.channel.message.MessageReference;
import io.github.springwolf.asyncapi.v3.model.components.ComponentSchema;
import io.github.springwolf.asyncapi.v3.model.schema.SchemaObject;
import io.github.springwolf.core.schemas.SwaggerSchemaUtil;
import io.github.springwolf.core.asyncapi.components.SwaggerSchemaUtil;
import io.swagger.v3.core.util.Json;
import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.BooleanSchema;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
package io.github.springwolf.asyncapi.v3.bindings;

public class EmptyChannelBinding extends ChannelBinding {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
package io.github.springwolf.asyncapi.v3.bindings;

public class EmptyMessageBinding extends MessageBinding {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
package io.github.springwolf.asyncapi.v3.bindings;

public class EmptyOperationBinding extends OperationBinding {}
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
import io.swagger.v3.core.util.ObjectMapperFactory;

public class DefaultAsyncApiSerializer implements AsyncApiSerializerService {
public class DefaultAsyncApiSerializerService implements AsyncApiSerializerService {

private final ObjectMapper jsonMapper = ObjectMapperFactory.createJson31();
private final ObjectMapper yamlMapper = ObjectMapperFactory.createYaml31();
private final PrettyPrinter printer = new CustomPrettyPrinter();

public DefaultAsyncApiSerializer() {
public DefaultAsyncApiSerializerService() {
jsonMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS);
yamlMapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS);
((YAMLFactory) yamlMapper.getFactory()).enable(YAMLGenerator.Feature.INDENT_ARRAYS_WITH_INDICATOR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializerService;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -20,7 +20,7 @@ public static String readAsString(String resourceName) throws IOException {

public static JsonNode parseYamlFile(String resourceName) throws IOException {
try (InputStream inputStream = ClasspathUtil.class.getResourceAsStream(resourceName)) {
ObjectMapper objectMapper = new DefaultAsyncApiSerializer().getYamlObjectMapper();
ObjectMapper objectMapper = new DefaultAsyncApiSerializerService().getYamlObjectMapper();
return objectMapper.readTree(inputStream);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package io.github.springwolf.asyncapi.v3.bindings.amqp;

import io.github.springwolf.asyncapi.v3.ClasspathUtil;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializerService;
import io.github.springwolf.asyncapi.v3.model.AsyncAPI;
import io.github.springwolf.asyncapi.v3.model.channel.ChannelObject;
import io.github.springwolf.asyncapi.v3.model.channel.ChannelReference;
Expand All @@ -17,7 +17,7 @@
import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;

class AMQPBindingTest {
private static final DefaultAsyncApiSerializer serializer = new DefaultAsyncApiSerializer();
private static final DefaultAsyncApiSerializerService serializer = new DefaultAsyncApiSerializerService();

@Test
void shouldSerializeAMQPChannelBindingQueue() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package io.github.springwolf.asyncapi.v3.bindings.googlepubsub;

import io.github.springwolf.asyncapi.v3.ClasspathUtil;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializerService;
import io.github.springwolf.asyncapi.v3.model.AsyncAPI;
import io.github.springwolf.asyncapi.v3.model.channel.ChannelObject;
import io.github.springwolf.asyncapi.v3.model.channel.message.MessageObject;
Expand All @@ -18,7 +18,7 @@
import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;

class GooglePubSubBindingTest {
private static final DefaultAsyncApiSerializer serializer = new DefaultAsyncApiSerializer();
private static final DefaultAsyncApiSerializerService serializer = new DefaultAsyncApiSerializerService();

@Test
void shouldSerializeGooglePubSubMessage() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package io.github.springwolf.asyncapi.v3.bindings.jms;

import io.github.springwolf.asyncapi.v3.ClasspathUtil;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializerService;
import io.github.springwolf.asyncapi.v3.model.AsyncAPI;
import io.github.springwolf.asyncapi.v3.model.channel.ChannelObject;
import io.github.springwolf.asyncapi.v3.model.channel.message.MessageHeaders;
Expand All @@ -19,7 +19,7 @@
import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;

class JMSBindingTest {
private static final DefaultAsyncApiSerializer serializer = new DefaultAsyncApiSerializer();
private static final DefaultAsyncApiSerializerService serializer = new DefaultAsyncApiSerializerService();

@Test
void shouldSerializeJMSChannel() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package io.github.springwolf.asyncapi.v3.bindings.kafka;

import io.github.springwolf.asyncapi.v3.ClasspathUtil;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializerService;
import io.github.springwolf.asyncapi.v3.model.AsyncAPI;
import io.github.springwolf.asyncapi.v3.model.channel.ChannelObject;
import io.github.springwolf.asyncapi.v3.model.channel.message.MessageObject;
Expand All @@ -19,7 +19,7 @@
import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;

class KafkaBindingTest {
private static final DefaultAsyncApiSerializer serializer = new DefaultAsyncApiSerializer();
private static final DefaultAsyncApiSerializerService serializer = new DefaultAsyncApiSerializerService();

@Test
void shouldSerializeKafkaServerBinding() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package io.github.springwolf.asyncapi.v3.bindings.mqtt;

import io.github.springwolf.asyncapi.v3.ClasspathUtil;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializerService;
import io.github.springwolf.asyncapi.v3.model.AsyncAPI;
import io.github.springwolf.asyncapi.v3.model.schema.SchemaObject;
import io.github.springwolf.asyncapi.v3.model.server.Server;
Expand All @@ -15,7 +15,7 @@
import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;

class MQTTBindingTest {
private static final DefaultAsyncApiSerializer serializer = new DefaultAsyncApiSerializer();
private static final DefaultAsyncApiSerializerService serializer = new DefaultAsyncApiSerializerService();

@Test
void shouldSerializeMQTTServerExample1() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package io.github.springwolf.asyncapi.v3.bindings.pulsar;

import io.github.springwolf.asyncapi.v3.ClasspathUtil;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializerService;
import io.github.springwolf.asyncapi.v3.model.AsyncAPI;
import io.github.springwolf.asyncapi.v3.model.channel.ChannelObject;
import io.github.springwolf.asyncapi.v3.model.server.Server;
Expand All @@ -15,7 +15,7 @@
import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;

class PulsarBindingTest {
private static final DefaultAsyncApiSerializer serializer = new DefaultAsyncApiSerializer();
private static final DefaultAsyncApiSerializerService serializer = new DefaultAsyncApiSerializerService();

@Test
void shouldSerializePulsarServer() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package io.github.springwolf.asyncapi.v3.bindings.sns;

import io.github.springwolf.asyncapi.v3.ClasspathUtil;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializerService;
import io.github.springwolf.asyncapi.v3.model.AsyncAPI;
import io.github.springwolf.asyncapi.v3.model.channel.ChannelObject;
import org.junit.jupiter.api.Disabled;
Expand All @@ -15,7 +15,7 @@
import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;

class SNSBindingTest {
private static final DefaultAsyncApiSerializer serializer = new DefaultAsyncApiSerializer();
private static final DefaultAsyncApiSerializerService serializer = new DefaultAsyncApiSerializerService();

@Test
void shouldSerializeSNSChannel() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package io.github.springwolf.asyncapi.v3.bindings.sqs;

import io.github.springwolf.asyncapi.v3.ClasspathUtil;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializerService;
import io.github.springwolf.asyncapi.v3.model.AsyncAPI;
import io.github.springwolf.asyncapi.v3.model.channel.ChannelObject;
import org.junit.jupiter.api.Disabled;
Expand All @@ -14,7 +14,7 @@
import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;

class SQSBindingTest {
private static final DefaultAsyncApiSerializer serializer = new DefaultAsyncApiSerializer();
private static final DefaultAsyncApiSerializerService serializer = new DefaultAsyncApiSerializerService();

@Test
@Disabled("Binding example is not updated to AsyncAPI v3")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
package io.github.springwolf.core.asyncapi;
package io.github.springwolf.asyncapi.v3.jackson;

import io.github.springwolf.asyncapi.v3.ClasspathUtil;
import io.github.springwolf.asyncapi.v3.bindings.OperationBinding;
import io.github.springwolf.asyncapi.v3.bindings.kafka.KafkaMessageBinding;
import io.github.springwolf.asyncapi.v3.bindings.kafka.KafkaOperationBinding;
import io.github.springwolf.asyncapi.v3.jackson.AsyncApiSerializerService;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.model.AsyncAPI;
import io.github.springwolf.asyncapi.v3.model.channel.ChannelObject;
import io.github.springwolf.asyncapi.v3.model.channel.ChannelReference;
Expand All @@ -24,12 +23,7 @@
import io.github.springwolf.asyncapi.v3.model.schema.SchemaObject;
import io.github.springwolf.asyncapi.v3.model.schema.SchemaType;
import io.github.springwolf.asyncapi.v3.model.server.Server;
import io.github.springwolf.core.ClasspathUtil;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -39,12 +33,9 @@

import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;

@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = {DefaultAsyncApiSerializer.class})
class DefaultAsyncApiSerializerServiceIntegrationTest {

@Autowired
private AsyncApiSerializerService serializer;
private static final AsyncApiSerializerService serializer = new DefaultAsyncApiSerializerService();

private AsyncAPI getAsyncAPITestObject() {
Info info = Info.builder()
Expand Down Expand Up @@ -132,7 +123,7 @@ private AsyncAPI getAsyncAPITestObject() {
void AsyncAPI_should_map_to_a_valid_asyncapi_json() throws IOException {
var asyncapi = getAsyncAPITestObject();
String actual = serializer.toJsonString(asyncapi);
InputStream s = this.getClass().getResourceAsStream("/asyncapi/asyncapi.json");
InputStream s = this.getClass().getResourceAsStream("/v3/asyncapi/asyncapi.json");
String expected = new String(s.readAllBytes(), StandardCharsets.UTF_8);
assertThatJson(actual).isEqualTo(expected);
}
Expand All @@ -141,7 +132,7 @@ void AsyncAPI_should_map_to_a_valid_asyncapi_json() throws IOException {
void AsyncAPI_should_map_to_a_valid_asyncapi_yaml() throws IOException {
var asyncapi = getAsyncAPITestObject();
String actual = serializer.toJsonString(asyncapi);
var expected = ClasspathUtil.parseYamlFile("/asyncapi/asyncapi.yaml");
var expected = ClasspathUtil.parseYamlFile("/v3/asyncapi/asyncapi.yaml");
assertThatJson(actual).isEqualTo(expected);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import io.github.springwolf.asyncapi.v3.ClasspathUtil;
import io.github.springwolf.asyncapi.v3.bindings.kafka.KafkaOperationBinding;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializerService;
import io.github.springwolf.asyncapi.v3.model.channel.ChannelObject;
import io.github.springwolf.asyncapi.v3.model.channel.ChannelParameter;
import io.github.springwolf.asyncapi.v3.model.channel.ChannelReference;
Expand Down Expand Up @@ -33,7 +33,7 @@
import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;

class AsyncAPITest {
private static final DefaultAsyncApiSerializer serializer = new DefaultAsyncApiSerializer();
private static final DefaultAsyncApiSerializerService serializer = new DefaultAsyncApiSerializerService();

@Test
void shouldCreateSimpleAsyncAPI() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import io.github.springwolf.asyncapi.v3.bindings.amqp.AMQPChannelBinding;
import io.github.springwolf.asyncapi.v3.bindings.amqp.AMQPChannelQueueProperties;
import io.github.springwolf.asyncapi.v3.bindings.amqp.AMQPChannelType;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializerService;
import io.github.springwolf.asyncapi.v3.model.ExternalDocumentation;
import io.github.springwolf.asyncapi.v3.model.Tag;
import io.github.springwolf.asyncapi.v3.model.channel.message.MessageReference;
Expand All @@ -18,7 +18,7 @@
import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;

class ChannelObjectTest {
private static final DefaultAsyncApiSerializer serializer = new DefaultAsyncApiSerializer();
private static final DefaultAsyncApiSerializerService serializer = new DefaultAsyncApiSerializerService();

@Test
void shouldSerializeChannelObject() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package io.github.springwolf.asyncapi.v3.model.channel;

import io.github.springwolf.asyncapi.v3.ClasspathUtil;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializerService;
import org.junit.jupiter.api.Test;

import java.io.IOException;
Expand All @@ -11,7 +11,7 @@
import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;

class ChannelParameterTest {
private static final DefaultAsyncApiSerializer serializer = new DefaultAsyncApiSerializer();
private static final DefaultAsyncApiSerializerService serializer = new DefaultAsyncApiSerializerService();

@Test
void shouldSerializeChannelParameter() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
package io.github.springwolf.asyncapi.v3.model.channel;

import io.github.springwolf.asyncapi.v3.ClasspathUtil;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializerService;
import org.junit.jupiter.api.Test;

import java.io.IOException;

import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;

class CorrelationIDTest {
private static final DefaultAsyncApiSerializer serializer = new DefaultAsyncApiSerializer();
private static final DefaultAsyncApiSerializerService serializer = new DefaultAsyncApiSerializerService();

@Test
void shouldSerializeCorrelationID() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package io.github.springwolf.asyncapi.v3.model.channel;

import io.github.springwolf.asyncapi.v3.ClasspathUtil;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializerService;
import io.github.springwolf.asyncapi.v3.model.Tag;
import io.github.springwolf.asyncapi.v3.model.channel.message.MessageExample;
import io.github.springwolf.asyncapi.v3.model.channel.message.MessageHeaders;
Expand All @@ -20,7 +20,7 @@
import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;

class MessageTest {
private static final DefaultAsyncApiSerializer serializer = new DefaultAsyncApiSerializer();
private static final DefaultAsyncApiSerializerService serializer = new DefaultAsyncApiSerializerService();

@Test
void shouldSerializeMessage() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
package io.github.springwolf.asyncapi.v3.model.info;

import io.github.springwolf.asyncapi.v3.ClasspathUtil;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializer;
import io.github.springwolf.asyncapi.v3.jackson.DefaultAsyncApiSerializerService;
import org.junit.jupiter.api.Test;

import java.io.IOException;

import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;

class ContactTest {
private static final DefaultAsyncApiSerializer serializer = new DefaultAsyncApiSerializer();
private static final DefaultAsyncApiSerializerService serializer = new DefaultAsyncApiSerializerService();

@Test
void shouldSerializeContact() throws IOException {
Expand Down
Loading

0 comments on commit f512448

Please sign in to comment.