From ff50863622c0f8ff5e2c99a6e67e2495a4ae66dd Mon Sep 17 00:00:00 2001 From: Andrea La Grotteria Date: Tue, 29 Oct 2024 16:32:13 +0100 Subject: [PATCH] Adds diffLink macro to core. Fix #1539. (#1540) --- .../guides/GuideAsciidocGenerator.groovy | 8 +- .../core/BuildDiffLinkSubstitution.java | 76 +++++++++++++++++++ .../core/DependencyMacroSubstitution.java | 2 +- .../guides/core/GuidesConfiguration.java | 2 + .../core/GuidesConfigurationProperties.java | 11 +++ .../guides/core/MacroSubstitution.java | 23 +++++- .../io/micronaut/guides/core/MacroUtils.java | 1 - .../core/SourceBlockMacroSubstitution.java | 14 ++-- .../core/BuildDiffLinkSubstitutionTest.java | 76 +++++++++++++++++++ .../core/DependencyMacroSubstitutionTest.java | 2 +- .../micronaut/guides/core/GuideTestUtils.java | 13 ++++ .../core/RawTestMacroSubstitutionTest.java | 6 +- .../core/ResourceMacroSubstitutionTest.java | 6 +- .../core/SourceMacroSubstitutionTest.java | 12 +-- .../core/TestMacroSubstitutionTest.java | 14 ++-- .../TestResourceMacroSubstitutionTest.java | 2 +- .../core/ZipIncludeMacroSubstitutionTest.java | 4 +- .../src/test/resources/metadata-diff.json | 24 ++++++ ...naut-database-authentication-provider.adoc | 2 + .../micronaut-dynamodb.adoc | 2 +- .../micronaut-google-cloud-http-function.adoc | 2 +- guides/micronaut-k8s/micronaut-k8s.adoc | 6 ++ ...icroservices-services-discover-consul.adoc | 6 ++ ...icroservices-services-discover-eureka.adoc | 6 ++ guides/micronaut-mqtt/micronaut-mqtt.adoc | 4 + .../micronaut-oracle-autonomous-db.adoc | 2 +- .../micronaut-oracle-function-http.adoc | 2 + .../micronaut-oracle-function.adoc | 2 +- .../micronaut-rabbitmq-rpc.adoc | 6 ++ .../micronaut-security-jwt-cookie.adoc | 2 + .../micronaut-security-session.adoc | 2 + .../micronaut-security-x509.adoc | 2 +- .../common-create-app-features-h2.adoc | 2 + ...on-create-app-features-testcontainers.adoc | 2 + .../snippets/common-create-app-features.adoc | 2 +- .../common/snippets/common-diff-general.adoc | 3 + src/docs/common/snippets/common-diff.adoc | 3 + 37 files changed, 307 insertions(+), 47 deletions(-) create mode 100644 buildSrc/src/main/java/io/micronaut/guides/core/BuildDiffLinkSubstitution.java create mode 100644 buildSrc/src/test/java/io/micronaut/guides/core/BuildDiffLinkSubstitutionTest.java create mode 100644 buildSrc/src/test/java/io/micronaut/guides/core/GuideTestUtils.java create mode 100644 buildSrc/src/test/resources/metadata-diff.json create mode 100644 src/docs/common/snippets/common-diff-general.adoc create mode 100644 src/docs/common/snippets/common-diff.adoc diff --git a/buildSrc/src/main/groovy/io/micronaut/guides/GuideAsciidocGenerator.groovy b/buildSrc/src/main/groovy/io/micronaut/guides/GuideAsciidocGenerator.groovy index c50033dfc96..5987dd0e059 100644 --- a/buildSrc/src/main/groovy/io/micronaut/guides/GuideAsciidocGenerator.groovy +++ b/buildSrc/src/main/groovy/io/micronaut/guides/GuideAsciidocGenerator.groovy @@ -613,10 +613,9 @@ class GuideAsciidocGenerator { } private static String buildDiffLink(String line, GuidesOption guidesOption, Guide metadata) { - String appName = extractAppName(line) ?: DEFAULT_APP_NAME App app = metadata.apps().find { it.name() == appName } - String link = 'https://micronaut.io/launch?' + + return 'https://micronaut.io/launch?' + featureNames(line, app, guidesOption).collect { 'features=' + it }.join('&') + '&lang=' + guidesOption.language.name() + '&build=' + guidesOption.buildTool.name() + @@ -625,10 +624,7 @@ class GuideAsciidocGenerator { '&type=' + app.applicationType().name() + '&package=example.micronaut' + '&activity=diff' + - '[view the dependency and configuration changes from the specified features, window="_blank"]' - - "NOTE: If you have an existing Micronaut application and want to add the functionality described here, you can " + - link + " and apply those changes to your application." + '[Diff, window="_blank"]' } private static String processGuideLink(String line) { diff --git a/buildSrc/src/main/java/io/micronaut/guides/core/BuildDiffLinkSubstitution.java b/buildSrc/src/main/java/io/micronaut/guides/core/BuildDiffLinkSubstitution.java new file mode 100644 index 00000000000..4888588d504 --- /dev/null +++ b/buildSrc/src/main/java/io/micronaut/guides/core/BuildDiffLinkSubstitution.java @@ -0,0 +1,76 @@ +package io.micronaut.guides.core; + +import io.micronaut.guides.core.asciidoc.AsciidocMacro; +import io.micronaut.guides.core.asciidoc.Attribute; +import io.micronaut.http.uri.UriBuilder; +import io.micronaut.starter.application.ApplicationType; +import jakarta.inject.Singleton; +import java.net.URI; +import java.util.*; +import static io.micronaut.guides.core.MacroUtils.*; + +@Singleton +public class BuildDiffLinkSubstitution implements MacroSubstitution { + private static final String QUERY_PARAMLANG = "lang"; + private static final String QUERY_PARAM_BUILD = "build"; + private static final String QUERY_PARAM_TEST = "test"; + private static final String QUERY_PARAM_NAME = "name"; + private static final String QUERY_PARAM_TYPE = "type"; + private static final String QUERY_PARAM_PACKAGE = "package"; + private static final String QUERY_PARAM_ACTIVITY = "activity"; + private static final String QUERY_PARAM_FEATURES = "features"; + public static final String MACRO_DIFF_LINK = "diffLink"; + private static final String ATTRIBUTE_FEATURES = "features"; + private static final String ATTRIBUTE_EXCLUDE_FEATURES = "featureExcludes"; + private final GuidesConfiguration guidesConfiguration; + + public BuildDiffLinkSubstitution(GuidesConfiguration config) { + this.guidesConfiguration = config; + } + + @Override + public String substitute(String str, Guide guide, GuidesOption option) { + for(String line : findMacroLines(str, MACRO_DIFF_LINK)) { + Optional asciidocMacroOptional = AsciidocMacro.of(MACRO_DIFF_LINK, line); + if (asciidocMacroOptional.isEmpty()) { + continue; + } + AsciidocMacro asciidocMacro = asciidocMacroOptional.get(); + String res = buildDiffLink(asciidocMacro, guide, option).toString() + "[Diff]"; + str = str.replace(line,res); + } + return str; + } + + private URI buildDiffLink(AsciidocMacro asciidocMacro, Guide guide, GuidesOption option) { + String appName = appName(asciidocMacro); + App app = app(guide, asciidocMacro); + Set features = features(app, asciidocMacro, option); + UriBuilder uriBuilder = UriBuilder.of(guidesConfiguration.getProjectGeneratorUrl()) + .queryParam(QUERY_PARAMLANG, option.getLanguage().name()) + .queryParam(QUERY_PARAM_BUILD, option.getBuildTool().name()) + .queryParam(QUERY_PARAM_TEST, option.getTestFramework().name()) + .queryParam(QUERY_PARAM_NAME, appName.equals(guidesConfiguration.getDefaultAppName()) ? "micronautguide" : appName) + .queryParam(QUERY_PARAM_TYPE, app != null ? app.applicationType().name() : ApplicationType.DEFAULT.name()) + .queryParam(QUERY_PARAM_PACKAGE, guidesConfiguration.getPackageName()) + .queryParam(QUERY_PARAM_ACTIVITY, "diff"); + features.forEach(f -> uriBuilder.queryParam(QUERY_PARAM_FEATURES, f)); + return uriBuilder.build(); + } + + private static Set features(App app, AsciidocMacro asciidocMacro, GuidesOption option) { + Set features = new HashSet<>(); + if (app != null) { + features.addAll(GuideUtils.getAppVisibleFeatures(app, option.getLanguage())); + } + asciidocMacro.attributes().stream() + .filter(attribute -> attribute.key().equals(ATTRIBUTE_FEATURES)) + .map(Attribute::values) + .forEach(features::addAll); + asciidocMacro.attributes().stream() + .filter(attribute -> attribute.key().equals(ATTRIBUTE_EXCLUDE_FEATURES)) + .map(Attribute::values) + .forEach(features::removeAll); + return features; + } +} diff --git a/buildSrc/src/main/java/io/micronaut/guides/core/DependencyMacroSubstitution.java b/buildSrc/src/main/java/io/micronaut/guides/core/DependencyMacroSubstitution.java index 23a595f9ff0..456bb371c54 100644 --- a/buildSrc/src/main/java/io/micronaut/guides/core/DependencyMacroSubstitution.java +++ b/buildSrc/src/main/java/io/micronaut/guides/core/DependencyMacroSubstitution.java @@ -8,7 +8,7 @@ @Singleton public class DependencyMacroSubstitution implements MacroSubstitution{ @Override - public String substitute(String str, String slug, GuidesOption option) { + public String substitute(String str, Guide guide, GuidesOption option) { for(String block : findMacroGroups(str, "dependencies")){ List lines = DependencyLines.asciidoc(block.replace(":dependencies:","").strip().lines().toList(), option.getBuildTool(), option.getLanguage()); str = str.replace(block,String.join("\n", lines)); diff --git a/buildSrc/src/main/java/io/micronaut/guides/core/GuidesConfiguration.java b/buildSrc/src/main/java/io/micronaut/guides/core/GuidesConfiguration.java index 27a38607fd4..08f70d58cda 100644 --- a/buildSrc/src/main/java/io/micronaut/guides/core/GuidesConfiguration.java +++ b/buildSrc/src/main/java/io/micronaut/guides/core/GuidesConfiguration.java @@ -7,5 +7,7 @@ public interface GuidesConfiguration { String getTitle(); String getLicensePath(); String getPackageName(); + String getDefaultAppName(); + String getProjectGeneratorUrl(); List getFilesWithHeader(); } diff --git a/buildSrc/src/main/java/io/micronaut/guides/core/GuidesConfigurationProperties.java b/buildSrc/src/main/java/io/micronaut/guides/core/GuidesConfigurationProperties.java index 519d15bbba3..eb8091e52d3 100644 --- a/buildSrc/src/main/java/io/micronaut/guides/core/GuidesConfigurationProperties.java +++ b/buildSrc/src/main/java/io/micronaut/guides/core/GuidesConfigurationProperties.java @@ -15,6 +15,9 @@ public class GuidesConfigurationProperties implements GuidesConfiguration { private String licensePath = DEFAULT_LICENSEHEADER; private String packageName = DEFAULT_PACKAGE_NAME; private List sourceFilesExtensions = List.of("java", "kotlin", "groovy"); + private static final String DEFAULT_APP_NAME = "default"; + private static final String HOMEPAGE_URL = "https://micronaut.io"; + private static final String LAUNCHER_URL = HOMEPAGE_URL + "/launch"; @Override public String getPackageName() { @@ -52,6 +55,14 @@ public void setTitle(String title) { this.title = title; } + @Override + public String getDefaultAppName() { + return DEFAULT_APP_NAME; + } + + @Override + public String getProjectGeneratorUrl() { return LAUNCHER_URL; } + @Override public List getFilesWithHeader() { return sourceFilesExtensions; diff --git a/buildSrc/src/main/java/io/micronaut/guides/core/MacroSubstitution.java b/buildSrc/src/main/java/io/micronaut/guides/core/MacroSubstitution.java index f016e0af8a9..d13b72181da 100644 --- a/buildSrc/src/main/java/io/micronaut/guides/core/MacroSubstitution.java +++ b/buildSrc/src/main/java/io/micronaut/guides/core/MacroSubstitution.java @@ -1,10 +1,31 @@ package io.micronaut.guides.core; import io.micronaut.core.annotation.NonNull; +import io.micronaut.guides.core.asciidoc.AsciidocMacro; +import io.micronaut.guides.core.asciidoc.Attribute; public interface MacroSubstitution { String APP = "app"; + String APP_NAME_DEFAULT = "default"; @NonNull - String substitute(@NonNull String str, @NonNull String slug, @NonNull GuidesOption option); + String substitute(@NonNull String str, @NonNull Guide guide, @NonNull GuidesOption option); + + default App app(Guide guide, AsciidocMacro asciidocMacro) { + final String appName = appName(asciidocMacro); + return guide.apps().stream() + .filter(a -> a.name().equals(appName)) + .findFirst() + .orElseThrow(() -> new RuntimeException("app not found for app name" + appName)); + } + + default String appName(AsciidocMacro asciidocMacro) { + return asciidocMacro.attributes().stream() + .filter(attribute -> attribute.key().equals(APP)) + .map(Attribute::values) + .filter(l -> !l.isEmpty()) + .map(l -> l.get(0)) + .findFirst() + .orElse(APP_NAME_DEFAULT); + } } diff --git a/buildSrc/src/main/java/io/micronaut/guides/core/MacroUtils.java b/buildSrc/src/main/java/io/micronaut/guides/core/MacroUtils.java index f1e6e8e4934..d8b797ccef6 100644 --- a/buildSrc/src/main/java/io/micronaut/guides/core/MacroUtils.java +++ b/buildSrc/src/main/java/io/micronaut/guides/core/MacroUtils.java @@ -1,7 +1,6 @@ package io.micronaut.guides.core; import io.micronaut.core.annotation.NonNull; - import java.util.ArrayList; import java.util.List; diff --git a/buildSrc/src/main/java/io/micronaut/guides/core/SourceBlockMacroSubstitution.java b/buildSrc/src/main/java/io/micronaut/guides/core/SourceBlockMacroSubstitution.java index d58a6d1fb49..916b2a05926 100644 --- a/buildSrc/src/main/java/io/micronaut/guides/core/SourceBlockMacroSubstitution.java +++ b/buildSrc/src/main/java/io/micronaut/guides/core/SourceBlockMacroSubstitution.java @@ -4,6 +4,7 @@ import org.jetbrains.annotations.NotNull; import java.nio.file.Path; +import java.util.List; import java.util.Optional; import static io.micronaut.guides.core.MacroUtils.*; @@ -35,18 +36,13 @@ public GuidesConfiguration getGuidesConfiguration() { } @Override - public String substitute(String str, String slug, GuidesOption option) { + public String substitute(String str, Guide guide, GuidesOption option) { + String slug = guide.slug(); for (String line : findMacroLines(str, getMacroName())) { Optional asciidocMacroOptional = AsciidocMacro.of(getMacroName(), line); if (asciidocMacroOptional.isPresent()) { AsciidocMacro asciidocMacro = asciidocMacroOptional.get(); - String appName = asciidocMacro.attributes().stream() - .filter(attribute -> attribute.key().equals(APP)) - .map(Attribute::values) - .filter(l -> !l.isEmpty()) - .map(l -> l.get(0)) - .findFirst() - .orElse(APP); + String appName = appName(asciidocMacro); String condensedTarget = condensedTarget(asciidocMacro, option); String[] arr; @@ -105,7 +101,7 @@ protected String sourceTitle( Classpath classpath, String language, String packageName) { - return (appName.equals(MacroSubstitution.APP) ? "" : (appName + "/")) + sourceConventionFolder(classpath, language) + "/" + return (appName.equals(MacroSubstitution.APP_NAME_DEFAULT) ? "" : (appName + "/")) + sourceConventionFolder(classpath, language) + "/" + (getFileType() == FileType.CODE ? (packageName.replace(".", "/") + "/") : "") + condensedTarget; } diff --git a/buildSrc/src/test/java/io/micronaut/guides/core/BuildDiffLinkSubstitutionTest.java b/buildSrc/src/test/java/io/micronaut/guides/core/BuildDiffLinkSubstitutionTest.java new file mode 100644 index 00000000000..39aa0e280b5 --- /dev/null +++ b/buildSrc/src/test/java/io/micronaut/guides/core/BuildDiffLinkSubstitutionTest.java @@ -0,0 +1,76 @@ +package io.micronaut.guides.core; + +import io.micronaut.core.beans.BeanIntrospection; +import io.micronaut.core.io.ResourceLoader; +import io.micronaut.http.uri.UriBuilder; +import io.micronaut.json.JsonMapper; +import io.micronaut.starter.api.TestFramework; +import io.micronaut.starter.options.BuildTool; +import io.micronaut.starter.options.Language; +import io.micronaut.test.extensions.junit5.annotation.MicronautTest; +import jakarta.inject.Inject; +import org.junit.jupiter.api.Test; + +import java.io.InputStream; +import java.net.URI; +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.*; + +@MicronautTest(startApplication = false) +class BuildDiffLinkSubstitutionTest { + @Inject + BuildDiffLinkSubstitution buildDiffLinkSubstitution; + + @Inject + JsonMapper jsonMapper; + + @Inject + ResourceLoader resourceLoader; + + @Test + void testSubstitute(){ + assertDoesNotThrow(() -> BeanIntrospection.getIntrospection(Guide.class)); + Optional inputStreamOptional = resourceLoader.getResourceAsStream("classpath:metadata-diff.json"); + assertTrue(inputStreamOptional.isPresent()); + final InputStream inputStreamBase = inputStreamOptional.get(); + Guide guide = assertDoesNotThrow(() -> jsonMapper.readValue(inputStreamBase, Guide.class)); + String str = "diffLink:[app=cli]"; + String resJava = buildDiffLinkSubstitution.substitute(str, guide, new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); + URI expectedURI = UriBuilder.of("https://micronaut.io") + .path("launch") + .queryParam("lang", "JAVA") + .queryParam("build", "GRADLE") + .queryParam("test", "JUNIT") + .queryParam("name", "cli") + .queryParam("type", "CLI") + .queryParam("package", "example.micronaut") + .queryParam("activity", "diff") + .queryParam("features", "awaitility") + .queryParam("features", "graalvm") + .queryParam("features", "mqtt") + .queryParam("features", "yaml") + .build(); + String expectedJava = expectedURI.toString() + "[Diff]"; + assertEquals(expectedJava, resJava); + + str = "diffLink:[app=cli,featureExcludes=graalvm]"; + resJava = buildDiffLinkSubstitution.substitute(str, guide, new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); + expectedURI = UriBuilder.of("https://micronaut.io") + .path("launch") + .queryParam("lang", "JAVA") + .queryParam("build", "GRADLE") + .queryParam("test", "JUNIT") + .queryParam("name", "cli") + .queryParam("type", "CLI") + .queryParam("package", "example.micronaut") + .queryParam("activity", "diff") + .queryParam("features", "awaitility") + .queryParam("features", "mqtt") + .queryParam("features", "yaml") + .build(); + expectedJava = expectedURI.toString() + "[Diff]"; + assertEquals(expectedJava, resJava); + } + +} diff --git a/buildSrc/src/test/java/io/micronaut/guides/core/DependencyMacroSubstitutionTest.java b/buildSrc/src/test/java/io/micronaut/guides/core/DependencyMacroSubstitutionTest.java index c5b58c2680b..04330c41aeb 100644 --- a/buildSrc/src/test/java/io/micronaut/guides/core/DependencyMacroSubstitutionTest.java +++ b/buildSrc/src/test/java/io/micronaut/guides/core/DependencyMacroSubstitutionTest.java @@ -36,7 +36,7 @@ void testSubstitute(){ dependency:micronaut-security-session[groupId=io.micronaut.security] """; - String resJava = dependencyMacroSubstitution.substitute(str, "micronaut-jaxrs", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.SPOCK)); + String resJava = dependencyMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-jaxrs"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.SPOCK)); String expectedJava = """ ==== Dependencies diff --git a/buildSrc/src/test/java/io/micronaut/guides/core/GuideTestUtils.java b/buildSrc/src/test/java/io/micronaut/guides/core/GuideTestUtils.java new file mode 100644 index 00000000000..f59ef362a99 --- /dev/null +++ b/buildSrc/src/test/java/io/micronaut/guides/core/GuideTestUtils.java @@ -0,0 +1,13 @@ +package io.micronaut.guides.core; + +import java.util.List; +import java.util.Map; + +public final class GuideTestUtils { + private GuideTestUtils() { + } + + public static Guide guideWithSlug(String slug) { + return new Guide("", "", List.of(), List.of(), null, 0, 0, null, null, null, "", List.of(), List.of(), List.of(), null, List.of(), slug, null, "", Map.of(), List.of()); + } +} diff --git a/buildSrc/src/test/java/io/micronaut/guides/core/RawTestMacroSubstitutionTest.java b/buildSrc/src/test/java/io/micronaut/guides/core/RawTestMacroSubstitutionTest.java index aeec4afd6ed..19679633935 100644 --- a/buildSrc/src/test/java/io/micronaut/guides/core/RawTestMacroSubstitutionTest.java +++ b/buildSrc/src/test/java/io/micronaut/guides/core/RawTestMacroSubstitutionTest.java @@ -21,7 +21,7 @@ void testSubstitute() { rawTest:HomePage[] """; - String resJava = rawTestMacroSubstitution.substitute(str, "micronaut-security-jwt-cookie", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.SPOCK)); + String resJava = rawTestMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-security-jwt-cookie"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.SPOCK)); String expectedJava = """ Create three pages: @@ -32,7 +32,7 @@ void testSubstitute() { ---- """; assertEquals(expectedJava, resJava); - String resKotlin = rawTestMacroSubstitution.substitute(str, "micronaut-security-jwt-cookie", new GuidesOption(BuildTool.GRADLE, Language.KOTLIN, TestFramework.SPOCK)); + String resKotlin = rawTestMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-security-jwt-cookie"), new GuidesOption(BuildTool.GRADLE, Language.KOTLIN, TestFramework.SPOCK)); String expectedKotlin = """ Create three pages: @@ -43,7 +43,7 @@ void testSubstitute() { ---- """; assertEquals(expectedKotlin, resKotlin); - String resGroovy = rawTestMacroSubstitution.substitute(str, "micronaut-security-jwt-cookie", new GuidesOption(BuildTool.GRADLE, Language.GROOVY, TestFramework.SPOCK)); + String resGroovy = rawTestMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-security-jwt-cookie"), new GuidesOption(BuildTool.GRADLE, Language.GROOVY, TestFramework.SPOCK)); String expectedGroovy = """ Create three pages: diff --git a/buildSrc/src/test/java/io/micronaut/guides/core/ResourceMacroSubstitutionTest.java b/buildSrc/src/test/java/io/micronaut/guides/core/ResourceMacroSubstitutionTest.java index fd35268504c..4bfca1ed88a 100644 --- a/buildSrc/src/test/java/io/micronaut/guides/core/ResourceMacroSubstitutionTest.java +++ b/buildSrc/src/test/java/io/micronaut/guides/core/ResourceMacroSubstitutionTest.java @@ -18,7 +18,7 @@ class ResourceMacroSubstitutionTest { @Test void testSubstitute() { String str = "resource:../../../ttfr.sh[]"; - String resJava = resourceMacroSubstitution.substitute(str, "executable-jar", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); + String resJava = resourceMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("executable-jar"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); String expectedJava = """ [source,sh] .ttfr.sh @@ -31,7 +31,7 @@ void testSubstitute() { @Test void testSubstituteWithTags() { String str = "resource:application.yml[tag=endpoints]"; - String resJava = resourceMacroSubstitution.substitute(str, "adding-commit-info", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); + String resJava = resourceMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("adding-commit-info"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); String expectedJava = """ [source,yaml] .src/main/resources/application.yml @@ -52,7 +52,7 @@ void testMultiLineInput(){ resource:test.yml[tag=security,app=testApp] """; - String resJava = resourceMacroSubstitution.substitute(str, "adding-commit-info", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); + String resJava = resourceMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("adding-commit-info"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); String expectedJava = """ The `git.properties` file that is generated by the `gradle-git-properties` plugin will not be accessible from the native executable unless access to the file is diff --git a/buildSrc/src/test/java/io/micronaut/guides/core/SourceMacroSubstitutionTest.java b/buildSrc/src/test/java/io/micronaut/guides/core/SourceMacroSubstitutionTest.java index 923ce5db74f..0fb1326173c 100644 --- a/buildSrc/src/test/java/io/micronaut/guides/core/SourceMacroSubstitutionTest.java +++ b/buildSrc/src/test/java/io/micronaut/guides/core/SourceMacroSubstitutionTest.java @@ -17,7 +17,7 @@ class SourceMacroSubstitutionTest { @Test void testSubstitute(){ String str = "source:GithubConfiguration[]\n"; - String resJava = sourceMacroSubstitution.substitute(str, "micronaut-http-client", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.SPOCK)); + String resJava = sourceMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-http-client"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.SPOCK)); String expectedJava = """ [source,java] .src/main/java/example/micronaut/GithubConfiguration.java @@ -26,7 +26,7 @@ void testSubstitute(){ ---- """; assertEquals(expectedJava, resJava); - String resKotlin = sourceMacroSubstitution.substitute(str, "micronaut-http-client", new GuidesOption(BuildTool.GRADLE, Language.KOTLIN, TestFramework.KOTEST)); + String resKotlin = sourceMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-http-client"), new GuidesOption(BuildTool.GRADLE, Language.KOTLIN, TestFramework.KOTEST)); String expectedKotlin = """ [source,kotlin] .src/main/kotlin/example/micronaut/GithubConfiguration.kt @@ -35,7 +35,7 @@ void testSubstitute(){ ---- """; assertEquals(expectedKotlin, resKotlin); - String resGroovy = sourceMacroSubstitution.substitute(str, "micronaut-http-client", new GuidesOption(BuildTool.GRADLE, Language.GROOVY, TestFramework.JUNIT)); + String resGroovy = sourceMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-http-client"), new GuidesOption(BuildTool.GRADLE, Language.GROOVY, TestFramework.JUNIT)); String expectedGroovy = """ [source,groovy] .src/main/groovy/example/micronaut/GithubConfiguration.groovy @@ -49,7 +49,7 @@ void testSubstitute(){ @Test void TestSubstituteWithApp(){ String str = "source:Application[app=springboot]\n"; - String resJava = sourceMacroSubstitution.substitute(str, "spring-boot-to-micronaut-application-class", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.SPOCK)); + String resJava = sourceMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("spring-boot-to-micronaut-application-class"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.SPOCK)); String expectedJava = """ [source,java] .springboot/src/main/java/example/micronaut/Application.java @@ -63,7 +63,7 @@ void TestSubstituteWithApp(){ @Test void TestSubstituteWithTags(){ String str = "source:TeamConfiguration[tags=teamConfigClassNoBuilder;gettersandsetters]\n"; - String resJava = sourceMacroSubstitution.substitute(str, "micronaut-configuration", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.SPOCK)); + String resJava = sourceMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-configuration"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.SPOCK)); String expectedJava = """ [source,java] .src/main/java/example/micronaut/TeamConfiguration.java @@ -77,7 +77,7 @@ void TestSubstituteWithTags(){ @Test void TestSubstituteWithMultiple(){ String str = "source:TeamConfiguration[app=springboot,tags=teamConfigClassNoBuilder;gettersandsetters,indent=0]\n"; - String resJava = sourceMacroSubstitution.substitute(str, "micronaut-configuration", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.SPOCK)); + String resJava = sourceMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-configuration"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.SPOCK)); String expectedJava = """ [source,java] .springboot/src/main/java/example/micronaut/TeamConfiguration.java diff --git a/buildSrc/src/test/java/io/micronaut/guides/core/TestMacroSubstitutionTest.java b/buildSrc/src/test/java/io/micronaut/guides/core/TestMacroSubstitutionTest.java index b0d01dbbf20..4d4a2c8f263 100644 --- a/buildSrc/src/test/java/io/micronaut/guides/core/TestMacroSubstitutionTest.java +++ b/buildSrc/src/test/java/io/micronaut/guides/core/TestMacroSubstitutionTest.java @@ -18,7 +18,7 @@ class TestMacroSubstitutionTest { @Test void testSubstitute() { String str = "test:HelloControllerTest[]"; - String resJava = testMacroSubstitution.substitute(str, "micronaut-http-client", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); + String resJava = testMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-http-client"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); String expectedJava = """ [source,java] .src/test/java/example/micronaut/HelloControllerTest.java @@ -26,7 +26,7 @@ void testSubstitute() { include::{sourceDir}/micronaut-http-client/micronaut-http-client-gradle-java/src/test/java/example/micronaut/HelloControllerTest.java[lines=16..-1] ----"""; assertEquals(expectedJava, resJava); - String resKotlin = testMacroSubstitution.substitute(str, "micronaut-http-client", new GuidesOption(BuildTool.GRADLE, Language.KOTLIN, TestFramework.KOTEST)); + String resKotlin = testMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-http-client"), new GuidesOption(BuildTool.GRADLE, Language.KOTLIN, TestFramework.KOTEST)); String expectedKotlin = """ [source,kotlin] .src/test/kotlin/example/micronaut/HelloControllerTest.kt @@ -34,7 +34,7 @@ void testSubstitute() { include::{sourceDir}/micronaut-http-client/micronaut-http-client-gradle-kotlin/src/test/kotlin/example/micronaut/HelloControllerTest.kt[lines=16..-1] ----"""; assertEquals(expectedKotlin, resKotlin); - String resGroovy = testMacroSubstitution.substitute(str, "micronaut-http-client", new GuidesOption(BuildTool.GRADLE, Language.GROOVY, TestFramework.SPOCK)); + String resGroovy = testMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-http-client"), new GuidesOption(BuildTool.GRADLE, Language.GROOVY, TestFramework.SPOCK)); String expectedGroovy = """ [source,groovy] .src/test/groovy/example/micronaut/HelloControllerSpec.groovy @@ -47,7 +47,7 @@ void testSubstitute() { @Test void TestSubstituteWithApp() { String str = "test:ApplicationTest[app=springboot]"; - String resJava = testMacroSubstitution.substitute(str, "spring-boot-to-micronaut-application-class", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); + String resJava = testMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("spring-boot-to-micronaut-application-class"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); String expectedJava = """ [source,java] .springboot/src/test/java/example/micronaut/ApplicationTest.java @@ -60,7 +60,7 @@ void TestSubstituteWithApp() { @Test void TestSubstituteWithTags(){ String str = "test:TeamConfigurationTest[tags=teamConfigClassNoBuilder;gettersandsetters]"; - String resJava = testMacroSubstitution.substitute(str, "micronaut-configuration", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); + String resJava = testMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-configuration"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); String expectedJava = """ [source,java] .src/test/java/example/micronaut/TeamConfigurationTest.java @@ -73,7 +73,7 @@ void TestSubstituteWithTags(){ @Test void TestSubstituteWithMultiple(){ String str = "test:TeamConfigurationTest[app=springboot,tags=teamConfigClassNoBuilder;gettersandsetters,indent=0]"; - String resJava = testMacroSubstitution.substitute(str, "micronaut-configuration", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); + String resJava = testMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-configuration"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); String expectedJava = """ [source,java] .springboot/src/test/java/example/micronaut/TeamConfigurationTest.java @@ -90,7 +90,7 @@ void TestSubstituteMultipleLines(){ test:TeamConfigurationTest[app=springboot,tags=teamConfigClassNoBuilder;gettersandsetters,indent=0] """; - String resJava = testMacroSubstitution.substitute(str, "micronaut-configuration", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); + String resJava = testMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-configuration"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); String expectedJava = """ Test diff --git a/buildSrc/src/test/java/io/micronaut/guides/core/TestResourceMacroSubstitutionTest.java b/buildSrc/src/test/java/io/micronaut/guides/core/TestResourceMacroSubstitutionTest.java index 0db9ad8b704..e95c64cec3d 100644 --- a/buildSrc/src/test/java/io/micronaut/guides/core/TestResourceMacroSubstitutionTest.java +++ b/buildSrc/src/test/java/io/micronaut/guides/core/TestResourceMacroSubstitutionTest.java @@ -18,7 +18,7 @@ public class TestResourceMacroSubstitutionTest { @Test void testSubstitute() { String str = "testResource:application-test.yml[tag=testcontainers]"; - String resJava = testResourceMacroSubstitution.substitute(str, "micronaut-metrics-oci", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); + String resJava = testResourceMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-metrics-oci"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); String expectedJava = """ [source,yaml] .src/test/resources/application-test.yml diff --git a/buildSrc/src/test/java/io/micronaut/guides/core/ZipIncludeMacroSubstitutionTest.java b/buildSrc/src/test/java/io/micronaut/guides/core/ZipIncludeMacroSubstitutionTest.java index 2907363dc9a..f64b47fcfcd 100644 --- a/buildSrc/src/test/java/io/micronaut/guides/core/ZipIncludeMacroSubstitutionTest.java +++ b/buildSrc/src/test/java/io/micronaut/guides/core/ZipIncludeMacroSubstitutionTest.java @@ -21,7 +21,7 @@ void testSubstitute() { A fast way to start using Kafka is https://hub.docker.com/r/confluentinc/cp-kafka/[via Docker]. Create this `docker-compose.yml` file: zipInclude:docker/docker-compose.yml[]"""; - String resJava = zipIncludeMacroSubstitution.substitute(str, "micronaut-kafka", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); + String resJava = zipIncludeMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("micronaut-kafka"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); String expectedJava = """ A fast way to start using Kafka is https://hub.docker.com/r/confluentinc/cp-kafka/[via Docker]. Create this `docker-compose.yml` file: @@ -36,7 +36,7 @@ void testSubstitute() { @Test void testSubstituteWithPath() { String str = "zipInclude:../ttfr.sh[]"; - String resJava = zipIncludeMacroSubstitution.substitute(str, "executable-jar", new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); + String resJava = zipIncludeMacroSubstitution.substitute(str, GuideTestUtils.guideWithSlug("executable-jar"), new GuidesOption(BuildTool.GRADLE, Language.JAVA, TestFramework.JUNIT)); String expectedJava = """ [source,sh] .ttfr.sh diff --git a/buildSrc/src/test/resources/metadata-diff.json b/buildSrc/src/test/resources/metadata-diff.json new file mode 100644 index 00000000000..55d4c95f9d5 --- /dev/null +++ b/buildSrc/src/test/resources/metadata-diff.json @@ -0,0 +1,24 @@ +{ + "title": "Publishing and subscribing to MQTT Topics from a Micronaut Application", + "intro": "Learn how to use Mosquitto as an MQTT broker, create a Micronaut CLI application and publish an MQTT topic, and subscribe to the MQTT topic in a different Micronaut Messaging application.", + "authors": ["Sergio del Amo"], + "tags": ["messaging"], + "categories": ["Messaging"], + "publicationDate": "2022-03-14", + "apps": [ + { + "applicationType": "messaging", + "name": "app", + "features": ["yaml","graalvm", "mqtt"], + "javaFeatures": [ "awaitility"], + "kotlinFeatures": [ "awaitility"] + }, + { + "applicationType": "cli", + "name": "cli", + "features": ["yaml","graalvm", "mqtt"], + "javaFeatures": [ "awaitility"], + "kotlinFeatures": [ "awaitility", "kapt"] + } + ] +} diff --git a/guides/micronaut-database-authentication-provider/micronaut-database-authentication-provider.adoc b/guides/micronaut-database-authentication-provider/micronaut-database-authentication-provider.adoc index 743cea52a9f..e072a10a9d8 100644 --- a/guides/micronaut-database-authentication-provider/micronaut-database-authentication-provider.adoc +++ b/guides/micronaut-database-authentication-provider/micronaut-database-authentication-provider.adoc @@ -12,6 +12,8 @@ common:create-app-features.adoc[] common:default-package.adoc[] +common:diff.adoc[] + diffLink:[featureExcludes=spring-security-crypto] https://guides.micronaut.io/latest/micronaut-intellij-idea-ide-setup.html[Setup IntelliJ IDEA to develop Micronaut Applications]. diff --git a/guides/micronaut-dynamodb/micronaut-dynamodb.adoc b/guides/micronaut-dynamodb/micronaut-dynamodb.adoc index 250aaed3aac..928ead7b029 100644 --- a/guides/micronaut-dynamodb/micronaut-dynamodb.adoc +++ b/guides/micronaut-dynamodb/micronaut-dynamodb.adoc @@ -30,7 +30,7 @@ common:build-lang-arguments.adoc[] common:default-package.adoc[] -diffLink:[] +common:diff-general.adoc[] === Dynamo DB Dependencies diff --git a/guides/micronaut-google-cloud-http-function/micronaut-google-cloud-http-function.adoc b/guides/micronaut-google-cloud-http-function/micronaut-google-cloud-http-function.adoc index 717970313d5..27177d3422b 100644 --- a/guides/micronaut-google-cloud-http-function/micronaut-google-cloud-http-function.adoc +++ b/guides/micronaut-google-cloud-http-function/micronaut-google-cloud-http-function.adoc @@ -30,7 +30,7 @@ common:build-lang-arguments.adoc[] common:default-package.adoc[] -diffLink:[] +common:diff-general.adoc[] === Runtime diff --git a/guides/micronaut-k8s/micronaut-k8s.adoc b/guides/micronaut-k8s/micronaut-k8s.adoc index aca9cbc90ea..e7239b60657 100644 --- a/guides/micronaut-k8s/micronaut-k8s.adoc +++ b/guides/micronaut-k8s/micronaut-k8s.adoc @@ -51,6 +51,8 @@ If you use Micronaut Launch, select Micronaut Application as application type an The previous command creates a directory named _users_ containing Micronaut application with a package named `example.micronaut`. +common:diff.adoc[] + diffLink:[app=users] Create a package named `controllers` and create a `UsersController` class to handle incoming HTTP requests for the `users` microservice: @@ -213,6 +215,8 @@ If you use Micronaut Launch, select Micronaut Application as application type an The previous command creates a directory named _orders_ containing a Micronaut application with a package named `example.micronaut`. +common:diff.adoc[] + diffLink:[app=orders] Create package named `controllers` and create the `OrdersController` and `ItemsController` classes to handle incoming HTTP requests to the `orders` microservice: @@ -401,6 +405,8 @@ If you use Micronaut Launch, select Micronaut Application as application type an The previous command creates a directory named _api_ containing a Micronaut application with a package named `example.micronaut`. +common:diff.adoc[] + diffLink:[app=api] Create a package named `controllers` and create a `GatewayController` class to handle incoming HTTP requests to the `api` microservice: diff --git a/guides/micronaut-microservices-services-discover-consul/micronaut-microservices-services-discover-consul.adoc b/guides/micronaut-microservices-services-discover-consul/micronaut-microservices-services-discover-consul.adoc index 566150c670f..3b62b170b12 100644 --- a/guides/micronaut-microservices-services-discover-consul/micronaut-microservices-services-discover-consul.adoc +++ b/guides/micronaut-microservices-services-discover-consul/micronaut-microservices-services-discover-consul.adoc @@ -67,6 +67,8 @@ If you use Micronaut Launch, select Micronaut Application as application type an The previous command creates a directory named `bookcatalogue` and a Micronaut application inside it with default package `example.micronaut`. +common:diff.adoc[] + diffLink:[app=bookcatalogue] Create a `BooksController` class to handle incoming HTTP requests into the `bookcatalogue` microservice: @@ -148,6 +150,8 @@ If you use Micronaut Launch, select Micronaut Application as application type an The previous command creates a directory named `bookinventory` and a Micronaut application inside it with default package `example.micronaut`. +common:diff.adoc[] + diffLink:[app=bookinventory] Create a Controller: @@ -223,6 +227,8 @@ If you use Micronaut Launch, select Micronaut Application as application type an The previous command creates a directory named `bookrecommendation` and a Micronaut application inside it with default package `example.micronaut`. +common:diff.adoc[] + diffLink:[app=bookrecommendation] Create an interface to map operations with `bookcatalogue`, and a Micronaut Declarative HTTP Client to consume it. diff --git a/guides/micronaut-microservices-services-discover-eureka/micronaut-microservices-services-discover-eureka.adoc b/guides/micronaut-microservices-services-discover-eureka/micronaut-microservices-services-discover-eureka.adoc index e9777b4b2b6..a8f5ade4275 100644 --- a/guides/micronaut-microservices-services-discover-eureka/micronaut-microservices-services-discover-eureka.adoc +++ b/guides/micronaut-microservices-services-discover-eureka/micronaut-microservices-services-discover-eureka.adoc @@ -51,6 +51,8 @@ If you use Micronaut Launch, select Micronaut Application as application type an The previous command creates a directory named `bookcatalogue` and a Micronaut application inside it with default package `example.micronaut`. +common:diff.adoc[] + diffLink:[app=bookcatalogue] Create a `BooksController` class to handle incoming HTTP requests into the `bookcatalogue` microservice: @@ -132,6 +134,8 @@ If you use Micronaut Launch, select Micronaut Application as application type an The previous command creates a directory named `bookinventory` and a Micronaut application inside it with default package `example.micronaut`. +common:diff.adoc[] + diffLink:[app=bookinventory] Create a Controller: @@ -207,6 +211,8 @@ If you use Micronaut Launch, select Micronaut Application as application type an The previous command creates a directory named `bookrecommendation` and a Micronaut application inside it with default package `example.micronaut`. +common:diff.adoc[] + diffLink:[app=bookrecommendation] Create an interface to map operations with `bookcatalogue`, and a Micronaut Declarative HTTP Client to consume it. diff --git a/guides/micronaut-mqtt/micronaut-mqtt.adoc b/guides/micronaut-mqtt/micronaut-mqtt.adoc index 987f98138c1..02926032c15 100644 --- a/guides/micronaut-mqtt/micronaut-mqtt.adoc +++ b/guides/micronaut-mqtt/micronaut-mqtt.adoc @@ -25,6 +25,8 @@ Rename this `micronautguide` directory to `cli`. If you use Micronaut Launch, select Micronaut Application as application type and add @cli:features-words@ features. +common:diff.adoc[] + diffLink:[app=cli] https://guides.micronaut.io/latest/micronaut-intellij-idea-ide-setup.html[Setup IntelliJ IDEA to develop Micronaut Applications]. @@ -90,6 +92,8 @@ Rename this `micronautguide` directory to `app`. If you use Micronaut Launch, select Micronaut Application as application type and add @app:features-words@ features. +common:diff.adoc[] + diffLink:[app=cli] https://guides.micronaut.io/latest/micronaut-intellij-idea-ide-setup.html[Setup IntelliJ IDEA to develop Micronaut Applications]. diff --git a/guides/micronaut-oracle-autonomous-db/micronaut-oracle-autonomous-db.adoc b/guides/micronaut-oracle-autonomous-db/micronaut-oracle-autonomous-db.adoc index 312312aaaf6..6099b853a02 100644 --- a/guides/micronaut-oracle-autonomous-db/micronaut-oracle-autonomous-db.adoc +++ b/guides/micronaut-oracle-autonomous-db/micronaut-oracle-autonomous-db.adoc @@ -75,7 +75,7 @@ common:build-lang-arguments.adoc[] common:default-package.adoc[] -diffLink:[] +common:diff-general.adoc[] https://guides.micronaut.io/latest/micronaut-intellij-idea-ide-setup.html[Setup IntelliJ IDEA to develop Micronaut Applications]. diff --git a/guides/micronaut-oracle-function-http/micronaut-oracle-function-http.adoc b/guides/micronaut-oracle-function-http/micronaut-oracle-function-http.adoc index 5019d7c1f7d..e8004cf21b4 100644 --- a/guides/micronaut-oracle-function-http/micronaut-oracle-function-http.adoc +++ b/guides/micronaut-oracle-function-http/micronaut-oracle-function-http.adoc @@ -28,6 +28,8 @@ If you use https://launch.micronaut.io[Micronaut Launch], select "Micronaut Appl common:default-package.adoc[] +common:diff.adoc[] + diffLink:[featureExcludes=oci-java-sdk-core] https://guides.micronaut.io/latest/micronaut-intellij-idea-ide-setup.html[Setup IntelliJ IDEA to develop Micronaut Applications]. diff --git a/guides/micronaut-oracle-function/micronaut-oracle-function.adoc b/guides/micronaut-oracle-function/micronaut-oracle-function.adoc index e6ff6136134..8f85d215e1f 100644 --- a/guides/micronaut-oracle-function/micronaut-oracle-function.adoc +++ b/guides/micronaut-oracle-function/micronaut-oracle-function.adoc @@ -28,7 +28,7 @@ If you use https://launch.micronaut.io[Micronaut Launch], select "Function Appli common:default-package.adoc[] -diffLink:[] +common:diff-general.adoc[] https://guides.micronaut.io/latest/micronaut-intellij-idea-ide-setup.html[Setup IntelliJ IDEA to develop Micronaut Applications]. diff --git a/guides/micronaut-rabbitmq-rpc/micronaut-rabbitmq-rpc.adoc b/guides/micronaut-rabbitmq-rpc/micronaut-rabbitmq-rpc.adoc index df0523ed0e9..6024ea39a6d 100644 --- a/guides/micronaut-rabbitmq-rpc/micronaut-rabbitmq-rpc.adoc +++ b/guides/micronaut-rabbitmq-rpc/micronaut-rabbitmq-rpc.adoc @@ -44,6 +44,8 @@ If you use Micronaut Launch, select Micronaut Application as application type an The previous command creates a directory named `bookcatalogue` and a Micronaut application inside it with default package `example.micronaut`. +common:diff.adoc[] + diffLink:[app=bookcatalogue] ==== Create RabbitMQ exchange, queue, and binding @@ -94,6 +96,8 @@ If you use Micronaut Launch, select Micronaut Application as application type an The previous command creates a directory named `bookinventory` and a Micronaut application inside it with default package `example.micronaut`. +common:diff.adoc[] + diffLink:[app=bookinventory] The previous command creates a directory named `bookinventory` and a Micronaut application inside it with default package `example.micronaut`. @@ -130,6 +134,8 @@ If you use Micronaut Launch, select Micronaut Application as application type an The previous command creates a directory named `bookrecommendation` and a Micronaut application inside it with default package `example.micronaut`. +common:diff.adoc[] + diffLink:[app=bookrecommendation] ==== Create RabbitMQ exchange, queue and binding diff --git a/guides/micronaut-security-jwt-cookie/micronaut-security-jwt-cookie.adoc b/guides/micronaut-security-jwt-cookie/micronaut-security-jwt-cookie.adoc index 914632bcb0f..690095ebf7b 100644 --- a/guides/micronaut-security-jwt-cookie/micronaut-security-jwt-cookie.adoc +++ b/guides/micronaut-security-jwt-cookie/micronaut-security-jwt-cookie.adoc @@ -27,6 +27,8 @@ If you use Micronaut Launch, select Micronaut Application as application type an common:default-package.adoc[] +common:diff.adoc[] + diffLink:[featureExcludes=geb] https://guides.micronaut.io/latest/micronaut-intellij-idea-ide-setup.html[Setup IntelliJ IDEA to develop Micronaut Applications]. diff --git a/guides/micronaut-security-session/micronaut-security-session.adoc b/guides/micronaut-security-session/micronaut-security-session.adoc index 9a97ad6297f..a76ca7da4c6 100644 --- a/guides/micronaut-security-session/micronaut-security-session.adoc +++ b/guides/micronaut-security-session/micronaut-security-session.adoc @@ -27,6 +27,8 @@ If you use Micronaut Launch, select "Micronaut Application" as application type common:default-package.adoc[] +common:diff.adoc[] + diffLink:[featureExcludes=geb] https://guides.micronaut.io/latest/micronaut-intellij-idea-ide-setup.html[Setup IntelliJ IDEA to develop Micronaut Applications]. diff --git a/guides/micronaut-security-x509/micronaut-security-x509.adoc b/guides/micronaut-security-x509/micronaut-security-x509.adoc index cec026eb573..4dc0b04e472 100644 --- a/guides/micronaut-security-x509/micronaut-security-x509.adoc +++ b/guides/micronaut-security-x509/micronaut-security-x509.adoc @@ -253,7 +253,7 @@ common:build-lang-arguments.adoc[] common:default-package.adoc[] -diffLink:[] +common:diff-general.adoc[] https://guides.micronaut.io/latest/micronaut-intellij-idea-ide-setup.html[Setup IntelliJ IDEA to develop Micronaut Applications]. diff --git a/src/docs/common/snippets/common-create-app-features-h2.adoc b/src/docs/common/snippets/common-create-app-features-h2.adoc index 9eae856f29d..6e7e368286d 100644 --- a/src/docs/common/snippets/common-create-app-features-h2.adoc +++ b/src/docs/common/snippets/common-create-app-features-h2.adoc @@ -16,6 +16,8 @@ common:default-package.adoc[] If you use Micronaut Launch, select Micronaut Application as application type and add @features-words@ features. +common:diff.adoc[] + diffLink:[app=h2] https://guides.micronaut.io/latest/micronaut-intellij-idea-ide-setup.html[Setup IntelliJ IDEA to develop Micronaut Applications]. diff --git a/src/docs/common/snippets/common-create-app-features-testcontainers.adoc b/src/docs/common/snippets/common-create-app-features-testcontainers.adoc index b563c3d0a7e..6f326172a95 100644 --- a/src/docs/common/snippets/common-create-app-features-testcontainers.adoc +++ b/src/docs/common/snippets/common-create-app-features-testcontainers.adoc @@ -16,6 +16,8 @@ common:default-package.adoc[] If you use Micronaut Launch, select Micronaut Application as application type and add @testcontainers:features-words@ features. +common:diff.adoc[] + diffLink:[app=testcontainers] https://guides.micronaut.io/latest/micronaut-intellij-idea-ide-setup.html[Setup IntelliJ IDEA to develop Micronaut Applications]. diff --git a/src/docs/common/snippets/common-create-app-features.adoc b/src/docs/common/snippets/common-create-app-features.adoc index a085f80015e..cad95adfade 100644 --- a/src/docs/common/snippets/common-create-app-features.adoc +++ b/src/docs/common/snippets/common-create-app-features.adoc @@ -17,6 +17,6 @@ common:default-package.adoc[] If you use Micronaut Launch, select Micronaut Application as application type and add @features-words@ features. -diffLink:[] +common:diff-general.adoc[] https://guides.micronaut.io/latest/micronaut-intellij-idea-ide-setup.html[Setup IntelliJ IDEA to develop Micronaut Applications]. diff --git a/src/docs/common/snippets/common-diff-general.adoc b/src/docs/common/snippets/common-diff-general.adoc new file mode 100644 index 00000000000..bf0fdbc059a --- /dev/null +++ b/src/docs/common/snippets/common-diff-general.adoc @@ -0,0 +1,3 @@ +common:diff.adoc[] + +diffLink:[] diff --git a/src/docs/common/snippets/common-diff.adoc b/src/docs/common/snippets/common-diff.adoc new file mode 100644 index 00000000000..f05422bf473 --- /dev/null +++ b/src/docs/common/snippets/common-diff.adoc @@ -0,0 +1,3 @@ +NOTE: If you have an existing Micronaut application and want to add the functionality described here, you can view the dependency and configuration changes from the specified features, and apply those changes to your application. + +